2024-12-19 12:41:30 +08:00
|
|
|
|
<template>
|
2024-12-20 10:50:22 +08:00
|
|
|
|
<custom-nav-bar :left="true" title="孢子"></custom-nav-bar>
|
2025-01-17 14:24:40 +08:00
|
|
|
|
<view class="header-section">
|
|
|
|
|
<view class="card" style="margin-top: 0; ">
|
|
|
|
|
<view class="cards-title">
|
|
|
|
|
<view>
|
|
|
|
|
<view>
|
|
|
|
|
<view>运行模式</view>
|
2024-12-19 12:41:30 +08:00
|
|
|
|
</view>
|
2025-01-17 14:24:40 +08:00
|
|
|
|
<view style="margin-left: 10px;">
|
|
|
|
|
<u-button :text="`${itemProperty.m == '1'? '自动':'手动'}`"
|
|
|
|
|
:type="`${itemProperty.m == '1'? 'success':'warning'}`"
|
|
|
|
|
@click="controlHeadSwitch(item,itemProperty.m,'m')"></u-button>
|
2024-12-19 12:41:30 +08:00
|
|
|
|
</view>
|
2025-01-17 14:24:40 +08:00
|
|
|
|
</view>
|
|
|
|
|
<view class="title-r">
|
|
|
|
|
<view class="iconfont icon-lishijilu icon" @click="openH(item)"></view>
|
|
|
|
|
</view>
|
2024-12-19 12:41:30 +08:00
|
|
|
|
</view>
|
2025-01-17 14:24:40 +08:00
|
|
|
|
<view class="content">
|
|
|
|
|
<view class="cards-content">
|
|
|
|
|
<view class="txt-list" @click="taskdetails">
|
|
|
|
|
<view class="list2">
|
|
|
|
|
<view>
|
|
|
|
|
<text class="iconfont icon-men icon"></text>
|
|
|
|
|
<text>设备门:</text>{{itemProperty.ss===null?"--":(itemProperty.ss==='1'?"打开":"关闭") }}
|
|
|
|
|
</view>
|
|
|
|
|
<view>
|
|
|
|
|
<text class="iconfont icon-haiba icon"></text>
|
|
|
|
|
<text>海拔:</text>{{itemProperty.att===null?"--":itemProperty.att}}m
|
|
|
|
|
</view>
|
|
|
|
|
<view>
|
|
|
|
|
<text class="iconfont icon-caiyangdengji icon"></text>
|
|
|
|
|
<text>单次采样:</text>{{itemProperty.pl===null?"--":itemProperty.pl}}
|
|
|
|
|
</view>
|
|
|
|
|
<view>
|
|
|
|
|
<text class="iconfont icon-qiancaiyang icon"></text>
|
|
|
|
|
<text>累计采样:</text>{{itemProperty.pt===null?"--":itemProperty.pt}}
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2024-12-19 12:41:30 +08:00
|
|
|
|
</view>
|
2025-01-17 14:24:40 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="content-section">
|
|
|
|
|
<view class="grid">
|
|
|
|
|
<view>
|
|
|
|
|
<text class="text">光源</text>
|
|
|
|
|
<u-button type="success" :text="`${itemProperty.ias == '1'? '打开':'关闭'}`" :class="[itemProperty.ias === '1' ? 'bg-green':'bg-red']"
|
|
|
|
|
@click="controlHeadSwitch(item,itemProperty.ias,'ias')" />
|
|
|
|
|
</view>
|
|
|
|
|
<view>
|
|
|
|
|
<text class="text">采样口</text>
|
|
|
|
|
<u-button type="success" :text="`${itemProperty.sls == '1'? '打开':'关闭'}`" :class="[itemProperty.sls === '1' ? 'bg-green':'bg-red']"
|
|
|
|
|
@click="controlHeadSwitch(item,itemProperty.sls,'sls')" />
|
|
|
|
|
</view>
|
|
|
|
|
<view>
|
|
|
|
|
<text class="text">吸气口</text>
|
|
|
|
|
<u-button type="success" :text="`${itemProperty.ais == '1'? '打开':'关闭'}`" :class="[itemProperty.ais === '1' ? 'bg-green':'bg-red']"
|
|
|
|
|
@click="controlHeadSwitch(item,itemProperty.ais,'ais')" />
|
|
|
|
|
</view>
|
|
|
|
|
<view>
|
|
|
|
|
<text class="text">载波电机</text>
|
|
|
|
|
<u-button type="success" :text="`${itemProperty.zbs == '1'? '运行':'停止'}`" :class="[itemProperty.zbs === '1' ? 'bg-green':'bg-red']"
|
|
|
|
|
@click="controlHeadSwitch(item,itemProperty.zbs,'zbs')" />
|
2024-12-19 12:41:30 +08:00
|
|
|
|
</view>
|
2025-01-17 14:24:40 +08:00
|
|
|
|
<view>
|
|
|
|
|
<text class="text">排气口</text>
|
|
|
|
|
<u-button type="success" :text="`${itemProperty.bwa == '1'? '打开':'关闭'}`" :class="[itemProperty.bwa === '1' ? 'bg-green':'bg-red']"
|
|
|
|
|
@click="controlHeadSwitch(item,itemProperty.bwa,'bwa')"/>
|
|
|
|
|
</view>
|
|
|
|
|
<view>
|
|
|
|
|
<text class="text">摄像头</text>
|
|
|
|
|
<u-button type="success" text="拍照" @click="controlHeadSwitch(item,0,'pg')"/>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<view class="rowheadstyle" vv-if="itemProperty.aat!=null">
|
|
|
|
|
<u-button text="分析" size="large" type="primary" @click="analysis(item,itemProperty.aat)"></u-button>
|
|
|
|
|
</view>
|
|
|
|
|
|
2024-12-19 12:41:30 +08:00
|
|
|
|
<u-popup :show="showDeviceLog" mode="center">
|
|
|
|
|
<view class="dialog-container">
|
|
|
|
|
<view class="dialog-title">
|
|
|
|
|
<text>孢子历史记录</text>
|
|
|
|
|
<u-icon name="reload" size="20" class="reload-btn" @click="reload"></u-icon>
|
|
|
|
|
<u-icon name="close" size="20" class="close-btn" @click="closeLog"></u-icon>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="dialog-body">
|
2024-12-19 18:12:16 +08:00
|
|
|
|
<view class="logs-data-box" style="width:90vw">
|
|
|
|
|
<view class="logs-container">
|
|
|
|
|
<view class="logs-item" v-for="itemHistory in listData" :key="item.id">
|
|
|
|
|
<view class="row">
|
|
|
|
|
<view class="full-line">
|
|
|
|
|
<text class="label">设备编号:</text>
|
|
|
|
|
<text class="text">{{ itemHistory.deviceCode }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="row">
|
|
|
|
|
<view class="full-line">
|
|
|
|
|
<text class="label">记录时间:</text>
|
|
|
|
|
<text class="text">{{ itemHistory.createTime }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="charge">
|
|
|
|
|
<view class="flex item charge-item">
|
|
|
|
|
<view>{{ itemHistory.historyContent || "-" }}</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<uni-pagination :pageCount="query.pageSize" :curPageNum="query.pageNum" :totalNum="total"
|
|
|
|
|
@pageClick="pageTurning"></uni-pagination>
|
|
|
|
|
</view>
|
2024-12-19 12:41:30 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</u-popup>
|
|
|
|
|
<u-popup :show="showAnalysis" mode="center">
|
|
|
|
|
<view class="dialog-container">
|
|
|
|
|
<view class="dialog-title">
|
|
|
|
|
<text>孢子分析</text>
|
|
|
|
|
<u-icon name="close" size="20" class="close-btn" @click="closeLogAnalysis"></u-icon>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="dialog-body" v-if="itemProperty.aat!=null">
|
|
|
|
|
<uni-row class="rowstyle">
|
|
|
|
|
<uni-col :span="24">
|
|
|
|
|
<uni-row class="col1"><uni-col :span="24">
|
|
|
|
|
<view class="text2">分析图片</view>
|
|
|
|
|
</uni-col></uni-row>
|
|
|
|
|
<uni-row class="col2"><uni-col :span="24" style="text-align: center;"><u-image
|
|
|
|
|
:src="itemProperty.img" :lazy-load="true" width="240px" height="240px"
|
|
|
|
|
shape="square"></u-image></uni-col></uni-row>
|
|
|
|
|
</uni-col>
|
|
|
|
|
</uni-row>
|
|
|
|
|
<uni-row class="rowstyle">
|
|
|
|
|
<uni-col :span="24">
|
|
|
|
|
<uni-row class="col1"><uni-col :span="24">
|
|
|
|
|
<view class="text2">分析时间</view>
|
|
|
|
|
</uni-col></uni-row>
|
|
|
|
|
<uni-row class="col2"><uni-col :span="24" style="text-align: center;">
|
|
|
|
|
<view class="text2">{{itemProperty.aat===null?"--":itemProperty.aat}}</view>
|
|
|
|
|
</uni-col></uni-row>
|
|
|
|
|
</uni-col>
|
|
|
|
|
</uni-row>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</u-popup>
|
2025-01-17 14:24:40 +08:00
|
|
|
|
|
2024-12-19 12:41:30 +08:00
|
|
|
|
</template>
|
2024-12-19 18:12:16 +08:00
|
|
|
|
<script>
|
|
|
|
|
import plugin from "@/plugins"
|
2024-12-19 12:41:30 +08:00
|
|
|
|
import {
|
2024-12-19 18:12:16 +08:00
|
|
|
|
controlHeadSwitch
|
|
|
|
|
} from "@/api/controlHeadInterface"
|
2024-12-19 12:41:30 +08:00
|
|
|
|
import {
|
2024-12-19 18:12:16 +08:00
|
|
|
|
getOutDeviceHistoryList
|
|
|
|
|
} from "@/api/system/device_agricultural"
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
item: {},
|
|
|
|
|
itemProperty: {},
|
|
|
|
|
showDeviceLog: false,
|
|
|
|
|
passParams: {},
|
|
|
|
|
showAnalysis: false,
|
|
|
|
|
total: 0,
|
|
|
|
|
listData: [],
|
|
|
|
|
query: {
|
|
|
|
|
pageNum: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
deviceCode: null
|
2024-12-19 22:23:23 +08:00
|
|
|
|
},
|
|
|
|
|
mqttConnected: false, // mqtt链接状态
|
|
|
|
|
topics: []
|
2024-12-19 18:12:16 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onLoad(option) {
|
|
|
|
|
if (option.item != null) {
|
|
|
|
|
this.item = JSON.parse(decodeURIComponent(option.item));
|
|
|
|
|
if (this.item) {
|
|
|
|
|
this.itemProperty = this.item.deviceData;
|
|
|
|
|
this.query.deviceCode = this.item.deviceCode;
|
2024-12-19 22:23:23 +08:00
|
|
|
|
let topic = "jsy/iot/push/outProduct/" + this.item.deviceCode;
|
|
|
|
|
this.topics.push(topic);
|
|
|
|
|
this.mqttSubscribes(this.topics);
|
2025-01-07 10:02:41 +08:00
|
|
|
|
getApp().on("mqtt", "mqtt_head", function(e) {
|
2024-12-19 22:23:23 +08:00
|
|
|
|
if (e.type == "state") {
|
2025-01-03 13:09:20 +08:00
|
|
|
|
this.mqttConnected = e.connected;
|
2024-12-19 22:23:23 +08:00
|
|
|
|
} else if (e.type == "msg") {
|
|
|
|
|
this.itemProperty = e.data;
|
|
|
|
|
}
|
|
|
|
|
});
|
2024-12-19 18:12:16 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2025-01-07 10:02:41 +08:00
|
|
|
|
onUnload() {
|
|
|
|
|
getApp().off("mqtt", "mqtt_head")
|
|
|
|
|
},
|
2024-12-19 18:12:16 +08:00
|
|
|
|
methods: {
|
2024-12-19 22:23:23 +08:00
|
|
|
|
mqttSubscribes(topics) {
|
|
|
|
|
getApp().mqttSubscribes(topics);
|
|
|
|
|
},
|
|
|
|
|
mqttUnSubscribes(topics) {
|
|
|
|
|
getApp().mqttUnsubscribes(topics);
|
|
|
|
|
},
|
2024-12-19 18:12:16 +08:00
|
|
|
|
queryList(str) {
|
|
|
|
|
if (str == "into") {
|
|
|
|
|
this.query.pageNum = 1;
|
|
|
|
|
}
|
|
|
|
|
if (str == "pre") {
|
|
|
|
|
this.query.pageNum = this.query.pageNum - 1
|
|
|
|
|
}
|
|
|
|
|
if (str == "next") {
|
|
|
|
|
this.query.pageNum = this.query.query.pageNum + 1
|
|
|
|
|
}
|
|
|
|
|
getOutDeviceHistoryList(this.query).then(res => {
|
|
|
|
|
this.listData = res.rows;
|
|
|
|
|
this.total = res.total;
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
//打开历史界面
|
|
|
|
|
openH(item) {
|
|
|
|
|
this.showDeviceLog = true
|
|
|
|
|
this.queryList("into");
|
|
|
|
|
},
|
|
|
|
|
reload() {
|
|
|
|
|
uni.$emit("reloadlogs")
|
|
|
|
|
},
|
|
|
|
|
//关闭历史记录
|
|
|
|
|
closeLog() {
|
|
|
|
|
this.showDeviceLog = false;
|
|
|
|
|
},
|
|
|
|
|
//控制按钮
|
|
|
|
|
controlHeadSwitch(item, e, k) {
|
|
|
|
|
if (this.itemProperty.s === "offline") {
|
|
|
|
|
plugin.modal.msgError("设备离线,不能操作!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (k === "pg" && this.itemProperty.m === "1") {
|
|
|
|
|
plugin.modal.msgError("自动模式不能拍照!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (k === "pg" && this.itemProperty.ias === "0") {
|
|
|
|
|
plugin.modal.msgError("请先打开光源!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
let par = {
|
|
|
|
|
controlKey: k,
|
|
|
|
|
deviceTypeId: 8,
|
|
|
|
|
operationType: 11,
|
|
|
|
|
deviceCode: item.deviceCode,
|
|
|
|
|
controlValve: e == 1 ? 0 : 1
|
|
|
|
|
};
|
|
|
|
|
controlHeadSwitch(par).then(res => {})
|
|
|
|
|
},
|
|
|
|
|
//打开分析弹出页
|
|
|
|
|
analysis(item, e) {
|
|
|
|
|
if (!e) {
|
|
|
|
|
plugin.modal.msgError("没有可以分析的数据!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.showAnalysis = true;
|
|
|
|
|
},
|
|
|
|
|
//关闭分析弹出页
|
|
|
|
|
closeLogAnalysis() {
|
|
|
|
|
this.showAnalysis = false;
|
|
|
|
|
},
|
|
|
|
|
pageTurning(flag) {
|
|
|
|
|
if (flag === 0) {
|
|
|
|
|
if (this.query.pageNum - 1 === 0) return
|
|
|
|
|
this.queryList("pre")
|
|
|
|
|
}
|
|
|
|
|
if (flag === 1) {
|
|
|
|
|
if (this.query.pageNum + 1 > Math.ceil(this.total / this.query.pageSize)) return
|
|
|
|
|
this.queryList("next")
|
2024-12-19 12:41:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-12-19 18:12:16 +08:00
|
|
|
|
}
|
2024-12-19 12:41:30 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
2025-01-17 14:24:40 +08:00
|
|
|
|
.header-section {
|
|
|
|
|
width: 100%;
|
|
|
|
|
padding: 10px 0px 30px 0px;
|
|
|
|
|
background-color: #39ac4f;
|
|
|
|
|
border-radius: 0 0 30px 30px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.content-section {
|
|
|
|
|
position: relative;
|
|
|
|
|
top: -35px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.cards-title {
|
|
|
|
|
border: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.txt-list .left uni-text:first-child {
|
|
|
|
|
width: 60px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.txt-list .left>view {
|
|
|
|
|
color: #000;
|
|
|
|
|
line-height: 2;
|
|
|
|
|
}
|
|
|
|
|
.rowheadstyle {width: 80%; margin: 0 auto;
|
|
|
|
|
height: 40px;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-19 18:12:16 +08:00
|
|
|
|
|
2024-12-19 12:41:30 +08:00
|
|
|
|
// 弹窗
|
|
|
|
|
.dialog-container {
|
|
|
|
|
width: 90vw;
|
|
|
|
|
height: 90vh;
|
|
|
|
|
overflow: hidden;
|
2024-12-19 18:12:16 +08:00
|
|
|
|
|
2024-12-19 12:41:30 +08:00
|
|
|
|
.dialog-title {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 34px;
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
line-height: 34px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
border-bottom: 1px solid #999;
|
|
|
|
|
position: relative;
|
2024-12-19 18:12:16 +08:00
|
|
|
|
|
2024-12-19 12:41:30 +08:00
|
|
|
|
.reload-btn {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 50%;
|
|
|
|
|
right: 56px;
|
|
|
|
|
transform: translateY(-50%);
|
|
|
|
|
}
|
2024-12-19 18:12:16 +08:00
|
|
|
|
|
2024-12-19 12:41:30 +08:00
|
|
|
|
.close-btn {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 50%;
|
|
|
|
|
right: 10px;
|
|
|
|
|
transform: translateY(-50%);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-12-19 18:12:16 +08:00
|
|
|
|
|
2024-12-19 12:41:30 +08:00
|
|
|
|
.dialog-body {
|
|
|
|
|
height: calc(100% - 35px);
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
position: relative;
|
|
|
|
|
background-color: #f7f7f7;
|
2024-12-19 18:12:16 +08:00
|
|
|
|
|
2024-12-19 12:41:30 +08:00
|
|
|
|
//扫码的弹窗
|
|
|
|
|
.scancode-device-info {
|
|
|
|
|
height: 100%;
|
|
|
|
|
padding: 0 20px;
|
|
|
|
|
overflow-x: hidden;
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
justify-content: space-evenly;
|
2024-12-19 18:12:16 +08:00
|
|
|
|
|
|
|
|
|
&>view {
|
2024-12-19 12:41:30 +08:00
|
|
|
|
width: 100%;
|
|
|
|
|
line-height: 40px;
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
color: gray;
|
2024-12-19 18:12:16 +08:00
|
|
|
|
|
2024-12-19 12:41:30 +08:00
|
|
|
|
.label {
|
|
|
|
|
display: inline-block;
|
|
|
|
|
width: 30%;
|
|
|
|
|
color: black;
|
|
|
|
|
margin-right: 2px;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-12-19 18:12:16 +08:00
|
|
|
|
|
2024-12-19 12:41:30 +08:00
|
|
|
|
.control-panel {
|
|
|
|
|
height: 100px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
flex-wrap: nowrap;
|
|
|
|
|
justify-content: space-evenly;
|
2024-12-19 18:12:16 +08:00
|
|
|
|
|
|
|
|
|
&>view {
|
2024-12-19 12:41:30 +08:00
|
|
|
|
padding: 6px 10px;
|
|
|
|
|
color: #007acc;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
border: 1px solid #ccc;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|