瀏覽代碼

修改代码生成树选择组件

RuoYi 2 年之前
父節點
當前提交
7414bc492e
共有 1 個文件被更改,包括 10 次插入8 次删除
  1. 10 8
      ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm

+ 10 - 8
ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm

@@ -174,11 +174,13 @@
 #set($dictType=$column.dictType)
 #if("" != $treeParentCode && $column.javaField == $treeParentCode)
         <el-form-item label="${comment}" prop="${treeParentCode}">
-          <tree-select
-            v-model:value="form.${treeParentCode}"
-            :options="${businessName}Options"
-            :objMap="{ value: '${treeCode}', label: '${treeName}', children: 'children' }"
+          <el-tree-select
+            v-model="form.${treeParentCode}"
+            :data="${businessName}Options"
+            :props="{ value: '${treeCode}', label: '${treeName}', children: 'children' }"
+            value-key="${treeCode}"
             placeholder="请选择${comment}"
+            check-strictly
           />
         </el-form-item>
 #elseif($column.htmlType == "input")
@@ -354,8 +356,8 @@ function getList() {
 }
 
 /** 查询${functionName}下拉树结构 */
-async function getTreeselect() {
-  await list${BusinessName}().then(response => {
+function getTreeselect() {
+  list${BusinessName}().then(response => {
     ${businessName}Options.value = [];
     const data = { ${treeCode}: 0, ${treeName}: '顶级节点', children: [] };
     data.children = proxy.handleTree(response.data, "${treeCode}", "${treeParentCode}");
@@ -404,9 +406,9 @@ function resetQuery() {
 }
 
 /** 新增按钮操作 */
-async function handleAdd(row) {
+function handleAdd(row) {
   reset();
-  await getTreeselect();
+  getTreeselect();
   if (row != null && row.${treeCode}) {
     form.value.${treeParentCode} = row.${treeCode};
   } else {