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