|
|
|
@ -13,12 +13,12 @@ import type { AsideConfig } from '/#/api'
|
|
|
|
|
import emitter from '@/utils/mitt'
|
|
|
|
|
import { getFilterList } from '@/api/home/main'
|
|
|
|
|
import dayjs from 'dayjs'
|
|
|
|
|
import { cloneDeep } from 'lodash-es'
|
|
|
|
|
import { cloneDeep, isEqual } from 'lodash-es'
|
|
|
|
|
|
|
|
|
|
const configStore = useConfig()
|
|
|
|
|
|
|
|
|
|
// 所有左侧模块的值
|
|
|
|
|
const asideValue: Record<keyof typeof asideMap, any> = reactive({})
|
|
|
|
|
let asideValue: Record<keyof typeof asideMap, any> = reactive({})
|
|
|
|
|
// 左侧某个模块是否显示: 显示需同时满足系统配置和个人配置
|
|
|
|
|
const asideVisible: Partial<Record<keyof AsideConfig, boolean>> = reactive({})
|
|
|
|
|
// 当前显示的模块,按照数组顺序显示
|
|
|
|
@ -28,13 +28,14 @@ Object.keys(asideMap).forEach((key) => {
|
|
|
|
|
const entity = asideMap[key]
|
|
|
|
|
const { defaultValue } = entity
|
|
|
|
|
asideValue[key] = defaultValue
|
|
|
|
|
console.log("asideMap和asideValue", asideValue);
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const filterModalRef = ref(null)
|
|
|
|
|
const newFilterModalRef = ref(null)
|
|
|
|
|
const customModalRef = ref(null)
|
|
|
|
|
const customObjRef = ref<any>(null) // 获取高级筛选获取的值
|
|
|
|
|
const customTempObjRef = ref<any>(null) // 获取高级筛选获取的值(作对比)
|
|
|
|
|
const configFilterRef = ref<any>([]) // 获取排序的值
|
|
|
|
|
|
|
|
|
|
function showModal(modalRef: any) {
|
|
|
|
|
const modal = unref(modalRef)! as any
|
|
|
|
@ -44,6 +45,9 @@ function showModal(modalRef: any) {
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
computeSlideHeight()
|
|
|
|
|
let tempAsideValue = cloneDeep(asideValue);
|
|
|
|
|
// configStore.setAsideValue(tempAsideValue);
|
|
|
|
|
console.log("asideMap和asideValue", tempAsideValue);
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
@ -88,7 +92,17 @@ onBeforeMount(async () => {
|
|
|
|
|
configStore.$subscribe(() => {
|
|
|
|
|
const config = configStore.getConfig
|
|
|
|
|
const customConfig = configStore.getCustomConfig
|
|
|
|
|
|
|
|
|
|
console.log("config", config);
|
|
|
|
|
console.log("customConfig", customConfig);
|
|
|
|
|
console.log("customObjRef.value", customObjRef.value);
|
|
|
|
|
console.log("customTempObjRef.value", customTempObjRef.value, );
|
|
|
|
|
console.log("getFilterConfig", configStore.getFilterConfig,);
|
|
|
|
|
console.log("isEqual(asideValue, configStore.getAsideValue)", isEqual(asideValue, configStore.getAsideValue), );
|
|
|
|
|
console.log("configStore的getAsideValue", configStore.getAsideValue, );
|
|
|
|
|
console.log( "getAsideValue", asideValue);
|
|
|
|
|
if((configFilterRef.value.length > 0 && isEqual(configFilterRef.value, configStore.getFilterConfig)) && customObjRef.value && isEqual(customObjRef.value, customTempObjRef.value)) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (config == null || customConfig == null)
|
|
|
|
|
return
|
|
|
|
|
// console.log("config", config, "customConfig", customConfig);
|
|
|
|
@ -98,7 +112,11 @@ configStore.$subscribe(() => {
|
|
|
|
|
showKeys.unshift(...defaultKeys)
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
const showKeys = [...customConfig];
|
|
|
|
|
let sortKeyList: any = [];
|
|
|
|
|
configStore.getFilterConfig.map((item: any) => {
|
|
|
|
|
sortKeyList.push(item.id);
|
|
|
|
|
});
|
|
|
|
|
const showKeys = [...sortKeyList];
|
|
|
|
|
|
|
|
|
|
Object.keys(config).forEach((key) => {
|
|
|
|
|
if (key.startsWith('iz') && asideMap[key] !== undefined)
|
|
|
|
@ -109,16 +127,21 @@ configStore.$subscribe(() => {
|
|
|
|
|
if(asideMap.hasOwnProperty(key)) {
|
|
|
|
|
const str = key.toLowerCase()
|
|
|
|
|
// console.log("customObjRef.value[str]1111111111111", customObjRef.value[str]);
|
|
|
|
|
if(str == "izsimilarity" && typeof customObjRef.value[str] == "string") {
|
|
|
|
|
customObjRef.value[str] = customObjRef.value[str].split(',');
|
|
|
|
|
if(str == "izsimilarity") {
|
|
|
|
|
if(typeof customObjRef.value[str] == "string") {
|
|
|
|
|
customObjRef.value[str] = customObjRef.value[str].split(',');
|
|
|
|
|
}
|
|
|
|
|
asideValue[key] = customObjRef.value[str];// 赋值
|
|
|
|
|
}else if(str == "izyear" && typeof customObjRef.value[str] == "string") {
|
|
|
|
|
let time = customObjRef.value[str].split('-');
|
|
|
|
|
time[0] = (new Date(time[0])).getTime();
|
|
|
|
|
time[1] = (new Date(time[1])).getTime();
|
|
|
|
|
customObjRef.value[str] = time;
|
|
|
|
|
console.log("相似度2222222222", asideValue[key]);
|
|
|
|
|
}else if(str == "izyear") {
|
|
|
|
|
if(typeof customObjRef.value[str] == "string") {
|
|
|
|
|
let time = customObjRef.value[str].split('-');
|
|
|
|
|
time[0] = (new Date(time[0])).getTime();
|
|
|
|
|
time[1] = (new Date(time[1])).getTime();
|
|
|
|
|
customObjRef.value[str] = time;
|
|
|
|
|
}
|
|
|
|
|
asideValue[key] = customObjRef.value[str];// 赋值
|
|
|
|
|
console.log("时间2222222222", customObjRef.value[str]);
|
|
|
|
|
console.log("时间2222222222", asideValue[key]);
|
|
|
|
|
}else if((str != 'izsimilarity' && str != "izyear") && customObjRef.value[str]) {
|
|
|
|
|
console.log("customObjRef.value[str]222222", customObjRef.value[str]);
|
|
|
|
|
// let list = customObjRef.value[str].split(',');
|
|
|
|
@ -130,7 +153,11 @@ configStore.$subscribe(() => {
|
|
|
|
|
// asideMap[str].defaultValue = customObjRef.value[str];// 赋值
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
customTempObjRef.value = customObjRef.value;
|
|
|
|
|
console.log("asideValue直接处理后的结果", asideValue);
|
|
|
|
|
console.log("customTempObjRef.value", customTempObjRef.value);
|
|
|
|
|
let tempobj = cloneDeep(asideValue);
|
|
|
|
|
configStore.setAsideValue(tempobj);
|
|
|
|
|
}
|
|
|
|
|
// console.log("showKeys", showKeys);
|
|
|
|
|
const items = showKeys.reduce((acc, key) => {
|
|
|
|
@ -149,8 +176,9 @@ configStore.$subscribe(() => {
|
|
|
|
|
return acc
|
|
|
|
|
}
|
|
|
|
|
}, [])
|
|
|
|
|
console.log("items", items);
|
|
|
|
|
console.log("showItems=================================", items);
|
|
|
|
|
showItems.value = items
|
|
|
|
|
configFilterRef.value = configStore.getFilterConfig;
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const asideEnter = ref(false)
|
|
|
|
@ -198,16 +226,20 @@ function editFilter(filter: any) {
|
|
|
|
|
|
|
|
|
|
function updateComponent(key, e) {
|
|
|
|
|
console.log("跟新值", key, e);
|
|
|
|
|
console.log("tempAsideValue跟新值", configStore.getAsideValue, asideValue);
|
|
|
|
|
// let tempAsideValue = configStore.getAsideValue || asideValue;
|
|
|
|
|
let tempobj = cloneDeep(asideValue);
|
|
|
|
|
tempobj[key] = e;
|
|
|
|
|
customObjRef.value = tempobj;
|
|
|
|
|
Object.assign(asideValue, tempobj);
|
|
|
|
|
// asideValue = Object.assign({}, asideValue, tempobj);
|
|
|
|
|
console.log("asideValue跟新值", tempobj);
|
|
|
|
|
configStore.setAsideValue(tempobj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
watch(asideValue, (newVal) => {
|
|
|
|
|
console.log("asideValue处理后", newVal);
|
|
|
|
|
configStore.setAsideValue(newVal)
|
|
|
|
|
}, { deep: true })
|
|
|
|
|
// watch(asideValue, (newVal) => {
|
|
|
|
|
// console.log("asideValue处理后", newVal);
|
|
|
|
|
// configStore.setAsideValue(newVal)
|
|
|
|
|
// }, { deep: true })
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
@ -229,7 +261,7 @@ watch(asideValue, (newVal) => {
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<component
|
|
|
|
|
:is="item.config.component" v-for="(item, index) in showItems" :id="item.key" :key="index" v-model:value="asideValue[item.key]"
|
|
|
|
|
:is="item.config.component" v-for="(item, index) in showItems" :id="item.key" :key="item.key" v-model:value="asideValue[item.key]"
|
|
|
|
|
:label="item.config.label" @update:value="e=>updateComponent(item.key, e)"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|