jsy-app/pages/head/index.vue

170 lines
4.6 KiB
Vue
Raw Normal View History

2024-12-18 16:26:40 +08:00
<template>
2025-02-13 16:09:37 +08:00
<z-paging ref="paging" use-virtual-list @query="queryList" bg-color="#F3F3F3" :loading-more-enabled="false"
empty-view-text="抱歉,暂时还没有相关数据!">
2025-01-14 17:59:17 +08:00
<template #top>
2025-02-13 15:10:05 +08:00
<custom-nav-bar :left="false" leftText="" @leftClick="" :title="landName||'首部'">
2025-01-14 17:59:17 +08:00
</custom-nav-bar>
</template>
2025-02-13 15:10:05 +08:00
<!-- <view class="text-intel" v-if="landName">
2025-01-14 17:59:17 +08:00
<view class="iconfont icon-ditu">
2025-01-13 18:30:46 +08:00
</view>
2025-01-14 17:59:17 +08:00
<view>
<span>{{landName}}</span>
</view>
2025-02-13 15:10:05 +08:00
</view> -->
2025-01-14 17:59:17 +08:00
<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>
2024-12-18 16:26:40 +08:00
<view>
2025-01-14 17:59:17 +08:00
{{item.deviceCode}}
2024-12-18 16:26:40 +08:00
</view>
2025-01-13 18:30:46 +08:00
</view>
2025-01-14 17:59:17 +08:00
</view>
<view class="content">
<view class="cards-content">
<view class="txt-list">
2025-01-16 17:22:27 +08:00
<view class="list2">
2025-01-14 17:59:17 +08:00
<view><text>状态</text><text
:class="item.status=='offline'?'font-red':''">{{item.status=="online"?"在线":"离线"}}</text>
2025-01-13 18:30:46 +08:00
</view>
2025-02-13 16:09:37 +08:00
<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>
2025-01-13 18:30:46 +08:00
</view>
2025-01-14 17:59:17 +08:00
</view>
<view class="right">
<view class="iconfont icon-you">
2024-12-18 16:26:40 +08:00
</view>
</view>
</view>
</view>
</view>
2025-01-14 17:59:17 +08:00
</view>
</template>
</z-paging>
<!-- 地块选择 -->
<custom-select-land ref="landRef" :data="ijs.companys" :defaultSelect="ijs.land" @getLand="getLand"
@select="landChange" />
2024-12-18 16:26:40 +08:00
</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,
2025-01-14 17:59:17 +08:00
landName: null,
2024-12-18 16:26:40 +08:00
query: {
landId: null,
landName: null
},
2025-02-13 15:10:05 +08:00
permission: {
list: false,
}
2024-12-18 16:26:40 +08:00
}
},
2025-01-14 17:59:17 +08:00
onShow() {
if (this.ijs.land) {
2025-01-14 10:40:02 +08:00
this.landName = this.ijs.land.landName;
2024-12-19 18:12:16 +08:00
this.query.landId = this.ijs.land.id;
this.queryList();
2025-02-13 16:09:37 +08:00
} else {
2025-02-13 12:33:26 +08:00
this.query.landId = -1;
this.queryList();
2024-12-19 18:12:16 +08:00
}
2024-12-18 16:26:40 +08:00
},
methods: {
queryList() {
2025-02-13 15:10:05 +08:00
if (!checkPermi(["iot:head:list"])) {
this.$refs.paging.complete([])
return;
}
2024-12-18 16:26:40 +08:00
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;
2024-12-25 17:54:00 +08:00
this.query.landId = e.id;
this.queryList();
2024-12-18 16:26:40 +08:00
},
2025-01-14 17:59:17 +08:00
onClickItem(item) {
2024-12-18 16:26:40 +08:00
if (item.deviceTypeId === 4) {
2025-01-14 17:59:17 +08:00
if (item.controlMode == 1) {
plugin.tab.navigateTo("/pages/head/fertilizerapplicator/detail?item=" + encodeURIComponent(JSON
.stringify(
item)))
2024-12-18 16:26:40 +08:00
}
2025-01-14 17:59:17 +08:00
if (item.controlMode == 2) {
plugin.tab.navigateTo("/pages/head/fertilizerapplicator/detailkl?item=" + encodeURIComponent(JSON
.stringify(
item)))
2024-12-18 16:26:40 +08:00
}
}
if (item.deviceTypeId === 5) {
plugin.tab.navigateTo("/pages/head/headdevice/detail?item=" + encodeURIComponent(JSON.stringify(item)))
}
}
}
}
</script>
2025-01-13 18:30:46 +08:00
<style lang="scss" scoped>
2025-01-16 12:41:23 +08:00
// 顶部nav
::v-deep.uni-navbar__header-container {
align-items: center;
justify-content: center;
2025-02-13 16:09:37 +08:00
2025-01-16 12:41:23 +08:00
&>view {
font-size: 36rpx;
}
}
2025-02-13 16:09:37 +08:00
2025-01-16 12:41:23 +08:00
::v-deep.uni-navbar__header-btns-left {
font-size: 27rpx;
}
2025-02-13 16:09:37 +08:00
2025-01-16 12:41:23 +08:00
::v-deep.uni-navbar__header-btns-right .icon {
font-size: 44rpx;
margin-left: 10px;
}
2024-12-18 16:26:40 +08:00
</style>