diff --git a/src/api/rightsComfort/rights.ts b/src/api/rightsComfort/rights.ts index faa850a..eae41a1 100644 --- a/src/api/rightsComfort/rights.ts +++ b/src/api/rightsComfort/rights.ts @@ -9,6 +9,13 @@ export function listRights(query) { } +export function getInfringerData(id){ + return request.get({ + url:`/rights/getInfringerData/${id}` + }) +} + + export function delRights(id){ return request.del({ url:`/rights/${id}` diff --git a/src/components/mobileSupervise/police-sampling.vue b/src/components/mobileSupervise/police-sampling.vue index 03a5687..f1f0f65 100644 --- a/src/components/mobileSupervise/police-sampling.vue +++ b/src/components/mobileSupervise/police-sampling.vue @@ -173,10 +173,7 @@ const query = ref({ departBranch: true }); -watch(() => props.departId, (val) => { - query.value.departId = val; - getList() -}) + const total = ref(0); const ableRef =ref(null) const treeData = catchSotre.getDepartsAll(); @@ -186,7 +183,6 @@ function getList() { loading.value = true listPolice(query.value).then((data) => { polices.value = data.records; - console.log('polices',polices) setCheckFun(data.records) total.value = data.total; loading.value = false @@ -195,11 +191,11 @@ function getList() { const setCheckFun =(row)=>{ - console.log('checkPolices.value',checkPolices.value) row.forEach((s)=>{ let data =checkPolices.value.find(x=> x.empNo === s.empNo ) + if(data){ nextTick(()=>{ ableRef.value.toggleRowSelection(s, true); @@ -212,7 +208,12 @@ const setCheckFun =(row)=>{ const checkPolices = ref([]); const checkPolicesMap =ref([]) function selectionChange(selectionRows) { - + if(checkPolicesMap.value['key-0']){ + //判断data中有无select的数据 + const {intersection, filteredSource} = processIntersection( checkPolicesMap.value['key-0'],selectionRows,'empNo') + checkPolicesMap.value['key-0']=filteredSource; + checkPolicesMap.value['key'+query.value.current] = intersection; + } if( checkPolicesMap.value['key'+query.value.current]){ let data = checkPolicesMap.value['key'+query.value.current]; @@ -227,6 +228,22 @@ function selectionChange(selectionRows) { } +/** + * 获取两个对象数组的交集,并从源数组中剔除交集数据 + * @param {Array} sourceArr 源数组(需要剔除交集的数组) + * @param {Array} targetArr 目标数组 + * @param {String} key 比较的键名(默认'id') + * @returns {Object} { intersection: 交集数组, filteredSource: 剔除后的源数组 } + */ +const processIntersection = (sourceArr, targetArr, key = 'id') => { + //获取交集数据 + const targetKeys = new Set(targetArr.map(item => item[key])); + const intersection = sourceArr.filter(item => targetKeys.has(item[key])); + // 剔除交集数据 + const filteredSource = sourceArr.filter(item => !targetKeys.has(item[key])); + return { intersection, filteredSource }; +} + const getCheckData = (data,selectionRows) =>{ selectionRows.forEach(item => { @@ -263,8 +280,23 @@ function submit() { emit('update:modelValue', checkPolices.value) show.value = false } -watch(()=>props.modelValue,()=>{ +watch(() => props.departId, (val) => { + query.value.departId = val; + getList() +}) +watch(() => show.value, (val) => { + if(val){ + setCheckFun(polices.value) + } +}) +watch(()=>props.modelValue,(val)=>{ checkPolices.value=props.modelValue + if(val){ + checkPolicesMap.value['key-0']=getCheckData(val,props.modelValue); + if(polices.value){ + setCheckFun(polices.value) + } + } },{deep:true,immediate:true}) diff --git a/src/views/books/Audit.vue b/src/views/books/Audit.vue index 5f23db9..3ba63a1 100644 --- a/src/views/books/Audit.vue +++ b/src/views/books/Audit.vue @@ -329,6 +329,12 @@ function reset() { getList(); function handleExport() { + if(query.value.discoveryTime == null){ + delete query.value.discoveryTime; + } + if(query.value.crtTime== null){ + delete query.value.crtTime; + } window.open( `${BASE_PATH}/negative/books/export/audit?` + new URLSearchParams(query.value).toString() diff --git a/src/views/rightsComfort/Rights.vue b/src/views/rightsComfort/Rights.vue index d5e88cc..741aaa7 100644 --- a/src/views/rightsComfort/Rights.vue +++ b/src/views/rightsComfort/Rights.vue @@ -30,10 +30,25 @@ + + + + + + + + + + + + + +
+ 数据导出