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

update:更新多编辑视图面板

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