Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
91fbce7d98
@ -288,7 +288,7 @@ const getDateRange = (type: 'week' | 'month') => {
|
|||||||
return [startOfMonth, endOfMonth]
|
return [startOfMonth, endOfMonth]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const theoryData = ref([])
|
||||||
const isLoading = ref(false)
|
const isLoading = ref(false)
|
||||||
const statAnalysisOperate = () => {
|
const statAnalysisOperate = () => {
|
||||||
const deviceId = statAnalysisDeviceId.value.split(':')[2]
|
const deviceId = statAnalysisDeviceId.value.split(':')[2]
|
||||||
@ -359,9 +359,7 @@ const statAnalysisOperate = () => {
|
|||||||
const seriesData = iGenPower.map((item: any, index: number) => {
|
const seriesData = iGenPower.map((item: any, index: number) => {
|
||||||
return [getCutDecimalsValue(iWindSpeed[index], 2), getCutDecimalsValue(item, 2)]
|
return [getCutDecimalsValue(iWindSpeed[index], 2), getCutDecimalsValue(item, 2)]
|
||||||
})
|
})
|
||||||
// seriesData.sort((a: any, b: any) => {
|
|
||||||
// return a[0] - b[0]
|
|
||||||
// })
|
|
||||||
seriesDataInit.value = seriesData
|
seriesDataInit.value = seriesData
|
||||||
calculateData.value = calculateAverages(seriesDataInit.value)
|
calculateData.value = calculateAverages(seriesDataInit.value)
|
||||||
updateChart()
|
updateChart()
|
||||||
@ -371,6 +369,7 @@ const statAnalysisOperate = () => {
|
|||||||
const seriesData = resData1.map((item: any) => {
|
const seriesData = resData1.map((item: any) => {
|
||||||
return [getCutDecimalsValue(item.speed, 2), getCutDecimalsValue(item.power, 2)]
|
return [getCutDecimalsValue(item.speed, 2), getCutDecimalsValue(item.power, 2)]
|
||||||
})
|
})
|
||||||
|
theoryData.value = seriesData
|
||||||
const series = {
|
const series = {
|
||||||
type: 'line',
|
type: 'line',
|
||||||
data: seriesData,
|
data: seriesData,
|
||||||
@ -391,33 +390,49 @@ const statAnalysisOperate = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const statAnalysisExport = () => {
|
const escapeCsvValue = (value: any) => {
|
||||||
const params = statAnalysisFatory.value ? statAnalysisFatory.value : statAnalysisDeviceId.value
|
if (typeof value === 'string') {
|
||||||
const windSource = statAnalysisSelectOptions.speedSource.filter((item: any) => item.value == statAnalysisSpeedSource.value)
|
// 如果值包含逗号、双引号或换行符,进行转义
|
||||||
const requestData = {
|
return `"${value.replace(/"/g, '""')}"`
|
||||||
devices: [
|
|
||||||
{
|
|
||||||
deviceId: statAnalysisDeviceId.value.split(':')[2],
|
|
||||||
attributes: [statAnalysisSpeedSource.value, 'AvgActivePower_10min'],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
startTime: new Date(statAnalysisTime.value[0]).getTime(),
|
|
||||||
endTime: new Date(statAnalysisTime.value[1]).getTime(),
|
|
||||||
madeinfactory: params.split(':')[0],
|
|
||||||
model: params.split(':')[1],
|
|
||||||
windSource: windSource[0]['label'],
|
|
||||||
displayCurve: AvgWindSpeedSwitch.value ? 1 : 0,
|
|
||||||
}
|
}
|
||||||
powerCurveExport(requestData).then((res: any) => {
|
return value
|
||||||
const downloadUrl = window.URL.createObjectURL(res)
|
}
|
||||||
const a = document.createElement('a')
|
|
||||||
a.href = downloadUrl
|
const statAnalysisExport = () => {
|
||||||
a.download = '功率曲线' + new Date().getTime()
|
const windSource = statAnalysisSelectOptions.speedSource.filter((item: any) => item.value == statAnalysisSpeedSource.value)
|
||||||
document.body.appendChild(a)
|
const csvHeaders = ['风机名称' + '\t', windSource[0]['label'] + '\t', '功率' + '\t', '理论风速' + '\t', '理论功率' + '\t'].join(',') + '\n'
|
||||||
a.click()
|
const deviceRow = statAnalysisSelectOptions.deviceId.filter((item: any) => item.value == statAnalysisDeviceId.value)
|
||||||
window.URL.revokeObjectURL(downloadUrl)
|
let sortseriesDataInit = [...seriesDataInit.value]
|
||||||
document.body.removeChild(a)
|
sortseriesDataInit.sort((a: any, b: any) => {
|
||||||
|
return a[0] - b[0]
|
||||||
})
|
})
|
||||||
|
const exportExcelData1 = chartType.value === 'scatter' ? sortseriesDataInit : calculateData.value
|
||||||
|
const exportExcelData: any = []
|
||||||
|
exportExcelData1.forEach((item: any, index: number) => {
|
||||||
|
let theoryItem0 = (theoryData.value[index] && theoryData.value[index][0]) || ''
|
||||||
|
let theoryItem1 = (theoryData.value[index] && theoryData.value[index][1]) || ''
|
||||||
|
const dataItem = [
|
||||||
|
escapeCsvValue(deviceRow[0]['label']) + '\t',
|
||||||
|
escapeCsvValue(item[0]) + '\t',
|
||||||
|
escapeCsvValue(item[1]) + '\t',
|
||||||
|
escapeCsvValue(theoryItem0) + '\t',
|
||||||
|
escapeCsvValue(theoryItem1) + '\t',
|
||||||
|
]
|
||||||
|
exportExcelData.push(dataItem.join(','))
|
||||||
|
})
|
||||||
|
|
||||||
|
const csvContent = csvHeaders + exportExcelData.join('\n')
|
||||||
|
const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' })
|
||||||
|
const link = document.createElement('a')
|
||||||
|
if (link.download !== undefined) {
|
||||||
|
const url = URL.createObjectURL(blob)
|
||||||
|
link.setAttribute('href', url)
|
||||||
|
link.setAttribute('download', '功率曲线' + new Date().getTime() + '.csv')
|
||||||
|
link.style.visibility = 'hidden'
|
||||||
|
document.body.appendChild(link)
|
||||||
|
link.click()
|
||||||
|
document.body.removeChild(link)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const calculateAverages = (data: any) => {
|
const calculateAverages = (data: any) => {
|
||||||
|
@ -637,7 +637,7 @@ const statAnalysisExport = () => {
|
|||||||
if (link.download !== undefined) {
|
if (link.download !== undefined) {
|
||||||
const url = URL.createObjectURL(blob)
|
const url = URL.createObjectURL(blob)
|
||||||
link.setAttribute('href', url)
|
link.setAttribute('href', url)
|
||||||
link.setAttribute('download', '趋势分析_' + new Date().getTime() + '.csv')
|
link.setAttribute('download', '单机分析_' + new Date().getTime() + '.csv')
|
||||||
link.style.visibility = 'hidden'
|
link.style.visibility = 'hidden'
|
||||||
document.body.appendChild(link)
|
document.body.appendChild(link)
|
||||||
link.click()
|
link.click()
|
||||||
|
@ -689,8 +689,8 @@ const escapeCsvValue = (value: any) => {
|
|||||||
}
|
}
|
||||||
const statAnalysisExport = () => {
|
const statAnalysisExport = () => {
|
||||||
const tables = [
|
const tables = [
|
||||||
{ data: highcsvContent.value, filename: '高频.csv' },
|
{ data: highcsvContent.value, filename: '多机对比_高频' + new Date().getTime() + '.csv' },
|
||||||
{ data: lowcsvContent.value, filename: '低频.csv' },
|
{ data: lowcsvContent.value, filename: '多机对比_低频' + new Date().getTime() + '.csv' },
|
||||||
]
|
]
|
||||||
|
|
||||||
tables.forEach((table) => {
|
tables.forEach((table) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user