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 + }) } }) },