修改获取大棚列表信息逻辑

feasure-livedata
lld 2026-04-05 18:19:35 +08:00
parent a47d7d2f00
commit c2a38758b0
6 changed files with 69 additions and 44 deletions

View File

@ -131,7 +131,7 @@ export default {
})
},
getAgriList() {
listAgri().then(response => {
listAgri({status: 1}).then(response => {
if (response.code === 200) {
this.agriList = response.rows.map(item => ({
agriId: item.id,

View File

@ -281,7 +281,8 @@ export default {
})
},
getAgriList() {
listAgri().then(response => {
//
listAgri({status: 1}).then(response => {
if (response.code === 200) {
this.range = response.rows.map(item => ({
agriId: item.id,

View File

@ -1,15 +1,15 @@
<template>
<view class="page-bg">
<!-- 顶部标签切换 -->
<view class="tab-bar">
<view
v-for="tab in tabs"
:key="tab.value"
class="tab-item"
:class="{ active: activeTab === tab.value }"
@click="activeTab = tab.value"
>{{ tab.label }}</view>
</view>
<!-- <view class="tab-bar">-->
<!-- <view-->
<!-- v-for="tab in tabs"-->
<!-- :key="tab.value"-->
<!-- class="tab-item"-->
<!-- :class="{ active: activeTab === tab.value }"-->
<!-- @click="activeTab = tab.value"-->
<!-- >{{ tab.label }}</view>-->
<!-- </view>-->
<!-- 步骤引导条 -->
<view class="steps-bar">
@ -48,26 +48,26 @@
class="device-item"
@click="goToDetail(device)"
>
<image :src="device.img" class="device-img" mode="aspectFit" />
<image :src="agriImg" class="device-img" mode="aspectFit" />
<view class="device-info">
<text class="device-name">{{ device.name }}</text>
<text class="device-name">{{ device.agriName }}</text>
<text class="device-sub">已分享{{ device.sharedCount }}</text>
</view>
<view class="arrow"></view>
</view>
</view>
<!-- 分享给我的列表 -->
<!-- 分享给我的列表 仅显示已接受的-->
<view v-if="activeSubTab === 'tome'">
<view
v-for="device in toMeDevices"
:key="device.id"
class="device-item"
>
<image :src="device.img" class="device-img" mode="aspectFit" />
<image :src="agriImg" class="device-img" mode="aspectFit" />
<view class="device-info">
<text class="device-name">{{ device.name }}</text>
<text class="device-sub">{{ device.channels }}个通道 | {{ device.serial }}</text>
<text class="device-name">{{ device.agriName }}</text>
<!-- <text class="device-sub">{{ device.channels }}个通道 | {{ device.serial }}</text>-->
</view>
<button class="quit-btn" @click="quitShare(device)">退</button>
</view>
@ -83,6 +83,9 @@
</template>
<script>
import {listAgri} from "@/api/system/assets/agri";
import store from "@/store";
export default {
data() {
return {
@ -92,30 +95,27 @@ export default {
{ label: '分享团队', value: 'team' }
],
steps: [
{ icon: '/static/images/share/step_send.png', label: '发起分享' },
{ icon: '/static/images/share/step_add.png', label: '添加分享对象' },
{ icon: '/static/images/share/step_key.png', label: '选择视频和权限' },
{ icon: '/static/images/share/step_mail.png', label: '接受分享' }
{ icon: 'https://img.xiaoces.com/photos/share/share.png', label: '发起分享' },
{ icon: 'https://img.xiaoces.com/photos/share/user2.png', label: '添加分享对象' },
{ icon: 'https://img.xiaoces.com/photos/share/access.png', label: '选择视频和权限' },
{ icon: 'https://img.xiaoces.com/photos/share/share__.png', label: '接受分享' }
],
featureTags: ['功能按需分享', '最多分享10人', '仅视频设备'],
featureTags: ['功能按需分享', '最多分享 5 人', '仅视频设备'],
activeSubTab: 'mine',
subTabs: [
{ label: '我的分享', value: 'mine' },
{ label: '分享给我的', value: 'tome' }
],
// API
mySharedDevices: [
{ id: 1, name: '八方', img: '/static/images/share/camera1.png', sharedCount: 1 },
{ id: 2, name: '十方', img: '/static/images/share/camera2.png', sharedCount: 1 },
{ id: 3, name: 'DS-2DE4423DW-D/GLT/XM(...', img: '/static/images/share/camera1.png', sharedCount: 1 },
{ id: 4, name: 'DS-7804N-Z1/X(D)(FR5725238)', img: '/static/images/share/nvr.png', sharedCount: 5 }
],
mySharedDevices: [],
//
toMeDevices: [
{ id: 5, name: 'DS-7804N-Z1/X(D)(F...', img: '/static/images/share/nvr.png', channels: 3, serial: 'FX3773731' }
]
toMeDevices: [],
agriImg: 'https://img.xiaoces.com/photos/share/agri.png'
}
},
onShow() {
this.getShareAgriList()
},
methods: {
goToDetail(device) {
uni.navigateTo({
@ -135,7 +135,28 @@ export default {
}
}
})
},
getShareAgriList() {
//
listAgri({inviteBy: store.getters.id, status:1}).then(response => {
if (response.code === 200) {
//
var mySharedDevices
= response.rows.filter(item => item.userId === store.getters.id);
//
var sharedDevices
= response.rows.filter(item => item.userId !== store.getters.id);
mySharedDevices.forEach(shareDevice => {
shareDevice.sharedCount = sharedDevices.filter(device => device.imei===shareDevice.imei
&& device.inviteBy === store.getters.id).length
});
this.mySharedDevices = mySharedDevices;
//
this.toMeDevices = mySharedDevices.filter(item => item.inviteBy && item.userId !== item.inviteBy );
}
})
},
}
}
</script>
@ -182,7 +203,7 @@ page {
display: flex;
align-items: center;
justify-content: space-between;
margin: 30rpx 30rpx 0;
margin: 50rpx 30rpx 20rpx;
.step-item {
display: flex;
@ -228,11 +249,12 @@ page {
/* 功能标签 */
.feature-tags {
display: flex;
margin: 20rpx 30rpx;
gap: 16rpx;
justify-content: center;
margin: 40rpx 30rpx;
gap: 20rpx;
.feature-tag {
padding: 8rpx 20rpx;
padding: 8rpx 40rpx;
border-radius: 8rpx;
font-size: 22rpx;
@ -245,8 +267,8 @@ page {
color: #f5a623;
}
&:nth-child(3) {
background: #fff3e0;
color: #f5a623;
background: rgba(253, 60, 60, 0.13);
color: #fd3c3c;
}
}
}

View File

@ -46,11 +46,11 @@
</view>
<view class="func-item" @click="goToAI">
<view class="func-icon">
<image style="width: 40rpx; height: 30rpx; "
src="https://img.xiaoces.com/photos/news/ai1.png"/>
<image style="width: 30rpx; height: 30rpx; "
src="https://img.xiaoces.com/photos/news/interact.png"/>
</view>
<view class="func-title">AI识别</view>
<view class="func-desc">AI识别精准过滤无效报警</view>
<view class="func-title">互动消息</view>
<view class="func-desc">暂无互动消息...</view>
</view>
</view>

View File

@ -163,7 +163,8 @@ export default {
},
getImeiList() {
listAgri().then(response => {
//
listAgri({status: 1}).then(response => {
if (response.code === 200) {
this.range = response.rows.map(item => ({
agriId: item.id,

View File

@ -362,7 +362,8 @@ export function updateSubscribeTopic() {
}
const agriList = [];
// 1. 获取设备列表(纯.then/.catch回调
listAgri().then(response => {
// 获取已启用的设备列表
listAgri({status: 1}).then(response => {
if (response.code === 200) {
// 生成设备订阅主题校验imei非空