This commit is contained in:
978184212@qq.com 2025-12-01 19:22:03 +08:00
parent 0b15b83805
commit 36b53cdb37
3 changed files with 185 additions and 82 deletions

View File

@ -3,8 +3,8 @@
<!-- 顶部选项卡 -->
<view class="topScroll">
<scroll-view scroll-x="true" class="scroll">
<view class="scroll-item" v-for="(item,index) in topItems" :key="index"
@click="chooseClick(item,index)" :class="{'scroll-item2':isActive == index}">
<view class="scroll-item" v-for="(item,index) in topItems" :key="index" @click="chooseClick(item,index)"
:class="{'scroll-item2':isActive == index}">
{{item.dictLabel}}
<view class="zliebs" v-show="isActive === index">
</view>
@ -14,14 +14,8 @@
<!-- 监测站告警 -->
<block v-if="isActive == 0">
<scroll-view
class="liebiaos"
scroll-y="true"
:refresher-enabled="true"
:refresher-triggered="isRefresher"
@refresherrefresh="refresherrefreshFun"
@scrolltolower="lower"
v-if="List.length != 0">
<scroll-view class="liebiaos" scroll-y="true" :refresher-enabled="true" :refresher-triggered="isRefresher"
@refresherrefresh="refresherrefreshFun" @scrolltolower="lower" v-if="List.length != 0">
<view class="itembox" v-for="(item,index) in List" :key="index">
<view class="itembox_top" v-if="item.fullDeviceName">
<view class="itembox_lef">
@ -41,17 +35,17 @@
{{it}}
</view>
</view>
<view class="lists_item" >
<view class="lists_item">
<view class="jczbs">
{{item.itemName?item.itemName:''}}
</view>
<view class="zbz" >
<view class="zbz">
{{item.survValue?item.survValue:''}}
</view>
<view class="sbsj" style="color: #FF4242;">
<view class="sbsj" style="color: #FF4242;">
{{item.normalValue?item.normalValue:''}}
</view>
<view class="szqss" >
<view class="szqss">
{{item.survUnit?item.survUnit:''}}
</view>
</view>
@ -83,14 +77,16 @@
</view>
<view class="example-body">
<text>时间区间</text>
<uni-datetime-picker v-model="rangetime" type="daterange" @maskClick="maskClick" />
<uni-datetime-picker v-model="rangetime" type="date" @maskClick="maskClick" />
</view>
</view>
<!-- 趋势图 -->
<view class="qushicov" v-for="(item,index) in resolt" :key="index">
<text class="quname">{{item.itemName}}{{item.unit}}</text>
<text class="quname">{{item.itemName}}</text>
<view class="charts-box">
<qiun-data-charts type="area" :opts="opts" :chartData="item.chartData" :enableScroll="true" :ontouch="true" canvas2d />
<qiun-data-charts type="area" :opts="item.chartOpts || opts"
:chartData="{categories: item.categories || [], series: item.chartData || []}"
:enableScroll="true" :ontouch="true" canvas2d />
</view>
</view>
</view>
@ -149,7 +145,7 @@
value: 0,
rangeList: [],
isActive: 0,
rangetime: [currentDate, currentDate],
rangetime: currentDate,
deployId: '',
resolt: [],
chartData: {},
@ -157,29 +153,38 @@
color: ["#1890FF", "#FF4242", "#19D58A", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272",
"#FC8452", "#9A60B4", "#ea7ccc"
],
padding: [15, 15, 10, 15],
padding: [0, 15, 10, 15], //
legend: {
show: false, // 便线
show: true, //
position: "top",
float: "center",
itemGap: 20
float: "right", //
itemGap: 10,
margin: 10,
},
enableScroll: true,
xAxis: {
disableGrid: true,
itemCount: 14,
itemCount: 8,
scrollShow: true,
scrollAlign: 'left',
labelCount: 14,
boundaryGap: 'justify'
boundaryGap: 'justify',
},
yAxis: {
// 线-线
gridType: "dash",
// 线
dashLength: 2,
//
format: (val) => {
return val.toFixed(2);
}
// y
showTitle: true,
// y
data: [{
// -
// min: 0,
// max: 150,
// y
title: '数量',
}],
},
extra: {
area: {
@ -209,8 +214,8 @@
},
onLoad() {
this.getList()
this.startTime = this.rangetime[0]
this.endTime = this.rangetime[1]
this.startTime = this.rangetime
this.endTime = this.rangetime
},
onShow() {
//
@ -232,8 +237,8 @@
},
watch: {
rangetime(newval) {
this.startTime = this.rangetime[0]
this.endTime = this.rangetime[1]
this.startTime = newval
this.endTime = newval
this.qushiList()
},
},
@ -261,7 +266,7 @@
this.deviceNo = '';
this.isLastpage = false;
this.loadStatus = 'more';
this.getList().then(() => {
//
setTimeout(() => {
@ -291,11 +296,11 @@
pageNo: this.pageNo,
pageSize: this.pageSize
};
uni.showLoading({
title: '加载中'
});
// tabURL
let url = '';
if (this.isActive == 0) {
@ -306,14 +311,14 @@
params.deviceNo = this.deviceNo;
}
}
this.$http.get(url, {
params: params
}).then(res => {
uni.hideLoading();
if (res.data.code == 0) {
var data = res.data.data.records || [];
//
if (this.pageNo === 1) {
this.List = data;
@ -359,15 +364,15 @@
if (this.isLastpage || this.loadStatus === 'loading') {
return;
}
this.loadStatus = 'loading';
this.pageNo = this.pageNo + 1;
var params = {
pageNo: this.pageNo,
pageSize: this.pageSize
};
// tabURL
let url = '';
if (this.isActive == 0) {
@ -378,14 +383,14 @@
params.deviceNo = this.deviceNo;
}
}
this.$http.get(url, {
params: params
}).then(res => {
if (res.data.code == 0) {
var data = res.data.data.records || [];
this.List = this.List.concat(data);
//
const total = res.data.data.total || 0;
if (total > 0) {
@ -476,8 +481,7 @@
},
//
maskClick(e) {
this.startTime = e[0];
this.endTime = e[1];
this.rangetime = e;
},
//
getServerData(val) {
@ -505,12 +509,8 @@
data: Array(this.timeList?.length || 0).fill(highValNum),
color: "#FF4242",
lineType: "solid",
showLabel: false,
//
dataLabel: {
fontSize: 0,
show: false
},
showLabel: true,
dataLabel: false,
});
}
@ -520,18 +520,69 @@
data: Array(this.timeList?.length || 0).fill(lowValNum),
color: "#19D58A",
lineType: "solid",
showLabel: false,
//
dataLabel: {
fontSize: 0,
show: false
},
showLabel: true,
dataLabel: false,
});
}
return {
categories: this.timeList.slice(0, 50) || [],
series: series
series: series,
// opts
chartOpts: {
color: ["#1890FF", "#FF4242", "#19D58A", "#91CB74", "#FAC858", "#EE6666", "#73C0DE",
"#3CA272",
"#FC8452", "#9A60B4", "#ea7ccc"
],
padding: [0, 15, 10, 15],
legend: {
show: true,
position: "top",
float: "right",
itemGap: 10,
margin: 10,
},
enableScroll: true,
dataLabel:false,
xAxis: {
disableGrid: true,
itemCount: 14,
scrollShow: true,
scrollAlign: 'left',
labelCount: 14,
boundaryGap: 'justify'
},
yAxis: {
gridType: "dash",
dashLength: 2,
showTitle: true,
// 使item.unit
data: [{
title: item.unit || '单位', // 使''
}],
},
extra: {
area: {
type: "curve",
opacity: 0.2,
addLine: true,
width: 2,
gradient: true,
activeType: "hollow"
},
tooltip: {
textStyle: {
fontSize: 12
},
format: (item, category, index, opts) => {
return `${category}\n${item.seriesName}: ${item.data}`
}
},
markLine: {
data: []
}
}
}
};
});
@ -539,19 +590,67 @@
this.resolt = this.resolt.map((item, index) => {
return {
...item,
chartData: chartDataList[index] || this.getDefaultChartData(item.itemName)
chartData: chartDataList[index] ? chartDataList[index].series : [],
categories: chartDataList[index] ? chartDataList[index].categories : [],
chartOpts: chartDataList[index] ? chartDataList[index].chartOpts : this
.getDefaultChartOpts(item.itemName, item.unit)
};
});
console.log("处理后的趋势图数据", this.resolt);
},
//
getDefaultChartData(itemName) {
//
getDefaultChartOpts(itemName, unit) {
return {
categories: [],
series: [{
name: itemName,
data: []
}]
color: ["#1890FF", "#FF4242", "#19D58A", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272",
"#FC8452", "#9A60B4", "#ea7ccc"
],
padding: [0, 15, 10, 15],
legend: {
show: true,
position: "top",
float: "right",
itemGap: 10,
margin: 10,
},
enableScroll: true,
xAxis: {
disableGrid: true,
itemCount: 14,
scrollShow: true,
scrollAlign: 'left',
labelCount: 14,
boundaryGap: 'justify'
},
yAxis: {
gridType: "dash",
dashLength: 2,
showTitle: true,
data: [{
title: unit || '单位',
}],
},
extra: {
area: {
type: "curve",
opacity: 0.2,
addLine: true,
width: 2,
gradient: true,
activeType: "hollow"
},
tooltip: {
textStyle: {
fontSize: 12
},
format: (item, category, index, opts) => {
return `${category}\n${item.seriesName}: ${item.data}`
}
},
markLine: {
data: []
}
}
};
},
}
@ -835,32 +934,34 @@
margin-bottom: 10rpx;
}
}
/* 确保列表容器有固定高度才能滚动 */
.liebiaos {
height: calc(100vh - 100rpx); /* 根据你的实际布局调整 */
height: calc(100vh - 100rpx);
/* 根据你的实际布局调整 */
}
.load {
padding: 20rpx 0;
text-align: center;
}
.zwsj {
height: calc(100vh - 100rpx);
display: flex;
align-items: center;
justify-content: center;
}
.inzwsj {
text-align: center;
}
.zwsjimg {
width: 200rpx;
height: 200rpx;
}
.zwsjtext {
font-size: 28rpx;
color: #999;

View File

@ -141,7 +141,7 @@
{
"path": "pages/vidio/soilindex",
"style": {
"navigationBarTitleText": "土壤监测",
"navigationBarTitleText": "长期定位监测点位",
"navigationStyle": "default",
"navigationBarBackgroundColor":"#0F6EFF"
}

View File

@ -141,8 +141,8 @@
switch(item.type) {
case 'soil':
iconPath = this.baseUrl + '/icon/device/soil.png';
width = 40;
height = 40;
width = 32;
height = 47;
break;
case 'camera':
iconPath = this.baseUrl + '/icon/device/cam.png';
@ -242,11 +242,14 @@
url: `/packDetail/pages/Site/detail?item=${encodeURIComponent(JSON.stringify(marker))}`
})
} else if (marker.stationType === 'device') {
uni.navigateTo({
url: `/packDetail/pages/vidio/soilindex`
})
//
uni.showToast({
title: `设备: ${marker.stationName}`,
icon: 'none'
});
// uni.showToast({
// title: `: ${marker.stationName}`,
// icon: 'none'
// });
//
}
}
@ -343,9 +346,8 @@
item.iconPath = this.baseUrl +'/'+ item.stationIcon;
item.latitude = Number(item.stationLatitude);
item.longitude = Number(item.stationLongitude);
item.width = 172;
item.height = 148;
item.width = 239;
item.height = 186;
const markerItem = {
id: item.id,
iconPath: item.iconPath,
@ -361,7 +363,7 @@
stationType: item.stationType,
stationName: item.stationName,
stationCode: item.stationCode,
joinCluster: true
joinCluster: true,
};
this.markers.push(markerItem);
}