|
@@ -1,19 +1,25 @@
|
|
|
<script lang="ts" setup>
|
|
|
-import {computed, onMounted, reactive, ref} from 'vue'
|
|
|
+import {onMounted, onUnmounted, reactive, ref} from 'vue'
|
|
|
import {useRoute} from 'vue-router'
|
|
|
+import play from '@/assets/svg/play2.svg'
|
|
|
+import pause from '@/assets/svg/pause2.svg'
|
|
|
+import stop from '@/assets/svg/stop2.svg'
|
|
|
import RightFrame from '@/components/RightFrame.vue'
|
|
|
import Card01 from '@/components/card/Card01.vue'
|
|
|
-import {getStation, stations} from '@/utils/station'
|
|
|
import Chart from '@/components/Chart.vue'
|
|
|
-import {getWaterLevelAndFlowListOfPageByStcd, getWaterQualityLatest} from '@/api/gx'
|
|
|
-import {formatd} from '@/utils/ruoyi'
|
|
|
-import {Label, Setting, View} from '@/utils/tdInstruction'
|
|
|
+import {getWaterQualityLatest} from '@/api/gx'
|
|
|
import StripeTable from '@/components/StripeTable.vue'
|
|
|
import {getAlarmInfo} from '@/api/alarm.ts'
|
|
|
import StationRightButtonGroup from "@/components/StationRightButtonGroup.vue";
|
|
|
+import GwVideo from "@/components/Video/index.vue";
|
|
|
+import {getVideoCodeByMark} from "@/components/Video/video";
|
|
|
+import CardList from "@/components/CardList.vue";
|
|
|
+import {Operate} from "@/utils/tdInstruction";
|
|
|
+import {getDeviceByType} from "@/utils/device";
|
|
|
+import {getDeviceStatus} from "@/api/nanshui";
|
|
|
+import {HexToRgb} from "@/utils/color";
|
|
|
|
|
|
const route = useRoute()
|
|
|
-const workProSrc = ref(new URL('@/assets/images/workPro.png', import.meta.url).href)
|
|
|
const videoSrc = ref(new URL('@/assets/images/video.png', import.meta.url).href)
|
|
|
const simulateSrc = ref(new URL('@/assets/images/simulate.png', import.meta.url).href)
|
|
|
const tempWarnSrc = ref(new URL('@/assets/images/tempWarn.png', import.meta.url).href)
|
|
@@ -21,15 +27,66 @@ const overflowWarnSrc = ref(new URL('@/assets/images/overflowWarn.png', import.m
|
|
|
const fireWarnSrc = ref(new URL('@/assets/images/fireWarn.png', import.meta.url).href)
|
|
|
const wetWarnSrc = ref(new URL('@/assets/images/wetWarn.png', import.meta.url).href)
|
|
|
|
|
|
+// 绿色
|
|
|
+const GREEN = '#67C23A'
|
|
|
+const RGB_GREEN = HexToRgb(GREEN)
|
|
|
+// 浅绿色
|
|
|
+const LIGHT_GREEN = `rgba(${RGB_GREEN[0]}, ${RGB_GREEN[1]}, ${RGB_GREEN[2]}, 0.3)`
|
|
|
+// 红色
|
|
|
+const RED = '#F56C6C'
|
|
|
+const RGB_RED = HexToRgb(RED)
|
|
|
+// 浅红色
|
|
|
+const LIGHT_RED = `rgba(${RGB_RED[0]}, ${RGB_RED[1]}, ${RGB_RED[2]}, 0.3)`
|
|
|
+
|
|
|
+
|
|
|
const wqData = ref({d1: '6', d2: '22.3', d3: '5', d4: '20', d5: '6', d6: '22.3', d7: '5', d8: '20'})
|
|
|
-const station = computed(() => getStation(route.params.stcd))
|
|
|
-const wlData = reactive({
|
|
|
- ss: '0',
|
|
|
- zg: '0',
|
|
|
- zd: '0',
|
|
|
- bz: station.value.grz ? station.value.grz + '' : '0',
|
|
|
- jj: station.value.wrz ? station.value.wrz + '' : '0'
|
|
|
-})
|
|
|
+// 设备列表
|
|
|
+const deviceList = reactive(getDeviceByType('水质测验设备'))
|
|
|
+// 水质测验模拟 0:结束 1:播放 2:暂停
|
|
|
+const testSimulationStatus = ref(0)
|
|
|
+// 获取视频CODE
|
|
|
+const videoCode = ref(getVideoCodeByMark(route.params.stcd + '', "室内"))
|
|
|
+
|
|
|
+/**
|
|
|
+ * 测验模拟
|
|
|
+ * @param mode 播放、暂停、继续、结束
|
|
|
+ */
|
|
|
+function handleTestSimulation(mode) {
|
|
|
+ switch (mode) {
|
|
|
+ case "play":
|
|
|
+ if (testSimulationStatus.value === 0) {
|
|
|
+ Operate.testSimulation(route.params.stcd, '播放')
|
|
|
+ } else {
|
|
|
+ Operate.testSimulation(route.params.stcd, '继续')
|
|
|
+ }
|
|
|
+ testSimulationStatus.value = 1
|
|
|
+ break
|
|
|
+ case "pause":
|
|
|
+ Operate.testSimulation(route.params.stcd, '暂停')
|
|
|
+ testSimulationStatus.value = 2
|
|
|
+ break
|
|
|
+ case "stop":
|
|
|
+ Operate.testSimulation(route.params.stcd, '结束')
|
|
|
+ testSimulationStatus.value = 0
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * 获取设备状态
|
|
|
+ */
|
|
|
+function deviceStatus() {
|
|
|
+ getDeviceStatus().then(res => {
|
|
|
+ const status = res.data?.devstatus
|
|
|
+ if (status) {
|
|
|
+ deviceList.forEach(d => {
|
|
|
+ d['status'] = status[d['nanshuiDevId']]
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
|
|
|
/**
|
|
|
* 获取最新水质数据
|
|
@@ -52,12 +109,12 @@ function getLatestWaterQuality() {
|
|
|
|
|
|
const alarmColumns = [
|
|
|
{
|
|
|
- label: '报警类型', prop: 'deviceName', width: '100',convertFn: (data) => {
|
|
|
+ label: '报警类型', prop: 'deviceName', width: '100', convertFn: (data) => {
|
|
|
return data ? data.trim() : ''
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
- label: '时间', prop: 'tm', convertFn: (data) => {
|
|
|
+ label: '时间', prop: 'tm', convertFn: (data) => {
|
|
|
return data ? data.substring(5, 16) : ''
|
|
|
}
|
|
|
},
|
|
@@ -68,6 +125,7 @@ const alarmColumns = [
|
|
|
},
|
|
|
]
|
|
|
const alarmData = reactive([])
|
|
|
+const left1Ref = ref(null)
|
|
|
|
|
|
function getAlarmList() {
|
|
|
getAlarmInfo().then(res => {
|
|
@@ -76,8 +134,6 @@ function getAlarmList() {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-const left1Ref = ref(null)
|
|
|
-
|
|
|
async function reloadLeft1() {
|
|
|
const colors = ['#5470C6', '#91CC75', '#EE6666'];
|
|
|
var option = {
|
|
@@ -104,7 +160,7 @@ async function reloadLeft1() {
|
|
|
left: '5%',
|
|
|
right: '4%',
|
|
|
bottom: '1%',
|
|
|
- top:'20%',
|
|
|
+ top: '20%',
|
|
|
containLabel: true
|
|
|
},
|
|
|
xAxis: {
|
|
@@ -112,7 +168,7 @@ async function reloadLeft1() {
|
|
|
boundaryGap: false,
|
|
|
data: ['11::30', '11:35', '11:40', '11:45', '11:50', '11:55', '12:00', '12:05', '12:10', '12:15']
|
|
|
},
|
|
|
- yAxis: [ {
|
|
|
+ yAxis: [{
|
|
|
type: 'value',
|
|
|
name: ' %',
|
|
|
position: 'right',
|
|
@@ -146,27 +202,30 @@ async function reloadLeft1() {
|
|
|
name: '温度',
|
|
|
type: 'line',
|
|
|
stack: 'Total',
|
|
|
- data: [20, 21, 25, 26, 32, 30, 26,39,29,30]
|
|
|
+ data: [20, 21, 25, 26, 32, 30, 26, 39, 29, 30]
|
|
|
},
|
|
|
{
|
|
|
name: '湿度',
|
|
|
type: 'line',
|
|
|
stack: 'Total',
|
|
|
- data: [40, 45, 30, 31, 36, 33, 31,50,30,20]
|
|
|
+ data: [40, 45, 30, 31, 36, 33, 31, 50, 30, 20]
|
|
|
}
|
|
|
]
|
|
|
};
|
|
|
left1Ref.value.loadChart(option)
|
|
|
}
|
|
|
|
|
|
-
|
|
|
onMounted(() => {
|
|
|
reloadLeft1()
|
|
|
-
|
|
|
- // 获取最新水质数据
|
|
|
- getLatestWaterQuality()
|
|
|
getAlarmList()
|
|
|
+ deviceStatus()
|
|
|
+})
|
|
|
|
|
|
+onUnmounted(() => {
|
|
|
+ if (testSimulationStatus.value !== 0) {
|
|
|
+ debugger
|
|
|
+ handleTestSimulation('stop')
|
|
|
+ }
|
|
|
})
|
|
|
</script>
|
|
|
<template>
|
|
@@ -197,11 +256,33 @@ onMounted(() => {
|
|
|
</template>
|
|
|
<template #rightModule>
|
|
|
<card01 style="height: 65%" title="监测流程">
|
|
|
- <img :src="workProSrc" style="width: 100%;height: 83%;">
|
|
|
- <img :src="simulateSrc" style="width: 100%;">
|
|
|
+ <card-list :data="deviceList" style="height: calc(100% - 86px);margin-bottom: 10px;">
|
|
|
+ <template #default="scope">
|
|
|
+ <div
|
|
|
+ :style="{'background-image': scope.row.status === 'open' ? `linear-gradient(100deg, ${LIGHT_GREEN} 0%, ${GREEN} 70%)`:`linear-gradient(100deg, ${LIGHT_RED} 0%, ${RED} 70%)`}"
|
|
|
+ style="padding: 12px 20px;display: flex;justify-content: space-between;align-items: center;">
|
|
|
+ <div style="font-weight: bolder;cursor: pointer;">{{ scope.row.deviceName }}</div>
|
|
|
+ <div>
|
|
|
+ <el-switch
|
|
|
+ v-model="scope.row.status"
|
|
|
+ active-value="open"
|
|
|
+ inactive-value="close"
|
|
|
+ style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </card-list>
|
|
|
+ <div :style="{ 'background-image': `url(${simulateSrc})`}" class="test-simulation">
|
|
|
+ <icon v-if="testSimulationStatus == 0 || testSimulationStatus == 2" :data="play" class="video-btn"
|
|
|
+ @click="handleTestSimulation('play')"/>
|
|
|
+ <icon v-if="testSimulationStatus == 1" :data="pause" class="video-btn"
|
|
|
+ @click="handleTestSimulation('pause')"/>
|
|
|
+ <icon v-if="testSimulationStatus != 0" :data="stop" class="video-btn" @click="handleTestSimulation('stop')"/>
|
|
|
+ </div>
|
|
|
</card01>
|
|
|
<card01 style="height: 35%" title="站房监控">
|
|
|
- <img :src="videoSrc" style="width: 100%;height: 100%;">
|
|
|
+ <gw-video :code="videoCode" :imageSrc="videoSrc"></gw-video>
|
|
|
</card01>
|
|
|
</template>
|
|
|
<template #btnGroup>
|
|
@@ -234,4 +315,25 @@ onMounted(() => {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+.test-simulation {
|
|
|
+ width: 100%;
|
|
|
+ height: 76px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ border-radius: 6px;
|
|
|
+
|
|
|
+ .video-btn {
|
|
|
+ width: 2rem;
|
|
|
+ height: 2rem;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+
|
|
|
+ .video-btn + .video-btn {
|
|
|
+ margin-left: 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
</style>
|