Ben Lin
2024-09-24 3bf0e1e45acfb85fb6054dc55d1c1204a6750998
src/views/components/GeneralTree.vue
@@ -4,7 +4,7 @@
 * @version: 
 * @Date: 2024-06-19 11:07:21
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-06-21 13:31:30
 * @LastEditTime: 2024-09-22 00:19:36
-->
<template>
  <div class="m-4 mr-0 overflow-hidden bg-white">
@@ -14,19 +14,22 @@
      search
      :add="add"
      treeWrapperClassName="h-[calc(100%-35px)] overflow-auto"
      :clickRowToExpand="false"
      :clickRowToExpand="true"
      :treeData="treeData"
      :renderIcon="createIcon"
      :fieldNames="fieldNames"
      @select="handleSelect"
      @handleAdd="handleAdd"
      @unselect="UnSelect"
      :beforeRightClick="props.beforeRightClick"
      :defaultExpandAll="true"
    />
  </div>
</template>
<script lang="ts" setup>
  import { onMounted, ref } from 'vue';
  import { FieldNames, TigerTree, TreeItem } from '/@/components/TigerTree'
  import { ContextMenuItem, ContextMenuOptions, FieldNames, TigerTree, TreeItem } from '/@/components/TigerTree';
  import { EventDataNode } from 'ant-design-vue/lib/tree';
  defineOptions({ name: 'CustTree' });
@@ -37,13 +40,17 @@
      type: String,
    },
    treeData: {
      type:  Array as PropType<TreeItem[]>,
      type: Array as PropType<TreeItem[]>,
    },
    createIcon: {
      type: Function as PropType<(params: Recordable<any>) => string>,
    },
    add: {type: Boolean,},
    fieldNames: {type: Object as PropType<FieldNames>},
    add: { type: Boolean },
    fieldNames: { type: Object as PropType<FieldNames> },
    beforeRightClick: {
      type: Function as PropType<(...arg: any) => ContextMenuItem[] | ContextMenuOptions>,
      default: undefined,
    },
  });
  function handleSelect(keys, e) {
@@ -54,7 +61,6 @@
    emit('handleAdd');
  }
  function UnSelect(node) {
    emit('UnSelect', node);
  }