jsy-app/pages/dev-ops/device.vue
2025-02-22 19:36:28 +08:00

889 lines
29 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<z-paging ref="paging" @query="queryList" v-model="dataList" :auto-show-system-loading="true"
empty-view-text="抱歉,暂时还没有相关数据!">
<template #top>
<custom-nav-bar :left="true" title="设备运维"></custom-nav-bar>
<!-- <view class="search">
<uni-forms ref="form" labelWidth="0px">
<uni-forms-item label="" name="">
<custom-land-tree :defaultLand="land" @change="handleTreeChange"
style="width: 100%;float: left;margin-right: 2px;"></custom-land-tree>
</uni-forms-item>
</uni-forms>
</view> -->
</template>
<view class="card">
<uni-collapse v-if="dataList.length">
<!-- 基站 -->
<uni-collapse-item title-border="none" :border="false" v-if="dataList[0]">
<template v-slot:title>
<view class="cards-title">
<view>
<view class="text">基站</view>
</view>
</view>
</template>
<view class="content">
<view class="cards-content" v-for="item in dataList[0]">
<view class="card card-grey">
<view class="cards-title">
<view>
<view>{{ item.deviceCode}}</view>
<uni-tag class="bg-green" :circle="true" text="在线"
v-if="dc.dataObj[item.deviceCode]?.online" />
<uni-tag class="bg-red" :circle="true" text="离线" v-else />
</view>
<view class="right">
<u-button type="success" size="mini" text="刷新"
:loading="dc.dataObj[item.deviceCode]?.refresh"
@click="dc.refreshDeviceItem(item.deviceCode, item)" />
</view>
</view>
<view class="cards-content">
<view class="txt-list">
<view class="list2">
<view style="width: 70%;">
<text>软/硬件版本:</text>
{{ dataObj[item.deviceCode]?.sv || item.softVer}}
/
{{ dataObj[item.deviceCode]?.dv || item.deviceVersion}}
</view>
<view style="width: 30%;">
<text>频段:</text>{{ dataObj[item.deviceCode]?.lf || item.rolaFrequency}}
</view>
</view>
</view>
<view class="btn-grid">
<!-- <u-button type="primary" size="normal" text="更换基站" @click="changeStation(item)"
disabled /> -->
<u-button type="primary" size="normal" text="下发列表"
v-hasPermi="['iot:dev-ops:gvl']" @click="sendTopoList(item)" />
<u-button type="primary" size="normal" text="修改频段"
v-hasPermi="['iot:dev-ops:slf']" @click="SLF(item)" />
<u-button type="primary" size="normal" text="获取配置"
v-hasPermi="['iot:dev-ops:gsc']" @click="getStationConfig(item)" />
<!-- <u-button type="primary" size="normal" text="压力校准"
@click="pressureCalibrationTopo(item)" disabled /> -->
<u-button type="primary" size="normal" text="重启"
@click="restartStation(item)" />
<u-button type="primary" v-hasPermi="['iot:dev-ops:valve']"
@click="topoDevice(item)">
子设备<u-badge type="success" max="999" :value="item.topoCount" />
</u-button>
<u-button type="primary" size="normal" text="基站升级"
v-hasPermi="['iot:dev-ops:upgradeStation']" @click="upgradeStation(item)" />
<!-- <u-button type="primary" size="normal" text="阀门升级"
@click="upgradeTopoValve(item)" disabled /> -->
</view>
</view>
</view>
</view>
</view>
</uni-collapse-item>
<!-- 蝶阀 -->
<uni-collapse-item title-border="none" :border="false" v-if="dataList[1]">
<template v-slot:title>
<view class="cards-title">
<view>
<view class="text">蝶阀</view>
</view>
</view>
</template>
<view class="content"></view>
</uni-collapse-item>
<!-- 4G阀门 -->
<uni-collapse-item title-border="none" :border="false" v-if="dataList[2]">
<template v-slot:title>
<view class="cards-title">
<view>
<view class="text">4G阀门</view>
</view>
</view>
</template>
<view class="content">
<view class="cards-content" v-for="item in dataList[2]">
<view class="card card-grey">
<view class="cards-title">
<view>
<view>{{ item.device.deviceCode}}</view>
<uni-tag class="bg-green" :circle="true" text="在线"
v-if="dc.dataObj[item.device.deviceCode]?.online" />
<uni-tag class="bg-red" :circle="true" text="离线" v-else />
</view>
<view class="right">
<u-button type="success" size="mini" text="刷新"
:loading="dc.dataObj[item.device.deviceCode]?.refresh"
@click="dc.refreshDeviceItem(item.device.deviceCode, item)" />
</view>
</view>
<view class="cards-content">
<view class="txt-list">
<view class="list2">
<view style="width: 60%;">
<text>软/硬件版本:</text>
{{ dataObj[item.device.deviceCode]?.sv || item.device.softVer}}
/
{{ dataObj[item.device.deviceCode]?.dv || item.device.deviceVersion}}
</view>
<view style="width: 40%;">
<text>信号强度:</text>{{ dc.dataObj[item.device.deviceCode]?.comm.rssi || '-' }}
</view>
<view style="width: 60%;">
<text>电量:</text>{{ dc.dataObj[item.device.deviceCode]?.adc.b || '-' }}%
</view>
<view style="width: 40%;">
<text>压力:</text>{{ dc.dataObj[item.device.deviceCode]?.adc.p || '-' }}
</view>
</view>
</view>
<view class="btn-grid">
<!-- <u-button type="primary" size="normal" text="获取配置"
@click="getValve4Config(item.device)" disabled /> -->
<u-button type="primary" size="normal" text="重启"
@click="restartValve4(item.device)" />
<u-button type="primary" size="normal" text="升级"
v-if="item.device.newDeviceVersionId"
v-hasPermi="['iot:dev-ops:upgradeValve4G']"
@click="upgradeValve4(item.device)" />
<!-- <u-button type="primary" size="normal" text="压力校准"
@click="pressureCalibrationValve4(item.device)" disabled />
<u-button type="primary" size="normal" text="压力查询"
@click="pressureSelect(item.device)" disabled /> -->
</view>
</view>
</view>
</view>
</view>
</uni-collapse-item>
<!-- 墒情 -->
<uni-collapse-item title-border="none" :border="false" v-if="dataList[3]">
<template v-slot:title>
<view class="cards-title">
<view>
<view class="text">墒情</view>
</view>
</view>
</template>
<view class="content">
<view class="cards-content" v-for="item in dataList[3]">
<view class="card card-grey">
<view class="cards-title">
<view>
<view>{{ item.name }}</view>
</view>
<view class="right">
<u-button type="success" size="mini" text="刷新"
:loading="dc.dataObj[item.deviceCode]?.refresh"
@click="dc.refreshDeviceItem(item.deviceCode, item)" />
</view>
</view>
<view class="cards-content">
<view class="txt-list">
<view class="list2">
<view style="width: 100%">
<text>版本:</text>1.4.6
</view>
<view style="width: 100px;">
<text>层数:</text>{{ item.floors }}
</view>
<view style="width: calc(100% - 100px);">
<text>深度:</text>{{ item.depth }}
</view>
</view>
</view>
<view class="btn-grid">
<u-button type="primary" size="normal" text="墒情配置"
v-hasPermi="['iot:deviceMp:add','iot:deviceMp:remove']"
@click="editMp(item)" />
<u-button type="primary" size="normal" text="升级" @click="upgrade" />
</view>
</view>
</view>
</view>
</view>
</uni-collapse-item>
<!-- 施肥机 -->
<uni-collapse-item title-border="none" :border="false" v-if="dataList[4]">
<template v-slot:title>
<view class="cards-title">
<view>
<view class="text">施肥机</view>
</view>
</view>
</template>
<view class="content">
<view class="cards-content" v-for="item in dataList[4]">
<view class="card card-grey">
<view class="cards-title">
<view>
<view>{{ item.deviceCode }}</view>
<uni-tag class="bg-green" :circle="true" text="在线"
v-if="item.status == 'online'" />
<uni-tag class="bg-red" :circle="true" text="离线" v-else />
</view>
<view class="right">
<!-- <u-button type="success" size="mini" text="刷新"
:loading="dc.dataObj[item.deviceCode]?.refresh"
@click="dc.refreshDeviceItem(item.deviceCode, item)" /> -->
</view>
</view>
<view class="cards-content">
<view class="txt-list">
<view class="list2">
<view style="width: 100%;">
<text>版本:</text>2.6.6
</view>
</view>
</view>
<view class="btn-grid">
<u-button type="primary" size="normal" text="施肥机配置" />
<u-button type="primary" size="normal" text="升级" @click="upgrade" />
</view>
</view>
</view>
</view>
</view>
</uni-collapse-item>
<!-- 气象站 -->
<uni-collapse-item title-border="none" :border="false" v-if="dataList[5]">
<template v-slot:title>
<view class="cards-title">
<view>
<view class="text">气象站</view>
</view>
</view>
</template>
<view class="content">
<view class="cards-content" v-for="item in dataList[5]">
<view class="card card-grey">
<view class="cards-title">
<view>
<view>{{ item.deviceCode }}</view>
<uni-tag class="bg-green" :circle="true" text="在线"
v-if="item.data && item.data.items.s.value == 'online'" />
<uni-tag class="bg-red" :circle="true" text="离线" v-else />
</view>
<view class="right">
<!-- <u-button type="success" size="mini" text="刷新"
:loading="dc.dataObj[item.deviceCode]?.refresh"
@click="dc.refreshDeviceItem(item.deviceCode, item)" /> -->
</view>
</view>
<view class="cards-content">
<view class="txt-list">
<view class="list2" v-if="item.data && item.data.items">
<view style="width: 100%;">
<text>版本:</text>1.2.9
</view>
<view style="width: 50%;">
<text>风力:</text>{{ item.data.items.wc.value || "-" }}级
</view>
<view style="width: 50%;">
<text>风速:</text>{{ item.data.items.ws.value || "-" }}m/s
</view>
<view style="width: 50%;">
<text>风向:</text>{{ item.data.items.wd.value || "-" }}
</view>
<view style="width: 50%;">
<text>大气压:</text>{{ item.data.items.p.value || "-" }}MPa
</view>
<view style="width: 50%;">
<text>空气温度:</text>{{ item.data.items.t.value || "-" }}℃
</view>
<view style="width: 50%;">
<text>空气湿度:</text>{{ item.data.items.h.value || "-" }}%
</view>
<view style="width: 50%;">
<text>光照:</text>{{ item.data.items.liy.value || "-" }}Lux
</view>
<view style="width: 50%;">
<text>当前雨量:</text>{{ item.data.items.rt.value || "-" }}mm
</view>
<view style="width: 50%;">
<text>瞬时雨量:</text>{{ item.data.items.ri.value || "-" }}mm
</view>
<view style="width: 50%;">
<text>累计雨量:</text>{{ item.data.items.r.value || "-" }}mm
</view>
</view>
</view>
<view class="btn-grid">
<u-button type="primary" size="normal" text="采集频率"
@click="qxzSetConfig(item)" />
<u-button type="primary" size="normal" text="升级" @click="upgrade" />
</view>
</view>
</view>
</view>
</view>
</uni-collapse-item>
<!-- 虫情 -->
<uni-collapse-item title-border="none" :border="false" v-if="dataList[6]">
<template v-slot:title>
<view class="cards-title">
<view>
<view class="text">虫情</view>
</view>
</view>
</template>
<view class="content">
<view class="cards-content" v-for="item in dataList[6]">
<view class="card card-grey">
<view class="cards-title">
<view>
<view>{{ item.deviceCode }}</view>
<uni-tag class="bg-green" :circle="true" text="在线"
v-if="item.status == 'online'" />
<uni-tag class="bg-red" :circle="true" text="离线" v-else />
</view>
<view class="right">
<view v-if="item.data && item.data.items">
<text>运行模式:</text>
{{ item.data.items.m.value == "1" ? "自动" : "手动" }}
</view>
</view>
</view>
<view class="cards-content">
<view class="txt-list" v-if="item.data && item.data.items">
<view class="list2">
<view style="width: 100%;">
<text>版本:</text>1.2.7
</view>
<view style="width: 50%;">
<text>降雨:</text>
{{ item.data.items.rs ? (item.data.items.rs.value == "0" ? "无雨" : "降雨"): "-" }}
</view>
<view style="width: 50%;">
<text>光照度:</text>
{{ item.data.items.il ? (item.data.items.il.value || "-"): "-" }}Lux
</view>
</view>
</view>
<view class="txt-list">
<view class="list2" v-if="item.data && item.data.items">
<view style="width: 50%;">
<text>诱虫灯:</text>{{ item.data.items.aw.value === '1' ? '打开' : '关闭' }}
</view>
<view style="width: 50%;">
<text>震动装置:</text>{{ item.data.items.sk.value === '1' ? '打开' : '关闭' }}
</view>
<view style="width: 50%;">
<text>虫雨挡板:</text>{{ item.data.items.rf.value === '1' ? '打开' : '关闭' }}
</view>
<view style="width: 50%;">
<text>补光灯:</text>{{ item.data.items.fl.value === '1' ? '打开' : '关闭' }}
</view>
<view style="width: 50%;">
<text>杀虫挡板:</text>{{ item.data.items.wf.value === '1' ? '打开' : '关闭' }}
</view>
<view style="width: 50%;">
<text>杀虫控制:</text>{{ item.data.items.itc.value === '1' ? '打开' : '关闭' }}
</view>
<view style="width: 50%;">
<text>烘干挡板:</text>{{ item.data.items.df.value === '1' ? '打开' : '关闭' }}
</view>
<view style="width: 50%;">
<text>烘干控制:</text>{{ item.data.items.d.value === '1' ? '打开' : '关闭' }}
</view>
<view style="width: 50%;">
<text>移虫装置:</text>{{ item.data.items.mw.value === '1' ? '打开' : '关闭' }}
</view>
</view>
</view>
<view class="btn-grid">
<u-button type="primary" size="normal" text="运行模式" @click="cqRunModel(item)" />
<u-button type="primary" size="normal" text="升级" @click="upgrade" />
</view>
</view>
</view>
</view>
</view>
</uni-collapse-item>
<!-- 农事活动采集仪 -->
<uni-collapse-item title-border="none" :border="false" v-if="dataList[7]">
<template v-slot:title>
<view class="cards-title">
<view>
<view class="text">农事活动采集仪</view>
</view>
</view>
</template>
<view class="content">
<view class="cards-content" v-for="item in dataList[7]">
<view class="card card-grey">
<view class="cards-title">
<view>
<view>{{ item.deviceCode }}</view>
<uni-tag class="bg-green" :circle="true" text="在线"
v-if="item.status == 'online'" />
<uni-tag class="bg-red" :circle="true" text="离线" v-else />
</view>
<view class="right">
<!-- <u-button type="success" size="mini" text="刷新"
:loading="dc.dataObj[item.deviceCode]?.refresh"
@click="dc.refreshDeviceItem(item.deviceCode, item)" /> -->
</view>
</view>
<view class="cards-content">
<view class="txt-list">
<view class="list2">
<!-- <view style="width: 50%;">
<text>层数:</text>{{ item.floors }}
</view>
<view style="width: 50%;">
<text>深度:</text>{{ item.depth }}
</view> -->
</view>
</view>
<view class="btn-grid">
<u-button type="primary" size="normal" text="定时抓拍" />
<u-button type="primary" size="normal" text="定时录像" />
</view>
</view>
</view>
</view>
</view>
</uni-collapse-item>
<!-- 多光谱苗情监测仪 -->
<uni-collapse-item title-border="none" :border="false" v-if="dataList[8]">
<template v-slot:title>
<view class="cards-title">
<view>
<view class="text">多光谱苗情监测仪</view>
</view>
</view>
</template>
<view class="content">
<view class="cards-content" v-for="item in dataList[8]">
<view class="card card-grey">
<view class="cards-title">
<view>
<view>{{ item.deviceCode }}</view>
<uni-tag class="bg-green" :circle="true" text="在线"
v-if="item.status == 'online'" />
<uni-tag class="bg-red" :circle="true" text="离线" v-else />
</view>
<view class="right">
<!-- <u-button type="success" size="mini" text="刷新"
:loading="dc.dataObj[item.deviceCode]?.refresh"
@click="dc.refreshDeviceItem(item.deviceCode, item)" /> -->
</view>
</view>
<view class="cards-content">
<view class="txt-list">
<view class="list2">
<!-- <view style="width: 50%;">
<text>层数:</text>{{ item.floors }}
</view>
<view style="width: 50%;">
<text>深度:</text>{{ item.depth }}
</view> -->
</view>
</view>
<view class="btn-grid">
<u-button type="primary" size="normal" text="定时抓拍" />
<u-button type="primary" size="normal" text="定时录像" />
</view>
</view>
</view>
</view>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
</z-paging>
<!-- 修改基站频段 -->
<custom-popup ref="frequencyRef" :title="rolaFrequency.item?.deviceCode" :footer="true"
@confirm="loraFrequencyHandler">
<view class="jz-info" style="width: 80vw;padding: 10px;">
<uni-forms ref="baseForm" style="padding-top: 10px;">
<uni-forms-item label="原频段" required>
<uni-data-select v-model="rolaFrequency.old" :localdata="rolaFrequency.range" :clear="false" />
</uni-forms-item>
<uni-forms-item label="新频段" required>
<uni-data-select v-model="rolaFrequency.new" :localdata="rolaFrequency.range" :clear="false" />
</uni-forms-item>
</uni-forms>
</view>
</custom-popup>
<!-- 气象站配置 -->
<custom-popup ref="qxzRef" title="气象站配置" :footer="true" @confirm="qxzConfigHandler">
<view class="jz-info" style="width: 80vw;padding: 10px;">
<uni-forms ref="baseForm" style="padding-top: 10px;">
<uni-forms-item label="采集间隔(m)" required label-width="100px">
<uni-number-box v-model="qxz.intervalTime" :width="120" />
</uni-forms-item>
</uni-forms>
</view>
</custom-popup>
</template>
<script>
import plugins from "@/plugins";
import * as DevOpsApi from "@/api/dev-ops/index.js"
import * as deviceConfig from "@/api/dev-ops/deviceConfig.js"
import {
controlHeadSwitch
} from "@/api/controlHeadInterface.js"
export default {
data() {
return {
land: null,
landId: null,
dataList: [],
dc: getApp().dc, // 设备控制公共代码
dataObj: {},
topics: [],
rolaFrequency: {
item: null,
old: null,
new: null,
range: [],
},
qxz: {
item: null,
intervalTime: 10
}
}
},
onLoad(par) {
// 频段
let list = [];
for (let i = 410; i < 491; i++) {
let lfObj = {
value: i,
text: i.toString()
}
list.push(lfObj);
}
this.rolaFrequency.range = list;
this.setQueryParams(getApp().ijs.getLandData);
const that = this;
getApp().on("mqtt", "mqtt_devOps_station", function(e) {
if (e.type == "state") {
// that.mqttConnected = e.connected;
} else if (e.type == "msg") {
if (e.topic.includes("jsy/iot/deviceConfig/1/")) {
const arr = e.topic.split("/");
const deviceCode = arr[4];
let obj = that.dataObj[deviceCode] || {};
if (e.data.type == "gsc") {
obj = Object.assign(obj, {
dv: e.data.data.dv,
sv: e.data.data.sv,
lf: e.data.data.lf,
})
}
if (e.data.type == "lf") {
obj = Object.assign(obj, {
lf: e.data.data,
})
}
that.dataObj[deviceCode] = obj;
}
}
});
// 监听刷新数据
uni.$off("reload-type");
uni.$on("reload-type", (e) => {
plugins.modal.loading()
DevOpsApi.getList(that.landId).then(res => {
plugins.modal.closeLoading()
console.error("res:", res);
if (e == "mp") {
that.dataList[3] = res.data[e];
}
});
});
},
mounted() {},
onUnload() {
getApp().mqttUnsubscribes(this.topics);
getApp().off("mqtt", "mqtt_devOps_station")
},
methods: {
// 设置地块
setQueryParams(e) {
if (e) {
this.land = e || null;
this.landId = e.id;
} else {
this.land = null;
this.landId = -1;
}
},
// 地块选择
handleTreeChange(e) {
this.setQueryParams(e);
this.$refs.paging.reload();
},
queryList(pageNo, pageSize) {
DevOpsApi.getList(this.landId).then(res => {
// console.error("res:", res);
let data = [];
data.push(res.data.station || []);
data.push(res.data.butterflyValve || []);
if (res.data.valve) {
let valve = [];
res.data.valve.forEach(item => {
if (item.device.deviceTypeId == 3) {
valve.push(item)
}
})
data.push(valve || []);
} else {
data.push([]);
}
data.push(res.data.mp || []);
data.push(res.data.other4 || []);
data.push(res.data.other6 || []);
data.push(res.data.other7 || []);
data.push(res.data.other9 || []);
data.push(res.data.other15 || []);
let hasData = false;
for (var i = 0; i < data.length; i++) {
if (data[i].length) {
hasData = true;
}
}
if (!hasData) {
data = [];
}
this.$refs.paging.completeByTotal(data);
let topicRow = [];
topicRow = topicRow.concat(res.data.station || []);
topicRow = topicRow.concat(res.data.butterflyValve || []);
topicRow = topicRow.concat(res.data.valve || []);
this.mqttSubscribes(topicRow);
});
},
mqttSubscribes(rows) {
if (rows && rows.length) {
let topics = [];
let topic = "jsy/iot/deviceConfig";
rows.forEach((x, index) => {
let item = x?.device || x;
topics.push(`${topic}/${item.deviceTypeId}/${item.deviceCode}`);
});
this.topics = topics;
getApp().mqttSubscribes(this.topics);
}
},
/************************************************** 基站 **************************************************/
// 更换基站
changeStation(item) {
console.error("更换基站:", item);
},
// 下发列表
sendTopoList(item) {
plugins.modal.confirm(`下发列表`).then(() => {
DevOpsApi.gvl(item.deviceCode).then(res => {
plugins.modal.msg(res.msg)
})
}).catch(() => {});
},
// 修改频段
SLF(item) {
this.$refs.frequencyRef.show();
this.rolaFrequency.item = item;
this.rolaFrequency.old = item.rolaFrequency;
this.rolaFrequency.new = item.rolaFrequency;
},
// 获取配置
getStationConfig(item) {
plugins.modal.confirm(`获取配置`).then(() => {
DevOpsApi.gsc(item.deviceCode).then(res => {
plugins.modal.msg(res.msg)
})
}).catch(() => {});
},
// 压力校准
pressureCalibrationTopo(item) {
console.error("压力校准:", item);
},
// 重启
restartStation(item) {
plugins.modal.confirm(`重启"${item.deviceCode}"`).then(() => {
DevOpsApi.resetStationDevice(item.deviceCode).then(res => {
plugins.modal.msg(res.msg)
})
}).catch(() => {});
},
// 子设备
topoDevice(item) {
uni.navigateTo({
url: '/pages/dev-ops/valve?station=' + JSON.stringify(item)
});
},
// 升级
upgradeStation(item) {
plugins.modal.confirm(`升级"${item.deviceCode}"到"${item.newVersionName}"版本?`).then(() => {
DevOpsApi.upgradeStation(item.deviceCode, item.newDeviceVersionId).then(res => {
plugins.modal.msg(res.msg)
})
}).catch(() => {});
},
// 设备升级
upgradeTopoValve(item) {
console.error("设备升级:", item);
},
/************************************************** 基站接口 **************************************************/
loraFrequencyHandler(e) {
if (!e) {
return;
}
// if (this.rolaFrequency.item.rolaFrequency == this.rolaFrequency.rolaFrequency) {
// plugins.modal.msg("新旧频段不能相同!")
// return;
// }
let msg = `您确定要修改【${this.rolaFrequency.item.deviceCode }】的频段为【${this.rolaFrequency.new}】?`;
plugins.modal.confirm(msg).then(() => {
DevOpsApi.slf({
deviceCode: this.rolaFrequency.item.deviceCode,
oldFrequency: this.rolaFrequency.old,
newFrequency: this.rolaFrequency.new
}).then(res => {
plugins.modal.msg(res.msg)
})
}).catch(() => {
this.pop.rolaFrequency = true;
});
},
/************************************************** 4G阀门 **************************************************/
// 获取配置
getValve4Config(item) {
console.error("获取配置:", item);
},
// 重启
restartValve4(item) {
plugins.modal.confirm(`重启"${item.deviceCode}"`).then(() => {
DevOpsApi.reset4GDevice(item.deviceCode).then(res => {
plugins.modal.msg(res.msg)
})
}).catch(() => {});
},
// 设备升级
upgradeValve4(item) {
plugins.modal.confirm(`升级"${item.deviceCode}"到"${item.newVersionName}"版本?`).then(() => {
DevOpsApi.upgradeValve4G(item.deviceCode, item.newDeviceVersionId).then(res => {
plugins.modal.msg(res.msg)
})
}).catch(() => {});
},
// 压力校准
pressureCalibrationValve4(item) {
console.error("压力校准:", item);
},
// 压力查询
pressureSelect(item) {
console.error("压力查询:", item);
},
/************************************************** 墒情 **************************************************/
editMp(item) {
uni.navigateTo({
url: '/pages/dev-ops/editMp?id=' + item.id
});
},
/************************************************** 气象站 **************************************************/
qxzSetConfig(item) {
this.$refs.qxzRef.show();
deviceConfig.getConfig(item.deviceCode).then(res => {
if (res.data) {
this.qxz = res.data.data;
this.qxz.item = item;
}
});
},
qxzConfigHandler(e) {
if (e) {
const data = {
key: this.qxz.item.deviceCode,
data: {
intervalTime: this.qxz.intervalTime
},
};
deviceConfig.setConfig(data).then(res => {
plugins.modal.msg("配置成功")
});
}
},
/************************************************** 虫情 **************************************************/
cqRunModel(item) {
if (!item.data || !item.data.items.m || item.data.items.m.value == "offline") {
plugins.modal.msg("设备离线,不能操作!")
return;
}
let m = item.data.items.m.value == 1 ? 0 : 1;
plugins.modal.confirm(`切换运行模式为"${(m == 1 ? "自动" : "手动" )}"`).then(() => {
let par = {
controlKey: "m",
deviceTypeId: 7,
operationType: 11,
deviceCode: item.deviceCode,
controlValve: m
};
controlHeadSwitch(par).then(res => {
item.data.items.m.value = m;
})
}).catch(() => {});
},
/************************************************** 公共 **************************************************/
// 升级
upgrade() {
plugins.modal.msg("已经是最新版本,无需升级")
},
// 关闭弹出层
close() {
for (var key in this.pop) {
this.pop[key] = false;
}
},
}
}
</script>
<style lang="scss" scoped>
.search {
background: #fff;
::v-deep.uni-searchbar {
padding: 0px 10px 10px 10px;
}
// 表单
::v-deep.uni-forms-item__label {
display: none !important;
}
.u-checkbox {
margin: 0 !important;
height: 35px;
}
.uni-forms-item.is-direction-left {
margin: 0 !important;
}
}
.card.card-grey {
margin: 10px 0 0;
}
::v-deep .tc-content {
overflow: inherit !important;
}
</style>