|
|
@@ -27,16 +27,16 @@
|
|
|
/>
|
|
|
</van-cell-group>
|
|
|
</div>
|
|
|
- <!-- 搜索框 -->
|
|
|
- <van-search v-model="itemName" class="van-hairline--bottom" placeholder="请输入检查项名称"/>
|
|
|
<!-- 检查项目 -->
|
|
|
<fieldset class="fieldset" :disabled="!enable">
|
|
|
<div class="card">
|
|
|
<p class="legend">检查项目 <span v-if="enable" @click="addCheck">添加检查内容</span></p>
|
|
|
+ <!-- 搜索框 -->
|
|
|
+ <van-search v-model="itemName" class="van-hairline--top" placeholder="请输入检查项名称" />
|
|
|
<van-collapse v-model="activeNames" v-for="v in resultList" :key="v.itemId">
|
|
|
<van-collapse-item :title="v.itemName" :name="v.itemName">
|
|
|
- <div v-for="(item, index) in v.pointList" :key="item.pointId">
|
|
|
- <van-cell>
|
|
|
+ <div v-for="(item, index) in v.pointList" :key="item.pointId" class="collapse-box" :class="{'van-hairline--bottom':item.status}">
|
|
|
+ <van-cell :border="Boolean(item.status)">
|
|
|
<template #title>
|
|
|
<pre>{{ item.pointName }}</pre>
|
|
|
</template>
|
|
|
@@ -86,22 +86,23 @@
|
|
|
v-model="item.remark"
|
|
|
rows="1"
|
|
|
autosize
|
|
|
- label="情况描述:"
|
|
|
+ label="情况描述"
|
|
|
type="textarea"
|
|
|
placeholder="请输入(255字以内)"
|
|
|
/>
|
|
|
<select-cell
|
|
|
required
|
|
|
:disabled="!enable"
|
|
|
+ is-row
|
|
|
title="整改期限"
|
|
|
v-model="item.rectificationDeadline"
|
|
|
- :data-list="getDictItem('rectification_deadline')"
|
|
|
+ :data-list="dateList"
|
|
|
/>
|
|
|
<div class="upload-box">
|
|
|
<uploader v-if="enable" :maxCount="5" v-model="item.imgData" />
|
|
|
<van-cell v-else-if="item.imgData">
|
|
|
<div
|
|
|
- class="nfc-img van-hairline--surround"
|
|
|
+ class="nfc-img"
|
|
|
v-for="(v, i) in item.imgData"
|
|
|
:key="v.imgPath"
|
|
|
@click="clickWarnImage(item.imgData, i)"
|
|
|
@@ -184,6 +185,7 @@ export default {
|
|
|
showPreView: false,
|
|
|
selected: null,
|
|
|
active: true,
|
|
|
+ dateList:[],
|
|
|
go: {
|
|
|
type: 'replace',
|
|
|
path: '/securityCheckRegister'
|
|
|
@@ -238,19 +240,18 @@ export default {
|
|
|
return false
|
|
|
}
|
|
|
},
|
|
|
+ //获取NFC已扫描数据
|
|
|
getNfcState(arr){
|
|
|
arr = arr || [];
|
|
|
- let num = 0;
|
|
|
- arr.forEach(v=>{
|
|
|
- if(v.status === 1){
|
|
|
- num++
|
|
|
- }
|
|
|
- })
|
|
|
- return num;
|
|
|
+ let nums = arr.filter(v=>{return v.status === 1});
|
|
|
+ return nums.length;
|
|
|
},
|
|
|
+ //调用nfc
|
|
|
checkNFC(){
|
|
|
+ //设置nfc调用后的回调
|
|
|
window.openNFCScanCallBack = this.openNFCScanCallBack;
|
|
|
- this.useNFC();
|
|
|
+
|
|
|
+ //设置loading弹窗
|
|
|
this.$toast.loading({
|
|
|
duration: 0, // 持续展示 toast
|
|
|
position: 'top',
|
|
|
@@ -270,9 +271,12 @@ export default {
|
|
|
}
|
|
|
}, 1000);
|
|
|
|
|
|
+ //挂载nfc
|
|
|
+ this.useNFC();
|
|
|
},
|
|
|
-
|
|
|
+ //调用nfc后的回调
|
|
|
openNFCScanCallBack(nfcStr){
|
|
|
+ //alert(JSON.stringify(nfcStr))
|
|
|
clearInterval(this.timer);
|
|
|
let nfcCode = '';
|
|
|
try{
|
|
|
@@ -286,45 +290,28 @@ export default {
|
|
|
//alert(nfcCode)
|
|
|
this.checkNfcFilter(nfcCode);
|
|
|
},
|
|
|
-
|
|
|
+ //验证nfc数据
|
|
|
checkNfcFilter(nfcCode){
|
|
|
- let areaId = null;
|
|
|
+ //let areaId = null;
|
|
|
let checkOk = false;
|
|
|
+ //alert(JSON.stringify(this.NFCList,'NFCList'));
|
|
|
this.NFCList.forEach(v => {
|
|
|
if(v.nfcCode === nfcCode){
|
|
|
- areaId = v.areaId;
|
|
|
- this.switchArea(areaId);
|
|
|
if(v.status === 1){
|
|
|
this.$toast.fail('NFC点位:' + v.nfcName + '已扫描,请勿重复扫描!');
|
|
|
throw new Error('NFC点位:' + v.nfcName + '已扫描,请勿重复扫描!');
|
|
|
}
|
|
|
v.status = 1;
|
|
|
v.scanMethod = 0;
|
|
|
- v.submitTime = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
|
- v.submitBy = this.id;
|
|
|
- this.$toast.success('NFC点位:' + v.nfcName + '扫描成功!');
|
|
|
+ this.$toast('NFC点位:' + v.nfcName + '扫描成功!');
|
|
|
checkOk = true;
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
- if(checkOk){
|
|
|
- this.yesNFCnums++
|
|
|
- this.resumptionData.yesNFCNums++
|
|
|
- this.resumptionData.noNFCNums--
|
|
|
- }else{
|
|
|
- this.$toast.fail(nfcCode + ",不在本次履职范围内!");
|
|
|
+ if(!checkOk){
|
|
|
+ this.$toast.fail( "扫描结果不在本次检查范围内!");
|
|
|
}
|
|
|
- this.validateArea(areaId)
|
|
|
- },
|
|
|
- switchArea(areaId){
|
|
|
- this.areas.forEach((area, i) => {
|
|
|
- if (areaId === area.areaId) {
|
|
|
- this.activeArea(area, i)
|
|
|
- }
|
|
|
- })
|
|
|
},
|
|
|
|
|
|
-
|
|
|
//是否显示nfc图标
|
|
|
nfcState(item){
|
|
|
if(item.nfcList && item.nfcList.length > 0){
|
|
|
@@ -334,6 +321,7 @@ export default {
|
|
|
}
|
|
|
return false
|
|
|
},
|
|
|
+
|
|
|
//格式化时间范围
|
|
|
formatTime(start,end,format){
|
|
|
format = format || 'YYYY-MM-DD'
|
|
|
@@ -382,9 +370,9 @@ export default {
|
|
|
return '#008cd6';
|
|
|
case '进行中':
|
|
|
return '#bc9f71';
|
|
|
- case '完成':
|
|
|
+ case '已完成':
|
|
|
return '#009240';
|
|
|
- case '已过期':
|
|
|
+ case '已逾期':
|
|
|
return '#D7000F';
|
|
|
}
|
|
|
},
|
|
|
@@ -412,6 +400,7 @@ export default {
|
|
|
this.taskInfo = res.data;
|
|
|
this.enable = this.taskInfo.status === 1 || this.taskInfo.status === 2; //是否可编辑
|
|
|
this.checkList = res.data.checkList;
|
|
|
+ this.dateList = this.getDictItem('rectification_deadline');
|
|
|
//设置默认展开项
|
|
|
this.activeNames = this.checkList.map(v => v.itemName);
|
|
|
})
|
|
|
@@ -443,20 +432,21 @@ export default {
|
|
|
//提交数据
|
|
|
submitData() {
|
|
|
//验证必填项
|
|
|
- let pointData = []
|
|
|
- this.checkList.forEach(v => {
|
|
|
- v.pointList.forEach(item => {
|
|
|
- pointData.push(item)
|
|
|
- })
|
|
|
- })
|
|
|
+ let pointData = this.checkList.flatMap(v => v.pointList);
|
|
|
+ let allNfcList = pointData.flatMap(v=>v.nfcList);
|
|
|
+ let result = allNfcList.some(v=>v.status != 1);
|
|
|
+ //some函数的用法
|
|
|
+ if(result){
|
|
|
+ this.$toast('请先扫描NFC标签');
|
|
|
+ return;
|
|
|
+ }
|
|
|
let arr = pointData.filter(v => {
|
|
|
if (v.status === 1) {
|
|
|
return !v.remark || !v.rectificationDeadline
|
|
|
}
|
|
|
})
|
|
|
- if (arr.length) return this.$toast(`${arr[0].itemName}:该信息不完整请填写`)
|
|
|
- //console.log( this.taskInfo,' this.taskInfo')
|
|
|
- this.taskInfo.isSubmit = 1
|
|
|
+ if (arr.length) return this.$toast(`${arr[0].itemName}:该信息不完整请填写`);
|
|
|
+ this.taskInfo.isSubmit = 1;
|
|
|
registerSubmit(this.taskInfo).then(res => {
|
|
|
this.$toast('提交成功')
|
|
|
this.$router.replace({
|
|
|
@@ -563,6 +553,9 @@ export default {
|
|
|
margin-bottom: 0;
|
|
|
}
|
|
|
}
|
|
|
+ .collapse-box{
|
|
|
+ -padding-bottom: 10px;
|
|
|
+ }
|
|
|
.check-area {
|
|
|
background-color: #f1f1f1;
|
|
|
margin: 10px;
|
|
|
@@ -584,7 +577,7 @@ export default {
|
|
|
vertical-align: middle;
|
|
|
}
|
|
|
.upload-box {
|
|
|
- margin: 30px;
|
|
|
+ padding: 30px;
|
|
|
}
|
|
|
.warning-msg {
|
|
|
color: orange;
|