添加用户地块
This commit is contained in:
parent
554964d268
commit
495b0fcefc
@ -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) {
|
||||
|
@ -3,10 +3,10 @@
|
||||
<z-paging class="paging" ref="paging" use-virtual-list @query="queryList" bg-color="#F6F3F3" :loading-more-enabled="false">
|
||||
<template #top>
|
||||
<view class="title">
|
||||
<u--image style="margin-right: 10px" :src="user.avatarURL ? user.avatarURL : avatar" shape="circle" width="50px" height="50px"></u--image>
|
||||
<text>{{ user.name }}</text>
|
||||
<text>{{ user.roleName }}</text>
|
||||
<text>{{ `地块数量:${listSize}块` }}</text>
|
||||
<u--image style="margin-right: 10px" :src="userInfo.avatarURL ? userInfo.avatarURL : avatar" shape="circle" width="50px" height="50px"></u--image>
|
||||
<text>{{ userInfo.name }}</text>
|
||||
<text>{{ userInfo.roleName }}</text>
|
||||
<text>{{ `地块数量:${landCount}块` }}</text>
|
||||
</view>
|
||||
<u-gap height="5" bgColor="#F6F3F3"></u-gap>
|
||||
<view class="search">
|
||||
@ -39,7 +39,7 @@
|
||||
</view>
|
||||
<view class="button" v-hasPermi="['device:control:list']">
|
||||
<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>
|
||||
</template>
|
||||
@ -47,70 +47,70 @@
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue"
|
||||
import { onShow, onLoad, onReady } from "@dcloudio/uni-app"
|
||||
<script >
|
||||
import store from "@/store"
|
||||
import plugin from "@/plugins"
|
||||
import storage from "@/utils/storage"
|
||||
import avatar from "../../../static/images/mine/userAvatar.png"
|
||||
|
||||
const userId = ref(0)
|
||||
const listSize = ref(0)
|
||||
const user = ref({
|
||||
name: "",
|
||||
avatarURL: "",
|
||||
roleName: ""
|
||||
})
|
||||
const paging = ref(null)
|
||||
const query = ref({ userId: 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()
|
||||
}
|
||||
})
|
||||
|
||||
function queryList() {
|
||||
if (query.value.landName == null || query.value.landName == "") {
|
||||
delete query.value["landName"]
|
||||
}
|
||||
//获取该用户地块列表
|
||||
store
|
||||
.dispatch("onGetUserManagerLandList", query.value)
|
||||
.then(res => {
|
||||
//将请求的结果数组传递给z-paging
|
||||
paging.value.complete(res.data)
|
||||
if (query.value.landName == null || query.value.landName == "") {
|
||||
listSize.value = res.data.length
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
userInfo:{},
|
||||
landCount:0,
|
||||
paging:null,
|
||||
avatar:null,
|
||||
query:{
|
||||
userId:null,
|
||||
landName:null
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
paging.value.complete(false)
|
||||
plugin.modal.msgError(error)
|
||||
})
|
||||
.finally(() => {
|
||||
plugin.modal.closeLoading()
|
||||
})
|
||||
}
|
||||
//查找地块
|
||||
function onSearchValue(keyword) {
|
||||
query.value.landName = keyword
|
||||
paging.value.reload()
|
||||
}
|
||||
|
||||
//跳转到权限页面
|
||||
function onClickPermission(param) {
|
||||
plugin.tab.navigateTo(`/pages/work/user/device?landId=${param.landID}&userId=${param.userID}`)
|
||||
}
|
||||
},
|
||||
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;
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
queryList() {
|
||||
if(!this.query.userId){
|
||||
return;
|
||||
}
|
||||
//获取该用户地块列表
|
||||
console.log(this.query)
|
||||
store
|
||||
.dispatch("getLandByUserId", this.query)
|
||||
.then(res => {
|
||||
//将请求的结果数组传递给z-paging
|
||||
console.log(res)
|
||||
this.$refs.paging.complete(res.data);
|
||||
if(res.data){
|
||||
this.landCount=res.data.length;
|
||||
}
|
||||
})
|
||||
.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) {
|
||||
plugin.tab.navigateTo(`/pages/work/user/device?landId=${item.landId}&userId=${item.userId}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus">
|
||||
|
@ -275,8 +275,7 @@
|
||||
})
|
||||
},
|
||||
clickMore(item) {
|
||||
console.log(item)
|
||||
plugin.tab.navigateTo(`/pages/work/user/ground?id=${item.userId}&name=${item.userName}&avatar=${item.avatar}&roleName=${item.role.roleName}`)
|
||||
plugin.tab.navigateTo(`/pages/work/user/ground?userInfo=${encodeURIComponent(JSON.stringify(item))}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,8 @@ import {
|
||||
getLandInfo,
|
||||
addLand,
|
||||
updateLand,
|
||||
getLandNum
|
||||
getLandNum,
|
||||
getLandByUserId
|
||||
} from "@/api/system/land"
|
||||
import {allListUser}from "@/api/system/user"
|
||||
const land = {
|
||||
@ -74,6 +75,17 @@ const land = {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
getLandByUserId({}, data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
getLandByUserId(data)
|
||||
.then(res => {
|
||||
resolve(res)
|
||||
})
|
||||
.catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user