import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
export default {
	data(){
		return{
			
		}
	},
	mixins:[MescrollMixin],
	methods:{
		/*上拉加载的回调*/
		upCallback(page) {
			console.log(page,"page");
			let pageNum = page.num; // 页码, 默认从1开始
			let pageSize = page.size; // 页长, 默认每页10条
			let obj = {
				pageSize:pageSize,
				pageNum:pageNum,
				 createDate:this.dateVal,
				alarmDivide:this.alarmSelectValue==1?"ALARM":"WARNING",
				processState:this.stateSelectValue,
				projectId: this.projectId
				// deviceState:this.screeningValue,
				// deviceName:this.searchValue
			}
			this.$get("/app/alarm/table",obj).then((res)=>{
				console.log(res,"ressssssssssss");
				if (res.rows && res.rows.length>0) {
					// 接口返回的当前页数据列表 (数组)
					let curPageData = res.rows; 
					// 接口返回的当前页数据长度 (如列表有26个数据,当前页返回8个,则curPageLen=8)
					let curPageLen = curPageData.length; 
					//设置列表数据
					if(pageNum == 1) this.allAlarmList = []; //如果是第一页需手动置空列表
					this.allAlarmList = this.allAlarmList.concat(curPageData); //追加新数据
					this.mescroll.endBySize(curPageLen, res.total); // 推荐
					// this.mescroll.endByPage(curPageLen, res.data.total)
					// this.mescroll.endSuccess(curPageData.length);
				} else{
					this.allAlarmList = [];
					this.mescroll.endErr();
					this.mescroll.showEmpty();
					// this.mescroll.endUpScroll(true);
				}
			}).catch(()=>{
				//联网失败, 结束加载
				this.mescroll.endErr();
			})
		},
	}
}