修改测试问题
This commit is contained in:
@@ -852,7 +852,7 @@ queryByCode('Device_Type').then(res => {
|
||||
})
|
||||
})
|
||||
const echoName = (value: any, arr: any[]) => {
|
||||
return value ? arr.find(item => item.value == value).label : '/'
|
||||
return value ? arr.find(item => item.value == value)?.label : '/'
|
||||
}
|
||||
|
||||
onMounted(() => {})
|
||||
|
||||
@@ -150,6 +150,7 @@ defineExpose({ getWpData })
|
||||
height: 50px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.el-select {
|
||||
width: 200px !important;
|
||||
|
||||
@@ -91,6 +91,7 @@ const tableStore: any = new TableStore({
|
||||
row.loading = false
|
||||
if (res != undefined) {
|
||||
boxoList.value = row
|
||||
boxoList.value.systemType = 'WX'
|
||||
wp.value = res.data
|
||||
view.value = false
|
||||
view2.value = true
|
||||
@@ -104,6 +105,18 @@ const tableStore: any = new TableStore({
|
||||
waveFormAnalysisRef.value && waveFormAnalysisRef.value.getWpData(wp.value, boxoList.value)
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'edit',
|
||||
text: '暂无波形',
|
||||
type: 'info',
|
||||
icon: 'el-icon-DataLine',
|
||||
render: 'basicButton',
|
||||
disabled: row => {
|
||||
return row.wavePath
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ import { position } from 'html2canvas/dist/types/css/property-descriptors/positi
|
||||
import { read, writeFile, utils } from 'xlsx'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import Table from '@/components/table/index.vue'
|
||||
import { yMethod } from '@/utils/echartMethod'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import { getTabsDataByType } from '@/api/cs-device-boot/EquipmentDelivery'
|
||||
import DatePicker from '@/components/form/datePicker/index.vue'
|
||||
@@ -183,271 +184,155 @@ const init = async () => {
|
||||
.then((res: any) => {
|
||||
if (res.code == 'A0000') {
|
||||
historyDataList.value = res.data
|
||||
echartsData.value = null
|
||||
let chartsList = JSON.parse(JSON.stringify(res.data))
|
||||
echartsData.value = {}
|
||||
//icon图标替换legend图例
|
||||
const iconThree =
|
||||
'path://M512 85.333333c235.637333 0 426.666667 191.029333 426.666667 426.666667S747.637333 938.666667 512 938.666667 85.333333 747.637333 85.333333 512 276.362667 85.333333 512 85.333333z m214.592 318.677334a32 32 0 0 0-45.248 0.064L544.736 541.066667l-81.792-89.109334a32 32 0 0 0-46.613333-0.576l-119.36 123.733334a32 32 0 1 0 46.058666 44.437333l95.754667-99.264 81.418667 88.704a32 32 0 0 0 46.24 0.96l160.213333-160.693333a32 32 0 0 0-0.064-45.248z'
|
||||
const iconDanger =
|
||||
'path://M1001.661867 796.544c48.896 84.906667 7.68 157.013333-87.552 157.013333H110.781867c-97.834667 0-139.050667-69.504-90.112-157.013333l401.664-666.88c48.896-87.552 128.725333-87.552 177.664 0l401.664 666.88zM479.165867 296.533333v341.333334a32 32 0 1 0 64 0v-341.333334a32 32 0 1 0-64 0z m0 469.333334v42.666666a32 32 0 1 0 64 0v-42.666666a32 32 0 1 0-64 0z'
|
||||
|
||||
let xAxis: any = [],
|
||||
timeList: any = []
|
||||
// y轴单位数组
|
||||
let unitList: any = []
|
||||
historyDataList.value.map((item: any) => {
|
||||
timeList.push(item.time)
|
||||
if (unitList.indexOf(item.unit) == -1) {
|
||||
unitList.push(item.unit)
|
||||
|
||||
let groupedData = chartsList.reduce((acc, item) => {
|
||||
let key = item.anotherName;
|
||||
if (!acc[key]) {
|
||||
acc[key] = [];
|
||||
}
|
||||
})
|
||||
xAxis = timeList.sort((a: any, b: any) => {
|
||||
return new Date(a).getTime() - new Date(b).getTime()
|
||||
})
|
||||
echartsData.value = {
|
||||
options: {
|
||||
title: [
|
||||
{
|
||||
left: '10%',
|
||||
top: 0,
|
||||
text: chartTitle.value
|
||||
}
|
||||
],
|
||||
toolbox: {
|
||||
feature: {
|
||||
// saveAsImage: {
|
||||
// title: '保存'
|
||||
// },
|
||||
// dataView: { readOnly: false },
|
||||
// }
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
textStyle: {
|
||||
color: '#fff',
|
||||
fontStyle: 'normal',
|
||||
opacity: 0.35,
|
||||
fontSize: 14
|
||||
},
|
||||
backgroundColor: 'rgba(0,0,0,0.35)',
|
||||
borderWidth: 0,
|
||||
axisPointer: {
|
||||
type: 'cross',
|
||||
crossStyle: {
|
||||
color: '#999'
|
||||
}
|
||||
},
|
||||
|
||||
formatter: function (params: any) {
|
||||
let list = params.filter((item, index, self) => {
|
||||
return index === self.findIndex(t => t.seriesName === item.seriesName)
|
||||
})
|
||||
var res =
|
||||
'<span style="margin-right:18px;"></span>' +
|
||||
list[0].value[0] +
|
||||
list[0].name +
|
||||
'<br/>'
|
||||
for (var i = 0, l = list.length; i < l; i++) {
|
||||
list[i].unit =
|
||||
echartsData.value.options.yAxis[
|
||||
echartsData.value.options.series[list[i].seriesIndex].yAxisIndex
|
||||
]?.name
|
||||
res +=
|
||||
list[i].seriesName +
|
||||
' ' +
|
||||
`<div style="width:16px;height:16px;float:left;background:${list[i].color};border-radius:50%;margin:0 15px"></div>` +
|
||||
`<div style='float:right;padding-left:20px;'>${list[i].value[1]==null?'':list[i].value[1].toFixed(2)} ${list[i].unit || ''} </div><br/>`
|
||||
}
|
||||
return res
|
||||
}
|
||||
},
|
||||
|
||||
legend: {
|
||||
//legend使用iconfont图标
|
||||
data: [],
|
||||
itemWidth: 20,
|
||||
itemHeight: 10,
|
||||
itemGap: 15,
|
||||
type: 'scroll', // 开启滚动分页
|
||||
// orient: 'vertical', // 垂直排列
|
||||
right: '3%', // 位置调整
|
||||
top: 0,
|
||||
bottom: 20,
|
||||
width: 430,
|
||||
height: 50
|
||||
},
|
||||
|
||||
xAxis: {
|
||||
type: 'time',
|
||||
axisLabel: {
|
||||
formatter: {
|
||||
day: '{MM}-{dd}',
|
||||
month: '{MM}',
|
||||
year: '{yyyy}',
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
// [
|
||||
// {
|
||||
// type: 'category',
|
||||
// name: '时间',
|
||||
// axisLabel: {
|
||||
// color: '#A9AEB2',
|
||||
// fontSize: 12,
|
||||
// show: function (index: any, value: any) {
|
||||
// // 检查数据中是否存在这个时间点
|
||||
// // return data.some(item:any => item[0] === value)
|
||||
// }
|
||||
// },
|
||||
// nameTextStyle: {
|
||||
// right: 0
|
||||
// },
|
||||
// data: Array.from(new Set(xAxis)),
|
||||
// axisLine: {
|
||||
// lineStyle: {
|
||||
// color: '#43485E'
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// ],
|
||||
yAxis: [
|
||||
{
|
||||
type: 'value',
|
||||
name: unitList[0],
|
||||
axisLabel: {
|
||||
color: '#000',
|
||||
fontSize: 14
|
||||
},
|
||||
splitNumber: 5,
|
||||
minInterval: 1,
|
||||
axisTick: {
|
||||
show: true
|
||||
},
|
||||
axisLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: colorList[0]
|
||||
}
|
||||
},
|
||||
nameTextStyle: {
|
||||
color: '#000',
|
||||
fontSize: '14'
|
||||
},
|
||||
splitLine: {
|
||||
show: false,
|
||||
lineStyle: {
|
||||
color: ['#43485E'],
|
||||
width: 1,
|
||||
type: 'solid'
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
series: []
|
||||
}
|
||||
}
|
||||
//处理多y轴
|
||||
if (unitList.length != 0 && unitList.length > 1) {
|
||||
// echartsData.value.options.yAxis[0].yAxisIndex = 0
|
||||
unitList.map((item: any, index: any) => {
|
||||
if (index != unitList.length - 1) {
|
||||
echartsData.value.options.yAxis.push({
|
||||
type: 'value',
|
||||
position: 'right',
|
||||
offset: index * 80, // y轴位置的偏移量
|
||||
name: unitList[index + 1],
|
||||
axisLabel: {
|
||||
color: '#000',
|
||||
fontSize: 14
|
||||
},
|
||||
splitNumber: 5,
|
||||
minInterval: 1,
|
||||
axisTick: {
|
||||
show: true
|
||||
},
|
||||
axisLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: colorList[index + 1]
|
||||
}
|
||||
},
|
||||
nameTextStyle: {
|
||||
color: '#000',
|
||||
fontSize: '14'
|
||||
},
|
||||
splitLine: {
|
||||
show: false,
|
||||
lineStyle: {
|
||||
color: ['#43485E'],
|
||||
width: 1,
|
||||
type: 'solid'
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
acc[key].push(item);
|
||||
return acc;
|
||||
}, {})
|
||||
let result = Object.values(groupedData);
|
||||
if (chartsList.length > 0) {
|
||||
unitList = result.map((item: any) => {
|
||||
return item[0].unit
|
||||
})
|
||||
}
|
||||
|
||||
list.map((item: any, index: any) => {
|
||||
item.map((vv: any, indexs: any) => {
|
||||
//处理legend
|
||||
if (historyDataList.value.length != 0) {
|
||||
echartsData.value.options.legend.data.push({
|
||||
name: vv.phase + '相' + vv.showName,
|
||||
icon: iconThree
|
||||
})
|
||||
}
|
||||
if (
|
||||
unitList.findIndex((item: any) => {
|
||||
return item == vv.unit
|
||||
}) != -1
|
||||
) {
|
||||
vv.yAxisIndex = unitList.findIndex((item: any) => {
|
||||
return item == vv.unit
|
||||
})
|
||||
} else {
|
||||
vv.yAxisIndex = 0
|
||||
}
|
||||
echartsData.value = {
|
||||
legend: {
|
||||
|
||||
itemWidth: 20,
|
||||
itemHeight: 10,
|
||||
itemGap: 15,
|
||||
type: 'scroll', // 开启滚动分页
|
||||
// orient: 'vertical', // 垂直排列
|
||||
top: 5,
|
||||
bottom: 30,
|
||||
width: 400,
|
||||
height: 50
|
||||
},
|
||||
tooltip: {
|
||||
axisPointer: {
|
||||
type: 'cross',
|
||||
label: {
|
||||
color: '#fff',
|
||||
fontSize: 16
|
||||
}
|
||||
},
|
||||
textStyle: {
|
||||
color: '#fff',
|
||||
fontStyle: 'normal',
|
||||
opacity: 0.35,
|
||||
fontSize: 14
|
||||
},
|
||||
backgroundColor: 'rgba(0,0,0,0.35)',
|
||||
borderWidth: 0,
|
||||
formatter(params) {
|
||||
const xname = params[0].value[0];
|
||||
let str = `${xname}<br>`;
|
||||
params.forEach((el, index) => {
|
||||
str += `${el.marker}${el.seriesName.split('(')[0]}:${el.value[1]}${el.value[2]}<br>`;
|
||||
});
|
||||
return str;
|
||||
},
|
||||
|
||||
|
||||
//series数据
|
||||
echartsData.value.options.series.push({
|
||||
name: vv.phase + '相' + vv.showName,
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbol: 'none',
|
||||
emphasis: {
|
||||
focus: 'series'
|
||||
|
||||
|
||||
|
||||
},
|
||||
color: ['#FFCC00', '#009900', '#CC0000', ...color],
|
||||
xAxis: {
|
||||
type: 'time',
|
||||
axisLabel: {
|
||||
formatter: {
|
||||
day: '{MM}-{dd}',
|
||||
month: '{MM}',
|
||||
year: '{yyyy}'
|
||||
}
|
||||
}
|
||||
},
|
||||
yAxis: [{
|
||||
|
||||
}],
|
||||
|
||||
options: {
|
||||
series: [
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
if (chartsList.length > 0) {
|
||||
echartsData.value.yAxis = []
|
||||
unitList.forEach((item: any, index: any) => {
|
||||
let right = {
|
||||
position: 'right',
|
||||
offset: (index - 1) * 80,
|
||||
}
|
||||
echartsData.value.yAxis.push({
|
||||
name: item,
|
||||
yAxisIndex: index,
|
||||
splitNumber: 5,
|
||||
minInterval: 1,
|
||||
splitLine: {
|
||||
show: false,
|
||||
|
||||
},
|
||||
itemStyle: {},
|
||||
//数据
|
||||
data: historyDataList.value
|
||||
.map((kk: any) => {
|
||||
if (kk.statisticalName == vv.name) {
|
||||
|
||||
return [kk.time, kk.statisticalData]
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
})
|
||||
.filter((kk: any) => kk !== ''),
|
||||
//数据对应的y轴
|
||||
// yAxisIndex:0,
|
||||
yAxisIndex: vv.yAxisIndex
|
||||
...(index > 0 ? right : null)
|
||||
})
|
||||
})
|
||||
})
|
||||
//设置数据项颜色
|
||||
echartsData.value.options.series.map((item: any, index: any) => {
|
||||
item.itemStyle = {
|
||||
normal: {
|
||||
color: colorList[index],
|
||||
lineStyle: {
|
||||
color: colorList[index]
|
||||
|
||||
result.forEach((item: any, index: any) => {
|
||||
let yMethodList: any = []
|
||||
|
||||
let ABCList = Object.values(item.reduce((acc, item) => {
|
||||
let key = item.phase;
|
||||
if (!acc[key]) {
|
||||
acc[key] = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
acc[key].push(item);
|
||||
return acc;
|
||||
}, {}));
|
||||
ABCList.forEach((kk: any,) => {
|
||||
let seriesList: any = []
|
||||
kk.forEach((cc: any) => {
|
||||
if (cc.statisticalData) {
|
||||
yMethodList.push(cc.statisticalData?.toFixed(2) - 0)
|
||||
|
||||
}
|
||||
|
||||
seriesList.push([cc.time, cc.statisticalData?.toFixed(2),cc.unit])
|
||||
})
|
||||
|
||||
|
||||
echartsData.value.options.series.push({
|
||||
name: kk[0].phase + '相' + item[0].anotherName,
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbol: 'none',
|
||||
data: seriesList,
|
||||
yAxisIndex: index
|
||||
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
let [min, max] = yMethod(yMethodList)
|
||||
echartsData.value.yAxis[index].min = min
|
||||
echartsData.value.yAxis[index].max = max
|
||||
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
|
||||
@@ -424,7 +424,15 @@ const init = (flag: boolean) => {
|
||||
fontSize: 14
|
||||
},
|
||||
backgroundColor: 'rgba(0,0,0,0.35)',
|
||||
borderWidth: 0
|
||||
borderWidth: 0,
|
||||
formatter(params) {
|
||||
const xname = params[0].value[0];
|
||||
let str = `${xname}<br>`;
|
||||
params.forEach((el, index) => {
|
||||
str += `${el.marker}${el.seriesName.split('(')[0]}:${el.value[1]}${el.value[2]}<br>`;
|
||||
});
|
||||
return str;
|
||||
},
|
||||
},
|
||||
color: ['#FFCC00', '#009900', '#CC0000', ...color],
|
||||
xAxis: {
|
||||
@@ -448,66 +456,68 @@ const init = (flag: boolean) => {
|
||||
}
|
||||
}
|
||||
if (chartsList.length > 0) {
|
||||
echartsData.value.yAxis=[]
|
||||
unitList.forEach((item: any, index: any) => {
|
||||
let right = {
|
||||
position: 'right',
|
||||
offset: (index - 1) * 80,
|
||||
}
|
||||
echartsData.value.yAxis.push({
|
||||
name: item,
|
||||
yAxisIndex: index,
|
||||
splitLine: {
|
||||
show: false,
|
||||
|
||||
},
|
||||
...(index > 0 ? right : null)
|
||||
})
|
||||
})
|
||||
|
||||
result.forEach((item: any, index: any) => {
|
||||
let yMethodList: any = []
|
||||
|
||||
let ABCList = Object.values(item.reduce((acc, item) => {
|
||||
let key = item.phase;
|
||||
if (!acc[key]) {
|
||||
acc[key] = [];
|
||||
echartsData.value.yAxis = []
|
||||
unitList.forEach((item: any, index: any) => {
|
||||
let right = {
|
||||
position: 'right',
|
||||
offset: (index - 1) * 80,
|
||||
}
|
||||
acc[key].push(item);
|
||||
return acc;
|
||||
}, {}));
|
||||
ABCList.forEach((kk: any,) => {
|
||||
let seriesList: any = []
|
||||
kk.forEach((cc: any) => {
|
||||
if (cc.statisticalData) {
|
||||
yMethodList.push(cc.statisticalData?.toFixed(2) - 0)
|
||||
echartsData.value.yAxis.push({
|
||||
name: item,
|
||||
yAxisIndex: index,
|
||||
splitNumber: 5,
|
||||
minInterval: 1,
|
||||
splitLine: {
|
||||
show: false,
|
||||
|
||||
},
|
||||
...(index > 0 ? right : null)
|
||||
})
|
||||
})
|
||||
|
||||
result.forEach((item: any, index: any) => {
|
||||
let yMethodList: any = []
|
||||
|
||||
let ABCList = Object.values(item.reduce((acc, item) => {
|
||||
let key = item.phase;
|
||||
if (!acc[key]) {
|
||||
acc[key] = [];
|
||||
}
|
||||
acc[key].push(item);
|
||||
return acc;
|
||||
}, {}));
|
||||
ABCList.forEach((kk: any,) => {
|
||||
let seriesList: any = []
|
||||
kk.forEach((cc: any) => {
|
||||
if (cc.statisticalData) {
|
||||
yMethodList.push(cc.statisticalData?.toFixed(2) - 0)
|
||||
|
||||
seriesList.push([cc.time, cc.statisticalData?.toFixed(2)])
|
||||
})
|
||||
}
|
||||
|
||||
seriesList.push([cc.time, cc.statisticalData?.toFixed(2),cc.unit])
|
||||
})
|
||||
|
||||
|
||||
echartsData.value.options.series.push({
|
||||
name: kk[0].phase + '相' + item[0].anotherName,
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbol: 'none',
|
||||
data: seriesList,
|
||||
yAxisIndex: index
|
||||
echartsData.value.options.series.push({
|
||||
name: kk[0].phase + '相' + item[0].anotherName,
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbol: 'none',
|
||||
data: seriesList,
|
||||
yAxisIndex: index
|
||||
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
let [min, max] = yMethod(yMethodList)
|
||||
echartsData.value.yAxis[index].min = min
|
||||
echartsData.value.yAxis[index].max = max
|
||||
|
||||
|
||||
|
||||
})
|
||||
let [min, max] = yMethod(yMethodList)
|
||||
echartsData.value.yAxis[index].min = min
|
||||
echartsData.value.yAxis[index].max = max
|
||||
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
// console.log("🚀 ~ .1111 ~ echartsData.value :", echartsData.value)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user