diff --git a/src/api/final/index.ts b/src/api/final/index.ts index d5eae04..c60dce5 100644 --- a/src/api/final/index.ts +++ b/src/api/final/index.ts @@ -14,7 +14,7 @@ export async function getFinalList(params: FinalParam) { Object.keys(notEmptyParams).forEach((key) => { const val = notEmptyParams[key] - if (key === 'izuptime') { + if (key === 'izyear') { const start = formatToDate2(val[0]) const end = formatToDate2(val[1]) notEmptyParams[key] = `${start}-${end}` diff --git a/src/assets/icons/lctname.svg b/src/assets/icons/lctname.svg new file mode 100644 index 0000000..404f96d --- /dev/null +++ b/src/assets/icons/lctname.svg @@ -0,0 +1,23 @@ + + + 位图 2 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/components/Search/Search.vue b/src/components/Search/Search.vue index 729f970..dab53b8 100644 --- a/src/components/Search/Search.vue +++ b/src/components/Search/Search.vue @@ -72,7 +72,10 @@ async function getHistory() { getHistory() function goPath(item, id) { - router.push({ name: item.path, query: { id } }) + const desiredObject = item.data.find(function (item) { + return item.id === id; + }); + router.push({ name: item.path, query: { id, searchContent: desiredObject.name } }) emit('close') } @@ -94,42 +97,30 @@ function highlightText(text, query) {
- +
-
+
历史搜索
-
+
{{ item.historyname }}
-
+
{{ item.title }}
@@ -148,13 +139,15 @@ function highlightText(text, query) { position: absolute; top: 20%; left: 20%; - box-shadow: none!important; - .ip_box{ + box-shadow: none !important; + + .ip_box { z-index: 0; position: relative; left: calc(50% - 40px); top: 30px; - img{ + + img { width: 80px; height: 80px; } @@ -169,6 +162,7 @@ function highlightText(text, query) { box-shadow: 0px 12px 12px 0px rgba(80, 122, 253, 0.15), 0px 0px 0px 0.5px #d4e3fc; } + .list_box { background: #fefefe; border: 1px dashed #f4f4f4; @@ -176,6 +170,7 @@ function highlightText(text, query) { box-shadow: 0px 12px 12px 0px rgba(80, 122, 253, 0.15); margin-top: 15px; padding: 8px 16px; + .list_classfiy_item { .list_title { font-size: 12px; @@ -185,6 +180,7 @@ function highlightText(text, query) { line-height: 17px; margin: 10px 0 10px 5px; } + .list_item { display: flex; flex-flow: row nowrap; @@ -194,28 +190,29 @@ function highlightText(text, query) { } } } + :deep(.n-input .n-input-wrapper) { margin: 8px; } -.history-list{ +.history-list { align-items: center; padding-bottom: 9px; } -.name{ +.name { margin-left: 5px; cursor: pointer; } -.tag-wrap{ +.tag-wrap { display: flex; align-items: center; flex: 1; overflow-y: hidden; overflow-x: auto; - .tag{ + .tag { padding: 0 12px; height: 22px; border: 1px solid #e4e7ed; @@ -230,11 +227,11 @@ function highlightText(text, query) { } } -.icon-delete{ +.icon-delete { cursor: pointer; } -.highlight{ +.highlight { color: #507AFD; } diff --git a/src/config/1.json b/src/config/1.json index 911d159..3c8e5e6 100644 --- a/src/config/1.json +++ b/src/config/1.json @@ -27,11 +27,11 @@ export const asideMap: Recordable = { key: 'izstatus', component: PlanVue, // todo }, - izuptime: { + izyear: { label: '提报时间', defaultValue: null, isDefaultFilter: false, - key: 'izuptime', + key: 'izyear', component: TimeVue, }, iztaskrrom: { diff --git a/src/config/final.ts b/src/config/final.ts index a258f4b..b3b466d 100644 --- a/src/config/final.ts +++ b/src/config/final.ts @@ -1,5 +1,6 @@ import type { AsideEntity } from './aside' import { IzApprovalStatus, IzCustomlevel, IzCustomname, IzCustomtype, IzProductVue, IzProjectVue, IzProjecttype, IzShowAll, IzStatus, IzVisitcity, IzfirmVue, IztaskrromVue, IzvisitproVue, PictureDownloadVue, PlanVue, ReportUserVue, TimeVue } from '@/views/home/aside/comp/items' +import { defineAsyncComponent } from "vue" export interface RowData { id: string @@ -83,49 +84,56 @@ export const asideMap: Recordable = { defaultValue: null, isDefaultFilter: true, key: 'izupuser', - component: ReportUserVue, + // component: ReportUserVue, + component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/ReportUser.vue")), }, izproject: { label: '所属项目', defaultValue: null, isDefaultFilter: true, key: 'izproject', - component: IzProjectVue, + // component: IzProjectVue, + component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/IzProject.vue")), }, izplan: { label: '所属计划', defaultValue: null, isDefaultFilter: true, key: 'izplan', - component: PlanVue, + // component: PlanVue, + component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/Plan.vue")), }, izstatus: { label: '审批状态', defaultValue: null, isDefaultFilter: false, key: 'izstatus', - component: IzStatus, // todo + // component: IzStatus, // todo + component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/IzStatus.vue")), }, - izuptime: { + izyear: { label: '提报时间', defaultValue: null, isDefaultFilter: false, - key: 'izuptime', - component: TimeVue, + key: 'izyear', + // component: TimeVue, + component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/Time.vue")), }, iztaskrrom: { label: '任务来源', defaultValue: null, isDefaultFilter: false, key: 'iztaskrrom', - component: IztaskrromVue, + // component: IztaskrromVue, + component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/Iztaskrrom.vue")), }, izshowall: { label: '显示全部任务数据', defaultValue: false, isDefaultFilter: false, key: 'izshowall', - component: IzShowAll, + // component: IzShowAll, + component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/IzShowAll.vue")), inFilterList: false, }, } @@ -137,90 +145,103 @@ export const asideTaskMap: Recordable = { defaultValue: null, isDefaultFilter: true, key: 'izApprovalStatus', - component: IzApprovalStatus, // todo + // component: IzApprovalStatus, // todo + component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/IzApprovalStatus.vue")), }, izuptime: { label: '提报时间', defaultValue: null, isDefaultFilter: true, key: 'izuptime', - component: TimeVue, + // component: TimeVue, + component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/Time.vue")), }, izupuser: { label: '提报人', defaultValue: null, isDefaultFilter: true, key: 'izupuser', - component: ReportUserVue, + // component: ReportUserVue, + component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/ReportUser.vue")), }, iztaskrrom: { label: '任务来源', defaultValue: null, isDefaultFilter: true, key: 'iztaskrrom', - component: IztaskrromVue, + // component: IztaskrromVue, + component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/Iztaskrrom.vue")), }, izcustomname: { label: '拜访客户', defaultValue: null, isDefaultFilter: true, key: 'izcustomname', - component: IzCustomname, + // component: IzCustomname, + component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/IzCustomname.vue")), }, izcustomtype: { label: '客户类型', defaultValue: null, isDefaultFilter: true, key: 'izcustomtype', - component: IzCustomtype, + // component: IzCustomtype, + component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/IzCustomtype.vue")), }, izproject: { label: '所属项目', defaultValue: null, isDefaultFilter: true, key: 'izproject', - component: IzProjectVue, + // component: IzProjectVue, + component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/IzProject.vue")), }, izvisitpro: { label: '拜访省份/直辖市', defaultValue: null, isDefaultFilter: true, key: 'izvisitpro', - component: IzVisitcity, + // component: IzVisitcity, + component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/IzVisitcity.vue")), }, izcustomlevel: { label: '客户级别', defaultValue: null, isDefaultFilter: true, key: 'izcustomlevel', - component: IzCustomlevel, + // component: IzCustomlevel, + component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/IzCustomlevel.vue")), }, izprojecttype: { label: '项目类别', defaultValue: null, isDefaultFilter: true, key: 'izprojecttype', - component: IzProjecttype, + // component: IzProjecttype, + component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/IzProjecttype.vue")), }, izproductname: { label: '产品名称', defaultValue: null, isDefaultFilter: true, key: 'izproductname', - component: IzProductVue, + // component: IzProductVue, + component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/IzProduct.vue")), }, izvisitcity: { label: '拜访城市', defaultValue: null, isDefaultFilter: true, key: 'izvisitcity', - component: IzvisitproVue, + // component: IzvisitproVue, + component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/Izvisitpro.vue")), }, izfirm: { label: '厂商', defaultValue: null, isDefaultFilter: true, key: 'izfirm', - component: IzfirmVue, + // component: IzfirmVue, + component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/Izfirm.vue")), }, } diff --git a/src/layout/components/Header/RecycleModal.vue b/src/layout/components/Header/RecycleModal.vue index 46688d4..c9f9b7c 100644 --- a/src/layout/components/Header/RecycleModal.vue +++ b/src/layout/components/Header/RecycleModal.vue @@ -66,6 +66,15 @@ const viewLabel = computed(() => { return item?.label }) +const maxHeight = computed(() => { + let height = "800"; + const screenWidth = window.screen.width; + if(screenWidth <= 1920) { + height = "600"; + } + return height + 'px'; +}) + const masonryRef = ref(null) const el = ref(null) const elwc = ref(null) @@ -102,6 +111,12 @@ const layout = debounce(() => { const clientHeight = el.value!.clientHeight const top = scrollHeight - clientHeight - 20 el.value!.scrollTo({ top, behavior: 'instant' }) + // let height = 800 - 15; + // const screenWidth = window.screen.width; + // if(screenWidth <= 1920) { + // height = 600 - 15; + // } + // el.value!.scrollTo({ top: height, behavior: 'instant' }) loading = false console.log("loading---------------", loading); }) @@ -383,7 +398,8 @@ async function onChange() { // orderbyname: val, orderByUptime: timeRange.value } - pagination.pageNo = 1 + pagination.pageNo = 1; + canloadMore = true; const list = await featchList() listData.value = list layout() @@ -399,7 +415,8 @@ async function onChangeView() { // orderbyname: val, orderBySimilarity: similarRange.value } - pagination.pageNo = 1 + pagination.pageNo = 1; + canloadMore = true; const list = await featchList() listData.value = list layout() @@ -601,13 +618,13 @@ watch(() => show.value, watch(() => pagination.pageNo, (newVal, oldVal) => { + console.log("加载了22222222222222222---------------------------", newVal, oldVal, canloadMore); if(newVal == oldVal) { return } if((newVal == 1 || newVal == 2) && canloadMore) { setTimeout(() => { nextTick(() => { - console.log("加载了22222222222222222---------------------------", newVal); loading = false loadMore(); }) @@ -695,7 +712,7 @@ watch(() => pagination.pageNo,
-
+
({ + systemConfig: null, customConfig: null, asideValue: null, listKey: 0, + searchValue: "", + isAllowDownload: true, + timeNum: 0, + filterConfig: [], }), getters: { + getSystemConfig(): AsideConfig | null { + return this.systemConfig + }, getCustomConfig(): string[] | null { return this.customConfig }, getAsideValue(): any { return this.asideValue }, + getSearchValue(): any { + return this.searchValue + }, + getIsAllowDownload(): any { + return this.isAllowDownload + }, + getTimeNum(): any { + return this.timeNum + }, + getFilterConfig(): any { + return this.filterConfig + }, }, actions: { + setSystemConfig(config: AsideConfig) { + this.systemConfig = config + console.log("systemConfig----------", config); + }, setAsideValue(value) { this.asideValue = value }, setListKey() { this.listKey = new Date().getTime() }, - // 获取终审个性化配置 + setSearchValue(value) { + this.searchValue = value + }, + setIsAllowDownload(value) { + this.isAllowDownload = value + }, + setTimeNum(value) { + this.timeNum = value + }, + // 设置个性化配置 + setCustomConfig(value) { + this.customConfig = value + }, + setFilterConfig(value) { + this.filterConfig = value + }, + // 获取系统配置信息 + async fetchConfig() { + // 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(',') : [] + const list = data && data.searchcount ? data.searchcount.split(',') : []; + console.log("listkey---------------", list); this.customConfig = list return list }, diff --git a/src/store/modules/task.ts b/src/store/modules/task.ts index f66b80c..658dccd 100644 --- a/src/store/modules/task.ts +++ b/src/store/modules/task.ts @@ -49,7 +49,7 @@ export const useTaskStore = defineStore({ back() { if (this.currentIndex === 0) return - + this.setActive(--this.currentIndex) }, async fetchApprovalList(pagination) { diff --git a/src/views/final/aside/Aside.vue b/src/views/final/aside/Aside.vue index af48f26..7a743c6 100644 --- a/src/views/final/aside/Aside.vue +++ b/src/views/final/aside/Aside.vue @@ -22,6 +22,8 @@ import type { AsideEntity } from "@/config/aside"; import { asideMap } from "@/config/final"; import type { AsideConfig } from "/#/api"; import emitter from "@/utils/mitt"; +import { getFilterList } from "@/api/home/main"; +import { cloneDeep, isEqual } from "lodash-es"; const emit = defineEmits(["inputChange"]); const finalStore = useFinal(); @@ -31,6 +33,17 @@ const asideValue: Record = reactive({}); const asideVisible: Partial> = reactive({}); // 当前显示的模块,按照数组顺序显示 const showItems = shallowRef<{ key: string; config: AsideEntity }[]>([]); +const initAsideValueRef = ref(null); // 所有左侧模块的值(初始值) +const customObjRef = ref(null); // 获取高级筛选获取的值 +const customTempObjRef = ref(null); // 获取高级筛选获取的值(作对比) +const configFilterRef = ref([]); // 获取排序的值 + +initAsideValueRef.value = cloneDeep(asideMap); + +onBeforeMount(async () => { + finalStore.fetchConfig(); + finalStore.fetchCustomConfig(); +}); Object.keys(asideMap).forEach((key) => { const { defaultValue, inFilterList } = asideMap[key]; @@ -99,38 +112,132 @@ onBeforeMount(async () => { finalStore.fetchCustomConfig(); }); -finalStore.$subscribe(() => { - const customConfig = finalStore.getCustomConfig; - - 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; +nextTick(()=>{ + finalStore.$subscribe(() => { + // const customConfig = finalStore.getCustomConfig; + // console.log("customConfig订阅aside---------------", 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; + if ( + configFilterRef.value.length > 0 && + isEqual(configFilterRef.value, finalStore.getFilterConfig) && + customObjRef.value && + isEqual(customObjRef.value, customTempObjRef.value) + ) { + return; } - }, []); - - showItems.value = items; -}); + 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) => { + const currentData = asideMap[key]; + const render = currentData?.render; + if (render !== false) { + const str = key?.toLowerCase(); + + const o = { + key: str, + config: asideMap[str], + }; + return [...acc, o]; + } else { + return acc; + } + }, []); + console.log("showItems=================================", items); + showItems.value = items; + configFilterRef.value = finalStore.getFilterConfig; + }); +}) watch(asideVisible, (newVal) => { Object.keys(asideValue).forEach((key) => { @@ -159,8 +266,22 @@ function scrollHandler(key: string) { element?.scrollIntoView(true); } -function filterHandler(searchId: string) { +async function filterHandler(searchId: string) { emitter.emit("filter-final", searchId); + const res = await getFilterList({ userSearchId: searchId }); + // console.log("顾虑结果", res); + if (res.code == "OK") { + let obj = res.data; + customObjRef.value = res.data; + let showKeys: any[] = []; + Object.keys(obj).map((key) => { + if (asideMap.hasOwnProperty(key)) { + showKeys.push(key); + } + }); + console.log("showKeys1111111111111111", showKeys); + finalStore.setCustomConfig(showKeys); + } } function editFilter(filter: any) { @@ -169,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); @@ -186,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); +} +