mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-27 14:57:10 +08:00
chore: 完善代码生成模板 AddModal.ftl
This commit is contained in:
@@ -16,8 +16,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Message } from '@arco-design/web-vue'
|
import { Message } from '@arco-design/web-vue'
|
||||||
import { get${classNamePrefix}, add${classNamePrefix}, update${classNamePrefix} } from '@/apis'
|
import { get${classNamePrefix}, add${classNamePrefix}, update${classNamePrefix} } from '@/apis'
|
||||||
import { type Columns, GiForm } from '@/components/GiForm'
|
import { type Columns, GiForm, type Options } from '@/components/GiForm'
|
||||||
import { useForm } from '@/hooks'
|
import { useForm } from '@/hooks'
|
||||||
|
import { useDict } from '@/hooks/app'
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'save-success'): void
|
(e: 'save-success'): void
|
||||||
@@ -28,6 +29,16 @@ const isUpdate = computed(() => !!dataId.value)
|
|||||||
const title = computed(() => (isUpdate.value ? '修改${businessName}' : '新增${businessName}'))
|
const title = computed(() => (isUpdate.value ? '修改${businessName}' : '新增${businessName}'))
|
||||||
const formRef = ref<InstanceType<typeof GiForm>>()
|
const formRef = ref<InstanceType<typeof GiForm>>()
|
||||||
|
|
||||||
|
<#list fieldConfigs as fieldConfig>
|
||||||
|
<#if fieldConfig.showInForm>
|
||||||
|
<#-- SELECT/RADIO/CHECK_GROUP/TREE_SELECT控件从服务器端获取数据 -->
|
||||||
|
<#if fieldConfig.formType = 'SELECT' || fieldConfig.formType = 'RADIO'
|
||||||
|
|| fieldConfig.formType = 'CHECK_GROUP' || fieldConfig.formType = 'TREE_SELECT'>
|
||||||
|
const { ${fieldConfig.columnName}_enum } = useDict('${fieldConfig.columnName}_enum')
|
||||||
|
</#if>
|
||||||
|
</#if>
|
||||||
|
</#list>
|
||||||
|
|
||||||
const options: Options = {
|
const options: Options = {
|
||||||
form: {},
|
form: {},
|
||||||
col: { xs: 24, sm: 24, md: 24, lg: 24, xl: 24, xxl: 24 },
|
col: { xs: 24, sm: 24, md: 24, lg: 24, xl: 24, xxl: 24 },
|
||||||
@@ -44,6 +55,34 @@ const columns: Columns = [
|
|||||||
type: 'input',
|
type: 'input',
|
||||||
<#elseif fieldConfig.formType = 'TEXT_AREA'>
|
<#elseif fieldConfig.formType = 'TEXT_AREA'>
|
||||||
type: 'textarea',
|
type: 'textarea',
|
||||||
|
<#elseif fieldConfig.formType = 'DATE'>
|
||||||
|
type: 'date-picker',
|
||||||
|
<#elseif fieldConfig.formType = 'DATE_TIME'>
|
||||||
|
type: 'time-picker',
|
||||||
|
<#elseif fieldConfig.formType = 'INPUT_NUMBER'>
|
||||||
|
type: 'input-number',
|
||||||
|
<#elseif fieldConfig.formType = 'INPUT_PASSWORD'>
|
||||||
|
type: 'input-password',
|
||||||
|
<#elseif fieldConfig.formType = 'SWITCH'>
|
||||||
|
type: 'switch',
|
||||||
|
<#elseif fieldConfig.formType = 'CHECK_GROUP'>
|
||||||
|
type: 'check-group',
|
||||||
|
props: {
|
||||||
|
options: ${fieldConfig.columnName}_enum,
|
||||||
|
},
|
||||||
|
<#elseif fieldConfig.formType = 'TREE_SELECT'>
|
||||||
|
type: 'tree-select',
|
||||||
|
data: '${fieldConfig.columnName}_enum',
|
||||||
|
<#elseif fieldConfig.formType = 'SELECT'>
|
||||||
|
type: 'select',
|
||||||
|
props: {
|
||||||
|
options: ${fieldConfig.columnName}_enum,
|
||||||
|
},
|
||||||
|
<#elseif fieldConfig.formType = 'RADIO'>
|
||||||
|
type: 'radio-group',
|
||||||
|
props: {
|
||||||
|
options: ${fieldConfig.columnName}_enum,
|
||||||
|
},
|
||||||
</#if>
|
</#if>
|
||||||
<#if fieldConfig.isRequired>
|
<#if fieldConfig.isRequired>
|
||||||
rules: [{ required: true, message: '请输入${fieldConfig.comment}' }]
|
rules: [{ required: true, message: '请输入${fieldConfig.comment}' }]
|
||||||
|
Reference in New Issue
Block a user