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 3e20ad3d..30afbbc0 100644 --- a/back/src/views/modules/ability/assignedScene/add-update-scene.vue +++ b/back/src/views/modules/ability/assignedScene/add-update-scene.vue @@ -163,15 +163,14 @@ export const modalTypeText = { } export const getFuseResourceList = (abilityListObj) => { - debugger + console.log('abilityListObjabilityListObj',abilityListObj); const arr = [] let length = 0 for (const key in abilityListObj) { if (Object.hasOwnProperty.call(abilityListObj, key)) { const itemArray = abilityListObj[key] - debugger if(key=='数据资源'){ - itemArray.map((v, i) => { + itemArray.map((v, i) => { const index = (i + 1) + length arr.push({ resourceId: v.id, @@ -332,6 +331,7 @@ export default { }, // 更新表单 updateDataForm (data) { + console.log('datadatadata',data); if (Object.keys(this.getListParams).includes(data.title)) { this.abilityListObj[data.title] = data.list } else { @@ -420,11 +420,15 @@ export default { // 组合能力--特殊处理 Object.keys(this.getListParams).map(k => { - const arr = data.fuseResourceList.filter(v => v.type == k) - const arr2 = [] + let arr = data.fuseResourceList.filter(v => v.type == k) + let arr2 = []; + if(k === "数据资源"){ + arr2 = JSON.parse(JSON.stringify(arr)); + }else{ arr.map(v => { arr2.push(v.resourceId) }) + } this.abilityListObj[k] = arr2 }) }) diff --git a/back/src/views/modules/ability/components/combine-ability.vue b/back/src/views/modules/ability/components/combine-ability.vue index c35979c9..a17660eb 100644 --- a/back/src/views/modules/ability/components/combine-ability.vue +++ b/back/src/views/modules/ability/components/combine-ability.vue @@ -227,15 +227,24 @@ export default { await this.getData() const arr = [] const attrValue = dataForm.fuseResourceList.filter(v => v.type == this.type); - console.log('attrValue',attrValue); + console.log('attrValue22',attrValue); if (attrValue.length > 0) { attrValue.map(val => { - const _obj = { + if(val.type==="数据资源"){ + const _obj = { type: val.type, id: val.resourceId, name: val.resource && val.resource.resourceName, } arr.push(_obj) + }else{ + const _obj = { + type: val.type, + id: val.resourceId, + name: val.resource && val.resource.name, + } + arr.push(_obj) + } }) } // 展示 @@ -305,8 +314,9 @@ export default { return item.name && item.name.indexOf(query) > -1 }, confirmSubmitHandle () { - console.log('lllooooo',this.selectedArray); - //通过选中的数据去查找原始列表数据 + debugger + if(this.type === "数据资源"){ + //通过选中的数据去查找原始列表数据 let selectedObjectList = []; this.selectedArray.forEach((item)=>{ let filterData = []; @@ -314,7 +324,16 @@ export default { //console.log('filterDatafilterData',filterData); selectedObjectList.push(filterData[0]); }); - console.log('selectedObjectListselectedObjectList',selectedObjectList); + this.$emit('update', { + title: this.type, + list: selectedObjectList + }) + }else{ + this.$emit('update', { + title: this.type, + list: this.selectedArray + }) + } if (this.selectedArray.length > this.maxNum) { return this.$message.error('最多选择十条数据!') } @@ -325,14 +344,10 @@ export default { this.displayList.push(v) } }) - this.$emit('update', { - title: this.type, - list: selectedObjectList - }) console.log(this.selectedArray, this.displayList, 'this.displayList') }, handleChange(){ - console.log('222222',this.selectedArray); + //console.log('222222',this.selectedArray); }, getDisplay (displayList) { this.displayList = []