From 155879360ae9b03eff9ffe87e01175bd4a6c7f01 Mon Sep 17 00:00:00 2001 From: danshihao Date: Thu, 1 Aug 2024 20:44:03 +0800 Subject: [PATCH] =?UTF-8?q?[fix=2087598]=20=E6=8B=86=E5=88=86-=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E6=8B=86=E5=88=86=E7=BB=93=E6=9E=9C-=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E6=A0=87=E5=87=86=E6=9D=A5=E6=BA=90=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../selection/StandardSelectionModal.vue | 75 ++++++++++++++++++- .../modules/ImportSplitResultModal.vue | 4 +- .../documentSplit/modules/SplitText.vue | 29 +++++-- 3 files changed, 100 insertions(+), 8 deletions(-) diff --git a/src/components/selection/StandardSelectionModal.vue b/src/components/selection/StandardSelectionModal.vue index eb30525..a9d299a 100644 --- a/src/components/selection/StandardSelectionModal.vue +++ b/src/components/selection/StandardSelectionModal.vue @@ -12,7 +12,7 @@
- + + + + + + + { return {} } + }, + // 是否拆分的搜索(来源换成外部标准结构树) + splitSearch: { + type: Boolean, + required: false, + default: false } }, data () { @@ -189,7 +214,15 @@ export default { } ], dataList: [], - sourceOptions: [] + sourceOptions: [], + // 标准结构树 + standardStructureTree: [] + } + }, + created () { + // 拆分的需要加载标准结构树 + if (this.splitSearch) { + this.loadStandardStructureTree() } }, methods: { @@ -210,6 +243,38 @@ export default { } }) }, + // 加载标准结构树 + loadStandardStructureTree () { + // option 不传显示我的收藏,1不显示我的收藏, 2只能选二级中国及中国下三级,和欧盟EU + getForeignStandardTree({ option: 2 }).then(res => { + if (res.success) { + const data = res.result || [] + this.standardStructureTree = data.map(item => { + item.disabled = true + return item + }) + } + }) + }, + // tree-select搜索 + filterTreeOption (input, option) { + const text = option.componentOptions.propsData.title || option.componentOptions.propsData.label + return text.toLowerCase().indexOf(input.toLowerCase()) >= 0 + }, + // 获取树结构没有被禁用的value值 + getValuesWhereNotDisabled (tree = []) { + const values = [] + function traverse (node) { + if (!node.disabled) { // 只处理 disabled 不为 true 的节点 + values.push(node.value) + } + if (node.children && node.children.length > 0) { + node.children.forEach(child => traverse(child)) + } + } + tree.forEach(node => traverse(node)) + return values + }, // 获取表格数据 replacePage (arg) { if (arg === 1) { @@ -222,6 +287,12 @@ export default { pageSize: this.ipagination.pageSize, excludeStandardNumbers: this.excludeStandardNumbers } + // 标准结构树 + if (Array.isArray(query.standardSystem) && query.standardSystem.length) { + query.standardSystem = query.standardSystem.map(item => item.value).join(',') + } else { + query.standardSystem = this.getValuesWhereNotDisabled(this.standardStructureTree).join(',') + } // 清空在可选范围内进行查询 if (!query.source && this.canSelectedSource.length < 3) { query.source = this.canSelectedSource.join(',') diff --git a/src/views/documentTool/documentSplit/modules/ImportSplitResultModal.vue b/src/views/documentTool/documentSplit/modules/ImportSplitResultModal.vue index 78f9cfa..c4ce785 100644 --- a/src/views/documentTool/documentSplit/modules/ImportSplitResultModal.vue +++ b/src/views/documentTool/documentSplit/modules/ImportSplitResultModal.vue @@ -17,9 +17,11 @@ diff --git a/src/views/documentTool/documentSplit/modules/SplitText.vue b/src/views/documentTool/documentSplit/modules/SplitText.vue index dd3b902..fdb62eb 100644 --- a/src/views/documentTool/documentSplit/modules/SplitText.vue +++ b/src/views/documentTool/documentSplit/modules/SplitText.vue @@ -151,6 +151,20 @@ export default { this.loadStandardStructureTree() }, methods: { + // 获取树结构没有被禁用的value值 + getValuesWhereNotDisabled (tree = []) { + const values = [] + function traverse (node) { + if (!node.disabled) { // 只处理 disabled 不为 true 的节点 + values.push(node.value) + } + if (node.children && node.children.length > 0) { + node.children.forEach(child => traverse(child)) + } + } + tree.forEach(node => traverse(node)) + return values + }, getQueryParams () { // 获取查询条件 const sqp = {} @@ -162,18 +176,23 @@ export default { param.field = this.getQueryField() param.pageNo = this.ipagination.current param.pageSize = this.ipagination.pageSize - if (Array.isArray(param.standardSystem)) { + if (Array.isArray(param.standardSystem) && param.standardSystem.length) { param.standardSystem = param.standardSystem.map(item => item.value).join(',') + } else { + param.standardSystem = this.getValuesWhereNotDisabled(this.standardStructureTree).join(',') } return filterObj(param) }, // 加载标准结构树 loadStandardStructureTree () { - // option 不传显示我的收藏,1不显示我的收藏 - getForeignStandardTree({ option: 1 }).then(res => { + // option 不传显示我的收藏,1不显示我的收藏, 2只能选二级中国及中国下三级,和欧盟EU + getForeignStandardTree({ option: 2 }).then(res => { if (res.success) { - console.log(res.result) - this.standardStructureTree = res.result || [] + const data = res.result || [] + this.standardStructureTree = data.map(item => { + item.disabled = true + return item + }) } }) },