update 树形通过接口获取数据
This commit is contained in:
@@ -38,11 +38,11 @@
|
||||
:nameStr="formInline[item.dbFieldName + '_name']"
|
||||
type="radio"
|
||||
:disabled="disabled" />
|
||||
<!-- <user-or-organ-selection :placeholder="$t('pleaseSelect')+item.dbFieldTxt"-->
|
||||
<!-- v-model="formInline[item.dbFieldName]"-->
|
||||
<!-- type="radio"-->
|
||||
<!-- selectType="user"-->
|
||||
<!-- :disabled="disabled" />-->
|
||||
<!-- <user-or-organ-selection :placeholder="$t('pleaseSelect')+item.dbFieldTxt"-->
|
||||
<!-- v-model="formInline[item.dbFieldName]"-->
|
||||
<!-- type="radio"-->
|
||||
<!-- selectType="user"-->
|
||||
<!-- :disabled="disabled" />-->
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
</a-col>
|
||||
@@ -56,12 +56,13 @@
|
||||
<a-form-model-item class="item-model" :prop="item.dbFieldName">
|
||||
<j-select-depart
|
||||
v-model="formInline[item.dbFieldName]"
|
||||
:backDepart="true">></j-select-depart>
|
||||
<!-- <user-or-organ-selection :placeholder="$t('pleaseSelect')+item.dbFieldTxt"-->
|
||||
<!-- v-model="formInline[item.dbFieldName]"-->
|
||||
<!-- selectType="organ"-->
|
||||
<!-- type="radio"-->
|
||||
<!-- :disabled="disabled" />-->
|
||||
:backDepart="true">>
|
||||
</j-select-depart>
|
||||
<!-- <user-or-organ-selection :placeholder="$t('pleaseSelect')+item.dbFieldTxt"-->
|
||||
<!-- v-model="formInline[item.dbFieldName]"-->
|
||||
<!-- selectType="organ"-->
|
||||
<!-- type="radio"-->
|
||||
<!-- :disabled="disabled" />-->
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
</a-col>
|
||||
@@ -74,7 +75,7 @@
|
||||
</div>
|
||||
<a-form-model-item class="item-model" :prop="item.dbFieldName">
|
||||
<j-multiple-date-picker class="box-input" v-model="formInline[item.dbFieldName]" :fieldName="item.dbFieldName"
|
||||
:disabled="disabled"/>
|
||||
:disabled="disabled" />
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
</a-col>
|
||||
@@ -122,12 +123,13 @@
|
||||
v-model="formInline[item.dbFieldName]"
|
||||
:multi="true"
|
||||
:backDepart="true"
|
||||
:treeOpera="true">></j-select-depart>
|
||||
<!-- <user-or-organ-selection :placeholder="$t('pleaseSelect')+item.dbFieldTxt"-->
|
||||
<!-- v-model="formInline[item.dbFieldName]"-->
|
||||
<!-- selectType="organ"-->
|
||||
<!-- type="checkbox"-->
|
||||
<!-- :disabled="disabled" />-->
|
||||
:treeOpera="true">>
|
||||
</j-select-depart>
|
||||
<!-- <user-or-organ-selection :placeholder="$t('pleaseSelect')+item.dbFieldTxt"-->
|
||||
<!-- v-model="formInline[item.dbFieldName]"-->
|
||||
<!-- selectType="organ"-->
|
||||
<!-- type="checkbox"-->
|
||||
<!-- :disabled="disabled" />-->
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
</a-col>
|
||||
@@ -204,17 +206,17 @@
|
||||
<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>
|
||||
<span class="title-text-text">{{ item.dbFieldTxt }}</span>
|
||||
</div>
|
||||
<a-form-model-item class="item-model" :prop="item.dbFieldName">
|
||||
<a-tree-select
|
||||
tree-node-filter-prop="title"
|
||||
v-model="formInline[item.dbFieldName]"
|
||||
:maxTagCount="1"
|
||||
:getPopupContainer="triggerNode=> triggerNode.parentNode"
|
||||
style="width: 100%"
|
||||
:tree-data="item.tree"
|
||||
:tree-data="optionsData[item.dbFieldName]"
|
||||
tree-checkable
|
||||
treeCheckStrictly
|
||||
:placeholder="$t('pleaseSelect')+item.dbFieldTxt"
|
||||
/>
|
||||
</a-form-model-item>
|
||||
@@ -234,15 +236,15 @@ import JMultiSelectTag from '../dict/JMultiSelectTag'
|
||||
import UploadFile from '../UploadFile'
|
||||
// 选择标准选择器
|
||||
import StandardSelection from '../selection/StandardSelection'
|
||||
// 选择用户或组织机构
|
||||
import UserOrOrganSelection from '../selection/UserOrOrganSelection'
|
||||
import { FieldType } from '../../enums/commonEnums'
|
||||
import JMultipleDatePicker from '../JMultipleDatePicker'
|
||||
import UserSelection from '../selection/UserSelection'
|
||||
import { getAction } from '../../api/manage.js'
|
||||
import { getDictTreeList } from '../../api/api.js'
|
||||
|
||||
export default {
|
||||
name: 'AddForm',
|
||||
components: { UserSelection, JMultipleDatePicker, StandardSelection, JDictSelectTag, JMultiSelectTag, UploadFile, UserOrOrganSelection },
|
||||
components: { UserSelection, JMultipleDatePicker, StandardSelection, JDictSelectTag, JMultiSelectTag, UploadFile },
|
||||
props: {
|
||||
url: {
|
||||
type: Object,
|
||||
@@ -294,7 +296,8 @@ export default {
|
||||
type: 'add',
|
||||
dataList: [],
|
||||
ruleList: [],
|
||||
uploadName: ''
|
||||
uploadName: '',
|
||||
optionsData: {} // 用接口获取到的下拉数据
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -302,80 +305,6 @@ export default {
|
||||
this.formInline = {}
|
||||
this.type = 'add'
|
||||
this.getForm()
|
||||
// this.dataList = [
|
||||
// {
|
||||
// 基本信息: [
|
||||
// {
|
||||
// area: '基本信息',
|
||||
// dbFieldName: 'serial_number',
|
||||
// dbFieldTxt: '编号',
|
||||
// db_length: 200,
|
||||
// dict_field: '',
|
||||
// fieldMustInput: '1',
|
||||
// fieldShowType: '1',
|
||||
// tree: []
|
||||
// },
|
||||
// {
|
||||
// area: '基本信息',
|
||||
// dbFieldName: 'state',
|
||||
// dbFieldTxt: '状态',
|
||||
// db_length: 36,
|
||||
// dict_field: 'state',
|
||||
// fieldMustInput: '1',
|
||||
// fieldShowType: '3',
|
||||
// tree: []
|
||||
// },
|
||||
// {
|
||||
// area: '基本信息',
|
||||
// dbFieldName: 'standard_system',
|
||||
// dbFieldTxt: '标准体系',
|
||||
// db_length: 100,
|
||||
// dict_field: 'standard_system',
|
||||
// fieldMustInput: '0',
|
||||
// fieldShowType: '3',
|
||||
// tree: []
|
||||
// },
|
||||
// {
|
||||
// area: '基本信息',
|
||||
// dbFieldName: 'corresponding_standard',
|
||||
// dbFieldTxt: '对应标准',
|
||||
// db_length: 200,
|
||||
// dict_field: '',
|
||||
// fieldMustInput: '0',
|
||||
// fieldShowType: '10',
|
||||
// tree: []
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// 文本信息: [
|
||||
// {
|
||||
// area: '文本信息',
|
||||
// dbFieldName: 'release_draft',
|
||||
// dbFieldTxt: '发言稿(必读)',
|
||||
// db_length: 3000,
|
||||
// dict_field: '',
|
||||
// fieldMustInput: '0',
|
||||
// fieldShowType: '7',
|
||||
// flag: 1,
|
||||
// tree: []
|
||||
// },
|
||||
// {
|
||||
// area: '文本信息',
|
||||
// dbFieldName: 'release_draft',
|
||||
// dbFieldTxt: '发言稿(必读)',
|
||||
// db_length: 3000,
|
||||
// dict_field: '',
|
||||
// fieldMustInput: '0',
|
||||
// fieldShowType: '7',
|
||||
// flag: 1,
|
||||
// tree: []
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
// ]
|
||||
// this.ruleList = this.dataList
|
||||
// this.integrateData()
|
||||
},
|
||||
edit (item) {
|
||||
this.type = 'edit'
|
||||
@@ -387,7 +316,7 @@ export default {
|
||||
}
|
||||
this.getDocumentInfoFunc({ id: item.id }).then((res) => {
|
||||
if (res.success) {
|
||||
this.formInline = res.result[0]
|
||||
this.formInline = res.result
|
||||
this.loading = false
|
||||
} else {
|
||||
this.loading = false
|
||||
@@ -410,6 +339,8 @@ export default {
|
||||
this.dataList = res.result
|
||||
this.ruleList = res.result
|
||||
this.integrateData()
|
||||
console.log(JSON.parse(JSON.stringify(this.dataList)))
|
||||
this.getOptionsData() // 获取下拉数据
|
||||
callBack && callBack()
|
||||
}
|
||||
})
|
||||
@@ -470,6 +401,29 @@ export default {
|
||||
this.isFormInline = true
|
||||
this.confirmLoading = false
|
||||
},
|
||||
/**
|
||||
* 处理需要通过接口获取的下拉数据
|
||||
*/
|
||||
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)
|
||||
}
|
||||
})
|
||||
}
|
||||
if (item.fieldShowType === FieldType.TREE.value && item.dictId) {
|
||||
getDictTreeList({ dictId: item.dictId }).then(res => {
|
||||
if (res.success) {
|
||||
this.$set(this.optionsData, item.dbFieldName, res.result)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 点击点击上传按钮
|
||||
clickButtonToUpload (item) {
|
||||
this.$refs.uploadFile.open(this.formInline[item.dbFieldName])
|
||||
|
||||
Reference in New Issue
Block a user