| | |
| | | /> |
| | | </el-card> |
| | | <!-- 添加或修改${functionName}对话框 --> |
| | | <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body> |
| | | <el-form ref="${businessName}FormRef" :model="form" :rules="rules" label-width="80px"> |
| | | #foreach($column in $columns) |
| | | #set($field=$column.javaField) |
| | | #if(($column.insert || $column.edit) && !$column.pk) |
| | | #set($parentheseIndex=$column.columnComment.indexOf("(")) |
| | | #if($parentheseIndex != -1) |
| | | #set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
| | | #else |
| | | #set($comment=$column.columnComment) |
| | | #end |
| | | #set($dictType=$column.dictType) |
| | | #if($column.htmlType == "input") |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-input v-model="form.${field}" placeholder="请输入${comment}" /> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "imageUpload") |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <image-upload v-model="form.${field}"/> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "fileUpload") |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <file-upload v-model="form.${field}"/> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "editor") |
| | | <el-form-item label="${comment}"> |
| | | <editor v-model="form.${field}" :min-height="192"/> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "select" && "" != $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-select v-model="form.${field}" placeholder="请选择${comment}"> |
| | | <el-option |
| | | v-for="dict in ${dictType}" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | #if($column.javaType == "Integer" || $column.javaType == "Long") |
| | | :value="parseInt(dict.value)" |
| | | #else |
| | | :value="dict.value" |
| | | #end |
| | | ></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "select" && $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-select v-model="form.${field}" placeholder="请选择${comment}"> |
| | | <el-option label="请选择字典生成" value="" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "checkbox" && "" != $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-checkbox-group v-model="form.${field}"> |
| | | <el-checkbox |
| | | v-for="dict in ${dictType}" |
| | | :key="dict.value" |
| | | :label="dict.value"> |
| | | {{dict.label}} |
| | | </el-checkbox> |
| | | </el-checkbox-group> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "checkbox" && $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-checkbox-group v-model="form.${field}"> |
| | | <el-checkbox>请选择字典生成</el-checkbox> |
| | | </el-checkbox-group> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "radio" && "" != $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-radio-group v-model="form.${field}"> |
| | | <el-radio |
| | | v-for="dict in ${dictType}" |
| | | :key="dict.value" |
| | | #if($column.javaType == "Integer" || $column.javaType == "Long") |
| | | :label="parseInt(dict.value)" |
| | | #else |
| | | :label="dict.value" |
| | | #end |
| | | >{{dict.label}}</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "radio" && $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-radio-group v-model="form.${field}"> |
| | | <el-radio label="1">请选择字典生成</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "datetime") |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-date-picker clearable |
| | | v-model="form.${field}" |
| | | type="datetime" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | placeholder="请选择${comment}"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "textarea") |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" /> |
| | | </el-form-item> |
| | | #end |
| | | #end |
| | | #end |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button> |
| | | <el-button @click="cancel">取 消</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | <detail-form ref="detailFormRef" @success="getList" apped-to-body/> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | /** 模块导入 */ |
| | | import { list${BusinessName}, del${BusinessName}} from '@/api/${moduleName}/${businessName}'; |
| | | import { ${BusinessName}VO, ${BusinessName}Query} from '@/api/${moduleName}/${businessName}/types'; |
| | | import DetailForm from "@/views/${moduleName}/${businessName}/DetailForm.vue"; |
| | | |
| | | defineOptions({ name: '${BusinessName}' }) |
| | | |
| | |
| | | #end |
| | | #end |
| | | }) |
| | | ## const ${businessName}FormRef = ref<ElFormInstance>(); |
| | | ## |
| | | ## const dialog = reactive<DialogOption>({ |
| | | ## visible: false, |
| | | ## title: '' |
| | | ## }); |
| | | |
| | | ## const initFormData: ${BusinessName}Form = { |
| | | ## #foreach ($column in $columns) |
| | | ## #if($column.insert || $column.edit) |
| | | ## #if($column.htmlType == "checkbox") |
| | | ## $column.javaField: []#if($foreach.count != $columns.size()),#end |
| | | ## #else |
| | | ## $column.javaField: undefined#if($foreach.count != $columns.size()),#end |
| | | ## #end |
| | | ## #end |
| | | ## #end |
| | | ## } |
| | | ## const data = reactive<PageData<${BusinessName}Form, ${BusinessName}Query>>({ |
| | | ## form: {...initFormData}, |
| | | ## queryParams: { |
| | | ## pageNum: 1, |
| | | ## pageSize: 10, |
| | | ## #foreach ($column in $columns) |
| | | ## #if($column.query) |
| | | ## #if($column.htmlType != "datetime" || $column.queryType != "BETWEEN") |
| | | ## $column.javaField: undefined, |
| | | ## #end |
| | | ## #end |
| | | ## #end |
| | | ## params: { |
| | | ## #foreach ($column in $columns) |
| | | ## #if($column.query) |
| | | ## #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
| | | ## $column.javaField: undefined#if($foreach.count != $columns.size()),#end |
| | | ## #end |
| | | ## #end |
| | | ## #end |
| | | ## } |
| | | ## }, |
| | | ## rules: { |
| | | ## #foreach ($column in $columns) |
| | | ## #if($column.insert || $column.edit) |
| | | ## #if($column.required) |
| | | ## #set($parentheseIndex=$column.columnComment.indexOf("(")) |
| | | ## #if($parentheseIndex != -1) |
| | | ## #set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
| | | ## #else |
| | | ## #set($comment=$column.columnComment) |
| | | ## #end |
| | | ## $column.javaField: [ |
| | | ## { required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select" || $column.htmlType == "radio")"change"#else"blur"#end } |
| | | ## ]#if($foreach.count != $columns.size()),#end |
| | | ## #end |
| | | ## #end |
| | | ## #end |
| | | ## } |
| | | ## }); |
| | | ## |
| | | ## const { queryParams, form, rules } = toRefs(data); |
| | | |
| | | /** 查询${functionName}列表 */ |
| | | const getList = async () => { |