From 0108df13340210bebd5ad6c693fc1a6bd1b061ff Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期二, 05 三月 2024 22:57:51 +0800
Subject: [PATCH] !88 合并flowable工作流功能 * merge 合并dev * add 添加抄送查询 * add 添加我的已办 * add 添加抄送 * add 添加附件下载 * update 优化类型 * Merge remote-tracking branch 'origin/future/flowable' into future/flowable * fix 修复 流程设计器打包部署报错问题 * add 添加审批附件上传 * update 修复固定值未在xml显示问题 * update 修复跳转条件回显Object问题 * update 优化面板文件名称 * update 调整key * remove 移除旧设计器,添加xml保存 * update 增加任务面板提示 * update 优化xml预览和svg预览 * update 优化xml预览和svg预览 * update 优化模型设计 * update 优化设计器 * update 优化设计器 * update 优化设计器 * update 删除旧设计器 * update 删除console.log * add 添加模型接口 * update 优化预览xml和svg样式被修改问题 * update 优化属性面板,增加展开动画 * update 去除开发模式 * update 优化任务栏样式 * update 优化图标渲染样式 * update 增加BpmnFactory类型 * update 增加BpmnFactory * update 移除users和group * update 移除无用类型 * update 优化页面类型 * update 去除多余属性 * update 完善流程线 * update 增加复杂网关 * update 完善流程 * update 完善网关 * update 优化网关汉化 * update 优化过期时间选择 * update 支持多实例 * update 增加类容提示 * update 支持选择组 * update 新增角色api * update 优化roleSelect 选中未确定,再次打开还保留选中的问题 * update 优化userSelect 选中未确定,再次打开还保留选中的问题 * update 优化userSelect 选中未确定,再次打开还保留选中的问题 * update 去掉modeler store多余属性 bpmnModel * update 优化属性面板,当面板未选中时默认展示流程面板 * update 优化TaskPanel类型,去掉roles属性 * update 优化用户api * update 优化用户选择器 * update 优化执行监听器 * update 优化任务监听器 * update 优化usePanel方法 * update 选人优化 * update 增加扩展节点信息 * update 增加usePanel默认方法 * update 去除处理事件 * update 扩展flowable  userinfo属性 * update 全局modeler 改为非响应式 * update 增加hooks方法 * update 修改命名 * update 修改面板formData来源 * update 重写用户任务面板选择逻辑 * update 重写用户任务面板选择逻辑 * update 修改用户选择组件获取数据逻辑 * update 修改枚举类型 * update 修改默认配置列 * update 增加修改节点方法 * update 调整预览窗口大小 * update 优化用户选择组件 返回值 * update 优化用户选择组件 * update 新增通过ids 获取用户信息 * update 重写task面板选人 未完成 * update 升级用户选择 支持多选配置 * update 升级bpmnjs依赖版本 * update 增加useDialog类型 * update 调整全局样式 * update 代码高亮设置 * update 优化领用,归还加载 * update 增加选择角色 * update  新增角色选择组件 * update 新增过期时间选择组件 * update 调整任务面板样式 * update  调整全局dialog header 增加分割线 * update 代码高亮设置 * update  调整面板位置 * update 封装用户选择组件 * update 移除所有的节点描述 * update 删除分类 * update  调整面板位置 * update  修改命名,增加自定义渲染 * update  修改命名,增加自定义渲染 * update 增加 Element类型定义 * update 调整样式 * update 移除bpmn panel依赖,升级bpmn.js依赖到最新,修改汉化包 * update 调整类型声明文件 * update 调整类型声明文件 * update 优化面板工具 * update 优化面板工具 * Merge remote-tracking branch 'origin/future/flowable' into future/flowable * update 优化面板工具 * Merge branch 'future/flowable' of https://gitee.com/JavaLionLi/plus-ui… * add 添加修改办理人 * update 优化面板工具 * update 初始化流程数据 * Merge remote-tracking branch 'origin/future/flowable' into future/flowable * add 流程设计面板 * update 调整初始化xml * add 任务面板 * add 新增bpmn.js * update 优化request请求类判断请求头方式 * update 流程定义预览 优化 * update 流程定义预览 优化 * update 去掉console.log * update 优化工作流代码 * fix 修复待办任务 重置查询条件失效问题 * add 增加待办任务 接口类型,优化页面 * add 增加vite 启动预编译css * fix 修复i18n无感刷新问题 * Merge branch 'dev' into future/flowable * update 调整选择请假事件 * Merge branch 'dev' into future/flowable * 同步dev代码 * Merge branch 'dev' into future/flowable * 合并dev * remove 设计器无用代码 调整请假查询 * update 调整请假申请 * update 移动请假表单包结构,调整设计器选择引用表单请求错误 * remove 移除动态表单 * update 调整流程办理 * Merge branch 'dev' into future/flowable * Merge branch 'dev' into future/flowable * Merge branch 'dev' into future/flowable * Merge branch 'dev' into future/flowable * 合并 * update 调整请假申请流程提交 * update 修改业务单据流程提交 * update 调整业务单据流程提交 * 优化代码 * 优化工作流代码缩进 * 项目格式化配置修改 * 调整代码缩进 * Merge branch 'ts' into future/flowable * add 添加动态表单提交流程 * add 添加动态表单单据 * add 新增流程定义与表单关联 * update 调整点击左侧部门查询人员,部门刷新问题 * update 调整按钮图标 * 调整错别字 * update 调整流程定义图片预览 * add 添加流程实例迁移版本 * fix 修复我的单据无法提交问题 * Merge branch 'ts' into future/flowable * remove 还原代码后端解决 * update 流程设计器中分配发起人变量错误,先移除 * fix 修复设计器无法编辑问题 * update 调整设计器请求头 * Merge branch 'ts' into future/flowable * Merge branch 'ts' into future/flowable * add 添加流程定义历史列表 * update 审批记录v2改为v3 * update 调整请假必填项 * add 添加请假申请示例,添加流程定义文件部署 * update 移除流程表单 formConfig 属性,表单配置信息都放一起便于使用。 * add 添加任务加签,减签 * update 调整流程作废 * update 优化流程状态 * add 添加任务驳回 * add 添加查询当前租户所有待办,已办任务 * add 增加审批意见 * add 添加流程办理弹窗确认组件 * add 添加任务作废理由 * update 调整流程实例,流程定义检索 * add 添加我的单据页面 * add 添加任务归还认领 * add 添加流程实例,流程定义分类查询 * add 添加模型分类查询 * add 添加流程分类 * Merge remote-tracking branch 'origin/future/flowable' into future/flowable * add 添加流程表单管理页面 * add 集成vForm动态表单组件 * update xml调整超出滚动 * add 添加已办列表 * add 添加单据状态 * update 优化流程实例删除 * fix 修复流程实例查询挂起状态错误 * update 调整流程实例挂起激活状态 * add 添加流程实例列表 * update 调整流程定义弹窗提示 * add 添加流程定义列表,添加流程图,xml预览,添加简单流程启动,办理 * 调整审批记录悬浮逻辑 * 删除无用代码 * add 添加节点悬浮信息 * 调整流程预览 * 调整流程追踪 * add 添加审批记录 * add 模型设计的types * update 修改排版 * add lang=ts * update 修改ele的废弃api * fix调整审批记录图片不显示问题 * add 添加任务待办,流程图 * 调整设计器关闭 * add 添加待办 * remove 删除无用代码 * update types * 添加模型token验证 * 隐藏设计器验证按钮,隐藏表单,案例,应用程序等 * 添加模型部署 * 添加画图接口token,优化画图接口 * 添加工作流模型新增,修改,查询,删除,画图工具

---
 src/views/demo/tree/index.vue |  399 ++++++++++++++++++++++++++------------------------------
 1 files changed, 188 insertions(+), 211 deletions(-)

diff --git a/src/views/demo/tree/index.vue b/src/views/demo/tree/index.vue
index 4fa8ffd..5dfda6c 100644
--- a/src/views/demo/tree/index.vue
+++ b/src/views/demo/tree/index.vue
@@ -1,88 +1,71 @@
 <template>
-  <div class="app-container">
-    <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
-      <el-form-item label="鏍戣妭鐐瑰悕" prop="treeName">
-        <el-input
-          v-model="queryParams.treeName"
-          placeholder="璇疯緭鍏ユ爲鑺傜偣鍚�"
-          clearable
-          style="width: 200px"
-          @keyup.enter="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="鍒涘缓鏃堕棿">
-        <el-date-picker
-          v-model="daterangeCreateTime"
-          value-format="YYYY-MM-DD HH:mm:ss"
-          type="daterange"
-          range-separator="-"
-          start-placeholder="寮�濮嬫棩鏈�"
-          end-placeholder="缁撴潫鏃ユ湡"
-          :default-time="[new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 1, 1, 23, 59, 59)]"
-        ></el-date-picker>
-      </el-form-item>
-      <el-form-item>
-        <el-button type="primary" icon="search" @click="handleQuery">鎼滅储</el-button>
-        <el-button icon="Refresh" @click="resetQuery">閲嶇疆</el-button>
-      </el-form-item>
-    </el-form>
+  <div class="p-2">
+    <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
+      <div v-show="showSearch" class="mb-[10px]">
+        <el-card shadow="hover">
+          <el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="68px">
+            <el-form-item label="鏍戣妭鐐瑰悕" prop="treeName">
+              <el-input v-model="queryParams.treeName" placeholder="璇疯緭鍏ユ爲鑺傜偣鍚�" clearable style="width: 240px" @keyup.enter="handleQuery" />
+            </el-form-item>
+            <el-form-item>
+              <el-button type="primary" icon="Search" @click="handleQuery">鎼滅储</el-button>
+              <el-button icon="Refresh" @click="resetQuery">閲嶇疆</el-button>
+            </el-form-item>
+          </el-form>
+        </el-card>
+      </div>
+    </transition>
 
-    <el-row :gutter="10" class="mb8">
-      <el-col :span="1.5">
-        <el-button
-          type="primary"
-          plain
-          icon="Plus"
-          @click="handleAdd"
-          v-hasPermi="['demo:tree:add']"
-        >鏂板</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-            type="info"
-            plain
-            icon="Sort"
-            @click="toggleExpandAll"
-        >灞曞紑/鎶樺彔</el-button>
-      </el-col>
-      <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
-    </el-row>
-
-    <el-table
-      v-if="refreshTable"
-      v-loading="loading"
-      :data="treeList"
-      row-key="id"
-      :default-expand-all="isExpandAll"
-      :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
-    >
-      <el-table-column label="鐖秈d" prop="parentId" v-if="columns[0].visible" />
-      <el-table-column label="閮ㄩ棬id" align="center" prop="deptId" v-if="columns[1].visible" />
-      <el-table-column label="鐢ㄦ埛id" align="center" prop="userId" v-if="columns[2].visible" />
-      <el-table-column label="鏍戣妭鐐瑰悕" align="center" prop="treeName" v-if="columns[3].visible" />
-      <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" v-if="columns[4].visible" width="180">
-        <template #default="scope">
-          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column label="鎿嶄綔" align="center" width="150" class-name="small-padding fixed-width">
-        <template #default="scope">
-          <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['demo:tree:edit']">淇敼</el-button>
-          <el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" v-hasPermi="['demo:tree:add']">鏂板</el-button>
-          <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['demo:tree:remove']">鍒犻櫎</el-button>
-        </template>
-      </el-table-column>
-    </el-table>
-
-    <!-- 娣诲姞鎴栦慨鏀规祴璇曟爲琛ㄥ璇濇 -->
-    <el-dialog :title="title" v-model="open" width="500px" append-to-body>
-      <el-form ref="treeRef" :model="form" :rules="rules" label-width="80px">
+    <el-card shadow="hover">
+      <template #header>
+        <el-row :gutter="10" class="mb8">
+          <el-col :span="1.5">
+            <el-button v-hasPermi="['demo:tree:add']" type="primary" plain icon="Plus" @click="handleAdd()">鏂板</el-button>
+          </el-col>
+          <el-col :span="1.5">
+            <el-button type="info" plain icon="Sort" @click="handleToggleExpandAll">灞曞紑/鎶樺彔</el-button>
+          </el-col>
+          <right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
+        </el-row>
+      </template>
+      <el-table
+        ref="treeTableRef"
+        v-loading="loading"
+        :data="treeList"
+        row-key="id"
+        :default-expand-all="isExpandAll"
+        :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
+      >
+        <el-table-column label="鐖秈d" align="center" prop="parentId" />
+        <el-table-column label="閮ㄩ棬id" align="center" prop="deptId" />
+        <el-table-column label="鐢ㄦ埛id" align="center" prop="userId" />
+        <el-table-column label="鏍戣妭鐐瑰悕" align="center" prop="treeName" />
+        <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width">
+          <template #default="scope">
+            <el-tooltip content="淇敼" placement="top">
+              <el-button v-hasPermi="['demo:tree:edit']" link type="primary" icon="Edit" @click="handleUpdate(scope.row)" />
+            </el-tooltip>
+            <el-tooltip content="鏂板" placement="top">
+              <el-button v-hasPermi="['demo:tree:add']" link type="primary" icon="Plus" @click="handleAdd(scope.row)" />
+            </el-tooltip>
+            <el-tooltip content="鍒犻櫎" placement="top">
+              <el-button v-hasPermi="['demo:tree:remove']" link type="primary" icon="Delete" @click="handleDelete(scope.row)" />
+            </el-tooltip>
+          </template>
+        </el-table-column>
+      </el-table>
+    </el-card>
+    <!-- 娣诲姞鎴栦慨鏀规祴璇曟爲瀵硅瘽妗� -->
+    <el-dialog v-model="dialog.visible" :title="dialog.title" width="500px" append-to-body>
+      <el-form ref="treeFormRef" :model="form" :rules="rules" label-width="80px">
         <el-form-item label="鐖秈d" prop="parentId">
-          <treeselect
-              v-model:value="form.parentId"
-              :options="treeOptions"
-              :objMap="{ value: 'id', label: 'true_name', children: 'children' }"
-              placeholder="璇烽�夋嫨鐖秈d"
+          <el-tree-select
+            v-model="form.parentId"
+            :data="treeOptions"
+            :props="{ value: 'id', label: 'treeName', children: 'children' }"
+            value-key="id"
+            placeholder="璇烽�夋嫨鐖秈d"
+            check-strictly
           />
         </el-form-item>
         <el-form-item label="閮ㄩ棬id" prop="deptId">
@@ -91,8 +74,8 @@
         <el-form-item label="鐢ㄦ埛id" prop="userId">
           <el-input v-model="form.userId" placeholder="璇疯緭鍏ョ敤鎴穒d" />
         </el-form-item>
-        <el-form-item label="鏍戣妭鐐瑰悕" prop="treeName">
-          <el-input v-model="form.treeName" placeholder="璇疯緭鍏ユ爲鑺傜偣鍚�" />
+        <el-form-item label="鍊�" prop="treeName">
+          <el-input v-model="form.treeName" placeholder="璇疯緭鍏ュ��" />
         </el-form-item>
       </el-form>
       <template #footer>
@@ -105,177 +88,171 @@
   </div>
 </template>
 
-<script setup name="Tree">
-import { listTree, getTree, delTree, addTree, updateTree } from "@/api/demo/tree";
+<script setup name="Tree" lang="ts">
+import { listTree, getTree, delTree, addTree, updateTree } from '@/api/demo/tree';
+import { TreeVO, TreeQuery, TreeForm } from '@/api/demo/tree/types';
 
-const { proxy } = getCurrentInstance();
+type TreeOption = {
+  id: number;
+  treeName: string;
+  children?: TreeOption[];
+};
 
-const treeList = ref([]);
-const open = ref(false);
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+
+const treeList = ref<TreeVO[]>([]);
+const treeOptions = ref<TreeOption[]>([]);
 const buttonLoading = ref(false);
-const loading = ref(true);
 const showSearch = ref(true);
-const single = ref(true);
-const multiple = ref(true);
-const total = ref(0);
-const title = ref("");
 const isExpandAll = ref(true);
-const refreshTable = ref(true);
-const treeOptions = ref(undefined);
-const daterangeCreateTime = ref([]);
+const loading = ref(false);
 
-// 鍒楁樉闅愪俊鎭�
-const columns = ref([
-  { key: 0, label: `鐖秈d`, visible: false },
-  { key: 1, label: `閮ㄩ棬id`, visible: true },
-  { key: 2, label: `鐢ㄦ埛id`, visible: true },
-  { key: 3, label: `鏍戣妭鐐瑰悕`, visible: true },
-  { key: 4, label: `鍒涘缓鏃堕棿`, visible: true }
-]);
+const queryFormRef = ref<ElFormInstance>();
+const treeFormRef = ref<ElFormInstance>();
+const treeTableRef = ref<ElTableInstance>();
 
-const data = reactive({
-  // 鏌ヨ鍙傛暟
+const dialog = reactive<DialogOption>({
+  visible: false,
+  title: ''
+});
+
+const initFormData: TreeForm = {
+  id: undefined,
+  parentId: undefined,
+  deptId: undefined,
+  userId: undefined,
+  treeName: undefined
+};
+
+const data = reactive<PageData<TreeForm, TreeQuery>>({
+  form: { ...initFormData },
   queryParams: {
-    treeName: null,
-    createTime: null,
+    parentId: undefined,
+    deptId: undefined,
+    userId: undefined,
+    treeName: undefined
   },
-  // 琛ㄥ崟鍙傛暟
-  form: {},
-  // 琛ㄥ崟鏍¢獙
   rules: {
-    treeName: [
-      { required: true, message: "鏍戣妭鐐瑰悕涓嶈兘涓虹┖", trigger: "blur" }
-    ],
+    id: [{ required: true, message: '涓婚敭涓嶈兘涓虹┖', trigger: 'blur' }],
+    parentId: [{ required: true, message: '鐖秈d涓嶈兘涓虹┖', trigger: 'blur' }],
+    deptId: [{ required: true, message: '閮ㄩ棬id涓嶈兘涓虹┖', trigger: 'blur' }],
+    userId: [{ required: true, message: '鐢ㄦ埛id涓嶈兘涓虹┖', trigger: 'blur' }],
+    treeName: [{ required: true, message: '鍊间笉鑳戒负绌�', trigger: 'blur' }]
   }
 });
 
 const { queryParams, form, rules } = toRefs(data);
 
-/** 鏌ヨ娴嬭瘯鏍戣〃鍒楄〃 */
-function getList() {
+/** 鏌ヨ娴嬭瘯鏍戝垪琛� */
+const getList = async () => {
   loading.value = true;
-  listTree(proxy.addDateRange(queryParams.value, daterangeCreateTime.value, "CreateTime")).then(response => {
-    treeList.value = proxy.handleTree(response.data, "id", "parentId");
-    total.value = response.total;
+  const res = await listTree(queryParams.value);
+  const data = proxy?.handleTree<TreeVO>(res.data, 'id', 'parentId');
+  if (data) {
+    treeList.value = data;
     loading.value = false;
-  });
-}
-/** 鏌ヨ閮ㄩ棬涓嬫媺鏍戠粨鏋� */
-async function getTreeselect() {
-  await listTree().then(response => {
-    treeOptions.value = [];
-    const data = { id: 0, treeName: '椤剁骇鑺傜偣', children: [] };
-    data.children = proxy.handleTree(response.data, "id", "parentId");
-    treeOptions.value.push(data);
-  });
-}
-/** 鍙栨秷鎸夐挳 */
-function cancel() {
-  open.value = false;
+  }
+};
+
+/** 鏌ヨ娴嬭瘯鏍戜笅鎷夋爲缁撴瀯 */
+const getTreeselect = async () => {
+  const res = await listTree();
+  treeOptions.value = [];
+  const data: TreeOption = { id: 0, treeName: '椤剁骇鑺傜偣', children: [] };
+  data.children = proxy?.handleTree<TreeOption>(res.data, 'id', 'parentId');
+  treeOptions.value.push(data);
+};
+
+// 鍙栨秷鎸夐挳
+const cancel = () => {
   reset();
-}
-/** 琛ㄥ崟閲嶇疆 */
-function reset() {
-  form.value = {
-    id: undefined,
-    parentId: undefined,
-    deptId: undefined,
-    userId: undefined,
-    treeName: undefined,
-    version: undefined,
-    createTime: undefined,
-    createBy: undefined,
-    updateTime: undefined,
-    updateBy: undefined,
-    delFlag: undefined
-  };
-  proxy.resetForm("treeRef");
-}
+  dialog.visible = false;
+};
+
+// 琛ㄥ崟閲嶇疆
+const reset = () => {
+  form.value = { ...initFormData };
+  treeFormRef.value?.resetFields();
+};
+
 /** 鎼滅储鎸夐挳鎿嶄綔 */
-function handleQuery() {
+const handleQuery = () => {
   getList();
-}
+};
+
 /** 閲嶇疆鎸夐挳鎿嶄綔 */
-function resetQuery() {
-  daterangeCreateTime.value = [];
-  proxy.resetForm("queryRef");
+const resetQuery = () => {
+  queryFormRef.value?.resetFields();
   handleQuery();
-}
+};
+
 /** 鏂板鎸夐挳鎿嶄綔 */
-async function handleAdd(row) {
+const handleAdd = (row?: TreeVO) => {
   reset();
-  await getTreeselect();
-  if (row != null && row.id) {
+  getTreeselect();
+  if (row && row.id) {
     form.value.parentId = row.id;
   } else {
     form.value.parentId = 0;
   }
-  open.value = true;
-  title.value = "娣诲姞娴嬭瘯鏍戣〃";
-}
+  dialog.visible = true;
+  dialog.title = '娣诲姞娴嬭瘯鏍�';
+};
 
 /** 灞曞紑/鎶樺彔鎿嶄綔 */
-function toggleExpandAll() {
-  refreshTable.value = false;
+const handleToggleExpandAll = () => {
   isExpandAll.value = !isExpandAll.value;
-  nextTick(() => {
-    refreshTable.value = true;
+  toggleExpandAll(treeList.value, isExpandAll.value);
+};
+
+/** 灞曞紑/鎶樺彔鎿嶄綔 */
+const toggleExpandAll = (data: TreeVO[], status: boolean) => {
+  data.forEach((item) => {
+    treeTableRef.value?.toggleRowExpansion(item, status);
+    if (item.children && item.children.length > 0) toggleExpandAll(item.children, status);
   });
-}
+};
 
 /** 淇敼鎸夐挳鎿嶄綔 */
-async function handleUpdate(row) {
-  loading.value = true;
+const handleUpdate = async (row: TreeVO) => {
   reset();
   await getTreeselect();
-  if (row != null) {
+  if (row) {
     form.value.parentId = row.id;
   }
-  getTree(row.id).then((response) => {
-    loading.value = false;
-    form.value = response.data;
-    open.value = true;
-    title.value = "淇敼娴嬭瘯鏍戣〃";
-  });
-}
+  const res = await getTree(row.id);
+  Object.assign(form.value, res.data);
+  dialog.visible = true;
+  dialog.title = '淇敼娴嬭瘯鏍�';
+};
+
 /** 鎻愪氦鎸夐挳 */
-function submitForm() {
-  proxy.$refs["treeRef"].validate(valid => {
+const submitForm = () => {
+  treeFormRef.value?.validate(async (valid: boolean) => {
     if (valid) {
       buttonLoading.value = true;
-      if (form.value.ossConfigId != null) {
-        updateTree(form.value).then(response => {
-          proxy.$modal.msgSuccess("淇敼鎴愬姛");
-          open.value = false;
-          getList();
-        }).finally(() => {
-          buttonLoading.value = false;
-        });
+      if (form.value.id) {
+        await updateTree(form.value).finally(() => (buttonLoading.value = false));
       } else {
-        addTree(form.value).then(response => {
-          proxy.$modal.msgSuccess("鏂板鎴愬姛");
-          open.value = false;
-          getList();
-        }).finally(() => {
-          buttonLoading.value = false;
-        });
+        await addTree(form.value).finally(() => (buttonLoading.value = false));
       }
+      proxy?.$modal.msgSuccess('鎿嶄綔鎴愬姛');
+      dialog.visible = false;
+      await getList();
     }
   });
-}
-/** 鍒犻櫎鎸夐挳鎿嶄綔 */
-function handleDelete(row) {
-  proxy.$modal.confirm('鏄惁纭鍒犻櫎娴嬭瘯鍗曡〃缂栧彿涓�"' + row.id + '"鐨勬暟鎹」?').then(() => {
-    loading.value = true;
-    return delTree(row.id);
-  }).then(() => {
-    loading.value = false;
-    getList();
-    proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-  }).finally(() => {
-    loading.value = false;
-  });
-}
+};
 
-getList()
+/** 鍒犻櫎鎸夐挳鎿嶄綔 */
+const handleDelete = async (row: TreeVO) => {
+  await proxy?.$modal.confirm('鏄惁纭鍒犻櫎娴嬭瘯鏍戠紪鍙蜂负"' + row.id + '"鐨勬暟鎹」锛�');
+  loading.value = true;
+  await delTree(row.id).finally(() => (loading.value = false));
+  await getList();
+  proxy?.$modal.msgSuccess('鍒犻櫎鎴愬姛');
+};
+
+onMounted(() => {
+  getList();
+});
 </script>

--
Gitblit v1.9.3