|
@@ -7,7 +7,6 @@ import stop from '@/assets/svg/stop2.svg'
|
|
|
import RightFrame from '@/components/RightFrame.vue'
|
|
|
import Card01 from '@/components/card/Card01.vue'
|
|
|
import Chart from '@/components/Chart.vue'
|
|
|
-import {getWaterQualityLatest} from '@/api/gx'
|
|
|
import StripeTable from '@/components/StripeTable.vue'
|
|
|
import {getAlarmInfo} from '@/api/alarm.ts'
|
|
|
import StationRightButtonGroup from "@/components/StationRightButtonGroup.vue";
|
|
@@ -15,10 +14,12 @@ import GwVideo from "@/components/Video/index.vue";
|
|
|
import {getVideoCodeByMark} from "@/components/Video/video";
|
|
|
import {Operate} from "@/utils/tdInstruction";
|
|
|
import {getDeviceByType} from "@/utils/device";
|
|
|
-import {getDeviceStatus} from "@/api/nanshui";
|
|
|
+import {getDeviceStatus, getTaskRead, getWaterQualityData, runTest, setTaskRead} from "@/api/nanshui";
|
|
|
import {HexToRgb} from "@/utils/color";
|
|
|
import bus from "@/utils/bus";
|
|
|
import DataTag from "@/components/tag/DataTag.vue";
|
|
|
+import {ElMessage, ElMessageBox} from "element-plus";
|
|
|
+import {VideoPlay} from "@element-plus/icons-vue";
|
|
|
|
|
|
const route = useRoute()
|
|
|
const videoSrc = ref(new URL('@/assets/images/video.png', import.meta.url).href)
|
|
@@ -39,9 +40,9 @@ const RGB_RED = HexToRgb(RED)
|
|
|
// 浅红色
|
|
|
const LIGHT_RED = `rgba(${RGB_RED[0]}, ${RGB_RED[1]}, ${RGB_RED[2]}, 0.3)`
|
|
|
|
|
|
-const frequency = ref([2, 8])
|
|
|
+const frequency = ref([])
|
|
|
|
|
|
-const wqData = ref({d1: '6', d2: '22.3', d3: '5', d4: '20', d5: '6', d6: '22.3', d7: '5', d8: '20'})
|
|
|
+const wqData = ref({})
|
|
|
// 设备列表
|
|
|
const deviceList = reactive(getDeviceByType('水质测验设备').filter(d => d.deviceName !== '控制单元'))
|
|
|
// 水质测验模拟 0:结束 1:播放 2:暂停
|
|
@@ -97,17 +98,14 @@ function deviceStatus() {
|
|
|
* 获取最新水质数据
|
|
|
*/
|
|
|
function getLatestWaterQuality() {
|
|
|
- getWaterQualityLatest({stcds: route.params.stcd}).then(res => {
|
|
|
- const data = res.data[0]
|
|
|
- wqData.value = {
|
|
|
- d1: data.ph,
|
|
|
- d2: data.dox,
|
|
|
- d3: data.chla,
|
|
|
- d4: data.turb,
|
|
|
- d5: data.wt,
|
|
|
- d6: data.cond,
|
|
|
- d7: data.tn,
|
|
|
- d8: data.tp
|
|
|
+ getWaterQualityData(route.params.stcd).then(res => {
|
|
|
+ if (res.data.wqdata && res.data.wqdata.wq && Object.keys(res.data.wqdata.wq).length > 0) {
|
|
|
+ res.data.wqdata.wq['tm'] = res.data.wqdata.tm
|
|
|
+ const data = Object.keys(res.data.wqdata.wq).reduce((acc, key) => {
|
|
|
+ acc[key.toLowerCase()] = res.data.wqdata.wq[key];
|
|
|
+ return acc;
|
|
|
+ }, {});
|
|
|
+ wqData.value = data
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -123,7 +121,17 @@ const alarmType = ref({
|
|
|
const alarmColumns = [
|
|
|
{
|
|
|
label: '报警类型', prop: 'warnType', width: '100', convertFn: (data) => {
|
|
|
- return data ? alarmType.value[data.trim()] : ''
|
|
|
+ switch (data) {
|
|
|
+ case '1':
|
|
|
+ return '故障'
|
|
|
+ case '2':
|
|
|
+ return '提醒'
|
|
|
+ case '3':
|
|
|
+ return '巡检'
|
|
|
+ case '4':
|
|
|
+ return '定期巡检'
|
|
|
+ }
|
|
|
+ return ''
|
|
|
}
|
|
|
},
|
|
|
{
|
|
@@ -133,7 +141,7 @@ const alarmColumns = [
|
|
|
},
|
|
|
{
|
|
|
label: '告警内容', prop: 'warnContent', width: '180', convertFn: (data) => {
|
|
|
- return data ? data.trim() : ''
|
|
|
+ return data ? alarmType.value[Number(data)] : ''
|
|
|
}
|
|
|
},
|
|
|
]
|
|
@@ -150,7 +158,6 @@ function getAlarmList() {
|
|
|
if (res.status == 200) {
|
|
|
alarmData.push(...res.data.records)
|
|
|
}
|
|
|
- // initPoints()
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -235,10 +242,53 @@ async function reloadLeft1() {
|
|
|
left1Ref.value.loadChart(option)
|
|
|
}
|
|
|
|
|
|
+function getFrequency() {
|
|
|
+ getTaskRead(route.params.stcd).then(res => {
|
|
|
+ frequency.value = res.data.hour.split(',')
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+function handleFrequencyChange(value) {
|
|
|
+ ElMessageBox.confirm('是否要修改监测频率?', '修改检测频率',
|
|
|
+ {
|
|
|
+ confirmButtonText: '确认',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .then(() => setTaskRead(route.params.stcd, value))
|
|
|
+ .then(() => {
|
|
|
+ ElMessage({type: 'success', message: '检测频率修改成功'})
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ ElMessage({type: 'info', message: '检测频率修改失败',})
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+function handleRunTest() {
|
|
|
+ ElMessageBox.confirm('是否要运行水质测验?水质测验需要2小时.', '执行水质测验',
|
|
|
+ {
|
|
|
+ confirmButtonText: '确认',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .then(() => runTest(route.params.stcd))
|
|
|
+ .then(() => {
|
|
|
+ ElMessage({type: 'success', message: '运行水质测验成功'})
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ ElMessage({type: 'info', message: '运行水质测验失败',})
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
reloadLeft1()
|
|
|
getAlarmList()
|
|
|
deviceStatus()
|
|
|
+ getFrequency()
|
|
|
+ getLatestWaterQuality()
|
|
|
})
|
|
|
|
|
|
onUnmounted(() => {
|
|
@@ -285,13 +335,20 @@ bus.on('test_simulation', (data) => {
|
|
|
<card01 style="height: 65%" title="监测流程">
|
|
|
<el-form label-width="auto">
|
|
|
<el-form-item label="检测频率">
|
|
|
- <el-select v-model="frequency" multiple placeholder="Select" style="width: 240px">
|
|
|
- <el-option v-for="item in 24" :key="item" :label="item + '时'" :value="item"></el-option>
|
|
|
- <template #tag>
|
|
|
- <el-tag v-for="color in frequency" :key="color" color="#4167F0" style="color: #fff;">{{ color + '时' }}
|
|
|
- </el-tag>
|
|
|
- </template>
|
|
|
- </el-select>
|
|
|
+ <div style="width: 100%;display: flex;align-items: center;justify-content: space-between;">
|
|
|
+ <el-select v-model="frequency" multiple placeholder="Select" style="width: 200px"
|
|
|
+ @blur="handleFrequencyChange">
|
|
|
+ <el-option v-for="item in 24" :key="item" :label="item + '时'" :value="item"></el-option>
|
|
|
+ <template #tag>
|
|
|
+ <el-tag v-for="color in frequency" :key="color" color="#4167F0" style="color: #fff;">
|
|
|
+ {{ color + '时' }}
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+ </el-select>
|
|
|
+ <el-button :icon="VideoPlay" style="margin-left: 10px;width: 6rem;" type="primary" @click="handleRunTest">
|
|
|
+ 水质测验
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div :style="{ 'background-image': `url(${simulateSrc})`}" class="video-control-bar test-simulation">
|
|
@@ -302,7 +359,13 @@ bus.on('test_simulation', (data) => {
|
|
|
<icon v-if="testSimulationStatus != 0" :data="stop" class="video-btn" @click="handleTestSimulation('stop')"/>
|
|
|
</div>
|
|
|
<div>
|
|
|
- <h3>测验结果:</h3>
|
|
|
+ <h3 style="display: flex;align-items: center;justify-content: space-between;">
|
|
|
+ 测验结果:
|
|
|
+ <span style="font-size: 1rem;display: flex;align-items: center;">
|
|
|
+ <Timer style="width: 1em; height: 1em; margin-right: 8px"/>
|
|
|
+ {{ wqData.tm }}
|
|
|
+ </span>
|
|
|
+ </h3>
|
|
|
<DataTag :data="wqData"></DataTag>
|
|
|
</div>
|
|
|
</card01>
|