统计查询
This commit is contained in:
parent
0a70a9a7d8
commit
4e338a2c4a
@ -16,6 +16,15 @@ export const historyReq = (data: any) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const windowReq = (data: any) => {
|
||||||
|
return createAxios({
|
||||||
|
url: '/api/data/windows',
|
||||||
|
method: 'post',
|
||||||
|
data: data,
|
||||||
|
timeout: 60 * 1000,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export const runAirBlowerReq = (
|
export const runAirBlowerReq = (
|
||||||
data: {
|
data: {
|
||||||
deviceId: string
|
deviceId: string
|
||||||
|
@ -4,6 +4,7 @@ export default {
|
|||||||
trendComparison: '多机对比',
|
trendComparison: '多机对比',
|
||||||
deviceId: '风机',
|
deviceId: '风机',
|
||||||
attributes: '测点名称',
|
attributes: '测点名称',
|
||||||
|
calFunction: '方法',
|
||||||
interval: '间隔',
|
interval: '间隔',
|
||||||
search: '查询',
|
search: '查询',
|
||||||
import: '下载',
|
import: '下载',
|
||||||
|
@ -28,6 +28,17 @@
|
|||||||
<el-option v-for="v in statAnalysisSelectOptions.interval" :key="v.value" :label="v.label" :value="v.value"></el-option>
|
<el-option v-for="v in statAnalysisSelectOptions.interval" :key="v.value" :label="v.label" :value="v.value"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="selectPart">
|
||||||
|
<span>{{ t('statAnalysis.calFunction') }}</span>
|
||||||
|
<el-select
|
||||||
|
:disabled="statAnalysisSelect.interval == 'NONE'"
|
||||||
|
v-model="statAnalysisSelect.calFunction"
|
||||||
|
:placeholder="'请选择' + t('statAnalysis.calFunction')"
|
||||||
|
class="statAnalysisSelect"
|
||||||
|
>
|
||||||
|
<el-option v-for="v in statAnalysisSelectOptions.calFunction" :key="v.value" :label="v.label" :value="v.value"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</div>
|
||||||
<el-button class="addline" type="primary" :icon="Plus" @click="addTime()"> 增加时间</el-button>
|
<el-button class="addline" type="primary" :icon="Plus" @click="addTime()"> 增加时间</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="topRight">
|
<div class="topRight">
|
||||||
@ -99,7 +110,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { reactive, ref, onMounted, markRaw } from 'vue'
|
import { reactive, ref, onMounted, markRaw } from 'vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { queryWindTurbinesPages, historyReq, trendAnalyseExport } from '/@/api/backend/statAnalysis/request'
|
import { queryWindTurbinesPages, historyReq, trendAnalyseExport, windowReq } from '/@/api/backend/statAnalysis/request'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { DArrowRight, Plus, Delete, Close } from '@element-plus/icons-vue'
|
import { DArrowRight, Plus, Delete, Close } from '@element-plus/icons-vue'
|
||||||
import MeasurementPage from './analysisAttributes.vue'
|
import MeasurementPage from './analysisAttributes.vue'
|
||||||
@ -115,6 +126,7 @@ const statAnalysisSelect = reactive({
|
|||||||
interval: '1h',
|
interval: '1h',
|
||||||
time: '',
|
time: '',
|
||||||
unit: '',
|
unit: '',
|
||||||
|
calFunction: 'interpolation',
|
||||||
})
|
})
|
||||||
const getFormattedDate = (offset: number) => {
|
const getFormattedDate = (offset: number) => {
|
||||||
const date = new Date()
|
const date = new Date()
|
||||||
@ -236,6 +248,14 @@ const option: any = {
|
|||||||
},
|
},
|
||||||
series: [],
|
series: [],
|
||||||
grid: {},
|
grid: {},
|
||||||
|
dataZoom: [
|
||||||
|
{
|
||||||
|
type: 'slider',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'inside',
|
||||||
|
},
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
const statAnalysisSelectOptions: any = reactive({
|
const statAnalysisSelectOptions: any = reactive({
|
||||||
@ -248,6 +268,12 @@ const statAnalysisSelectOptions: any = reactive({
|
|||||||
{ label: '一天', value: '1d' },
|
{ label: '一天', value: '1d' },
|
||||||
{ label: '原始', value: 'NONE' },
|
{ label: '原始', value: 'NONE' },
|
||||||
],
|
],
|
||||||
|
calFunction: [
|
||||||
|
{ label: '插值', value: 'interpolation' },
|
||||||
|
{ label: '平均值', value: 'average' },
|
||||||
|
{ label: '最大值', value: 'max' },
|
||||||
|
{ label: '最小值', value: 'min' },
|
||||||
|
],
|
||||||
deviceId: [],
|
deviceId: [],
|
||||||
})
|
})
|
||||||
const customName = reactive([statAnalysisSelect.attributes + '1'])
|
const customName = reactive([statAnalysisSelect.attributes + '1'])
|
||||||
@ -446,10 +472,12 @@ const statAnalysisOperate = () => {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
interval: statAnalysisSelect.interval || '5m',
|
interval: statAnalysisSelect.interval || '5m',
|
||||||
|
calFunction: statAnalysisSelect.calFunction,
|
||||||
startTime: new Date(time[0]).getTime(),
|
startTime: new Date(time[0]).getTime(),
|
||||||
endTime: new Date(time[1]).getTime(),
|
endTime: new Date(time[1]).getTime(),
|
||||||
}
|
}
|
||||||
const promise = new Promise((resolve, reject) => {
|
const promise = new Promise((resolve, reject) => {
|
||||||
|
if (statAnalysisSelect.calFunction == 'interpolation') {
|
||||||
historyReq(requestData)
|
historyReq(requestData)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
@ -461,6 +489,19 @@ const statAnalysisOperate = () => {
|
|||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
reject(error)
|
reject(error)
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
windowReq(requestData)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
resolve(res.data)
|
||||||
|
} else {
|
||||||
|
ElMessage.warning('查询失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
reject(error)
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
promises.push(promise)
|
promises.push(promise)
|
||||||
}
|
}
|
||||||
@ -474,6 +515,7 @@ const historyDataReq = (promises: any) => {
|
|||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
const deviceId = statAnalysisSelect.deviceId
|
const deviceId = statAnalysisSelect.deviceId
|
||||||
const attributeCode = statAnalysisSelect.attributeCode
|
const attributeCode = statAnalysisSelect.attributeCode
|
||||||
|
if (results.length) {
|
||||||
results.forEach((res: any, index: number) => {
|
results.forEach((res: any, index: number) => {
|
||||||
const resData = (res && deviceId in res && res[deviceId][attributeCode]) || undefined
|
const resData = (res && deviceId in res && res[deviceId][attributeCode]) || undefined
|
||||||
if (!resData['values'].length) {
|
if (!resData['values'].length) {
|
||||||
@ -520,6 +562,9 @@ const historyDataReq = (promises: any) => {
|
|||||||
option.series.push(seriesData)
|
option.series.push(seriesData)
|
||||||
chart.value.setOption(option)
|
chart.value.setOption(option)
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
ElMessage.warning('查询结果为空')
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
@ -547,7 +592,6 @@ const statAnalysisExport = () => {
|
|||||||
requestData.push(devices)
|
requestData.push(devices)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
console.log('🚀 ~ times.forEach ~ requestData:', requestData)
|
|
||||||
|
|
||||||
trendAnalyseExport(requestData).then((res: any) => {
|
trendAnalyseExport(requestData).then((res: any) => {
|
||||||
const downloadUrl = window.URL.createObjectURL(res)
|
const downloadUrl = window.URL.createObjectURL(res)
|
||||||
@ -729,6 +773,7 @@ const timestampToTime = (timestamp: any) => {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
|
white-space: nowrap;
|
||||||
span {
|
span {
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,17 @@
|
|||||||
<el-option v-for="v in statAnalysisSelectOptions.interval" :key="v.value" :label="v.label" :value="v.value"></el-option>
|
<el-option v-for="v in statAnalysisSelectOptions.interval" :key="v.value" :label="v.label" :value="v.value"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="selectPart">
|
||||||
|
<span>{{ t('statAnalysis.calFunction') }}</span>
|
||||||
|
<el-select
|
||||||
|
:disabled="statAnalysisInterval == 'NONE'"
|
||||||
|
v-model="statAnalysisSelectcalFunction"
|
||||||
|
:placeholder="'请选择' + t('statAnalysis.calFunction')"
|
||||||
|
class="statAnalysisSelect"
|
||||||
|
>
|
||||||
|
<el-option v-for="v in statAnalysisSelectOptions.calFunction" :key="v.value" :label="v.label" :value="v.value"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</div>
|
||||||
<el-button type="primary" :icon="Crop" class="addline" @click="openMeasure">测点选择</el-button>
|
<el-button type="primary" :icon="Crop" class="addline" @click="openMeasure">测点选择</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="topRight">
|
<div class="topRight">
|
||||||
@ -129,7 +140,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { markRaw, reactive, ref, watch, nextTick, onMounted, computed } from 'vue'
|
import { markRaw, reactive, ref, watch, nextTick, onMounted, computed } from 'vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { queryWindTurbinesPages, historyReq, trendContrastExport } from '/@/api/backend/statAnalysis/request'
|
import { queryWindTurbinesPages, historyReq, trendContrastExport, windowReq } from '/@/api/backend/statAnalysis/request'
|
||||||
import { ElMessage, ElMenu } from 'element-plus'
|
import { ElMessage, ElMenu } from 'element-plus'
|
||||||
import { DArrowRight, Plus, Crop, Close } from '@element-plus/icons-vue'
|
import { DArrowRight, Plus, Crop, Close } from '@element-plus/icons-vue'
|
||||||
import * as echarts from 'echarts'
|
import * as echarts from 'echarts'
|
||||||
@ -139,6 +150,7 @@ import { getCutDecimalsValue } from '/@/views/backend/equipment/airBlower/utils'
|
|||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
||||||
const statAnalysisInterval = ref('1h')
|
const statAnalysisInterval = ref('1h')
|
||||||
|
const statAnalysisSelectcalFunction = ref('interpolation')
|
||||||
const statAnalysisSelectOptions: any = reactive({
|
const statAnalysisSelectOptions: any = reactive({
|
||||||
interval: [
|
interval: [
|
||||||
{ label: '一分钟', value: '1m' },
|
{ label: '一分钟', value: '1m' },
|
||||||
@ -149,6 +161,12 @@ const statAnalysisSelectOptions: any = reactive({
|
|||||||
{ label: '一天', value: '1d' },
|
{ label: '一天', value: '1d' },
|
||||||
{ label: '原始', value: 'NONE' },
|
{ label: '原始', value: 'NONE' },
|
||||||
],
|
],
|
||||||
|
calFunction: [
|
||||||
|
{ label: '插值', value: 'interpolation' },
|
||||||
|
{ label: '平均值', value: 'average' },
|
||||||
|
{ label: '最大值', value: 'max' },
|
||||||
|
{ label: '最小值', value: 'min' },
|
||||||
|
],
|
||||||
})
|
})
|
||||||
const getFormattedDate = (offset: number) => {
|
const getFormattedDate = (offset: number) => {
|
||||||
const date = new Date()
|
const date = new Date()
|
||||||
@ -189,6 +207,14 @@ const option: any = {
|
|||||||
},
|
},
|
||||||
series: [],
|
series: [],
|
||||||
grid: {},
|
grid: {},
|
||||||
|
dataZoom: [
|
||||||
|
{
|
||||||
|
type: 'slider',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'inside',
|
||||||
|
},
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
const chart: any = ref(null)
|
const chart: any = ref(null)
|
||||||
@ -200,7 +226,6 @@ onMounted(() => {
|
|||||||
queryWindTurbines().then((res) => {
|
queryWindTurbines().then((res) => {
|
||||||
selectedLeft.value = [tableDataLeft.value[0]]
|
selectedLeft.value = [tableDataLeft.value[0]]
|
||||||
getCompleteData().then((attrRes: any) => {
|
getCompleteData().then((attrRes: any) => {
|
||||||
console.log('🚀 ~ getCompleteData ~ attrRes:', attrRes)
|
|
||||||
multipleSelection.value = [
|
multipleSelection.value = [
|
||||||
{
|
{
|
||||||
attributeName: attrRes.attributeName,
|
attributeName: attrRes.attributeName,
|
||||||
@ -446,8 +471,30 @@ const historyDataReq = (data: any) => {
|
|||||||
const selectAllDevices = [...selectedLeft.value, ...selectedMid.value, ...selectedRight.value].sort((a: any, b: any) => {
|
const selectAllDevices = [...selectedLeft.value, ...selectedMid.value, ...selectedRight.value].sort((a: any, b: any) => {
|
||||||
return a.index - b.index
|
return a.index - b.index
|
||||||
})
|
})
|
||||||
|
if (statAnalysisSelectcalFunction.value == 'interpolation') {
|
||||||
historyReq(data)
|
historyReq(data)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
handleRes(res, selectAllDevices)
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
isLoading.value = false
|
||||||
|
console.error(error)
|
||||||
|
ElMessage.warning(error)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
windowReq(data)
|
||||||
|
.then((res) => {
|
||||||
|
handleRes(res, selectAllDevices)
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
isLoading.value = false
|
||||||
|
console.error(error)
|
||||||
|
ElMessage.warning(error)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleRes = (res: any, selectAllDevices: any) => {
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
const resData = res.data
|
const resData = res.data
|
||||||
@ -503,12 +550,6 @@ const historyDataReq = (data: any) => {
|
|||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
ElMessage.warning('查询失败')
|
ElMessage.warning('查询失败')
|
||||||
}
|
}
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
isLoading.value = false
|
|
||||||
console.error(error)
|
|
||||||
ElMessage.warning(error)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const statAnalysisExport = () => {
|
const statAnalysisExport = () => {
|
||||||
@ -531,9 +572,8 @@ const getRequestData = () => {
|
|||||||
interval: statAnalysisInterval.value || '5m',
|
interval: statAnalysisInterval.value || '5m',
|
||||||
startTime: new Date(statAnalysisTime.value[0]).getTime(),
|
startTime: new Date(statAnalysisTime.value[0]).getTime(),
|
||||||
endTime: new Date(statAnalysisTime.value[1]).getTime(),
|
endTime: new Date(statAnalysisTime.value[1]).getTime(),
|
||||||
|
calFunction: statAnalysisSelectcalFunction.value,
|
||||||
}
|
}
|
||||||
console.log('🚀 ~ getRequestData ~ requestData:', requestData)
|
|
||||||
|
|
||||||
return requestData
|
return requestData
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -599,6 +639,7 @@ const timestampToTime = (timestamp: any) => {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
|
white-space: nowrap;
|
||||||
span {
|
span {
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user