|
|
|
@ -1197,7 +1197,18 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
this.$set(this.rules, item.fieldName, [{ |
|
|
|
const existingRules = this.rules[item.fieldName] || [] |
|
|
|
const newRules = [] |
|
|
|
|
|
|
|
if (item.isRequired) { |
|
|
|
newRules.push({ |
|
|
|
required: true, |
|
|
|
message: `请输入${item.fieldCnName}`, |
|
|
|
trigger: 'blur' |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
newRules.push({ |
|
|
|
validator: async(rule, value, callback) => { |
|
|
|
const errorMessage = await validateRepeat(value) |
|
|
|
if (errorMessage) { |
|
|
|
@ -1207,7 +1218,9 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
trigger: 'blur' |
|
|
|
}]) |
|
|
|
}) |
|
|
|
|
|
|
|
this.$set(this.rules, item.fieldName, [...existingRules.filter(r => !r.required && !r.validator), ...newRules]) |
|
|
|
}, |
|
|
|
async isRepeatHandle(item) { |
|
|
|
// 记录最后修改的字段名 |
|
|
|
@ -1461,6 +1474,7 @@ export default { |
|
|
|
this.rules = {} |
|
|
|
console.log('this.formPreviewData', this.formPreviewData) |
|
|
|
this.entityIndex = this.formPreviewData.findIndex(item => item.fieldName === 'is_entity') |
|
|
|
|
|
|
|
this.formPreviewData.map(item => { |
|
|
|
if (item.isInputClass === 'select') { |
|
|
|
this.$set(item, 'options', []) |
|
|
|
@ -1509,7 +1523,7 @@ export default { |
|
|
|
const rule = { |
|
|
|
required: !!item.isRequired, |
|
|
|
message: ((item.isInputClass === 'text' || item.isInputClass === 'textarea') ? '请输入' : '请选择') + item.fieldCnName, |
|
|
|
trigger: item.isInputClass === 'text' ? 'blur' : 'change' |
|
|
|
trigger: (item.isInputClass === 'text' || item.isInputClass === 'textarea' || item.isInputClass === 'number') ? 'blur' : 'change' |
|
|
|
} |
|
|
|
|
|
|
|
// 处理除 archive_year 外的字段最大长度验证 |
|
|
|
@ -1580,7 +1594,6 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (item.fieldName === 'doc_qty' || item.fieldName === 'doc_qty_now') { |
|
|
|
rule.validator = (rule, value, callback) => { |
|
|
|
// 无实体时不能 > 0 |
|
|
|
|