jsy-app/pages/work/user/ground.vue

138 lines
3.9 KiB
Vue
Raw Normal View History

2024-11-22 17:32:06 +08:00
<template>
2025-01-17 18:33:33 +08:00
<!-- 顶部导航栏 -->
<custom-nav-bar :left="true" leftText="" @leftClick="" title="用户地块">
</custom-nav-bar>
2024-11-22 17:32:06 +08:00
<view class="index-container">
2025-01-16 12:41:23 +08:00
<z-paging class="paging" ref="paging" use-virtual-list @query="queryList" bg-color="#F6F3F3"
:loading-more-enabled="false">
2024-11-22 17:32:06 +08:00
<template #top>
2025-01-14 17:59:17 +08:00
<custom-nav-bar :left="true" title="用户地块">
</custom-nav-bar>
2025-01-16 12:41:23 +08:00
<view class="text-intel">
<u--image style="margin-right: 10px" :src="userInfo.avatarURL ? userInfo.avatarURL : avatar"
shape="circle" width="20px" height="20px"></u--image>
2024-11-25 09:23:51 +08:00
<text>{{ userInfo.name }}</text>
<text>{{ userInfo.roleName }}</text>
<text>{{ `地块数量:${landCount}` }}</text>
2024-11-22 17:32:06 +08:00
</view>
<view class="search">
2025-01-16 12:41:23 +08:00
<u-search placeholder="请输入地块名称" @search="onSearchValue" @custom="onSearchValue"
@clear="onSearchValue(null)" shape="square"></u-search>
2024-11-22 17:32:06 +08:00
</view>
</template>
<template #cell="{ item }">
2025-01-16 12:41:23 +08:00
<view class="card">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false" :show-arrow="false">
<template v-slot:title>
<view class="cards-title">
<view>
<view class="text">地块编号{{ item.landNum }}</view>
</view>
<view class="title-r">
<uni-tag class="bg-green" :circle="true" text="启用" v-if="item.status == 0" />
<uni-tag class="bg-green" :circle="true" text="禁用" v-if="item.status == 1" />
</view>
</view>
</template>
<view class="content">
<view class="cards-content">
<view class="txt-list">
<view class="left">
<view><text>地块名称</text>{{ item.landName }}</view>
<view><text>地块地址</text>{{ item.landAddress || "-" }}</view>
</view>
</view>
<view class="card-font">
<u-button type="success" size="mini" text="其它设备权限"
2025-01-17 17:50:47 +08:00
v-hasPermi="['system:permission:list']"
2025-01-16 12:41:23 +08:00
@click="onClickOtherPermission(item)" />
<u-button type="success" size="mini" text="出水口权限"
2025-01-17 17:50:47 +08:00
v-hasPermi="['system:wateroutletpermission:add']"
@click="onClickPermission(item)" />
2025-01-16 12:41:23 +08:00
</view>
</view>
</view>
</uni-collapse-item>
</uni-collapse>
2024-11-22 17:32:06 +08:00
</view>
</template>
</z-paging>
</view>
</template>
2025-01-16 12:41:23 +08:00
<script>
import store from "@/store"
import plugin from "@/plugins"
import avatar from "../../../static/images/mine/userAvatar.png"
export default {
2024-11-25 09:23:51 +08:00
data() {
return {
2025-01-16 12:41:23 +08:00
userInfo: {},
landCount: 0,
paging: null,
avatar: null,
query: {
userId: null,
landName: null
2024-11-25 09:23:51 +08:00
}
2024-11-22 17:32:06 +08:00
}
2024-11-25 09:23:51 +08:00
},
created() {
this.avatar = avatar;
},
2025-01-16 12:41:23 +08:00
onLoad(options) {
2024-11-25 09:23:51 +08:00
this.userInfo = JSON.parse(decodeURIComponent(options.userInfo));
2024-12-19 12:52:31 +08:00
console.log(this.userInfo)
2024-11-25 09:23:51 +08:00
this.queryList();
},
onShow() {
2025-01-16 12:41:23 +08:00
if (this.userInfo) {
2024-11-25 09:23:51 +08:00
this.query.userId = this.userInfo.userId;
}
},
methods: {
queryList() {
2025-01-16 12:41:23 +08:00
if (!this.query.userId) {
2024-11-25 09:23:51 +08:00
return;
}
//获取该用户地块列表
console.log(this.query)
store
.dispatch("getLandByUserId", this.query)
.then(res => {
//将请求的结果数组传递给z-paging
console.log(res)
this.$refs.paging.complete(res.data);
2025-01-16 12:41:23 +08:00
if (res.data) {
this.landCount = res.data.length;
2024-11-25 09:23:51 +08:00
}
})
.catch(error => {
this.$refs.paging.complete(false)
plugin.modal.msgError(error)
})
.finally(() => {
plugin.modal.closeLoading()
})
},
onSearchValue(e) {
this.query.landName = e;
this.queryList();
},
onClickPermission(item) {
2024-11-25 18:21:25 +08:00
plugin.tab.navigateTo(`/pages/work/user/device?landId=${item.id}&userId=${item.userId}`)
2024-12-19 12:41:30 +08:00
},
2025-01-16 12:41:23 +08:00
onClickOtherPermission(item) {
2024-12-19 12:41:30 +08:00
plugin.tab.navigateTo(`/pages/work/user/otherDevice?landId=${item.id}&userId=${item.userId}`)
2024-11-25 09:23:51 +08:00
}
}
}
2024-11-22 17:32:06 +08:00
</script>
2025-01-16 12:41:23 +08:00
<style lang="scss" scoped>
2025-01-17 17:50:47 +08:00
// 表单
2025-01-16 12:41:23 +08:00
.u-search {
2025-01-17 17:50:47 +08:00
padding: 0 10px 10px;
2024-11-22 17:32:06 +08:00
}
2025-01-16 12:41:23 +08:00
</style>