123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384 |
- <script lang="ts" setup>
- import {computed, onMounted, onUnmounted, ref} from 'vue'
- import {useRoute} from 'vue-router'
- import RightFrame from '@/components/RightFrame.vue'
- import Card01 from '@/components/card/Card01.vue'
- import StripeTable from '@/components/StripeTable.vue'
- import {getDeviceByName, getDeviceTypeByName} from '@/utils/device'
- import Chart from '@/components/Chart.vue'
- import StationRightButtonGroup from '@/components/StationRightButtonGroup.vue'
- import {Label, View} from "@/utils/tdInstruction";
- import GwVideo from "@/components/Video/index.vue";
- import {getVideoCodeByMark} from "@/components/Video/video";
- import WaterQualityAnalysis from "@/components/DeviceComponent/WaterQualityAnalysis.vue";
- import WaterLevel from "@/components/DeviceComponent/WaterLevel.vue";
- import Rainfall from "@/components/DeviceComponent/Rainfall.vue";
- import AdcpFlow from "@/components/DeviceComponent/AdcpFlow.vue";
- const route = useRoute()
- const right3Ref = ref(null)
- const device = ref(getDeviceByName(route.params.deviceid) || {})
- // 根据仪器类型展示信息 video、waterLevel、flow、rainfall、waterQuality、default
- const deviceType = computed(() => getDeviceTypeByName(route.params.deviceid))
- const deviceDetail = computed(() => device && device.detail ? device.detail.split('\n') : [])
- // 视频图片
- const videoImageSrc = new URL('@/assets/images/tmp/jiankong.png', import.meta.url).href
- // 获取视频CODE
- const videoCode = ref(getVideoCodeByMark(route.params.stcd + '', "室外"))
- const deviceStatusColumns = [
- {label: '维护信息', prop: 'deviceName', width: '100'},
- {label: '维护人员', prop: 'woker', width: '90'},
- {label: '维护日期', prop: 'updateTm'},
- {label: '状态', prop: 'status', width: '70'}
- ]
- const deviceStatusData = [
- {deviceName: '总磷分析仪', woker: '陈标', updateTm: '11-20 15:00:00', status: '正常'},
- {deviceName: '总氮分析仪', woker: '于奇', updateTm: '11-20 15:00:00', status: '正常'},
- {deviceName: '水位计', woker: '张孝荣', updateTm: '11-20 15:00:00', status: '正常'},
- {deviceName: '氨氮分析仪', woker: '张孝荣', updateTm: '11-20 15:00:00', status: '正常'}
- ]
- const accessoriesColumns = [
- {label: '耗材名称', prop: 'name', width: '110'},
- {label: '剩余有效期', prop: 'days', width: '110'},
- {label: '到期时间', prop: 'updateTm'}
- ]
- const accessoriesData = [
- {name: '1-16泵管', days: 120, updateTm: '11-20 15:00:00'},
- {name: '试管', days: 20, updateTm: '11-20 15:00:00'},
- {name: '滴定管', days: 90, updateTm: '11-20 15:00:00'},
- {name: '3-16泵管', days: 65, updateTm: '11-20 15:00:00'},
- {name: '瓶子', days: 102, updateTm: '11-20 15:00:00'}
- ]
- const reagentColumns = [
- {label: '试剂名称', prop: 'name'},
- {label: '添加体积', prop: 'volume', width: '110'},
- {label: '更换时间', prop: 'updateTm', width: '110'}
- ]
- const reagentData = [
- {name: '硫酸溶液', volume: 2, updateTm: '11-20 15:00:00'},
- {name: '高锰酸钾溶液', volume: 1, updateTm: '11-20 15:00:00'},
- {name: '草酸钠溶液', volume: 3, updateTm: '11-20 15:00:00'},
- {name: '去离子水', volume: 2, updateTm: '11-20 15:00:00'}
- ]
- // function reloadRight3(list) {
- // if (!list || list.length === 0) {
- // return
- // }
- //
- // const typeSet = new Set()
- // const times = []
- // list.forEach((item, index) => {
- // Object.keys(item).forEach(key => typeSet.add(key))
- // times.push(item['maintainDate'] || index + 1)
- // })
- // typeSet.delete('maintainDate')
- // const types = Array.from(typeSet)
- // const rawData = []
- // types.forEach(t => {
- // let array = []
- // list.forEach(d => array.push(d[t] || 0))
- // rawData.push(array)
- // })
- // const totalData = []
- // for (let i = 0; i < rawData[0].length; ++i) {
- // let sum = 0
- // for (let j = 0; j < rawData.length; ++j) {
- // sum += Number(rawData[j][i])
- // }
- // totalData.push(sum)
- // }
- // const grid = {
- // left: 10,
- // right: 10,
- // top: 50,
- // bottom: 10,
- // containLabel: true
- // }
- // const series = types.map((name, sid) => {
- // return {
- // name,
- // type: 'bar',
- // stack: 'total',
- // barWidth: '60%',
- // label: { show: false },
- // data: rawData[sid]
- // }
- // })
- // series.push({
- // name: '总计',
- // type: 'bar',
- // stack: 'total',
- // label: {
- // show: true,
- // position: 'top',
- // color: '#fff',
- // formatter: params => totalData[params.dataIndex] + '个'
- // },
- // data: totalData.map(t => 0)
- // })
- // let maxValue = totalData.reduce((a, b) => Math.max(a, b))
- // const option = {
- // tooltip: {
- // trigger: 'axis',
- // axisPointer: {
- // type: 'shadow'
- // },
- // formatter(params) {
- // let circle = `<span style="display:inline-block;margin-right:5px;border-radius:50%;width:10px;height:10px;left:5px;background-color:`
- // let info = params[0].axisValueLabel
- // for (let i = 0; i < params.length; i++) {
- // let param = params[i]
- // if (i === params.length - 1) {
- // info += `<br/>${circle}${param.color}"></span> ${param.seriesName}: ${totalData[param.dataIndex]}个`
- // } else {
- // if (param.value > 0) {
- // info += `<br/>${circle}${param.color}"></span> ${param.seriesName}: ${param.value}个`
- // }
- // }
- // }
- // return info
- // }
- // },
- // legend: {
- // type: 'scroll',
- // icon: 'circle',
- // data: types,
- // selectedMode: false,
- // textStyle: {
- // color: '#fff'
- // }
- // },
- // grid,
- // yAxis: {
- // type: 'value',
- // name: '个',
- // nameTextStyle: {
- // color: '#fff'
- // },
- // minInterval: 1,
- // interval: Math.ceil(maxValue / 5),
- // axisLabel: {
- // color: '#fff'
- // }
- // },
- // xAxis: {
- // type: 'category',
- // axisLabel: {
- // color: '#fff'
- // },
- // data: times
- // },
- // series
- // }
- // right3Ref.value.loadChart(option)
- // }
- function reloadRight3() {
- const option = {
- // backgroundColor: "#0B2D55",
- tooltip: {
- axisPointer: {
- type: 'cross'
- }
- },
- grid: {
- top: '14%',
- left: '2%',
- right: '4%',
- bottom: '5%',
- containLabel: true
- },
- xAxis: [{
- type: 'category',
- axisLine: { // 坐标轴轴线相关设置。数学上的x轴
- show: true,
- lineStyle: {
- color: '#233e64'
- }
- },
- axisLabel: { // 坐标轴刻度标签的相关设置
- color: '#02cacf'
- },
- axisTick: {show: false},
- data: ['1-16氯管', 'p3-16氯管', '3-16氯管']
- }],
- yAxis: [{
- name: '个',
- nameTextStyle: {
- color: '#02cacf'
- },
- min: value => (value.min - 1).toFixed(0),
- max: value => (value.max + 1).toFixed(0),
- axisLabel: {
- margin: 20,
- color: '#02cacf'
- },
- splitLine: {
- show: true,
- lineStyle: {
- color: '#233e64'
- }
- },
- axisLine: {
- show: true
- }
- }],
- series: [{
- name: '数量',
- type: 'bar',
- itemStyle: {
- color: function (params) {
- // 根据params的
- const colorsMap = [
- '#4768ec',
- '#92da76',
- '#dc8a5e'
- ]
- //返回对应的颜色
- return colorsMap[params.dataIndex]
- }
- },
- barWidth: 50,
- label: {
- show: true,
- position: 'top'
- },
- data: [3, 5, 6]
- }
- ]
- }
- right3Ref.value.loadChart(option)
- }
- onMounted(() => {
- // reloadRight3([])
- // reloadRight3()
- })
- onUnmounted(() => {
- // 关闭水质仪器视角
- if (deviceType.value === 'waterQuality') {
- View.closeDeviceView(route.params.stcd)
- }
- // 关闭 adcp 特效与弹窗
- if (device.value.ueDeviceName === "H-ADCP") {
- Label.setStationLabel(route.params.stcd, 'ADCP弹框', false)
- Label.adcpfx(route.params.stcd, false)
- }
- })
- </script>
- <template>
- <right-frame>
- <template #leftModule>
- <template v-if="['rainfall', 'flow','waterLevel'].includes(deviceType)">
- <card01 :title="device.deviceName" style="height: 65%">
- <h4 style="color: #00ccff">设备简介</h4>
- <el-row>
- <el-col :span="16">
- <p v-for="text in deviceDetail" class="introduce-text" v-html="text"></p>
- </el-col>
- <el-col :span="8">
- <img v-if="device.img" :src="device.img" alt="" class="introduce-float-img"/>
- </el-col>
- </el-row>
- <h4 style="color: #00ccff">维护记录</h4>
- <p>维护日期:2024年11月20日</p>
- <p>维护内容:</p>
- <p>·清洗采样过滤头及管路,检查位置确保采样顺利。</p>
- <p>·检查电源线路,确保干燥和稳定。</p>
- <p>·校准仪器,确保测量准确性。</p>
- </card01>
- <card01 style="height: 40%" title="设备维护情况">
- <stripe-table :columns="deviceStatusColumns" :data="deviceStatusData"></stripe-table>
- </card01>
- </template>
- <template v-if="deviceType === 'waterQuality'">
- <card01 :title="device.deviceName" style="height: 65%">
- <h4 style="color: #00ccff">设备简介</h4>
- <el-row>
- <el-col :span="16">
- <p v-for="text in deviceDetail" class="introduce-text" v-html="text"></p>
- </el-col>
- <el-col :span="8">
- <img v-if="device.img" :src="device.img" alt="" class="introduce-float-img"/>
- </el-col>
- </el-row>
- <h4 style="color: #00ccff">维护记录</h4>
- <p>维护日期:2024年11月20日</p>
- <p>维护内容:</p>
- <p>·清洗采样过滤头及管路,检查位置确保采样顺利。</p>
- <p>·检查电源线路,确保干燥和稳定。</p>
- <p>·校准仪器,确保测量准确性。</p>
- </card01>
- <card01 style="height: 40%" title="水质监测">
- <water-quality-analysis></water-quality-analysis>
- </card01>
- </template>
- </template>
- <template #rightModule>
- <template v-if="deviceType=== 'default'">
- <card01 :title="device.deviceName" style="height: 65%">
- <h4 style="color: #00ccff">设备简介</h4>
- <el-row>
- <el-col :span="16">
- <p v-for="text in deviceDetail" class="introduce-text" v-html="text"></p>
- </el-col>
- <el-col :span="8">
- <img v-if="device.img" :src="device.img" alt="" class="introduce-float-img"/>
- </el-col>
- </el-row>
- <h4 style="color: #00ccff">维护记录</h4>
- <p>维护日期:2024年11月20日</p>
- <p>维护内容:</p>
- <p>·清洗采样过滤头及管路,检查位置确保采样顺利。</p>
- <p>·检查电源线路,确保干燥和稳定。</p>
- <p>·校准仪器,确保测量准确性。</p>
- </card01>
- <card01 style="height: 40%" title="设备维护情况">
- <stripe-table :columns="deviceStatusColumns" :data="deviceStatusData"></stripe-table>
- </card01>
- </template>
- <template v-if="deviceType=== 'video'">
- <card01 style="height: 40%" title="视频监控">
- <gw-video :code="videoCode" :imageSrc="videoImageSrc"></gw-video>
- </card01>
- </template>
- <template v-if="deviceType=== 'waterLevel'">
- <card01 style="height: 36%" title="水位监测">
- <water-level></water-level>
- </card01>
- </template>
- <template v-if="deviceType=== 'rainfall'">
- <card01 style="height: 36%" title="雨量监测">
- <rainfall></rainfall>
- </card01>
- </template>
- <template v-if="deviceType=== 'flow'">
- <card01 style="height: 36%" title="流量监测">
- <adcp-flow></adcp-flow>
- <!-- <adcp-flow v-if="device.ueDeviceName === '无人船'"></adcp-flow>-->
- <!-- <flow v-else></flow>-->
- </card01>
- </template>
- <template v-if="deviceType=== 'waterQuality'">
- <card01 style="height: 33%" title="设备维护情况">
- <stripe-table :columns="deviceStatusColumns" :data="deviceStatusData"></stripe-table>
- </card01>
- <card01 style="height: 33%" title="配件运维信息">
- <stripe-table :columns="accessoriesColumns" :data="accessoriesData"></stripe-table>
- </card01>
- <card01 style="height: 33%" title="耗材余量监控">
- <chart ref="right3Ref"></chart>
- </card01>
- </template>
- </template>
- <template #btnGroup>
- <station-right-button-group></station-right-button-group>
- </template>
- </right-frame>
- </template>
- <style lang="scss" scoped>
- @use "@/assets/styles/introduce.scss";
- </style>
|