赋能场景:数据资源接口联调

This commit is contained in:
guoyue 2022-07-28 10:31:42 +08:00
parent 20de75e0dd
commit 78f836dd92
1 changed files with 32 additions and 10 deletions

View File

@ -223,17 +223,39 @@ export default {
},
//
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 = [];
// 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 === '') {
return;
}
this.$http[this.getDataParams.methods](this.getDataParams.url, this.getDataParams.postData).then(res => {
console.log('res.data----获取列表-------->', res.data);
if (res.data.code !== 0) {
return this.$message.error(res.msg);
}
this.transferData = []; // allData
this.allData = [];
(res.data.data || []).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));
this.allData = JSON.parse(JSON.stringify(this.transferData));
}).catch(err => {
this.$message.error(err);
})
},
filterMethod(query, item) {
return item.name && item.name.indexOf(query) > -1;