diff --git a/src/views/documentTool/documentSplit/modules/SplitAddForm.vue b/src/views/documentTool/documentSplit/modules/SplitAddForm.vue index dfb60733..b85ec1e0 100644 --- a/src/views/documentTool/documentSplit/modules/SplitAddForm.vue +++ b/src/views/documentTool/documentSplit/modules/SplitAddForm.vue @@ -172,17 +172,25 @@
- + - +
{{ $t('newlyAdded') }} - {{ $t('edit') }} + {{ + $t('edit') + }} + {{ $t('delete') }}
@@ -382,62 +390,47 @@ export default { */ integrateData () { this.isFormInline = false + const ruleList = JSON.parse(JSON.stringify(this.ruleList)) + console.log(this.ruleList) const rules = {} - this.ruleList.forEach((res, index) => { + ruleList.forEach((res, index) => { const rule = [] - if (res.field_must_input === 1) { - if (res.field_show_type === '1') { + if (res.fieldMustInput === '1') { + if ([FieldType.TEXT_BOX.value, FieldType.TEXTAREA.value].includes(res.fieldShowType)) { rule.push({ required: true, - message: res.db_field_txt + this.$t('cannotEmpty'), + message: res.dbFieldTxt + this.$t('cannotEmpty'), trigger: 'blur' }) - } else if (res.field_show_type === '4' || res.field_show_type === '6' || - res.field_show_type === '5' || res.field_show_type === '7' - ) { + } else { rule.push({ required: true, - message: res.db_field_txt + this.$t('cannotEmpty'), + message: res.dbFieldTxt + this.$t('cannotEmpty'), trigger: 'change' }) - } else if (res.field_show_type === '2') { + } + } else { + if ([FieldType.TEXT_BOX.value, FieldType.TEXTAREA.value].includes(res.fieldShowType)) { rule.push({ - required: true, - message: res.db_field_txt + this.$t('cannotEmpty'), + required: false, + message: res.dbFieldTxt + this.$t('cannotEmpty'), trigger: 'blur' }) - } else if (res.field_show_type === '8' || res.field_show_type === '9' || res.field_show_type === '10' || res.field_show_type === '11') { + } else { rule.push({ - required: true, - message: res.db_field_txt + this.$t('cannotEmpty'), - trigger: 'blur' - }) - } else if (res.field_show_type === '3') { - rule.push({ - required: true, - message: res.db_field_txt + this.$t('cannotEmpty'), + required: false, + message: res.dbFieldTxt + this.$t('cannotEmpty'), trigger: 'change' }) } } - if (res.field_show_type === '1' || - res.field_show_type === '8' || res.field_show_type === '9' || res.field_show_type === '10' || - res.field_show_type === '11') { - rule.push({ - max: res.db_length, - message: res.db_field_txt + this.$t('cantExeed') + res.db_length + this.$t('characters'), - trigger: 'blur' - }) - } if (rule.length > 0) { - rules[res.db_field_name] = rule + rules[res.dbFieldName] = rule } }) - this.$set(this, 'rules', rules) - // console.log('rules',this.rules) + this.rules = rules this.isFormInline = true this.loading = false - // console.log('this.column',this.column) }, /** * 获取表单信息 @@ -475,7 +468,7 @@ export default { if (!data.interpretation_articles) { data.interpretation_articles = '' } - this.formInline = Object.assign({}, {...data}) + this.formInline = Object.assign({}, { ...data }) } }) }, @@ -564,8 +557,8 @@ export default { }, // 点击点击上传按钮 clickButtonToUpload (item) { - this.$refs.uploadFile.open(this.formInline[item.db_field_name]) - this.uploadName = item.db_field_name + this.$refs.uploadFile.open(this.formInline[item.dbFieldName]) + this.uploadName = item.dbFieldName }, // 文件上传改变后的回调 uploadFileChange (data) { @@ -697,7 +690,7 @@ export default { } }) }, - updateDom() { + updateDom () { this.$forceUpdate() } }