fix : 组件服务获取列表传参

This commit is contained in:
guoyue 2022-08-10 15:47:24 +08:00
parent b3769f2415
commit 607e119c61
1 changed files with 9 additions and 32 deletions

View File

@ -23,20 +23,7 @@
</template> </template>
</el-dialog> </el-dialog>
<DisplayList></DisplayList> <DisplayList :displayList="displayList" showKey="name"></DisplayList>
<div class="show-box" v-if="displayList.length > 0">
<div class="list-box">
<div v-for="(item, i) in displayList" :key="i">
<el-tooltip popper-class="testTooltip" effect="dark" :content="item.name || '--'" placement="top">
<div class="list-item">
{{ item.name || '--' }}
</div>
</el-tooltip>
</div>
</div>
</div>
</div> </div>
</template> </template>
@ -149,8 +136,8 @@ let keyObj = {
nameKey: 'zyname' nameKey: 'zyname'
}, },
'组件服务': { '组件服务': {
idKey: 'zycode', idKey: 'id',
nameKey: 'zyname' nameKey: 'name'
}, },
} }
@ -204,15 +191,15 @@ export default {
let attrValue = dataForm.fuseResourceList.filter(v => v.type == this.type); let attrValue = dataForm.fuseResourceList.filter(v => v.type == this.type);
if (attrValue.length > 0) { if (attrValue.length > 0) {
attrValue.map(val => { attrValue.map(val => {
let item = this.allData.find(v => v.id == val.resourceId) || {};
let _obj = { let _obj = {
type: val.type, type: val.type,
id: val.resourceId, id: val.resourceId,
name: item.name name: val.resource && val.resource.name
}; };
arr.push(_obj); arr.push(_obj);
}); });
} }
// //
this.displayList = JSON.parse(JSON.stringify(arr)); this.displayList = JSON.parse(JSON.stringify(arr));
// //
@ -223,27 +210,17 @@ export default {
}, },
// //
getData() { getData() {
// this.allData = [];
// this.transferData = [];
// let arr = JSON.parse(JSON.stringify(sjzyArray));
// arr.map(v => {
// this.transferData.push({
// type: this.type,
// id: v[keyObj[this.type].idKey],
// name: v[keyObj[this.type].nameKey] || "--"
// });
// });
// this.allData = JSON.parse(JSON.stringify(this.transferData));
// return;
if (this.getDataParams.url === '') { if (this.getDataParams.url === '') {
return; return;
} }
this.$http[this.getDataParams.methods](this.getDataParams.url, this.getDataParams.postData).then(res => { this.$http[this.getDataParams.methods](this.getDataParams.url, {
params: this.getDataParams.postData
}).then(res => {
console.log('res.data----获取列表-------->', res.data); console.log('res.data----获取列表-------->', res.data);
if (res.data.code !== 0) { if (res.data.code !== 0) {
return this.$message.error(res.msg); return this.$message.error(res.msg);
} }
this.transferData = []; // allData this.transferData = [];
this.allData = []; this.allData = [];
(res.data.data || []).map(v => { (res.data.data || []).map(v => {
this.transferData.push({ this.transferData.push({