修改测试问题

This commit is contained in:
guanj
2026-06-16 08:34:45 +08:00
parent 1c01fe5ae1
commit d9dfd804c5
63 changed files with 5289 additions and 3842 deletions

View File

@@ -118,6 +118,11 @@ const init = () => {
})
let [min, max] = yMethod(arr.map((item: any) => item.statisticalData.toFixed(2)))
echartsData.value = {
exportFileName: {
subject: props.detail.name?.split('(')[0],
feature: '历史趋势',
date: datePickerRef.value?.timeValue?.[1] || datePickerRef.value?.timeValue?.[0]
},
options: {
legend: {
@@ -261,7 +266,11 @@ const init = () => {
return [item[0], item[1], value1, value2, value3];
});
exportCSV(echartsData.value.options.series.map(item => item.name), dataList, echartsData.value.title.text + '.csv')
exportCSV(
echartsData.value.options.series.map(item => item.name),
dataList,
echartsData.value.exportFileName
)
}
}

View File

@@ -377,6 +377,7 @@ import {
getRawData
} from '@/api/cs-device-boot/EquipmentDelivery'
import { deviceHisData, deviceRtData, realTimeData, getTestData } from '@/api/cs-device-boot/csGroup'
import { buildExportFileName } from '@/utils/echartMethod'
import { ref, reactive, onMounted, onUnmounted, inject, nextTick, onBeforeUnmount } from 'vue'
import { ElMessage } from 'element-plus'
import DatePicker from '@/components/form/datePicker/index.vue'
@@ -1372,7 +1373,11 @@ const downloadTxt = () => {
// 创建 <a> 标签并触发下载
const link = document.createElement('a')
link.href = url
link.download = '实时数据.txt' // 文件名
link.download = buildExportFileName({
subject: (TrendList.value as any)?.name,
feature: '实时数据',
ext: 'txt'
})
link.click()
// 释放 URL 对象

View File

@@ -210,15 +210,12 @@ const buildTMetric = (name: string, items: RawMetricItem[]): DisplayMetric => {
return {
name,
otherName: name,
unit: sharedUnit,
unit: getSharedUnit(items),
type: 't-multi',
subItems: items.map(item => {
const keyword = extractSubTitle(item.otherName || item.name || '')
return {
subTitle: unitsDiffer ? buildTitle(keyword, item.unit) : keyword,
value: item.data,
}
}),
subItems: items.map(item => ({
subTitle: extractSubTitle(item.otherName || item.name || ''),
value: item.data,
})),
}
}

View File

@@ -222,6 +222,11 @@ const setEchart = () => {
}
echartsData.value = {
exportFileName: {
subject: (props.TrendList as any)?.name || trendRequestData.value?.name,
feature: '电度数据',
date: datePickerRef.value?.timeValue?.[1] || datePickerRef.value?.timeValue?.[0]
},
legend: {
itemWidth: 20,
itemHeight: 20,
@@ -290,7 +295,7 @@ const setEchart = () => {
title: '下载csv',
icon: 'path://M642 673.1H301.6c-9.9 0-17.9-8-17.9-17.9s8-17.9 17.9-17.9H642c9.9 0 17.9 8 17.9 17.9s-8 17.9-17.9 17.9zM642 511.8H301.6c-9.9 0-17.9-8-17.9-17.9 0-9.9 8-17.9 17.9-17.9H642c9.9 0 17.9 8 17.9 17.9 0 9.9-8 17.9-17.9 17.9zM480.7 350.6H301.6c-9.9 0-17.9-8-17.9-17.9s8-17.9 17.9-17.9h179.2c9.9 0 17.9 8 17.9 17.9s-8.1 17.9-18 17.9zM874.9 350.6H695.7c-49.4 0-89.6-40.2-89.6-89.6V81.9c0-9.9 8-17.9 17.9-17.9 9.9 0 17.9 8 17.9 17.9V261c0 29.6 24.1 53.7 53.7 53.7h179.2c9.9 0 17.9 8 17.9 17.9s-7.9 18-17.8 18zM794.3 959.7H221c-49.4 0-89.6-40.2-89.6-89.6V153.5c0-49.4 40.2-89.6 89.6-89.6h403.1c4.8 0 9.3 1.9 12.7 5.2L887.6 320c3.4 3.4 5.2 7.9 5.2 12.7v537.5c0 52.7-51.9 89.5-98.5 89.5zM221 99.8c-29.6 0-53.7 24.1-53.7 53.7v716.6c0 29.6 24.1 53.7 53.7 53.7h573.3c29 0 62.7-23.5 62.7-53.7v-530L616.7 99.8H221z',
onclick: () => {
exportSeriesCSV(echartsData.value.options.series, '电度数据.csv')
exportSeriesCSV(echartsData.value.options.series, echartsData.value.exportFileName)
}
},
myTool2: {

View File

@@ -26,6 +26,7 @@ import { ArrowLeft, Message } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus'
import { analyseWave, getFileByEventId } from '@/api/common'
import { getFileZip } from '@/api/cs-harmonic-boot/datatrend'
import { buildWaveExportFileName, getExportSubjectFromRow } from '@/utils/echartMethod'
import { useDictData } from '@/stores/dictData'
const emit=defineEmits(['fileRecall'])
const tableParams: any = ref({})
@@ -108,12 +109,12 @@ const tableStore: any = new TableStore({
{ field: 'showName', title: '触发类型', minWidth: 100 },
{
title: '暂降原因', field: 'advanceReason', minWidth: 100, align: 'center', formatter: (row: any) => {
return ReasonList.find((item: any) => item.id == row.cellValue)?.name || '未知'
return ReasonList.find((item: any) => item.id == row.cellValue)?.name || '其他'
}
},
{
title: '暂降类型', field: 'advanceType', minWidth: 100, align: 'center', formatter: (row: any) => {
return EventTypeList.find((item: any) => item.id == row.cellValue)?.name || '未知'
return EventTypeList.find((item: any) => item.id == row.cellValue)?.name || '其他'
}
},
{ title: '电压等级(kV)', field: 'lineVoltage', minWidth: 120, align: 'center', sortable: true, },
@@ -206,7 +207,7 @@ const tableStore: any = new TableStore({
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = row.wavePath.split('/')[2] || '波形文件' // 设置下载的文件名
link.download = buildWaveExportFileName(getExportSubjectFromRow(row))
document.body.appendChild(link)
link.click() //执行下载
document.body.removeChild(link) //释放标签

View File

@@ -62,7 +62,7 @@ import { ref, onMounted, watch } from 'vue'
import MyEchart from '@/components/echarts/MyEchart.vue'
import { useDictData } from '@/stores/dictData'
import { queryStatistical } from '@/api/system-boot/csstatisticalset'
import { yMethod, exportSeriesCSV, completeTimeSeries } from '@/utils/echartMethod'
import { yMethod, exportSeriesCSV, completeTimeSeries, buildExportFileName } 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'
@@ -283,6 +283,15 @@ const init = async () => {
}
}
}
const getChartExportFileName = () => {
const obj = deviceData.value.records?.find((item: any) => item.id == activeName.value)
return {
subject: (props.TrendList as any)?.name,
feature: obj?.itemName || '历史趋势',
date: datePickerRef.value?.timeValue?.[1] || datePickerRef.value?.timeValue?.[0]
}
}
const setEchart = () => {
loading.value = true
echartsData.value = {}
@@ -315,6 +324,7 @@ const setEchart = () => {
}
echartsData.value = {
exportFileName: getChartExportFileName(),
legend: {
itemWidth: 20,
itemHeight: 20,
@@ -383,7 +393,7 @@ const setEchart = () => {
title: '下载csv',
icon: 'path://M642 673.1H301.6c-9.9 0-17.9-8-17.9-17.9s8-17.9 17.9-17.9H642c9.9 0 17.9 8 17.9 17.9s-8 17.9-17.9 17.9zM642 511.8H301.6c-9.9 0-17.9-8-17.9-17.9 0-9.9 8-17.9 17.9-17.9H642c9.9 0 17.9 8 17.9 17.9 0 9.9-8 17.9-17.9 17.9zM480.7 350.6H301.6c-9.9 0-17.9-8-17.9-17.9s8-17.9 17.9-17.9h179.2c9.9 0 17.9 8 17.9 17.9s-8.1 17.9-18 17.9zM874.9 350.6H695.7c-49.4 0-89.6-40.2-89.6-89.6V81.9c0-9.9 8-17.9 17.9-17.9 9.9 0 17.9 8 17.9 17.9V261c0 29.6 24.1 53.7 53.7 53.7h179.2c9.9 0 17.9 8 17.9 17.9s-7.9 18-17.8 18zM794.3 959.7H221c-49.4 0-89.6-40.2-89.6-89.6V153.5c0-49.4 40.2-89.6 89.6-89.6h403.1c4.8 0 9.3 1.9 12.7 5.2L887.6 320c3.4 3.4 5.2 7.9 5.2 12.7v537.5c0 52.7-51.9 89.5-98.5 89.5zM221 99.8c-29.6 0-53.7 24.1-53.7 53.7v716.6c0 29.6 24.1 53.7 53.7 53.7h573.3c29 0 62.7-23.5 62.7-53.7v-530L616.7 99.8H221z',
onclick: () => {
exportSeriesCSV(echartsData.value.options.series, '历史趋势.csv')
exportSeriesCSV(echartsData.value.options.series, echartsData.value.exportFileName)
}
},
myTool2: {
@@ -651,11 +661,7 @@ const handleExport = async () => {
const blob = new Blob([csvs], { type: 'text/csv;charset=utf-8;' })
const link = document.createElement('a')
link.href = URL.createObjectURL(blob)
let obj = deviceData.value.records.find((item: any) => {
return item.id == activeName.value
})
const date = window.XEUtils.toDateString(new Date(), 'yyyyMMdd HHmmss').replace(' ', '_')
link.download = `${deviceData.value.itemName}_${obj?.itemName}_${date}.csv`
link.download = buildExportFileName(echartsData.value?.exportFileName || getChartExportFileName())
link.click()
return
}

View File

@@ -104,6 +104,7 @@ import DeviceTree from '@/components/tree/govern/deviceTree.vue'
import { mainHeight } from '@/utils/layout'
import { queryByCode, queryByid, queryCsDictTree } from '@/api/system-boot/dictTree'
import { getDeviceData } from '@/api/cs-device-boot/EquipmentDelivery'
import { buildExportBaseName } from '@/utils/echartMethod'
import { getTargetById } from '@/api/cs-device-boot/csDataArray'
import { getGroup } from '@/api/cs-device-boot/csGroup'
import { ref } from 'vue'
@@ -135,6 +136,7 @@ const deviceTypeChange = (val: any, obj: any) => {
deviceType.value = val
nodeClick(obj)
}
const exportSubjectName = ref('')
// 树节点点击
const nodeClick = (e: anyObj) => {
if (!e) {
@@ -142,6 +144,7 @@ const nodeClick = (e: anyObj) => {
return
}
if (e.level == 2 || e.level == 3) {
exportSubjectName.value = e.name || ''
pName.value = e.pName
nDid.value = e.ndid
loading.value = true
@@ -288,8 +291,12 @@ const handleRestartDevice = () => {
})
}
const exportData = () => {
const dataSetName = deviceData.value.dataSetList.filter((item: any) => item.id == dataSet.value)[0]?.name
xTableRef.value.exportData({
filename: deviceData.value.dataSetList.filter((item: any) => item.id == dataSet.value)[0]?.name, // 文件名字
filename: buildExportBaseName({
subject: exportSubjectName.value || deviceData.value?.name,
feature: dataSetName || '数据集'
}), // 文件名字
sheetName: 'Sheet1',
type: 'xlsx', //导出文件类型 xlsx 和 csv
useStyle: true,

View File

@@ -34,6 +34,7 @@ import waveFormAnalysis from '@/views/govern/device/control/tabs/components/wave
import { analyseWave, getFileByEventId } from '@/api/common'
import { mainHeight } from '@/utils/layout'
import { getFileZip } from '@/api/cs-harmonic-boot/datatrend'
import { buildWaveExportFileName, getExportSubjectFromRow } from '@/utils/echartMethod'
import { queryByCode, queryByid, queryCsDictTree } from '@/api/system-boot/dictTree'
import analysisList from '@/views/govern/device/control/analysisList/index.vue'
@@ -109,12 +110,12 @@ const tableStore = new TableStore({
{ field: 'showName', title: '触发类型', minWidth: 100 },
{
title: '暂降原因', field: 'advanceReason', minWidth: 100, align: 'center', formatter: (row: any) => {
return ReasonList.find((item: any) => item.id == row.cellValue)?.name || '未知'
return ReasonList.find((item: any) => item.id == row.cellValue)?.name || '其他'
}
},
{
title: '暂降类型', field: 'advanceType', minWidth: 100, align: 'center', formatter: (row: any) => {
return EventTypeList.find((item: any) => item.id == row.cellValue)?.name || '未知'
return EventTypeList.find((item: any) => item.id == row.cellValue)?.name || '其他'
}
},
{ title: '监测点名称', field: 'lineName', minWidth: 120, align: 'center' },
@@ -204,7 +205,7 @@ const tableStore = new TableStore({
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = row.wavePath.split('/')[2] || '波形文件' // 设置下载的文件名
link.download = buildWaveExportFileName(getExportSubjectFromRow(row))
document.body.appendChild(link)
link.click() //执行下载
document.body.removeChild(link) //释放标签

View File

@@ -26,9 +26,9 @@
:name="item.id" :key="index">
<template #label>
<span class="custom-tabs-label">
<el-icon>
<!-- <el-icon>
<TrendCharts />
</el-icon>
</el-icon> -->
<span>{{ item.itemName }}</span>
</span>
</template>
@@ -203,7 +203,7 @@ import { getTestRecordInfo, getHistoryTrend } from '@/api/cs-device-boot/planDat
import { useDictData } from '@/stores/dictData'
import { queryStatistical } from '@/api/system-boot/csstatisticalset'
import { TrendCharts, Plus, Platform } from '@element-plus/icons-vue'
import { yMethod, completeTimeSeries } from '@/utils/echartMethod'
import { yMethod, completeTimeSeries, buildExportFileName } from '@/utils/echartMethod'
import { color, gradeColor3 } from '@/components/echarts/color'
import TableHeader from '@/components/table/header/index.vue'
import { useConfig } from '@/stores/config'
@@ -341,10 +341,12 @@ const handleClickTabs = async () => {
transientRef.value && transientRef.value.init()
}, 100)
}
const exportSubjectName = ref('')
const nodeClick = async (e: anyObj) => {
if (e == undefined) {
return
}
exportSubjectName.value = e.name || ''
// onIndexChange([])
deviceData.value = []
historyDevId.value = e?.children && e?.children.length != 0 ? e?.children[0].id : e?.id
@@ -567,6 +569,15 @@ const init = (flag: boolean) => {
}
}
const getChartExportFileName = () => {
const obj = deviceData.value.records?.find((item: any) => item.id == activeName.value)
return {
subject: exportSubjectName.value,
feature: obj?.itemName || '预案数据',
date: obj?.endTime || obj?.startTime
}
}
const setEchart = () => {
loading.value = true
echartsData.value = {}
@@ -597,6 +608,7 @@ const setEchart = () => {
}
echartsData.value = {
exportFileName: getChartExportFileName(),
// title: {
// text: chartTitle.value,
// left: '0',
@@ -919,11 +931,7 @@ const handleExport = async () => {
const blob = new Blob([csvs], { type: 'text/csv;charset=utf-8;' })
const link = document.createElement('a')
link.href = URL.createObjectURL(blob)
let obj = deviceData.value.records.find((item: any) => {
return item.id == activeName.value
})
const date = window.XEUtils.toDateString(new Date(), 'yyyyMMdd HHmmss').replace(' ', '_')
link.download = `${deviceData.value.itemName}_${obj?.itemName}_${date}.csv`
link.download = buildExportFileName(echartsData.value?.exportFileName || getChartExportFileName())
link.click()
return
}