|
@ -7,7 +7,7 @@ |
|
|
<el-input v-model="form.fieldCnName" :disabled="isDisabled" /> |
|
|
<el-input v-model="form.fieldCnName" :disabled="isDisabled" /> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
<el-form-item v-if="!isDisabled" label="字段标识" prop="fieldName"> |
|
|
|
|
|
|
|
|
<el-form-item v-if="!isDisabled" label="字段标识" prop="fieldName" :inline-message="true"> |
|
|
<el-input v-if="isDisabled" v-model="form.fieldName" readonly /> |
|
|
<el-input v-if="isDisabled" v-model="form.fieldName" readonly /> |
|
|
<el-input v-else v-model="form.fieldName" :disabled="!isAdd" /> |
|
|
<el-input v-else v-model="form.fieldName" :disabled="!isAdd" /> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
@ -34,7 +34,7 @@ |
|
|
<el-form-item label="对应字典" prop="dictionaryConfigId"> |
|
|
<el-form-item label="对应字典" prop="dictionaryConfigId"> |
|
|
<el-input v-if="isDisabled" v-model="form.dictionaryConfigId.dicName" readonly /> |
|
|
<el-input v-if="isDisabled" v-model="form.dictionaryConfigId.dicName" readonly /> |
|
|
<!-- @change="selectDictionary" --> |
|
|
<!-- @change="selectDictionary" --> |
|
|
<el-select v-else v-model="form.dictionaryConfigId.id" placeholder="" value-key="id"> |
|
|
|
|
|
|
|
|
<el-select v-else v-model="form.dictionaryConfigId.id" placeholder="" value-key="id" :disabled="form.isInputClass !== 'select' && form.isInputClass !== 'popover'"> |
|
|
<el-option v-for="item in dictionaryData" :key="item.id" :label="item.dicName" :value="item.id" /> |
|
|
<el-option v-for="item in dictionaryData" :key="item.id" :label="item.dicName" :value="item.id" /> |
|
|
</el-select> |
|
|
</el-select> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
@ -116,13 +116,37 @@ export default { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
var checkFieldName = (rule, value, callback) => { |
|
|
var checkFieldName = (rule, value, callback) => { |
|
|
const reg = /^[A-Za-z][A-Za-z_]+[a-zA-Z]*$/ |
|
|
|
|
|
|
|
|
const reg = /^[A-Za-z][A-Za-z_]]*[a-zA-Z]*$/ |
|
|
if (reg.test(value)) { |
|
|
if (reg.test(value)) { |
|
|
callback() |
|
|
callback() |
|
|
} else { |
|
|
} else { |
|
|
callback(new Error('字段标识只能由字母、字符“_”组成,并且必须以字母开头和结尾')) |
|
|
callback(new Error('字段标识只能由字母、字符“_”组成,并且必须以字母开头和结尾')) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
// 显示长度限制 |
|
|
|
|
|
var checkEditLength = (rule, value, callback) => { |
|
|
|
|
|
if (this.form.editLength && this.form.editLength > 510) { |
|
|
|
|
|
callback(new Error('显示长度最大510')) |
|
|
|
|
|
} else { |
|
|
|
|
|
callback() |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
// 对应字典必填判断 |
|
|
|
|
|
var checkDictionaryConfigId = (rule, value, callback) => { |
|
|
|
|
|
if ((this.form.isInputClass === 'select' || this.form.isInputClass === 'popover') && !this.form.dictionaryConfigId.id) { |
|
|
|
|
|
callback(new Error('对应字典项不可为空!')) |
|
|
|
|
|
} else { |
|
|
|
|
|
callback() |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
// 选择'自动补零',位数必填 |
|
|
|
|
|
var checkFillingDigit = (rule, value, callback) => { |
|
|
|
|
|
if (this.form.isFilling && !this.form.fillingDigit) { |
|
|
|
|
|
callback(new Error('请填写位数!')) |
|
|
|
|
|
} else { |
|
|
|
|
|
callback() |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
var getRules = () => { |
|
|
var getRules = () => { |
|
|
const rules = { |
|
|
const rules = { |
|
|
fieldCnName: [ |
|
|
fieldCnName: [ |
|
@ -137,6 +161,15 @@ export default { |
|
|
], |
|
|
], |
|
|
isColumnLength: [ |
|
|
isColumnLength: [ |
|
|
{ validator: checkMaxLength, trigger: 'blur' } |
|
|
{ validator: checkMaxLength, trigger: 'blur' } |
|
|
|
|
|
], |
|
|
|
|
|
editLength: [ |
|
|
|
|
|
{ validator: checkEditLength, trigger: 'blur' } |
|
|
|
|
|
], |
|
|
|
|
|
dictionaryConfigId: [ |
|
|
|
|
|
{ validator: checkDictionaryConfigId, trigger: 'blur' } |
|
|
|
|
|
], |
|
|
|
|
|
fillingDigit: [ |
|
|
|
|
|
{ validator: checkFillingDigit, trigger: 'blur' } |
|
|
] |
|
|
] |
|
|
} |
|
|
} |
|
|
if (this.isDisabled) { |
|
|
if (this.isDisabled) { |
|
@ -300,27 +333,27 @@ export default { |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
submitForm(formName) { |
|
|
submitForm(formName) { |
|
|
// 对应字典必填判断 |
|
|
|
|
|
if (this.form.isInputClass === 'select' || this.form.isInputClass === 'popover') { |
|
|
|
|
|
if (!this.form.dictionaryConfigId.id) { |
|
|
|
|
|
this.$message.error('对应字典项不可为空!') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
// 选择'自动补零',位数必填 |
|
|
|
|
|
if (this.form.isFilling) { |
|
|
|
|
|
if (!this.form.fillingDigit) { |
|
|
|
|
|
this.$message.error('请填写位数!') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
// 显示长度限制 |
|
|
|
|
|
if (this.form.editLength) { |
|
|
|
|
|
if (this.form.editLength > 510) { |
|
|
|
|
|
this.$message.error('显示长度最大510') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// // 对应字典必填判断 |
|
|
|
|
|
// if (this.form.isInputClass === 'select' || this.form.isInputClass === 'popover') { |
|
|
|
|
|
// if (!this.form.dictionaryConfigId.id) { |
|
|
|
|
|
// this.$message.error('对应字典项不可为空!') |
|
|
|
|
|
// return |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// // 选择'自动补零',位数必填 |
|
|
|
|
|
// if (this.form.isFilling) { |
|
|
|
|
|
// if (!this.form.fillingDigit) { |
|
|
|
|
|
// this.$message.error('请填写位数!') |
|
|
|
|
|
// return |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// // 显示长度限制 |
|
|
|
|
|
// if (this.form.editLength) { |
|
|
|
|
|
// if (this.form.editLength > 510) { |
|
|
|
|
|
// this.$message.error('显示长度最大510') |
|
|
|
|
|
// return |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
this.$refs[formName].validate((valid) => { |
|
|
this.$refs[formName].validate((valid) => { |
|
|
if (valid) { |
|
|
if (valid) { |
|
|
alert('submit!') |
|
|
alert('submit!') |
|
|