[update] 新增表单编辑时字典回显问题,标准选择传source,企标详情修改

This commit is contained in:
lideqin
2023-09-19 17:35:16 +08:00
parent 2479b33556
commit 2eafb3a179
5 changed files with 42 additions and 21 deletions
+10 -7
View File
@@ -35,7 +35,7 @@
v-model="formInline[item.dbFieldName]"
:filedName="item.dbFieldName"
@nameChange="userSelectNameChange"
:nameStr="formInline[item.dbFieldName + '_name']"
:nameStr="formInline[item.dbFieldName + '_dictText']"
type="radio"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)" />
<!-- <user-or-organ-selection :placeholder="$t('pleaseSelect')+item.dbFieldTxt"-->
@@ -104,6 +104,7 @@
</div>
<a-form-model-item class="item-model" :prop="item.dbFieldName">
<standard-selection :query="item"
:source="flag"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
:standard="formInline"
@change="standardSelectionChange"
@@ -222,7 +223,7 @@
</a-form-model-item>
</div>
</a-col>
<!--14 年份选择-->
<!-- 14, 年份选择 -->
<a-col :span="12" v-else-if="item.fieldShowType === FieldType.YEAR_PICKER.value">
<div class="box-title-text" :title="item.dbFieldTxt">
<div class="title-text">
@@ -372,7 +373,8 @@ export default {
this.loading = false
return
}
this.getDocumentInfoFunc({ id: item.id }).then((res) => {
// type标识是新增表单还是详情页
this.getDocumentInfoFunc({ id: item.id, type: this.type }).then((res) => {
if (res.success) {
// 处理树结构多选回显
const formList = Object.values(this.dataList).reduce((acc, cur) => acc.concat(cur), [])
@@ -390,6 +392,10 @@ export default {
this.formInline[field.dbFieldName] = valueArr
}
})
const dictField = formList.filter(tt => tt.fieldShowType === FieldType.OPTION_SINGLE.value)
dictField.forEach(field => {
this.formInline[field.dbFieldName] = this.formInline[field.dbFieldName] || null
})
this.loading = false
} else {
this.loading = false
@@ -455,7 +461,6 @@ export default {
rules[res.dbFieldName] = rule
}
})
console.log(rules)
this.rules = rules
this.isFormInline = true
this.confirmLoading = false
@@ -508,7 +513,7 @@ export default {
},
// 选择用户得到用户名
userSelectNameChange (value, fieldName) {
this.formInline[fieldName + '_name'] = value
this.formInline[fieldName + '_dictText'] = value
},
submit () {
this.$refs.ruleForm.validate(valid => {
@@ -539,8 +544,6 @@ export default {
</script>
<style scoped lang="less">
/deep/ .ant-form-item-children {
width: 100%;
display: inline-block;