TraceabilityAPP/pages/index/massif.vue

1078 lines
23 KiB
Vue
Raw Normal View History

2023-11-21 18:54:33 +08:00
<template>
<view class="" style="position: relative;">
<view class="top">
2023-12-13 15:57:20 +08:00
<!-- 17828474084 -->
<view class="" style="height:var(--status-bar-height) ;">
</view>
2023-12-13 15:57:20 +08:00
2023-11-30 17:51:39 +08:00
<view class="nav-con" style="justify-content: space-between;">
2024-01-02 18:18:57 +08:00
<view class="title" v-if="Object.keys(dataobj).length>0" @click=" show=true">
2023-12-20 08:42:32 +08:00
<u--image :src="u('qhtd')" width="38.55rpx" height="38.55rpx"
2023-12-13 15:57:20 +08:00
style="margin-right: 20rpx;"></u--image>
2024-01-02 18:18:57 +08:00
<text class="text">{{dataobj.title}}</text>
2023-11-30 17:51:39 +08:00
2023-12-20 23:41:00 +08:00
</view>
<view class="" v-else>
2023-12-13 15:57:20 +08:00
</view>
2023-11-30 17:51:39 +08:00
2023-12-13 15:57:20 +08:00
<view class="" style="display: flex;align-items: center;">
2023-11-30 17:51:39 +08:00
<view class="nav">
2024-01-02 18:18:57 +08:00
<view class="" style="margin-right: 16rpx;">
<u--image :src="u('sbbd')" width="35.25rpx" @click="showModal=true"
height="35.25rpx"></u--image>
2023-11-30 17:51:39 +08:00
</view>
2024-01-02 18:18:57 +08:00
<view class="" style="margin-left: 16rpx;">
<u--image :src="u('sys')" width="35.25rpx" @click="scanFn" height="35.25rpx"></u--image>
2023-11-30 17:51:39 +08:00
</view>
2024-01-02 18:18:57 +08:00
2023-11-30 17:51:39 +08:00
<view class="" style="margin-left: 20rpx;">
2024-01-02 18:18:57 +08:00
2023-11-30 17:51:39 +08:00
</view>
</view>
2023-12-13 15:57:20 +08:00
<view class="" style="margin-top: -5rpx;">
2023-11-30 17:51:39 +08:00
<Myindex url='/pages/index/massif' />
</view>
</view>
2023-11-30 17:51:39 +08:00
</view>
2023-12-13 15:57:20 +08:00
</view>
<view class="">
<view class="" style="height:var(--status-bar-height) ;">
</view>
2024-01-02 18:18:57 +08:00
<view class="nav-con" style="margin-bottom: 65rpx;">
2023-12-13 15:57:20 +08:00
</view>
</view>
2024-01-02 18:18:57 +08:00
<view class="content">
2023-12-13 15:57:20 +08:00
<!-- 土地信息 -->
2023-11-30 17:51:39 +08:00
<view class="">
2023-12-13 15:57:20 +08:00
<view class="empty-land" v-if="Object.keys(dataobj).length<=0">
<text>没有土地信息</text>
2024-01-02 18:18:57 +08:00
<text @click="navto('/pages/addLand/addLand')" style="display: flex;">去新增 <u-icon name="arrow-right"
color="#709DE9" size="28"></u-icon></text>
</view>
2023-12-13 15:57:20 +08:00
<view class="land-info">
<view class="land-area">
土地面积
2024-01-02 18:18:57 +08:00
<view style="color: #7B7B7B; font-size: 28rpx;">
2023-12-13 15:57:20 +08:00
{{dataobj.total_area|| "--"}}
</view>
</view>
<view class="plant-area">
种植面积
2024-01-02 18:18:57 +08:00
<view style="color: #7B7B7B; font-size: 28rpx;">
2023-12-13 15:57:20 +08:00
{{dataobj.total_area-dataobj.residual_area||"--"}}
</view>
</view>
</view>
<view v-if="(dataobj.total_area-dataobj.residual_area)==0" @click="palnt(dataobj.id)">
<view class="empty-land" style="background-image: url('static/main/index/xzzh.png');">
<text></text>
2024-01-02 18:18:57 +08:00
<text style="display: flex;font-size: 26rpx;">新增种植 <u-icon name="arrow-right" color="#709DE9"
size="15"></u-icon></text>
2023-12-13 15:57:20 +08:00
</view>
</view>
<view class="note" v-else>
<u--image v-if="columns2[0]&&columns2[0].length>0" @click="showPicker1=true" :src="u('qtj')"
click="showPicker1=true" width="170rpx" height="40rpx"
style="position: absolute;right: 80rpx;top: 80rpx;"></u--image>
</view>
<view class="live-tit" style="color: #1A1A1A;">
<view class="tit" style="">
苗情检测视频
</view>
2024-01-02 18:18:57 +08:00
<view class="" style="font-size: 20rpx;color: #ACACAC;display: flex;align-items: center;">
<u-icon name="clock" style="margin-right: 5rpx;" color="#ACACAC"></u-icon>
刷新时间{{getNowTimeFn()}}
2023-12-13 15:57:20 +08:00
</view>
</view>
<view class="live">
2023-12-24 20:53:41 +08:00
<u--image
src="https://ceshi-worker-task.lihaink.cn/uploads/images/20231223/20231223092144475437017.png"
v-if="video_url" width="100%"></u--image>
2023-12-20 23:41:00 +08:00
<u--image :src="u('K')" v-else width="100%"></u--image>
<view class=""
style="width: 100%;height: 100%;background-color: rgba(0, 0, 0, .5);position: absolute;top: 1px;"
@click="goLive" v-if="video_url">
<u-icon name="play-circle" size="40" color="white" v-if="video_url"
style="position: absolute;top: 50%;left: 50%;transform: translate(-50%,-50%);"></u-icon>
</view>
</view>
2023-11-29 18:11:21 +08:00
2023-11-30 17:51:39 +08:00
<view class="">
2023-12-13 15:57:20 +08:00
<view class="tit">
土壤检测信息
</view>
<view class="area-check">
2024-01-02 18:18:57 +08:00
<view class="area-li" v-for="(item,index) in soilList" :key="index"
2023-12-13 15:57:20 +08:00
:style="{backgroundImage:`url(${bgc(item.icon)})`}">
2024-01-02 18:18:57 +08:00
<view class="" style="color: #2E2E2E;font-size: 26rpx;">
2023-12-13 15:57:20 +08:00
{{item.name}}
2023-11-30 17:51:39 +08:00
</view>
2024-01-02 18:18:57 +08:00
<view class="" :style=" {color: item.status==0?'#73DFB2':'red'}"
style="font-size: 28rpx;margin-top: 10rpx;">
2023-12-13 15:57:20 +08:00
{{ item.num?item.num+item.unit:'--' }}
2023-11-30 17:51:39 +08:00
</view>
2023-12-20 23:41:00 +08:00
<view class="" style="display: flex;color:red" v-if="item.status>0">
<u-icon name="arrow-upward" color="red"></u-icon>{{item.status}}
</view>
<view class="" v-if="item.status<0" style="color: #A3E1F5;display: flex;">
<u-icon name="arrow-downward" color="#A3E1F5"></u-icon>{{item.status}}
</view>
</view>
2023-12-20 23:41:00 +08:00
2023-12-13 15:57:20 +08:00
</view>
</view>
2023-11-30 17:51:39 +08:00
2023-12-13 15:57:20 +08:00
<view class="">
<view class="tit">
环境检测信息
2023-11-21 18:54:33 +08:00
</view>
2023-12-13 15:57:20 +08:00
<view class="area-check">
2024-01-02 18:18:57 +08:00
<view class="area-li" v-for="(item,index) in environmentList" :key="index"
2023-12-13 15:57:20 +08:00
:style="{backgroundImage:`url(${bgc(item.icon)})`}">
2024-01-02 18:18:57 +08:00
<view class="" style="color: #2E2E2E;font-size: 26rpx;">
2023-12-13 15:57:20 +08:00
{{item.name}}
2023-11-30 17:51:39 +08:00
</view>
2024-01-02 18:18:57 +08:00
<view class="" :style=" {color: item.status==0?'#73DFB2':'red'}"
style="font-size: 28rpx;margin-top: 10rpx;">
2023-12-20 08:42:32 +08:00
<text v-if="item.num==0">{{item.num+item.unit}}</text>
<text v-else>{{ item.num?item.num+item.unit:'--' }}</text>
2023-12-13 15:57:20 +08:00
</view>
2023-12-20 23:41:00 +08:00
<view class="" style="display: flex;color:red" v-if="item.status>0">
<u-icon name="arrow-upward" color="red"></u-icon>{{item.status}}
</view>
<view class="" v-if="item.status<0" style="color: #A3E1F5;display: flex;">
<u-icon name="arrow-downward" color="#A3E1F5"></u-icon>{{item.status}}
</view>
2023-11-30 17:51:39 +08:00
</view>
2023-12-13 15:57:20 +08:00
</view>
</view>
2023-11-27 18:23:17 +08:00
2023-12-13 15:57:20 +08:00
<!-- old -->
2023-12-14 11:27:14 +08:00
<!-- <view class="card" v-if="Object.keys(dataobj).length>0">
2023-12-13 15:57:20 +08:00
<view class="" @click="navgo">
<view class="" style="margin: 10rpx 0;">
土地名称: {{dataobj.title}}
</view>
2023-11-27 18:23:17 +08:00
2023-12-13 15:57:20 +08:00
<view class="" style="margin: 10rpx 0;">
土地面积: {{dataobj.total_area}}
</view>
<view class="" style="margin: 10rpx 0;">
种植面积: {{dataobj.total_area-dataobj.residual_area}}
</view>
</view>
<view class="changeLand" @click="show=true">
切换土地
2023-11-21 18:54:33 +08:00
</view>
2023-12-07 09:34:25 +08:00
2023-11-21 18:54:33 +08:00
</view>
2023-12-13 15:57:20 +08:00
<view class="card" v-else>
<view class="">
<view class="">
暂无信息
</view>
</view>
2023-12-14 11:27:14 +08:00
</view> -->
2023-12-07 09:34:25 +08:00
2023-12-13 15:57:20 +08:00
</view>
2023-12-14 11:27:14 +08:00
<!-- <view class="add-thing" v-if="(dataobj.total_area-dataobj.residual_area)==0" @click="palnt(dataobj.id)">
2023-12-13 15:57:20 +08:00
新增种植
</view>
<view class="" v-else>
<view class="add-thing" @click="showPicker1=true" v-if="columns2[0]&&columns2[0].length>0">
记农事
</view>
2023-12-14 11:27:14 +08:00
</view> -->
2023-12-13 15:57:20 +08:00
<!-- 苗情监测 -->
2023-12-14 11:27:14 +08:00
<!-- <view class="">
2023-12-13 15:57:20 +08:00
<view class="live-video soil-monitor">
<view class="head">
<view class="tit">
苗情监测数据
</view>
<view class="flushed-time">
<u-icon name="clock"></u-icon>
<text>刷新时间: {{getNowTimeFn()}} </text>
2023-11-30 17:51:39 +08:00
</view>
</view>
2023-12-13 15:57:20 +08:00
</view>
<view class="video" @click="navto(' /pages/live/live')">
<u-swiper :list="dataobj.pic" width="100%" height="300rpx"></u-swiper>
</view>
2023-11-29 18:11:21 +08:00
2023-12-14 11:27:14 +08:00
</view> -->
2023-12-13 15:57:20 +08:00
<!-- 土壤监测 -->
2023-12-14 11:27:14 +08:00
<!-- -->
2023-11-29 18:11:21 +08:00
2023-12-13 15:57:20 +08:00
<!-- 组件 -->
2023-12-13 15:57:20 +08:00
<u-loading-page :loading="showLoading"></u-loading-page>
2023-12-13 15:57:20 +08:00
<u-action-sheet :show="show" keyName="name" closeOnClickOverlay :actions="columns" title="请选择"
@close="show = false" @select="confirm">
</u-action-sheet>
</view>
2024-01-02 18:18:57 +08:00
<!-- <view class="empty">
2023-12-13 15:57:20 +08:00
<view class="addLand">
<view class="">
你还没有土地信息
</view>
<view class="addBtn" @click="navto('/pages/addLand/addLand')">
去添加
2023-11-27 18:23:17 +08:00
</view>
2023-11-30 17:51:39 +08:00
</view>
2024-01-02 18:18:57 +08:00
</view> -->
2023-12-13 15:57:20 +08:00
<!-- 组件 -->
<view class="Modal">
<u-popup :show="showModal" mode="center" @close="closeModal" :round="10">
<view class="Modal">
<text> 产品编号:</text>
<uni-data-select v-model="equipmentId" style="width: 300rpx;margin-left: 30rpx;"
:localdata="range"></uni-data-select>
</view>
2023-11-30 17:51:39 +08:00
2023-12-13 15:57:20 +08:00
<view class="Modal-btn">
<view class="Modal-btna" @click="closeModal">
取消
</view>
2023-12-13 15:57:20 +08:00
<view class="Modal-btnb" @click="bindFn">
确定
</view>
</view>
</u-popup>
2023-11-27 18:23:17 +08:00
2023-11-30 17:51:39 +08:00
</view>
2023-12-13 15:57:20 +08:00
<u-picker keyName="name" :show="showPicker1" @cancel="showPicker1=false" @confirm="confirm1"
:columns="columns2"></u-picker>
<u-picker keyName="label" :show="showPicker" @cancel="showPicker=false" @confirm="confirm2"
:columns="columns1"></u-picker>
</view>
2023-12-25 00:26:32 +08:00
<MyTabbar />
2023-11-21 18:54:33 +08:00
</template>
<script setup>
import {
reactive,
2023-12-21 18:04:26 +08:00
ref,
} from 'vue';
import {
onLoad,
2023-12-21 18:04:26 +08:00
onShow,
onHide
} from "@dcloudio/uni-app"
2023-11-30 17:51:39 +08:00
import Myindex from '@/components/return/index.vue';
2023-12-25 00:26:32 +08:00
import MyTabbar from "@/components/customTabbar/tabbar.vue"
2023-11-25 16:18:54 +08:00
import {
2023-11-27 18:23:17 +08:00
bindproduct,
2023-11-25 16:18:54 +08:00
lindexist,
2023-11-27 18:23:17 +08:00
landlist,
2023-11-29 18:11:21 +08:00
plantlist,
2023-11-27 18:23:17 +08:00
landproduct
} from '@/api/api.js'
2023-11-30 17:51:39 +08:00
import store from "@/store/index.js"
2023-11-29 18:11:21 +08:00
const showPicker = ref(false)
const showPicker1 = ref(false)
2023-11-27 18:23:17 +08:00
const showModal = ref(false)
2023-11-29 18:11:21 +08:00
const columns1 = reactive([
[{
label: '施肥',
route: "/pages/husbandryForm/fertilize"
}, {
label: '除草',
route: "/pages/husbandryForm/weeding"
}, {
label: '灌溉',
route: "/pages/husbandryForm/irrigate"
}, {
label: '除虫',
route: "/pages/husbandryForm/Pest"
}, {
label: '收获',
route: "/pages/husbandryForm/harvest"
}]
]);
2023-11-29 18:11:21 +08:00
const columns2 = reactive([])
const range = reactive([])
// 土壤监测数据
const url = ref('https://ceshi-worker-task.lihaink.cn//uploads//images//20231121//202311211336582b7920656.jpg')
const soilList = reactive([{
2023-12-13 15:57:20 +08:00
icon: "trwd",
name: "土壤温度",
2023-12-13 15:57:20 +08:00
num: 0,
2023-11-27 18:23:17 +08:00
unit: "℃",
2023-12-20 23:41:00 +08:00
status: 0,
2023-12-09 17:07:42 +08:00
}, {
2023-12-13 15:57:20 +08:00
icon: "trsd",
name: "土壤湿度",
2023-12-13 15:57:20 +08:00
num: 0,
2023-11-27 18:23:17 +08:00
unit: "%RH",
2023-12-20 23:41:00 +08:00
status: 0,
2023-12-09 17:07:42 +08:00
}, {
2023-12-13 15:57:20 +08:00
icon: "trddl",
name: "土壤导电率",
2023-12-13 15:57:20 +08:00
num: 0,
2023-11-27 18:23:17 +08:00
unit: "μS/cm",
2023-12-20 23:41:00 +08:00
status: 0,
2023-12-09 17:07:42 +08:00
}, {
2023-12-13 15:57:20 +08:00
icon: "trph",
name: "土壤PH值",
2023-12-13 15:57:20 +08:00
num: 0,
2024-01-02 18:18:57 +08:00
unit: "",
2023-12-20 23:41:00 +08:00
status: 0,
2023-12-09 17:07:42 +08:00
}, {
2023-12-13 15:57:20 +08:00
icon: "trhdl",
name: "土壤含氮量",
2023-12-13 15:57:20 +08:00
num: 0,
2023-11-27 18:23:17 +08:00
unit: "mg/kg",
2023-12-20 23:41:00 +08:00
status: 0,
2023-12-09 17:07:42 +08:00
}, {
2023-12-13 15:57:20 +08:00
icon: "trhll",
name: "土壤含磷量",
2023-12-13 15:57:20 +08:00
num: 0,
2023-11-27 18:23:17 +08:00
unit: "mg/kg",
2023-12-20 23:41:00 +08:00
status: 0,
2023-12-09 17:07:42 +08:00
}, {
2023-12-13 15:57:20 +08:00
icon: "trhjl",
name: "土壤含钾量",
2023-12-13 15:57:20 +08:00
num: 0,
2023-11-27 18:23:17 +08:00
unit: "mg/kg",
2023-12-20 23:41:00 +08:00
status: 0,
2023-12-09 17:07:42 +08:00
},
2023-12-09 17:07:42 +08:00
])
2023-11-30 17:51:39 +08:00
onLoad(() => {
2023-12-25 00:26:32 +08:00
uni.hideTabBar()
2023-11-30 17:51:39 +08:00
// console.log(store.state.userInfo)
if (!store.state.userInfo) {
uni.redirectTo({
url: '/pages/Login/login'
})
2023-12-09 17:07:42 +08:00
2023-11-30 17:51:39 +08:00
}
})
2023-12-21 18:04:26 +08:00
2023-11-25 16:18:54 +08:00
const dataobj = reactive({})
2023-11-27 18:23:17 +08:00
const tdId = ref('')
2023-11-29 18:11:21 +08:00
const palntId = ref('')
// 绑定设备
const equipmentId = ref("")
const bindFn = () => {
2023-11-27 18:23:17 +08:00
biproduct()
showModal.value = false
}
// 扫码
const scanFn = () => {
uni.scanCode({
2023-11-21 18:54:33 +08:00
success: function(res) {
// console.log('条码类型:' + res.scanType);
console.log('条码内容:' + res.result.split('='));
uni.navigateTo({
2023-11-29 18:11:21 +08:00
url: '/pages/landDetail/results?id=' + res.result.split('=')[1]
})
2023-11-21 18:54:33 +08:00
}
});
}
2023-12-20 23:41:00 +08:00
const goLive = () => {
uni.navigateTo({
url: '/pages/live/live?url=' + video_url.value
})
}
const show = ref(false)
const showLoading = ref(false)
2023-11-25 16:18:54 +08:00
const columns = reactive([]);
2023-12-20 23:41:00 +08:00
// 环境基准
let threshold = []
const thresholdFn = (item, min, max) => {
if (item.num < min) {
item.status = (item.num - min).toFixed(1)
}
if (item.num > max) {
item.status = (item.num - max).toFixed(1)
}
}
// 环境监测数据
const environmentList = reactive([{
2023-12-13 15:57:20 +08:00
icon: "FS",
name: "风速",
2023-12-13 15:57:20 +08:00
num: 0,
2023-12-20 23:41:00 +08:00
unit: "m/s",
status: 0,
2023-12-09 17:07:42 +08:00
}, {
2023-12-13 15:57:20 +08:00
icon: "FX",
name: "风向",
2023-12-13 15:57:20 +08:00
num: 0,
2023-12-20 23:41:00 +08:00
unit: "",
status: 0,
2023-12-09 17:07:42 +08:00
}, {
2023-12-13 15:57:20 +08:00
icon: "WD1",
name: "温度",
2023-12-13 15:57:20 +08:00
num: 0,
2023-11-27 18:23:17 +08:00
unit: "℃",
2023-12-20 23:41:00 +08:00
status: 0,
2023-12-09 17:07:42 +08:00
}, {
2023-12-13 15:57:20 +08:00
icon: "SD",
name: "湿度",
2023-12-13 15:57:20 +08:00
num: 0,
2023-11-27 18:23:17 +08:00
unit: "%RH",
2023-12-20 23:41:00 +08:00
status: 0,
2023-12-09 17:07:42 +08:00
}, {
2023-12-13 15:57:20 +08:00
icon: 'eyht',
name: "二氧化碳",
2023-12-13 15:57:20 +08:00
num: 0,
2023-11-27 18:23:17 +08:00
unit: "ppm",
2023-12-20 23:41:00 +08:00
status: 0,
}, {
2023-12-13 15:57:20 +08:00
icon: "QY",
name: "气压",
2023-12-13 15:57:20 +08:00
num: 0,
2023-11-27 18:23:17 +08:00
unit: "KPa",
2023-12-20 23:41:00 +08:00
status: 0,
2023-12-09 17:07:42 +08:00
}, {
2023-12-13 15:57:20 +08:00
icon: "YL",
name: "雨量",
2023-12-13 15:57:20 +08:00
num: 0,
2023-11-27 18:23:17 +08:00
unit: "mm",
2023-12-20 23:41:00 +08:00
status: 0,
2023-12-09 17:07:42 +08:00
}, {
2023-12-13 15:57:20 +08:00
icon: "GZ",
name: "光照量",
2023-12-13 15:57:20 +08:00
num: 0,
2023-11-27 18:23:17 +08:00
unit: "Lux",
2023-12-20 23:41:00 +08:00
status: 0,
2023-12-09 17:07:42 +08:00
},
2023-12-09 17:07:42 +08:00
])
onShow(() => {
2023-12-20 08:42:32 +08:00
// getlist()
2023-11-25 16:18:54 +08:00
getlist1()
2023-11-27 18:23:17 +08:00
getlist2()
2023-11-25 16:18:54 +08:00
})
2023-12-13 15:57:20 +08:00
const bgc = (icon) => {
return `/static/main/index/${icon}.png`
}
2023-12-24 20:53:41 +08:00
const video_url = ref()
2023-11-27 18:23:17 +08:00
//列表获取
2023-11-25 16:18:54 +08:00
const getlist = () => {
lindexist({
2023-11-27 18:23:17 +08:00
land_id: tdId.value
2023-11-25 16:18:54 +08:00
}).then((res) => {
2023-11-27 18:23:17 +08:00
2023-11-25 16:18:54 +08:00
if (res.code == 1) {
2023-12-20 23:41:00 +08:00
2024-01-02 18:18:57 +08:00
2023-12-20 23:41:00 +08:00
2023-12-28 16:56:26 +08:00
video_url.value = res.data.video_url
// if (res.data.user_id == 23) {
// video_url.value =
// 'http://rtsp.lihaink.cn/live/lihai_lot_walnutpi_dev_4.live.mp4?secret=YwDtp2llj80HA19JhMXL4Po99nsMAyNT'
// }
2023-12-20 23:41:00 +08:00
// video_url=res.data.
2023-12-24 20:53:41 +08:00
threshold = res.data?.monitor?.threshold || ""
2023-11-30 17:51:39 +08:00
if (Object.keys(res.data).length > 0) {
getlist3(res.data.id)
Object.assign(dataobj, res.data);
if (res.data && res.data.monitor && res.data.monitor.soil_monitor_data) {
2023-12-20 08:42:32 +08:00
soilList[0].num = res.data.monitor.soil_monitor_data.soil_temperature
soilList[1].num = res.data.monitor.soil_monitor_data.soil_moisture
2023-11-30 17:51:39 +08:00
soilList[2].num = res.data.monitor.soil_monitor_data.conductivity
soilList[3].num = res.data.monitor.soil_monitor_data.ph
soilList[4].num = res.data.monitor.soil_monitor_data.n_content
soilList[5].num = res.data.monitor.soil_monitor_data.p_content
soilList[6].num = res.data.monitor.soil_monitor_data.k_content
2023-12-20 23:41:00 +08:00
thresholdFn(soilList[0], threshold.soil_temp_min, threshold.soil_temp_max)
thresholdFn(soilList[1], threshold.soil_mois_min, threshold.soil_mois_max)
thresholdFn(soilList[3], threshold.soil_ph_min, threshold.soil_ph_max)
thresholdFn(soilList[4], threshold.soil_n_content_min, threshold.soil_n_content_max)
thresholdFn(soilList[5], threshold.soil_p_content_min, threshold.soil_p_content_max)
thresholdFn(soilList[6], threshold.soil_k_content_min, threshold.soil_k_content_max)
2023-11-30 17:51:39 +08:00
}
if (res.data && res.data.monitor && res.data.monitor.air_monitor_data) {
environmentList[0].num = res.data.monitor.air_monitor_data.wind_speed
environmentList[1].num = res.data.monitor.air_monitor_data.wind_direction
2023-12-20 08:42:32 +08:00
environmentList[2].num = res.data.monitor.air_monitor_data.air_temperature
environmentList[3].num = res.data.monitor.air_monitor_data.air_moisture
2023-11-30 17:51:39 +08:00
environmentList[4].num = res.data.monitor.air_monitor_data.co2_content
environmentList[5].num = res.data.monitor.air_monitor_data.pressure
environmentList[6].num = res.data.monitor.air_monitor_data.rainfall
environmentList[7].num = res.data.monitor.air_monitor_data.light_intensity
2023-12-20 23:41:00 +08:00
thresholdFn(environmentList[0], threshold.wind_speed_min, threshold.wind_speed_max)
// thresholdFn(environmentList[1], threshold.wind_speed_min, threshold.wind_speed_max)
// sdf
thresholdFn(environmentList[2], threshold.air_temp_min, threshold.air_temp_max)
thresholdFn(environmentList[3], threshold.air_mois_min, threshold.air_mois_max)
thresholdFn(environmentList[4], threshold.air_co2_content_min, threshold
.air_co2_content_max)
thresholdFn(environmentList[5], threshold.ambient_air_pressure_min, threshold
.ambient_air_pressure_max)
// sdf
// thresholdFn(environmentList[6], threshold.ambient_air_pressure_min, threshold.ambient_air_pressure_max)
// thresholdFn(environmentList[6], threshold.ambient_air_pressure_min, threshold.ambient_air_pressure_max)
2023-11-30 17:51:39 +08:00
}
2023-11-27 18:23:17 +08:00
}
2023-11-25 16:18:54 +08:00
}
})
}
const getlist1 = () => {
landlist({
page_no: 1,
page_size: 99995,
keyword: ''
}).then((res) => {
if (res.code == 1) {
2023-12-20 08:42:32 +08:00
2023-12-24 20:53:41 +08:00
tdId.value = res.data[0]?.id || ''
2023-12-20 08:42:32 +08:00
getlist()
2023-11-27 18:23:17 +08:00
if (res.data.length > 0) {
columns.splice(0, columns.length, ...res.data.map((step, index) => {
return {
name: step.title,
id: step.id,
};
}));
}
2023-11-25 16:18:54 +08:00
}
})
}
2023-11-27 18:23:17 +08:00
const getlist2 = () => {
landproduct().then((res) => {
if (res.code == 1) {
range.splice(0, range.length, ...res.data.map((step, index) => {
return {
text: step.name,
value: step.product_id,
};
}));
// console.log(res)
2023-11-27 18:23:17 +08:00
}
})
2023-11-29 18:11:21 +08:00
2023-11-27 18:23:17 +08:00
}
2023-11-29 18:11:21 +08:00
const getlist3 = (id) => {
plantlist({
land_id: id
}).then((res) => {
2023-11-30 17:51:39 +08:00
2023-11-29 18:11:21 +08:00
if (res.code == 1) {
2023-11-30 17:51:39 +08:00
columns2.splice(0)
2023-11-29 18:11:21 +08:00
let arr1 = []
arr1.splice(0, arr1.length, ...res.data.map((step, index) => {
return {
name: step.kind + '-' + step.id,
id: step.id,
2023-12-07 09:34:25 +08:00
status: step.status
2023-11-29 18:11:21 +08:00
};
}));
columns2.push(arr1)
2023-12-07 09:34:25 +08:00
2023-11-29 18:11:21 +08:00
}
})
}
//关闭弹窗
const closeModal = () => {
showModal.value = false
equipmentId.value = ''
}
2023-11-25 16:18:54 +08:00
//绑定产品
2023-11-27 18:23:17 +08:00
const biproduct = () => {
2023-11-30 17:51:39 +08:00
if (equipmentId.value) {
bindproduct({
land_id: dataobj.id,
product_id: equipmentId.value
}).then((res) => {
if (res.code == 1) {
uni.$u.toast(res.msg);
// this.dataobj=res.data
equipmentId.value = ''
}
console.log(res)
})
} else {
uni.$u.toast('请选择产品编号');
}
2023-11-25 16:18:54 +08:00
}
2023-11-29 18:11:21 +08:00
const confirm2 = (e) => {
showPicker.value = false
2023-11-30 17:51:39 +08:00
2023-11-29 18:11:21 +08:00
uni.navigateTo({
url: e.value[0].route + '?id=' + palntId.value
})
}
const confirm1 = (e) => {
2023-12-09 17:07:42 +08:00
2023-11-29 18:11:21 +08:00
palntId.value = e.value[0].id
showPicker1.value = false
2023-12-07 09:34:25 +08:00
if (e.value[0].status == 2) {
uni.$u.toast('该土地已经收获,不能进行操作');
} else {
showPicker.value = true
}
2023-11-29 18:11:21 +08:00
}
const confirm = (e) => {
2023-11-27 18:23:17 +08:00
// console.log(e)
tdId.value = e.id
getlist()
show.value = false
showLoading.value = true
setTimeout(() => {
showLoading.value = false
}, 1000)
}
const getNowTimeFn = () => {
const now = new Date();
const hour = now.getHours();
const minute = now.getMinutes();
const formattedHour = hour < 10 ? '0' + hour : hour;
const formattedMinute = minute < 10 ? '0' + minute : minute;
const currentTime = formattedHour + ':' + formattedMinute;
return currentTime
}
2023-11-29 18:11:21 +08:00
2023-11-25 16:18:54 +08:00
const navgo = () => {
uni.navigateTo({
url: '/pages/landDetail/index?id=' + dataobj.id
})
}
2023-12-09 17:07:42 +08:00
const palnt = (id) => {
uni.navigateTo({
url: '/pages/husbandryForm/sow?id=' + id
})
}
const navto = (url) => {
2023-11-21 18:54:33 +08:00
uni.navigateTo({
url
})
}
getNowTimeFn()
2023-12-13 15:57:20 +08:00
const u = (name) => {
return `/static/main/index/${name}.png`
}
2023-11-21 18:54:33 +08:00
</script>
2023-11-29 18:11:21 +08:00
<style lang="scss">
2023-11-27 18:23:17 +08:00
page {
background-color: $theme-bg-color;
}
.top {
background-color: #34D190;
position: fixed;
z-index: 999999;
width: 750rpx;
2023-11-21 18:54:33 +08:00
}
2023-11-27 18:23:17 +08:00
.coneng-detail {
width: 478rpx;
height: 341rpx;
background: #FFFFFF;
border-radius: 6px 6px 6px 6px;
opacity: 1;
font-size: 25rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #737373;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
margin: 70rpx auto;
image {
width: 280rpx;
height: 142rpx;
margin-bottom: 20rpx;
}
}
2023-11-29 18:11:21 +08:00
.add-thing {
width: 266.36rpx;
height: 66.59rpx;
border-radius: 42.06rpx 42.06rpx 42.06rpx 42.06rpx;
border: 1px solid $theme-main-color;
margin: 20rpx auto;
line-height: 66rpx;
text-align: center;
color: $theme-main-color;
}
2023-11-27 18:23:17 +08:00
.Modal {
padding: 60rpx 40rpx;
display: flex;
text {
margin-top: 5rpx;
}
.Modal-btn {
display: flex;
justify-content: space-around;
padding-bottom: 20rpx;
.Modal-btna {
width: 120rpx;
height: 60rpx;
line-height: 60rpx;
font-size: 25rpx;
background-color: #e5e0d8;
text-align: center;
border-radius: 30rpx;
color: #fff;
}
.Modal-btnb {
width: 120rpx;
height: 60rpx;
line-height: 60rpx;
font-size: 25rpx;
background-color: #34D190;
text-align: center;
border-radius: 30rpx;
color: #fff;
}
}
}
.uni-select__selector {
z-index: 9999 !important;
}
2023-11-30 17:51:39 +08:00
.nav-con {
display: flex;
padding-top: 20rpx;
padding-bottom: 10rpx;
}
.nav {
display: flex;
2023-11-30 17:51:39 +08:00
padding-right: 20rpx;
padding-left: 10rpx;
}
.card {
display: flex;
justify-content: space-between;
2023-11-21 18:54:33 +08:00
.changeLand {
width: 200rpx;
height: 70rpx;
line-height: 70rpx;
text-align: center;
border-radius: 30rpx;
background-color: $theme-main-color;
color: white;
2023-11-21 18:54:33 +08:00
}
}
2023-11-21 18:54:33 +08:00
.content {
2023-11-27 18:23:17 +08:00
// min-height: 92vh;
padding: 0 30rpx;
2024-01-02 18:18:57 +08:00
// padding-top: 20rpx;
// background-color: red;
box-sizing: border-box;
2023-12-13 15:57:20 +08:00
// .land.land-info
.land-info {
display: flex;
justify-content: space-between;
2024-01-02 18:18:57 +08:00
margin-bottom: 30rpx;
2023-12-13 15:57:20 +08:00
.land-area {
2024-01-02 18:18:57 +08:00
width: 335rpx;
2023-12-13 15:57:20 +08:00
height: 120rpx;
2024-01-02 18:18:57 +08:00
font-size: 30rpx;
border-radius: 10rpx;
color: #1A1A1A;
box-sizing: border-box;
2023-12-13 15:57:20 +08:00
background-image: url('/static/main/index/tdmj.png');
background-size: 100% 100%;
2023-12-14 11:27:14 +08:00
box-shadow: 1rpx 1rpx 10rpx 1rpx rgba(0, 0, 0, 0.1);
2024-01-02 18:18:57 +08:00
padding-top: 20rpx;
padding-left: 115rpx;
2023-12-13 15:57:20 +08:00
}
.plant-area {
2024-01-02 18:18:57 +08:00
width: 335rpx;
2023-12-13 15:57:20 +08:00
height: 120rpx;
2024-01-02 18:18:57 +08:00
font-size: 30rpx;
2023-12-13 15:57:20 +08:00
background-image: url('/static/main/index/zzmj.png');
background-size: 100% 100%;
2024-01-02 18:18:57 +08:00
box-sizing: border-box;
border-radius: 10rpx;
2023-12-14 11:27:14 +08:00
box-shadow: 1rpx 1rpx 10rpx 1rpx rgba(0, 0, 0, 0.1);
2024-01-02 18:18:57 +08:00
padding-top: 20rpx;
padding-left: 115rpx;
2023-12-13 15:57:20 +08:00
}
}
.live-tit {
display: flex;
justify-content: space-between;
align-items: center;
}
.live {
2023-12-20 23:41:00 +08:00
position: relative;
2023-12-13 15:57:20 +08:00
width: 100%;
height: 447rpx;
margin-bottom: 20rpx;
}
}
2023-11-21 18:54:33 +08:00
2023-12-13 15:57:20 +08:00
.note {
height: 168rpx;
background-image: url('/static/main/index/JNS.png');
2024-01-02 18:18:57 +08:00
// background-color: red;
2023-12-13 15:57:20 +08:00
background-size: 100% 100%;
2024-01-02 18:18:57 +08:00
margin-bottom: 30rpx;
2023-12-13 15:57:20 +08:00
position: relative;
}
.area-check {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
.area-li {
2024-01-02 18:18:57 +08:00
width: 330rpx;
height: 194rpx;
2023-12-13 15:57:20 +08:00
border-radius: 10rpx;
background-size: 100% 100%;
margin-bottom: 20rpx;
padding: 45rpx 30rpx;
2024-01-02 18:18:57 +08:00
box-shadow: 1rpx 1rpx 10rpx 1rpx rgba(0, 0, 0, 0.1);
2023-12-13 15:57:20 +08:00
}
}
.tit {
position: relative;
padding-left: 20rpx;
font-weight: bold;
2024-01-02 18:18:57 +08:00
font-size: 28rpx;
2023-12-13 15:57:20 +08:00
margin-bottom: 20rpx;
2024-01-02 18:18:57 +08:00
color: #1A1A1A;
2023-12-13 15:57:20 +08:00
}
.tit::before {
content: "";
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 0;
2024-01-02 18:18:57 +08:00
width: 6rpx;
2023-12-13 15:57:20 +08:00
/* 左边框的宽度 */
2024-01-02 18:18:57 +08:00
height: 25rpx;
border-radius: 20rpx;
2023-12-13 15:57:20 +08:00
background-color: #34D08D;
}
.soil-monitor {
margin-top: 40rpx;
2023-11-21 18:54:33 +08:00
.head {
2023-11-21 18:54:33 +08:00
.flushed-time {
display: flex;
font-size: 26.29rpx;
color: #737373;
margin-top: 10rpx;
}
}
.monitor-content {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.monitor-card {
margin-top: 20rpx;
background-color: white;
padding: 30rpx 20rpx;
border-radius: 30rpx;
width: 332.94rpx;
box-sizing: border-box;
height: 212.03rpx;
.name {
font-size: 29.79rpx;
display: flex;
align-items: center;
}
.num {
margin-top: 30rpx;
color: $theme-main-color;
}
}
}
}
.video {
margin-top: 20rpx;
width: 100%;
height: 300rpx;
}
2023-11-21 18:54:33 +08:00
.empty {
height: 100vh;
background-color: $theme-bg-color;
position: relative;
.addLand {
width: auto;
height: 100rpx;
color: grey;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
.addBtn {
margin-top: 20rpx;
width: 250rpx;
height: 70rpx;
border: 1px solid $theme-main-color;
line-height: 70rpx;
border-radius: 50rpx;
text-align: center;
2023-11-21 18:54:33 +08:00
}
2023-11-21 18:54:33 +08:00
}
}
2023-12-13 15:57:20 +08:00
.empty-land {
2024-01-02 18:18:57 +08:00
width: 715rpx;
margin: 0 auto;
2023-12-13 15:57:20 +08:00
height: 135rpx;
2024-01-02 18:18:57 +08:00
transform: translateX(-20rpx);
2023-12-13 15:57:20 +08:00
color: #74A0EA;
text-align: center;
background-image: url('../../static/main/index/xz.png');
background-size: 100% 100%;
display: flex;
justify-content: space-between;
align-items: center;
padding-left: 200rpx;
padding-right: 10rpx;
}
2024-01-02 18:18:57 +08:00
.title {
padding-left: 20rpx;
display: flex;
color: white;
font-size: 32rpx;
width: 400rpx;
}
.text {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
2023-11-21 18:54:33 +08:00
</style>