diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/inner/CodegenEngine.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/inner/CodegenEngine.java index 258dceb3c..94eab36b1 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/inner/CodegenEngine.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/inner/CodegenEngine.java @@ -105,6 +105,8 @@ public class CodegenEngine { // Vue3 .put(CodegenFrontTypeEnum.VUE3.getType(), vue3TemplatePath("views/index.vue"), vue3FilePath("views/${table.moduleName}/${classNameVar}/index.vue")) + .put(CodegenFrontTypeEnum.VUE3.getType(), vue3TemplatePath("views/form.vue"), + vue3FilePath("views/${table.moduleName}/${classNameVar}/form.vue")) // .put(CodegenFrontTypeEnum.VUE3.getType(), vue3TemplatePath("views/data.ts"), // vue3FilePath("views/${table.moduleName}/${classNameVar}/${classNameVar}.data.ts")) .put(CodegenFrontTypeEnum.VUE3.getType(), vue3TemplatePath("api/api.ts"), diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/form.vue.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/form.vue.vm index 366fcb86b..53414e9b0 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/form.vue.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/form.vue.vm @@ -1,165 +1,116 @@ - - - - #foreach($column in $columns) - #if ($column.createOperation || $column.updateOperation) - #set ($dictType = $column.dictType) - #set ($javaField = $column.javaField) - #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) - #set ($comment = $column.columnComment) - #if ($column.htmlType == "input") - #if (!$column.primaryKey)## 忽略主键,不用在表单里 - - - - #end - #elseif($column.htmlType == "imageUpload")## 图片上传 - #set ($hasImageUploadColumn = true) - - - - #elseif($column.htmlType == "fileUpload")## 文件上传 - #set ($hasFileUploadColumn = true) - - - - #elseif($column.htmlType == "editor")## 文本编辑器 - #set ($hasEditorColumn = true) - - - - #elseif($column.htmlType == "select")## 下拉框 - - - #if ("" != $dictType)## 有数据字典 - - #else##没数据字典 - - #end - - - #elseif($column.htmlType == "checkbox")## 多选框 - - - #if ("" != $dictType)## 有数据字典 - {{dict.label}} - #else##没数据字典 - 请选择字典生成 - #end - - - #elseif($column.htmlType == "radio")## 单选框 - - - #if ("" != $dictType)## 有数据字典 - {{dict.label}} - #else##没数据字典 - 请选择字典生成 - #end - - - #elseif($column.htmlType == "datetime")## 时间框 - - - - #elseif($column.htmlType == "textarea")## 文本框 - - - - #end - #end - #end - - - - - -// 弹出层标题 -title: "", -// 是否显示弹出层 -open: false, - -// 表单参数 -form: {}, -// 表单校验 -rules: { -#foreach ($column in $columns) - #if (($column.createOperation || $column.updateOperation) && !$column.nullable && !${column.primaryKey})## 创建或者更新操作 && 要求非空 && 非主键 - #set($comment=$column.columnComment) - $column.javaField: [{ required: true, message: "${comment}不能为空", trigger: #if($column.htmlType == "select")"change"#else"blur"#end }], - #end -#end -} - - -/** 表单重置 */ -reset() { -this.form = { -#foreach ($column in $columns) + diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/index.vue.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/index.vue.vm index dc071f212..5622d7895 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/index.vue.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/index.vue.vm @@ -8,15 +8,23 @@ :inline="true" label-width="68px" > - #set ($dictMethods = []) ## 使用到的 dict 字典方法 + #set ($dictMethods = [])## 使用到的 dict 字典方法 #foreach($column in $columns) - #if ($column.listOperation) - #set ($dictType = $column.dictType) - #set ($javaField = $column.javaField) - #set ($javaType = $column.javaType) - #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) - #set ($comment = $column.columnComment) - #if ($column.htmlType == "input") + #if ($column.listOperation) + #set ($dictType = $column.dictType) + #set ($javaField = $column.javaField) + #set ($javaType = $column.javaType) + #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) + #set ($comment = $column.columnComment) + #set ($dictMethod = "getDictOptions")## 计算使用哪个 dict 字典方法 + #if ($javaType == "Integer" || $javaType == "Long" || $javaType == "Byte" || $javaType == "Short") + #set ($dictMethod = "getIntDictOptions") + #elseif ($javaType == "String") + #set ($dictMethod = "getStrDictOptions") + #elseif ($javaType == "Boolean") + #set ($dictMethod = "getBoolDictOptions") + #end + #if ($column.htmlType == "input") - #elseif ($column.htmlType == "select" || $column.htmlType == "radio") + #elseif ($column.htmlType == "select" || $column.htmlType == "radio") + #if ($javaField.length() + $comment.length() > 8) - #if ("" != $dictType)## 设置了 dictType 数据字典的情况 - #set ($dictMethod = "getDictOptions") ## 计算使用哪个 dict 字典方法 - #if ($javaType == "Integer" || $javaType == "Long" || $javaType == "Byte" || $javaType == "Short") - #set ($dictMethod = "getIntDictOptions") - #elseif ($javaType == "String") - #set ($dictMethod = "getStrDictOptions") - #elseif ($javaType == "Boolean") - #set ($dictMethod = "getBoolDictOptions") - #end - #if (!$dictMethods.contains($dictMethod)) ## 如果不存在,则添加到 dictMethods 数组中,后续好 import - #( $dictMethods.add($dictMethod) ) - #end + #else + + #end + #if ("" != $dictType)## 设置了 dictType 数据字典的情况 + #if (!$dictMethods.contains($dictMethod))## 如果不存在,则添加到 dictMethods 数组中,后续好 import + #set($ignore = $dictMethods.add($dictMethod) ) + #end - #else## 未设置 dictType 数据字典的情况 + #else## 未设置 dictType 数据字典的情况 - #end + #end #elseif($column.htmlType == "datetime") @@ -88,7 +92,15 @@ 搜索 重置 + #if ($permissionPrefix <= 14) + #else + + #end 新增 { await message.exportConfirm() // 发起导出 exportLoading.value = true - const data = await ${simpleClassName}Api.export${simpleClassName}Api(queryParams) + const data = await ${simpleClassName}Api.export${simpleClassName}(queryParams) download.excel(data, '${table.classComment}.xls') } catch { } finally {