261 lines
5.4 KiB
Vue
261 lines
5.4 KiB
Vue
<template>
|
||
<view class="warn-container">
|
||
<view class="warn-navbar">
|
||
<image src="/static/ic_back.png" class="warn-back" @click="goBack" />
|
||
<text class="warn-title">预警处理</text>
|
||
<text class="warn-right-txt" @click="goStatistics">预警统计</text>
|
||
</view>
|
||
<!-- tab栏 -->
|
||
<view class="warn-tabs">
|
||
<view v-for="(tab, idx) in tabs" :key="idx" :class="['warn-tab', { active: idx === activeTab }]"
|
||
@click="changeTab(idx)">
|
||
{{ tab }}
|
||
<view v-if="idx === activeTab" class="tab-underline"></view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 列表区 -->
|
||
<scroll-view scroll-y class="warn-list">
|
||
<view v-for="(item, idx) in list" :key="idx" class="warn-card" @click="goDetail2(item)">
|
||
<view class="warn-row">
|
||
<view class="warn-no">{{item.smallTypeName}}</view>
|
||
<view class="warn-status">
|
||
{{item.levelName}}
|
||
</view>
|
||
</view>
|
||
<image class="warn-line-image" src="/static/ic_my_repair_03.png" />
|
||
<view class="warn-info">预警内容:{{ item.description }}</view>
|
||
<view class="warn-info">预警位置:{{ item.deviceGroupName }}</view>
|
||
<view class="warn-info">预警时间:{{ item.reportTime }}</view>
|
||
<view class="warn-info">预警设备:{{ item.deviceName }}</view>
|
||
<view v-if="[20, 30, 31, 32].includes(item.state)" class="warn-eval-wrap" @click.stop="goDetail(item)">
|
||
<view class="warn-eval-btn">去处理</view>
|
||
</view>
|
||
</view>
|
||
</scroll-view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
tabs: ["待处理", "全部"],
|
||
activeTab: 0,
|
||
tabData: [
|
||
[],
|
||
[]
|
||
],
|
||
tabLoaded: [false, false],
|
||
loading: false,
|
||
lastScrollTop: 0,
|
||
|
||
};
|
||
},
|
||
computed: {
|
||
list() {
|
||
return this.tabData[this.activeTab];
|
||
},
|
||
},
|
||
onShow() {
|
||
uni.$once('refreshData',s=> {
|
||
this.loadTabData(this.activeTab);
|
||
});
|
||
},
|
||
created() {
|
||
this.loadTabData(this.activeTab);
|
||
},
|
||
methods: {
|
||
goBack() {
|
||
uni.navigateBack();
|
||
},
|
||
|
||
async changeTab(idx) {
|
||
this.activeTab = idx;
|
||
if (!this.tabLoaded[idx]) {
|
||
await this.loadTabData(idx);
|
||
}
|
||
},
|
||
async loadTabData(idx) {
|
||
this.loading = true;
|
||
let params = {};
|
||
if (idx == 0) {
|
||
params = {
|
||
'states': [20, 30, 31, 32]
|
||
}
|
||
}
|
||
let res = await this.$u.api.getWarns(params);
|
||
if (res.code == "200") {
|
||
this.$set(this.tabData, idx, res.rows);
|
||
}
|
||
this.$set(this.tabLoaded, idx, true);
|
||
this.loading = false;
|
||
},
|
||
|
||
goDetail(item) {
|
||
const itemStr = encodeURIComponent(JSON.stringify(item));
|
||
uni.navigateTo({
|
||
url: "/pages/sys/workbench/earlyWarning/warnDetail?item=" + itemStr,
|
||
});
|
||
},
|
||
goDetail2(item) {
|
||
const itemStr = encodeURIComponent(JSON.stringify(item));
|
||
uni.navigateTo({
|
||
url: "/pages/sys/workbench/earlyWarning/warnDetail?item=" + itemStr+"&pageType=detail",
|
||
});
|
||
},
|
||
goStatistics() {
|
||
uni.navigateTo({
|
||
url: "/pages/sys/workbench/earlyWarning/warnStatistics"
|
||
});
|
||
}
|
||
},
|
||
};
|
||
</script>
|
||
|
||
<style scoped>
|
||
.warn-container {
|
||
height: 100vh;
|
||
background: #fff;
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
|
||
.warn-navbar {
|
||
width: 100%;
|
||
height: 100rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: stretch;
|
||
position: relative;
|
||
margin-top: 50rpx;
|
||
}
|
||
|
||
.warn-back {
|
||
width: 18rpx;
|
||
height: 32rpx;
|
||
margin-left: 24rpx;
|
||
margin-right: 78rpx;
|
||
}
|
||
|
||
.warn-right-txt {
|
||
font-size: 24rpx;
|
||
color: #0090FF;
|
||
margin-right: 24rpx;
|
||
}
|
||
|
||
.warn-title {
|
||
font-size: 36rpx;
|
||
color: #000;
|
||
margin-left: auto;
|
||
margin-right: auto;
|
||
}
|
||
|
||
.warn-tabs {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-around;
|
||
background: #fff;
|
||
height: 80rpx;
|
||
bwarn-bottom: 1px solid #f0f0f0;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.warn-tab {
|
||
flex: 1;
|
||
text-align: center;
|
||
font-size: 30rpx;
|
||
color: #888;
|
||
position: relative;
|
||
font-weight: 500;
|
||
padding: 0 0 10rpx 0;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.warn-tab.active {
|
||
color: #2186ff;
|
||
font-weight: bold;
|
||
}
|
||
|
||
.tab-underline {
|
||
width: 60rpx;
|
||
height: 6rpx;
|
||
background: #2186ff;
|
||
bwarn-radius: 3rpx;
|
||
margin: 0 auto;
|
||
margin-top: 8rpx;
|
||
}
|
||
|
||
.warn-list {
|
||
padding: 0 24rpx;
|
||
flex: 1;
|
||
overflow-y: auto;
|
||
padding-bottom: 30rpx;
|
||
height: calc(100vh - 80rpx - 32rpx);
|
||
background: #f7f7f7;
|
||
}
|
||
|
||
.warn-card {
|
||
background: #fff;
|
||
bwarn-radius: 12rpx;
|
||
margin-top: 24rpx;
|
||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.03);
|
||
padding-top: 25rpx;
|
||
padding-bottom: 32rpx;
|
||
}
|
||
|
||
.warn-eval-wrap {
|
||
display: flex;
|
||
justify-content: center;
|
||
width: 100%;
|
||
margin-top: 20rpx;
|
||
}
|
||
|
||
.warn-eval-btn {
|
||
width: 240rpx;
|
||
height: 60rpx;
|
||
text-align: center;
|
||
line-height: 60rpx;
|
||
background: #0090FF;
|
||
border-radius: 40rpx;
|
||
font-size: 24rpx;
|
||
color: white;
|
||
}
|
||
|
||
.warn-row {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
margin-bottom: 12rpx;
|
||
margin-top: 25rpx;
|
||
margin-left: 19rpx;
|
||
margin-right: 50rpx;
|
||
}
|
||
|
||
.warn-no {
|
||
font-size: 24rpx;
|
||
color: #0b0b0b;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.warn-status {
|
||
font-size: 24rpx;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.warn-line-image {
|
||
margin-left: 29rpx;
|
||
margin-right: 39rpx;
|
||
height: 2rpx;
|
||
margin-bottom: 29rpx;
|
||
}
|
||
|
||
|
||
|
||
.warn-info {
|
||
font-size: 24rpx;
|
||
color: #888;
|
||
margin-bottom: 30rpx;
|
||
margin-left: 47rpx;
|
||
}
|
||
</style> |