diff --git a/src/components/mobileSupervise/police-sampling.vue b/src/components/mobileSupervise/police-sampling.vue new file mode 100644 index 0000000..03a5687 --- /dev/null +++ b/src/components/mobileSupervise/police-sampling.vue @@ -0,0 +1,279 @@ + + + diff --git a/src/components/police-picker.vue b/src/components/police-picker.vue index aceede9..70eed03 100644 --- a/src/components/police-picker.vue +++ b/src/components/police-picker.vue @@ -47,6 +47,7 @@
props.departId, (val) => { query.value.departId = val; getList() }) const total = ref(0); - +const ableRef =ref(null) const treeData = catchSotre.getDepartsAll(); const polices = ref([]); const loading = ref(false) @@ -178,27 +181,69 @@ function getList() { listPolice(query.value).then((data) => { polices.value = data.records; console.log('polices',polices) + setCheckFun(data.records) total.value = data.total; loading.value = false }); } -const checkPolices = ref([]); +const setCheckFun =(row)=>{ + + row.forEach((s)=>{ + let data =checkPolices.value.find(x=>{ + return JSON.stringify(x) === JSON.stringify({ + name: s.name, + empNo: s.empNo, + idCode: s.idCode + }) + }); + if(data){ + nextTick(()=>{ + ableRef.value.toggleRowSelection(s, true); + }) + } + }) +} + + +const checkPolices = ref([]); +const checkPolicesMap =ref([]) function selectionChange(selectionRows) { - selectionRows.forEach(item => { - if (checkPolices.value.findIndex(o => o.empNo === item.empNo) === -1) { - checkPolices.value.push({ - name: item.name, - empNo: item.empNo, - idCode: item.idCode - }) - } else { - - } - }) + if( checkPolicesMap.value['key'+query.value.current]){ + let data = checkPolicesMap.value['key'+query.value.current]; + checkPolicesMap.value['key'+query.value.current]=getCheckData(data,selectionRows); + }else{ + checkPolicesMap.value['key'+query.value.current] =getCheckData([],selectionRows); + } + checkPolices.value=[] + for (let key in checkPolicesMap.value){ + checkPolices.value=checkPolices.value.concat(checkPolicesMap.value[key]) + } +} + +const getCheckData = (data,selectionRows) =>{ + selectionRows.forEach(item => { + if (data.findIndex(o => o.empNo === item.empNo) === -1) { + data.push({ + name: item.name, + empNo: item.empNo, + idCode: item.idCode + }) + } + }) + data.forEach((s,i)=>{ + if (selectionRows.findIndex(o => o.empNo === s.empNo) === -1){ + data.splice(i,1) + } + }) + return data; } + + + + function handleSelectDepart(node) { query.value.departId = node.id; getList(); diff --git a/src/views/mobileSupervise/Inspection.vue b/src/views/mobileSupervise/Inspection.vue index fba8ee1..2fbc03c 100644 --- a/src/views/mobileSupervise/Inspection.vue +++ b/src/views/mobileSupervise/Inspection.vue @@ -1603,6 +1603,7 @@ async function submit() { getList(); form.value = { files: [], + supervisionType :'日常督察', supRiskDtoList:[] }; } @@ -1622,10 +1623,10 @@ const getTaskType = (val) => { function handleShowAdd() { - form.value.supervisionType = '日常督察' show.value = true; form.value = { files: [], + supervisionType :'日常督察', supRiskDtoList:[] }; } @@ -1943,7 +1944,7 @@ watch(()=>form.value.supRiskDtoList,(newVal)=>{ * 获取重点督察人员表单 * */ watch(()=>activeRow.value.supRiskDtoList,(newVal)=>{ - if(activeRow.value.supRiskDtoList.length > 0){ + if(activeRow.value.supRiskDtoList && activeRow.value.supRiskDtoList.length > 0){ getRiskDataTableSubmit(); } diff --git a/src/views/mobileSupervise/Sampling.vue b/src/views/mobileSupervise/Sampling.vue index 60e1b85..b1674c2 100644 --- a/src/views/mobileSupervise/Sampling.vue +++ b/src/views/mobileSupervise/Sampling.vue @@ -1,11 +1,12 @@