|
|
@@ -86,7 +86,7 @@
|
|
|
v-model="item.remark"
|
|
|
rows="1"
|
|
|
autosize
|
|
|
- label="情况描述:"
|
|
|
+ label="情况描述"
|
|
|
type="textarea"
|
|
|
placeholder="请输入(255字以内)"
|
|
|
/>
|
|
|
@@ -96,7 +96,7 @@
|
|
|
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" />
|
|
|
@@ -185,6 +185,7 @@ export default {
|
|
|
showPreView: false,
|
|
|
selected: null,
|
|
|
active: true,
|
|
|
+ dateList:[],
|
|
|
go: {
|
|
|
type: 'replace',
|
|
|
path: '/securityCheckRegister'
|
|
|
@@ -239,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',
|
|
|
@@ -271,9 +271,12 @@ export default {
|
|
|
}
|
|
|
}, 1000);
|
|
|
|
|
|
+ //挂载nfc
|
|
|
+ this.useNFC();
|
|
|
},
|
|
|
-
|
|
|
+ //调用nfc后的回调
|
|
|
openNFCScanCallBack(nfcStr){
|
|
|
+ //alert(JSON.stringify(nfcStr))
|
|
|
clearInterval(this.timer);
|
|
|
let nfcCode = '';
|
|
|
try{
|
|
|
@@ -287,44 +290,27 @@ 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){
|
|
|
@@ -335,6 +321,7 @@ export default {
|
|
|
}
|
|
|
return false
|
|
|
},
|
|
|
+
|
|
|
//格式化时间范围
|
|
|
formatTime(start,end,format){
|
|
|
format = format || 'YYYY-MM-DD'
|
|
|
@@ -413,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);
|
|
|
})
|
|
|
@@ -444,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({
|