Procházet zdrojové kódy

fix 修复 代码生成模板导包错误
update 优化 前端代码生成模板

疯狂的狮子Li před 2 roky
rodič
revize
77fa4e0aa8

+ 1 - 1
ruoyi-modules/ruoyi-generator/src/main/resources/vm/java/controller.java.vm

@@ -16,7 +16,7 @@ import org.dromara.common.core.domain.R;
 import org.dromara.common.core.validate.AddGroup;
 import org.dromara.common.core.validate.EditGroup;
 import org.dromara.common.log.enums.BusinessType;
-import utils.excel.common.org.dromara.ExcelUtil;
+import org.dromara.common.excel.utils.ExcelUtil;
 import ${packageName}.domain.vo.${ClassName}Vo;
 import ${packageName}.domain.bo.${ClassName}Bo;
 import ${packageName}.service.I${ClassName}Service;

+ 1 - 1
ruoyi-modules/ruoyi-generator/src/main/resources/vm/java/domain.java.vm

@@ -6,7 +6,7 @@ package ${packageName}.domain;
 #end
 #end
 #if($IsTenant==1)
-import core.tenant.common.org.dromara.TenantEntity;
+import org.dromara.common.tenant.core.TenantEntity;
 #else
 #end
 import com.baomidou.mybatisplus.annotation.*;

+ 2 - 2
ruoyi-modules/ruoyi-generator/src/main/resources/vm/java/vo.java.vm

@@ -6,8 +6,8 @@ import ${import};
 import ${packageName}.domain.${ClassName};
 import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
 import com.alibaba.excel.annotation.ExcelProperty;
-import annotation.excel.common.org.dromara.ExcelDictFormat;
-import convert.excel.common.org.dromara.ExcelDictConvert;
+import org.dromara.common.excel.annotation.ExcelDictFormat;
+import org.dromara.common.convert.excelExcelDictConvert;
 import io.github.linpeilie.annotations.AutoMapper;
 import lombok.Data;
 

+ 3 - 2
ruoyi-modules/ruoyi-generator/src/main/resources/vm/ts/api.ts.vm

@@ -1,13 +1,14 @@
 import request from '@/utils/request';
 import { AxiosPromise } from 'axios';
-import { ${BusinessName}VO, ${BusinessName}Form, ${BusinessName}Query } from './types';
+import { ${BusinessName}VO, ${BusinessName}Form, ${BusinessName}Query } from '@/api/${moduleName}/${businessName}/types';
 
 /**
  * 查询${functionName}列表
  * @param query
  * @returns {*}
  */
-export const list${BusinessName} = (#if(${treeCode})query?: ${BusinessName}Query#else query: ${BusinessName}Query#end): AxiosPromise<${BusinessName}VO[]> => {
+
+export const list${BusinessName} = (query?: ${BusinessName}Query): AxiosPromise<${BusinessName}VO[]> => {
   return request({
     url: '/${moduleName}/${businessName}/list',
     method: 'get',

+ 1 - 1
ruoyi-modules/ruoyi-generator/src/main/resources/vm/ts/types.ts.vm

@@ -13,7 +13,7 @@ export interface ${BusinessName}VO {
 #end
 }
 
-export interface ${BusinessName}Form extends BaseEntity{
+export interface ${BusinessName}Form extends BaseEntity {
 #foreach ($column in $columns)
 #if($column.insert || $column.edit)
   /**

+ 8 - 27
ruoyi-modules/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm

@@ -15,12 +15,7 @@
 #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-input v-model="queryParams.${column.javaField}" placeholder="请输入${comment}" clearable @keyup.enter="handleQuery" />
           </el-form-item>
 #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType)
           <el-form-item label="${comment}" prop="${column.javaField}">
@@ -71,26 +66,14 @@
       </div>
     </transition>
 
-
     <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-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-button type="info" plain icon="Sort" @click="handleToggleExpandAll">展开/折叠</el-button>
           </el-col>
           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
         </el-row>
@@ -274,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>
@@ -307,7 +290,6 @@ const ${businessName}Options = ref<${BusinessName}Option[]>([]);
 const buttonLoading = ref(false);
 const showSearch = ref(true);
 const isExpandAll = ref(true);
-const refreshTable = ref(true);
 const loading = ref(false);
 
 const queryFormRef = ref(ElForm);
@@ -472,15 +454,14 @@ const handleUpdate = (row: ${BusinessName}VO) => {
     if (row != null) {
       form.value.${treeParentCode} = row.${treeCode};
     }
-    get${BusinessName}(row.${pkColumn.javaField}).then(response => {
-      loading.value = false;
-      form.value = response.data;
+    const res = await get${BusinessName}(row.${treeCode});
+    loading.value = false;
+    Object.assign(form.value, res.data);
 #foreach ($column in $columns)
 #if($column.htmlType == "checkbox")
-      form.value.$column.javaField = form.value.${column.javaField}.split(",");
+    form.value.$column.javaField = form.value.${column.javaField}.split(",");
 #end
 #end
-    });
   });
 }
 

+ 6 - 37
ruoyi-modules/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm

@@ -15,12 +15,7 @@
 #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-input v-model="queryParams.${column.javaField}" placeholder="请输入${comment}" clearable @keyup.enter="handleQuery" />
           </el-form-item>
 #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType)
           <el-form-item label="${comment}" prop="${column.javaField}">
@@ -75,42 +70,16 @@
       <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-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="success"
-                plain
-                icon="Edit"
-                :disabled="single"
-                @click="handleUpdate()"
-                v-hasPermi="['${moduleName}:${businessName}:edit']"
-            >修改</el-button>
+            <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['${moduleName}:${businessName}:edit']">修改</el-button>
           </el-col>
           <el-col :span="1.5">
-            <el-button
-                type="danger"
-                plain
-                icon="Delete"
-                :disabled="multiple"
-                @click="handleDelete()"
-                v-hasPermi="['${moduleName}:${businessName}:remove']"
-            >删除</el-button>
+            <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['${moduleName}:${businessName}:remove']">删除</el-button>
           </el-col>
           <el-col :span="1.5">
-            <el-button
-                type="warning"
-                plain
-                icon="Download"
-                @click="handleExport"
-                v-hasPermi="['${moduleName}:${businessName}:export']"
-            >导出</el-button>
+            <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['${moduleName}:${businessName}:export']">导出</el-button>
           </el-col>
           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
         </el-row>
@@ -127,7 +96,7 @@
 #set($comment=$column.columnComment)
 #end
 #if($column.pk)
-        <el-table-column label="${comment}" align="center" prop="${javaField}" v-if="${column.list}"/>
+        <el-table-column label="${comment}" align="center" prop="${javaField}" v-if="${column.list}" />
 #elseif($column.list && $column.htmlType == "datetime")
         <el-table-column label="${comment}" align="center" prop="${javaField}" width="180">
           <template #default="scope">