From a1822a104c165af0a6c3ca20b9b854c43e910846 Mon Sep 17 00:00:00 2001 From: lizijiee <562949697@qq.com> Date: Sat, 23 Mar 2024 14:27:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=202574=20=E3=80=90AI=E4=B8=80=E9=94=AE?= =?UTF-8?q?=E6=9F=A5=E9=87=8D--=E8=87=AA=E5=AE=9A=E4=B9=89=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E3=80=91=E5=8F=B3=E4=BE=A7=E7=AD=9B=E9=80=89=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E6=A8=A1=E5=9D=97=E7=82=B9=E5=87=BB=E6=B8=85=E7=A9=BA?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E5=90=8E=EF=BC=8C=E7=82=B9=E5=87=BB=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E6=8C=89=E9=92=AE=E5=85=B3=E9=97=AD=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=EF=BC=8C=E5=86=8D=E6=AC=A1=E6=89=93=E5=BC=80=E5=90=8E=E5=8F=B3?= =?UTF-8?q?=E4=BE=A7=E7=AD=9B=E9=80=89=E6=9D=A1=E4=BB=B6=E5=B7=B2=E8=A2=AB?= =?UTF-8?q?=E6=B8=85=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aside/comp/modals/CustomFilterModal.vue | 39 +++++++++++++------ 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/src/views/home/aside/comp/modals/CustomFilterModal.vue b/src/views/home/aside/comp/modals/CustomFilterModal.vue index f683320..88cd2fb 100644 --- a/src/views/home/aside/comp/modals/CustomFilterModal.vue +++ b/src/views/home/aside/comp/modals/CustomFilterModal.vue @@ -17,6 +17,18 @@ const selectIds = ref([]) function showModal() { show.value = true + + // 重置左右列表数据 + const config = configStore.getConfig + const customConfig = configStore.getCustomConfig + + if (config == null || customConfig == null) + return + const { showList, hideList } = generatList(config, customConfig) + onList.value = showList + offList.value = hideList + // 重置全选状态 + checkAll.value = hideList.every(item => item.checked); } function closeModal() { @@ -83,8 +95,9 @@ function generatList(config, customConfig) { fix: isDefaultFilter, checked: isChecked, }) - - isChecked && selectIds.value.push(key) + if (isChecked && selectIds.value.indexOf(key) === -1) { + isChecked && selectIds.value.push(key) + } } } @@ -156,7 +169,9 @@ function onCheckChange(checked: any, item: any) { if (index === -1 && checked) selectIds.value.push(item.id) else - selectIds.value.splice(index, 1) + index !== -1 && selectIds.value.splice(index, 1) + + checkAll.value = offList.value.every(item => item.checked); } const showIds = computed(() => { @@ -180,11 +195,13 @@ watch( if (action === 'add') { for (const item of offList.value) { if (!item.fix && diff.includes(item.id)) { - onList.value.push({ - id: item.id, - name: item.name || '未配置', - fix: item.fix || false, - }) + if (item.checked) { + onList.value.push({ + id: item.id, + name: item.name || '未配置', + fix: item.fix || false, + }) + } } } } @@ -248,15 +265,15 @@ const rightInputHandler = debounce((keyword) => { onKeyword.value = keyword }, 300) -async function getfield(){ +async function getfield() { let res; res = await getAllfieldList(3) const userStore = useUser(); const userInfo = userStore.getUserInfo; - res = await getfieldList(3,userInfo.id) + res = await getfieldList(3, userInfo.id) } -onMounted(()=>{ +onMounted(() => { getfield(); })