提交 a87c1117 编写于 作者: Shine-zwj's avatar Shine-zwj

update:更新多编辑视图面板

上级 d8c15d49
......@@ -334,7 +334,7 @@
* @param {*} data
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public load(data: any): void {
public async load(data: any): void {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: '${view.getName()}' + (this.$t('app.multiEditView.notConfig.fetchAction') as string) });
return;
......@@ -342,26 +342,40 @@
let arg: any = {};
Object.assign(arg, data,{viewparams:this.viewparams});
this.items = [];
const promice: Promise<any> = this.service.get(this.fetchAction,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator);
promice.then((response: any) => {
if (!response.status || response.status !== 200) {
let viewparamResult:any = Object.assign(arg, this.viewparams);
const tempContext = Util.deepCopy(this.context);
if (!(await this.handleCtrlEvents('onbeforeload', { context: tempContext, viewparams: viewparamResult, data: arg }))) {
return;
}
const response: any = await this.service.get(this.fetchAction,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator);
try {
if (response.status && response.status == 200) {
if (!(await this.handleCtrlEvents('onloadsuccess', { data: response.data }))) {
return;
}
const data: any = response.data;
if (data.length > 0) {
const items = JSON.parse(JSON.stringify(data));
this.doItems(items);
}
this.$emit('load', this.items);
} else {
if (!(await this.handleCtrlEvents('onloaderror', { data: response.data }))) {
return;
}
if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return;
}
const data: any = response.data;
if (data.length > 0) {
const items = JSON.parse(JSON.stringify(data));
this.doItems(items);
} catch (error) {
if (!(await this.handleCtrlEvents('onloaderror', { context: tempContext, viewparams: viewparamResult, data: response && response.data ? response.data : arg }))) {
return;
}
this.$emit('load', this.items);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" });
});
}
}
/**
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册