From 550e401cd64dff2fc3cae9fa26da5f8bdba7a14a Mon Sep 17 00:00:00 2001 From: pengwei Date: Mon, 7 Jul 2025 17:19:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:1=E3=80=81=E6=8A=BD=E6=A3=80=E4=BA=BA?= =?UTF-8?q?=E5=91=98=E5=BF=85=E5=A1=AB=E9=A1=B9=202=E3=80=81=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E7=9D=A3=E5=AF=9F=E4=BA=BA=E5=91=98=E5=9B=9E=E6=98=BE?= =?UTF-8?q?=203=E3=80=81=E6=8A=BD=E6=A3=80=E4=BA=BA=E5=91=98=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E8=8C=83=E5=9B=B4=E6=8A=A5=E9=94=99=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=204=E3=80=81=E6=8A=BD=E6=A3=80=E4=BA=BA=E6=95=B0=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=8F=A0=E5=8A=A0=E2=80=9C=E8=A2=AB=E6=8A=BD=E6=A3=80?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=E2=80=9D=E5=A1=AB=E5=86=99=E7=9A=84=E4=BA=BA?= =?UTF-8?q?=E6=95=B0=205=E3=80=81=E5=8D=95=E9=80=89=E6=A1=86=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=8F=96=E6=B6=88=206=E3=80=81=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E6=9C=89=E4=B8=80=E6=9D=A1=E8=A2=AB=E6=8A=BD=E6=A3=80=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mobileSupervise/police-sampling.vue | 279 ++++++++++++++++++ src/components/police-picker.vue | 71 ++++- src/views/mobileSupervise/Inspection.vue | 5 +- src/views/mobileSupervise/Sampling.vue | 190 +++++++++--- 4 files changed, 484 insertions(+), 61 deletions(-) create mode 100644 src/components/mobileSupervise/police-sampling.vue 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 @@