Commit 2759a323312f9ce66d536f558faa437e55dce3d9

Authored by YunaiV
1 parent 54956fcb

【功能移除】INFRA:移除 Vue3 + Element Plus schema 模式

yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/enums/codegen/CodegenFrontTypeEnum.java
@@ -14,7 +14,6 @@ public enum CodegenFrontTypeEnum { @@ -14,7 +14,6 @@ public enum CodegenFrontTypeEnum {
14 14
15 VUE2(10), // Vue2 Element UI 标准模版 15 VUE2(10), // Vue2 Element UI 标准模版
16 VUE3(20), // Vue3 Element Plus 标准模版 16 VUE3(20), // Vue3 Element Plus 标准模版
17 - VUE3_SCHEMA(21), // Vue3 Element Plus Schema 模版  
18 VUE3_VBEN(30), // Vue3 VBEN 模版 17 VUE3_VBEN(30), // Vue3 VBEN 模版
19 ; 18 ;
20 19
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/inner/CodegenEngine.java
@@ -135,15 +135,6 @@ public class CodegenEngine { @@ -135,15 +135,6 @@ public class CodegenEngine {
135 vue3FilePath("views/${table.moduleName}/${table.businessName}/components/${subSimpleClassName}List.vue")) 135 vue3FilePath("views/${table.moduleName}/${table.businessName}/components/${subSimpleClassName}List.vue"))
136 .put(CodegenFrontTypeEnum.VUE3.getType(), vue3TemplatePath("api/api.ts"), 136 .put(CodegenFrontTypeEnum.VUE3.getType(), vue3TemplatePath("api/api.ts"),
137 vue3FilePath("api/${table.moduleName}/${table.businessName}/index.ts")) 137 vue3FilePath("api/${table.moduleName}/${table.businessName}/index.ts"))
138 - // Vue3 Schema 模版  
139 - .put(CodegenFrontTypeEnum.VUE3_SCHEMA.getType(), vue3SchemaTemplatePath("views/data.ts"),  
140 - vue3FilePath("views/${table.moduleName}/${table.businessName}/${classNameVar}.data.ts"))  
141 - .put(CodegenFrontTypeEnum.VUE3_SCHEMA.getType(), vue3SchemaTemplatePath("views/index.vue"),  
142 - vue3FilePath("views/${table.moduleName}/${table.businessName}/index.vue"))  
143 - .put(CodegenFrontTypeEnum.VUE3_SCHEMA.getType(), vue3SchemaTemplatePath("views/form.vue"),  
144 - vue3FilePath("views/${table.moduleName}/${table.businessName}/${simpleClassName}Form.vue"))  
145 - .put(CodegenFrontTypeEnum.VUE3_SCHEMA.getType(), vue3SchemaTemplatePath("api/api.ts"),  
146 - vue3FilePath("api/${table.moduleName}/${table.businessName}/index.ts"))  
147 // Vue3 vben 模版 138 // Vue3 vben 模版
148 .put(CodegenFrontTypeEnum.VUE3_VBEN.getType(), vue3VbenTemplatePath("views/data.ts"), 139 .put(CodegenFrontTypeEnum.VUE3_VBEN.getType(), vue3VbenTemplatePath("views/data.ts"),
149 vue3FilePath("views/${table.moduleName}/${table.businessName}/${classNameVar}.data.ts")) 140 vue3FilePath("views/${table.moduleName}/${table.businessName}/${classNameVar}.data.ts"))
@@ -496,10 +487,6 @@ public class CodegenEngine { @@ -496,10 +487,6 @@ public class CodegenEngine {
496 "src/" + path; 487 "src/" + path;
497 } 488 }
498 489
499 - private static String vue3SchemaTemplatePath(String path) {  
500 - return "codegen/vue3_schema/" + path + ".vm";  
501 - }  
502 -  
503 private static String vue3VbenTemplatePath(String path) { 490 private static String vue3VbenTemplatePath(String path) {
504 return "codegen/vue3_vben/" + path + ".vm"; 491 return "codegen/vue3_vben/" + path + ".vm";
505 } 492 }
yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_schema/api/api.ts.vm deleted
1 -import request from '@/config/axios'  
2 -#set ($baseURL = "/${table.moduleName}/${simpleClassName_strikeCase}")  
3 -  
4 -export interface ${simpleClassName}VO {  
5 - #foreach ($column in $columns)  
6 - #if ($column.createOperation || $column.updateOperation)  
7 - #if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer" || ${column.javaType.toLowerCase()} == "double" || ${column.javaType.toLowerCase()} == "bigdecimal")  
8 - ${column.javaField}: number  
9 - #elseif(${column.javaType.toLowerCase()} == "date" || ${column.javaType.toLowerCase()} == "localdatetime")  
10 - ${column.javaField}: Date  
11 - #else  
12 - ${column.javaField}: ${column.javaType.toLowerCase()}  
13 - #end  
14 - #end  
15 - #end  
16 -}  
17 -  
18 -// 查询${table.classComment}列表  
19 -export const get${simpleClassName}Page = async (params) => {  
20 - return await request.get({ url: '${baseURL}/page', params })  
21 -}  
22 -  
23 -// 查询${table.classComment}详情  
24 -export const get${simpleClassName} = async (id: number) => {  
25 - return await request.get({ url: '${baseURL}/get?id=' + id })  
26 -}  
27 -  
28 -// 新增${table.classComment}  
29 -export const create${simpleClassName} = async (data: ${simpleClassName}VO) => {  
30 - return await request.post({ url: '${baseURL}/create', data })  
31 -}  
32 -  
33 -// 修改${table.classComment}  
34 -export const update${simpleClassName} = async (data: ${simpleClassName}VO) => {  
35 - return await request.put({ url: '${baseURL}/update', data })  
36 -}  
37 -  
38 -// 删除${table.classComment}  
39 -export const delete${simpleClassName} = async (id: number) => {  
40 - return await request.delete({ url: '${baseURL}/delete?id=' + id })  
41 -}  
42 -  
43 -// 导出${table.classComment} Excel  
44 -export const export${simpleClassName}Api = async (params) => {  
45 - return await request.download({ url: '${baseURL}/export-excel', params })  
46 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_schema/views/data.ts.vm deleted
1 -import type { CrudSchema } from '@/hooks/web/useCrudSchemas'  
2 -import { dateFormatter } from '@/utils/formatTime'  
3 -  
4 -// 表单校验  
5 -export const rules = reactive({  
6 -#foreach ($column in $columns)  
7 -#if (($column.createOperation || $column.updateOperation) && !$column.nullable && !${column.primaryKey})## 创建或者更新操作 && 要求非空 && 非主键  
8 -#set($comment=$column.columnComment)  
9 - $column.javaField: [required],  
10 -#end  
11 -#end  
12 -})  
13 -  
14 -// CrudSchema https://doc.iocoder.cn/vue3/crud-schema/  
15 -const crudSchemas = reactive<CrudSchema[]>([  
16 -#foreach($column in $columns)  
17 -#if ($column.listOperation || $column.listOperationResult || $column.createOperation || $column.updateOperation)  
18 -#set ($dictType = $column.dictType)  
19 -#set ($javaField = $column.javaField)  
20 -#set ($javaType = $column.javaType)  
21 - {  
22 - label: '${column.columnComment}',  
23 - field: '${column.javaField}',  
24 -## ========= 字典部分 =========  
25 - #if ("" != $dictType)## 有数据字典  
26 - dictType: DICT_TYPE.$dictType.toUpperCase(),  
27 - #if ($javaType == "Integer" || $javaType == "Long" || $javaType == "Byte" || $javaType == "Short")  
28 - dictClass: 'number',  
29 - #elseif ($javaType == "String")  
30 - dictClass: 'string',  
31 - #elseif ($javaType == "Boolean")  
32 - dictClass: 'boolean',  
33 - #end  
34 - #end  
35 -## ========= Table 表格部分 =========  
36 - #if (!$column.listOperationResult)  
37 - isTable: false,  
38 - #else  
39 - #if ($column.htmlType == "datetime")  
40 - formatter: dateFormatter,  
41 - #end  
42 - #end  
43 -## ========= Search 表格部分 =========  
44 - #if ($column.listOperation)  
45 - isSearch: true,  
46 - #if ($column.htmlType == "datetime")  
47 - search: {  
48 - component: 'DatePicker',  
49 - componentProps: {  
50 - valueFormat: 'YYYY-MM-DD HH:mm:ss',  
51 - type: 'daterange',  
52 - defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]  
53 - }  
54 - },  
55 - #end  
56 - #end  
57 -## ========= Form 表单部分 =========  
58 - #if ((!$column.createOperation && !$column.updateOperation) || $column.primaryKey)  
59 - isForm: false,  
60 - #else  
61 - #if($column.htmlType == "imageUpload")## 图片上传  
62 - form: {  
63 - component: 'UploadImg'  
64 - },  
65 - #elseif($column.htmlType == "fileUpload")## 文件上传  
66 - form: {  
67 - component: 'UploadFile'  
68 - },  
69 - #elseif($column.htmlType == "editor")## 文本编辑器  
70 - form: {  
71 - component: 'Editor',  
72 - componentProps: {  
73 - valueHtml: '',  
74 - height: 200  
75 - }  
76 - },  
77 - #elseif($column.htmlType == "select")## 下拉框  
78 - form: {  
79 - component: 'SelectV2'  
80 - },  
81 - #elseif($column.htmlType == "checkbox")## 多选框  
82 - form: {  
83 - component: 'Checkbox'  
84 - },  
85 - #elseif($column.htmlType == "radio")## 单选框  
86 - form: {  
87 - component: 'Radio'  
88 - },  
89 - #elseif($column.htmlType == "datetime")## 时间框  
90 - form: {  
91 - component: 'DatePicker',  
92 - componentProps: {  
93 - type: 'datetime',  
94 - valueFormat: 'x'  
95 - }  
96 - },  
97 - #elseif($column.htmlType == "textarea")## 文本框  
98 - form: {  
99 - component: 'Input',  
100 - componentProps: {  
101 - type: 'textarea',  
102 - rows: 4  
103 - },  
104 - colProps: {  
105 - span: 24  
106 - }  
107 - },  
108 - #elseif(${javaType.toLowerCase()} == "long" || ${javaType.toLowerCase()} == "integer")## 文本框  
109 - form: {  
110 - component: 'InputNumber',  
111 - value: 0  
112 - },  
113 - #end  
114 - #end  
115 - },  
116 -#end  
117 -#end  
118 - {  
119 - label: '操作',  
120 - field: 'action',  
121 - isForm: false  
122 - }  
123 -])  
124 -export const { allSchemas } = useCrudSchemas(crudSchemas)  
yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_schema/views/form.vue.vm deleted
1 -<template>  
2 - <Dialog :title="dialogTitle" v-model="dialogVisible">  
3 - <Form ref="formRef" :schema="allSchemas.formSchema" :rules="rules" v-loading="formLoading" />  
4 - <template #footer>  
5 - <el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>  
6 - <el-button @click="dialogVisible = false">取 消</el-button>  
7 - </template>  
8 - </Dialog>  
9 -</template>  
10 -<script setup lang="ts">  
11 -import * as ${simpleClassName}Api from '@/api/${table.moduleName}/${table.businessName}'  
12 -import { rules, allSchemas } from './${classNameVar}.data'  
13 -const { t } = useI18n() // 国际化  
14 -const message = useMessage() // 消息弹窗  
15 -  
16 -const dialogVisible = ref(false) // 弹窗的是否展示  
17 -const dialogTitle = ref('') // 弹窗的标题  
18 -const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用  
19 -const formType = ref('') // 表单的类型:create - 新增;update - 修改  
20 -const formRef = ref() // 表单 Ref  
21 -  
22 -/** 打开弹窗 */  
23 -const open = async (type: string, id?: number) => {  
24 - dialogVisible.value = true  
25 - dialogTitle.value = t('action.' + type)  
26 - formType.value = type  
27 - // 修改时,设置数据  
28 - if (id) {  
29 - formLoading.value = true  
30 - try {  
31 - const data = await ${simpleClassName}Api.get${simpleClassName}(id)  
32 - formRef.value.setValues(data)  
33 - } finally {  
34 - formLoading.value = false  
35 - }  
36 - }  
37 -}  
38 -defineExpose({ open }) // 提供 open 方法,用于打开弹窗  
39 -  
40 -/** 提交表单 */  
41 -const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调  
42 -const submitForm = async () => {  
43 - // 校验表单  
44 - if (!formRef) return  
45 - const valid = await formRef.value.getElFormRef().validate()  
46 - if (!valid) return  
47 - // 提交请求  
48 - formLoading.value = true  
49 - try {  
50 - const data = formRef.value.formModel as ${simpleClassName}Api.${simpleClassName}VO  
51 - if (formType.value === 'create') {  
52 - await ${simpleClassName}Api.create${simpleClassName}(data)  
53 - message.success(t('common.createSuccess'))  
54 - } else {  
55 - await ${simpleClassName}Api.update${simpleClassName}(data)  
56 - message.success(t('common.updateSuccess'))  
57 - }  
58 - dialogVisible.value = false  
59 - // 发送操作成功的事件  
60 - emit('success')  
61 - } finally {  
62 - formLoading.value = false  
63 - }  
64 -}  
65 -</script>  
yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_schema/views/index.vue.vm deleted
1 -<template>  
2 - <!-- 搜索工作栏 -->  
3 - <ContentWrap>  
4 - <Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams">  
5 - <!-- 新增等操作按钮 -->  
6 - <template #actionMore>  
7 - <el-button  
8 - type="primary"  
9 - plain  
10 - @click="openForm('create')"  
11 - v-hasPermi="['${permissionPrefix}:create']"  
12 - >  
13 - <Icon icon="ep:plus" class="mr-5px" /> 新增  
14 - </el-button>  
15 - </template>  
16 - </Search>  
17 - </ContentWrap>  
18 -  
19 - <!-- 列表 -->  
20 - <ContentWrap>  
21 - <Table  
22 - :columns="allSchemas.tableColumns"  
23 - :data="tableObject.tableList"  
24 - :loading="tableObject.loading"  
25 - :pagination="{  
26 - total: tableObject.total  
27 - }"  
28 - v-model:pageSize="tableObject.pageSize"  
29 - v-model:currentPage="tableObject.currentPage"  
30 - >  
31 - <template #action="{ row }">  
32 - <el-button  
33 - link  
34 - type="primary"  
35 - @click="openForm('update', row.id)"  
36 - v-hasPermi="['${permissionPrefix}:update']"  
37 - >  
38 - 编辑  
39 - </el-button>  
40 - <el-button  
41 - link  
42 - type="danger"  
43 - v-hasPermi="['${permissionPrefix}:delete']"  
44 - @click="handleDelete(row.id)"  
45 - >  
46 - 删除  
47 - </el-button>  
48 - </template>  
49 - </Table>  
50 - </ContentWrap>  
51 -  
52 - <!-- 表单弹窗:添加/修改 -->  
53 - <${simpleClassName}Form ref="formRef" @success="getList" />  
54 -</template>  
55 -<script setup lang="ts" name="${table.className}">  
56 -import { allSchemas } from './${classNameVar}.data'  
57 -import * as ${simpleClassName}Api from '@/api/${table.moduleName}/${table.businessName}'  
58 -import ${simpleClassName}Form from './${simpleClassName}Form.vue'  
59 -  
60 -// tableObject:表格的属性对象,可获得分页大小、条数等属性  
61 -// tableMethods:表格的操作对象,可进行获得分页、删除记录等操作  
62 -// 详细可见:https://doc.iocoder.cn/vue3/crud-schema/  
63 -const { tableObject, tableMethods } = useTable({  
64 - getListApi: ${simpleClassName}Api.get${simpleClassName}Page, // 分页接口  
65 - delListApi: ${simpleClassName}Api.delete${simpleClassName} // 删除接口  
66 -})  
67 -// 获得表格的各种操作  
68 -const { getList, setSearchParams } = tableMethods  
69 -  
70 -/** 添加/修改操作 */  
71 -const formRef = ref()  
72 -const openForm = (type: string, id?: number) => {  
73 - formRef.value.open(type, id)  
74 -}  
75 -  
76 -/** 删除按钮操作 */  
77 -const handleDelete = (id: number) => {  
78 - tableMethods.delList(id, false)  
79 -}  
80 -  
81 -/** 初始化 **/  
82 -onMounted(() => {  
83 - getList()  
84 -})  
85 -</script>  
yudao-server/src/main/resources/application.yaml
@@ -245,7 +245,7 @@ yudao: @@ -245,7 +245,7 @@ yudao:
245 codegen: 245 codegen:
246 base-package: ${yudao.info.base-package} 246 base-package: ${yudao.info.base-package}
247 db-schemas: ${spring.datasource.dynamic.datasource.master.name} 247 db-schemas: ${spring.datasource.dynamic.datasource.master.name}
248 - front-type: 10 # 前端模版的类型,参见 CodegenFrontTypeEnum 枚举类 248 + front-type: 20 # 前端模版的类型,参见 CodegenFrontTypeEnum 枚举类
249 tenant: # 多租户相关配置项 249 tenant: # 多租户相关配置项
250 enable: true 250 enable: true
251 ignore-urls: 251 ignore-urls: