From d54772815bc34efc76112b5c22def86d3f45faa8 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期二, 05 三月 2024 22:57:39 +0800
Subject: [PATCH] !491 合并flowable工作流功能 * update 优化 表字段映射于数据库保持一致 * remove 删除无用代码 * remove 删除无用代码 * fix 修复 实体类未实现序列化接口问题 * update 优化 表字段映射于数据库保持一致 * update 优化 统一sql名称 * fix 修复 接口名称编写错误 * merge dev * update 调整sql 添加抄送查询 * update 调整菜单 * update 调整sql脚本 * update 调整任务查询 添加抄送 * add 抄送任务 * remove 删除错误代码 * remove 删除无用代码 * update 调整作废,撤销等校验 * fix 修复 流程作废异常问题 * update 优化 flowable 配置到主yml文件 * update 调整 数据排序规则 * fix 修复 数据库无法自动执行建表sql问题 * update 优化 工作流id生成器保持全局统一 * add 添加附件任务查询 * add 添加审批附件上传 * update 调整bpmn文件修复驳回失败问题 * update 调整会签类型转换异常 * add 添加获取运行中流程信息,流程扩展信息,补充注解,删除无用代码 * update 调整流程转换,流程启动,上传新bpmn文件 * update 调整方法 * update 调整模型修改 * fix 修复 user与dept xml 编写错误 * remove 移除原生ui接口,增加新ui接口 * update 优化 下拉选接口数据权限 * update 优化 删除观测用日志记录 * reset 还原修复命名 * update 修复命名 * add 新增 用户、部门、角色、岗位 下拉选接口与代码实现优化 * update 调整任务办理异步时流程状态错误问题 * add 工作流用户查询 * remove 删除无用注释 添加非空校验 * update 优化获取审批记录 * update 调整事件办理 * update 调整工作流选人接口 * Merge branch 'dev' into future/flowable * update 办理调整执行顺序 * update 调整流程办理优化撤销,驳回,草稿等动作 * fix 修复子流程中设置发起人变量错误问题 * Merge branch 'dev' into future/flowable * update 调整流程执行非空校验,调整任务节点执行 * update 调整注释 * add 添加自定义任务监听策略 * !469 update-完善对模型key校验逻辑 * update-修改常量命名 * update-完善对模型key校验逻辑 * add 添加sql脚本 * Merge branch 'dev' into future/flowable * Merge branch 'dev' into future/flowable * Merge branch 'future/flowable' of https://gitee.com/dromara/RuoYi-Vue-… * add 添加SQLserve脚本 * add 添加流程监听示例 * update 调整获取审批记录 * Merge branch 'future/flowable' of https://gitee.com/dromara/RuoYi-Vue-… * update  调整请假查询 修改流程定义查看xml * update 调整流程实例删除 * update 调整sql * add 添加sql脚本 * update 调整sql * update 调整请假申请,调整菜单sql * update 调整设计器保存发起人变量,修改菜单sql * update 依赖调整 * update 调整flw依赖 * update 升级7.0后移除画图mule类型 * update 调整flw依赖 * update 移动模型设计器翻译方法 * update 调整flw依赖 * fix 修复 误删依赖 * Merge remote-tracking branch 'origin/dev' into future/flowable * remove 移除动态表单 * Merge remote-tracking branch 'origin/dev' into future/flowable * update 优化代码结构 * update 调整请假申请包结构 * Merge branch 'dev' into future/flowable * add 添加文件,调整分类查询 * Merge branch 'dev' into future/flowable * Merge branch 'future/flowable' of https://gitee.com/dromara/RuoYi-Vue-… * add bpmn文件 调整流程办理 * Merge branch 'dev' into future/flowable * Merge branch 'future/flowable' of https://gitee.com/dromara/RuoYi-Vue-… * Merge branch '5.X' into future/flowable * update 调整消息发送 * update 调整名称 * update 调整流程实例查询 * add 添加任务催办,任务改派 * fix 修复 用户注册接口校验用户名不区分租户问题 * update 还原待办任务,添加待办消息发送 * update 优化任务待办,排除非待办任务 * Merge branch '5.X' into future/flowable * update 修改流程启动后重新覆盖流程变量,删除并行流程驳回,撤销后,垃圾数据 * update 升级flowable7.0,添加业务单据删除流程信息 * Merge branch '5.X' into future/flowable * add 添加动态表单提交流程 * Merge branch 'future/flowable' of https://gitee.com/dromara/RuoYi-Vue-… * add 添加动态表单单据 * update 升级flowable到7.0.0.M2,调整工作流提交校验,调整工作流工具类 * add 新增流程定义与表单关联 * update 调整修改流程分类后更新流程分类编码 * update 调整流程定义图片预览 * update 调整人员查询 * update 优化作废,撤销等备注 * Merge branch '5.X' into future/flowable * Merge branch 'future/flowable' of https://gitee.com/dromara/RuoYi-Vue-… * fix 解决设计器选择设置流程发起人设置变量有问题 * add 添加引擎调度监听 * merge 合并5.x分支代码 * remove 移除flow-ui * update 调整日志打印 * add 添加按照业务id删除流程记录 * add 添加请假申请示例,添加流程定义文件部署,添加sql菜单 * update 移除流程表单 formConfig 属性,表单配置信息都放一起便于使用。 * update 调整菜单 * add 添加mysql工作流菜单 * update 调整获取加签人,审判记录 * update 调整流程作废 * add 添加任务完成状态 * add 添加加签,减签人员接口 * update 调整任务驳回后设置审批人 * add 添加驳回申请人 * add 添加查询当前租户所有待办,已办任务 * add 添加会签任务加签减签,添加任务作废理由 * update 调整流程实例,流程定义检索 * update 调整撤销流程申请,当前登录人单据 * add 添加办理人名称翻译 * add 添加流程流程实例,流程定义分类查询 * add 添加模型分类查询 * add 添加流程分类 * add 添加流程表单操作相关接口 * fix 修复修改流程历史流程实例错误问题 * update 调整已办任务排序,添加注释 * update 调整用户,用户组查询 * add 添加获取当前任务参与者,优化任务待办,已办 * add 添加当前登录人单据列表,添加单据状态 * update 补充任务撤销事务 * add 添加撤销流程申请 * update 优化流程实例删除 * fix 修复流程实例查询挂起状态错误 * update 优化流程办理 流程挂起抛出异常 * add 添加业务状态枚举。添加流程启动,审批,终止等状态 * update 优化流程启动 * add 添加流程实例作废,运行中流程实例删除,已完成流程实例删除 * add 添加节点信息 * 调整流程预览 * add 添加审批记录 * 还原代码 * fix 修复模型导出错误 * add 增加委托办理,调整流程启动 * add 添加转办任务 * add 添加任务拾取,任务归还,任务终止,任务委托 * fix 修复任务,流程实例分页模糊查询失效 * add 添加流程实例运行中,已结束分页查询 * add 添加通过流程实例id获取历史流程图,添加flowable配置,调整流程办理 * add 添加流程办理,流程待办,已办分页查询 * 删除无用导入 * 调整流程查询租户id * add 添加流程启动 * 添加模型人员用户,组查询 * add 添加模型部署模型校验 * 修改模型部署导出校验 * fix 修复模型画图保存时key不回显问题 * add 添加流程定义转换为模型 * 优化模型编辑校验,流程定义删除,流程定义激活挂起等 * add 添加流程定义删除,流程定义挂起激活,流程定义版本迁移 * 调整ObjectNode.put警告 * 删除无用依赖,优化模型修改,导出,部署非空校验 * 删除无用导入 * 添加流程定义分页,查看图片,查看xml * 添加模型部署,导出模型 * 修改画图账户登录信息 * 添加模型编辑key重复校验,添加租户查询,删除忽略token注解 * 添加模型新增校验 * 添加工作流模型新增,修改,查询,删除 * 【ADD】集成原生Flowable-ui * 添加workflow模块,添加flowable依赖,yml配置信息

---
 ruoyi-modules/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm |  427 +++++++++++++++++++++++++++--------------------------
 1 files changed, 219 insertions(+), 208 deletions(-)

diff --git a/ruoyi-modules/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm b/ruoyi-modules/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm
index 8f4113e..af3275e 100644
--- a/ruoyi-modules/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm
+++ b/ruoyi-modules/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm
@@ -1,6 +1,8 @@
 <template>
-  <div class="app-container">
-    <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
+  <div class="p-2">
+    <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
+      <div class="search" v-show="showSearch">
+        <el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px">
 #foreach($column in $columns)
 #if($column.query)
 #set($dictType=$column.dictType)
@@ -12,90 +14,78 @@
 #set($comment=$column.columnComment)
 #end
 #if($column.htmlType == "input" || $column.htmlType == "textarea")
-      <el-form-item label="${comment}" prop="${column.javaField}">
-        <el-input
-          v-model="queryParams.${column.javaField}"
-          placeholder="璇疯緭鍏�${comment}"
-          clearable
-          @keyup.enter="handleQuery"
-        />
-      </el-form-item>
+          <el-form-item label="${comment}" prop="${column.javaField}">
+            <el-input v-model="queryParams.${column.javaField}" placeholder="璇疯緭鍏�${comment}" clearable style="width: 240px" @keyup.enter="handleQuery" />
+          </el-form-item>
 #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType)
-      <el-form-item label="${comment}" prop="${column.javaField}">
-        <el-select v-model="queryParams.${column.javaField}" placeholder="璇烽�夋嫨${comment}" clearable>
-          <el-option
-            v-for="dict in ${dictType}"
-            :key="dict.value"
-            :label="dict.label"
-            :value="dict.value"
-          />
-        </el-select>
-      </el-form-item>
+          <el-form-item label="${comment}" prop="${column.javaField}">
+            <el-select v-model="queryParams.${column.javaField}" placeholder="璇烽�夋嫨${comment}" clearable>
+              <el-option
+                  v-for="dict in ${dictType}"
+                  :key="dict.value"
+                  :label="dict.label"
+                  :value="dict.value"
+              />
+            </el-select>
+          </el-form-item>
 #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType)
-      <el-form-item label="${comment}" prop="${column.javaField}">
-        <el-select v-model="queryParams.${column.javaField}" placeholder="璇烽�夋嫨${comment}" clearable>
-          <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" />
-        </el-select>
-      </el-form-item>
+          <el-form-item label="${comment}" prop="${column.javaField}">
+            <el-select v-model="queryParams.${column.javaField}" placeholder="璇烽�夋嫨${comment}" clearable>
+              <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" />
+            </el-select>
+          </el-form-item>
 #elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN")
-      <el-form-item label="${comment}" prop="${column.javaField}">
-        <el-date-picker clearable
-          v-model="queryParams.${column.javaField}"
-          type="date"
-          value-format="YYYY-MM-DD"
-          placeholder="閫夋嫨${comment}">
-        </el-date-picker>
-      </el-form-item>
+          <el-form-item label="${comment}" prop="${column.javaField}">
+            <el-date-picker clearable
+                v-model="queryParams.${column.javaField}"
+                type="date"
+                value-format="YYYY-MM-DD"
+                placeholder="閫夋嫨${comment}"
+            />
+          </el-form-item>
 #elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
-      <el-form-item label="${comment}" style="width: 308px">
-        <el-date-picker
-          v-model="daterange${AttrName}"
-          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 label="${comment}" style="width: 308px">
+            <el-date-picker
+                v-model="dateRange${AttrName}"
+                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-form-item>
 #end
 #end
 #end
-      <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-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>
+    </transition>
 
-    <el-row :gutter="10" class="mb8">
-      <el-col :span="1.5">
-        <el-button
-          type="primary"
-          plain
-          icon="Plus"
-          @click="handleAdd"
-          v-hasPermi="['${moduleName}:${businessName}: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="${businessName}List"
-      row-key="${treeCode}"
-      :default-expand-all="isExpandAll"
-      :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
-    >
+    <el-card shadow="never">
+      <template #header>
+        <el-row :gutter="10" class="mb8">
+          <el-col :span="1.5">
+            <el-button type="primary" plain icon="Plus" @click="handleAdd()" v-hasPermi="['${moduleName}:${businessName}:add']">鏂板</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" @queryTable="getList"></right-toolbar>
+        </el-row>
+      </template>
+      <el-table
+        v-loading="loading"
+        :data="${businessName}List"
+        row-key="${treeCode}"
+        :default-expand-all="isExpandAll"
+        :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
+        ref="${businessName}TableRef"
+      >
 #foreach($column in $columns)
 #set($javaField=$column.javaField)
 #set($parentheseIndex=$column.columnComment.indexOf("锛�"))
@@ -106,50 +96,56 @@
 #end
 #if($column.pk)
 #elseif($column.list && $column.htmlType == "datetime")
-      <el-table-column label="${comment}" align="center" prop="${javaField}" width="180">
-        <template #default="scope">
-          <span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span>
-        </template>
-      </el-table-column>
-#elseif($column.list && $column.htmlType == "imageUpload")
-      <el-table-column label="${comment}" align="center" prop="${javaField}" width="100">
+        <el-table-column label="${comment}" align="center" prop="${javaField}" width="180">
           <template #default="scope">
-              <image-preview :src="scope.row.${javaField}" :width="50" :height="50"/>
+            <span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span>
           </template>
-      </el-table-column>
+        </el-table-column>
+#elseif($column.list && $column.htmlType == "imageUpload")
+        <el-table-column label="${comment}" align="center" prop="${javaField}" width="100">
+          <template #default="scope">
+            <image-preview :src="scope.row.${javaField}" :width="50" :height="50"/>
+          </template>
+        </el-table-column>
 #elseif($column.list && $column.dictType && "" != $column.dictType)
-      <el-table-column label="${comment}" align="center" prop="${javaField}">
-        <template #default="scope">
+        <el-table-column label="${comment}" align="center" prop="${javaField}">
+          <template #default="scope">
 #if($column.htmlType == "checkbox")
-          <dict-tag :options="${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/>
+            <dict-tag :options="${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/>
 #else
-          <dict-tag :options="${column.dictType}" :value="scope.row.${javaField}"/>
+            <dict-tag :options="${column.dictType}" :value="scope.row.${javaField}"/>
 #end
-        </template>
-      </el-table-column>
+          </template>
+        </el-table-column>
 #elseif($column.list && "" != $javaField)
 #if(${foreach.index} == 1)
-      <el-table-column label="${comment}" prop="${javaField}" />
+        <el-table-column label="${comment}" prop="${javaField}" />
 #else
-      <el-table-column label="${comment}" align="center" prop="${javaField}" />
+        <el-table-column label="${comment}" align="center" prop="${javaField}" />
 #end
 #end
 #end
-      <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width">
+        <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width">
           <template #default="scope">
-              <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${moduleName}:${businessName}:edit']">淇敼</el-button>
-              <el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" v-hasPermi="['${moduleName}:${businessName}:add']">鏂板</el-button>
-              <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${moduleName}:${businessName}:remove']">鍒犻櫎</el-button>
+            <el-tooltip content="淇敼" placement="top">
+              <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${moduleName}:${businessName}:edit']" />
+            </el-tooltip>
+            <el-tooltip content="鏂板" placement="top">
+              <el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" v-hasPermi="['${moduleName}:${businessName}:add']" />
+            </el-tooltip>
+            <el-tooltip content="鍒犻櫎" placement="top">
+              <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${moduleName}:${businessName}:remove']" />
+            </el-tooltip>
           </template>
-      </el-table-column>
-    </el-table>
-
+        </el-table-column>
+      </el-table>
+    </el-card>
     <!-- 娣诲姞鎴栦慨鏀�${functionName}瀵硅瘽妗� -->
-    <el-dialog :title="title" v-model="open" width="500px" append-to-body>
-      <el-form ref="${businessName}Ref" :model="form" :rules="rules" label-width="80px">
+    <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
+      <el-form ref="${businessName}FormRef" :model="form" :rules="rules" label-width="80px">
 #foreach($column in $columns)
 #set($field=$column.javaField)
-#if($column.insert && !$column.pk)
+#if(($column.insert || $column.edit) && !$column.pk)
 #set($parentheseIndex=$column.columnComment.indexOf("锛�"))
 #if($parentheseIndex != -1)
 #set($comment=$column.columnComment.substring(0, $parentheseIndex))
@@ -248,8 +244,8 @@
             v-model="form.${field}"
             type="datetime"
             value-format="YYYY-MM-DD HH:mm:ss"
-            placeholder="閫夋嫨${comment}">
-          </el-date-picker>
+            placeholder="閫夋嫨${comment}"
+          />
         </el-form-item>
 #elseif($column.htmlType == "textarea")
         <el-form-item label="${comment}" prop="${field}">
@@ -261,7 +257,7 @@
       </el-form>
       <template #footer>
         <div class="dialog-footer">
-          <el-button type="primary" @click="submitForm">纭� 瀹�</el-button>
+          <el-button :loading="buttonLoading" type="primary" @click="submitForm">纭� 瀹�</el-button>
           <el-button @click="cancel">鍙� 娑�</el-button>
         </div>
       </template>
@@ -269,39 +265,77 @@
   </div>
 </template>
 
-<script setup name="${BusinessName}">
+<script setup name="${BusinessName}" lang="ts">
 import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}";
+import { ${BusinessName}VO, ${BusinessName}Query, ${BusinessName}Form } from '@/api/${moduleName}/${businessName}/types';
 
-const { proxy } = getCurrentInstance();
+type ${BusinessName}Option = {
+  ${treeCode}: number;
+  ${treeName}: string;
+  children?: ${BusinessName}Option[];
+}
+
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;;
+
 #if(${dicts} != '')
 #set($dictsNoSymbol=$dicts.replace("'", ""))
-const { ${dictsNoSymbol} } = proxy.useDict(${dicts});
+const { ${dictsNoSymbol} } = toRefs<any>(proxy?.useDict(${dicts}));
 #end
 
-const ${businessName}List = ref([]);
-const ${businessName}Options = ref([]);
-const open = ref(false);
+const ${businessName}List = ref<${BusinessName}VO[]>([]);
+const ${businessName}Options = ref<${BusinessName}Option[]>([]);
 const buttonLoading = ref(false);
-const loading = ref(true);
 const showSearch = ref(true);
-const title = ref("");
 const isExpandAll = ref(true);
-const refreshTable = ref(true);
+const loading = ref(false);
+
+const queryFormRef = ref<ElFormInstance>();
+const ${businessName}FormRef = ref<ElFormInstance>();
+const ${businessName}TableRef = ref<ElTableInstance>()
+
+const dialog = reactive<DialogOption>({
+    visible: false,
+    title: ''
+});
+
 #foreach ($column in $columns)
 #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
 #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
-const daterange${AttrName} = ref([]);
+const dateRange${AttrName} = ref<[DateModelType, DateModelType]>(['', '']);
 #end
 #end
 
-const data = reactive({
-  form: {},
-  queryParams: {
+const initFormData: ${BusinessName}Form = {
 #foreach ($column in $columns)
-#if($column.query)
+#if($column.insert || $column.edit)
+#if($column.htmlType == "checkbox")
+    $column.javaField: []#if($foreach.count != $columns.size()),#end
+#else
     $column.javaField: undefined#if($foreach.count != $columns.size()),#end
 #end
 #end
+#end
+}
+
+const data = reactive<PageData<${BusinessName}Form, ${BusinessName}Query>>({
+  form: {...initFormData},
+  queryParams: {
+#foreach ($column in $columns)
+#if($column.query)
+#if($column.htmlType != "datetime" || $column.queryType != "BETWEEN")
+    $column.javaField: undefined,
+#end
+#end
+#end
+    params: {
+#foreach ($column in $columns)
+#if($column.query)
+#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
+      $column.javaField: undefined#if($foreach.count != $columns.size()),#end
+#end
+#end
+#end
+    }
   },
   rules: {
 #foreach ($column in $columns)
@@ -325,7 +359,7 @@
 const { queryParams, form, rules } = toRefs(data);
 
 /** 鏌ヨ${functionName}鍒楄〃 */
-function getList() {
+const getList = async () => {
   loading.value = true;
 #foreach ($column in $columns)
 #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
@@ -336,113 +370,103 @@
 #foreach ($column in $columns)
 #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
 #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
-  if (null != daterange${AttrName} && '' != daterange${AttrName}) {
-    queryParams.value.params["begin${AttrName}"] = daterange${AttrName}.value[0];
-    queryParams.value.params["end${AttrName}"] = daterange${AttrName}.value[1];
-  }
+  proxy?.addDateRange(queryParams.value, dateRange${AttrName}.value, '${AttrName}');
 #end
 #end
-  list${BusinessName}(queryParams.value).then(response => {
-    ${businessName}List.value = proxy.handleTree(response.data, "${treeCode}", "${treeParentCode}");
+  const res = await list${BusinessName}(queryParams.value);
+  const data = proxy?.handleTree<${BusinessName}VO>(res.data, "${treeCode}", "${treeParentCode}");
+  if (data) {
+    ${businessName}List.value = data;
     loading.value = false;
-  });
+  }
 }
 
 /** 鏌ヨ${functionName}涓嬫媺鏍戠粨鏋� */
-function getTreeselect() {
-  list${BusinessName}().then(response => {
-    ${businessName}Options.value = [];
-    const data = { ${treeCode}: 0, ${treeName}: '椤剁骇鑺傜偣', children: [] };
-    data.children = proxy.handleTree(response.data, "${treeCode}", "${treeParentCode}");
-    ${businessName}Options.value.push(data);
-  });
+const getTreeselect = async () => {
+  const res = await list${BusinessName}();
+  ${businessName}Options.value = [];
+  const data: ${BusinessName}Option = { ${treeCode}: 0, ${treeName}: '椤剁骇鑺傜偣', children: [] };
+  data.children = proxy?.handleTree<${BusinessName}Option>(res.data, "${treeCode}", "${treeParentCode}");
+  ${businessName}Options.value.push(data);
 }
 
 // 鍙栨秷鎸夐挳
-function cancel() {
-  open.value = false;
+const cancel = () => {
   reset();
+  dialog.visible = false;
 }
 
 // 琛ㄥ崟閲嶇疆
-function reset() {
-  form.value = {
-#foreach ($column in $columns)
-#if($column.insert || $column.edit)
-#if($column.htmlType == "checkbox")
-    $column.javaField: []#if($foreach.count != $columns.size()),#end
-#else
-    $column.javaField: null#if($foreach.count != $columns.size()),#end
-#end
-#end
-#end
-  };
-  proxy.resetForm("${businessName}Ref");
+const reset = () => {
+  form.value = {...initFormData}
+  ${businessName}FormRef.value?.resetFields();
 }
 
 /** 鎼滅储鎸夐挳鎿嶄綔 */
-function handleQuery() {
+const handleQuery = () => {
   getList();
 }
 
 /** 閲嶇疆鎸夐挳鎿嶄綔 */
-function resetQuery() {
+const resetQuery = () => {
 #foreach ($column in $columns)
 #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
 #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
-  daterange${AttrName}.value = [];
+  dateRange${AttrName}.value = ['', ''];
 #end
 #end
-  proxy.resetForm("queryRef");
+  queryFormRef.value?.resetFields();
   handleQuery();
 }
 
 /** 鏂板鎸夐挳鎿嶄綔 */
-function handleAdd(row) {
+const handleAdd = (row?: ${BusinessName}VO) => {
   reset();
   getTreeselect();
   if (row != null && row.${treeCode}) {
-    form.value.${treeParentCode} = row.${treeCode};
+      form.value.${treeParentCode} = row.${treeCode};
   } else {
-    form.value.${treeParentCode} = 0;
+      form.value.${treeParentCode} = 0;
   }
-  open.value = true;
-  title.value = "娣诲姞${functionName}";
+  dialog.visible = true;
+  dialog.title = "娣诲姞${functionName}";
 }
 
 /** 灞曞紑/鎶樺彔鎿嶄綔 */
-function toggleExpandAll() {
-  refreshTable.value = false;
+const handleToggleExpandAll = () => {
   isExpandAll.value = !isExpandAll.value;
-  nextTick(() => {
-    refreshTable.value = true;
-  });
+  toggleExpandAll(${businessName}List.value, isExpandAll.value)
+}
+
+/** 灞曞紑/鎶樺彔鎿嶄綔 */
+const toggleExpandAll = (data: ${BusinessName}VO[], status: boolean) => {
+  data.forEach((item) => {
+    ${businessName}TableRef.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: ${BusinessName}VO) => {
   reset();
   await getTreeselect();
   if (row != null) {
-    form.value.${treeParentCode} = row.${treeCode};
+    form.value.${treeParentCode} = row.${treeParentCode};
   }
-  get${BusinessName}(row.${pkColumn.javaField}).then(response => {
-    loading.value = false;
-    form.value = response.data;
+  const res = await get${BusinessName}(row.${pkColumn.javaField});
+  Object.assign(form.value, res.data);
 #foreach ($column in $columns)
-#if($column.htmlType == "checkbox")
-    form.value.$column.javaField = form.value.${column.javaField}.split(",");
+  #if($column.htmlType == "checkbox")
+  form.value.$column.javaField = form.value.${column.javaField}.split(",");
+  #end
 #end
-#end
-    open.value = true;
-    title.value = "淇敼${functionName}";
-  });
+  dialog.visible = true;
+  dialog.title = "淇敼${functionName}";
 }
 
 /** 鎻愪氦鎸夐挳 */
-function submitForm() {
-  proxy.#[[$]]#refs["${businessName}Ref"].validate(valid => {
+const submitForm = () => {
+  ${businessName}FormRef.value?.validate(async (valid: boolean) => {
     if (valid) {
       buttonLoading.value = true;
 #foreach ($column in $columns)
@@ -450,41 +474,28 @@
       form.value.$column.javaField = form.value.${column.javaField}.join(",");
 #end
 #end
-      if (form.value.${pkColumn.javaField} != null) {
-        update${BusinessName}(form.value).then(response => {
-          proxy.#[[$modal]]#.msgSuccess("淇敼鎴愬姛");
-          open.value = false;
-          getList();
-        }).finally(() => {
-          buttonLoading.value = false;
-        });
+      if (form.value.${pkColumn.javaField}) {
+        await update${BusinessName}(form.value).finally(() => buttonLoading.value = false);
       } else {
-        add${BusinessName}(form.value).then(response => {
-          proxy.#[[$modal]]#.msgSuccess("鏂板鎴愬姛");
-          open.value = false;
-          getList();
-        }).finally(() => {
-          buttonLoading.value = false;
-        });
+        await add${BusinessName}(form.value).finally(() => buttonLoading.value = false);
       }
+      proxy?.#[[$modal]]#.msgSuccess("鎿嶄綔鎴愬姛");
+      dialog.visible = false;
+      getList();
     }
   });
 }
 
 /** 鍒犻櫎鎸夐挳鎿嶄綔 */
-function handleDelete(row) {
-  proxy.#[[$modal]]#.confirm('鏄惁纭鍒犻櫎${functionName}缂栧彿涓�"' + row.${pkColumn.javaField} + '"鐨勬暟鎹」锛�').then(function() {
-    loading.value = true;
-    return del${BusinessName}(row.${pkColumn.javaField});
-  }).then(() => {
-    loading.value = false;
-    getList();
-    proxy.#[[$modal]]#.msgSuccess("鍒犻櫎鎴愬姛");
-  }).catch(() => {
-  }).finally(() => {
-    loading.value = false;
-  });
+const handleDelete = async (row: ${BusinessName}VO) => {
+  await proxy?.#[[$modal]]#.confirm('鏄惁纭鍒犻櫎${functionName}缂栧彿涓�"' + row.${pkColumn.javaField} + '"鐨勬暟鎹」锛�');
+  loading.value = true;
+  await del${BusinessName}(row.${pkColumn.javaField}).finally(() => loading.value = false);
+  await getList();
+  proxy?.#[[$modal]]#.msgSuccess("鍒犻櫎鎴愬姛");
 }
 
-getList();
+onMounted(() => {
+  getList();
+});
 </script>

--
Gitblit v1.9.3