370 lines
8.1 KiB
Vue
Raw Normal View History

2023-10-17 09:49:06 +08:00
<template>
<view class="" style="padding: 30rpx;">
<view style="height: var(--status-bar-height)"></view>
<view class="" style="display: flex;align-items: center;font-size: 33.29rpx;margin-bottom: 20rpx;">
<u--image @tap="backFn" src="/static/img/FH.png" width="50.82rpx" height="50.82rpx" alt=""></u--image>
<text>生态概况</text>
</view>
<view class="" style="padding: 20rpx;box-sizing: border-box;">
<view class="head">
<view class="subsection">
<view class="subsection-li" @click="changeDate(10)">
小时
</view>
<view class="subsection-li" @click="changeDate(160.7)">
</view>
<view class="subsection-li sct" @click="changeDate(311.4)">
</view>
<view class="act" :style="{left:leftNum+'rpx'}">
</view>
</view>
<view class="set" @tap="navgo">
<view class="" style="margin: 0 10rpx;">
<u-icon name="setting" color="white" size="15"></u-icon>
</view> 设置
</view>
</view>
<view class="">
<view class="tit">
水池检测数据
</view>
<view class="charts-box">
<qiun-data-charts type="mix" :opts="opts" :chartData="chartData" />
</view>
<view class="charts-box">
<qiun-data-charts type="mix" :opts="opts2" :chartData="chartData2" />
</view>
</view>
<view class="detect">
<view class="detecttit">
<text class="line"></text> 种植监测
</view>
<view class="content" style=" text-indent: 2em;">
<view class="">
通过对水池数据进行实时监测可以及时发现水池中存在的问题如水池的水位水质恶化等可以了解水池的运行规律为水池的管理提供科学依据提高水池的管理水平
</view>
<view class="">
保障水质安全:通过对水质参数的监测,可以及时发现水质问题采取相应措施进行处理确保水池中的水质达标
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {
companyMine
} from "@/api/test.js"
export default {
data() {
return {
leftNum: 10,
chartData: {},
chartData2: {},
//您可以通过修改 config-ucharts.js 文件中下标为 ['mix'] 的节点来配置全局默认参数,如都是默认参数,此处可以不传 opts 。实际应用过程中 opts 只需传入与全局默认参数中不一致的【某一个属性】即可实现同类型的图表显示不同的样式,达到页面简洁的需求。
opts: {
color: ["#1890FF", "#91CB74"],
padding: [15, 15, 0, 15],
enableScroll: false,
legend: {},
xAxis: {
disableGrid: true,
},
yAxis: {
disabled: false,
disableGrid: false,
splitNumber: 5,
gridType: "dash",
dashLength: 4,
gridColor: "#CCCCCC",
padding: 10,
showTitle: true,
data: [{
position: "left",
title: ""
},
{
position: "right",
min: 0,
max: 200,
title: "",
textAlign: "left"
},
]
},
extra: {
mix: {
column: {
width: 20
}
}
}
},
opts2: {
color: ["#1890FF", "#91CB74"],
padding: [15, 15, 0, 15],
enableScroll: false,
legend: {},
xAxis: {
disableGrid: true,
},
yAxis: {
disabled: false,
disableGrid: false,
splitNumber: 5,
gridType: "dash",
dashLength: 4,
gridColor: "#CCCCCC",
padding: 10,
showTitle: true,
data: [{
position: "left",
title: ""
},
{
position: "right",
min: 0,
max: 200,
title: "",
textAlign: "left"
},
]
},
extra: {
mix: {
column: {
width: 20
}
}
}
}
};
},
onReady() {
let datas = [
[6.5, 7, 7.5, 6.8, 7.0, 7.2],
[33, 33, 34, 32, 32, 33],
[5, 6, 6, 7, 5, 6],
[0.2, 0.4, 0.5, 0.3, 0.4, 0.3],
[0.3, 0.5, 0.3, 0.4, 0.5, 0.3],
["12:00", "13:00", "14:00", "15:00", "16:00", "17:00"],
["12:00", "13:00", "14:00", "15:00", "16:00", "17:00"],
]
this.getServerData(datas)
},
onLaunch() {
},
onShow() {
companyMine({
id: 1,
flag: 1
}).then(res => {
console.log(res.data)
})
},
methods: {
changeDate(num) {
let datas = []
this.leftNum = num
if (num == 10) {
datas = [
[6.5, 7, 7.5, 6.8, 7.0, 7.2],
[33, 33, 34, 32, 32, 33],
[5, 6, 6, 7, 5, 6],
[0.2, 0.4, 0.5, 0.3, 0.4, 0.3],
[0.3, 0.5, 0.3, 0.4, 0.5, 0.3],
["12:00", "13:00", "14:00", "15:00", "16:00", "17:00"],
["12:00", "13:00", "14:00", "15:00", "16:00", "17:00"],
]
} else if (num == 160.7) {
datas = [
[6.9, 7.1, 7.5, 7.5, 7.4, 7.3],
[35, 36, 37, 38, 36, 34],
[5, 7, 6, 6, 7, 5],
[0.3, 0.5, 0.2, 0.3, 0.52, 0.57],
[0.4, 0.45, 0.35, 0.3, 0.28, 0.32],
["10-12", "10-13", "10-14", "10-15", "10-16", "10-17"],
["10-12", "10-13", "10-14", "10-15", "10-16", "10-17"],
]
} else if (num == 311.4) {
datas = [
[7.0, 6.9, 7.3, 6.7, 6.5, 6.6],
[36, 34, 37, 38, 36, 33],
[5, 5, 6, 6, 5, 6],
[0.5, 0.4, 0.34, 0.5, 0.4, 0.3],
[0.6, 0.4, 0.4, 0.5, 0.4, 0.6],
["5月", "6月", "7月", "8月", "9月", "10月"],
["5月", "6月", "7月", "8月", "9月", "10月"],
]
}
this.getServerData(datas)
},
navgo() {
uni.navigateTo({
url: '/pages/index3/index'
})
},
backFn() {
uni.navigateBack()
},
getServerData(datas) {
//模拟从服务器获取数据时的延时
setTimeout(() => {
//模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
let res = {
categories: datas[5],
series: [{
name: "PH值",
index: 1,
type: "column",
data: datas[0]
},
{
name: "水池温度(℃)",
type: "line",
color: "#2fc25b",
data: datas[1]
},
]
};
let res2 = {
categories: datas[6],
series: [{
name: "溶氧量(mg/L)",
index: 1,
type: "column",
data: datas[2]
},
{
name: "氨气量(mg/L)",
type: "line",
color: "#2fc25b",
data: datas[3]
},
{
name: "亚硝酸盐",
type: "line",
color: "#2fc25b",
data: datas[4]
},
]
};
this.chartData = JSON.parse(JSON.stringify(res));
this.chartData2 = JSON.parse(JSON.stringify(res2));
}, 500);
},
}
};
</script>
<style lang="less" scoped>
.head {
// height: 10vh;
display: flex;
justify-content: space-between;
align-items: center;
// background-color: red;
.subsection {
display: flex;
width: 466.12rpx;
height: 98.13rpx;
background-color: #F4F4F4;
border-radius: 50.82rpx 50.82rpx 50.82rpx 50.82rpx;
line-height: 5vh;
position: relative;
.subsection-li {
width: 150.7rpx;
height: 84.11rpx;
border-radius: 50.82rpx 50.82rpx 50.82rpx 50.82rpx;
text-align: center;
line-height: 94rpx;
z-index: 8;
// margin-top: 10rpx;
}
.act {
position: absolute;
width: 130.7rpx;
height: 84.11rpx;
border-radius: 50.82rpx 50.82rpx 50.82rpx 50.82rpx;
background-color: #fff;
top: 50%;
transform: translateY(-50%);
transition: .5s;
}
}
.set {
width: 131.43rpx;
height: 63rpx;
background-color: #0BC677;
border-radius: 31.54rpx 31.54rpx 31.54rpx 31.54rpx;
color: white;
text-align: center;
line-height: 63rpx;
display: flex;
align-items: center;
}
}
.tit {
text-align: center;
margin: 30rpx 0;
font-size: 36.8rpx;
}
.charts-box {
width: 100%;
height: 300px;
border: 1px solid black;
margin-bottom: 40rpx;
}
.detect {
.line {
width: 7.01rpx;
height: 31.54rpx;
background-color: #4CC593;
display: inline-block;
margin-right: 10rpx;
}
.detecttit {
font-size: 31.54rpx;
display: flex;
align-items: center;
}
.content {
padding-top: 20rpx;
}
}
</style>