From d278b2194cfecc215023ad710a46872ba5f0b27c Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 13 Oct 2022 18:54:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=90=8E=E7=AB=AF=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=89=80=E9=9C=80=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assignedScene/add-update-scene.vue | 18 ++++++++++- .../ability/components/combine-ability.vue | 30 ++++++++++++++----- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/back/src/views/modules/ability/assignedScene/add-update-scene.vue b/back/src/views/modules/ability/assignedScene/add-update-scene.vue index 9f121c0e..3e01307e 100644 --- a/back/src/views/modules/ability/assignedScene/add-update-scene.vue +++ b/back/src/views/modules/ability/assignedScene/add-update-scene.vue @@ -163,12 +163,26 @@ export const modalTypeText = { } export const getFuseResourceList = (abilityListObj) => { + debugger const arr = [] let length = 0 for (const key in abilityListObj) { if (Object.hasOwnProperty.call(abilityListObj, key)) { const itemArray = abilityListObj[key] - itemArray.map((v, i) => { + debugger + if(key=='数据资源'){ + itemArray.map((v, i) => { + const index = (i + 1) + length + arr.push({ + resourceId: v.id, + type: key, + sequence: index, + resourceName:v.resourceName, + deptName:v.deptName, + }) + }) + }else{ + itemArray.map((v, i) => { const index = (i + 1) + length arr.push({ resourceId: v, @@ -176,6 +190,8 @@ export const getFuseResourceList = (abilityListObj) => { sequence: index }) }) + } + length = itemArray.length } } diff --git a/back/src/views/modules/ability/components/combine-ability.vue b/back/src/views/modules/ability/components/combine-ability.vue index dc6faeca..c35979c9 100644 --- a/back/src/views/modules/ability/components/combine-ability.vue +++ b/back/src/views/modules/ability/components/combine-ability.vue @@ -20,7 +20,8 @@ :titles="nameArray" :props="{ key: 'id', label: 'name', - }" :data="transferData"> + }" :data="transferData" + @change="handleChange"> v.type == this.type) + const attrValue = dataForm.fuseResourceList.filter(v => v.type == this.type); + console.log('attrValue',attrValue); if (attrValue.length > 0) { attrValue.map(val => { const _obj = { type: val.type, id: val.resourceId, - name: val.resource && val.resource.name + name: val.resource && val.resource.resourceName, } arr.push(_obj) }) } - // 展示 - this.displayList = JSON.parse(JSON.stringify(arr)) + this.displayList = JSON.parse(JSON.stringify(arr)); // 已选中 this.selectedArray = arr.map(v => v.id) this.$nextTick(() => { @@ -288,7 +289,9 @@ export default { this.transferData.push({ type: this.type, id: v.guid, - name: v.zyname || '--' + name: v.zyname || '--', + deptName:v.TGBM, +              resourceName:v.zyname }) }) this.allData = JSON.parse(JSON.stringify(this.transferData)) @@ -302,6 +305,16 @@ export default { return item.name && item.name.indexOf(query) > -1 }, confirmSubmitHandle () { + console.log('lllooooo',this.selectedArray); + //通过选中的数据去查找原始列表数据 + let selectedObjectList = []; + this.selectedArray.forEach((item)=>{ + let filterData = []; + filterData = this.allData.filter(v => v.id == item); + //console.log('filterDatafilterData',filterData); + selectedObjectList.push(filterData[0]); + }); + console.log('selectedObjectListselectedObjectList',selectedObjectList); if (this.selectedArray.length > this.maxNum) { return this.$message.error('最多选择十条数据!') } @@ -314,10 +327,13 @@ export default { }) this.$emit('update', { title: this.type, - list: this.selectedArray + list: selectedObjectList }) console.log(this.selectedArray, this.displayList, 'this.displayList') }, + handleChange(){ + console.log('222222',this.selectedArray); + }, getDisplay (displayList) { this.displayList = [] this.displayList = displayList