feat: 修改bug

pull/173/head
raofuzi 1 year ago
parent 00ec4dd402
commit 6ce50b5d33

11
components.d.ts vendored

@ -10,12 +10,23 @@ declare module 'vue' {
Application: typeof import('./src/components/Application/Application.vue')['default']
BasicModal: typeof import('./src/components/Modal/BasicModal.vue')['default']
DataHeader: typeof import('./src/components/DataHeader/index.vue')['default']
NAvatar: typeof import('naive-ui')['NAvatar']
NButton: typeof import('naive-ui')['NButton']
NCard: typeof import('naive-ui')['NCard']
NCheckbox: typeof import('naive-ui')['NCheckbox']
NCollapse: typeof import('naive-ui')['NCollapse']
NCollapseItem: typeof import('naive-ui')['NCollapseItem']
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
NDatePicker: typeof import('naive-ui')['NDatePicker']
NDialogProvider: typeof import('naive-ui')['NDialogProvider']
NDivider: typeof import('naive-ui')['NDivider']
NDropdown: typeof import('naive-ui')['NDropdown']
NForm: typeof import('naive-ui')['NForm']
NFormItem: typeof import('naive-ui')['NFormItem']
NGi: typeof import('naive-ui')['NGi']
NGrid: typeof import('naive-ui')['NGrid']
NGridItem: typeof import('naive-ui')['NGridItem']
NImage: typeof import('naive-ui')['NImage']
NInput: typeof import('naive-ui')['NInput']
NMessageProvider: typeof import('naive-ui')['NMessageProvider']
NModal: typeof import('naive-ui')['NModal']

@ -82,29 +82,24 @@ export const useFinalStore = defineStore({
},
// 获取系统配置信息
async fetchConfig() {
const response = await getConfig()
console.log("response.data----------", response.data);
this.setSystemConfig(response.data)
return response.data
// const response = await getConfig()
// console.log("response.data----------", response.data);
// this.setSystemConfig(response.data)
// return response.data
let list: any = {};
let tempAsideMap = cloneDeep(asideMap);
Object.keys(tempAsideMap).map(key => {
list[key] = "Y";
});
console.log("setSystemConfig---------------", list);
this.setSystemConfig(list);
return list
},
// // 获取终审个性化配置
// async fetchCustomConfig() {
// const res = await getFilter(1)
// const { data } = res
// const list = data && data.searchcount ? data.searchcount.split(',') : [];
// console.log("listkey---------------", list);
// this.customConfig = list
// return list
// },
// 获取终审个性化配置
async fetchCustomConfig() {
let list: any = [];
let tempAsideMap = cloneDeep(asideMap);
Object.keys(tempAsideMap).map(key => {
if(!tempAsideMap[key].isDefaultFilter) {
list.push(key);
}
});
const res = await getFilter(1)
const { data } = res
const list = data && data.searchcount ? data.searchcount.split(',') : [];
console.log("listkey---------------", list);
this.customConfig = list
return list

@ -36,6 +36,7 @@ const showItems = shallowRef<{ key: string; config: AsideEntity }[]>([]);
const initAsideValueRef = ref<any>(null); // ()
const customObjRef = ref<any>(null); //
const customTempObjRef = ref<any>(null); // ()
const configFilterRef = ref<any>([]); //
initAsideValueRef.value = cloneDeep(asideMap);
@ -113,36 +114,128 @@ onBeforeMount(async () => {
nextTick(()=>{
finalStore.$subscribe(() => {
// const customConfig = finalStore.getCustomConfig;
// console.log("customConfigaside---------------", customConfig);
// if (customConfig === null) return;
// const showKeys: string[] = [...customConfig];
// // const defaultKeys = Object.keys(asideMap).filter(
// // (key) => asideMap[key].isDefaultFilter
// // );
// // showKeys.unshift(...defaultKeys);
// Object.keys(asideMap).forEach((key) => {
// //
// if (key.startsWith("iz"))
// asideVisible[key] =
// asideMap[key] && (showKeys.includes(key) || asideMap[key].isDefaultFilter);
// });
// const items = showKeys.reduce((acc, key) => {
// if (asideMap[key]) {
// const config = {
// key,
// config: asideMap[key],
// };
// return [...acc, config];
// } else {
// return acc;
// }
// }, []);
// console.log("showItems111111111---------------", items);
// showItems.value = items;
const config = finalStore.getSystemConfig;
const customConfig = finalStore.getCustomConfig;
console.log("customConfig111111111---------------", customConfig);
if (customConfig === null) return;
const showKeys: string[] = [...customConfig];
const defaultKeys = Object.keys(asideMap).filter(
(key) => asideMap[key].isDefaultFilter
);
showKeys.unshift(...defaultKeys);
Object.keys(asideMap).forEach((key) => {
//
if (key.startsWith("iz"))
asideVisible[key] =
asideMap[key] && (showKeys.includes(key) || asideMap[key].isDefaultFilter);
if (
configFilterRef.value.length > 0 &&
isEqual(configFilterRef.value, finalStore.getFilterConfig) &&
customObjRef.value &&
isEqual(customObjRef.value, customTempObjRef.value)
) {
return;
}
if (config == null || customConfig == null) return;
// console.log("config", config, "customConfig", customConfig);
/* rao
const showKeys = [...customConfig].filter(key => !asideMap[key].isDefaultFilter)// customConfig isDefaultFilter
const defaultKeys = Object.keys(asideMap).filter(key => asideMap[key].isDefaultFilter)// asideMap isDefaultFilter
showKeys.unshift(...defaultKeys)
*/
let sortKeyList: any = [];
finalStore.getFilterConfig.map((item: any) => {
sortKeyList.push(item?.id);
});
const showKeys = [...sortKeyList];
Object.keys(config).forEach((key) => {
if (key.startsWith("iz") && asideMap[key] !== undefined)
asideVisible[key] =
(showKeys.includes(key) || asideMap[key].isDefaultFilter) && config[key] === "Y";
});
if (customObjRef.value) {
//
Object.keys(customObjRef.value).map((key) => {
if (asideMap.hasOwnProperty(key)) {
const str = key.toLowerCase();
// console.log("customObjRef.value[str]1111111111111", customObjRef.value[str]);
if (str == "izsimilarity") {
if (typeof customObjRef.value[str] == "string") {
customObjRef.value[str] = customObjRef.value[str].split(",");
}
asideValue[key] = customObjRef.value[str]; //
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", asideValue[key]);
} else if (customObjRef.value[str]) {
console.log("customObjRef.value[str]222222", customObjRef.value[str]);
// let list = customObjRef.value[str].split(',');
// console.log("list222222", list);
if (typeof customObjRef.value[str] == "string") {
customObjRef.value[str] = customObjRef.value[str].split(",");
asideValue[key] = customObjRef.value[str]; //
}else {
asideValue[key] = customObjRef.value[str]; //
}
} else {
asideValue[key] = null;
}
// asideMap[str].defaultValue = customObjRef.value[str];//
}
});
customTempObjRef.value = customObjRef.value;
console.log("asideValue直接处理后的结果", asideValue);
console.log("customTempObjRef.value", customTempObjRef.value);
let tempobj = cloneDeep(asideValue);
console.log("tempObj", tempobj);
finalStore.setAsideValue(tempobj);
}
// console.log("showKeys", showKeys);
const items = showKeys.reduce((acc, key) => {
if (asideMap[key]) {
const config = {
key,
config: asideMap[key],
const currentData = asideMap[key];
const render = currentData?.render;
if (render !== false) {
const str = key?.toLowerCase();
const o = {
key: str,
config: asideMap[str],
};
return [...acc, config];
return [...acc, o];
} else {
return acc;
}
}, []);
console.log("showItems111111111---------------", items);
console.log("showItems=================================", items);
showItems.value = items;
configFilterRef.value = finalStore.getFilterConfig;
});
})
@ -197,9 +290,9 @@ function editFilter(filter: any) {
modal.edit(filter);
}
watch(asideValue, (newVal) => {
finalStore.setAsideValue(newVal);
});
// watch(asideValue, (newVal) => {
// finalStore.setAsideValue(newVal);
// });
const inputChange = (keyword) => {
emit("inputChange", keyword);
@ -214,6 +307,21 @@ const handleOk = (item: any) => {
filterHandler("");
}
};
function updateComponent(key, e) {
console.log("跟新值", key, e);
console.log("tempAsideValue跟新值", finalStore.getAsideValue, asideValue);
// let tempAsideValue = finalStore.getAsideValue || asideValue;
let tempobj = cloneDeep(asideValue);
console.log(tempobj, "tempobj");
tempobj[key] = e;
console.log(tempobj, "tempobj After");
customObjRef.value = tempobj;
// asideValue = Object.assign({}, asideValue, tempobj);
console.log("asideValue跟新值", tempobj);
finalStore.setAsideValue(tempobj);
}
</script>
<template>
@ -256,6 +364,7 @@ const handleOk = (item: any) => {
:key="index"
v-model:value="asideValue[item.key]"
:label="item.config.label"
@update:value="(e) => updateComponent(item.key, e)"
/>
<!-- 筛选 -->

@ -12,6 +12,14 @@ const finalStore = useFinal()
const checkAll = ref(false)
const selectIds = 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() {
show.value = true
@ -21,6 +29,7 @@ function showModal() {
const customConfig = finalStore.getCustomConfig
console.log('开启了啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦筛选条件----------------',config, customConfig)
console.log('开启了啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦筛选条件----------------',tempList.value, finalStore.getFilterConfig)
if (config == null || customConfig == null)
return
if (tempList.value.length > 0 && isEqual(tempList.value, finalStore.getFilterConfig))
@ -28,6 +37,7 @@ function showModal() {
const { showList, hideList } = generatList(config, customConfig)
tempList.value = cloneDeep(showList)
console.log("tempList.value开启了lllllllllllllllllll", showList, hideList);
if (tempList.value.length > 0)
finalStore.setFilterConfig(tempList.value)
@ -84,18 +94,43 @@ function generateDefaultList(config) {
function generatList(config, customConfig) {
const keys = Object.keys(config)
let onList: object[] = []
const offList: object[] = []
const showKeys = [...customConfig]
for (const key of keys) {
if (!key.startsWith('iz') || config[key] === 'N' || asideMap[key] === undefined)
continue
let offList: any = []
let showKeys = [];
const tempShowKeys = [...customConfig, ...extraCustomConfig];
tempShowKeys.map(item => {
if(!showKeys.includes(item)) {
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 isDefaultFilter = asideMap[key]?.isDefaultFilter
// Y
if (!isDefaultFilter) {
// if (!isDefaultFilter) {
const isChecked = asideMap[key].isDefaultFilter || showKeys.includes(key)
offList.push({
@ -106,14 +141,15 @@ function generatList(config, customConfig) {
})
if (isChecked && !selectIds.value.includes(key))
isChecked && selectIds.value.push(key)
}
}
// }
})
onList = showKeys.reduce((acc, key) => {
const isDefaultFilter = asideMap[key]?.isDefaultFilter
// && ()
if (config[key] === 'Y' && isDefaultFilter === false) {
// if (config[key] === 'Y') {
const config = {
id: key,
name: asideMap[key].label || '未配置',
@ -125,9 +161,10 @@ function generatList(config, customConfig) {
return acc
}
}, [])
console.log('原始筛选条件onList', onList)
const fixedList = generateDefaultList(config)
offList.unshift(...fixedList)
// offList.unshift(...fixedList)
console.log('原始筛选条件fixedList', fixedList)
onList.unshift(...fixedList)
console.log('原始筛选条件customConfig', customConfig)
// onListcustomConfig
@ -136,25 +173,30 @@ function generatList(config, customConfig) {
const sortKeyList: any = []
finalStore.getFilterConfig.map((item: any) => {
console.log("tFilterConfig item000000000000000", item);
sortKeyList.push(item.id)
})
console.log('原始筛选条件sortKeyList', sortKeyList)
console.log('原始筛选条件showKeys', showKeys)
const sortList: any = []
if (sortKeyList.length > 0) {
sortKeyList.map((key) => {
const tempItem = tempOnList.find(item => item.id == key)
sortList.push(tempItem)
if(tempItem) {
sortList.push(tempItem)
}
})
}
else {
customConfig.map((key) => {
showKeys.map((key) => {
const tempItem = tempOnList.find(item => item.id == key)
if(tempItem) {
sortList.push(tempItem)
}
})
}
console.log('原始筛选条件sortList', sortList)
console.log('原始筛选条件showList', sortList)
console.log('原始筛选条件hideList', offList)
console.log('原始筛选条件configStore.getFilterConfig', finalStore.getFilterConfig)
// return { showList: onList, hideList: offList }
return { showList: sortList, hideList: offList }
@ -166,19 +208,20 @@ finalStore.$subscribe(() => {
if (config == null || customConfig == null)
return
console.log('tempList.value-----------', tempList.value)
console.log('finalStore.getFilterConfig-----------', finalStore.getFilterConfig)
console.log('订阅tempList.value-----------', tempList.value)
console.log('订阅finalStore.getFilterConfig-----------', finalStore.getFilterConfig)
if (tempList.value.length > 0 && isEqual(tempList.value, finalStore.getFilterConfig))
return
const { showList, hideList } = generatList(config, customConfig)
tempList.value = cloneDeep(showList)
console.log('克隆条件', tempList.value)
console.log('订阅克隆条件', tempList.value)
if (tempList.value.length > 0)
finalStore.setFilterConfig(tempList.value)
// setTimeout(() => {
// }, 500);
console.log('订阅showList, hideList-----------', showList, hideList)
onList.value = showList
offList.value = hideList
})
@ -189,17 +232,19 @@ async function handleSumbit(e: MouseEvent) {
return item.id
}).join(',')
await setFilter({ searchcount: param, type: 0 })
await setFilter({ searchcount: param, type: 1 })
const obj = await finalStore.fetchCustomConfig()
console.log('obj-------------------------------', obj)
const tempOnList = cloneDeep(onList.value)
console.log('原始筛选条件tempOnList', tempOnList)
console.log('提交筛选条件tempOnList', tempOnList)
const sortList: any = []
obj.map((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(() => {
if (sortList.length > 0)
finalStore.setFilterConfig(sortList)

@ -3,6 +3,7 @@ import { onBeforeMount, onMounted, ref } from 'vue'
import type { FormItemRule, FormRules } from 'naive-ui'
import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig'
import { useFinal } from '@/store/modules/final'
const configUseStore = useConfig()
@ -24,6 +25,27 @@ configUseStore.$subscribe(() => {
formValue.value.plans = [];
}
});
const finalStore = useFinal()
finalStore.$subscribe(() => {
if(isLoadValue.value) {
isLoadValue.value = false;
return
}
let asideValue = finalStore.getAsideValue;
if(asideValue && asideValue['izproject']) {
if(typeof asideValue['izproject'] == "string") {
let list = asideValue['izproject'].split(',');
formValue.value.plans = list;
}else {
formValue.value.plans = asideValue['izproject'];
}
console.log("formValue.value.izproject", formValue.value.plans);
}else {
formValue.value.plans = [];
}
});
const props = defineProps<{
value: string[] | null
label: string

@ -3,6 +3,7 @@ import { onBeforeMount, onMounted, ref } from 'vue'
import type { FormRules } from 'naive-ui'
import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig'
import { useFinal } from '@/store/modules/final'
const configUseStore = useConfig()
@ -24,6 +25,27 @@ configUseStore.$subscribe(() => {
formValue.value.plans = [];
}
});
const finalStore = useFinal()
finalStore.$subscribe(() => {
if(isLoadValue.value) {
isLoadValue.value = false;
return
}
let asideValue = finalStore.getAsideValue;
if(asideValue && asideValue['izstatus']) {
if(typeof asideValue['izstatus'] == "string") {
let list = asideValue['izstatus'].split(',');
formValue.value.plans = list;
}else {
formValue.value.plans = asideValue['izstatus'];
}
console.log("formValue.value.izstatus", formValue.value.plans);
}else {
formValue.value.plans = [];
}
});
const props = defineProps<{
value: string[] | null
label: string

@ -3,6 +3,7 @@ import { onBeforeMount, onMounted, ref } from 'vue'
import { type FormItemRule, type FormRules, faIR } from 'naive-ui'
import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig'
import { useFinal } from '@/store/modules/final'
const configUseStore = useConfig()
@ -26,6 +27,27 @@ configUseStore.$subscribe(() => {
formValue.value.plans = [];
}
});
const finalStore = useFinal()
finalStore.$subscribe(() => {
if(isLoadValue.value) {
isLoadValue.value = false;
return
}
let asideValue = finalStore.getAsideValue;
if(asideValue && asideValue['iztaskrrom']) {
if(typeof asideValue['iztaskrrom'] == "string") {
let list = asideValue['iztaskrrom'].split(',');
formValue.value.plans = list;
}else {
formValue.value.plans = asideValue['iztaskrrom'];
}
console.log("formValue.value.iztaskrrom", formValue.value.plans);
}else {
formValue.value.plans = [];
}
});
const props = defineProps<{
value: string[] | null
label: string

@ -3,6 +3,7 @@ import { onBeforeMount, onMounted, ref } from 'vue'
import type { FormItemRule, FormRules } from 'naive-ui'
import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig'
import { useFinal } from '@/store/modules/final'
const configUseStore = useConfig()
@ -24,6 +25,27 @@ configUseStore.$subscribe(() => {
formValue.value.plans = [];
}
});
const finalStore = useFinal()
finalStore.$subscribe(() => {
if(isLoadValue.value) {
isLoadValue.value = false;
return
}
let asideValue = finalStore.getAsideValue;
if(asideValue && asideValue['izplan']) {
if(typeof asideValue['izplan'] == "string") {
let list = asideValue['izplan'].split(',');
formValue.value.plans = list;
}else {
formValue.value.plans = asideValue['izplan'];
}
console.log("formValue.value.izplan", formValue.value.plans);
}else {
formValue.value.plans = [];
}
});
const props = defineProps<{
value: string[] | null
label: string

@ -3,6 +3,7 @@ import { onBeforeMount, onMounted, onUpdated, ref } from 'vue'
import type { FormItemRule, FormRules } from 'naive-ui'
import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig'
import { useFinal } from '@/store/modules/final'
const configUseStore = useConfig()
@ -26,6 +27,27 @@ configUseStore.$subscribe(() => {
}
});
const finalStore = useFinal()
finalStore.$subscribe(() => {
let asideValue = finalStore.getAsideValue;
console.log("asideValue接受到的", asideValue);
if(isLoadValue.value) {
isLoadValue.value = false;
return
}
if(asideValue && asideValue['izupuser']) {
if(typeof asideValue['izupuser'] == "string") {
let list = asideValue['izupuser'].split(',');
formValue.value.users = list;
}else {
formValue.value.users = asideValue['izupuser'];
}
console.log("formValue.value.users222222222222222", formValue.value.users);
}else {
formValue.value.users = [];
}
});
const props = defineProps<{
value: string[] | null
label: string

@ -3,6 +3,7 @@ import dayjs from "dayjs";
import { onUpdated, watch } from "vue";
import { onMounted, ref } from "vue";
import { useConfig } from "@/store/modules/asideConfig";
import { useFinal } from '@/store/modules/final'
const configUseStore = useConfig();
@ -18,6 +19,23 @@ configUseStore.$subscribe(() => {
time.value = null;
}
});
const finalStore = useFinal()
finalStore.$subscribe(() => {
if (isLoadValue.value) {
isLoadValue.value = false;
return;
}
let asideValue = finalStore.getAsideValue;
console.log("asideValue izyear", asideValue);
if (asideValue && asideValue["izyear"]) {
time.value = asideValue["izyear"];
} else {
time.value = null;
}
});
const props = defineProps<{
value: [number, number] | null;
label: string;

Loading…
Cancel
Save