| | |
| | | * @version: |
| | | * @Date: 2024-06-26 15:31:43 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-06-26 21:41:54 |
| | | * @LastEditTime: 2024-06-29 05:50:18 |
| | | --> |
| | | <template> |
| | | <GeneralTree |
| | |
| | | |
| | | const emit = defineEmits(['select']); |
| | | const objParams = inject('objParams') as Ref<any>; |
| | | const nodeType = inject('nodeType') as Ref<any>; |
| | | const selectedNodes = inject('selectedNodes') as Ref<any>; |
| | | const custImport = ref<any[]>([]); |
| | | const EntityCustFunction = ref([ |
| | |
| | | try { |
| | | custImport.value = await import(`../entityts/${objParams.value['Name']}.ts`); |
| | | } catch (e) {} |
| | | const [{ CreateIcon, SelectNode }] = isNullOrUnDef(custImport.value['default']) |
| | | const [{ CreateIcon, SelectNode, fetchTreeData }] = isNullOrUnDef(custImport.value['default']) |
| | | ? EntityCustFunction.value |
| | | : custImport.value['default'](); |
| | | const treeData = ref<TreeItem[]>([]); |
| | |
| | | */ |
| | | async function fetch(type: string) { |
| | | if (!isNullOrUnDef(custImport.value)) { |
| | | const [{ fetchTreeData }] = custImport.value['default'](); |
| | | // const [{ fetchTreeData }] = custImport.value['default'](); |
| | | //根据type获取树形数据 |
| | | const data = await fetchTreeData(type, objParams.value['CODE']); |
| | | title.value = data.title; |
| | |
| | | } |
| | | |
| | | function handleSelect(Id = '', info) { |
| | | nodeType.value = info.selectedNodes[0].type; |
| | | selectedNodes.value = info.selectedNodes; |
| | | emit('select', SelectNode(selectedNodes)); |
| | | } |
| | |
| | | * @return {*} |
| | | */ |
| | | function UnSelect(node) { |
| | | nodeType.value = ''; |
| | | emit('select', SelectNode(undefined)); |
| | | // reload(); |
| | | } |