[fix 87598] 拆分-导入拆分结果-选择标准来源调整
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
<div class="table-page-search-wrapper">
|
||||
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
||||
<a-row :gutter="24">
|
||||
<a-col :sm="6">
|
||||
<a-col :sm="6" v-show="!splitSearch">
|
||||
<a-form-item :label="$t('standardSelect.source')" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<j-dict-select-tag style="width: 100%" v-model="queryParam.source"
|
||||
:disabled="disabledSourceSearch"
|
||||
@@ -22,6 +22,24 @@
|
||||
@change="handleTypeChange" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<!--标准结构树-->
|
||||
<a-col :md="8" :sm="12" v-if="splitSearch">
|
||||
<a-form-item :label="$t('docTool.comparison.standardStructureTree')">
|
||||
<a-tree-select
|
||||
tree-node-filter-prop="title"
|
||||
v-model="queryParam.standardSystem"
|
||||
:maxTagCount="1"
|
||||
:getPopupContainer="triggerNode=> triggerNode.parentNode"
|
||||
:tree-data="standardStructureTree"
|
||||
tree-checkable
|
||||
show-search
|
||||
allowClear
|
||||
tree-check-strictly
|
||||
:filterTreeNode="filterTreeOption"
|
||||
:placeholder="$t('pleaseSelect') + $t('docTool.comparison.standardStructureTree')"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :sm="8">
|
||||
<a-form-item :label="$t('standardSelect.standardNumOrName')" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-input :placeholder="$t('pleaseEnter')+$t('standardSelect.standardNumOrName')"
|
||||
@@ -83,6 +101,7 @@
|
||||
import { ajaxGetDictItems, getStandardList } from '@/api/api'
|
||||
import JDictSelectTag from '../dict/JDictSelectTag'
|
||||
import { StandardSource } from '../../enums/commonEnums'
|
||||
import { getForeignStandardTree } from '@api/standardRegulationLibraryApi'
|
||||
|
||||
export default {
|
||||
name: 'StandardSelectionModal',
|
||||
@@ -127,6 +146,12 @@ export default {
|
||||
default: () => {
|
||||
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(',')
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('standardSelect.standardNumber')">
|
||||
<standard-selection :placeholder="$t('pleaseSelect') + $t('standardSelect.standardNumber')"
|
||||
type="radio"
|
||||
splitSearch
|
||||
disabledSourceSearch
|
||||
@nameChange="handleStandardNumberChange"
|
||||
:select-only="true"
|
||||
:can-selected-source="[StandardSource.FOREIGN.value, StandardSource.ENTERPRISE.value]"
|
||||
:can-selected-source="[StandardSource.FOREIGN.value]"
|
||||
class="readonly-input"
|
||||
v-decorator="['serialNumber', validatorRules.serialNumber]" />
|
||||
</a-form-item>
|
||||
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user