添加后端接口所需字段

This commit is contained in:
unknown 2022-10-13 18:54:27 +08:00
parent f4f5292540
commit d278b2194c
2 changed files with 40 additions and 8 deletions

View File

@ -163,12 +163,26 @@ export const modalTypeText = {
} }
export const getFuseResourceList = (abilityListObj) => { export const getFuseResourceList = (abilityListObj) => {
debugger
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]
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 const index = (i + 1) + length
arr.push({ arr.push({
resourceId: v, resourceId: v,
@ -176,6 +190,8 @@ export const getFuseResourceList = (abilityListObj) => {
sequence: index sequence: index
}) })
}) })
}
length = itemArray.length length = itemArray.length
} }
} }

View File

@ -20,7 +20,8 @@
:titles="nameArray" :props="{ :titles="nameArray" :props="{
key: 'id', key: 'id',
label: 'name', label: 'name',
}" :data="transferData"> }" :data="transferData"
@change="handleChange">
</el-transfer> </el-transfer>
<el-input <el-input
v-model="searchValue" v-model="searchValue"
@ -225,20 +226,20 @@ export default {
async getDataInfo (dataForm) { async getDataInfo (dataForm) {
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);
if (attrValue.length > 0) { if (attrValue.length > 0) {
attrValue.map(val => { attrValue.map(val => {
const _obj = { const _obj = {
type: val.type, type: val.type,
id: val.resourceId, id: val.resourceId,
name: val.resource && val.resource.name name: val.resource && val.resource.resourceName,
} }
arr.push(_obj) 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.selectedArray = arr.map(v => v.id)
this.$nextTick(() => { this.$nextTick(() => {
@ -288,7 +289,9 @@ export default {
this.transferData.push({ this.transferData.push({
type: this.type, type: this.type,
id: v.guid, id: v.guid,
name: v.zyname || '--' name: v.zyname || '--',
deptName:v.TGBM,
              resourceName:v.zyname
}) })
}) })
this.allData = JSON.parse(JSON.stringify(this.transferData)) this.allData = JSON.parse(JSON.stringify(this.transferData))
@ -302,6 +305,16 @@ 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);
//
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) { if (this.selectedArray.length > this.maxNum) {
return this.$message.error('最多选择十条数据!') return this.$message.error('最多选择十条数据!')
} }
@ -314,10 +327,13 @@ export default {
}) })
this.$emit('update', { this.$emit('update', {
title: this.type, title: this.type,
list: this.selectedArray list: selectedObjectList
}) })
console.log(this.selectedArray, this.displayList, 'this.displayList') console.log(this.selectedArray, this.displayList, 'this.displayList')
}, },
handleChange(){
console.log('222222',this.selectedArray);
},
getDisplay (displayList) { getDisplay (displayList) {
this.displayList = [] this.displayList = []
this.displayList = displayList this.displayList = displayList