feat(generate): 优化代码生成逻辑

- 新增公共字段配置,统一处理常见字段的生成规则
- 修复模板中的一些错误,如变量名、函数名等
- 优化代码结构,提高可读性和可维护性
This commit is contained in:
2025-07-01 23:40:43 +08:00
parent bd13f1cfdc
commit 1c316594f5
10 changed files with 568 additions and 175 deletions

View File

@@ -1,5 +1,10 @@
<template>
<el-form ref="ruleFormRef" :model="newFormInline" label-width="82px">
<el-form
ref="ruleFormRef"
:model="newFormInline"
:rules="formRules"
label-width="82px"
>
<el-row :gutter="30">
[% for column in columns if column.is_insert or column.is_edit %]
<re-col :value="24" :xm="24" :sm="24">
@@ -63,7 +68,7 @@
</el-form>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { reactive, ref } from "vue";
import ReCol from "@/components/ReCol";
import type { FormRules } from "element-plus";
import { [[ class_name ]]Info } from "types/[[ name ]]";
@@ -84,7 +89,7 @@ const props = withDefaults(defineProps<FormProps>(), {
[% endfor %]
})
});
const newFormInline = ref<ConfigInfo>(props.formInline);
const newFormInline = ref<[[ class_name ]]Info>(props.formInline);
/** 自定义表单规则校验 */
const formRules = reactive<FormRules>({
[% for column in columns if column.is_insert or column.is_edit %]