update addform回显问题
This commit is contained in:
@@ -210,13 +210,13 @@
|
||||
</div>
|
||||
<a-form-model-item class="item-model" :prop="item.dbFieldName">
|
||||
<a-tree-select
|
||||
tree-node-filter-prop="title"
|
||||
v-model="formInline[item.dbFieldName]"
|
||||
:getPopupContainer="triggerNode=> triggerNode.parentNode"
|
||||
style="width: 100%"
|
||||
:tree-data="optionsData[item.dbFieldName]"
|
||||
tree-checkable
|
||||
treeCheckStrictly
|
||||
:label-in-value="false"
|
||||
:placeholder="$t('pleaseSelect')+item.dbFieldTxt"
|
||||
/>
|
||||
</a-form-model-item>
|
||||
@@ -234,11 +234,29 @@
|
||||
v-model="formInline[item.dbFieldName]"
|
||||
:default-value="defaultValue[item.dbFieldName]"
|
||||
date-format="YYYY"
|
||||
:placeholder="$t('pleaseSelect')+item.dbFieldTxt"/>
|
||||
:placeholder="$t('pleaseSelect')+item.dbFieldTxt" />
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
</a-col>
|
||||
<!-- 15, 树选择(单选) -->
|
||||
<a-col :span="12" v-else-if="item.fieldShowType === FieldType.TREE_SINGLE.value">
|
||||
<div class="box-title-text" :title="item.dbFieldTxt">
|
||||
<div class="title-text">
|
||||
<span class="required" v-if="item.fieldMustInput === '1'">*</span>
|
||||
<span class="title-text-text">{{ item.dbFieldTxt }}</span>
|
||||
</div>
|
||||
<a-form-model-item class="item-model" :prop="item.dbFieldName">
|
||||
<a-tree-select
|
||||
v-model="formInline[item.dbFieldName]"
|
||||
:getPopupContainer="triggerNode=> triggerNode.parentNode"
|
||||
style="width: 100%"
|
||||
:tree-data="optionsData[item.dbFieldName]"
|
||||
:label-in-value="false"
|
||||
:placeholder="$t('pleaseSelect')+item.dbFieldTxt"
|
||||
/>
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
</a-col>
|
||||
|
||||
</div>
|
||||
</a-row>
|
||||
</div>
|
||||
@@ -358,7 +376,22 @@ export default {
|
||||
}
|
||||
this.getDocumentInfoFunc({ id: item.id }).then((res) => {
|
||||
if (res.success) {
|
||||
// 处理树结构多选回显
|
||||
const formList = Object.values(this.dataList).reduce((acc, cur) => acc.concat(cur), [])
|
||||
const treeMultipleField = formList.filter(tt => tt.fieldShowType === FieldType.TREE.value)
|
||||
this.formInline = res.result
|
||||
treeMultipleField.forEach(field => {
|
||||
const valueArr = []
|
||||
if (this.formInline[field.dbFieldName]) {
|
||||
const values = this.formInline[field.dbFieldName].split(',')
|
||||
for (let i = 0; i < values.length; i++) {
|
||||
valueArr[i] = {
|
||||
value: values[i]
|
||||
}
|
||||
}
|
||||
this.formInline[field.dbFieldName] = valueArr
|
||||
}
|
||||
})
|
||||
this.loading = false
|
||||
} else {
|
||||
this.loading = false
|
||||
@@ -381,7 +414,6 @@ export default {
|
||||
this.dataList = res.result
|
||||
this.ruleList = res.result
|
||||
this.integrateData()
|
||||
console.log(JSON.parse(JSON.stringify(this.dataList)))
|
||||
this.getOptionsData() // 获取下拉数据
|
||||
callBack && callBack()
|
||||
}
|
||||
@@ -391,7 +423,6 @@ export default {
|
||||
integrateData () {
|
||||
this.isFormInline = false
|
||||
const ruleList = []
|
||||
console.log(this.ruleList)
|
||||
for (const item in this.ruleList) {
|
||||
this.ruleList[item].forEach(ol => {
|
||||
ruleList.push(ol)
|
||||
@@ -429,19 +460,21 @@ export default {
|
||||
getOptionsData () {
|
||||
const formList = Object.values(this.dataList).reduce((acc, cur) => acc.concat(cur), [])
|
||||
formList.forEach(item => {
|
||||
// 展示类型是树选择,且有接口的
|
||||
if (item.fieldShowType === FieldType.TREE.value && item.fieldHref) {
|
||||
getAction(item.fieldHref).then(res => {
|
||||
if (res.success) {
|
||||
this.$set(this.optionsData, item.dbFieldName, res.result)
|
||||
}
|
||||
})
|
||||
} else if (item.fieldShowType === FieldType.TREE.value && item.dictId) {
|
||||
getFormDictTreeList({ dictId: item.dictId }).then(res => {
|
||||
if (res.success) {
|
||||
this.$set(this.optionsData, item.dbFieldName, res.result)
|
||||
}
|
||||
})
|
||||
if (item.fieldShowType === FieldType.TREE.value || item.fieldShowType === FieldType.TREE_SINGLE.value) {
|
||||
// 展示类型是树选择,且有接口的
|
||||
if (item.fieldHref) {
|
||||
getAction(item.fieldHref).then(res => {
|
||||
if (res.success) {
|
||||
this.$set(this.optionsData, item.dbFieldName, res.result)
|
||||
}
|
||||
})
|
||||
} else if (item.dictId) {
|
||||
getFormDictTreeList({ dictId: item.dictId }).then(res => {
|
||||
if (res.success) {
|
||||
this.$set(this.optionsData, item.dbFieldName, res.result)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user