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 94eab36b1..b41821b80 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 @@ -97,20 +97,21 @@ public class CodegenEngine { * value:生成的路径 */ private static final Table FRONT_TEMPLATES = ImmutableTable.builder() - // Vue2 + // Vue2 标准模版 .put(CodegenFrontTypeEnum.VUE2.getType(), vueTemplatePath("views/index.vue"), vueFilePath("views/${table.moduleName}/${classNameVar}/index.vue")) .put(CodegenFrontTypeEnum.VUE2.getType(), vueTemplatePath("api/api.js"), vueFilePath("api/${table.moduleName}/${classNameVar}.js")) - // Vue3 + // 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")) + vue3FilePath("views/${table.moduleName}/${classNameVar}/${simpleClassName}Form.vue")) .put(CodegenFrontTypeEnum.VUE3.getType(), vue3TemplatePath("api/api.ts"), vue3FilePath("api/${table.moduleName}/${classNameVar}/index.ts")) + // Vue3 Schema 模版 +// .put(CodegenFrontTypeEnum.VUE3.getType(), vue3TemplatePath("views/data.ts"), +// vue3FilePath("views/${table.moduleName}/${classNameVar}/${classNameVar}.data.ts")) .build(); @Resource @@ -203,6 +204,8 @@ public class CodegenEngine { getStr(bindingMap, "basePackage").replaceAll("\\.", "/")); filePath = StrUtil.replace(filePath, "${classNameVar}", getStr(bindingMap, "classNameVar")); + filePath = StrUtil.replace(filePath, "${simpleClassName}", + getStr(bindingMap, "simpleClassName")); // sceneEnum 包含的字段 CodegenSceneEnum sceneEnum = (CodegenSceneEnum) bindingMap.get("sceneEnum"); filePath = StrUtil.replace(filePath, "${sceneEnum.prefixClass}", sceneEnum.getPrefixClass()); 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 8209c92c3..690d7cf72 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 @@ -27,17 +27,17 @@ - #elseif($column.htmlType == "imageUpload")## 图片上传 TODO 芋艿:待测试 + #elseif($column.htmlType == "imageUpload")## 图片上传 #set ($hasImageUploadColumn = true) - - - - #elseif($column.htmlType == "fileUpload")## 文件上传 TODO 芋艿:待测试 + + + + #elseif($column.htmlType == "fileUpload")## 文件上传 #set ($hasFileUploadColumn = true) - - - - #elseif($column.htmlType == "editor")## 文本编辑器 TODO 芋艿:待测试 + + + + #elseif($column.htmlType == "editor")## 文本编辑器 @@ -59,19 +59,20 @@ #end - #elseif($column.htmlType == "checkbox")## 多选框 TODO 芋艿:待测试 + #elseif($column.htmlType == "checkbox")## 多选框 #if ("" != $dictType)## 有数据字典 #if (!$dictMethods.contains($dictMethod))## 如果不存在,则添加到 dictMethods 数组中,后续好 import #set($ignore = $dictMethods.add($dictMethod) ) #end - - {{dict.label}} - + + {{ dict.label }} + #else##没数据字典 请选择字典生成 #end @@ -96,14 +97,19 @@ #end - #elseif($column.htmlType == "datetime")## 时间框 TODO 芋艿:待测试 - - - - #elseif($column.htmlType == "textarea")## 文本框 TODO 芋艿:待测试 - - - + #elseif($column.htmlType == "datetime")## 时间框 + + + + #elseif($column.htmlType == "textarea")## 文本框 + + + #end #end #end @@ -163,7 +169,7 @@ const formRules = reactive({ const formRef = ref() // 表单 Ref /** 打开弹窗 */ -const openModal = async (type: string, id?: number) => { +const open = async (type: string, id?: number) => { modelVisible.value = true modelTitle.value = t('action.' + type) formType.value = type @@ -178,7 +184,7 @@ const openModal = async (type: string, id?: number) => { } } } -defineExpose({ openModal }) // 提供 openModal 方法,用于打开弹窗 +defineExpose({ open }) // 提供 open 方法,用于打开弹窗 /** 提交表单 */ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 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 9a57c83f9..1d9158f71 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 @@ -92,12 +92,12 @@ 搜索 重置 - #if ($permissionPrefix.length() < 15) - + #if ($permissionPrefix.length() <= 12) + #else #end @@ -148,7 +148,7 @@ 编辑 @@ -172,6 +172,9 @@ @pagination="getList" /> + + + <${simpleClassName}Form ref="formRef" @success="getList" />