From d0cf9019ff7e081979ea91867399280efac248a3 Mon Sep 17 00:00:00 2001 From: xuhuajiao <13476289682@163.com> Date: Wed, 16 Aug 2023 17:31:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A1=A3=E6=A1=88=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/system/archivesClass.js | 11 ++++- .../archivesClassify/module/tableList.vue | 46 ++++++++++++++++--- 2 files changed, 49 insertions(+), 8 deletions(-) diff --git a/src/api/system/archivesClass.js b/src/api/system/archivesClass.js index 5ab300c..956e775 100644 --- a/src/api/system/archivesClass.js +++ b/src/api/system/archivesClass.js @@ -9,6 +9,15 @@ export function FetchInitArchivesClass(params) { }) } +// 获取档案分类树 +export function FetchArchivesClassTree(params) { + return request({ + url: 'api/archivesClass/getArchivesClassTree', + method: 'get', + params + }) +} + export function add(data) { return request({ url: 'api/archivesClass/editArchivesClass', @@ -33,4 +42,4 @@ export function del(data) { }) } -export default { add, edit, del, FetchInitArchivesClass } +export default { add, edit, del, FetchInitArchivesClass, FetchArchivesClassTree } diff --git a/src/views/system/archivesClassify/module/tableList.vue b/src/views/system/archivesClassify/module/tableList.vue index 76a719e..04da8d8 100644 --- a/src/views/system/archivesClassify/module/tableList.vue +++ b/src/views/system/archivesClassify/module/tableList.vue @@ -40,7 +40,6 @@ @@ -178,6 +178,7 @@ export default { }, data() { return { + classifyOptions: [], categoryDatas: [], selections: [], isAllSelect: false, @@ -242,6 +243,7 @@ export default { // 新增与编辑前做的操作 [CRUD.HOOK.afterToCU](crud, form) { this.getCategoryDataTree() + this.getClassifyTree() if (form.id != null) { if (form.pid === null) { form.isTop = '1' @@ -263,13 +265,33 @@ export default { this.categoryDatas = this.filterData(res) }) }, + getClassifyTree() { + crudClassify.FetchArchivesClassTree().then(res => { + this.classifyOptions = res.map(function(obj) { + if (obj.childArchivesClass !== null) { + obj.hasChildren = true + } else { + obj.hasChildren = false + } + if (obj.hasChildren) { + obj.children = null + } + return obj + }) + }) + }, // 获取弹窗内门类数据 - loadCategorys({ action, parentNode, callback }) { + loadClassifyTree({ action, parentNode, callback }) { if (action === LOAD_CHILDREN_OPTIONS) { - FetchCategoryMenu().then(res => { + crudClassify.FetchArchivesClassTree().then(res => { parentNode.children = res.map(function(obj) { - if (obj.children) { - obj.childMenus = null + if (obj.childArchivesClass !== 0) { + obj.hasChildren = true + } else { + obj.hasChildren = false + } + if (obj.hasChildren) { + obj.children = null } return obj }) @@ -361,6 +383,16 @@ export default { children: node.children, isDisabled: node.isType !== 2 } + }, + classifyNormalizer(node) { + if (node.childArchivesClass && !node.childArchivesClass.length) { + delete node.childArchivesClass + } + return { + id: node.id, + label: node.name, + children: node.childArchivesClass + } } } }