fix: 2574 【AI一键查重--自定义筛选】右侧筛选条件模块点击清空按钮后,点击取消按钮关闭弹窗,再次打开后右侧筛选条件已被清空

pull/1/head
lizijiee 2 years ago
parent ba1934bcc8
commit a1822a104c

@ -17,6 +17,18 @@ const selectIds = ref<string[]>([])
function showModal() { function showModal() {
show.value = true 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() { function closeModal() {
@ -83,10 +95,11 @@ function generatList(config, customConfig) {
fix: isDefaultFilter, fix: isDefaultFilter,
checked: isChecked, checked: isChecked,
}) })
if (isChecked && selectIds.value.indexOf(key) === -1) {
isChecked && selectIds.value.push(key) isChecked && selectIds.value.push(key)
} }
} }
}
onList = showKeys.reduce((acc, key) => { onList = showKeys.reduce((acc, key) => {
const isDefaultFilter = asideMap[key]?.isDefaultFilter const isDefaultFilter = asideMap[key]?.isDefaultFilter
@ -156,7 +169,9 @@ function onCheckChange(checked: any, item: any) {
if (index === -1 && checked) if (index === -1 && checked)
selectIds.value.push(item.id) selectIds.value.push(item.id)
else else
selectIds.value.splice(index, 1) index !== -1 && selectIds.value.splice(index, 1)
checkAll.value = offList.value.every(item => item.checked);
} }
const showIds = computed(() => { const showIds = computed(() => {
@ -180,6 +195,7 @@ watch(
if (action === 'add') { if (action === 'add') {
for (const item of offList.value) { for (const item of offList.value) {
if (!item.fix && diff.includes(item.id)) { if (!item.fix && diff.includes(item.id)) {
if (item.checked) {
onList.value.push({ onList.value.push({
id: item.id, id: item.id,
name: item.name || '未配置', name: item.name || '未配置',
@ -188,6 +204,7 @@ watch(
} }
} }
} }
}
else { else {
const list = onList.value const list = onList.value
for (let index = 0; index < list.length; index++) { for (let index = 0; index < list.length; index++) {

Loading…
Cancel
Save