添加用户地块

This commit is contained in:
jsy_zjg 2024-11-25 09:23:51 +08:00
parent 554964d268
commit 495b0fcefc
4 changed files with 89 additions and 68 deletions

View File

@ -10,6 +10,16 @@ export function getLandList(data) {
}) })
} }
// 根据用户id查询列表
export function getLandByUserId(data) {
return request({
url: '/system/land/app/getLandByUserId',
method: 'get',
data:data
})
}
//查询地块详情 //查询地块详情
export function getLandInfo(param) { export function getLandInfo(param) {

View File

@ -3,10 +3,10 @@
<z-paging class="paging" ref="paging" use-virtual-list @query="queryList" bg-color="#F6F3F3" :loading-more-enabled="false"> <z-paging class="paging" ref="paging" use-virtual-list @query="queryList" bg-color="#F6F3F3" :loading-more-enabled="false">
<template #top> <template #top>
<view class="title"> <view class="title">
<u--image style="margin-right: 10px" :src="user.avatarURL ? user.avatarURL : avatar" shape="circle" width="50px" height="50px"></u--image> <u--image style="margin-right: 10px" :src="userInfo.avatarURL ? userInfo.avatarURL : avatar" shape="circle" width="50px" height="50px"></u--image>
<text>{{ user.name }}</text> <text>{{ userInfo.name }}</text>
<text>{{ user.roleName }}</text> <text>{{ userInfo.roleName }}</text>
<text>{{ `地块数量:${listSize}` }}</text> <text>{{ `地块数量:${landCount}` }}</text>
</view> </view>
<u-gap height="5" bgColor="#F6F3F3"></u-gap> <u-gap height="5" bgColor="#F6F3F3"></u-gap>
<view class="search"> <view class="search">
@ -39,7 +39,7 @@
</view> </view>
<view class="button" v-hasPermi="['device:control:list']"> <view class="button" v-hasPermi="['device:control:list']">
<view style="flex-grow: 1"></view> <view style="flex-grow: 1"></view>
<u-button style="width: 80px; height: 30px; margin-right: 0px" type="success" text="禁控设备" size="mini" @click="onClickPermission(item.landId, item.userId)"></u-button> <u-button style="width: 80px; height: 30px; margin-right: 0px" type="success" text="禁控设备" size="mini" @click="onClickPermission(item)"></u-button>
</view> </view>
</view> </view>
</template> </template>
@ -47,70 +47,70 @@
</view> </view>
</template> </template>
<script setup> <script >
import { ref } from "vue"
import { onShow, onLoad, onReady } from "@dcloudio/uni-app"
import store from "@/store" import store from "@/store"
import plugin from "@/plugins" import plugin from "@/plugins"
import storage from "@/utils/storage"
import avatar from "../../../static/images/mine/userAvatar.png" import avatar from "../../../static/images/mine/userAvatar.png"
export default {
const userId = ref(0) data() {
const listSize = ref(0) return {
const user = ref({ userInfo:{},
name: "", landCount:0,
avatarURL: "", paging:null,
roleName: "" avatar:null,
}) query:{
const paging = ref(null) userId:null,
const query = ref({ userId: null, landName: null }) landName:null
onLoad(params => {
userId.value = params.id
query.value.userId = params.id
user.value.name = params.name
user.value.avatarURL = params.avatar
user.value.roleName = params.roleName
})
onShow(() => {
if (paging.value != null) {
paging.value.reload()
} }
}) }
},
created() {
this.avatar = avatar;
},
onLoad(options){
this.userInfo = JSON.parse(decodeURIComponent(options.userInfo));
this.queryList();
},
onShow() {
if(this.userInfo){
this.query.userId = this.userInfo.userId;
function queryList() { }
if (query.value.landName == null || query.value.landName == "") { },
delete query.value["landName"] methods: {
queryList() {
if(!this.query.userId){
return;
} }
// //
console.log(this.query)
store store
.dispatch("onGetUserManagerLandList", query.value) .dispatch("getLandByUserId", this.query)
.then(res => { .then(res => {
//z-paging //z-paging
paging.value.complete(res.data) console.log(res)
if (query.value.landName == null || query.value.landName == "") { this.$refs.paging.complete(res.data);
listSize.value = res.data.length if(res.data){
this.landCount=res.data.length;
} }
}) })
.catch(error => { .catch(error => {
paging.value.complete(false) this.$refs.paging.complete(false)
plugin.modal.msgError(error) plugin.modal.msgError(error)
}) })
.finally(() => { .finally(() => {
plugin.modal.closeLoading() plugin.modal.closeLoading()
}) })
} },
// onSearchValue(e) {
function onSearchValue(keyword) { this.query.landName = e;
query.value.landName = keyword this.queryList();
paging.value.reload() },
} onClickPermission(item) {
plugin.tab.navigateTo(`/pages/work/user/device?landId=${item.landId}&userId=${item.userId}`)
// }
function onClickPermission(param) { }
plugin.tab.navigateTo(`/pages/work/user/device?landId=${param.landID}&userId=${param.userID}`) }
}
</script> </script>
<style lang="stylus"> <style lang="stylus">

View File

@ -275,8 +275,7 @@
}) })
}, },
clickMore(item) { clickMore(item) {
console.log(item) plugin.tab.navigateTo(`/pages/work/user/ground?userInfo=${encodeURIComponent(JSON.stringify(item))}`)
plugin.tab.navigateTo(`/pages/work/user/ground?id=${item.userId}&name=${item.userName}&avatar=${item.avatar}&roleName=${item.role.roleName}`)
} }
} }
} }

View File

@ -3,7 +3,8 @@ import {
getLandInfo, getLandInfo,
addLand, addLand,
updateLand, updateLand,
getLandNum getLandNum,
getLandByUserId
} from "@/api/system/land" } from "@/api/system/land"
import {allListUser}from "@/api/system/user" import {allListUser}from "@/api/system/user"
const land = { const land = {
@ -74,6 +75,17 @@ const land = {
reject(error) reject(error)
}) })
}) })
},
getLandByUserId({}, data) {
return new Promise((resolve, reject) => {
getLandByUserId(data)
.then(res => {
resolve(res)
})
.catch(error => {
reject(error)
})
})
} }
} }
} }