<template>
|
<view class="u-page">
|
<view class="tab">
|
<u-tabs :itemStyle="{width: '160rpx' ,height: '88rpx' }" :activeStyle="{color: '#99bada' }" lineWidth="60"
|
:current="current" :list="tabList" @click="tabClick">
|
</u-tabs>
|
</view>
|
<!-- 外呼报讯 -->
|
<view v-if="current==0">
|
<view v-if="historyList.length<=0" class="line-center">
|
<u-empty mode="data" />
|
</view>
|
<u-list @scrolltolower="scrolltolower" v-else>
|
<u-list-item v-for="(item, index) in historyList" :key="item.id">
|
<u-cell isLink :url='`./detail/index?data=${encodeURIComponent(JSON.stringify(item))}`'
|
:title="`${item.waterName}-${item.realName}`" :value='item.createTime'>
|
</u-cell>
|
</u-list-item>
|
</u-list>
|
</view>
|
<view v-else>
|
<view v-if="patrolList.length<=0" class="line-center">
|
<u-empty mode="data" />
|
</view>
|
<u-list @scrolltolower="scrolltolower" v-else>
|
<u-list-item v-for="(item, index) in patrolList" :key="item.id">
|
<u-cell isLink
|
:url='`../../realtimeMonitor/reservoir/reportFlood?reservoirId=${item.reservoirId}&id=${item.id}`'
|
:title="`${item.reservoirName}`" :value='item.createTime'>
|
</u-cell>
|
</u-list-item>
|
</u-list>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import {
|
getHistotyList,
|
reportFloodRecord
|
} from "@/api/history"
|
export default {
|
data() {
|
return {
|
historyList: [],
|
query: {
|
current: 0,
|
pageSize: 14,
|
size: 14,
|
account: uni.getStorageSync("userInfo").account,
|
createUser: uni.getStorageSync("userInfo").user_id
|
},
|
total: 0,
|
tabList: [{
|
name: "外呼报汛"
|
},
|
{
|
name: "巡查报汛"
|
},
|
],
|
current: 1,
|
//巡查报讯列表
|
patrolList: [],
|
}
|
},
|
onLoad() {
|
// this.loadmore()
|
if (this.current == 0) {
|
this.initList()
|
} else {
|
this.getReportFloodRecord()
|
}
|
},
|
methods: {
|
//外呼报讯初始化
|
async initList(query = this.query) {
|
//通过当前账号字段判断是否登录
|
if (!this.query.account) {
|
uni.showModal({
|
title: "提示",
|
content: "您当前未登录,请登陆后查看!",
|
showCancel: false,
|
success(res) {
|
if (res.confirm) {
|
uni.clearStorageSync()
|
uni.navigateTo({
|
url: "../../../pages/login/index"
|
})
|
}
|
}
|
})
|
}
|
this.query.current += 1
|
if (this.historyList.length >= this.total && this.historyList.length != 0) return
|
const {
|
code,
|
data,
|
msg
|
} = await getHistotyList(query)
|
if (code != 200) {
|
uni.showToast({
|
title: msg,
|
icon: "none"
|
})
|
return
|
}
|
this.total = data.total
|
if (this.historyList.length === 0) {
|
this.historyList = data.records
|
} else {
|
this.query.current += 1
|
this.historyList = [...this.historyList, ...data.records]
|
}
|
},
|
//巡查报讯初始化
|
async getReportFloodRecord() {
|
this.query.current += 1
|
if (this.patrolList.length >= this.total && this.patrolList.length != 0) return
|
const res = await reportFloodRecord(this.query)
|
if (res.code != 200) return
|
this.total = res.data.total
|
if (this.patrolList.length === 0) {
|
this.patrolList = res.data.records
|
} else {
|
this.patrolList = [...this.patrolList, ...res.data.records]
|
}
|
},
|
tabClick(e) {
|
this.query.current = 0
|
this.current = e.index
|
if (this.current == 0) {
|
this.patrolList = []
|
this.initList()
|
} else if (this.current == 1) {
|
this.historyList = []
|
this.getReportFloodRecord()
|
}
|
},
|
scrolltolower() {
|
if (this.current == 0) {
|
this.initList()
|
} else if (this.current == 1) {
|
this.getReportFloodRecord()
|
}
|
},
|
},
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.u-page {
|
.tab {
|
display: flex;
|
flex-direction: column;
|
justify-content: space-evenly;
|
width: 100%;
|
background-color: #ffffff;
|
align-items: center;
|
}
|
}
|
|
.line-center {
|
height: 100vh;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
</style>
|