|
|
@ -13,7 +13,7 @@ |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="字段类型" prop="isDataType"> |
|
|
|
<el-input v-if="isDisabled" v-model="form.isDataType" readonly /> |
|
|
|
<el-input v-if="isDisabled" v-model="form.isDataTypeTxt" readonly /> |
|
|
|
<el-select v-else v-model="form.isDataType" placeholder="" :disabled="!isAdd"> |
|
|
|
<el-option v-for="item in dataTypeOptions" :key="item.value" :label="item.label" :value="item.value" /> |
|
|
|
</el-select> |
|
|
@ -21,7 +21,7 @@ |
|
|
|
|
|
|
|
<el-form-item label="字段长度" prop="isColumnLength"> |
|
|
|
<el-input v-if="isDisabled" v-model="form.isColumnLength" type="number" placeholder="" readonly /> |
|
|
|
<el-input v-else v-model="form.isColumnLength" type="number" placeholder="" :disabled="!isAdd" /> |
|
|
|
<el-input v-else v-model.number="form.isColumnLength" type="number" placeholder="" :disabled="!isAdd" /> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="著录形式" prop="isInputClass"> |
|
|
@ -123,25 +123,8 @@ export default { |
|
|
|
callback(new Error('字段标识只能由字母、字符“_”组成,并且必须以字母开头和结尾')) |
|
|
|
} |
|
|
|
} |
|
|
|
return { |
|
|
|
form: { |
|
|
|
// fieldCnName: '', |
|
|
|
// fieldName: '', |
|
|
|
// isDataType: '', |
|
|
|
// isColumnLength: '', |
|
|
|
// isInputClass: '', |
|
|
|
// sysDictionaryId: '', |
|
|
|
// isInputLength: '', |
|
|
|
// isDefaultValue: '', |
|
|
|
// isFilling: '', |
|
|
|
// isLine: '', |
|
|
|
// isInput: '', |
|
|
|
// isRequired: '', |
|
|
|
// isAutomatic: '', |
|
|
|
// isRepeat: '', |
|
|
|
// fillingDigit: '' |
|
|
|
}, |
|
|
|
rules: { |
|
|
|
var getRules = () => { |
|
|
|
const rules = { |
|
|
|
fieldCnName: [ |
|
|
|
{ required: true, message: '请输入中文名称', trigger: 'blur' } |
|
|
|
], |
|
|
@ -155,7 +138,19 @@ export default { |
|
|
|
isColumnLength: [ |
|
|
|
{ validator: checkMaxLength, trigger: 'blur' } |
|
|
|
] |
|
|
|
} |
|
|
|
if (this.isDisabled) { |
|
|
|
delete rules.isDataType |
|
|
|
} |
|
|
|
return rules |
|
|
|
} |
|
|
|
return { |
|
|
|
form: { |
|
|
|
dictionaryConfigId: { |
|
|
|
id: null |
|
|
|
} |
|
|
|
}, |
|
|
|
rules: getRules(), |
|
|
|
// 字段类型 |
|
|
|
dataTypeOptions: [ |
|
|
|
{ value: 1, label: '字符' }, |
|
|
@ -201,9 +196,9 @@ export default { |
|
|
|
this.form.isAutomatic = !!this.form.isAutomatic |
|
|
|
// 字段类型 |
|
|
|
if (this.form.isDataType === 1) { |
|
|
|
this.form.isDataType = '字符' |
|
|
|
this.form.isDataTypeTxt = '字符' |
|
|
|
} else if (this.form.isDataType === 2) { |
|
|
|
this.form.isDataType = '数字' |
|
|
|
this.form.isDataTypeTxt = '数字' |
|
|
|
} |
|
|
|
// 初始化 - 著录形式 |
|
|
|
switch (this.form.isInputClass) { |
|
|
@ -226,12 +221,14 @@ export default { |
|
|
|
this.form.isInputClassTxt = '文本域' |
|
|
|
break |
|
|
|
} |
|
|
|
if (!this.isDisabled) { |
|
|
|
// 初始化 - 著录形式 - 对应字典 |
|
|
|
if (this.form.isInputClass === 'select' || this.form.isInputClass === 'popover') { |
|
|
|
this.getDictrionaryList() |
|
|
|
} else { |
|
|
|
this.dictionaryData = [] |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
// 获取对应字典list |
|
|
|
getDictrionaryList() { |
|
|
@ -248,7 +245,7 @@ export default { |
|
|
|
this.getDictrionaryList() |
|
|
|
} else { |
|
|
|
this.dictionaryData = [] |
|
|
|
this.form.sysDictionaryId = null |
|
|
|
this.form.dictionaryConfigId.id = null |
|
|
|
} |
|
|
|
// 字段类型为数字型,且默认著录类型为数字框不可更改 |
|
|
|
if (this.form.isDataType === 2) { |
|
|
@ -305,7 +302,7 @@ export default { |
|
|
|
submitForm(formName) { |
|
|
|
// 对应字典必填判断 |
|
|
|
if (this.form.isInputClass === 'select' || this.form.isInputClass === 'popover') { |
|
|
|
if (!this.form.sysDictionaryId) { |
|
|
|
if (!this.form.dictionaryConfigId.id) { |
|
|
|
this.$message.error('对应字典项不可为空!') |
|
|
|
return |
|
|
|
} |
|
|
|