From a65b8f63b7515553c03f32cb9072375397f6f037 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 10 Apr 2023 23:20:38 +0800 Subject: [PATCH] =?UTF-8?q?Vue3=20CRUD=20Schema=20=E6=A8=A1=E7=89=88?= =?UTF-8?q?=EF=BC=8Cdata=20=E9=83=A8=E5=88=86=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../codegen/vue3_schema/views/data.ts.vm | 99 ++++++++++--------- 1 file changed, 54 insertions(+), 45 deletions(-) diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_schema/views/data.ts.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_schema/views/data.ts.vm index 3c37ead0a..0cb639901 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_schema/views/data.ts.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_schema/views/data.ts.vm @@ -1,4 +1,5 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' +import { dateFormatter } from '@/utils/formatTime' const { t } = useI18n() // 国际化 // 表单校验 @@ -21,9 +22,7 @@ const crudSchemas = reactive([ { title: '${column.columnComment}', field: '${column.javaField}', - #if (!$column.listOperationResult) - isTable: false, - #end +## ========= 字典部分 ========= #if ("" != $dictType)## 有数据字典 dictType: DICT_TYPE.$dictType.toUpperCase(), #if ($javaType == "Integer" || $javaType == "Long" || $javaType == "Byte" || $javaType == "Short") @@ -34,6 +33,28 @@ const crudSchemas = reactive([ dictClass: 'boolean', #end #end +## ========= Table 表格部分 ========= + #if (!$column.listOperationResult) + isTable: false, + #if ($column.htmlType == "datetime") + formatter: dateFormatter, + #end + #end +## ========= Search 表格部分 ========= + #if ($column.listOperation) + isSearch: true, + #if ($column.htmlType == "datetime") + search: { + component: 'DatePicker', + componentProps: { + valueFormat: 'YYYY-MM-DD HH:mm:ss', + type: 'daterange', + defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] + } + } + #end + #end +## ========= Form 表单部分 ========= #if ((!$column.createOperation && !$column.updateOperation) || $column.primaryKey) isForm: false, #else @@ -64,52 +85,40 @@ const crudSchemas = reactive([ #elseif($column.htmlType == "checkbox")## 单选框 form: { component: 'Radio' + }, + #elseif($column.htmlType == "datetime")## 时间框 + form: { + component: 'DatePicker', + componentProps: { + type: 'datetime', + valueFormat: 'x' + } + }, + #elseif($column.htmlType == "textarea")## 文本框 + form: { + component: 'Input', + componentProps: { + type: 'textarea', + rows: 4 + }, + colProps: { + span: 24 + } + }, + #elseif(${javaType.toLowerCase()} == "long" || ${javaType.toLowerCase()} == "integer")## 文本框 + form: { + component: 'InputNumber', + value: 0 }, #end #end - #elseif(!("" != $column.dictType)) - #if (${column.javaType.toLowerCase()} == "date" || ${column.javaType.toLowerCase()} == "localdatetime") - form: { - component: 'DatePicker', - componentProps: { - type: 'datetime', - valueFormat: 'x' - } - }, - #elseif($column.htmlType == "textarea")## 文本框 - form: { - component: 'Input', - componentProps: { - type: 'textarea', - rows: 4 - }, - colProps: { - span: 24 - } - }, - #elseif(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer")## 数字类型 - form: { - component: 'InputNumber', - value: 0 - }, - #end - #end - #if ($column.listOperation) - #if($column.htmlType == "input") - isSearch: true, - #elseif("" != $dictType) - isSearch: true, - #elseif($column.htmlType == "datetime") - formatter: 'formatDate', - search: { - show: true, - itemRender: { - name: 'XDataTimePicker' - } - }, - #end - #end }, #end +#end + { + label: '操作', + field: 'action', + isForm: false + } ]) export const { allSchemas } = useCrudSchemas(crudSchemas)