58 lines
1.2 KiB
TypeScript
58 lines
1.2 KiB
TypeScript
import type { Ref } from 'vue';
|
|
import { ref } from 'vue';
|
|
|
|
export const rootMenus: any[] = [];
|
|
|
|
export const nodeMenus: any[] = [];
|
|
|
|
export const useDbTree = (dbTreeRef: Ref<any>) => {
|
|
const treeData = ref<any[]>([
|
|
{
|
|
id: '1',
|
|
label: '工料机总类',
|
|
children: [
|
|
{
|
|
id: '2',
|
|
label: '广东',
|
|
children: [
|
|
{ id: '3', label: '广东工民建工料机' },
|
|
{ id: '4', label: '广东公路工料机' },
|
|
{ id: '5', label: '广东水利工料机' }
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
id: '11',
|
|
label: '工料机总类2',
|
|
children: [
|
|
{
|
|
id: '12',
|
|
label: '广西',
|
|
children: [
|
|
{ id: '13', label: '工料机1' },
|
|
{ id: '14', label: '工料机1' },
|
|
{ id: '15', label: '工料机2' }
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]);
|
|
|
|
const handleTreeNodeEdit = (payload: any) => {
|
|
console.log('节点编辑保存:', payload);
|
|
};
|
|
|
|
const handleTreeNodeSelect = (payload: any) => {
|
|
console.log('节点点击:', payload);
|
|
};
|
|
|
|
return {
|
|
treeData,
|
|
rootMenus,
|
|
nodeMenus,
|
|
handleTreeNodeEdit,
|
|
handleTreeNodeSelect,
|
|
};
|
|
};
|