Vue3 CRUD Schema 模版,data 完整提交
This commit is contained in:
parent
a65b8f63b7
commit
9d272e7941
@ -187,6 +187,8 @@ public class CodegenEngine {
|
||||
templates.forEach((vmPath, filePath) -> {
|
||||
filePath = formatFilePath(filePath, bindingMap);
|
||||
String content = templateEngine.getTemplate(vmPath).render(bindingMap);
|
||||
// 去除字段后面多余的 , 逗号
|
||||
content = content.replaceAll(",\n}", "\n}").replaceAll(",\n }", "\n }");
|
||||
result.put(filePath, content);
|
||||
});
|
||||
return result;
|
||||
|
@ -182,7 +182,12 @@
|
||||
#if ($dictMethods.size() > 0)
|
||||
import { DICT_TYPE#foreach ($dictMethod in $dictMethods), ${dictMethod}#end } from '@/utils/dict'
|
||||
#end
|
||||
#foreach ($column in $columns)
|
||||
#if ($column.listOperationResult && $column.htmlType == "datetime")
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
#break
|
||||
#end
|
||||
#end
|
||||
import download from '@/utils/download'
|
||||
import * as ${simpleClassName}Api from '@/api/${table.moduleName}/${classNameVar}'
|
||||
import ${simpleClassName}Form from './${simpleClassName}Form.vue'
|
||||
|
@ -1,6 +1,10 @@
|
||||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
|
||||
#foreach ($column in $columns)
|
||||
#if ($column.listOperationResult && $column.htmlType == "datetime")
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
const { t } = useI18n() // 国际化
|
||||
#break
|
||||
#end
|
||||
#end
|
||||
|
||||
// 表单校验
|
||||
export const rules = reactive({
|
||||
@ -12,7 +16,7 @@ export const rules = reactive({
|
||||
#end
|
||||
})
|
||||
|
||||
// CrudSchema
|
||||
// CrudSchema https://kailong110120130.gitee.io/vue-element-plus-admin-doc/hooks/useCrudSchemas.html
|
||||
const crudSchemas = reactive<CrudSchema[]>([
|
||||
#foreach($column in $columns)
|
||||
#if ($column.listOperation || $column.listOperationResult || $column.createOperation || $column.updateOperation)
|
||||
@ -20,7 +24,7 @@ const crudSchemas = reactive<CrudSchema[]>([
|
||||
#set ($javaField = $column.javaField)
|
||||
#set ($javaType = $column.javaType)
|
||||
{
|
||||
title: '${column.columnComment}',
|
||||
label: '${column.columnComment}',
|
||||
field: '${column.javaField}',
|
||||
## ========= 字典部分 =========
|
||||
#if ("" != $dictType)## 有数据字典
|
||||
@ -36,6 +40,7 @@ const crudSchemas = reactive<CrudSchema[]>([
|
||||
## ========= Table 表格部分 =========
|
||||
#if (!$column.listOperationResult)
|
||||
isTable: false,
|
||||
#else
|
||||
#if ($column.htmlType == "datetime")
|
||||
formatter: dateFormatter,
|
||||
#end
|
||||
@ -51,7 +56,7 @@ const crudSchemas = reactive<CrudSchema[]>([
|
||||
type: 'daterange',
|
||||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
|
||||
}
|
||||
}
|
||||
},
|
||||
#end
|
||||
#end
|
||||
## ========= Form 表单部分 =========
|
||||
@ -82,7 +87,7 @@ const crudSchemas = reactive<CrudSchema[]>([
|
||||
form: {
|
||||
component: 'Checkbox'
|
||||
},
|
||||
#elseif($column.htmlType == "checkbox")## 单选框
|
||||
#elseif($column.htmlType == "radio")## 单选框
|
||||
form: {
|
||||
component: 'Radio'
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user