第二阶段代码
This commit is contained in:
57
apps/web-ele/src/views/database/feature/dbTree.ts
Normal file
57
apps/web-ele/src/views/database/feature/dbTree.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
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,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user