故障录波:修改日志与录波显示逻辑

This commit is contained in:
高云鹏 2024-12-24 14:57:11 +08:00
parent 684fa55eb6
commit 60e24b7b93

View File

@ -513,15 +513,13 @@ const fileName = ref('')
const warningInfo = ref()
const previewFileDialogVisible = ref(false)
const readFile = (data: tableItemData) => {
fileName.value = data.name.slice(24)
fileName.value = activeName.value === 'malFunction' ? data.name.slice(24) : data.name
previewFileDialogVisible.value = true
getFileKeyEnum().finally(() => {
getFileData(data.path)
.then((res) => {
// warningInfo.value = res.data.faultTime ? dayjs(res.data.faultTime).format('YYYY-MM-DD HH:mm:ss.SSS') : ''
previewChartData = res.data.dataCurve
const attrName = Object.keys(res.data.dataCurve)
.then((res: { data: any; faultTime?: any }) => {
previewChartData = res.data
const attrName = Object.keys(res.data)
const data: any = []
let hasAddFaultTime = false
attrName.forEach((item) => {
@ -529,8 +527,8 @@ const readFile = (data: tableItemData) => {
let timeStamp: any = []
previewChartData.TimeStamp = previewChartData.TimeStamp.map((item: any) => {
const parseTime = dayjs(item).format('YYYY-MM-DD HH:mm:ss.SSS')
if (!hasAddFaultTime && res.data?.faultTime && item > res.data.faultTime) {
const parseFaultTime = dayjs(res.data.faultTime).format('YYYY-MM-DD HH:mm:ss.SSS')
if (!hasAddFaultTime && res?.faultTime && item > res?.faultTime) {
const parseFaultTime = dayjs(res.faultTime).format('YYYY-MM-DD HH:mm:ss.SSS')
warningInfo.value = parseFaultTime
timeStamp.push(parseFaultTime)
hasAddFaultTime = true
@ -694,6 +692,7 @@ const createSeriresData = () => {
const initPreviewChart = () => {
const chart = previewChartInstance ?? echarts.init(previewChartRef.value)
const series = createSeriresData()
const option = {
grid: {
top: 50,
@ -791,27 +790,30 @@ const initPreviewChart = () => {
color: '#73767a',
},
},
series: [
...series,
{
type: 'line',
name: '报警值',
data: [],
xAxisIndex: 1,
tooltip: {
show: false,
},
markLine: {
symbol: 'none',
data: [
{
xAxis: warningInfo.value,
},
],
animation: false,
},
},
],
series:
activeName.value === 'malFunction'
? [
...series,
{
type: 'line',
name: '报警值',
data: [],
xAxisIndex: 1,
tooltip: {
show: false,
},
markLine: {
symbol: 'none',
data: [
{
xAxis: warningInfo.value,
},
],
animation: false,
},
},
]
: series,
}
chart.setOption(option)
previewChartInstance = chart
@ -823,11 +825,15 @@ const getFileData = (url: string) => {
return previewFileReq({
deviceCode: curTreeData.value.code,
url: url,
}).then((res) => {
return { data: res.data.dataCurve, faultTime: res.data?.faultTime }
})
} else if (activeName.value === 'logManage') {
return previewLogFileReq({
deviceCode: curTreeData.value.code,
url: url,
}).then((res) => {
return { data: res.data }
})
}
return Promise.reject()