Browse Source

feat: 细节调整

feature-with-login
wally 4 years ago
parent
commit
f5d3f91fe3
  1. 8
      src/components/config/function-config-applied.vue
  2. 4
      src/components/history/device.vue
  3. 4
      src/components/history/local.vue
  4. 78
      src/config/chart.js
  5. 3
      src/utils/statistical.js
  6. 4
      src/views/data-realtime.vue

8
src/components/config/function-config-applied.vue

@ -41,10 +41,10 @@
<span>温度高阈值()</span>
<span>{{ data.temperatureHigh }}</span>
</el-col>
<el-col :lg="8" :md="12" :xl="6" :xs="24" class="text-sm text-gray-500 py-3">
<span>金属腐蚀采集个数</span>
<span>{{ data.count }}</span>
</el-col>
<!-- <el-col :lg="8" :md="12" :xl="6" :xs="24" class="text-sm text-gray-500 py-3">-->
<!-- <span>金属腐蚀采集个数</span>-->
<!-- <span>{{ data.count }}</span>-->
<!-- </el-col>-->
<el-col :lg="8" :md="12" :xl="6" :xs="24" class="text-sm text-gray-500 py-3">
<span>安全模式</span>

4
src/components/history/device.vue

@ -4,12 +4,12 @@
<template v-if="data">
<el-table :data="data" :max-height="contentHeight" border stripe style="width: 100%">
<el-table-column align="center" fixed label="设备ID" min-width="80" prop="deviceId" />
<el-table-column align="center" label="采集时间" min-width="170">
<el-table-column align="center" fixed label="采集时间" min-width="170">
<template #default="scope">
{{ formatTime(+scope.row.time) }}
</template>
</el-table-column>
<el-table-column align="center" label="后台接收时间" min-width="170">
<el-table-column align="center" fixed label="后台接收时间" min-width="170">
<template #default="scope">
{{ formatTime(+scope.row.createdAt) }}
</template>

4
src/components/history/local.vue

@ -4,12 +4,12 @@
<template v-if="data">
<el-table :data="data" :max-height="contentHeight" border stripe style="width: 100%">
<el-table-column align="center" fixed label="设备ID" min-width="80" prop="deviceId" />
<el-table-column align="center" label="采集时间" min-width="170">
<el-table-column align="center" fixed label="采集时间" min-width="170">
<template #default="scope">
{{ formatTime(+scope.row.time) }}
</template>
</el-table-column>
<el-table-column align="center" label="后台接收时间" min-width="170">
<el-table-column align="center" fixed label="后台接收时间" min-width="170">
<template #default="scope">
{{ formatTime(+scope.row.createdAt) }}
</template>

78
src/config/chart.js

@ -1,16 +1,64 @@
/* eslint-disable max-len */
export const colors = ['#5470C6', '#91CC75', '#EE6666', '#5470C6', '#91CC75', '#EE6666', '#5470C6', '#91CC75', '#5470C6'];
export const colors = ['#EAB308', '#F97316', '#EC4899', '#F43F5E', '#D946EF', '#06B6D4', '#0EA5E9', '#3B82F6', '#6366F1'];
export const itemColor = {
'钢腐蚀电流(nA)': colors[5],
'铜腐蚀电流(nA)': colors[6],
'铝腐蚀电流(nA)': colors[7],
'锌腐蚀电流(nA)': colors[8],
'SO2(ppb)': colors[0],
'盐分阻抗(Ω)': colors[1],
'盐分温度(℃)': colors[2],
'环境温度(℃)': colors[3],
'环境湿度(RH%)': colors[4],
};
export const legendData = [
'SO2(ppb)',
'盐分阻抗(Ω)',
'盐分温度(℃)',
'环境温度(℃)',
'环境湿度(RH%)',
'锌腐蚀电流(nA)',
'铜腐蚀电流(nA)',
'铝腐蚀电流(nA)',
'钢腐蚀电流(nA)',
{
name: 'SO2(ppb)',
itemStyle: { color: colors[0] },
listStyle: { color: colors[0] },
},
{
name: '盐分阻抗(Ω)',
itemStyle: { color: colors[1] },
listStyle: { color: colors[1] },
},
{
name: '盐分温度(℃)',
itemStyle: { color: colors[2] },
listStyle: { color: colors[2] },
},
{
name: '环境温度(℃)',
itemStyle: { color: colors[3] },
listStyle: { color: colors[3] },
},
{
name: '环境湿度(RH%)',
itemStyle: { color: colors[4] },
listStyle: { color: colors[4] },
},
{
name: '锌腐蚀电流(nA)',
itemStyle: { color: colors[5] },
listStyle: { color: colors[5] },
},
{
name: '铜腐蚀电流(nA)',
itemStyle: { color: colors[6] },
listStyle: { color: colors[6] },
},
{
name: '铝腐蚀电流(nA)',
itemStyle: { color: colors[7] },
listStyle: { color: colors[7] },
},
{
name: '钢腐蚀电流(nA)',
itemStyle: { color: colors[8] },
listStyle: { color: colors[8] },
},
];
// 默认legend select
@ -35,7 +83,7 @@ export const yAxisData = [
position: 'left',
axisLine: {
show: true,
lineStyle: { color: colors[0] },
lineStyle: { color: colors[6] },
},
axisLabel: { formatter: '{value}' },
axisPointer: { show: false },
@ -47,7 +95,7 @@ export const yAxisData = [
position: 'right',
axisLine: {
show: true,
lineStyle: { color: colors[1] },
lineStyle: { color: colors[3] },
},
axisLabel: { formatter: '{value}' },
axisPointer: { show: false },
@ -59,7 +107,7 @@ export const yAxisData = [
position: 'right',
axisLine: {
show: true,
lineStyle: { color: colors[2] },
lineStyle: { color: colors[4] },
},
axisLabel: { formatter: '{value}' },
axisPointer: { show: false },
@ -72,7 +120,7 @@ export const yAxisData = [
offset: 150,
axisLine: {
show: true,
lineStyle: { color: colors[3] },
lineStyle: { color: colors[0] },
},
axisLabel: { formatter: '{value}' },
axisPointer: { show: false },
@ -85,7 +133,7 @@ export const yAxisData = [
offset: 220,
axisLine: {
show: true,
lineStyle: { color: colors[4] },
lineStyle: { color: colors[1] },
},
axisLabel: { formatter: '{value}' },
axisPointer: { show: false },

3
src/utils/statistical.js

@ -2,7 +2,7 @@
import dayjs from 'dayjs';
import max from 'lodash/max';
import isNaN from 'lodash/isNaN';
import { colors, generateDefaultSeries, legendData, yAxisData } from '@/config/chart';
import { colors, generateDefaultSeries, itemColor, legendData, yAxisData } from '@/config/chart';
/**
* 生成chart所需参数
@ -98,6 +98,7 @@ function generateSeries(data, yAxis) {
const hideArr = seriesArr.filter(item => !yAxis.find(y => y.name === item.name));
const result = [...showArr, ...hideArr];
result.forEach(item => {
item.itemStyle = { color: itemColor[item.name] };
if (item.name.includes('电流')) {
item.yAxisIndex = 0;
} else if (item.name.includes('温度')) {

4
src/views/data-realtime.vue

@ -4,12 +4,12 @@
<template v-if="data">
<el-table :data="data" :max-height="contentHeight" border stripe style="width: 100%">
<el-table-column align="center" fixed label="设备ID" min-width="80" prop="deviceId" />
<el-table-column align="center" label="采集时间" min-width="170">
<el-table-column align="center" fixed label="采集时间" min-width="170">
<template #default="scope">
{{ formatTime(+scope.row.time) }}
</template>
</el-table-column>
<el-table-column align="center" label="后台接收时间" min-width="170">
<el-table-column align="center" fixed label="后台接收时间" min-width="170">
<template #default="scope">
{{ formatTime(+scope.row.createdAt) }}
</template>

Loading…
Cancel
Save