diff --git a/ui/dasadmin/src/views/backend/alarms/index.vue b/ui/dasadmin/src/views/backend/alarms/index.vue
index 8c46d056..82c73284 100644
--- a/ui/dasadmin/src/views/backend/alarms/index.vue
+++ b/ui/dasadmin/src/views/backend/alarms/index.vue
@@ -17,12 +17,17 @@
/>
{{ t('airBlower.airBlowerNumber') }}
-
+
{{ t('alarm.type') }}
-
+
@@ -153,7 +158,7 @@ const searchalarms = (): GetAlarmsTableParam => {
const start = timeRange.value[0]
const end = timeRange.value[1]
const deviceCode: any = []
- if (airBlowerNumberValue.value.length) {
+ if (airBlowerNumberValue.value && airBlowerNumberValue.value.length) {
deviceCode.push(airBlowerNumberValue.value)
} else {
airBlowerList.value.forEach((item: any) => {
diff --git a/ui/dasadmin/src/views/backend/statAnalysis/powerCurveAnalysis.vue b/ui/dasadmin/src/views/backend/statAnalysis/powerCurveAnalysis.vue
index 1d8b8f1c..dc3052ce 100644
--- a/ui/dasadmin/src/views/backend/statAnalysis/powerCurveAnalysis.vue
+++ b/ui/dasadmin/src/views/backend/statAnalysis/powerCurveAnalysis.vue
@@ -95,6 +95,7 @@ const option: any = {
itemGap: 20,
itemWidth: 8,
itemHeight: 8,
+ selectedMode: true,
data: [],
},
xAxis: {
@@ -255,6 +256,7 @@ const isLoading = ref(false)
const statAnalysisOperate = () => {
isLoading.value = true
option.series = []
+ option.legend.data = []
chart.value.setOption(option, { notMerge: true })
const requestData = {
devices: [
@@ -271,24 +273,32 @@ const statAnalysisOperate = () => {
const promise1 = new Promise((resolve, reject) => {
const madeinfactory = params.split(':')[0]
const model = params.split(':')[1]
- powerCurveQuery(madeinfactory, model).then((res) => {
- if (res.code == 200) {
- resolve(res.data)
- } else {
- isLoading.value = false
- ElMessage.warning('查询失败')
- }
- })
+ powerCurveQuery(madeinfactory, model)
+ .then((res) => {
+ if (res.code == 200) {
+ resolve(res.data)
+ } else {
+ isLoading.value = false
+ ElMessage.warning('查询失败')
+ }
+ })
+ .catch((error) => {
+ resolve(error)
+ })
})
const promise2 = new Promise((resolve, reject) => {
- historyReq(requestData).then((res) => {
- if (res.code == 200) {
- resolve(res.data)
- } else {
- isLoading.value = false
- ElMessage.warning('查询失败')
- }
- })
+ historyReq(requestData)
+ .then((res) => {
+ if (res.code == 200) {
+ resolve(res.data)
+ } else {
+ isLoading.value = false
+ ElMessage.warning('查询失败')
+ }
+ })
+ .catch((error) => {
+ resolve(error)
+ })
})
Promise.all([promise1, promise2])
@@ -299,20 +309,25 @@ const statAnalysisOperate = () => {
if (resData0) {
const iGenPower = resData0['iGenPower']['values']
const iWindSpeed = resData0['iWindSpeed']['values']
- const seriesData = iGenPower.map((item: any, index: number) => {
- return [iWindSpeed[index], item]
- })
- seriesData.sort((a: any, b: any) => {
- return a[0] - b[0]
- })
- const series = {
- type: 'line',
- data: seriesData,
- name: '实际值',
- smooth: true,
+ if (!iWindSpeed.length) {
+ ElMessage.info(`实时值数据为空`)
+ } else {
+ const seriesData = iGenPower.map((item: any, index: number) => {
+ return [iWindSpeed[index], item]
+ })
+ seriesData.sort((a: any, b: any) => {
+ return a[0] - b[0]
+ })
+ const series = {
+ type: 'line',
+ data: seriesData,
+ name: '实际值',
+ smooth: true,
+ animation: false,
+ }
+ option.series.push(series)
+ option.legend.data.push('实际值')
}
- option.series.push(series)
- option.legend.data.push('实际值')
}
if (resData1.length) {
const seriesData = resData1.map((item: any) => {
@@ -323,6 +338,7 @@ const statAnalysisOperate = () => {
data: seriesData,
name: '理论值',
smooth: true,
+ animation: false,
}
option.series.push(series)
option.legend.data.push('理论值')
@@ -331,7 +347,6 @@ const statAnalysisOperate = () => {
})
.catch((error) => {
isLoading.value = false
- console.error(error)
ElMessage.warning(error)
})
}
diff --git a/ui/dasadmin/src/views/backend/statAnalysis/trendAnalysis.vue b/ui/dasadmin/src/views/backend/statAnalysis/trendAnalysis.vue
index 7753be94..b9db81f5 100644
--- a/ui/dasadmin/src/views/backend/statAnalysis/trendAnalysis.vue
+++ b/ui/dasadmin/src/views/backend/statAnalysis/trendAnalysis.vue
@@ -105,8 +105,6 @@ import { ElMessage } from 'element-plus'
import { DArrowRight, Plus, Delete } from '@element-plus/icons-vue'
import MeasurementPage from './analysisAttributes.vue'
import * as echarts from 'echarts'
-import { promises } from 'dns'
-import { index } from '/@/api/backend'
const { t } = useI18n()
const statAnalysisSelect = reactive({
deviceId: '',
@@ -123,7 +121,7 @@ const addTime = (index: any) => {
const switchTime = (index: number) => {
times.splice(index, 1)
customName.splice(index, 1)
- calculate.splice(index, 1)
+ calculate.value.splice(index, 1)
}
const timechange = (value: any) => {
const count = getTimeIntervals(times[0][0], times[0][1])
@@ -326,7 +324,6 @@ const getTimeIntervals = (startTimestamp: number, endTimestamp: number) => {
const startDate: any = new Date(startTimestamp)
const endDate: any = new Date(endTimestamp)
let count = 0
-
switch (statAnalysisSelect.interval) {
case 'NONE':
count = Math.floor((endDate - startDate) / 1000)
@@ -343,13 +340,13 @@ const getTimeIntervals = (startTimestamp: number, endTimestamp: number) => {
case '1d':
count = Math.floor((endDate - startDate) / (1 * 24 * 60 * 60 * 1000))
break
- // default:
- // throw new Error('Invalid interval')
+ default:
+ count = Math.floor((endDate - startDate) / (5 * 60 * 1000))
}
return count
}
-const calculate: any = reactive([{ max: '', min: '', average: '' }])
+const calculate: any = ref([{ max: '', min: '', average: '' }])
var xDatas: any = []
const isLoading = ref(false)
const statAnalysisOperate = () => {
@@ -357,6 +354,7 @@ const statAnalysisOperate = () => {
option.series = []
option.legend.data = []
xDatas = []
+ calculate.value = []
chart.value.setOption(option, { notMerge: true })
const promises: any = []
times.forEach((time: any, index: number) => {
@@ -373,13 +371,17 @@ const statAnalysisOperate = () => {
endTime: new Date(time[1]).getTime(),
}
const promise = new Promise((resolve, reject) => {
- historyReq(requestData).then((res) => {
- if (res.code == 200) {
- resolve(res.data)
- } else {
- ElMessage.warning('查询失败')
- }
- })
+ historyReq(requestData)
+ .then((res) => {
+ if (res.code == 200) {
+ resolve(res.data)
+ } else {
+ ElMessage.warning('查询失败')
+ }
+ })
+ .catch((error) => {
+ reject(error)
+ })
})
promises.push(promise)
}
@@ -397,7 +399,11 @@ const historyDataReq = (promises: any) => {
const resData = (res && deviceId in res && res[deviceId][attributeCode]) || undefined
const xData = resData['times']
const yData = resData['values']
- calculate[index] = calculateStats(yData)
+ if (!yData.length) {
+ ElMessage.info(`${customName[index]}数据为空`)
+ return
+ }
+ calculate.value[index] = calculateStats(yData)
xDatas.push({
series: String(customName[index]),
data: xData,
@@ -421,6 +427,7 @@ const historyDataReq = (promises: any) => {
type: 'line',
data: yData,
showSymbol: true,
+ animation: false,
}
option.legend.data.push(customName[index])
option.series.push(seriesData)
diff --git a/ui/dasadmin/src/views/backend/statAnalysis/trendComparison.vue b/ui/dasadmin/src/views/backend/statAnalysis/trendComparison.vue
index 0da8630c..f3e41ac9 100644
--- a/ui/dasadmin/src/views/backend/statAnalysis/trendComparison.vue
+++ b/ui/dasadmin/src/views/backend/statAnalysis/trendComparison.vue
@@ -138,7 +138,7 @@ const switchDevice = (index: number) => {
statAnalysisAttributes.splice(index, 1)
statAnalysisAttributeCode.splice(index, 1)
customName.splice(index, 1)
- calculate.splice(index, 1)
+ calculate.value.splice(index, 1)
}
const isExpand = ref(false)
@@ -327,54 +327,69 @@ const isLoading = ref(false)
const statAnalysisOperate = () => {
isLoading.value = true
+ option.series = []
+ option.legend.data = []
+ calculate.value = []
+ chart.value.setOption(option, { notMerge: true })
historyDataReq(getRequestData())
}
-const calculate: any = reactive([{ max: '', min: '', average: '' }])
+const calculate: any = ref([{ max: '', min: '', average: '' }])
const historyDataReq = (data: any) => {
- historyReq(data).then((res) => {
- isLoading.value = false
- if (res.code == 200) {
- const resData = res.data
- const deviceIdKeys = Object.keys(resData)
- const attributeKeys = []
- if (deviceIdKeys.length) {
- deviceIdKeys.forEach((item) => {
- const indexList1 = findAllOccurrences(statAnalysisDeviceId, item)
- Object.keys(resData[item]).forEach((value) => {
- const indexList2 = findAllOccurrences(statAnalysisAttributeCode, value)
- const dataIndex = getCommonElements(indexList1, indexList2)[0]
- const historyData = resData[item][value]
- const xData = historyData['times']
- const yData = historyData['values']
- const seriesData = {
- name: customName[dataIndex],
- type: 'line',
- data: yData,
- }
- calculate[dataIndex] = calculateStats(yData)
- option.tooltip = {
- show: true,
- trigger: 'axis',
- formatter: function (params: any) {
- return params
- .map((item: any) => {
- return `${item.marker} ${item.seriesName} (${timestampToTime(xData[item.dataIndex])}): ${item.data}`
- })
- .join('
')
- },
- }
- option.legend.data.push(customName[dataIndex])
- option.xAxis.data = xData.map((item: any) => timestampToTime(item))
- option.series.push(seriesData)
- chart.value.setOption(option)
- })
- })
- }
- } else {
+ historyReq(data)
+ .then((res) => {
isLoading.value = false
- ElMessage.warning('查询失败')
- }
- })
+ if (res.code == 200) {
+ const resData = res.data
+ const deviceIdKeys = Object.keys(resData)
+ const attributeKeys = []
+ if (deviceIdKeys.length) {
+ deviceIdKeys.forEach((item) => {
+ const indexList1 = findAllOccurrences(statAnalysisDeviceId, item)
+ Object.keys(resData[item]).forEach((value) => {
+ const indexList2 = findAllOccurrences(statAnalysisAttributeCode, value)
+ const dataIndex = getCommonElements(indexList1, indexList2)[0]
+ const historyData = resData[item][value]
+ const xData = historyData['times']
+ const yData = historyData['values']
+ if (!yData.length) {
+ ElMessage.info(`${customName[dataIndex]}数据为空`)
+ return
+ }
+ const seriesData = {
+ name: customName[dataIndex],
+ type: 'line',
+ data: yData,
+ animation: false,
+ }
+ calculate.value[dataIndex] = calculateStats(yData)
+ option.tooltip = {
+ show: true,
+ trigger: 'axis',
+ formatter: function (params: any) {
+ return params
+ .map((item: any) => {
+ return `${item.marker} ${item.seriesName} (${timestampToTime(xData[item.dataIndex])}): ${item.data}`
+ })
+ .join('
')
+ },
+ }
+ option.legend.data.push(customName[dataIndex])
+ option.xAxis.data = xData.map((item: any) => timestampToTime(item))
+ option.series.push(seriesData)
+ chart.value.setOption(option)
+ })
+ })
+ }
+ } else {
+ isLoading.value = false
+ ElMessage.warning('查询失败')
+ }
+ })
+ .catch((error) => {
+ isLoading.value = false
+ console.error(error)
+ ElMessage.warning(error)
+ })
}
const findAllOccurrences = (arr: any, target: any) => {