|
@@ -38,6 +38,9 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class=" text-center margin-top" v-if="!this.getExportData.length&&this.dataRes">暂无数据...</view>
|
|
|
+ <view v-show="isLoadMore&&page>1">
|
|
|
+ <uni-load-more :status="loadStatus"></uni-load-more>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</block>
|
|
@@ -59,7 +62,14 @@
|
|
|
dataRes: 0,
|
|
|
datetimerange: ['', ''],
|
|
|
keyWords:'',
|
|
|
- type:0
|
|
|
+ type:0,
|
|
|
+ start_time:'',
|
|
|
+ end_time:'',
|
|
|
+
|
|
|
+ page: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ loadStatus: 'loading', //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
|
|
|
+ isLoadMore: false, //是否加载中
|
|
|
};
|
|
|
},
|
|
|
onLoad: function(option) {
|
|
@@ -67,22 +77,48 @@
|
|
|
this.getData({
|
|
|
"company_code": uni.getStorageSync('selectedCode'),
|
|
|
"type":this.type,
|
|
|
- "start_time": '',
|
|
|
- "end_time": '',
|
|
|
+ "start_time": this.start_time,
|
|
|
+ "end_time": this.end_time,
|
|
|
+ "page": this.page,
|
|
|
+ "pageSize": this.pageSize,
|
|
|
})
|
|
|
|
|
|
},
|
|
|
watch: {
|
|
|
datetimerange(newval) {
|
|
|
+ this.start_time=newval[0];
|
|
|
+ this.end_time=newval[1]
|
|
|
+
|
|
|
+ this.getExportData = [],
|
|
|
+ this.page = 1,
|
|
|
this.getData({
|
|
|
"company_code": uni.getStorageSync('selectedCode'),
|
|
|
"type":this.type,
|
|
|
"start_time":newval[0],
|
|
|
"end_time": newval[1],
|
|
|
+ "page": this.page,
|
|
|
+ "pageSize": this.pageSize,
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ onReachBottom() { //上拉触底函数
|
|
|
+ if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
|
|
|
+ this.isLoadMore = true
|
|
|
+ this.page += 1
|
|
|
+ this.getData({
|
|
|
+ "company_code": uni.getStorageSync('selectedCode'),
|
|
|
+ "type":this.type,
|
|
|
+ "start_time": this.start_time,
|
|
|
+ "end_time": this.end_time,
|
|
|
+ "page": this.page,
|
|
|
+ "pageSize": this.pageSize,
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+ // alert(this.page)
|
|
|
+ },
|
|
|
+
|
|
|
methods: {
|
|
|
async getData(params = {}) {
|
|
|
const res = await this.$myRequest({
|
|
@@ -90,14 +126,29 @@
|
|
|
data: params,
|
|
|
showLoading: true
|
|
|
})
|
|
|
- this.getExportData = res.data.data;
|
|
|
this.dataRes = 1;
|
|
|
+ if (res.data.data.length) {
|
|
|
+
|
|
|
+ this.getExportData = this.getExportData.concat(res.data.data)
|
|
|
+
|
|
|
+ if (res.data.data.length < this.pageSize) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
|
|
|
+ this.isLoadMore = true
|
|
|
+ this.loadStatus = 'nomore'
|
|
|
+ } else {
|
|
|
+ this.isLoadMore = false
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.isLoadMore = true
|
|
|
+ this.loadStatus = 'nomore'
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
exportButton() {
|
|
|
//#ifdef H5
|
|
|
let exportUrl = this.$BASE_URL+
|
|
|
`ExportModule/getIntegratedAlarmListExpor/start_time/${this.datetimerange[0]}/end_time/${this.datetimerange[1]}/type/${this.type}/company_code/${uni.getStorageSync('selectedCode')}/`
|
|
|
var ua = window.navigator.userAgent.toLowerCase();
|
|
|
+ // alert(exportUrl)
|
|
|
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
|
|
|
uni.showModal({
|
|
|
showCancel: false,
|