提交 fb9c633e 编写于 作者: KK's avatar KK

列表分页大小

上级 a8501dd6
......@@ -169,15 +169,50 @@
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
protected async load(data: any, type: any): Promise<any> {
if (!data.page) {
Object.assign(data, { page: this.pageNumber });
}
if (!data.size) {
Object.assign(data, { size: this.pageSize });
}
//部件排序
if(this.sort){
​ Object.assign(data,this.sort);
}
//视图排序
if(data.data && data.data.sort){
Object.assign(data, { sort:data.data.sort });
}
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(data, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
Object.assign(data,{viewparams:tempViewParams});
const response: any = await this.service.search(this.fetchAction, this.context, data, this.showBusyIndicator);
if (response && response.status === 200) {
let datelist = response.data.records;
this.formatdate(datelist);
this.$emit("load",this.items);
} else if (response && response.status !== 401) {
const { data: _data } = response;
this.$notice.error(_data.message)
if (!response || response.status !== 200) {
this.$notify({ type: 'danger', message: response.error.message });
return response;
}
this.$emit('load', (response.data && response.data.records) ? response.data.records : []);
this.pageTotal = response.data.total;
if (type == 'top') {
this.items = [];
this.items = response.data.records;
} else if (type == 'bottom') {
for (let i = 0; i < response.data.records.length; i++) {
this.items.push(response.data.records[i]);
}
} else {
this.items = [];
this.items = response.data.records;
}
this.items.forEach((item:any)=>{
Object.assign(item,this.getActionState(item));
this.setSlidingDisabled(item);
});
return response;
}
/**
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册