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,7 +192,8 @@ const columns = [
hideInTable: true, hideInTable: true,
search: { search: {
type: 'treeSelect', type: 'treeSelect',
options: getTreeData_api({ paging: false }).then((resp: any) => { options: () => new Promise((resolve) => {
getTreeData_api({ paging: false }).then((resp: any) => {
const formatValue = (list: any[]) => { const formatValue = (list: any[]) => {
return list.map((item: any) => { return list.map((item: any) => {
if (item.children) { if (item.children) {
@ -212,8 +213,9 @@ const columns = [
} }
}) })
} }
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 = []