|
|
@ -12,6 +12,14 @@ const finalStore = useFinal()
|
|
|
|
const checkAll = ref(false)
|
|
|
|
const checkAll = ref(false)
|
|
|
|
const selectIds = ref<string[]>([])
|
|
|
|
const selectIds = ref<string[]>([])
|
|
|
|
const tempList = ref<string[]>([])
|
|
|
|
const tempList = ref<string[]>([])
|
|
|
|
|
|
|
|
let extraCustomConfig :any = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Object.keys(asideMap).forEach((key) => {
|
|
|
|
|
|
|
|
const { isDefaultFilter } = asideMap[key];
|
|
|
|
|
|
|
|
if (isDefaultFilter) {
|
|
|
|
|
|
|
|
extraCustomConfig.push(key);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
function showModal() {
|
|
|
|
function showModal() {
|
|
|
|
show.value = true
|
|
|
|
show.value = true
|
|
|
@ -21,6 +29,7 @@ function showModal() {
|
|
|
|
const customConfig = finalStore.getCustomConfig
|
|
|
|
const customConfig = finalStore.getCustomConfig
|
|
|
|
|
|
|
|
|
|
|
|
console.log('开启了啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦筛选条件----------------',config, customConfig)
|
|
|
|
console.log('开启了啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦筛选条件----------------',config, customConfig)
|
|
|
|
|
|
|
|
console.log('开启了啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦筛选条件----------------',tempList.value, finalStore.getFilterConfig)
|
|
|
|
if (config == null || customConfig == null)
|
|
|
|
if (config == null || customConfig == null)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
if (tempList.value.length > 0 && isEqual(tempList.value, finalStore.getFilterConfig))
|
|
|
|
if (tempList.value.length > 0 && isEqual(tempList.value, finalStore.getFilterConfig))
|
|
|
@ -28,6 +37,7 @@ function showModal() {
|
|
|
|
|
|
|
|
|
|
|
|
const { showList, hideList } = generatList(config, customConfig)
|
|
|
|
const { showList, hideList } = generatList(config, customConfig)
|
|
|
|
tempList.value = cloneDeep(showList)
|
|
|
|
tempList.value = cloneDeep(showList)
|
|
|
|
|
|
|
|
console.log("tempList.value开启了lllllllllllllllllll", showList, hideList);
|
|
|
|
if (tempList.value.length > 0)
|
|
|
|
if (tempList.value.length > 0)
|
|
|
|
finalStore.setFilterConfig(tempList.value)
|
|
|
|
finalStore.setFilterConfig(tempList.value)
|
|
|
|
|
|
|
|
|
|
|
@ -84,18 +94,43 @@ function generateDefaultList(config) {
|
|
|
|
function generatList(config, customConfig) {
|
|
|
|
function generatList(config, customConfig) {
|
|
|
|
const keys = Object.keys(config)
|
|
|
|
const keys = Object.keys(config)
|
|
|
|
let onList: object[] = []
|
|
|
|
let onList: object[] = []
|
|
|
|
const offList: object[] = []
|
|
|
|
let offList: any = []
|
|
|
|
const showKeys = [...customConfig]
|
|
|
|
let showKeys = [];
|
|
|
|
|
|
|
|
const tempShowKeys = [...customConfig, ...extraCustomConfig];
|
|
|
|
for (const key of keys) {
|
|
|
|
tempShowKeys.map(item => {
|
|
|
|
if (!key.startsWith('iz') || config[key] === 'N' || asideMap[key] === undefined)
|
|
|
|
if(!showKeys.includes(item)) {
|
|
|
|
continue
|
|
|
|
showKeys.push(item);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
console.log('原始筛选条件showKeys', showKeys)
|
|
|
|
|
|
|
|
console.log('原始筛选条件config customConfig', config, customConfig)
|
|
|
|
|
|
|
|
// for (const key of keys) {
|
|
|
|
|
|
|
|
// if (!key.startsWith('iz') || config[key] === 'N' || asideMap[key] === undefined)
|
|
|
|
|
|
|
|
// continue
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// const name = asideMap[key]?.label
|
|
|
|
|
|
|
|
// const isDefaultFilter = asideMap[key]?.isDefaultFilter
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// // 系统配置为Y,且不是默认配置
|
|
|
|
|
|
|
|
// if (!isDefaultFilter) {
|
|
|
|
|
|
|
|
// const isChecked = asideMap[key].isDefaultFilter || showKeys.includes(key)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// offList.push({
|
|
|
|
|
|
|
|
// id: key,
|
|
|
|
|
|
|
|
// name: name || '未配置',
|
|
|
|
|
|
|
|
// fix: isDefaultFilter,
|
|
|
|
|
|
|
|
// checked: isChecked,
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
// if (isChecked && !selectIds.value.includes(key))
|
|
|
|
|
|
|
|
// isChecked && selectIds.value.push(key)
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
Object.keys(asideMap).map(key => {
|
|
|
|
const name = asideMap[key]?.label
|
|
|
|
const name = asideMap[key]?.label
|
|
|
|
const isDefaultFilter = asideMap[key]?.isDefaultFilter
|
|
|
|
const isDefaultFilter = asideMap[key]?.isDefaultFilter
|
|
|
|
|
|
|
|
|
|
|
|
// 系统配置为Y,且不是默认配置
|
|
|
|
// 系统配置为Y,且不是默认配置
|
|
|
|
if (!isDefaultFilter) {
|
|
|
|
// if (!isDefaultFilter) {
|
|
|
|
const isChecked = asideMap[key].isDefaultFilter || showKeys.includes(key)
|
|
|
|
const isChecked = asideMap[key].isDefaultFilter || showKeys.includes(key)
|
|
|
|
|
|
|
|
|
|
|
|
offList.push({
|
|
|
|
offList.push({
|
|
|
@ -106,14 +141,15 @@ function generatList(config, customConfig) {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
if (isChecked && !selectIds.value.includes(key))
|
|
|
|
if (isChecked && !selectIds.value.includes(key))
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
// 也需要系统配置开启(可能个人开启后,系统配置关闭) && 把默认显示的过滤掉(理论上不会出现这种情况)
|
|
|
|
// 也需要系统配置开启(可能个人开启后,系统配置关闭) && 把默认显示的过滤掉(理论上不会出现这种情况)
|
|
|
|
if (config[key] === 'Y' && isDefaultFilter === false) {
|
|
|
|
if (config[key] === 'Y' && isDefaultFilter === false) {
|
|
|
|
|
|
|
|
// if (config[key] === 'Y') {
|
|
|
|
const config = {
|
|
|
|
const config = {
|
|
|
|
id: key,
|
|
|
|
id: key,
|
|
|
|
name: asideMap[key].label || '未配置',
|
|
|
|
name: asideMap[key].label || '未配置',
|
|
|
@ -125,9 +161,10 @@ function generatList(config, customConfig) {
|
|
|
|
return acc
|
|
|
|
return acc
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, [])
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
console.log('原始筛选条件onList', onList)
|
|
|
|
const fixedList = generateDefaultList(config)
|
|
|
|
const fixedList = generateDefaultList(config)
|
|
|
|
offList.unshift(...fixedList)
|
|
|
|
// offList.unshift(...fixedList)
|
|
|
|
|
|
|
|
console.log('原始筛选条件fixedList', fixedList)
|
|
|
|
onList.unshift(...fixedList)
|
|
|
|
onList.unshift(...fixedList)
|
|
|
|
console.log('原始筛选条件customConfig', customConfig)
|
|
|
|
console.log('原始筛选条件customConfig', customConfig)
|
|
|
|
// onList按照customConfig排序
|
|
|
|
// onList按照customConfig排序
|
|
|
@ -136,25 +173,30 @@ function generatList(config, customConfig) {
|
|
|
|
|
|
|
|
|
|
|
|
const sortKeyList: any = []
|
|
|
|
const sortKeyList: any = []
|
|
|
|
finalStore.getFilterConfig.map((item: any) => {
|
|
|
|
finalStore.getFilterConfig.map((item: any) => {
|
|
|
|
|
|
|
|
console.log("tFilterConfig item000000000000000", item);
|
|
|
|
sortKeyList.push(item.id)
|
|
|
|
sortKeyList.push(item.id)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
console.log('原始筛选条件sortKeyList', sortKeyList)
|
|
|
|
console.log('原始筛选条件sortKeyList', sortKeyList)
|
|
|
|
|
|
|
|
console.log('原始筛选条件showKeys', showKeys)
|
|
|
|
const sortList: any = []
|
|
|
|
const sortList: any = []
|
|
|
|
if (sortKeyList.length > 0) {
|
|
|
|
if (sortKeyList.length > 0) {
|
|
|
|
sortKeyList.map((key) => {
|
|
|
|
sortKeyList.map((key) => {
|
|
|
|
const tempItem = tempOnList.find(item => item.id == key)
|
|
|
|
const tempItem = tempOnList.find(item => item.id == key)
|
|
|
|
sortList.push(tempItem)
|
|
|
|
if(tempItem) {
|
|
|
|
|
|
|
|
sortList.push(tempItem)
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
customConfig.map((key) => {
|
|
|
|
showKeys.map((key) => {
|
|
|
|
const tempItem = tempOnList.find(item => item.id == key)
|
|
|
|
const tempItem = tempOnList.find(item => item.id == key)
|
|
|
|
if(tempItem) {
|
|
|
|
if(tempItem) {
|
|
|
|
sortList.push(tempItem)
|
|
|
|
sortList.push(tempItem)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log('原始筛选条件sortList', sortList)
|
|
|
|
console.log('原始筛选条件showList', sortList)
|
|
|
|
|
|
|
|
console.log('原始筛选条件hideList', offList)
|
|
|
|
console.log('原始筛选条件configStore.getFilterConfig', finalStore.getFilterConfig)
|
|
|
|
console.log('原始筛选条件configStore.getFilterConfig', finalStore.getFilterConfig)
|
|
|
|
// return { showList: onList, hideList: offList }
|
|
|
|
// return { showList: onList, hideList: offList }
|
|
|
|
return { showList: sortList, hideList: offList }
|
|
|
|
return { showList: sortList, hideList: offList }
|
|
|
@ -166,19 +208,20 @@ finalStore.$subscribe(() => {
|
|
|
|
|
|
|
|
|
|
|
|
if (config == null || customConfig == null)
|
|
|
|
if (config == null || customConfig == null)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
console.log('tempList.value-----------', tempList.value)
|
|
|
|
console.log('订阅tempList.value-----------', tempList.value)
|
|
|
|
console.log('finalStore.getFilterConfig-----------', finalStore.getFilterConfig)
|
|
|
|
console.log('订阅finalStore.getFilterConfig-----------', finalStore.getFilterConfig)
|
|
|
|
if (tempList.value.length > 0 && isEqual(tempList.value, finalStore.getFilterConfig))
|
|
|
|
if (tempList.value.length > 0 && isEqual(tempList.value, finalStore.getFilterConfig))
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
const { showList, hideList } = generatList(config, customConfig)
|
|
|
|
const { showList, hideList } = generatList(config, customConfig)
|
|
|
|
tempList.value = cloneDeep(showList)
|
|
|
|
tempList.value = cloneDeep(showList)
|
|
|
|
console.log('克隆条件', tempList.value)
|
|
|
|
console.log('订阅克隆条件', tempList.value)
|
|
|
|
if (tempList.value.length > 0)
|
|
|
|
if (tempList.value.length > 0)
|
|
|
|
finalStore.setFilterConfig(tempList.value)
|
|
|
|
finalStore.setFilterConfig(tempList.value)
|
|
|
|
|
|
|
|
|
|
|
|
// setTimeout(() => {
|
|
|
|
// setTimeout(() => {
|
|
|
|
// }, 500);
|
|
|
|
// }, 500);
|
|
|
|
|
|
|
|
console.log('订阅showList, hideList-----------', showList, hideList)
|
|
|
|
onList.value = showList
|
|
|
|
onList.value = showList
|
|
|
|
offList.value = hideList
|
|
|
|
offList.value = hideList
|
|
|
|
})
|
|
|
|
})
|
|
|
@ -189,17 +232,19 @@ async function handleSumbit(e: MouseEvent) {
|
|
|
|
return item.id
|
|
|
|
return item.id
|
|
|
|
}).join(',')
|
|
|
|
}).join(',')
|
|
|
|
|
|
|
|
|
|
|
|
await setFilter({ searchcount: param, type: 0 })
|
|
|
|
await setFilter({ searchcount: param, type: 1 })
|
|
|
|
const obj = await finalStore.fetchCustomConfig()
|
|
|
|
const obj = await finalStore.fetchCustomConfig()
|
|
|
|
console.log('obj-------------------------------', obj)
|
|
|
|
console.log('obj-------------------------------', obj)
|
|
|
|
const tempOnList = cloneDeep(onList.value)
|
|
|
|
const tempOnList = cloneDeep(onList.value)
|
|
|
|
console.log('原始筛选条件tempOnList', tempOnList)
|
|
|
|
console.log('提交筛选条件tempOnList', tempOnList)
|
|
|
|
const sortList: any = []
|
|
|
|
const sortList: any = []
|
|
|
|
obj.map((key) => {
|
|
|
|
obj.map((key) => {
|
|
|
|
const tempItem = tempOnList.find(item => item.id == key)
|
|
|
|
const tempItem = tempOnList.find(item => item.id == key)
|
|
|
|
sortList.push(tempItem)
|
|
|
|
if(tempItem) {
|
|
|
|
|
|
|
|
sortList.push(tempItem)
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
console.log('finalStore.sortList---------------', sortList)
|
|
|
|
console.log('finalStore.sortList提交---------------', sortList)
|
|
|
|
// setTimeout(() => {
|
|
|
|
// setTimeout(() => {
|
|
|
|
if (sortList.length > 0)
|
|
|
|
if (sortList.length > 0)
|
|
|
|
finalStore.setFilterConfig(sortList)
|
|
|
|
finalStore.setFilterConfig(sortList)
|
|
|
|