提交 24960ad9 编写于 作者: WodahsOrez's avatar WodahsOrez

lxm--列表,数据视图加载

上级 256986da
...@@ -164,6 +164,14 @@ ...@@ -164,6 +164,14 @@
*/ */
public totalRecord: number = 0; public totalRecord: number = 0;
/**
* 加载的数据是否附加在items之后
*
* @type {boolean}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public isAddBehind:boolean = false;
/** /**
* 排序方向 * 排序方向
* *
...@@ -209,6 +217,7 @@ ...@@ -209,6 +217,7 @@
}) })
} }
/** /**
* Vue声明周期,组件创建完毕 * Vue声明周期,组件创建完毕
* *
...@@ -268,6 +277,7 @@ ...@@ -268,6 +277,7 @@
if(this.totalRecord>this.items.length) if(this.totalRecord>this.items.length)
{ {
this.curPage = ++this.curPage; this.curPage = ++this.curPage;
this.isAddBehind = true;
this.load({}); this.load({});
} }
} }
...@@ -324,7 +334,9 @@ ...@@ -324,7 +334,9 @@
return; return;
} }
const data: any = response.data; const data: any = response.data;
if(!this.isAddBehind){
this.items = []; this.items = [];
}
if (Object.keys(data).length > 0) { if (Object.keys(data).length > 0) {
let datas = JSON.parse(JSON.stringify(data)); let datas = JSON.parse(JSON.stringify(data));
datas.map((item: any) => { datas.map((item: any) => {
...@@ -333,6 +345,7 @@ ...@@ -333,6 +345,7 @@
this.totalRecord = response.total; this.totalRecord = response.total;
this.items.push(...datas); this.items.push(...datas);
} }
this.isAddBehind = false;
this.$emit('load', this.items); this.$emit('load', this.items);
if(this.isSelectFirstDefault){ if(this.isSelectFirstDefault){
this.handleClick(this.items[0]); this.handleClick(this.items[0]);
......
...@@ -160,6 +160,14 @@ ...@@ -160,6 +160,14 @@
*/ */
public totalRecord: number = 0; public totalRecord: number = 0;
/**
* 加载的数据是否附加在items之后
*
* @type {boolean}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public isAddBehind:boolean = false;
/** /**
* 选中数组 * 选中数组
* @type {Array<any>} * @type {Array<any>}
...@@ -298,6 +306,7 @@ ...@@ -298,6 +306,7 @@
if(this.totalRecord>this.items.length) if(this.totalRecord>this.items.length)
{ {
this.curPage = ++this.curPage; this.curPage = ++this.curPage;
this.isAddBehind = true;
this.load({}); this.load({});
} }
} }
...@@ -375,7 +384,9 @@ ...@@ -375,7 +384,9 @@
return; return;
} }
const data: any = response.data; const data: any = response.data;
if(!this.isAddBehind){
this.items = []; this.items = [];
}
if (Object.keys(data).length > 0) { if (Object.keys(data).length > 0) {
let datas = JSON.parse(JSON.stringify(data)); let datas = JSON.parse(JSON.stringify(data));
datas.map((item: any) => { datas.map((item: any) => {
...@@ -388,6 +399,7 @@ ...@@ -388,6 +399,7 @@
this.items.push(...datas); this.items.push(...datas);
} }
} }
this.isAddBehind = false;
this.$emit('load', this.items); this.$emit('load', this.items);
if(this.isSelectFirstDefault){ if(this.isSelectFirstDefault){
this.handleClick(this.items[0]); this.handleClick(this.items[0]);
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册