diff --git a/src/views/archivesManage/managementLibrary/anjuan/index.vue b/src/views/archivesManage/managementLibrary/anjuan/index.vue index 5682a6b..0f03e9b 100644 --- a/src/views/archivesManage/managementLibrary/anjuan/index.vue +++ b/src/views/archivesManage/managementLibrary/anjuan/index.vue @@ -58,6 +58,7 @@ export default { closeDrawer() { this.anjuanDrawer = false this.$parent.parentsProjectId = null + this.$parent.parentsProjectRow = null } } } diff --git a/src/views/archivesManage/managementLibrary/index.vue b/src/views/archivesManage/managementLibrary/index.vue index b29c09f..d7c7b79 100644 --- a/src/views/archivesManage/managementLibrary/index.vue +++ b/src/views/archivesManage/managementLibrary/index.vue @@ -129,6 +129,7 @@ export default { selectedCategory: {}, yearChildData: '', parentsProjectId: null, + parentsProjectRow: null, parentsAnjuanId: null, parentsJuanneiId: null, smartQuery: { @@ -253,6 +254,7 @@ export default { this.parentsProjectId = null this.parentsAnjuanId = null this.parentsJuanneiId = null + this.parentsProjectRow = null // 缓存当前的选中的 localStorage.setItem('currentArchivesKey', JSON.stringify(val)) this.selectedCategory = val @@ -264,6 +266,7 @@ export default { } this.$nextTick(() => { this.handlePageList() + this.getDictsList() }) }, handlePageList(isQuickFilter) { @@ -389,9 +392,9 @@ export default { } } }, - handleOpenAnjuan(data, parentId) { + handleOpenAnjuan(data, parentId, parentsRow) { this.parentsProjectId = parentId - console.log('this.parentsProjectId', this.parentsProjectId) + this.parentsProjectRow = parentsRow this.$refs.anjuanEle.anjuanDrawer = true this.activeIndex = 0 if (this.$refs.anjuanEle.$refs.ajContent) { @@ -509,6 +512,7 @@ export default { ::v-deep .custom-tree-node{ font-size: 14px; + font-weight: normal; } [data-theme=light] .elect-cont-right { diff --git a/src/views/archivesManage/managementLibrary/mixins/index.js b/src/views/archivesManage/managementLibrary/mixins/index.js index efcd0ea..2d5f6b7 100644 --- a/src/views/archivesManage/managementLibrary/mixins/index.js +++ b/src/views/archivesManage/managementLibrary/mixins/index.js @@ -1,6 +1,7 @@ import { FetchInitCategoryViewTable } from '@/api/collect/collect' import { FetchInitContorlView } from '@/api/archivesManage/library' +import { FetchDictionaryTree } from '@/api/system/dict' import { crud } from '@crud/crud' export const manageLibraryCrud = { mixins: [crud()], @@ -84,7 +85,6 @@ export const manageLibraryCrud = { } } } - setTimeout(() => { this.getViewTable(categoryLevel, this.parentsId, 'search') }, 200) @@ -234,7 +234,86 @@ export const manageLibraryCrud = { } }) }, + // 项目级别 - 阶段分类 + getDictsList(type) { + FetchDictionaryTree().then((res) => { + const filterCodes = ['project_class'] + let filteredItems = JSON.parse(JSON.stringify(res)).filter(item => filterCodes.includes(item.dictionaryCode)) + filteredItems = this.addLevelToDictionaryList(filteredItems, 1) + if (type === 1) { + let fiterData = [] + fiterData = filteredItems.flatMap(item => { + const level2Childs = item.childDictionarys.filter(child => { + return child.dictionaryParents === item.id && child.level === 2 + }) + return level2Childs + }) + if (this.parentsData.parentsProjectRow) { + console.log(this.parentsData.parentsProjectRow.project_class) + const anjuanObj = this.parentsData.$refs.anjuanEle.$refs.ajContent.$refs.tableList + anjuanObj.$refs.collectHeaderRef.projectOptions = [] + if (this.parentsData.parentsProjectRow.project_class !== '') { + const findDic = fiterData.find(item => item.dictionaryName === this.parentsData.parentsProjectRow.project_class) + anjuanObj.$refs.collectHeaderRef.projectOptions.push(findDic) + } else { + console.log(fiterData) + anjuanObj.$refs.collectHeaderRef.projectOptions = fiterData + } + } + } else { + if (this.selectedCategory.arrangeType === 3) { + const projectObj = this.$refs.projectEle + // this.projectOptions = this.filterData(filteredItems, filteredItems[0].id) + projectObj.$refs.collectHeaderRef.projectOptions = filteredItems.flatMap(item => { + const level2Childs = item.childDictionarys.filter(child => { + return child.dictionaryParents === item.id && child.level === 2 + }) + // 将满足条件的子项目的childDictionarys设置为空数组,因为项目页不需要 + level2Childs.forEach(child => { + child.childDictionarys = [] + }) + return level2Childs + }) + } + } + }).catch(err => { + console.log(err) + }) + }, + // 显示第一级和第二级 + // filterData(data, targetId) { + // return data.filter(item => { + // if (item.id === targetId || item.dictionaryParents === targetId) { + // if (item.childDictionarys && item.childDictionarys.length > 0) { + // item.childDictionarys = this.filterData(item.childDictionarys, targetId) + // } + // return true + // } + // return false + // }) + // }, + // 给筛选出来的数据加level 方便后面是否可点击 + addLevelToDictionaryList(dictionaryList, level) { + dictionaryList.forEach(dictionary => { + dictionary.level = level + if (dictionary.childDictionarys) { + dictionary.childDictionarys = this.addLevelToDictionaryList(dictionary.childDictionarys, level + 1) + } + }) + return dictionaryList + }, + normalizerProject(node) { + if ((node.childDictionarys && !node.childDictionarys.length) || node.childDictionarys === null) { + delete node.childDictionarys + } + return { + id: node.dictionaryName, + label: `${node.dictionaryName} - ${node.dictionaryCode}`, + children: node.childDictionarys, + isDisabled: this.isTitleType === 3 ? node.level !== 3 : node.level === 1 + } + }, /* 重新渲染table组件 防止table-fixed 错位 配合watch-table数据 */ doLayout() { this.$nextTick(() => { diff --git a/src/views/archivesManage/managementLibrary/module/collectHeader.vue b/src/views/archivesManage/managementLibrary/module/collectHeader.vue index 36c02b1..373de62 100644 --- a/src/views/archivesManage/managementLibrary/module/collectHeader.vue +++ b/src/views/archivesManage/managementLibrary/module/collectHeader.vue @@ -4,12 +4,12 @@