From 4132ea058924aa0df387d6373ca9a483ecee22f8 Mon Sep 17 00:00:00 2001 From: guoyue Date: Fri, 15 Jul 2022 16:43:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=9E=8D=E5=90=88=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ability/IntegratedServices-add.vue | 55 ++++--- .../modules/ability/IntegratedServices.vue | 81 +++------- .../ability/components/common-question.vue | 43 ++---- .../components/integrated-combine-ability.vue | 142 +++++++++++------- 4 files changed, 144 insertions(+), 177 deletions(-) diff --git a/back/src/views/modules/ability/IntegratedServices-add.vue b/back/src/views/modules/ability/IntegratedServices-add.vue index fc960d21..9df71299 100644 --- a/back/src/views/modules/ability/IntegratedServices-add.vue +++ b/back/src/views/modules/ability/IntegratedServices-add.vue @@ -2,7 +2,7 @@
-
填写字段
- {{ item.name }} @@ -21,7 +21,7 @@ -
+
- +
+
+ -
+
- +
+
@@ -138,6 +140,7 @@ import qs from "qs"; import CommonQuestion from './components/common-question.vue'; import IntegratedCombineAbility from './components/integrated-combine-ability.vue'; import Cookies from 'js-cookie' +import { tableColumns } from './IntegratedServices.vue'; export default { components: { @@ -158,7 +161,7 @@ export default { }, { "attrType": "常见问题", - "attrValue": [{ question: "", answer: "" }], + "attrValue": '[{ question: "", answer: "" }]', } ], "fuseResourceList": [ @@ -172,11 +175,8 @@ export default { "provider": "", "providerMobile": "", "providerUser": "", - // "updateDate": "", - // "updater": 0, - // "createDate": "", - // "creator": 0, "deptUser": "", + type: '融合服务' }, rules: { name: [ @@ -220,16 +220,7 @@ export default { areaList: [], fileNameList: [], addOrUpdateVisibleCopy: this.addOrUpdateVisible, - displayInfo: { - 'name': '融合服务名称', - 'description': '融合服务描述', - 'applicationArea': '应用领域', - 'deptUser': '部门联系人', - 'mobile': '部门联系人电话', - 'provider': '服务商', - 'providerMobile': '服务商联系人', - 'providerMobile': '服务商联系人电话', - }, + displayInfo: tableColumns, displayListInfo: { '常见问题': [], '组合能力': [] @@ -257,9 +248,12 @@ export default { addOrUpdateVisible: { handler(newVal) { this.addOrUpdateVisibleCopy = newVal; + if (this.modalType == 'add' && newVal) { + this.getDetail(this.dataForm) + } }, immediate: true, - } + }, }, mounted() { // 获取应用领域 @@ -365,21 +359,24 @@ export default { getDetail(data) { this.dataForm = data; this.$nextTick(() => { + this.$refs.combineAbility && this.$refs.combineAbility.getDataInfo(data) + this.$refs.commonQuestion && this.$refs.commonQuestion.getDataInfo(data) console.log('this.dataForm----详情-------->', this.dataForm); }) }, // 重组数据 getDisPlayData() { this.$nextTick(() => { - console.log('this.dataForm----重组数据-------->', this.dataForm); const questionObj = this.dataForm.fuseAttrList.find(v => v.attrType == '常见问题') || {}; let fuseResourceList = this.dataForm.fuseResourceList || []; let arr = [] fuseResourceList.map(v => { - arr.push({ - name: v.resource.name, - type: v.resource.type, - }) + if (v.resource) { + arr.push({ + name: v.resource.name, + type: v.resource.type, + }) + } }) this.displayListInfo['常见问题'] = JSON.parse(questionObj.attrValue || '[]') this.displayListInfo['组合能力'] = arr diff --git a/back/src/views/modules/ability/IntegratedServices.vue b/back/src/views/modules/ability/IntegratedServices.vue index 16972066..ae494b97 100644 --- a/back/src/views/modules/ability/IntegratedServices.vue +++ b/back/src/views/modules/ability/IntegratedServices.vue @@ -21,25 +21,8 @@ - - - - - - - - - - - - - - - - - - - + @@ -71,20 +52,28 @@ diff --git a/back/src/views/modules/ability/components/common-question.vue b/back/src/views/modules/ability/components/common-question.vue index 5af00854..0ab78cb3 100644 --- a/back/src/views/modules/ability/components/common-question.vue +++ b/back/src/views/modules/ability/components/common-question.vue @@ -8,8 +8,10 @@ - - 删除 + + + 删除 v.attrType === '常见问题') || {} - console.log('obj-------常见问题----->', obj); - let attrValue = JSON.parse(obj.attrValue) - - if (attrValue.length > 0) { - attrValue.map(v => { - arr.push({ - question: v.question, - answer: v.answer, + if (dataForm && (dataForm.id || dataForm.id === 0)) { + let fuseAttrList = dataForm.fuseAttrList || []; + let obj = fuseAttrList.find(v => v.attrType === '常见问题') || {} + let attrValue = JSON.parse(obj.attrValue || "[]") + if (attrValue.length > 0) { + attrValue.map(v => { + arr.push({ + question: v.question, + answer: v.answer, + }) }) - }) + } } else { arr = [] arr.push({ @@ -95,8 +86,6 @@ export default { \ No newline at end of file