From faea04546e1004494b2a4444ce1da80fe1391097 Mon Sep 17 00:00:00 2001 From: jueying Date: Mon, 31 Oct 2022 17:13:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=A3=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90=E7=88=B6=E8=8F=9C=E5=8D=95=E9=80=89=E6=8B=A9=E6=97=A0?= =?UTF-8?q?=E6=95=88=EF=BC=8C=E5=89=8D=E7=AB=AF=E4=BB=A3=E7=A0=81=E7=BC=BA?= =?UTF-8?q?=E5=B0=91=E5=AD=97=E6=AE=B5=EF=BC=8C=E6=A0=BC=E5=BC=8F=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/codegen/vue3/api/api.ts.vm | 14 +- .../resources/codegen/vue3/api/types.ts.vm | 18 +- .../resources/codegen/vue3/views/data.ts.vm | 170 ++++++------- .../resources/codegen/vue3/views/index.vue.vm | 236 +++++++++--------- .../src/views/infra/codegen/EditTable.vue | 8 +- .../infra/codegen/components/GenInfoForm.vue | 2 +- 6 files changed, 227 insertions(+), 221 deletions(-) diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/api/api.ts.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/api/api.ts.vm index 69da81493..7d13b5dec 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/api/api.ts.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/api/api.ts.vm @@ -1,35 +1,35 @@ import { useAxios } from '@/hooks/web/useAxios' -import { ${simpleClassName}VO,${simpleClassName}PageReqVO,${simpleClassName}ExcelReqVO } from './types' +import { ${simpleClassName}VO, ${simpleClassName}PageReqVO, ${simpleClassName}ExcelReqVO } from './types' const request = useAxios() #set ($baseURL = "/${table.moduleName}/${simpleClassName_strikeCase}") // 查询${table.classComment}列表 export const get${simpleClassName}PageApi = async (params: ${simpleClassName}PageReqVO) => { - return await request.get({ url: '${baseURL}/page', params }) + return await request.get({ url: '${baseURL}/page', params }) } // 查询${table.classComment}详情 export const get${simpleClassName}Api = async (id: number) => { - return await request.get({ url: '${baseURL}/get?id=' + id }) + return await request.get({ url: '${baseURL}/get?id=' + id }) } // 新增${table.classComment} export const create${simpleClassName}Api = async (data: ${simpleClassName}VO) => { - return await request.post({ url: '${baseURL}/create', data }) + return await request.post({ url: '${baseURL}/create', data }) } // 修改${table.classComment} export const update${simpleClassName}Api = async (data: ${simpleClassName}VO) => { - return await request.put({ url: '${baseURL}/update', data }) + return await request.put({ url: '${baseURL}/update', data }) } // 删除${table.classComment} export const delete${simpleClassName}Api = async (id: number) => { - return await request.delete({ url: '${baseURL}/delete?id=' + id }) + return await request.delete({ url: '${baseURL}/delete?id=' + id }) } // 导出${table.classComment} Excel export const export${simpleClassName}Api = async (params: ${simpleClassName}ExcelReqVO) => { - return await request.download({ url: '${baseURL}/export-excel', params }) + return await request.download({ url: '${baseURL}/export-excel', params }) } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/api/types.ts.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/api/types.ts.vm index d5b5d937d..54ab47e02 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/api/types.ts.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/api/types.ts.vm @@ -2,9 +2,11 @@ export type ${simpleClassName}VO = { #foreach ($column in $columns) #if ($column.createOperation || $column.updateOperation) #if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer") - ${column.javaField}: number + ${column.javaField}: number +#elseif(${column.javaType.toLowerCase()} == "date") + ${column.javaField}: string #else - ${column.javaField}: ${column.javaType.toLowerCase()} + ${column.javaField}: ${column.javaType.toLowerCase()} #end #end #end @@ -14,9 +16,11 @@ export type ${simpleClassName}PageReqVO = { #foreach ($column in $columns) #if (${column.listOperation})##查询操作 #if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer") - ${column.javaField}: number + ${column.javaField}: number +#elseif(${column.javaType.toLowerCase()} == "date") + ${column.javaField}: string #else - ${column.javaField}: ${column.javaType.toLowerCase()} + ${column.javaField}: ${column.javaType.toLowerCase()} #end #end #end @@ -26,9 +30,11 @@ export type ${simpleClassName}ExcelReqVO = { #foreach ($column in $columns) #if (${column.listOperation})##查询操作 #if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer") - ${column.javaField}: number + ${column.javaField}: number +#elseif(${column.javaType.toLowerCase()} == "date") + ${column.javaField}: string #else - ${column.javaField}: ${column.javaType.toLowerCase()} + ${column.javaField}: ${column.javaType.toLowerCase()} #end #end #end diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/data.ts.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/data.ts.vm index 965fe49ab..fa64bc883 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/data.ts.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/data.ts.vm @@ -8,104 +8,104 @@ export const rules = reactive({ #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 }], + $column.javaField: [{ required: true, message: '${comment}不能为空', trigger: #if($column.htmlType == "select")'change'#else'blur'#end }], #end #end }) // CrudSchema const crudSchemas = reactive([ #foreach($column in $columns) - #if ($column.listOperation || $column.listOperationResult || $column.createOperation || $column.updateOperation) - #set ($dictType = $column.dictType) - { - label: '${column.columnComment}', - field: '${column.javaField}', - #if ("" != $dictType)## 有数据字典 - dictType: DICT_TYPE.$dictType.toUpperCase(), - #end - #if($column.primaryKey) - type: 'index', - form: { - show: false - }, - detail: { - show: false + #if ($column.listOperation || $column.listOperationResult || $column.createOperation || $column.updateOperation) + #set ($dictType = $column.dictType) + { + label: '${column.columnComment}', + field: '${column.javaField}', + #if ("" != $dictType)## 有数据字典 + dictType: DICT_TYPE.$dictType.toUpperCase(), + #end + #if($column.primaryKey) + type: 'index', + form: { + show: false + }, + detail: { + show: false + } + #else + #if (!$column.createOperation && !$column.updateOperation) + form: { + show: false + }, + #elseif(!("" != $column.dictType)) + form: { + show: true, + #if ($column.htmlType == "datetime")## 时间框 + component: 'DatePicker', + componentProps: { + type: 'datetime', + valueFormat: 'YYYY-MM-DD HH:mm:ss' } - #else - #if (!$column.createOperation && !$column.updateOperation) - form: { - false + #elseif($column.htmlType == "editor")## 文本编辑器 + component: 'Editor', + colProps: { + span: 24 }, - #elseif(!("" != $column.dictType)) - form: { - show: true, - #if ($column.htmlType == "datetime")## 时间框 - component: 'DatePicker', - componentProps: { - type: 'datetime', - valueFormat: 'YYYY-MM-DD HH:mm:ss' - } - #elseif($column.htmlType == "editor")## 文本编辑器 - component: 'Editor', - colProps: { - span: 24 - }, - componentProps: { - valueHtml: '' - } - #elseif($column.htmlType == "textarea")## 文本框 - component: 'Input', - componentProps: { - type: 'textarea', - rows: 4 - }, - colProps: { - span: 24 - } - #end - }, - #end - #if ($column.listOperationResult) - search: { - #if($column.htmlType == "input") - show: true - #else - #if($column.htmlType == "datetime") - show: true, - component: 'DatePicker', - componentProps: { - type: 'datetimerange', - valueFormat: 'YYYY-MM-DD HH:mm:ss' - } - #elseif($column.htmlType == "select" || $column.htmlType == "radio") - #if ("" == $dictType)## 没有数据字典 - show: true, - component: 'Select', - componentProps: { - option: [{'','请选择字典生成'}] - } - #else - show: true - #end - #end - #end + componentProps: { + valueHtml: '' + } + #elseif($column.htmlType == "textarea")## 文本框 + component: 'Input', + componentProps: { + type: 'textarea', + rows: 4 + }, + colProps: { + span: 24 } - #end #end }, #end -#end - { - label: t('table.action'), - field: 'action', - width: '240px', - form: { - show: false - }, - detail: { - show: false - } + #if ($column.listOperationResult) + search: { + #if($column.htmlType == "input") + show: true + #else + #if($column.htmlType == "datetime") + show: true, + component: 'DatePicker', + componentProps: { + type: 'datetimerange', + valueFormat: 'YYYY-MM-DD HH:mm:ss' + } + #elseif($column.htmlType == "select" || $column.htmlType == "radio") + #if ("" == $dictType)## 没有数据字典 + show: true, + component: 'Select', + componentProps: { + option: [{'','请选择字典生成'}] + } + #else + show: true + #end + #end + #end } + #end + #end + }, + #end +#end + { + label: t('table.action'), + field: 'action', + width: '240px', + form: { + show: false + }, + detail: { + show: false + } + } ]) export const { allSchemas } = useCrudSchemas(crudSchemas) \ No newline at end of file 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 ca4adc1a6..7a050b8bb 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 @@ -1,92 +1,92 @@