统计分析
This commit is contained in:
parent
e521234d94
commit
606c5e588a
@ -36,49 +36,85 @@ export const runAirBlowerReq = (
|
||||
})
|
||||
}
|
||||
|
||||
export const getReportTemplateListReq = (data: { category: '单机报表' | '多机报表', pageNum: number, pageSize: number }) => {
|
||||
return createAxios<never, Promise<{
|
||||
code: number,
|
||||
msg: string,
|
||||
data: {
|
||||
total: number,
|
||||
rows: { id: string, category: '单机报表' | '多机报表', template: string }[]
|
||||
code: number,
|
||||
export const getReportTemplateListReq = (data: { category: '单机报表' | '多机报表'; pageNum: number; pageSize: number }) => {
|
||||
return createAxios<
|
||||
never,
|
||||
Promise<{
|
||||
code: number
|
||||
msg: string
|
||||
},
|
||||
success: boolean
|
||||
}>>({
|
||||
data: {
|
||||
total: number
|
||||
rows: { id: string; category: '单机报表' | '多机报表'; template: string }[]
|
||||
code: number
|
||||
msg: string
|
||||
}
|
||||
success: boolean
|
||||
}>
|
||||
>({
|
||||
url: '/api/page/report/template/getList',
|
||||
method: 'post',
|
||||
data
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export const addReportTemplateListReq = (data: { category: '单机报表' | '多机报表', template: string }) => {
|
||||
return createAxios<never, Promise<{
|
||||
code: number,
|
||||
msg: string,
|
||||
data: {
|
||||
id: string,
|
||||
category: '单机报表' | '多机报表',
|
||||
template: string
|
||||
}[],
|
||||
success: boolean
|
||||
}>>({
|
||||
export const addReportTemplateListReq = (data: { category: '单机报表' | '多机报表'; template: string }) => {
|
||||
return createAxios<
|
||||
never,
|
||||
Promise<{
|
||||
code: number
|
||||
msg: string
|
||||
data: {
|
||||
id: string
|
||||
category: '单机报表' | '多机报表'
|
||||
template: string
|
||||
}[]
|
||||
success: boolean
|
||||
}>
|
||||
>({
|
||||
url: '/api/page/report/template/add',
|
||||
method: 'post',
|
||||
data
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export const delReportTemplateListReq = (data: { id: string }) => {
|
||||
return createAxios<never, Promise<{
|
||||
code: number,
|
||||
msg: string,
|
||||
success: boolean
|
||||
}>>({
|
||||
return createAxios<
|
||||
never,
|
||||
Promise<{
|
||||
code: number
|
||||
msg: string
|
||||
success: boolean
|
||||
}>
|
||||
>({
|
||||
url: '/api/page/report/template/del',
|
||||
method: 'post',
|
||||
data
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function powerCurveExport(params: object = {}) {
|
||||
return createAxios({
|
||||
url: '/api/page/statistical/powerCurveExport',
|
||||
method: 'POST',
|
||||
data: params,
|
||||
responseType: 'blob',
|
||||
})
|
||||
}
|
||||
|
||||
export function trendContrastExport(params: object = {}) {
|
||||
return createAxios({
|
||||
url: '/api/page/statistical/trendContrastExport',
|
||||
method: 'POST',
|
||||
data: params,
|
||||
responseType: 'blob',
|
||||
})
|
||||
}
|
||||
|
||||
export function trendAnalyseExport(params: object = {}) {
|
||||
return createAxios({
|
||||
url: '/api/page/statistical/trendAnalyseExport',
|
||||
method: 'POST',
|
||||
data: params,
|
||||
responseType: 'blob',
|
||||
})
|
||||
}
|
||||
|
@ -11,7 +11,6 @@
|
||||
</div>
|
||||
<div class="topRight">
|
||||
<el-button type="primary" @click="statAnalysisOperate()">{{ t('statAnalysis.search') }}</el-button>
|
||||
<el-button style="color: #0064aa" @click="statAnalysiImport()">{{ t('statAnalysis.import') }}</el-button>
|
||||
<el-button style="color: #0064aa" @click="statAnalysisExport()">{{ t('statAnalysis.export') }}</el-button>
|
||||
</div>
|
||||
</el-header>
|
||||
@ -61,7 +60,7 @@
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref, onMounted } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { queryWindTurbinesPages, historyReq } from '/@/api/backend/statAnalysis/request'
|
||||
import { queryWindTurbinesPages, historyReq, powerCurveExport } from '/@/api/backend/statAnalysis/request'
|
||||
import { theoreticalpowerCurveList, powerCurveQuery } from '/@/api/backend/theoreticalpowerCurve/request'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import * as echarts from 'echarts'
|
||||
@ -325,8 +324,33 @@ const historyDataReq = (data: any) => {
|
||||
})
|
||||
}
|
||||
|
||||
const statAnalysisExport = () => {}
|
||||
const statAnalysiImport = () => {}
|
||||
const statAnalysisExport = () => {
|
||||
const params = statAnalysisFatory.value ? statAnalysisFatory.value : statAnalysisDeviceId.value
|
||||
const requestData = {
|
||||
devices: [
|
||||
{
|
||||
deviceId: statAnalysisDeviceId.value.split(':')[2],
|
||||
attributes: ['iGenPower', 'iWindSpeed'],
|
||||
},
|
||||
],
|
||||
interval: statAnalysisInterval.value || '5m',
|
||||
startTime: new Date(statAnalysisTime.value[0]).getTime(),
|
||||
endTime: new Date(statAnalysisTime.value[1]).getTime(),
|
||||
madeinfactory: params.split(':')[0],
|
||||
model: params.split(':')[1],
|
||||
}
|
||||
console.log(requestData)
|
||||
powerCurveExport(requestData).then((res: any) => {
|
||||
const downloadUrl = window.URL.createObjectURL(res)
|
||||
const a = document.createElement('a')
|
||||
a.href = downloadUrl
|
||||
a.download = '功率曲线' + new Date().getTime()
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
window.URL.revokeObjectURL(downloadUrl)
|
||||
document.body.removeChild(a)
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.statAnalysis {
|
||||
|
@ -31,7 +31,6 @@
|
||||
</div>
|
||||
<div class="topRight">
|
||||
<el-button type="primary" @click="statAnalysisOperate()">{{ t('statAnalysis.search') }}</el-button>
|
||||
<el-button style="color: #0064aa" @click="statAnalysiImport()">{{ t('statAnalysis.import') }}</el-button>
|
||||
<el-button style="color: #0064aa" @click="statAnalysisExport()">{{ t('statAnalysis.export') }}</el-button>
|
||||
</div>
|
||||
</el-header>
|
||||
@ -101,7 +100,7 @@
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref, onMounted, markRaw } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { queryWindTurbinesPages, historyReq } from '/@/api/backend/statAnalysis/request'
|
||||
import { queryWindTurbinesPages, historyReq, trendAnalyseExport } from '/@/api/backend/statAnalysis/request'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { DArrowRight, Plus, Delete } from '@element-plus/icons-vue'
|
||||
import MeasurementPage from './analysisAttributes.vue'
|
||||
@ -419,8 +418,37 @@ const historyDataReq = (data: any, index: number) => {
|
||||
})
|
||||
}
|
||||
|
||||
const statAnalysisExport = () => {}
|
||||
const statAnalysiImport = () => {}
|
||||
const statAnalysisExport = () => {
|
||||
const requestData: any = []
|
||||
times.forEach((time: any, index: number) => {
|
||||
if (time[0] && time[1]) {
|
||||
const devices = {
|
||||
devices: [
|
||||
{
|
||||
deviceId: statAnalysisSelect.deviceId,
|
||||
attributes: [statAnalysisSelect.attributeCode],
|
||||
},
|
||||
],
|
||||
interval: statAnalysisSelect.interval || '5m',
|
||||
startTime: new Date(time[0]).getTime(),
|
||||
endTime: new Date(time[1]).getTime(),
|
||||
timeName: customName[index],
|
||||
}
|
||||
requestData.push(devices)
|
||||
}
|
||||
})
|
||||
console.log(requestData)
|
||||
trendAnalyseExport(requestData).then((res: any) => {
|
||||
const downloadUrl = window.URL.createObjectURL(res)
|
||||
const a = document.createElement('a')
|
||||
a.href = downloadUrl
|
||||
a.download = '趋势分析' + new Date().getTime()
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
window.URL.revokeObjectURL(downloadUrl)
|
||||
document.body.removeChild(a)
|
||||
})
|
||||
}
|
||||
|
||||
function calculateStats(numbers: any) {
|
||||
const max = Math.max(...numbers)
|
||||
|
@ -23,7 +23,6 @@
|
||||
</div>
|
||||
<div class="topRight">
|
||||
<el-button type="primary" @click="statAnalysisOperate()">{{ t('statAnalysis.search') }}</el-button>
|
||||
<el-button style="color: #0064aa" @click="statAnalysiImport()">{{ t('statAnalysis.import') }}</el-button>
|
||||
<el-button style="color: #0064aa" @click="statAnalysisExport()">{{ t('statAnalysis.export') }}</el-button>
|
||||
</div>
|
||||
</el-header>
|
||||
@ -107,7 +106,7 @@
|
||||
<script setup lang="ts">
|
||||
import { markRaw, reactive, ref, watch, nextTick, onMounted, computed } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { queryWindTurbinesPages, historyReq } from '/@/api/backend/statAnalysis/request'
|
||||
import { queryWindTurbinesPages, historyReq, trendContrastExport } from '/@/api/backend/statAnalysis/request'
|
||||
import { ElMessage, ElMenu } from 'element-plus'
|
||||
import { DArrowRight, Plus, Delete } from '@element-plus/icons-vue'
|
||||
import MeasurementPage from './analysisAttributes.vue'
|
||||
@ -325,26 +324,7 @@ const getDateRange = (type: 'week' | 'month') => {
|
||||
}
|
||||
|
||||
const statAnalysisOperate = () => {
|
||||
option.series = []
|
||||
chart.value.setOption(option, { notMerge: true })
|
||||
const attributes = statAnalysisAttributeCode
|
||||
const devices = statAnalysisDeviceId.reduce((deviceId: any, curr, index) => {
|
||||
const existing: any = deviceId.find((item: any) => item.deviceId === curr)
|
||||
if (existing) {
|
||||
existing.attributes.push(statAnalysisAttributeCode[index])
|
||||
} else {
|
||||
deviceId.push({ deviceId: curr, attributes: [statAnalysisAttributeCode[index]] })
|
||||
}
|
||||
return deviceId
|
||||
}, [])
|
||||
const requestData = {
|
||||
devices: devices,
|
||||
interval: statAnalysisInterval.value || '5m',
|
||||
startTime: new Date(statAnalysisTime.value[0]).getTime(),
|
||||
endTime: new Date(statAnalysisTime.value[1]).getTime(),
|
||||
}
|
||||
|
||||
historyDataReq(requestData)
|
||||
historyDataReq(getRequestData())
|
||||
}
|
||||
const calculate: any = reactive([{ max: '', min: '', average: '' }])
|
||||
const historyDataReq = (data: any) => {
|
||||
@ -399,8 +379,38 @@ const findAllOccurrences = (arr: any, target: any) => {
|
||||
const getCommonElements = (arr1: any, arr2: any) => {
|
||||
return arr1.filter((item: any) => arr2.some((x: any) => x === item))
|
||||
}
|
||||
const statAnalysisExport = () => {}
|
||||
const statAnalysiImport = () => {}
|
||||
const statAnalysisExport = () => {
|
||||
console.log('🚀 ~ trendContrastExport ~ getRequestData():', getRequestData())
|
||||
trendContrastExport(getRequestData()).then((res: any) => {
|
||||
const downloadUrl = window.URL.createObjectURL(res)
|
||||
const a = document.createElement('a')
|
||||
a.href = downloadUrl
|
||||
a.download = '趋势对比' + new Date().getTime()
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
window.URL.revokeObjectURL(downloadUrl)
|
||||
document.body.removeChild(a)
|
||||
})
|
||||
}
|
||||
|
||||
const getRequestData = () => {
|
||||
const devices = statAnalysisDeviceId.reduce((deviceId: any, curr, index) => {
|
||||
const existing: any = deviceId.find((item: any) => item.deviceId === curr)
|
||||
if (existing) {
|
||||
existing.attributes.push(statAnalysisAttributeCode[index])
|
||||
} else {
|
||||
deviceId.push({ deviceId: curr, attributes: [statAnalysisAttributeCode[index]] })
|
||||
}
|
||||
return deviceId
|
||||
}, [])
|
||||
const requestData = {
|
||||
devices: devices,
|
||||
interval: statAnalysisInterval.value || '5m',
|
||||
startTime: new Date(statAnalysisTime.value[0]).getTime(),
|
||||
endTime: new Date(statAnalysisTime.value[1]).getTime(),
|
||||
}
|
||||
return requestData
|
||||
}
|
||||
function calculateStats(numbers: any) {
|
||||
const max = Math.max(...numbers)
|
||||
const min = Math.min(...numbers)
|
||||
|
Loading…
Reference in New Issue
Block a user