| | |
| | | * @version: |
| | | * @Date: 2024-06-26 15:31:43 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-06-26 18:48:09 |
| | | * @LastEditTime: 2024-06-26 21:41:54 |
| | | --> |
| | | <template> |
| | | <GeneralTree |
| | |
| | | import { TreeItem } from '/@/components/TigerTree'; |
| | | import { EntityCustFunctionType } from '/@/api/tigerapi/model/basModel'; |
| | | |
| | | 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 EntityCustFunction = ref([ |
| | | { |
| | | CreateIcon(params: Recordable<any>) {}, |
| | | SelectNode(selectedNodes: Ref<any[]>) {}, |
| | | } as EntityCustFunctionType, |
| | | ]); |
| | | /* 动态import实体名.ts的自定义方法 */ |
| | | try { |
| | | custImport.value = await import(`../entityts/${objParams.value['Name']}.ts`); |
| | | } catch (e) {} |
| | | const [{ CreateIcon }] = isNullOrUnDef(custImport.value['default']) |
| | | const [{ CreateIcon, SelectNode }] = isNullOrUnDef(custImport.value['default']) |
| | | ? EntityCustFunction.value |
| | | : custImport.value['default'](); |
| | | const treeData = ref<TreeItem[]>([]); |
| | |
| | | } |
| | | |
| | | function handleSelect(Id = '', info) { |
| | | // searchInfo.Id = Id; |
| | | nodeType.value = info.selectedNodes[0].type; |
| | | selectedNodes.value = info.selectedNodes; |
| | | // prodCode.value =rotType.value=='Product'? info.selectedNodes[0].code: prodCode.value; |
| | | // actionCode.value = rotType.value == 'Action' ? info.selectedNodes[0].code : actionCode.value; |
| | | // custCode.value = rotType.value == 'Customer' ? info.selectedNodes[0].code : custCode.value; |
| | | // reload(); |
| | | emit('select', SelectNode(selectedNodes)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | function UnSelect(node) { |
| | | nodeType.value = ''; |
| | | emit('select', SelectNode(undefined)); |
| | | // reload(); |
| | | } |
| | | </script> |