SmartBeehive/page_Beehive/Beehive_detail.vue

1902 lines
42 KiB
Vue
Raw Normal View History

2024-06-21 18:04:01 +08:00
<template>
<view class="page">
<u-navbar :title="title" :border-bottom="false" :background="bgc" title-color='#000' title-size='36'
:title-bold='true' height='45' id="navbar">
</u-navbar>
<view class="mapbox">
<map class="map" id="map" ref="map" :scale="zoomSize" :latitude="latitude" :longitude="longitude"
:show-location='true'> </map>
<!-- <view class="num">
<view class="txt">
在线1001
</view>
<view class="txt" style="color:#FF473E ;margin-top: 10rpx;">
在线100
</view>
</view> -->
<view class="btn" @click="showwl = true">
<image src="https://api.ccttiot.com/smartmeter/img/static/uAJBChYkLJO66dYUkJ8M" mode=""></image>
</view>
</view>
<view class="tit">
2024-07-01 18:03:05 +08:00
{{obj.name}}-{{obj.sn}}
<view class="sets" v-if="false">
2024-06-21 18:04:01 +08:00
<image src="https://api.ccttiot.com/smartmeter/img/static/ulHBKvkXDfe9OIveIJKZ" mode=""></image>
<view class="menu">
<view class="menu_li">
<image src="https://api.ccttiot.com/smartmeter/img/static/uE84FLJ6hKTfgt6gxYMw" mode=""></image>
编辑信息
</view>
<view class="menu_li">
<image src="https://api.ccttiot.com/smartmeter/img/static/uBfAFsDIhqFTFKxL0PVP" mode=""></image>
投放认养
</view>
<view class="menu_li">
<image src="https://api.ccttiot.com/smartmeter/img/static/uwkwkl1CDZfUhQyZdNFY" mode=""></image>
分享认养
</view>
</view>
</view>
</view>
<view class="address">
<image src="https://api.ccttiot.com/smartmeter/img/static/uMOucOG04nN4PrLJfqj6" mode=""></image>
2024-07-01 18:03:05 +08:00
{{obj.apiaryAddress}}
2024-06-21 18:04:01 +08:00
</view>
<view class="weather">
<view class="weather_left">
<view class="txt">
2024-07-01 18:03:05 +08:00
多云 {{daily[0].tempMin}} ~ {{daily[0].tempMax}}
2024-06-21 18:04:01 +08:00
</view>
<view class="txt" style="margin-left: 40rpx;">
2024-07-01 18:03:05 +08:00
{{daily[0].windDirDay}} {{daily[0].windSpeedDay}}
2024-06-21 18:04:01 +08:00
</view>
</view>
<view class="weather_right">
更多天气 <view class="iconfont icon-xiangyou1"></view>
</view>
</view>
<view class="weather">
<view class="weather_left">
<view class="txt">
<image src="https://api.ccttiot.com/smartmeter/img/static/uZqKuAjf2idHAtkknKEU" mode=""></image>
2024-07-01 18:03:05 +08:00
{{obj.outerHumidity}}%
2024-06-21 18:04:01 +08:00
</view>
<view class="txt" style="margin-left: 26rpx;">
<image src="https://api.ccttiot.com/smartmeter/img/static/uJmWnkVE9UeIhNYdPexV" mode=""></image>
2024-07-01 18:03:05 +08:00
{{obj.outerTemperature}}
2024-06-21 18:04:01 +08:00
</view>
</view>
<view class="weather_right" style="font-weight: 400;font-size: 24rpx;color: #808080;">
2024-07-01 18:03:05 +08:00
更新于 {{obj.lastOnlineTime}}
2024-06-21 18:04:01 +08:00
</view>
</view>
<view class="setbox">
<view class="setcard">
<view class="top">
<view class="left">
预警设置
</view>
<view class="right iconfont icon-xiangyou1">
</view>
</view>
<view class="bot">
时刻注意蜂箱变化
</view>
<view class="img">
<image src="https://api.ccttiot.com/smartmeter/img/static/uxDnt5rGbJcc6mU6W3cE" mode=""></image>
</view>
</view>
<view class="setcard">
<view class="top">
<view class="left">
视频监控
</view>
<view class="right iconfont icon-xiangyou1">
</view>
</view>
<view class="bot">
更好查看蜂场情况
</view>
<view class="img">
<image src="https://api.ccttiot.com/smartmeter/img/static/ukN0K37DEPQQxFJ03Qi9" mode=""></image>
</view>
</view>
</view>
<view class="card_top">
<view class="name">
2024-07-01 18:03:05 +08:00
{{obj.name}}-{{obj.sn}}
2024-06-21 18:04:01 +08:00
</view>
<view class="time">
2024-07-01 18:03:05 +08:00
{{obj.lastOnlineTime}}
2024-06-21 18:04:01 +08:00
</view>
<view class="ele">
<image src="https://api.ccttiot.com/smartmeter/img/static/uWDVO6wzl5tRe8X3rmhT" mode=""></image>
2024-07-01 18:03:05 +08:00
{{obj.surplusPower}}%
2024-06-21 18:04:01 +08:00
</view>
</view>
<view class="echarts_box">
<view class="echarts_top">
<view class="top_left">
温度
<image src="https://api.ccttiot.com/smartmeter/img/static/utoKXhZBoejfRZwNUMP9" mode=""></image>
</view>
<view class="top_cont">
2024-07-01 18:03:05 +08:00
当前 {{obj.innerTemperature}}
2024-06-21 18:04:01 +08:00
</view>
<view class="top_right">
<view style="width: 1rpx;">
</view>
<view class="txt">
历史走势<view class="iconfont icon-xiangyou1"></view>
</view>
</view>
</view>
<view class="echarts">
<uni-ec-canvas class="uni-ec-canvas" id="uni-ec-canvas" ref="canvas1" canvas-id="uni-ec-canvas"
:ec="ec">
</uni-ec-canvas>
</view>
</view>
<view class="echarts_box">
<view class="echarts_top">
<view class="top_left">
湿度
<image src="https://api.ccttiot.com/smartmeter/img/static/una6Kbd2gdBZ9gG6lg44" mode=""></image>
</view>
<view class="top_cont">
2024-07-01 18:03:05 +08:00
当前 {{obj.innerHumidity}}%
2024-06-21 18:04:01 +08:00
</view>
<view class="top_right">
<view style="width: 1rpx;">
</view>
<view class="txt">
历史走势<view class="iconfont icon-xiangyou1"></view>
</view>
</view>
</view>
<view class="echarts">
<uni-ec-canvas class="uni-ec-canvas" id="uni-ec-canvas" ref="canvas2" canvas-id="uni-ec-canvas"
:ec="ec">
</uni-ec-canvas>
</view>
</view>
<view class="echarts_box">
<view class="echarts_top">
<view class="top_left">
重量
<image src="https://api.ccttiot.com/smartmeter/img/static/uk7CvwzeU0ukxvS9cBtD" mode=""></image>
</view>
<view class="top_cont">
2024-07-01 18:03:05 +08:00
当前 {{obj.totalWeight == 999999 ? '--' : obj.totalWeight}}Kg
2024-06-21 18:04:01 +08:00
</view>
<view class="top_right">
<view style="width: 1rpx;">
</view>
<view class="txt">
历史走势<view class="iconfont icon-xiangyou1"></view>
</view>
</view>
</view>
<view class="echarts">
<uni-ec-canvas class="uni-ec-canvas" id="uni-ec-canvas" ref="canvas3" canvas-id="uni-ec-canvas"
:ec="ec">
</uni-ec-canvas>
</view>
</view>
<view class="echarts_box">
<view class="echarts_top">
<view class="top_left">
进出量
<image src="https://api.ccttiot.com/smartmeter/img/static/uhsU6Y1K35jxA4aRauzy" mode=""></image>
</view>
<view class="top_cont">
2024-07-01 18:03:05 +08:00
当前 {{obj.ioCount}}
2024-06-21 18:04:01 +08:00
</view>
<view class="top_right">
<view style="width: 1rpx;">
</view>
<view class="txt">
历史走势<view class="iconfont icon-xiangyou1"></view>
</view>
</view>
</view>
<view class="echarts">
<uni-ec-canvas class="uni-ec-canvas" id="uni-ec-canvas" ref="canvas4" canvas-id="uni-ec-canvas"
:ec="ec">
</uni-ec-canvas>
</view>
</view>
<view class="echarts_box">
<view class="echarts_top">
<view class="top_left">
频率
<image src="https://api.ccttiot.com/smartmeter/img/static/up9IaGzSg1RKhIZz3V7a" mode=""></image>
</view>
<view class="top_cont">
2024-07-01 18:03:05 +08:00
当前 {{obj.volume}}
2024-06-21 18:04:01 +08:00
</view>
<view class="top_right">
<view style="width: 1rpx;">
</view>
<view class="txt">
历史走势<view class="iconfont icon-xiangyou1"></view>
</view>
</view>
</view>
<view class="echarts">
<uni-ec-canvas class="uni-ec-canvas" id="uni-ec-canvas" ref="canvas5" canvas-id="uni-ec-canvas"
:ec="ec">
</uni-ec-canvas>
</view>
</view>
<view class="echarts_box">
<view class="echarts_top">
<view class="top_left">
二氧化碳
<image src="https://api.ccttiot.com/smartmeter/img/static/um4lfl5q2O7FNM1EQc2L" mode=""></image>
</view>
<view class="top_cont">
2024-07-01 18:03:05 +08:00
当前 {{obj.innerCo2}}ppm
2024-06-21 18:04:01 +08:00
</view>
<view class="top_right">
<view style="width: 1rpx;">
</view>
<view class="txt">
历史走势<view class="iconfont icon-xiangyou1"></view>
</view>
</view>
</view>
<view class="echarts">
<uni-ec-canvas class="uni-ec-canvas" id="uni-ec-canvas" ref="canvas6" canvas-id="uni-ec-canvas"
:ec="ec">
</uni-ec-canvas>
</view>
</view>
<view class="weather_info" v-show="showtq">
<view class="top">
<view class="weather_info_tit">
未来7日天气预知
</view>
<image src="https://api.ccttiot.com/smartmeter/img/static/uQK4q99a1Qb7LFD6O3Hw" mode="" @click="showtq = false"></image>
</view>
<view class="top" style="margin-top: 14rpx;">
<view class="weather_add">
2024-07-01 18:03:05 +08:00
蜂场位置<span style="color: #42A5F5;">{{obj.apiaryCounty}}</span>
2024-06-21 18:04:01 +08:00
</view>
<view class="up_time">
1小时前更新
</view>
</view>
<view class="weather_cont">
2024-07-01 18:03:05 +08:00
<view class="weather_li" v-for="(item,index) in daily" :key="index">
2024-06-21 18:04:01 +08:00
<view class="data">
2024-07-01 18:03:05 +08:00
{{item.fxDate.slice(5)}}
2024-06-21 18:04:01 +08:00
</view>
<view class="week">
2024-07-01 18:03:05 +08:00
{{item.textDay}}
2024-06-21 18:04:01 +08:00
</view>
<view class="week_weather">
2024-07-01 18:03:05 +08:00
{{item.windDirDay}}
2024-06-21 18:04:01 +08:00
</view>
<view class="week_weather_img">
<image src="https://api.ccttiot.com/smartmeter/img/static/u6wWpgZOuId6JSX8LGmz" mode=""></image>
</view>
</view>
</view>
<view class="echarts_box">
<uni-ec-canvas class="uni-ec-canvas" id="uni-ec-canvas" ref="canvas7" canvas-id="uni-ec-canvas" :ec="ec">
</uni-ec-canvas>
</view>
</view>
<view class="bottom_box">
2024-07-01 18:03:05 +08:00
<view class="type_li" @click="btndow(1)">
2024-06-21 18:04:01 +08:00
去皮
</view>
2024-07-01 18:03:05 +08:00
<view class="type_li" @click="btndow(2)">
2024-06-21 18:04:01 +08:00
蜂鸣寻箱
</view>
2024-07-01 18:03:05 +08:00
<view class="type_li" @click="btndow(3)">
风扇{{fskx}}
2024-06-21 18:04:01 +08:00
</view>
2024-07-01 18:03:05 +08:00
<view class="type_li" @click="btndow(4)">
加热{{jrkg}}
2024-06-21 18:04:01 +08:00
</view>
</view>
</view>
</template>
<script>
import uniEcCanvas from '@/components/uni-ec-canvas/uni-ec-canvas.vue'
import * as echarts from '@/components/uni-ec-canvas/echarts'
let chart = null
export default {
components: {
uniEcCanvas
},
data() {
return {
ec: {
lazyLoad: true
},
bgc: {
backgroundColor: " #FAFDFD",
},
title: "添加视频监控",
latitude: '39.916527',
longitude: ' 116.397128',
isMap: false,
zoomSize: 15,
markers: [{
id: 1,
latitude: 39.90469,
longitude: 116.40717,
title: 'Marker1'
}, {
id: 2,
latitude: 39.90969,
longitude: 116.41217,
title: 'Marker2'
}],
chartday: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'],
chartData: [120, 200, 150, 80, 70, 110, 130],
2024-07-01 18:03:05 +08:00
showtq:true,
beehiveId:'',
obj:{},
daily:[],
fskx:'关',
jrkg:'关',
chartData1:[],
chartData2:[],
chartData3:[],
chartData4:[],
chartData5:[],
chartData6:[],
yeartime: {
year: '',
month: '',
day:''
},
yeartimes: {
year: '',
month: '',
day:''
},
2024-06-21 18:04:01 +08:00
}
},
2024-07-01 18:03:05 +08:00
onLoad(option) {
this.beehiveId = option.beehiveId
this.getobj()
2024-06-21 18:04:01 +08:00
},
onShow() {
setTimeout(() => {
this.$refs.canvas1.init(this.initChart)
this.$refs.canvas2.init(this.initChart2)
this.$refs.canvas3.init(this.initChart3)
this.$refs.canvas4.init(this.initChart4)
this.$refs.canvas5.init(this.initChart5)
this.$refs.canvas6.init(this.initChart6)
this.$refs.canvas7.init(this.initChart7)
2024-07-01 18:03:05 +08:00
}, 1000)
const now = new Date();
const previousDay = new Date(now)
this.yeartime.year = now.getFullYear()
this.yeartime.month = String(previousDay.getMonth() + 1).padStart(2, '0')
this.yeartime.day = String(now.getDate()).padStart(2, '0')
// const now = new Date();
// 创建一个新的Date对象表示前一天
previousDay.setDate(now.getDate() - 7)
this.yeartimes.year = previousDay.getFullYear()
this.yeartimes.month = String(previousDay.getMonth() + 1).padStart(2, '0')
this.yeartimes.day = String(previousDay.getDate()).padStart(2, '0')
this.getchartData1()
this.getchartData2()
this.getchartData3()
this.getchartData4()
this.getchartData5()
this.getchartData6()
2024-06-21 18:04:01 +08:00
},
methods: {
2024-07-01 18:03:05 +08:00
// 温度图表
getchartData1(){
let time = this.yeartime.year +'-' + this.yeartime.month + '-' + this.yeartime.day
let times = this.yeartimes.year + '-' + this.yeartimes.month + '-' + this.yeartimes.day
console.log(this.yeartime,this.yeartimes);
this.$u.get(`/farmer/report/tempN?dateRange=${times},${time}&beehiveId=${this.beehiveId}`).then(res => {
if(res.code == 200){
this.chartData1 = res.data.map(item => item.value)
}
})
},
// 湿度图表
getchartData2(){
let time = this.yeartime.year +'-' + this.yeartime.month + '-' + this.yeartime.day
let times = this.yeartimes.year + '-' + this.yeartimes.month + '-' + this.yeartimes.day
this.$u.get(`/farmer/report/hpN?dateRange=${times},${time}&beehiveId=${this.beehiveId}`).then(res => {
if(res.code == 200){
this.chartData2 = res.data.map(item => item.value)
}
})
},
// 重量图表
getchartData3(){
let time = this.yeartime.year +'-' + this.yeartime.month + '-' + this.yeartime.day
let times = this.yeartimes.year + '-' + this.yeartimes.month + '-' + this.yeartimes.day
this.$u.get(`/farmer/report/weightDay?dateRange=${times},${time}&beehiveId=${this.beehiveId}`).then(res => {
if(res.code == 200){
this.chartData3 = res.data.map(item => item.value)
}
})
},
// 进出量图表
getchartData4(){
let time = this.yeartime.year +'-' + this.yeartime.month + '-' + this.yeartime.day
let times = this.yeartimes.year + '-' + this.yeartimes.month + '-' + this.yeartimes.day
this.$u.get(`/farmer/report/ioCount?dateRange=${times},${time}&beehiveId=${this.beehiveId}`).then(res => {
if(res.code == 200){
this.chartData4 = res.data.map(item => item.value)
}
})
},
// 频率图表
getchartData5(){
let time = this.yeartime.year +'-' + this.yeartime.month + '-' + this.yeartime.day
let times = this.yeartimes.year + '-' + this.yeartimes.month + '-' + this.yeartimes.day
this.$u.get(`/farmer/report/mic?dateRange=${times},${time}&beehiveId=${this.beehiveId}`).then(res => {
if(res.code == 200){
this.chartData5 = res.data.map(item => item.value)
}
})
},
// 二氧化碳图表
getchartData6(){
let time = this.yeartime.year +'-' + this.yeartime.month + '-' + this.yeartime.day
let times = this.yeartimes.year + '-' + this.yeartimes.month + '-' + this.yeartimes.day
this.$u.get(`/farmer/report/co2?dateRange=${times},${time}&beehiveId=${this.beehiveId}`).then(res => {
if(res.code == 200){
this.chartData6 = res.data.map(item => item.value)
}
})
},
btndow(num){
if(num == 1){
this.$u.put(`farm/beehive/iot/${this.beehiveId}/clearWeight`).then(res => {
if(res.code == 200){
uni.showToast({
title: '去皮成功',
icon: 'success',
duration: 2000
})
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
}else if(num == 2){
this.$u.put(`farm/beehive/iot/${this.beehiveId}/buzzer`).then(res => {
if(res.code == 200){
uni.showToast({
title: '响铃成功',
icon: 'success',
duration: 2000
})
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
}else if(num == 3){
if(this.fskx == '关'){
this.$u.put(`farm/beehive/iot/${this.beehiveId}/fan?open=true`).then(res => {
if(res.code == 200){
if(this.fskx == '关'){
this.fskx = '开'
}else{
this.fskx = '关'
}
uni.showToast({
title: '风扇开启成功',
icon: 'success',
duration: 2000
})
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
}else{
this.$u.put(`farm/beehive/iot/${this.beehiveId}/fan?open=false`).then(res => {
if(res.code == 200){
if(this.fskx == '关'){
this.fskx = '开'
}else{
this.fskx = '关'
}
uni.showToast({
title: '风扇关闭成功',
icon: 'success',
duration: 2000
})
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
}
}else if(num == 4){
if(this.jrkg == '关'){
this.$u.put(`farm/beehive/iot/${this.beehiveId}/heat?open=true`).then(res => {
if(res.code == 200){
if(this.jrkg == '关'){
this.jrkg = '开'
}else{
this.jrkg = '关'
}
uni.showToast({
title: '加热开启成功',
icon: 'success',
duration: 2000
})
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
}else{
this.$u.put(`farm/beehive/iot/${this.beehiveId}/heat?open=false`).then(res => {
if(res.code == 200){
if(this.jrkg == '关'){
this.jrkg = '开'
}else{
this.jrkg = '关'
}
uni.showToast({
title: '加热关闭成功',
icon: 'success',
duration: 2000
})
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
}
}
},
getobj(){
this.$u.get(`/farm/beehive/${this.beehiveId}`).then(res => {
if(res.code == 200){
this.obj = res.data
this.latitude = res.data.apiaryLat
this.longitude = res.data.apiaryLng
if(res.data.enableFan == false){
this.fskx = '关'
}else{
this.fskx = '开'
}
if(res.data.enableHeat == false){
this.jrkg = '关'
}else{
this.jrkg = '开'
}
this.gettq()
if(this.latitude == 0 && this.longitude == 0){
this.zoomSize = 2
}
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
},
gettq(){
this.$u.get(`weather/7d?location=${this.longitude},${this.latitude}`).then(res => {
if(res.code == 200){
this.daily = res.data.daily
}
})
},
2024-06-21 18:04:01 +08:00
// 温度
initChart(canvas, width, height, canvasDpr) {
let that = this
const option = {
grid: {
left: '4%',
right: '4%',
bottom: '3%',
top: '4%',
containLabel: true
},
xAxis: {
show: true,
type: 'category',
boundaryGap: false,
axisLine: {
show: false // 隐藏X轴线
},
axisTick: {
show: false // 隐藏X轴刻度
},
axisLabel: {
show: false // 隐藏X轴标签
},
axisLabel: {
show: true,
color: '#ccc',
fontSize: 11,
rotate: 0,
},
splitLine: {
show: false,
},
// data: that.chartday,
},
yAxis: {
show: true,
axisLine: {
show: false,
},
axisTick: {
show: false,
},
axisLabel: {
show: true,
color: '#ccc',
fontSize: 11,
formatter: function(value) {
// 保留两位小数没有小数时显示00
return value + '℃'
},
},
splitLine: {
show: true, // 显示X轴网格线
lineStyle: {
type: 'dashed', // 设置网格线为虚线
color: '#ccc', // 可以设置虚线的颜色
width: 1 // 可以设置虚线的宽度
}
}
},
visualMap: {
type: 'piecewise',
show: false,
dimension: 0,
seriesIndex: 0,
pieces: [{
gt: 1,
lt: 3,
color: 'RGBA(255, 241, 201, 1)',
},
{
gt: 5,
lt: 7,
color: 'RGBA(255, 241, 201, 1)',
},
],
},
series: [{
type: 'line',
smooth: 0.6,
symbol: 'none',
lineStyle: {
color: '#FFE28C',
width: 4,
},
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: '#FFF1C9'
}, ]),
},
},
2024-07-01 18:03:05 +08:00
data: that.chartData1,
2024-06-21 18:04:01 +08:00
}],
};
chart = echarts.init(canvas, null, {
width: width,
height: height,
devicePixelRatio: canvasDpr
})
2024-07-01 18:03:05 +08:00
option.series[0].data = that.chartData1
2024-06-21 18:04:01 +08:00
canvas.setChart(chart)
chart.setOption(option)
return chart
},
// 湿度
initChart2(canvas, width, height, canvasDpr) {
let that = this
const option = {
grid: {
left: '4%',
right: '4%',
bottom: '3%',
top: '4%',
containLabel: true
},
xAxis: {
show: true,
type: 'category',
boundaryGap: false,
axisLine: {
show: false // 隐藏X轴线
},
axisTick: {
show: false // 隐藏X轴刻度
},
axisLabel: {
show: false // 隐藏X轴标签
},
axisLabel: {
show: true,
color: '#ccc',
fontSize: 11,
rotate: 0,
},
splitLine: {
show: false,
},
// data: that.chartday,
},
yAxis: {
show: true,
axisLine: {
show: false,
},
axisTick: {
show: false,
},
axisLabel: {
show: true,
color: '#ccc',
fontSize: 11,
formatter: function(value) {
// 保留两位小数没有小数时显示00
return value + '%'
},
},
splitLine: {
show: true, // 显示X轴网格线
lineStyle: {
type: 'dashed', // 设置网格线为虚线
color: '#ccc', // 可以设置虚线的颜色
width: 1 // 可以设置虚线的宽度
}
}
},
visualMap: {
type: 'piecewise',
show: false,
dimension: 0,
seriesIndex: 0,
pieces: [{
gt: 1,
lt: 3,
color: 'RGBA(255, 241, 201, 1)',
},
{
gt: 5,
lt: 7,
color: 'RGBA(255, 241, 201, 1)',
},
],
},
series: [{
type: 'line',
smooth: 0.6,
symbol: 'none',
lineStyle: {
color: '#FFE28C',
width: 4,
},
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: '#FFF1C9'
}, ]),
},
},
2024-07-01 18:03:05 +08:00
data: that.chartData2,
2024-06-21 18:04:01 +08:00
}],
};
chart = echarts.init(canvas, null, {
width: width,
height: height,
devicePixelRatio: canvasDpr
})
2024-07-01 18:03:05 +08:00
option.series[0].data = that.chartData2
2024-06-21 18:04:01 +08:00
canvas.setChart(chart)
chart.setOption(option)
return chart
},
//重量
initChart3(canvas, width, height, canvasDpr) {
let that = this
const option = {
grid: {
left: '4%',
right: '4%',
bottom: '3%',
top: '4%',
containLabel: true
},
xAxis: {
show: true,
type: 'category',
boundaryGap: false,
axisLine: {
show: false // 隐藏X轴线
},
axisTick: {
show: false // 隐藏X轴刻度
},
axisLabel: {
show: false // 隐藏X轴标签
},
axisLabel: {
show: true,
color: '#ccc',
fontSize: 11,
rotate: 0,
},
splitLine: {
show: false,
},
// data: that.chartday,
},
yAxis: {
show: true,
axisLine: {
show: false,
},
axisTick: {
show: false,
},
axisLabel: {
show: true,
color: '#ccc',
fontSize: 11,
formatter: function(value) {
// 保留两位小数没有小数时显示00
return value + 'Kg'
},
},
splitLine: {
show: true, // 显示X轴网格线
lineStyle: {
type: 'dashed', // 设置网格线为虚线
color: '#ccc', // 可以设置虚线的颜色
width: 1 // 可以设置虚线的宽度
}
}
},
visualMap: {
type: 'piecewise',
show: false,
dimension: 0,
seriesIndex: 0,
pieces: [{
gt: 1,
lt: 3,
color: 'RGBA(255, 241, 201, 1)',
},
{
gt: 5,
lt: 7,
color: 'RGBA(255, 241, 201, 1)',
},
],
},
series: [{
type: 'line',
smooth: 0.6,
symbol: 'none',
lineStyle: {
color: '#FFE28C',
width: 4,
},
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: '#FFF1C9'
}, ]),
},
},
2024-07-01 18:03:05 +08:00
data: that.chartData3,
2024-06-21 18:04:01 +08:00
}],
};
chart = echarts.init(canvas, null, {
width: width,
height: height,
devicePixelRatio: canvasDpr
})
2024-07-01 18:03:05 +08:00
option.series[0].data = that.chartData3
2024-06-21 18:04:01 +08:00
canvas.setChart(chart)
chart.setOption(option)
return chart
},
// 进出量
initChart4(canvas, width, height, canvasDpr) {
let that = this
const option = {
grid: {
left: '4%',
right: '4%',
bottom: '3%',
top: '4%',
containLabel: true
},
xAxis: {
show: true,
type: 'category',
boundaryGap: false,
axisLine: {
show: false // 隐藏X轴线
},
axisTick: {
show: false // 隐藏X轴刻度
},
axisLabel: {
show: false // 隐藏X轴标签
},
axisLabel: {
show: true,
color: '#ccc',
fontSize: 11,
rotate: 0,
},
splitLine: {
show: false,
},
// data: that.chartday,
},
yAxis: {
show: true,
axisLine: {
show: false,
},
axisTick: {
show: false,
},
axisLabel: {
show: true,
color: '#ccc',
fontSize: 11,
formatter: function(value) {
// 保留两位小数没有小数时显示00
return value + '只'
},
},
splitLine: {
show: true, // 显示X轴网格线
lineStyle: {
type: 'dashed', // 设置网格线为虚线
color: '#ccc', // 可以设置虚线的颜色
width: 1 // 可以设置虚线的宽度
}
}
},
visualMap: {
type: 'piecewise',
show: false,
dimension: 0,
seriesIndex: 0,
pieces: [{
gt: 1,
lt: 3,
color: 'RGBA(255, 241, 201, 1)',
},
{
gt: 5,
lt: 7,
color: 'RGBA(255, 241, 201, 1)',
},
],
},
series: [{
type: 'line',
smooth: 0.6,
symbol: 'none',
lineStyle: {
color: '#FFE28C',
width: 4,
},
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: '#FFF1C9'
}, ]),
},
},
2024-07-01 18:03:05 +08:00
data: that.chartData4,
2024-06-21 18:04:01 +08:00
}],
};
chart = echarts.init(canvas, null, {
width: width,
height: height,
devicePixelRatio: canvasDpr
})
2024-07-01 18:03:05 +08:00
option.series[0].data = that.chartData4
2024-06-21 18:04:01 +08:00
canvas.setChart(chart)
chart.setOption(option)
return chart
},
// 频率
initChart5(canvas, width, height, canvasDpr) {
let that = this
const option = {
grid: {
left: '4%',
right: '4%',
bottom: '3%',
top: '4%',
containLabel: true
},
xAxis: {
show: true,
type: 'category',
boundaryGap: false,
axisLine: {
show: false // 隐藏X轴线
},
axisTick: {
show: false // 隐藏X轴刻度
},
axisLabel: {
show: false // 隐藏X轴标签
},
axisLabel: {
show: true,
color: '#ccc',
fontSize: 11,
rotate: 0,
},
splitLine: {
show: false,
},
// data: that.chartday,
},
yAxis: {
show: true,
axisLine: {
show: false,
},
axisTick: {
show: false,
},
axisLabel: {
show: true,
color: '#ccc',
fontSize: 11,
formatter: function(value) {
// 保留两位小数没有小数时显示00
return value + 'Hz'
},
},
splitLine: {
show: true, // 显示X轴网格线
lineStyle: {
type: 'dashed', // 设置网格线为虚线
color: '#ccc', // 可以设置虚线的颜色
width: 1 // 可以设置虚线的宽度
}
}
},
visualMap: {
type: 'piecewise',
show: false,
dimension: 0,
seriesIndex: 0,
pieces: [{
gt: 1,
lt: 3,
color: 'RGBA(255, 241, 201, 1)',
},
{
gt: 5,
lt: 7,
color: 'RGBA(255, 241, 201, 1)',
},
],
},
series: [{
type: 'line',
smooth: 0.6,
symbol: 'none',
lineStyle: {
color: '#FFE28C',
width: 4,
},
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: '#FFF1C9'
}, ]),
},
},
2024-07-01 18:03:05 +08:00
data: that.chartData5,
2024-06-21 18:04:01 +08:00
}],
};
chart = echarts.init(canvas, null, {
width: width,
height: height,
devicePixelRatio: canvasDpr
})
2024-07-01 18:03:05 +08:00
option.series[0].data = that.chartData5
2024-06-21 18:04:01 +08:00
canvas.setChart(chart)
chart.setOption(option)
return chart
},
// 二氧化碳
initChart6(canvas, width, height, canvasDpr) {
let that = this
const option = {
grid: {
left: '4%',
right: '4%',
bottom: '3%',
top: '4%',
containLabel: true
},
xAxis: {
show: true,
type: 'category',
boundaryGap: false,
axisLine: {
show: false // 隐藏X轴线
},
axisTick: {
show: false // 隐藏X轴刻度
},
axisLabel: {
show: false // 隐藏X轴标签
},
axisLabel: {
show: true,
color: '#ccc',
fontSize: 11,
rotate: 0,
},
splitLine: {
show: false,
},
// data: that.chartday,
},
yAxis: {
show: true,
axisLine: {
show: false,
},
axisTick: {
show: false,
},
axisLabel: {
show: true,
color: '#ccc',
fontSize: 11,
formatter: function(value) {
// 保留两位小数没有小数时显示00
return value + '%'
},
},
splitLine: {
show: true, // 显示X轴网格线
lineStyle: {
type: 'dashed', // 设置网格线为虚线
color: '#ccc', // 可以设置虚线的颜色
width: 1 // 可以设置虚线的宽度
}
}
},
visualMap: {
type: 'piecewise',
show: false,
dimension: 0,
seriesIndex: 0,
pieces: [{
gt: 1,
lt: 3,
color: 'RGBA(255, 241, 201, 1)',
},
{
gt: 5,
lt: 7,
color: 'RGBA(255, 241, 201, 1)',
},
],
},
series: [{
type: 'line',
smooth: 0.6,
symbol: 'none',
lineStyle: {
color: '#FFE28C',
width: 4,
},
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: '#FFF1C9'
}, ]),
},
},
2024-07-01 18:03:05 +08:00
data: that.chartData6,
2024-06-21 18:04:01 +08:00
}],
};
chart = echarts.init(canvas, null, {
width: width,
height: height,
devicePixelRatio: canvasDpr
})
2024-07-01 18:03:05 +08:00
option.series[0].data = that.chartData6
2024-06-21 18:04:01 +08:00
canvas.setChart(chart)
chart.setOption(option)
return chart
},
initChart7(canvas, width, height, canvasDpr) {
let that = this
const option = {
grid: {
left: '4%',
right: '4%',
bottom: '3%',
top:'0%',
containLabel: true
},
tooltip: {
trigger: 'axis'
},
xAxis: {
type: 'category',
boundaryGap: false,
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
axisLine: {
show: false // 隐藏X轴线
},
axisTick: {
show: false // 隐藏X轴刻度
},
axisLabel: {
show: false // 隐藏X轴标签
},
splitLine: {
show: true, // 显示X轴网格线
lineStyle: {
type: 'dashed', // 设置网格线为虚线
color: '#ccc', // 可以设置虚线的颜色
width: 1 // 可以设置虚线的宽度
}
}
},
yAxis: {
type: 'value',
max: 40, // 设置Y轴的最大值为40
axisLabel: {
show: false // 隐藏Y轴标签
},
axisLine: {
show: false // 隐藏Y轴线
},
axisTick: {
show: false // 隐藏Y轴刻度
},
splitLine: {
show: false // 隐藏Y轴背景网格线
}
},
dataZoom: [
{
show: true,
type: 'inside',
filterMode: 'none',
xAxisIndex: [0],
startValue: -20,
endValue: 20
},
{
show: true,
type: 'inside',
filterMode: 'none',
yAxisIndex: [0],
startValue: -20,
endValue: 20
}
],
series: [{
name: '最高温度',
type: 'line',
data: [25, 29, 29, 29, 27, 24, 26],
smooth: true,
symbol: 'circle',
symbolSize: 8,
lineStyle: {
width: 3
},
itemStyle: {
color: '#42A5F5'
},
label: {
show: true,
position: 'top',
formatter: '{c}°',
color: '#42A5F5'
},
markLine: {
silent: true, // 不响应鼠标事件
symbol: ['none', 'none'], // 不显示标记
lineStyle: {
color: 'red', // 使虚线更明显
type: 'dashed'
},
// data: [
// { yAxis: 'min' },
// { yAxis: 'max' }
// ]
},
},
{
name: '最低温蒂',
type: 'line',
data: [15, 18, 19, 19, 21, 20, 20],
smooth: true,
symbol: 'circle',
symbolSize: 8,
lineStyle: {
width: 3
},
itemStyle: {
color: '#42A5F5'
},
label: {
show: true,
position: 'bottom',
formatter: '{c}°',
color: '#42A5F5'
},
}]
};
chart = echarts.init(canvas, null, {
width: width,
height: height,
devicePixelRatio: canvasDpr
})
canvas.setChart(chart)
chart.setOption(option)
return chart
},
}
}
</script>
<style lang="scss">
page {
background-color: #FAFDFD;
}
.page {
// position: relative;
padding: 38rpx;
padding-bottom: 200rpx;
width: 750rpx;
.weather_info {
position: fixed;
padding: 30rpx 50rpx;
bottom: 0;
right: 0;
width: 750rpx;
height: 820rpx;
background: #FFFFFF;
2024-07-01 18:03:05 +08:00
z-index: 999 !important;
2024-06-21 18:04:01 +08:00
border-radius: 20rpx 20rpx 0rpx 0rpx;
.echarts_box {
margin-top: 24rpx;
// width: 100%;
// height: 80%;
width: 646rpx;
height: 344rpx;
}
.weather_cont {
margin-top: 42rpx;
width: 100%;
display: flex;
flex-wrap: nowrap;
align-items: center;
justify-content: space-between;
.weather_li {
.data {
text-align: center;
width: 72rpx;
font-weight: 400;
font-size: 24rpx;
color: #50565A;
}
.week {
margin-top: 4rpx;
text-align: center;
width: 72rpx;
font-weight: 600;
font-size: 36rpx;
color: #50565A;
}
.week_weather {
margin-top: 14rpx;
text-align: center;
2024-07-01 18:03:05 +08:00
width: 82rpx;
2024-06-21 18:04:01 +08:00
font-weight: 500;
font-size: 28rpx;
color: #50565A;
}
.week_weather_img {
margin-top: 4rpx;
display: flex;
align-items: center;
justify-content: center;
width: 72rpx;
image {
width: 48rpx;
height: 48rpx;
}
}
}
}
.top {
display: flex;
flex-wrap: nowrap;
justify-content: space-between;
align-items: center;
.weather_info_tit {
font-weight: 600;
font-size: 36rpx;
color: #3D3D3D;
}
image {
width: 42rpx;
height: 42rpx;
}
.weather_add {
font-weight: 600;
font-size: 32rpx;
color: #50565A;
}
.up_time {
font-weight: 400;
font-size: 32rpx;
color: #808080;
}
}
}
.echarts_box {
margin-top: 26rpx;
padding: 18rpx 24rpx;
width: 674rpx;
background: #FFFFFF;
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15);
border-radius: 28rpx 28rpx 28rpx 28rpx;
.echarts {
margin-top: 24rpx;
// width: 100%;
// height: 80%;
width: 100%;
height: 330rpx;
}
.echarts_top {
display: flex;
align-items: center;
// justify-content: space-between;
.top_left {
width: 33.33%;
display: flex;
align-items: center;
font-weight: 500;
font-size: 36rpx;
color: #3D3D3D;
image {
margin-left: 28rpx;
width: 25.03rpx;
height: 34rpx;
}
}
.top_cont {
width: 33.33%;
text-align: center;
font-weight: 600;
font-size: 36rpx;
color: #3D3D3D;
}
.top_right {
width: 33.33%;
display: flex;
align-items: center;
.txt {
display: flex;
align-items: center;
flex-wrap: nowrap;
margin-left: auto;
font-weight: 400;
font-size: 32rpx;
color: #4D4D4D;
.icon-xiangyou1 {
margin-top: 4rpx;
margin-left: 8rpx;
}
}
}
}
}
.bottom_box {
padding: 38rpx 20rpx;
position: fixed;
display: flex;
align-items: center;
justify-content: space-around;
width: 750rpx;
height: 142rpx;
background: #FFFFFF;
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15);
border-radius: 0rpx 0rpx 0rpx 0rpx;
bottom: 0;
left: 0;
.type_li {
// margin-top: 26rpx;
// margin-right: 18rpx;
padding: 12rpx 26rpx;
background: #FFF5D6;
border-radius: 12rpx 12rpx 12rpx 12rpx;
border: 2rpx solid #FFC107;
font-weight: 600;
font-size: 32rpx;
color: #3D3D3D;
}
.act1 {
background: #FFC107;
border-radius: 12rpx 12rpx 12rpx 12rpx;
border: 2rpx solid #FFC107;
color: #FFFFFF;
}
}
.card_top {
margin-top: 28rpx;
display: flex;
flex-wrap: nowrap;
align-items: center;
.name {
font-weight: 600;
font-size: 36rpx;
color: #3D3D3D;
}
.time {
margin-left: 18rpx;
font-weight: 400;
font-size: 28rpx;
color: #808080;
}
.ele {
margin-left: auto;
display: flex;
align-items: center;
flex-wrap: nowrap;
font-weight: 400;
font-size: 28rpx;
color: #808080;
image {
margin-right: 12rpx;
width: 46rpx;
height: 46rpx;
}
}
}
.setbox {
margin: 0 auto;
margin-top: 34rpx;
width: 674rpx;
display: flex;
flex-wrap: nowrap;
justify-content: space-between;
.setcard {
position: relative;
padding: 14rpx 22rpx;
width: 320rpx;
height: 132rpx;
background: #FFFFFF;
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15);
border-radius: 20rpx 20rpx 20rpx 20rpx;
.top {
display: flex;
flex-wrap: nowrap;
align-items: center;
justify-content: space-between;
.left {
font-weight: 600;
font-size: 28rpx;
color: #3D3D3D;
}
.right {
font-size: 24rpx;
color: #808080;
}
}
.bot {
margin-top: 14rpx;
font-weight: 400;
font-size: 24rpx;
color: #808080;
}
.img {
position: absolute;
right: 24rpx;
bottom: 24rpx;
width: 82rpx;
height: 82rpx;
image {
width: 82rpx;
height: 82rpx;
}
}
}
}
.weather {
margin-top: 12rpx;
display: flex;
flex-wrap: nowrap;
align-items: center;
justify-content: space-between;
.weather_left {
display: flex;
flex-wrap: nowrap;
align-items: center;
.txt {
display: flex;
flex-wrap: nowrap;
align-items: center;
image {
width: 38rpx;
height: 38rpx;
margin-right: 8rpx;
}
font-weight: 400;
font-size: 28rpx;
color: #3D3D3D;
}
}
.weather_right {
display: flex;
flex-wrap: nowrap;
align-items: center;
font-weight: 400;
font-size: 28rpx;
color: #42A5F5;
.icon-xiangyou1 {}
}
}
.address {
display: flex;
align-items: center;
margin-top: 8rpx;
image {
margin-right: 8rpx;
width: 20rpx;
height: 24rpx;
}
font-weight: 400;
font-size: 28rpx;
color: #808080;
}
.tit {
display: flex;
flex-wrap: nowrap;
align-items: center;
justify-content: space-between;
margin-top: 24rpx;
font-weight: 600;
font-size: 32rpx;
color: #3D3D3D;
.sets {
position: relative;
.menu{
padding: 20rpx;
position: absolute;
right: 20rpx;
width: 218rpx;
height: 234rpx;
background: #FFFFFF;
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0,0,0,0.15);
border-radius: 20rpx 20rpx 20rpx 20rpx;
z-index: 10;
.menu_li:first-child{
margin-top: 10rpx;
}
.menu_li{
image{
margin-right: 14rpx;
width: 38rpx;
height: 38rpx;
}
font-weight: 400;
font-size: 32rpx;
color: #3D3D3D;
margin-top: 26rpx;
display: flex;
flex-wrap: nowrap;
align-items: center;
}
}
image {
width: 36rpx;
height: 36rpx;
}
}
}
.mapbox {
position: relative;
margin: 0 auto;
margin-top: 34rpx;
width: 674rpx;
height: 372rpx;
border-radius: 20rpx;
overflow: hidden;
.num {
width: 180rpx;
position: absolute;
top: 24rpx;
left: 30rpx;
.txt {
width: 180rpx;
font-weight: 600;
font-size: 32rpx;
color: #FFC107;
}
}
.btn {
position: absolute;
right: 0rpx;
bottom: 0rpx;
// width: 70rpx;
// height: 70rpx;
image {
width: 90rpx;
height: 90rpx;
}
}
.map {
width: 672rpx;
height: 372rpx;
// border-radius:20rpx;
}
}
}
</style>