统计数据的 趋势图 修改
This commit is contained in:
parent
e152ec17df
commit
dc74ea41cf
|
|
@ -127,11 +127,11 @@
|
|||
scorllheight: 0,
|
||||
zt: '',
|
||||
date: new Date().getFullYear().toString(),
|
||||
array: [],
|
||||
array: [], // 站点名称列表(用于趋势图下拉)
|
||||
index: 0,
|
||||
index1: 0,
|
||||
array1: [],
|
||||
arrays: [],
|
||||
array1: [], // 设备名称列表(用于预警下拉)
|
||||
arrays: [], // 站点列表(已废弃,保留兼容)
|
||||
list: [],
|
||||
tabList: ['站点名称', '告警指标', '指标值', '告警时间'],
|
||||
pjlist: [],
|
||||
|
|
@ -186,9 +186,9 @@
|
|||
total: 0,
|
||||
yearStr: null,
|
||||
stationName1: '',
|
||||
stationCode1: null,
|
||||
stationCode: '',
|
||||
arrays1: [],
|
||||
stationCode1: null, // 设备ID(用于预警列表)
|
||||
stationCode: '', // 站点编码(用于趋势图)
|
||||
arrays1: [], // 设备列表(已废弃,保留兼容)
|
||||
zxtdata: [],
|
||||
timList: [{
|
||||
value: 'yearMonth',
|
||||
|
|
@ -208,7 +208,10 @@
|
|||
datetwo: currentDate,
|
||||
riqinumber: 'yearMonth',
|
||||
startDate: '2000-01-01',
|
||||
endDate: '2030-12-31'
|
||||
endDate: '2030-12-31',
|
||||
// 新增:分离站点列表和设备列表
|
||||
stationList: [], // 站点列表 [{label: '站点名', value: '站点编码'}]
|
||||
deviceList: [] // 设备列表 [{label: '设备名', value: '设备ID'}]
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
|
|
@ -234,29 +237,21 @@
|
|||
if (!val && val !== 0) return 0
|
||||
return val
|
||||
},
|
||||
// 获取站点列表
|
||||
// 获取站点列表(用于趋势图)
|
||||
importWyw() {
|
||||
this.stationList = []
|
||||
this.array = []
|
||||
this.arrays = []
|
||||
this.arrays1 = [{
|
||||
label: '全部监测设备',
|
||||
value: ''
|
||||
}]
|
||||
this.$http.get('/applet/survStationInfo/list').then(res => {
|
||||
for (var i = 0; i < res.data.data.length; i++) {
|
||||
this.arrays.push({
|
||||
this.stationList.push({
|
||||
label: res.data.data[i].stationName,
|
||||
value: res.data.data[i].stationCode
|
||||
})
|
||||
this.arrays1.push({
|
||||
label: res.data.data[i].stationName,
|
||||
value: res.data.data[i].stationCode
|
||||
value: res.data.data[i].stationCode // 站点编码
|
||||
})
|
||||
this.array.push(res.data.data[i].stationName)
|
||||
}
|
||||
// 站点数据加载完成后,设置默认站点并获取趋势数据
|
||||
if (this.array.length > 0) {
|
||||
this.stationCode = this.arrays[0]?.value || ''
|
||||
if (this.stationList.length > 0) {
|
||||
this.stationCode = this.stationList[0]?.value || ''
|
||||
// 延迟一点确保数据已渲染
|
||||
setTimeout(() => {
|
||||
this.qushicov()
|
||||
|
|
@ -266,23 +261,15 @@
|
|||
console.log('获取站点列表失败', err)
|
||||
})
|
||||
},
|
||||
// 获取监测站点设备数据
|
||||
// 获取设备列表(用于预警)
|
||||
getazsurvMulchRecord() {
|
||||
this.arrays = []
|
||||
this.deviceList = []
|
||||
this.array1 = ['全部监测设备']
|
||||
this.arrays1 = [{
|
||||
label: '全部监测设备',
|
||||
value: ''
|
||||
}]
|
||||
this.$http.get('/applet/survDeviceDeploy/survDeviceList').then(res => {
|
||||
for (var i = 0; i < res.data.data.length; i++) {
|
||||
this.arrays.push({
|
||||
this.deviceList.push({
|
||||
label: res.data.data[i].fullDeviceName,
|
||||
value: res.data.data[i].id
|
||||
})
|
||||
this.arrays1.push({
|
||||
label: res.data.data[i].fullDeviceName,
|
||||
value: res.data.data[i].id
|
||||
value: res.data.data[i].id // 设备ID
|
||||
})
|
||||
this.array1.push(res.data.data[i].fullDeviceName)
|
||||
}
|
||||
|
|
@ -295,7 +282,7 @@
|
|||
let params = {}
|
||||
params.pageNo = this.pageNo
|
||||
params.pageSize = this.pageSize
|
||||
params.deployId = this.stationCode1
|
||||
params.deployId = this.stationCode1 // 使用设备ID
|
||||
params.yearStr = this.yearStr
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
|
|
@ -352,7 +339,6 @@
|
|||
this.isRefresher = false
|
||||
}).catch(err => {
|
||||
uni.hideLoading();
|
||||
console.log('获取预警列表失败', err)
|
||||
})
|
||||
},
|
||||
// 分页加载
|
||||
|
|
@ -369,7 +355,7 @@
|
|||
let params = {}
|
||||
params.pageNo = this.pageNo
|
||||
params.pageSize = this.pageSize
|
||||
params.deployId = this.stationCode1
|
||||
params.deployId = this.stationCode1 // 使用设备ID
|
||||
params.yearStr = this.yearStr
|
||||
this.$http.get('/applet/wxclient/alertRecord', {
|
||||
params: params
|
||||
|
|
@ -468,14 +454,13 @@
|
|||
qushicov() {
|
||||
// 如果没有站点编码,使用默认值或等待
|
||||
if (!this.stationCode) {
|
||||
console.log('站点编码为空,使用默认站点')
|
||||
if (this.arrays.length > 0) {
|
||||
this.stationCode = this.arrays[0].value
|
||||
if (this.stationList.length > 0) {
|
||||
this.stationCode = this.stationList[0].value
|
||||
} else {
|
||||
// 如果站点还没加载完成,延迟重试
|
||||
setTimeout(() => {
|
||||
if (this.arrays.length > 0) {
|
||||
this.stationCode = this.arrays[0].value
|
||||
if (this.stationList.length > 0) {
|
||||
this.stationCode = this.stationList[0].value
|
||||
this.qushicov()
|
||||
}
|
||||
}, 500)
|
||||
|
|
@ -486,17 +471,14 @@
|
|||
let data = {
|
||||
summrayMode: this.riqinumber,
|
||||
startTime: this.dateqs,
|
||||
stationCode: this.stationCode,
|
||||
stationCode: this.stationCode, // 使用站点编码
|
||||
}
|
||||
console.log('请求趋势数据参数:', data)
|
||||
|
||||
this.$http.post('/applet/survDeviceDeploy/waterIntegrateStatistic', data).then(iem => {
|
||||
let lynum = iem.data.data
|
||||
console.log('趋势数据返回:', lynum)
|
||||
|
||||
// 数据为空时显示空图表
|
||||
if (!lynum || !lynum.tableHead || !lynum.tableData2 || lynum.tableHead.length === 0) {
|
||||
console.log('趋势数据为空')
|
||||
this.chartData = {
|
||||
categories: [],
|
||||
series: []
|
||||
|
|
@ -566,35 +548,33 @@
|
|||
categories: displayCategories,
|
||||
series: series
|
||||
}
|
||||
console.log('图表数据:', this.chartData)
|
||||
}, 300)
|
||||
}).catch(err => {
|
||||
console.log('趋势数据请求失败', err)
|
||||
this.chartData = {
|
||||
categories: [],
|
||||
series: []
|
||||
}
|
||||
})
|
||||
},
|
||||
// 折线图切换站点
|
||||
// 折线图切换站点 - 使用 stationList
|
||||
bindPickerChange: function(e) {
|
||||
this.index = e.detail.value
|
||||
let stationName = this.array[this.index]
|
||||
for (var i = 0; i < this.arrays.length; i++) {
|
||||
if (stationName == this.arrays[i].label) {
|
||||
this.stationCode = this.arrays[i].value
|
||||
for (var i = 0; i < this.stationList.length; i++) {
|
||||
if (stationName == this.stationList[i].label) {
|
||||
this.stationCode = this.stationList[i].value // 使用 stationList 获取站点编码
|
||||
break
|
||||
}
|
||||
}
|
||||
this.qushicov()
|
||||
},
|
||||
// 预警切换站点
|
||||
// 预警切换设备 - 使用 deviceList
|
||||
bindPickerChange1: function(e) {
|
||||
this.index1 = e.detail.value
|
||||
this.stationName1 = this.array1[this.index1]
|
||||
for (var i = 0; i < this.arrays1.length; i++) {
|
||||
if (this.stationName1 == this.arrays1[i].label) {
|
||||
this.stationCode1 = this.arrays1[i].value
|
||||
for (var i = 0; i < this.deviceList.length; i++) {
|
||||
if (this.stationName1 == this.deviceList[i].label) {
|
||||
this.stationCode1 = this.deviceList[i].value // 使用 deviceList 获取设备ID
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue