Merge branch 'main' of https://git.jsspisoft.com/ry-das
This commit is contained in:
commit
a47ca1a29b
@ -96,6 +96,7 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
|
|||||||
SysEquipment sysEquipment = new SysEquipment();
|
SysEquipment sysEquipment = new SysEquipment();
|
||||||
BeanCopyUtils.copy(sysEquipmentDto, sysEquipment);
|
BeanCopyUtils.copy(sysEquipmentDto, sysEquipment);
|
||||||
SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
|
SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
|
||||||
|
SysEquipment oldModelSysEquipInfo = sysEquipmentMapper.selectById(sysEquipmentDto.getId());
|
||||||
SysEquipmentVo oldSysEquipment = sysEquipmentMapper.queryEquipmentInfoByCode(sysEquipmentDto.getCode());
|
SysEquipmentVo oldSysEquipment = sysEquipmentMapper.queryEquipmentInfoByCode(sysEquipmentDto.getCode());
|
||||||
// 判断设备编码是否存在
|
// 判断设备编码是否存在
|
||||||
if (sysEquipmentMapper.queryEquipmentByCode(sysEquipment.getCode()) > 0) {
|
if (sysEquipmentMapper.queryEquipmentByCode(sysEquipment.getCode()) > 0) {
|
||||||
@ -106,7 +107,8 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
|
|||||||
sysEquipment.setUpdatedTime(new Date());
|
sysEquipment.setUpdatedTime(new Date());
|
||||||
sysEquipment.setUpdatedBy(sysUserVo.getAccount());
|
sysEquipment.setUpdatedBy(sysUserVo.getAccount());
|
||||||
sysEquipmentMapper.updateById(sysEquipment);
|
sysEquipmentMapper.updateById(sysEquipment);
|
||||||
if (oldSysEquipment.getIotModelId() == null && sysEquipment.getIotModelId() != null){
|
|
||||||
|
if (oldModelSysEquipInfo.getIotModelId() == null && sysEquipment.getIotModelId() != null){
|
||||||
dataService.deviceModelMap.put(sysEquipment.getId().toString(),dataService.iotModelMap.get(sysEquipment.getIotModelId().toString()));
|
dataService.deviceModelMap.put(sysEquipment.getId().toString(),dataService.iotModelMap.get(sysEquipment.getIotModelId().toString()));
|
||||||
}
|
}
|
||||||
SysEquipmentVo sysEquipmentVo = new SysEquipmentVo();
|
SysEquipmentVo sysEquipmentVo = new SysEquipmentVo();
|
||||||
|
@ -7,14 +7,7 @@ export const queryWindTurbinesPages = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const historyReq = (data: {
|
export const historyReq = (data: any) => {
|
||||||
devices: {
|
|
||||||
deviceId: string
|
|
||||||
attributes: string
|
|
||||||
}
|
|
||||||
startTime: string
|
|
||||||
endTime: string
|
|
||||||
}) => {
|
|
||||||
return createAxios({
|
return createAxios({
|
||||||
url: '/api/data/history',
|
url: '/api/data/history',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
@ -17,12 +17,17 @@
|
|||||||
/>
|
/>
|
||||||
<div style="width: 20px"></div>
|
<div style="width: 20px"></div>
|
||||||
<div style="width: fit-content; min-width: 60px">{{ t('airBlower.airBlowerNumber') }}</div>
|
<div style="width: fit-content; min-width: 60px">{{ t('airBlower.airBlowerNumber') }}</div>
|
||||||
<el-select v-model="airBlowerNumberValue" :placeholder="t('alarm.select') + t('airBlower.airBlowerNumber')" class="alarmSelect">
|
<el-select
|
||||||
|
v-model="airBlowerNumberValue"
|
||||||
|
:placeholder="t('alarm.select') + t('airBlower.airBlowerNumber')"
|
||||||
|
class="alarmSelect"
|
||||||
|
clearable
|
||||||
|
>
|
||||||
<el-option v-for="v in airBlowerList" :key="v.value" :label="v.label" :value="v.value"></el-option>
|
<el-option v-for="v in airBlowerList" :key="v.value" :label="v.label" :value="v.value"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<div style="width: 20px"></div>
|
<div style="width: 20px"></div>
|
||||||
<div style="width: fit-content; min-width: 30px">{{ t('alarm.type') }}</div>
|
<div style="width: fit-content; min-width: 30px">{{ t('alarm.type') }}</div>
|
||||||
<el-select v-model="alarmTypeValue" :placeholder="t('alarm.select') + t('alarm.type')" class="alarmSelect">
|
<el-select v-model="alarmTypeValue" :placeholder="t('alarm.select') + t('alarm.type')" class="alarmSelect" clearable>
|
||||||
<el-option v-for="v in alarmTypes" :key="v.value" :label="v.label" :value="v.value"></el-option>
|
<el-option v-for="v in alarmTypes" :key="v.value" :label="v.label" :value="v.value"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<div style="width: 20px"></div>
|
<div style="width: 20px"></div>
|
||||||
@ -153,7 +158,7 @@ const searchalarms = (): GetAlarmsTableParam => {
|
|||||||
const start = timeRange.value[0]
|
const start = timeRange.value[0]
|
||||||
const end = timeRange.value[1]
|
const end = timeRange.value[1]
|
||||||
const deviceCode: any = []
|
const deviceCode: any = []
|
||||||
if (airBlowerNumberValue.value.length) {
|
if (airBlowerNumberValue.value && airBlowerNumberValue.value.length) {
|
||||||
deviceCode.push(airBlowerNumberValue.value)
|
deviceCode.push(airBlowerNumberValue.value)
|
||||||
} else {
|
} else {
|
||||||
airBlowerList.value.forEach((item: any) => {
|
airBlowerList.value.forEach((item: any) => {
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<div class="small-title">全场实时有功</div>
|
<div class="small-title">全场实时有功</div>
|
||||||
<div class="small-value">
|
<div class="small-value">
|
||||||
<span class="content-number">{{realData.attributeMap.windfarmactivepower}}</span>
|
<span class="content-number">{{realData.attributeMap.windfarmactivepower}}</span>
|
||||||
<span>MW</span>
|
<span>kW</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -349,6 +349,7 @@ const getTableData = (deviceCode) => {
|
|||||||
limit: 100,
|
limit: 100,
|
||||||
eventLevel:2
|
eventLevel:2
|
||||||
}
|
}
|
||||||
|
// console.log(JSON.stringify(data))
|
||||||
getAlarmListReq(data).then((res) => {
|
getAlarmListReq(data).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
//tableData.value = res.rows
|
//tableData.value = res.rows
|
||||||
@ -430,11 +431,7 @@ const createScroll = () => {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const activeName = ref('first')
|
|
||||||
//let autoUpdateTimer: any = null
|
|
||||||
let autoUpdateForSecondTimer: any = null
|
let autoUpdateForSecondTimer: any = null
|
||||||
let autoUpdateTimerForMinuteTimer: any = null
|
|
||||||
let autoUpdateTimerForHourTimer: any = null
|
|
||||||
const autoUpdate = () => {
|
const autoUpdate = () => {
|
||||||
if (!autoUpdateForSecondTimer) {
|
if (!autoUpdateForSecondTimer) {
|
||||||
autoUpdateForSecondTimer = setInterval(() => {
|
autoUpdateForSecondTimer = setInterval(() => {
|
||||||
@ -473,7 +470,7 @@ onMounted(() => {
|
|||||||
|
|
||||||
equipList({ objectType: 10002 }).then((res) => {
|
equipList({ objectType: 10002 }).then((res) => {
|
||||||
res.data.map((item: any) => {
|
res.data.map((item: any) => {
|
||||||
deviceCode.value.push(item.name)
|
deviceCode.value.push(item.code)
|
||||||
})
|
})
|
||||||
|
|
||||||
getTableData(deviceCode.value)
|
getTableData(deviceCode.value)
|
||||||
@ -484,10 +481,6 @@ onUnmounted(() => {
|
|||||||
window.removeEventListener('resize', sizeChange)
|
window.removeEventListener('resize', sizeChange)
|
||||||
clearInterval(timer)
|
clearInterval(timer)
|
||||||
autoUpdateForSecondTimer && clearInterval(autoUpdateForSecondTimer)
|
autoUpdateForSecondTimer && clearInterval(autoUpdateForSecondTimer)
|
||||||
/*const chartKeys = Object.keys(state.charts) as Array<keyof typeof state.charts>
|
|
||||||
chartKeys.forEach((key) => {
|
|
||||||
state.charts[key].dispose()
|
|
||||||
})*/
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="topRight">
|
<div class="topRight">
|
||||||
<el-button type="primary" @click="statAnalysisOperate()">{{ t('statAnalysis.search') }}</el-button>
|
<el-button type="primary" :loading="isLoading" @click="statAnalysisOperate()">{{ t('statAnalysis.search') }}</el-button>
|
||||||
<el-button style="color: #0064aa" @click="statAnalysisExport()">{{ t('statAnalysis.export') }}</el-button>
|
<el-button style="color: #0064aa" @click="statAnalysisExport()">{{ t('statAnalysis.export') }}</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-header>
|
</el-header>
|
||||||
@ -95,6 +95,7 @@ const option: any = {
|
|||||||
itemGap: 20,
|
itemGap: 20,
|
||||||
itemWidth: 8,
|
itemWidth: 8,
|
||||||
itemHeight: 8,
|
itemHeight: 8,
|
||||||
|
selectedMode: true,
|
||||||
data: [],
|
data: [],
|
||||||
},
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
@ -165,31 +166,6 @@ const queryfactoery = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const querytheoretical = (val: any) => {
|
|
||||||
const madeinfactory = val.split(':')[0]
|
|
||||||
const model = val.split(':')[1]
|
|
||||||
powerCurveQuery(madeinfactory, model).then((res) => {
|
|
||||||
if (res.code == 200) {
|
|
||||||
const resData = res.data
|
|
||||||
if (resData.length) {
|
|
||||||
const seriesData = resData.map((item: any) => {
|
|
||||||
return [item.speed, item.power]
|
|
||||||
})
|
|
||||||
const series = {
|
|
||||||
type: 'line',
|
|
||||||
data: seriesData,
|
|
||||||
name: '理论值',
|
|
||||||
smooth: true,
|
|
||||||
}
|
|
||||||
option.series.push(series)
|
|
||||||
option.legend.data.push('理论值')
|
|
||||||
chart.value.setOption(option)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ElMessage.warning('查询失败')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
const queryWindTurbines = () => {
|
const queryWindTurbines = () => {
|
||||||
queryWindTurbinesPages().then((res) => {
|
queryWindTurbinesPages().then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
@ -276,10 +252,12 @@ const getDateRange = (type: 'week' | 'month') => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isLoading = ref(false)
|
||||||
const statAnalysisOperate = () => {
|
const statAnalysisOperate = () => {
|
||||||
|
isLoading.value = true
|
||||||
option.series = []
|
option.series = []
|
||||||
|
option.legend.data = []
|
||||||
chart.value.setOption(option, { notMerge: true })
|
chart.value.setOption(option, { notMerge: true })
|
||||||
// chart.value.clear()
|
|
||||||
const requestData = {
|
const requestData = {
|
||||||
devices: [
|
devices: [
|
||||||
{
|
{
|
||||||
@ -292,16 +270,48 @@ const statAnalysisOperate = () => {
|
|||||||
endTime: new Date(statAnalysisTime.value[1]).getTime(),
|
endTime: new Date(statAnalysisTime.value[1]).getTime(),
|
||||||
}
|
}
|
||||||
const params = statAnalysisFatory.value ? statAnalysisFatory.value : statAnalysisDeviceId.value
|
const params = statAnalysisFatory.value ? statAnalysisFatory.value : statAnalysisDeviceId.value
|
||||||
querytheoretical(params)
|
const promise1 = new Promise((resolve, reject) => {
|
||||||
historyDataReq(requestData)
|
const madeinfactory = params.split(':')[0]
|
||||||
}
|
const model = params.split(':')[1]
|
||||||
const historyDataReq = (data: any) => {
|
powerCurveQuery(madeinfactory, model)
|
||||||
historyReq(data).then((res) => {
|
.then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
const resData = res.data[statAnalysisDeviceId.value.split(':')[2]]
|
resolve(res.data)
|
||||||
if (resData) {
|
} else {
|
||||||
const iGenPower = resData['iGenPower']['values']
|
isLoading.value = false
|
||||||
const iWindSpeed = resData['iWindSpeed']['values']
|
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('查询失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
resolve(error)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
Promise.all([promise1, promise2])
|
||||||
|
.then((results: any) => {
|
||||||
|
isLoading.value = false
|
||||||
|
const resData0 = results[1][statAnalysisDeviceId.value.split(':')[2]]
|
||||||
|
const resData1 = results[0]
|
||||||
|
if (resData0) {
|
||||||
|
const iGenPower = resData0['iGenPower']['values']
|
||||||
|
const iWindSpeed = resData0['iWindSpeed']['values']
|
||||||
|
if (!iWindSpeed.length) {
|
||||||
|
ElMessage.info(`实时值数据为空`)
|
||||||
|
} else {
|
||||||
const seriesData = iGenPower.map((item: any, index: number) => {
|
const seriesData = iGenPower.map((item: any, index: number) => {
|
||||||
return [iWindSpeed[index], item]
|
return [iWindSpeed[index], item]
|
||||||
})
|
})
|
||||||
@ -313,14 +323,31 @@ const historyDataReq = (data: any) => {
|
|||||||
data: seriesData,
|
data: seriesData,
|
||||||
name: '实际值',
|
name: '实际值',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
|
animation: false,
|
||||||
}
|
}
|
||||||
option.series.push(series)
|
option.series.push(series)
|
||||||
option.legend.data.push('实际值')
|
option.legend.data.push('实际值')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (resData1.length) {
|
||||||
|
const seriesData = resData1.map((item: any) => {
|
||||||
|
return [item.speed, item.power]
|
||||||
|
})
|
||||||
|
const series = {
|
||||||
|
type: 'line',
|
||||||
|
data: seriesData,
|
||||||
|
name: '理论值',
|
||||||
|
smooth: true,
|
||||||
|
animation: false,
|
||||||
|
}
|
||||||
|
option.series.push(series)
|
||||||
|
option.legend.data.push('理论值')
|
||||||
|
}
|
||||||
chart.value.setOption(option)
|
chart.value.setOption(option)
|
||||||
}
|
})
|
||||||
} else {
|
.catch((error) => {
|
||||||
ElMessage.warning('查询失败')
|
isLoading.value = false
|
||||||
}
|
ElMessage.warning(error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="topRight">
|
<div class="topRight">
|
||||||
<el-button type="primary" @click="statAnalysisOperate()">{{ t('statAnalysis.search') }}</el-button>
|
<el-button type="primary" :loading="isLoading" @click="statAnalysisOperate()">{{ t('statAnalysis.search') }}</el-button>
|
||||||
<el-button style="color: #0064aa" @click="statAnalysisExport()">{{ t('statAnalysis.export') }}</el-button>
|
<el-button style="color: #0064aa" @click="statAnalysisExport()">{{ t('statAnalysis.export') }}</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-header>
|
</el-header>
|
||||||
@ -121,7 +121,7 @@ const addTime = (index: any) => {
|
|||||||
const switchTime = (index: number) => {
|
const switchTime = (index: number) => {
|
||||||
times.splice(index, 1)
|
times.splice(index, 1)
|
||||||
customName.splice(index, 1)
|
customName.splice(index, 1)
|
||||||
calculate.splice(index, 1)
|
calculate.value.splice(index, 1)
|
||||||
}
|
}
|
||||||
const timechange = (value: any) => {
|
const timechange = (value: any) => {
|
||||||
const count = getTimeIntervals(times[0][0], times[0][1])
|
const count = getTimeIntervals(times[0][0], times[0][1])
|
||||||
@ -324,7 +324,6 @@ const getTimeIntervals = (startTimestamp: number, endTimestamp: number) => {
|
|||||||
const startDate: any = new Date(startTimestamp)
|
const startDate: any = new Date(startTimestamp)
|
||||||
const endDate: any = new Date(endTimestamp)
|
const endDate: any = new Date(endTimestamp)
|
||||||
let count = 0
|
let count = 0
|
||||||
|
|
||||||
switch (statAnalysisSelect.interval) {
|
switch (statAnalysisSelect.interval) {
|
||||||
case 'NONE':
|
case 'NONE':
|
||||||
count = Math.floor((endDate - startDate) / 1000)
|
count = Math.floor((endDate - startDate) / 1000)
|
||||||
@ -341,19 +340,23 @@ const getTimeIntervals = (startTimestamp: number, endTimestamp: number) => {
|
|||||||
case '1d':
|
case '1d':
|
||||||
count = Math.floor((endDate - startDate) / (1 * 24 * 60 * 60 * 1000))
|
count = Math.floor((endDate - startDate) / (1 * 24 * 60 * 60 * 1000))
|
||||||
break
|
break
|
||||||
// default:
|
default:
|
||||||
// throw new Error('Invalid interval')
|
count = Math.floor((endDate - startDate) / (5 * 60 * 1000))
|
||||||
}
|
}
|
||||||
|
|
||||||
return count
|
return count
|
||||||
}
|
}
|
||||||
const calculate: any = reactive([{ max: '', min: '', average: '' }])
|
const calculate: any = ref([{ max: '', min: '', average: '' }])
|
||||||
var xDatas: any = []
|
var xDatas: any = []
|
||||||
|
const isLoading = ref(false)
|
||||||
const statAnalysisOperate = () => {
|
const statAnalysisOperate = () => {
|
||||||
|
isLoading.value = true
|
||||||
option.series = []
|
option.series = []
|
||||||
option.legend.data = []
|
option.legend.data = []
|
||||||
xDatas = []
|
xDatas = []
|
||||||
|
calculate.value = []
|
||||||
chart.value.setOption(option, { notMerge: true })
|
chart.value.setOption(option, { notMerge: true })
|
||||||
|
const promises: any = []
|
||||||
times.forEach((time: any, index: number) => {
|
times.forEach((time: any, index: number) => {
|
||||||
if (time[0] && time[1]) {
|
if (time[0] && time[1]) {
|
||||||
const requestData = {
|
const requestData = {
|
||||||
@ -367,21 +370,40 @@ const statAnalysisOperate = () => {
|
|||||||
startTime: new Date(time[0]).getTime(),
|
startTime: new Date(time[0]).getTime(),
|
||||||
endTime: new Date(time[1]).getTime(),
|
endTime: new Date(time[1]).getTime(),
|
||||||
}
|
}
|
||||||
historyDataReq(requestData, index)
|
const promise = new Promise((resolve, reject) => {
|
||||||
|
historyReq(requestData)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
resolve(res.data)
|
||||||
|
} else {
|
||||||
|
ElMessage.warning('查询失败')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
reject(error)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
promises.push(promise)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
historyDataReq(promises)
|
||||||
}
|
}
|
||||||
|
|
||||||
const historyDataReq = (data: any, index: number) => {
|
const historyDataReq = (promises: any) => {
|
||||||
historyReq(data).then((res) => {
|
Promise.all(promises)
|
||||||
if (res.code == 200) {
|
.then((results: any) => {
|
||||||
|
isLoading.value = false
|
||||||
const deviceId = statAnalysisSelect.deviceId
|
const deviceId = statAnalysisSelect.deviceId
|
||||||
const attributeCode = statAnalysisSelect.attributeCode
|
const attributeCode = statAnalysisSelect.attributeCode
|
||||||
const resData = (res.data && deviceId in res.data && res.data[deviceId][attributeCode]) || undefined
|
results.forEach((res: any, index: number) => {
|
||||||
if (resData) {
|
const resData = (res && deviceId in res && res[deviceId][attributeCode]) || undefined
|
||||||
const xData = resData['times']
|
const xData = resData['times']
|
||||||
const yData = resData['values']
|
const yData = resData['values']
|
||||||
calculate[index] = calculateStats(yData)
|
if (!yData.length) {
|
||||||
|
ElMessage.info(`${customName[index]}数据为空`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
calculate.value[index] = calculateStats(yData)
|
||||||
xDatas.push({
|
xDatas.push({
|
||||||
series: String(customName[index]),
|
series: String(customName[index]),
|
||||||
data: xData,
|
data: xData,
|
||||||
@ -405,16 +427,17 @@ const historyDataReq = (data: any, index: number) => {
|
|||||||
type: 'line',
|
type: 'line',
|
||||||
data: yData,
|
data: yData,
|
||||||
showSymbol: true,
|
showSymbol: true,
|
||||||
|
animation: false,
|
||||||
}
|
}
|
||||||
option.legend.data.push(customName[index])
|
option.legend.data.push(customName[index])
|
||||||
option.series.push(seriesData)
|
option.series.push(seriesData)
|
||||||
chart.value.setOption(option)
|
chart.value.setOption(option)
|
||||||
} else {
|
})
|
||||||
ElMessage.warning('查询失败1')
|
})
|
||||||
}
|
.catch((error) => {
|
||||||
} else {
|
isLoading.value = false
|
||||||
ElMessage.warning('查询失败')
|
console.error(error)
|
||||||
}
|
ElMessage.warning(error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -437,7 +460,6 @@ const statAnalysisExport = () => {
|
|||||||
requestData.push(devices)
|
requestData.push(devices)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
console.log(requestData)
|
|
||||||
trendAnalyseExport(requestData).then((res: any) => {
|
trendAnalyseExport(requestData).then((res: any) => {
|
||||||
const downloadUrl = window.URL.createObjectURL(res)
|
const downloadUrl = window.URL.createObjectURL(res)
|
||||||
const a = document.createElement('a')
|
const a = document.createElement('a')
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="topRight">
|
<div class="topRight">
|
||||||
<el-button type="primary" @click="statAnalysisOperate()">{{ t('statAnalysis.search') }}</el-button>
|
<el-button type="primary" :loading="isLoading" @click="statAnalysisOperate()">{{ t('statAnalysis.search') }}</el-button>
|
||||||
<el-button style="color: #0064aa" @click="statAnalysisExport()">{{ t('statAnalysis.export') }}</el-button>
|
<el-button style="color: #0064aa" @click="statAnalysisExport()">{{ t('statAnalysis.export') }}</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-header>
|
</el-header>
|
||||||
@ -138,7 +138,7 @@ const switchDevice = (index: number) => {
|
|||||||
statAnalysisAttributes.splice(index, 1)
|
statAnalysisAttributes.splice(index, 1)
|
||||||
statAnalysisAttributeCode.splice(index, 1)
|
statAnalysisAttributeCode.splice(index, 1)
|
||||||
customName.splice(index, 1)
|
customName.splice(index, 1)
|
||||||
calculate.splice(index, 1)
|
calculate.value.splice(index, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
const isExpand = ref(false)
|
const isExpand = ref(false)
|
||||||
@ -323,12 +323,21 @@ const getDateRange = (type: 'week' | 'month') => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isLoading = ref(false)
|
||||||
|
|
||||||
const statAnalysisOperate = () => {
|
const statAnalysisOperate = () => {
|
||||||
|
isLoading.value = true
|
||||||
|
option.series = []
|
||||||
|
option.legend.data = []
|
||||||
|
calculate.value = []
|
||||||
|
chart.value.setOption(option, { notMerge: true })
|
||||||
historyDataReq(getRequestData())
|
historyDataReq(getRequestData())
|
||||||
}
|
}
|
||||||
const calculate: any = reactive([{ max: '', min: '', average: '' }])
|
const calculate: any = ref([{ max: '', min: '', average: '' }])
|
||||||
const historyDataReq = (data: any) => {
|
const historyDataReq = (data: any) => {
|
||||||
historyReq(data).then((res) => {
|
historyReq(data)
|
||||||
|
.then((res) => {
|
||||||
|
isLoading.value = false
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
const resData = res.data
|
const resData = res.data
|
||||||
const deviceIdKeys = Object.keys(resData)
|
const deviceIdKeys = Object.keys(resData)
|
||||||
@ -342,12 +351,17 @@ const historyDataReq = (data: any) => {
|
|||||||
const historyData = resData[item][value]
|
const historyData = resData[item][value]
|
||||||
const xData = historyData['times']
|
const xData = historyData['times']
|
||||||
const yData = historyData['values']
|
const yData = historyData['values']
|
||||||
|
if (!yData.length) {
|
||||||
|
ElMessage.info(`${customName[dataIndex]}数据为空`)
|
||||||
|
return
|
||||||
|
}
|
||||||
const seriesData = {
|
const seriesData = {
|
||||||
name: customName[dataIndex],
|
name: customName[dataIndex],
|
||||||
type: 'line',
|
type: 'line',
|
||||||
data: yData,
|
data: yData,
|
||||||
|
animation: false,
|
||||||
}
|
}
|
||||||
calculate[dataIndex] = calculateStats(yData)
|
calculate.value[dataIndex] = calculateStats(yData)
|
||||||
option.tooltip = {
|
option.tooltip = {
|
||||||
show: true,
|
show: true,
|
||||||
trigger: 'axis',
|
trigger: 'axis',
|
||||||
@ -367,9 +381,15 @@ const historyDataReq = (data: any) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
isLoading.value = false
|
||||||
ElMessage.warning('查询失败')
|
ElMessage.warning('查询失败')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
isLoading.value = false
|
||||||
|
console.error(error)
|
||||||
|
ElMessage.warning(error)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const findAllOccurrences = (arr: any, target: any) => {
|
const findAllOccurrences = (arr: any, target: any) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user