提交 6da1ef18 编写于 作者: zcdtk's avatar zcdtk

请求方法异步处理

上级 24459a0d
...@@ -242,24 +242,24 @@ import echarts from 'echarts'; ...@@ -242,24 +242,24 @@ import echarts from 'echarts';
/** /**
* 获取图表数据 * 获取图表数据
* *
* @returns {*} * @param {*} [opt]
* @returns {Promise<any>}
* @memberof ${srfclassname('${ctrl.name}')} * @memberof ${srfclassname('${ctrl.name}')}
*/ */
public load(opt?:any) { public async load(opt?: any): Promise<any> {
let _this = this; let _this = this;
const arg: any = { ...opt }; const arg: any = { ...opt };
const parentdata: any = {}; const parentdata: any = {};
this.$emit('beforeload', parentdata); this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata); Object.assign(arg, parentdata);
Object.assign(arg,{viewparams:this.viewparams}); Object.assign(arg, { viewparams: this.viewparams });
this.service.search(this.fetchAction,JSON.parse(JSON.stringify(this.context)),arg,this.showBusyIndicator).then((res) => { const response = await this.service.search(this.fetchAction, { ...this.context }, arg, this.showBusyIndicator);
if (res) { if (response && response.status === 200) {
_this.chartOption = _this.deepObjectMerge(_this.defaultConfig, res.data); _this.chartOption = _this.deepObjectMerge(_this.defaultConfig, response.data);
_this.drawCharts(); _this.drawCharts();
} else {
console.error(response);
} }
}).catch((error) => {
console.error(error);
});
} }
/** /**
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册