|
@@ -28,7 +28,7 @@
|
|
|
<div v-for="(item,index) in v.pointList" :key="item.pointId">
|
|
<div v-for="(item,index) in v.pointList" :key="item.pointId">
|
|
|
<van-cell :title="item.pointName">
|
|
<van-cell :title="item.pointName">
|
|
|
<template #right-icon>
|
|
<template #right-icon>
|
|
|
- <img v-if="enable && item.nfcList.length > 0" :src="require('../../../assets/svg/NFC.svg')" class="nfc-icon" @click="clickNFC(item.nfcList)"/>
|
|
|
|
|
|
|
+ <img v-if="enable && item.nfcList && item.nfcList.length > 0" :src="require('../../../assets/svg/NFC.svg')" class="nfc-icon" @click="clickNFC(item.nfcList)"/>
|
|
|
<van-switch
|
|
<van-switch
|
|
|
v-if="enable"
|
|
v-if="enable"
|
|
|
style="margin-left: 10px;"
|
|
style="margin-left: 10px;"
|
|
@@ -46,7 +46,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
</van-cell>
|
|
</van-cell>
|
|
|
<van-cell-group v-show="item.status">
|
|
<van-cell-group v-show="item.status">
|
|
|
- <van-cell v-show="item.nfcList.length > 0" :border="false" >
|
|
|
|
|
|
|
+ <van-cell v-if="item.nfcList && item.nfcList.length > 0" :border="false" >
|
|
|
<div v-if="img.img" class="nfc-img" v-for="(img,i) in item.nfcList" :key="img.img" @click="preViewNFC(i)">
|
|
<div v-if="img.img" class="nfc-img" v-for="(img,i) in item.nfcList" :key="img.img" @click="preViewNFC(i)">
|
|
|
<img :src="imgUrl(img.img)" alt="" >
|
|
<img :src="imgUrl(img.img)" alt="" >
|
|
|
<span>{{img.checkName}}</span>
|
|
<span>{{img.checkName}}</span>
|
|
@@ -164,36 +164,33 @@ export default {
|
|
|
handler(val){
|
|
handler(val){
|
|
|
console.log(val,'val')
|
|
console.log(val,'val')
|
|
|
if(!val)return
|
|
if(!val)return
|
|
|
-
|
|
|
|
|
- val.forEach((valItem) => {
|
|
|
|
|
|
|
+ let str = JSON.parse(JSON.stringify(val));
|
|
|
|
|
+ str.forEach((valItem) => {
|
|
|
// 查找是否有与 valItem.itemId 相同的项
|
|
// 查找是否有与 valItem.itemId 相同的项
|
|
|
const existingItem = this.checkList.find((checkItem) => checkItem.itemId === valItem.itemId);
|
|
const existingItem = this.checkList.find((checkItem) => checkItem.itemId === valItem.itemId);
|
|
|
-
|
|
|
|
|
if (existingItem) {
|
|
if (existingItem) {
|
|
|
- // 如果存在相同 itemId 的项,查找 pointList 是否有与 valItem.pointId 相同的项
|
|
|
|
|
|
|
+ // // 如果存在相同 itemId 的项,查找 pointList 是否有与 valItem.pointId 相同的项
|
|
|
const existingPoint = existingItem.pointList.find((pointItem) => pointItem.pointId === valItem.id);
|
|
const existingPoint = existingItem.pointList.find((pointItem) => pointItem.pointId === valItem.id);
|
|
|
-
|
|
|
|
|
if (!existingPoint) {
|
|
if (!existingPoint) {
|
|
|
console.log(existingItem,'point添加成功')
|
|
console.log(existingItem,'point添加成功')
|
|
|
- // 如果不存在相同 pointId 的项,将 valItem 添加到 pointList 中
|
|
|
|
|
- existingItem.pointList.push({
|
|
|
|
|
- pointId: valItem.id,
|
|
|
|
|
- pointName: valItem.pointName,
|
|
|
|
|
- mustCheck: valItem.checked ? 1 : 0,
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ this.$nextTick(()=>{
|
|
|
|
|
+ existingItem.pointList.push(valItem);
|
|
|
|
|
+ })
|
|
|
|
|
+ }else {
|
|
|
|
|
+ this.$toast('该检查项已添加');
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
console.log(valItem,'item添加成功')
|
|
console.log(valItem,'item添加成功')
|
|
|
- // 如果不存在相同 itemId 的项,创建一个新的项并添加到 checkList 数组中
|
|
|
|
|
- this.checkList.push({
|
|
|
|
|
- itemId: valItem.itemId,
|
|
|
|
|
- itemName: valItem.itemName,
|
|
|
|
|
- pointList: [valItem],
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ this.$nextTick(()=>{
|
|
|
|
|
+ this.checkList.push({
|
|
|
|
|
+ itemId: valItem.itemId,
|
|
|
|
|
+ itemName: valItem.itemName,
|
|
|
|
|
+ pointList: [valItem],
|
|
|
|
|
+ });
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
- deep:true
|
|
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
computed:{
|
|
computed:{
|
|
@@ -261,7 +258,9 @@ export default {
|
|
|
this.taskInfo.isSubmit = 0;
|
|
this.taskInfo.isSubmit = 0;
|
|
|
registerSubmit(this.taskInfo).then(res=>{
|
|
registerSubmit(this.taskInfo).then(res=>{
|
|
|
this.$toast('保存成功');
|
|
this.$toast('保存成功');
|
|
|
- this.$router.go(-1);
|
|
|
|
|
|
|
+ this.$router.replace ({
|
|
|
|
|
+ path:'/securityCheckRegister',
|
|
|
|
|
+ });
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
|
|
|
|
@@ -284,7 +283,9 @@ export default {
|
|
|
this.taskInfo.isSubmit = 1;
|
|
this.taskInfo.isSubmit = 1;
|
|
|
registerSubmit(this.taskInfo).then(res=>{
|
|
registerSubmit(this.taskInfo).then(res=>{
|
|
|
this.$toast('提交成功');
|
|
this.$toast('提交成功');
|
|
|
- this.$router.go(-1);
|
|
|
|
|
|
|
+ this.$router.replace ({
|
|
|
|
|
+ path:'/securityCheckRegister',
|
|
|
|
|
+ });
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
|
|
|
|
@@ -325,7 +326,7 @@ export default {
|
|
|
//切换开关时添加操作时间
|
|
//切换开关时添加操作时间
|
|
|
switchChange(item){
|
|
switchChange(item){
|
|
|
console.log(item,'666')
|
|
console.log(item,'666')
|
|
|
- item.resTime = formatDate(new Date());
|
|
|
|
|
|
|
+ //item.resTime = formatDate(new Date());
|
|
|
},
|
|
},
|
|
|
//添加图片时的回调
|
|
//添加图片时的回调
|
|
|
changeNfcImg(imgItem){
|
|
changeNfcImg(imgItem){
|