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