fix: 新增菜单没有主目录 #I6Y1X2
parent
0143cd5978
commit
4ff33d87f5
|
@ -22,7 +22,8 @@ const props = defineProps({
|
|||
params: { type: Object },
|
||||
immediate: { type: Boolean, default: true },
|
||||
resultField: propTypes.string.def(''),
|
||||
handleTree: { type: String, default: '' }
|
||||
handleTree: { type: String, default: '' },
|
||||
parent: { type: String, default: '' }
|
||||
})
|
||||
const emit = defineEmits(['options-change', 'change'])
|
||||
const attrs = useAttrs()
|
||||
|
@ -79,7 +80,13 @@ async function fetch() {
|
|||
if (props.handleTree) {
|
||||
result = handleTree(result, props.handleTree)
|
||||
}
|
||||
if (props.parent) {
|
||||
treeData.value = [{ id: 0, name: props.parent, children: [] }]
|
||||
treeData.value[0].children = (result as Recordable[]) || []
|
||||
} else {
|
||||
treeData.value = (result as Recordable[]) || []
|
||||
}
|
||||
|
||||
isFirstLoaded.value = true
|
||||
emit('options-change', treeData.value)
|
||||
}
|
||||
|
|
|
@ -85,6 +85,7 @@ export const formSchema: FormSchema[] = [
|
|||
component: 'ApiTreeSelect',
|
||||
componentProps: {
|
||||
api: () => listSimpleMenus(),
|
||||
parent: '主类目',
|
||||
fieldNames: {
|
||||
label: 'name',
|
||||
key: 'id',
|
||||
|
|
Loading…
Reference in New Issue