Form 动态表单,增加基础表单

This commit is contained in:
YunaiV 2021-12-30 22:06:07 +08:00
parent d2420212a6
commit 4c56a07c4e
2 changed files with 51 additions and 27 deletions

View File

@ -1,29 +1,29 @@
export default [ export default [
{ {
layout: 'colFormItem', // layout: 'colFormItem',
tagIcon: 'input', // tagIcon: 'input',
label: '手机号', // label: '手机号',
vModel: 'mobile', // vModel: 'mobile',
formId: 6, // formId: 6,
tag: 'el-input', // tag: 'el-input',
placeholder: '请输入手机号', // placeholder: '请输入手机号',
defaultValue: '', // defaultValue: '',
span: 24, // span: 24,
style: { width: '100%' }, // style: { width: '100%' },
clearable: true, // clearable: true,
prepend: '', // prepend: '',
append: '', // append: '',
'prefix-icon': 'el-icon-mobile', // 'prefix-icon': 'el-icon-mobile',
'suffix-icon': '', // 'suffix-icon': '',
maxlength: 11, // maxlength: 11,
'show-word-limit': true, // 'show-word-limit': true,
readonly: false, // readonly: false,
disabled: false, // disabled: false,
required: true, // required: true,
changeTag: true, // changeTag: true,
regList: [{ // regList: [{
pattern: '/^1(3|4|5|7|8|9)\\d{9}$/', // pattern: '/^1(3|4|5|7|8|9)\\d{9}$/',
message: '手机号格式错误' // message: '手机号格式错误'
}] // }]
} }
] ]

View File

@ -72,6 +72,21 @@
</div> </div>
</div> </div>
</draggable> </draggable>
<!-- 动态表单 -->
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="表单名" prop="name">
<el-input v-model="form.name" placeholder="请输入表单名" />
</el-form-item>
<el-form-item label="开启状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio v-for="dict in this.getDictDatas(DICT_TYPE.SYS_COMMON_STATUS)"
:key="dict.value" :label="parseInt(dict.value)">{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
</el-form>
</div> </div>
</el-scrollbar> </el-scrollbar>
</div> </div>
@ -177,7 +192,7 @@ export default {
return { return {
logo, logo,
idGlobal: 100, idGlobal: 100,
formConf, formConf, //
inputComponents, inputComponents,
selectComponents, selectComponents,
layoutComponents, layoutComponents,
@ -190,7 +205,16 @@ export default {
dialogVisible: false, dialogVisible: false,
generateConf: null, generateConf: null,
showFileName: false, showFileName: false,
activeData: drawingDefalut[0] activeData: drawingDefalut[0],
//
form: {},
//
rules: {
name: [{ required: true, message: "表单名不能为空", trigger: "blur" }],
status: [{ required: true, message: "开启状态不能为空", trigger: "blur" }],
fields: [{ required: true, message: "表单配置不能为空", trigger: "blur" }],
}
} }
}, },
computed: { computed: {