tsg-app/pages/yj/index.vue

179 lines
3.7 KiB
Vue
Raw Normal View History

2024-11-13 09:42:42 +08:00
<template>
2025-09-30 17:23:21 +08:00
<view :style="{ height: '100vh', overflow: 'hidden' }">
2024-11-13 09:42:42 +08:00
<u-status-bar></u-status-bar>
<u-navbar title="预警" :autoBack="true" :titleStyle="{
2025-09-30 17:23:21 +08:00
fontSize: '18px'
}" :height='44' :safeAreaInsetTop=true leftIconSize='20' leftIconColor='rgb(153, 153, 153)'>
2024-11-13 09:42:42 +08:00
</u-navbar>
2025-09-30 17:23:21 +08:00
2024-11-13 09:42:42 +08:00
<view class="" style="margin-top:44px;border-top: 1px solid #f0f0f0;">
<view class="align-center" style="height: 44px;background-color: #f0f0f0;font-size: 12px;padding: 0 10px;">
2025-09-30 17:23:21 +08:00
预警时间{{ model.start }} {{ model.end }}
2024-11-13 09:42:42 +08:00
</view>
<view class="itemYj">
2025-09-30 17:23:21 +08:00
<view class="itemYjCont" v-for="(value, key) of list">
<view class="item" @click="todetail(key, value)">
<view :style="`color:${getColor(value)};`" class="num">
{{ getValue(value) }}
2024-11-13 09:42:42 +08:00
</view>
<view class="title">
2025-09-30 17:23:21 +08:00
{{ mapType[key] }}
2024-11-13 09:42:42 +08:00
</view>
</view>
</view>
</view>
2025-09-30 17:23:21 +08:00
2024-11-13 09:42:42 +08:00
</view>
<u-calendar :show="show" mode="range" @confirm="confirm" @cancel='cancel'></u-calendar>
</view>
</template>
<script>
2025-09-30 17:23:21 +08:00
import moment from 'moment'
2024-11-13 09:42:42 +08:00
2025-09-30 17:23:21 +08:00
export default {
data() {
return {
show: false,
model: {
start: moment().subtract(1, 'day').format('YYYY-MM-DD HH:mm:ss'),
end: moment().format('YYYY-MM-DD HH:mm:ss')
2024-11-13 09:42:42 +08:00
},
2025-09-30 17:23:21 +08:00
mapType: {
aiWarnCount: 'AI告警',
rzWarn: "水位告警",
// qxWarn:'气象告警',
pressWarn: '渗流告警',
flowWarn: '渗压告警',
shiftWarn: '位移告警',
byWarn: '白蚁告警'
2024-11-13 09:42:42 +08:00
},
2025-09-30 17:23:21 +08:00
list: {
rzWarn: "正常(-4.031)",
flowWarn: [],
pressWarn: [],
// qxWarn:[],
shiftWarn: [],
aiWarnCount: 0,
byWarn: 0
}
};
},
onLoad() {
this.getList();
},
methods: {
getValue(value) {
if (Array.isArray(value)) {
return value.length
} else {
return value
}
},
getColor(value) {
let str = '';
str = this.getValue(value) + '';
return str.includes("正常") ? '#04D919' : '#D9001B'
},
confirm(e) {
console.log(e);
this.model.stm = e[0]
this.model.etm = e[1]
this.show = false
},
cancel() {
this.show = false
},
todetail(key, e) {
let arr = encodeURIComponent(JSON.stringify(e))
console.log(key, e.length);
if (!e.length) {
return;
}
if (key == 'qxWarn') {
uni.navigateTo({
url: '/pages/yj/detail/qxyj?list=' + arr
2024-11-13 09:42:42 +08:00
})
2025-09-30 17:23:21 +08:00
}
if (key == 'shiftWarn') {
uni.navigateTo({
url: '/pages/yj/detail/wyyj?list=' + arr
})
}
if (key == 'flowWarn') {
uni.navigateTo({
url: '/pages/yj/detail/wyyj?list=' + arr
})
}
if (key == 'pressWarn') {
uni.navigateTo({
url: '/pages/yj/detail/wyyj?list=' + arr
})
}
if (key == 'aiWarnCount') {
uni.navigateTo({
url: '/pages/yj/detail/aiyj?list=' + arr
})
}
if (key == 'byWarn') {
uni.navigateTo({
url: '/pages/yj/detail/byTable?list=' + arr
})
}
},
getList() {
uni.$http.post('/gunshiApp/tsg/stQxWarnR/home/warn', this.model).then(res => {
delete res.data.data.qxWarn;
this.list = res.data.data
})
},
2024-11-13 09:42:42 +08:00
}
2025-09-30 17:23:21 +08:00
}
2024-11-13 09:42:42 +08:00
</script>
<style lang="scss" scoped>
2025-09-30 17:23:21 +08:00
.itemYj {
display: flex;
flex-wrap: wrap;
// justify-content: space-between;
// column-gap: 8px;
padding: 10px;
.itemYjCont {
border-width: 0px;
width: 112px;
height: 85px;
background: inherit;
background-color: rgba(234, 244, 254, 1);
border: none;
border-radius: 5px;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
2024-11-13 09:42:42 +08:00
display: flex;
2025-09-30 17:23:21 +08:00
flex-direction: column;
align-items: center;
justify-content: center;
margin-bottom: 10px;
margin-right: 1px;
.item {
text-align: center;
}
.normal {
color: #04D919;
2024-11-13 09:42:42 +08:00
}
2025-09-30 17:23:21 +08:00
.bj {
color: #D9001B;
}
// width: 30%;
// margin: 5px;
2024-11-13 09:42:42 +08:00
}
2025-09-30 17:23:21 +08:00
}
2024-11-13 09:42:42 +08:00
</style>