From b5cd18e3517406706ef0d432587946ff1941c037 Mon Sep 17 00:00:00 2001
From: "978184212@qq.com" <978184212@qq.com>
Date: Fri, 21 Nov 2025 19:03:05 +0800
Subject: [PATCH] =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
packDetail/pages/analysis/index.vue | 272 +++++++++++++++++++---------
pages/maps/index.vue | 110 ++++++++++-
2 files changed, 299 insertions(+), 83 deletions(-)
diff --git a/packDetail/pages/analysis/index.vue b/packDetail/pages/analysis/index.vue
index 2e5ba39..77552d8 100644
--- a/packDetail/pages/analysis/index.vue
+++ b/packDetail/pages/analysis/index.vue
@@ -34,23 +34,24 @@
-
-
-
-
+
+
+ {{dateqs}}
+
+
-
+
@@ -132,6 +133,9 @@
uniEcCanvas,
},
data() {
+ const currentDate = this.getDate({
+ format: true
+ })
return {
height: 0,
scorllheight: 0,
@@ -145,64 +149,38 @@
list: [],
tabList: ['站点名称', '告警指标', '指标值', '告警时间'],
pjlist: [],
- ec: {
- option: {
- title: {
- subtext: '(单位:mg/l)'
- },
- grid: {
- top: "45",
- left: "5",
- bottom: "5",
- right: "25",
- containLabel: true,
- },
- tooltip: {
- trigger: 'axis',
- position: [20, 20],
- axisPointer: {
- type: 'cross',
- label: {
- backgroundColor: '#6a7985'
- }
- }
- },
- legend: {
- icon: 'roundRect',
- itemHeight: 10,
- itemWidth: 10,
- right: '10%',
- top: '10%',
- textStyle: {
- //图例字体大小
- fontSize: 10,
- },
- data: []
- },
- color: [],
- toolbox: {
- feature: {
- saveAsImage: {}
- }
- },
- xAxis: [{
- type: 'category',
- boundaryGap: false,
- axisLabel: {
- //x轴文字的配置
- show: true,
- interval: 0, //使x轴文字显示全
- color: '#999999',
- },
- data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月',
- '12月'
- ],
- }],
-
- yAxis: [{
- type: 'value'
- }],
- series: []
+ chartData: {},
+ opts: {
+ color: ["#1890FF","#91CB74","#FAC858","#EE6666","#73C0DE","#3CA272","#FC8452","#9A60B4","#ea7ccc"],
+ padding: [15,10,0,15],
+ dataLabel: false,
+ dataPointShape: false,
+ enableScroll: true,
+ legend: {},
+ xAxis: {
+ disableGrid: true,
+ scrollShow: true,
+ itemCount: 4
+ },
+ yAxis: {
+ gridType: "dash",
+ dashLength: 2,
+ data: [
+ {
+ min: 0,
+ max: 150
+ }
+ ]
+ },
+ extra: {
+ line: {
+ type: "curve",
+ width: 2,
+ activeType: "hollow",
+ linearType: "custom",
+ onShadow: true,
+ animation: "horizontal"
+ }
}
},
pjnr: '',
@@ -222,7 +200,25 @@
stationCode1: null,
stationCode: '',
arrays1: [],
- zxtdata: []
+ zxtdata: [],
+ timList: [{
+ value: 'yearMonth',
+ name: '年',
+ checked: 'true'
+ },
+ {
+ value: 'monthDays',
+ name: '月'
+ },
+ {
+ value: 'dayhours',
+ name: '日'
+ },
+ ],
+ current: 0,
+ dateqs:new Date().getFullYear(),
+ datetwo:currentDate,
+ riqinumber:'yearMonth',
}
},
onLoad() {
@@ -240,7 +236,8 @@
this.getpj()
this.getazsurvMulchRecord()
this.getyjList()
- this.gettj()
+ // this.gettj()
+ this.qushicov()
},
methods: {
// 获取监测站点数据
@@ -390,15 +387,100 @@
},
// 选择年月日
radioChange(e){
- console.log("选择年月日.......",e)
- let data = {
- summrayMode:'dayhours',
- startTime:'2025-11-20',
- endTime:'endTime'
+ this.riqinumber = e.detail.value
+ console.log("0000000000000",this.datetwo)
+ this.bindDateqsChange(this.datetwo,'twotime')
+ },
+ // 趋势时间
+ bindDateqsChange(e,tiem) {
+ if (tiem=='twotime') {
+ let selectedDate = e
+ if (this.riqinumber === 'monthDays') {
+ this.dateqs = selectedDate.slice(0, 7); // YYYY-MM
+ } else if (this.riqinumber === 'yearMonth') {
+ this.dateqs = selectedDate.slice(0, 4); // YYYY
+ } else {
+ this.dateqs = selectedDate; // YYYY-MM-DD
+ }
+ } else {
+ let selectedDate = e.detail.value;
+ if (this.riqinumber === 'monthDays') {
+ this.dateqs = selectedDate.slice(0, 7); // YYYY-MM
+ } else if (this.riqinumber === 'yearMonth') {
+ this.dateqs = selectedDate.slice(0, 4); // YYYY
+ } else {
+ this.dateqs = selectedDate; // YYYY-MM-DD
+ }
}
- this.$http.get('/applet/survDeviceDeploy/waterIntegrateStatistic',data).then(res => {
- console.log("66666666666",res)
- })
+
+ this.qushicov();
+ },
+ // 趋势接口
+ // 在 qushicov 方法中修改
+ qushicov() {
+ let data = {
+ summrayMode: this.riqinumber,
+ startTime: this.dateqs,
+ }
+ this.$http.post('/applet/survDeviceDeploy/waterIntegrateStatistic', data).then(iem => {
+ console.log("接口返回数据", iem)
+ let lynum = iem.data.data
+
+ setTimeout(() => {
+ let categories = [];
+ let series = [];
+ let allValues = []; // 收集所有数值
+
+ if (lynum.tableHead && lynum.tableHead.length > 0) {
+ categories = lynum.tableIndex;
+
+ lynum.tableHead.forEach((header, index) => {
+ const seriesData = lynum.tableData2.map(row => {
+ const value = row[index] === "0" ? 0 : parseFloat(row[index]) || 0;
+ allValues.push(value); // 收集数值
+ return value;
+ });
+
+ series.push({
+ name: header.eleDesc,
+ data: seriesData
+ });
+ });
+
+ // 动态计算Y轴范围
+ const maxValue = Math.max(...allValues);
+ const minValue = Math.min(...allValues);
+
+ // 设置合适的上下边界,增加一些余量
+ const padding = maxValue * 0.1; // 10%的余量
+ const yAxisMax = maxValue + padding;
+ const yAxisMin = Math.max(0, minValue - padding); // 确保最小值不小于0
+
+ // 更新opts中的yAxis配置
+ this.opts = {
+ ...this.opts,
+ yAxis: {
+ gridType: "dash",
+ dashLength: 2,
+ data: [
+ {
+ min: yAxisMin,
+ max: yAxisMax
+ }
+ ]
+ }
+ };
+ }
+
+ let res = {
+ categories: categories,
+ series: series
+ };
+
+ console.log("处理后的图表数据", res);
+ this.chartData = JSON.parse(JSON.stringify(res));
+ }, 500);
+ })
},
// 获取折线图
gettj() {
@@ -608,7 +690,8 @@
this.stationCode = this.arrays[i].value
}
}
- this.gettj()
+ // this.gettj()
+ this.qushicov()
},
// 预警切换站点
bindPickerChange1: function(e) {
@@ -632,6 +715,21 @@
this.pageNo = 1
this.getyjList()
},
+ getDate(type) {
+ const date = new Date();
+ let year = date.getFullYear();
+ let month = date.getMonth() + 1;
+ let day = date.getDate();
+
+ if (type === 'start') {
+ year = year - 10;
+ } else if (type === 'end') {
+ year = year + 10;
+ }
+ month = month > 9 ? month : '0' + month;
+ day = day > 9 ? day : '0' + day;
+ return `${year}-${month}-${day}`;
+ }
}
}
@@ -1039,4 +1137,14 @@
}
}
}
+ .qstim{
+ width: 40%;
+ display: block;
+ margin: 0 auto;
+ margin-top: 20rpx;
+ }
+ .qstim image {
+ width: 44rpx;
+ height: 44rpx;
+ }
\ No newline at end of file
diff --git a/pages/maps/index.vue b/pages/maps/index.vue
index 3a2917b..df46a5c 100644
--- a/pages/maps/index.vue
+++ b/pages/maps/index.vue
@@ -253,4 +253,112 @@
},
}
}
-
\ No newline at end of file
+
+
+
\ No newline at end of file