|
@@ -1,51 +1,51 @@
|
|
|
<script lang="ts" setup>
|
|
|
-import {onMounted, 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} from "@/utils/device";
|
|
|
-import Chart from "@/components/Chart.vue";
|
|
|
+import { onMounted, 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 } from '@/utils/device'
|
|
|
+import Chart from '@/components/Chart.vue'
|
|
|
|
|
|
const route = useRoute()
|
|
|
const right3Ref = ref(null)
|
|
|
-const device = ref(getDeviceByName("高锰酸盐指数分析仪"))
|
|
|
+const device = ref(getDeviceByName('高锰酸盐指数分析仪'))
|
|
|
|
|
|
|
|
|
const deviceStatusColumns = [
|
|
|
- {label: '设备名称', prop: 'name'},
|
|
|
- {label: '设备位置', prop: 'loc', width: '110'},
|
|
|
- {label: '设备状态', prop: 'status', width: '110'},
|
|
|
+ { label: '试剂名称', prop: 'name' },
|
|
|
+ { label: '添加体积', prop: 'volume', width: '110' },
|
|
|
+ { label: '更换时间', prop: 'updateTm', width: '110' }
|
|
|
]
|
|
|
+
|
|
|
const deviceStatusData = [
|
|
|
- {name: '总磷分析仪', loc: '100米', status: '正常'},
|
|
|
- {name: '总氮分析仪', loc: '100米', status: '正常'},
|
|
|
- {name: '水位计', loc: '100米', status: '正常'},
|
|
|
- {name: '氢氮分析仪', loc: '100米', status: '正常'},
|
|
|
+ { name: '总磷分析仪', volume: 2, updateTm: '11-20 15:00:00' },
|
|
|
+ { name: '总氮分析仪', volume: 2, updateTm: '11-20 15:00:00' },
|
|
|
+ { name: '水位计', volume: 2, updateTm: '11-20 15:00:00' },
|
|
|
+ { name: '氢氮分析仪', volume: 2, updateTm: '11-20 15:00:00' }
|
|
|
]
|
|
|
-
|
|
|
const accessoriesColumns = [
|
|
|
- {label: '设备名称', prop: 'name'},
|
|
|
- {label: '设备位置', prop: 'loc', width: '110'},
|
|
|
- {label: '设备状态', prop: 'status', width: '110'},
|
|
|
+ { label: '试剂名称', prop: 'name' },
|
|
|
+ { label: '添加体积', prop: 'volume', width: '110' },
|
|
|
+ { label: '更换时间', prop: 'updateTm', width: '110' }
|
|
|
]
|
|
|
const accessoriesData = [
|
|
|
- {name: '总磷分析仪', loc: '100米', status: '正常'},
|
|
|
- {name: '总氮分析仪', loc: '100米', status: '正常'},
|
|
|
- {name: '水位计', loc: '100米', status: '正常'},
|
|
|
- {name: '氢氮分析仪', loc: '100米', status: '正常'},
|
|
|
+ { name: '总磷分析仪', volume: 2, updateTm: '11-20 15:00:00' },
|
|
|
+ { name: '总氮分析仪', volume: 2, updateTm: '11-20 15:00:00' },
|
|
|
+ { name: '水位计', volume: 2, updateTm: '11-20 15:00:00' },
|
|
|
+ { name: '氢氮分析仪', volume: 2, updateTm: '11-20 15:00:00' }
|
|
|
]
|
|
|
|
|
|
const reagentColumns = [
|
|
|
- {label: '设备名称', prop: 'name'},
|
|
|
- {label: '设备位置', prop: 'loc', width: '110'},
|
|
|
- {label: '设备状态', prop: 'status', width: '110'},
|
|
|
+ { label: '试剂名称', prop: 'name' },
|
|
|
+ { label: '添加体积', prop: 'volume', width: '110' },
|
|
|
+ { label: '更换时间', prop: 'updateTm', width: '110' }
|
|
|
]
|
|
|
const reagentData = [
|
|
|
- {name: '总磷分析仪', loc: '100米', status: '正常'},
|
|
|
- {name: '总氮分析仪', loc: '100米', status: '正常'},
|
|
|
- {name: '水位计', loc: '100米', status: '正常'},
|
|
|
- {name: '氢氮分析仪', loc: '100米', status: '正常'},
|
|
|
+ { name: '总磷分析仪', volume: 2, updateTm: '11-20 15:00:00' },
|
|
|
+ { name: '总氮分析仪', volume: 2, updateTm: '11-20 15:00:00' },
|
|
|
+ { name: '水位计', volume: 2, updateTm: '11-20 15:00:00' },
|
|
|
+ { name: '氢氮分析仪', volume: 2, updateTm: '11-20 15:00:00' }
|
|
|
]
|
|
|
|
|
|
function reloadRight3(list) {
|
|
@@ -55,25 +55,26 @@ function reloadRight3(list) {
|
|
|
|
|
|
const typeSet = new Set()
|
|
|
const times = []
|
|
|
+ debugger
|
|
|
list.forEach((item, index) => {
|
|
|
Object.keys(item).forEach(key => typeSet.add(key))
|
|
|
times.push(item['maintainDate'] || index + 1)
|
|
|
})
|
|
|
- typeSet.delete('maintainDate');
|
|
|
+ typeSet.delete('maintainDate')
|
|
|
const types = Array.from(typeSet)
|
|
|
- const rawData = [];
|
|
|
+ const rawData = []
|
|
|
types.forEach(t => {
|
|
|
let array = []
|
|
|
list.forEach(d => array.push(d[t] || 0))
|
|
|
rawData.push(array)
|
|
|
})
|
|
|
- const totalData = [];
|
|
|
+ const totalData = []
|
|
|
for (let i = 0; i < rawData[0].length; ++i) {
|
|
|
- let sum = 0;
|
|
|
+ let sum = 0
|
|
|
for (let j = 0; j < rawData.length; ++j) {
|
|
|
- sum += Number(rawData[j][i]);
|
|
|
+ sum += Number(rawData[j][i])
|
|
|
}
|
|
|
- totalData.push(sum);
|
|
|
+ totalData.push(sum)
|
|
|
}
|
|
|
const grid = {
|
|
|
left: 10,
|
|
@@ -81,17 +82,17 @@ function reloadRight3(list) {
|
|
|
top: 50,
|
|
|
bottom: 10,
|
|
|
containLabel: true
|
|
|
- };
|
|
|
+ }
|
|
|
const series = types.map((name, sid) => {
|
|
|
return {
|
|
|
name,
|
|
|
type: 'bar',
|
|
|
stack: 'total',
|
|
|
barWidth: '60%',
|
|
|
- label: {show: false,},
|
|
|
+ label: { show: false },
|
|
|
data: rawData[sid]
|
|
|
- };
|
|
|
- });
|
|
|
+ }
|
|
|
+ })
|
|
|
series.push({
|
|
|
name: '总计',
|
|
|
type: 'bar',
|
|
@@ -104,7 +105,7 @@ function reloadRight3(list) {
|
|
|
},
|
|
|
data: totalData.map(t => 0)
|
|
|
})
|
|
|
- let maxValue = totalData.reduce((a, b) => Math.max(a, b));
|
|
|
+ let maxValue = totalData.reduce((a, b) => Math.max(a, b))
|
|
|
const option = {
|
|
|
tooltip: {
|
|
|
trigger: 'axis',
|
|
@@ -112,19 +113,19 @@ function reloadRight3(list) {
|
|
|
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 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];
|
|
|
+ let param = params[i]
|
|
|
if (i === params.length - 1) {
|
|
|
- info += `<br/>${circle}${param.color}"></span> ${param.seriesName}: ${totalData[param.dataIndex]}个`;
|
|
|
+ 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}个`;
|
|
|
+ info += `<br/>${circle}${param.color}"></span> ${param.seriesName}: ${param.value}个`
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return info;
|
|
|
+ return info
|
|
|
}
|
|
|
},
|
|
|
legend: {
|
|
@@ -134,30 +135,30 @@ function reloadRight3(list) {
|
|
|
selectedMode: false,
|
|
|
textStyle: {
|
|
|
color: '#fff'
|
|
|
- },
|
|
|
+ }
|
|
|
},
|
|
|
grid,
|
|
|
yAxis: {
|
|
|
type: 'value',
|
|
|
name: '个',
|
|
|
nameTextStyle: {
|
|
|
- color: '#fff',
|
|
|
+ color: '#fff'
|
|
|
},
|
|
|
minInterval: 1,
|
|
|
interval: Math.ceil(maxValue / 5),
|
|
|
axisLabel: {
|
|
|
- color: '#fff',
|
|
|
- },
|
|
|
+ color: '#fff'
|
|
|
+ }
|
|
|
},
|
|
|
xAxis: {
|
|
|
type: 'category',
|
|
|
axisLabel: {
|
|
|
- color: '#fff',
|
|
|
+ color: '#fff'
|
|
|
},
|
|
|
data: times
|
|
|
},
|
|
|
series
|
|
|
- };
|
|
|
+ }
|
|
|
right3Ref.value.loadChart(option)
|
|
|
}
|
|
|
|
|
@@ -170,9 +171,22 @@ onMounted(() => {
|
|
|
<template>
|
|
|
<right-frame>
|
|
|
<template #leftModule>
|
|
|
- <card01 :title="device.name" style="height: 60%">
|
|
|
- <p v-for="text in device.detail.split('\n')" class="introduce-text" v-html="text"></p>
|
|
|
- <img v-if="device.img" :src="device.img" alt="" class="introduce-float-img"/>
|
|
|
+ <card01 :title="device.name" style="height: 65%">
|
|
|
+ <h4 style="color: #00ccff">设备简介</h4>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="16">
|
|
|
+ <p v-for="text in device.detail.split('\n')" 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>
|