fix: bug#10824

This commit is contained in:
xieyonghong 2023-03-27 19:18:59 +08:00
parent c366f4a2cc
commit c34647fad5
3 changed files with 30 additions and 28 deletions

View File

@ -192,28 +192,30 @@ const columns = [
hideInTable: true, hideInTable: true,
search: { search: {
type: 'treeSelect', type: 'treeSelect',
options: getTreeData_api({ paging: false }).then((resp: any) => { options: () => new Promise((resolve) => {
const formatValue = (list: any[]) => { getTreeData_api({ paging: false }).then((resp: any) => {
return list.map((item: any) => { const formatValue = (list: any[]) => {
if (item.children) { return list.map((item: any) => {
item.children = formatValue(item.children); if (item.children) {
} item.children = formatValue(item.children);
return { }
...item, return {
value: JSON.stringify({ ...item,
assetType: 'product', value: JSON.stringify({
targets: [ assetType: 'product',
{ targets: [
type: 'org', {
id: item.id, type: 'org',
}, id: item.id,
], },
}), ],
} }),
}) }
} })
return formatValue(resp.result) }
}), resolve(formatValue(resp.result) || [])
})
})
} }
} }
] ]

View File

@ -175,14 +175,14 @@ const handOptionByColumn = (option: any) => {
termTypeOptions.value = option.termTypes || [] termTypeOptions.value = option.termTypes || []
tabsOptions.value[0].component = option.type tabsOptions.value[0].component = option.type
if (option.type === 'boolean') { if (option.type === 'boolean') {
valueOptions.value = [ valueOptions.value = option.options?.map((item: any) => ({ ...item, label: item.name, value: item.id})) || [
{ name: '是', id: true }, { label: '是', value: true },
{ name: '否', id: false }, { label: '否', value: false },
] ]
} else if(option.type === 'enum') { } else if(option.type === 'enum') {
valueOptions.value = option.options?.map((item: any) => ({ ...item, label: item.name, value: item.id})) || [] valueOptions.value = option.options?.map((item: any) => ({ ...item, label: item.name, value: item.id})) || []
} else{ } else{
valueOptions.value = option.options || [] valueOptions.value = (option.options || []).map((item: any) => ({ ...item, label: item.name, value: item.id}))
} }
valueColumnOptions.value = treeFilter(cloneDeep(columnOptions.value), option.type, 'type') valueColumnOptions.value = treeFilter(cloneDeep(columnOptions.value), option.type, 'type')
} else { } else {

View File

@ -176,14 +176,14 @@ const handOptionByColumn = (option: any) => {
} }
if (option.dataType === 'boolean') { if (option.dataType === 'boolean') {
valueOptions.value = [ valueOptions.value = option.options?.map((item: any) => ({ ...item, label: item.name, value: item.id})) || [
{ label: '是', value: true }, { label: '是', value: true },
{ label: '否', value: false }, { label: '否', value: false },
] ]
} else if(option.dataType === 'enum') { } else if(option.dataType === 'enum') {
valueOptions.value = option.options?.map((item: any) => ({ ...item, label: item.name, value: item.id})) || [] valueOptions.value = option.options?.map((item: any) => ({ ...item, label: item.name, value: item.id})) || []
} else{ } else{
valueOptions.value = option.options || [] valueOptions.value = (option.options || []).map((item: any) => ({ ...item, label: item.name, value: item.id}))
} }
} else { } else {
termTypeOptions.value = [] termTypeOptions.value = []