2023-10-21 18:02:06 +08:00
|
|
|
<template>
|
|
|
|
<view class="" style="padding: 30rpx;">
|
|
|
|
<view class="" style="padding: 20rpx;box-sizing: border-box;">
|
|
|
|
<view class="head">
|
|
|
|
<view class="subsection">
|
|
|
|
<view class="subsection-li" @click="changeDate(10)">
|
|
|
|
天
|
|
|
|
</view>
|
2023-10-23 17:57:19 +08:00
|
|
|
<view class="subsection-li" @click="changeDate(160.7)">
|
2023-10-21 18:02:06 +08:00
|
|
|
月
|
|
|
|
</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>
|
2023-10-26 19:02:26 +08:00
|
|
|
<view class="charts-box" v-for="(item,index) in baseData " :key="index">
|
|
|
|
<qiun-data-charts type="column" :opts="opts" :chartData="chartData[index]" />
|
2023-10-21 18:02:06 +08:00
|
|
|
</view>
|
2023-10-26 19:02:26 +08:00
|
|
|
|
2023-10-21 18:02:06 +08:00
|
|
|
</view>
|
|
|
|
|
2023-10-23 17:57:19 +08:00
|
|
|
|
2023-10-21 18:02:06 +08:00
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2023-10-26 19:02:26 +08:00
|
|
|
import {
|
|
|
|
landEnvDataChartAPI
|
|
|
|
} from "@/api/plant.js"
|
2023-10-21 18:02:06 +08:00
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
2023-10-26 19:02:26 +08:00
|
|
|
aaa: [{
|
|
|
|
"soil_temp": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
2023-10-21 18:02:06 +08:00
|
|
|
},
|
2023-10-26 19:02:26 +08:00
|
|
|
{
|
|
|
|
"soil_mois": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"p_content": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"n_content": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"k_content": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
}, {
|
|
|
|
"soil_temp": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"soil_mois": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"p_content": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"n_content": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"k_content": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
}, {
|
|
|
|
"soil_temp": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"soil_mois": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"p_content": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"n_content": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"k_content": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
}, {
|
|
|
|
"soil_temp": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"soil_mois": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"p_content": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"n_content": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"k_content": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
}, {
|
|
|
|
"soil_temp": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"soil_mois": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"p_content": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"n_content": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"k_content": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
}, {
|
|
|
|
"soil_temp": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"soil_mois": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"p_content": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"n_content": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"k_content": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
}, {
|
|
|
|
"soil_temp": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"soil_mois": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"p_content": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"n_content": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"k_content": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
}, {
|
|
|
|
"soil_temp": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
2023-10-21 18:02:06 +08:00
|
|
|
]
|
|
|
|
},
|
2023-10-26 19:02:26 +08:00
|
|
|
{
|
|
|
|
"soil_mois": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"p_content": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"n_content": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"k_content": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"create_time": [
|
|
|
|
"10-23"
|
|
|
|
]
|
2023-10-21 18:02:06 +08:00
|
|
|
}
|
2023-10-26 19:02:26 +08:00
|
|
|
],
|
|
|
|
leftNum: 10,
|
|
|
|
baseData: [],
|
|
|
|
xInfo: [{
|
|
|
|
name: "土壤温度(℃)",
|
|
|
|
|
|
|
|
data: 'soil_temp'
|
|
|
|
}, {
|
|
|
|
name: "土壤湿度(%RH)",
|
2023-10-21 18:02:06 +08:00
|
|
|
|
2023-10-26 19:02:26 +08:00
|
|
|
data: 'soil_mois'
|
|
|
|
}, {
|
|
|
|
name: "磷含量%)",
|
|
|
|
|
|
|
|
data: 'p_content'
|
|
|
|
}, {
|
|
|
|
name: "氮含量(mg/l)",
|
|
|
|
|
|
|
|
data: 'n_content'
|
|
|
|
}, {
|
|
|
|
name: "钾含量(%)",
|
|
|
|
|
|
|
|
data: 'k_content'
|
2023-10-21 18:02:06 +08:00
|
|
|
},
|
2023-10-26 19:02:26 +08:00
|
|
|
|
|
|
|
],
|
|
|
|
chartData: [],
|
|
|
|
|
|
|
|
//您可以通过修改 config-ucharts.js 文件中下标为 ['mix'] 的节点来配置全局默认参数,如都是默认参数,此处可以不传 opts 。实际应用过程中 opts 只需传入与全局默认参数中不一致的【某一个属性】即可实现同类型的图表显示不同的样式,达到页面简洁的需求。
|
|
|
|
opts: {
|
|
|
|
color: ["#1890FF"],
|
|
|
|
padding: [15, 15, 0, 15],
|
2023-10-21 18:02:06 +08:00
|
|
|
yAxis: {
|
|
|
|
gridType: "dash",
|
|
|
|
dashLength: 4,
|
|
|
|
gridColor: "#CCCCCC",
|
|
|
|
padding: 10,
|
|
|
|
data: [{
|
|
|
|
position: "left",
|
2023-10-26 19:02:26 +08:00
|
|
|
title: "",
|
|
|
|
min: 0,
|
|
|
|
max: 10,
|
2023-10-21 18:02:06 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
position: "right",
|
|
|
|
min: 0,
|
2023-10-26 19:02:26 +08:00
|
|
|
max: 10,
|
2023-10-21 18:02:06 +08:00
|
|
|
title: "",
|
|
|
|
textAlign: "left"
|
|
|
|
},
|
|
|
|
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
2023-10-26 19:02:26 +08:00
|
|
|
},
|
2023-10-21 18:02:06 +08:00
|
|
|
};
|
|
|
|
},
|
|
|
|
onReady() {
|
2023-10-26 19:02:26 +08:00
|
|
|
this.initCharts('2023-10-20', '2023-10-27')
|
2023-10-21 18:02:06 +08:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
changeDate(num) {
|
2023-10-26 19:02:26 +08:00
|
|
|
// this.initCharts('2023-10-23', '2023-10-27')
|
2023-10-21 18:02:06 +08:00
|
|
|
},
|
|
|
|
navgo() {
|
|
|
|
uni.navigateTo({
|
|
|
|
url: '/pages/index3/index'
|
|
|
|
})
|
|
|
|
},
|
|
|
|
backFn() {
|
|
|
|
uni.navigateBack()
|
|
|
|
},
|
2023-10-26 19:02:26 +08:00
|
|
|
initCharts(start_time, end_time) {
|
|
|
|
landEnvDataChartAPI({
|
|
|
|
user_id: 307,
|
|
|
|
start_time,
|
|
|
|
end_time
|
|
|
|
}).then(res => {
|
|
|
|
this.baseData = res.data
|
|
|
|
// this.baseData = this.aaa
|
|
|
|
let datas = this.baseData
|
|
|
|
this.baseData.forEach((item, index) => {
|
|
|
|
this.getServerData(item, index)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
getServerData(datas, index) {
|
2023-10-21 18:02:06 +08:00
|
|
|
setTimeout(() => {
|
|
|
|
let res = {
|
2023-10-26 19:02:26 +08:00
|
|
|
categories: datas['create_time'],
|
2023-10-21 18:02:06 +08:00
|
|
|
series: [{
|
2023-10-26 19:02:26 +08:00
|
|
|
name: this.xInfo[index].name,
|
|
|
|
index: 1,
|
|
|
|
type: "column",
|
|
|
|
data: datas[this.xInfo[index].data]
|
|
|
|
}]
|
2023-10-21 18:02:06 +08:00
|
|
|
};
|
2023-10-26 19:02:26 +08:00
|
|
|
this.chartData[index] = JSON.parse(JSON.stringify(res));
|
2023-10-21 18:02:06 +08:00
|
|
|
}, 500);
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
.head {
|
|
|
|
// height: 10vh;
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
// background-color: red;
|
|
|
|
.subsection {
|
|
|
|
display: flex;
|
2023-10-23 17:57:19 +08:00
|
|
|
width: 300.12rpx;
|
2023-10-21 18:02:06 +08:00
|
|
|
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: 159.46rpx;
|
|
|
|
|
|
|
|
height: 63.08rpx;
|
|
|
|
font-size: 29.79rpx;
|
|
|
|
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>
|