jsy-app/pages/head/index.vue
2025-02-13 16:09:37 +08:00

170 lines
4.6 KiB
Vue
Raw 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" use-virtual-list @query="queryList" bg-color="#F3F3F3" :loading-more-enabled="false"
empty-view-text="抱歉暂时还没有相关数据">
<template #top>
<custom-nav-bar :left="false" leftText="" @leftClick="" :title="landName||'首部'">
</custom-nav-bar>
</template>
<!-- <view class="text-intel" v-if="landName">
<view class="iconfont icon-ditu">
</view>
<view>
<span>{{landName}}</span>
</view>
</view> -->
<template #cell="{item}">
<view class="card" @click="onClickItem(item)">
<view class="cards-title">
<view>
<view class="text" v-if="item.deviceTypeId==4">
施肥机编号
</view>
<view class="text" v-if="item.deviceTypeId==5">
首部控制器
</view>
<view>
{{item.deviceCode}}
</view>
</view>
</view>
<view class="content">
<view class="cards-content">
<view class="txt-list">
<view class="list2">
<view><text>状态</text><text
:class="item.status=='offline'?'font-red':''">{{item.status=="online"?"在线":"离线"}}</text>
</view>
<view v-if="item.deviceTypeId==4">
<text>流速</text><text>{{ item.deviceData&& item.deviceData.fs?item.deviceData.fs:"--"}}L/min</text>
</view>
<view v-if="item.deviceTypeId==4">
<text>压力</text><text>{{item.deviceData&&item.deviceData.pr?item.deviceData.pr:"--"}}Mpa</text>
</view>
<view v-if="item.deviceTypeId==4">
<text>循环次数</text><text>{{item.deviceData&&item.deviceData.wct?item.deviceData.wct:"--"}}</text>
</view>
<view v-if="item.deviceTypeId==5">
<text>水流</text><text>{{item.deviceData&&item.deviceData.fs == 1 ? "有" : "无"}}</text>
</view>
<view v-if="item.deviceTypeId==5">
<text>开关</text><text>{{item.deviceData&&item.deviceData.sc=="1"?"启动":"停止"}}</text>
</view>
<view v-if="item.deviceTypeId==5">
<text>压力</text><text>{{item.deviceData&&item.deviceData.wip?item.deviceData.wip:"--"}}Mpa</text>
</view>
</view>
<view class="right">
<view class="iconfont icon-you">
</view>
</view>
</view>
</view>
</view>
</view>
</template>
</z-paging>
<!-- 地块选择 -->
<custom-select-land ref="landRef" :data="ijs.companys" :defaultSelect="ijs.land" @getLand="getLand"
@select="landChange" />
</template>
<script>
import {
checkPermi
} from "@/utils/permission"
import store from "@/store"
import plugin from "@/plugins"
import {
getHeadDeviceList
} from "@/api/controlHeadInterface";
export default {
data() {
return {
ijs: getApp().ijs, // 首页公共js
title: "",
isFirst: true,
user: store.state.user.user,
landName: null,
query: {
landId: null,
landName: null
},
permission: {
list: false,
}
}
},
onShow() {
if (this.ijs.land) {
this.landName = this.ijs.land.landName;
this.query.landId = this.ijs.land.id;
this.queryList();
} else {
this.query.landId = -1;
this.queryList();
}
},
methods: {
queryList() {
if (!checkPermi(["iot:head:list"])) {
this.$refs.paging.complete([])
return;
}
if (this.query.landId) {
getHeadDeviceList(this.query.landId).then(res => {
this.$refs.paging.complete(res.data)
});
}
},
// 获取地块信息
getLand(e) {
this.ijs.getLand(e.node).then(res => {
this.$refs.landRef.addLand(e, res.data);
});
},
// 地块选择回调
landChange(e) {
this.title = e.landName;
this.query.landId = e.id;
this.queryList();
},
onClickItem(item) {
if (item.deviceTypeId === 4) {
if (item.controlMode == 1) {
plugin.tab.navigateTo("/pages/head/fertilizerapplicator/detail?item=" + encodeURIComponent(JSON
.stringify(
item)))
}
if (item.controlMode == 2) {
plugin.tab.navigateTo("/pages/head/fertilizerapplicator/detailkl?item=" + encodeURIComponent(JSON
.stringify(
item)))
}
}
if (item.deviceTypeId === 5) {
plugin.tab.navigateTo("/pages/head/headdevice/detail?item=" + encodeURIComponent(JSON.stringify(item)))
}
}
}
}
</script>
<style lang="scss" scoped>
// 顶部nav
::v-deep.uni-navbar__header-container {
align-items: center;
justify-content: center;
&>view {
font-size: 36rpx;
}
}
::v-deep.uni-navbar__header-btns-left {
font-size: 27rpx;
}
::v-deep.uni-navbar__header-btns-right .icon {
font-size: 44rpx;
margin-left: 10px;
}
</style>