组件服务修改

This commit is contained in:
unknown 2022-10-13 20:11:01 +08:00
parent eb563cd3dd
commit 5ec0d81181
2 changed files with 34 additions and 15 deletions

View File

@ -163,13 +163,12 @@ export const modalTypeText = {
} }
export const getFuseResourceList = (abilityListObj) => { export const getFuseResourceList = (abilityListObj) => {
debugger console.log('abilityListObjabilityListObj',abilityListObj);
const arr = [] const arr = []
let length = 0 let length = 0
for (const key in abilityListObj) { for (const key in abilityListObj) {
if (Object.hasOwnProperty.call(abilityListObj, key)) { if (Object.hasOwnProperty.call(abilityListObj, key)) {
const itemArray = abilityListObj[key] const itemArray = abilityListObj[key]
debugger
if(key=='数据资源'){ if(key=='数据资源'){
itemArray.map((v, i) => { itemArray.map((v, i) => {
const index = (i + 1) + length const index = (i + 1) + length
@ -332,6 +331,7 @@ export default {
}, },
// //
updateDataForm (data) { updateDataForm (data) {
console.log('datadatadata',data);
if (Object.keys(this.getListParams).includes(data.title)) { if (Object.keys(this.getListParams).includes(data.title)) {
this.abilityListObj[data.title] = data.list this.abilityListObj[data.title] = data.list
} else { } else {
@ -420,11 +420,15 @@ export default {
// -- // --
Object.keys(this.getListParams).map(k => { Object.keys(this.getListParams).map(k => {
const arr = data.fuseResourceList.filter(v => v.type == k) let arr = data.fuseResourceList.filter(v => v.type == k)
const arr2 = [] let arr2 = [];
if(k === "数据资源"){
arr2 = JSON.parse(JSON.stringify(arr));
}else{
arr.map(v => { arr.map(v => {
arr2.push(v.resourceId) arr2.push(v.resourceId)
}) })
}
this.abilityListObj[k] = arr2 this.abilityListObj[k] = arr2
}) })
}) })

View File

@ -227,15 +227,24 @@ export default {
await this.getData() await this.getData()
const arr = [] const arr = []
const attrValue = dataForm.fuseResourceList.filter(v => v.type == this.type); const attrValue = dataForm.fuseResourceList.filter(v => v.type == this.type);
console.log('attrValue',attrValue); console.log('attrValue22',attrValue);
if (attrValue.length > 0) { if (attrValue.length > 0) {
attrValue.map(val => { attrValue.map(val => {
if(val.type==="数据资源"){
const _obj = { const _obj = {
type: val.type, type: val.type,
id: val.resourceId, id: val.resourceId,
name: val.resource && val.resource.resourceName, name: val.resource && val.resource.resourceName,
} }
arr.push(_obj) arr.push(_obj)
}else{
const _obj = {
type: val.type,
id: val.resourceId,
name: val.resource && val.resource.name,
}
arr.push(_obj)
}
}) })
} }
// //
@ -305,7 +314,8 @@ export default {
return item.name && item.name.indexOf(query) > -1 return item.name && item.name.indexOf(query) > -1
}, },
confirmSubmitHandle () { confirmSubmitHandle () {
console.log('lllooooo',this.selectedArray); debugger
if(this.type === "数据资源"){
// //
let selectedObjectList = []; let selectedObjectList = [];
this.selectedArray.forEach((item)=>{ this.selectedArray.forEach((item)=>{
@ -314,7 +324,16 @@ export default {
//console.log('filterDatafilterData',filterData); //console.log('filterDatafilterData',filterData);
selectedObjectList.push(filterData[0]); 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) { if (this.selectedArray.length > this.maxNum) {
return this.$message.error('最多选择十条数据!') return this.$message.error('最多选择十条数据!')
} }
@ -325,14 +344,10 @@ export default {
this.displayList.push(v) this.displayList.push(v)
} }
}) })
this.$emit('update', {
title: this.type,
list: selectedObjectList
})
console.log(this.selectedArray, this.displayList, 'this.displayList') console.log(this.selectedArray, this.displayList, 'this.displayList')
}, },
handleChange(){ handleChange(){
console.log('222222',this.selectedArray); //console.log('222222',this.selectedArray);
}, },
getDisplay (displayList) { getDisplay (displayList) {
this.displayList = [] this.displayList = []