diff --git a/src/components/JMultipleDatePicker.vue b/src/components/JMultipleDatePicker.vue index 12c80916..66f5a7f9 100644 --- a/src/components/JMultipleDatePicker.vue +++ b/src/components/JMultipleDatePicker.vue @@ -38,6 +38,9 @@ export default { this.checkedValue = [] document.getElementById(this.fieldName).children[0].children[0].value = '' this.$emit('change', '') + } else { + this.checkedValue = val.split(',') + document.getElementById(this.fieldName).children[0].children[0].value = val } } }, diff --git a/src/components/customField/AddForm.vue b/src/components/customField/AddForm.vue index b0645966..1666d527 100644 --- a/src/components/customField/AddForm.vue +++ b/src/components/customField/AddForm.vue @@ -210,13 +210,13 @@ @@ -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" /> + + + + + +
+
+ * + {{ item.dbFieldTxt }} +
+ +
- @@ -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) + } + }) + } } }) }, diff --git a/src/components/customField/Search.vue b/src/components/customField/Search.vue index c97aca1d..a6605de2 100644 --- a/src/components/customField/Search.vue +++ b/src/components/customField/Search.vue @@ -1,26 +1,42 @@ - +
{{ !toggleSearchStatus ? $t('open') : $t('putAway') }} - + - {{$t('query')}} - {{$t('reset')}} + {{ $t('query') }} + {{ $t('reset') }}
@@ -220,7 +264,18 @@ export default { }, methods: { searchQuery () { - this.$emit('search', JSON.parse(JSON.stringify(this.queryParam))) + const formInline = JSON.parse(JSON.stringify(this.queryParam)) + Object.keys(formInline).forEach(res => { + if (formInline[res] instanceof Array) { + if (formInline[res][0] instanceof Object) { + // 说明是树选择 + formInline[res] = formInline[res].map(item => item.value).join(',') + } else { + formInline[res] = formInline[res].join(',') + } + } + }) + this.$emit('search', JSON.parse(JSON.stringify(formInline))) eventBus.$emit('searchQuery', JSON.parse(JSON.stringify(this.queryParam))) }, searchReset () { diff --git a/src/enums/commonEnums.js b/src/enums/commonEnums.js index 94473e6e..a63c11da 100644 --- a/src/enums/commonEnums.js +++ b/src/enums/commonEnums.js @@ -19,9 +19,10 @@ export const FieldType = { TEXT_BOX: { text: '文本框', value: '9' }, OPTION_SINGLE: { text: '下拉单选', value: '10' }, OPTION_MORE: { text: '下拉多选', value: '11' }, - TREE: { text: '树形结构', value: '12' }, + TREE: { text: '树形结构(多选)', value: '12' }, TEXT_LINK: { text: '输入框(链接)', value: '13' }, - YEAR_PICKER: { text: '年份选择', value: '14' } + YEAR_PICKER: { text: '年份选择', value: '14' }, + TREE_SINGLE: { text: '树形结构(单选)', value: '15' } } export const TagsTypeEnums = new EsEnums({