Browse Source

用户管理, 用户添加, 用户查看

zhengkaixin 1 tháng trước cách đây
mục cha
commit
9114f0304d

+ 15 - 0
apis/pagejs/pagejsIndex.js

@@ -10,6 +10,21 @@ export function errList(data) {
 	})
 }
 
+export function findByOpenId(data) {
+	var url='/mobile/sysUser/findByOpenId';
+	 
+	if(!data){
+		data={}
+	}
+	data.roleName='XJ'
+	return request({
+		method: 'get',
+		data: data,
+		url: url
+	})
+}
+
+
 export function floorStatus(data) {
 	var url='/mobile/inspection/floorStatus';
 	return request({

+ 21 - 0
apis/pagejs/pagesTeam.js

@@ -0,0 +1,21 @@
+
+import request from '@/apis/utils/request'
+
+
+export function userList(data) {
+	var url='/mobile/sysUser/userList';
+	return request({
+		method: 'post',
+		data: data,
+		url: url
+	})
+}
+
+export function adduser(data) {
+	var url='/mobile/sysUser/adduser';
+	return request({
+		method: 'post',
+		data: data,
+		url: url
+	})
+}

+ 14 - 0
pages.json

@@ -144,6 +144,20 @@
 			{
 				"navigationBarTitleText" : ""
 			}
+		},
+		{
+			"path" : "pages/team/teamList",
+			"style" : 
+			{
+				"navigationBarTitleText" : ""
+			}
+		},
+		{
+			"path" : "pages/team/teamAdd",
+			"style" : 
+			{
+				"navigationBarTitleText" : ""
+			}
 		}
 	],
 

+ 64 - 20
pages/index/index.vue

@@ -25,7 +25,7 @@
 				<!-- 消息提醒位置 -->
 			</view>
 		</view>
-		<view class="main_navigation panel" style="display:block" >
+		<view class="main_navigation panel"  >
 			<view class="item-na end" @click="gotoUrl('/pages/task/addTask')">
 				<view class="na-img">
 					<image class="img" src="@/assets/img/index/na-1.png" mode=""></image>
@@ -34,28 +34,27 @@
 					故障上报
 				</view>
 			</view>
-			<view class="item-na-b"  v-if="0">
+			<view class="item-na-b"  >
 
+			</view>
+			<view class="item-na end"   @click="gotoUrl('/pages/team/teamList')" v-if="isAdmin"  >
+				<view class="na-img">
+					<image class="img" src="@/assets/img/index/na-3.png" mode=""></image>
+				</view>
+				<view class="na-text">
+					团队管理
+				</view>
 			</view>
-			<view class="item-na" v-if="0">
+			<view class="item-na end"   @click="gotoUrl('/pages/task/listTask')" v-else  >
 				<view class="na-img">
 					<image class="img" src="@/assets/img/index/na-2.png" mode=""></image>
 				</view>
 				<view class="na-text">
-					申请管理
-				</view>
-			</view>
-			<view class="item-na-b"  v-if="0">
-
-			</view>
-			<view class="item-na end" v-if="0" >
-				<view class="na-img">
-					<image class="img" src="@/assets/img/index/na-3.png" mode=""></image>
-				</view>
-				<view class="na-text">
-					团队管理
+					故障记录
 				</view>
 			</view>
+			
+			
 		</view>
 		<view class="main_statuspanel panel">
 			<view class="top-main">
@@ -73,7 +72,7 @@
 					<view id="body1pie1" class="body1pie">
 
 					</view>
-					<view  class="body2pie">
+					<view  class="body2pie" v-if="datafloorStatus.totalNum">
 						<view class="v1">{{datafloorStatus.totalNum}}</view>
 						<view class="v2">地锁:套</view>
 					</view>
@@ -225,17 +224,17 @@
 				echartsList: {},
 				isReadyfloorStatus:false,
 				datafloorStatus:{},
-				
+				roleList:[],
 				isReadyerrList:false,
 				dataerrList:[],
 				dataerrRecordsTotal:0,
 			};
 		},
 		onLoad() {
-
+			this.roleList=this.jphelp.getPersonInfoPlus().roleList
 		},
 		onShow() {
-			
+			this.roleList=this.jphelp.getPersonInfoPlus().roleList
 			if(this.isReadyfloorStatus){
 				this.getfloorStatus()
 			}
@@ -243,13 +242,58 @@
 				this.geterrList()
 			}
 			
+		},
+		computed:{
+				isAdmin(){
+					if(this.roleList){
+						var i =this.roleList.findIndex(item=>{
+							return item.name=='XJADMIN'
+						})
+						if(i!=-1){
+								return true
+						}
+					}
+					return false
+				}
 		},
 		onReady() {
 			this.geterrList()
 			this.getfloorStatus()
-			//this.getbody1pie1()
+			//this.getbody1pie1()
+			this.query()
 		},
 		methods: {
+			query(){
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				
+				API.findByOpenId({
+					noerror:true,
+					openId: this.jphelp.getOpenId(),
+				 
+				
+				}).then((response) => {
+					uni.hideLoading();
+					if(response.message){
+						uni.hideLoading();
+						
+					}else{
+						this.loginset(response)
+						
+						 
+					}
+					this.roleList=this.jphelp.getPersonInfoPlus().roleList
+					
+					
+				
+				}).catch(error => {
+					
+					uni.hideLoading();
+					
+				})
+			},
 			geterrList(){
 				
 				API.errList({

+ 1 - 1
pages/task/listTask.vue

@@ -123,7 +123,7 @@
 			},
 			customBack(){
 				if(this.lockId){
-					uni.reLaunch({
+					uni.switchTab({
 						url:"/pages/index/index"
 					})
 				}else{

+ 206 - 0
pages/team/teamAdd.vue

@@ -0,0 +1,206 @@
+<template>
+	<view>
+		<u-navbar title="成员信息" title-color="#101010"></u-navbar>
+		<view class="list">
+			<view class="item">
+				<view class="name">
+					<span>*</span>成员姓名
+
+				</view>
+				<view class="value">
+					<u-input v-model="addInfo.name" placeholder="请输入成员姓名"></u-input>
+				</view>
+			</view>
+			<view class="item">
+				<view class="name">
+					<span>*</span>登录手机号
+
+				</view>
+				<view class="value">
+					<u-input v-model="addInfo.phone"  placeholder="请输入登录手机号"></u-input>
+				</view>
+			</view>
+			<view class="item">
+				<view class="name">
+					登录密码
+
+				</view>
+				<view class="value">
+					<u-input placeholder="不填写默认123456" v-model="addInfo.password"></u-input>
+				</view>
+			</view>
+
+
+		</view>
+		<view class="floating-button">
+			<view class="button" @click="submit">
+
+				提交
+			</view>
+
+		</view>
+
+	</view>
+</template>
+
+<script>
+	import * as API from '@/apis/pagejs/pagesTeam.js'
+
+	export default {
+		data() {
+			return {
+				addInfo: {
+					roleName:"XJ"
+				}
+			};
+		},
+		methods:{
+			submit(){
+				if(!this.addInfo.name){
+					uni.showToast({
+						title:"请输入成员姓名"
+					})
+					 return
+				}
+				if(!this.addInfo.phone){
+					uni.showToast({
+						title:"请输入登录手机号"
+					})
+					 return
+				}
+				
+			
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				
+				API.adduser(this.addInfo).then((res) => {
+					
+					uni.showModal({
+						title: '提示',
+						showCancel: false,
+						content: "操作成功",
+						success: res1 => {
+							if (res1.confirm) {
+								uni.navigateBack()
+							} else if (res1.cancel) {
+								//('用户点击取消');
+							}
+						}
+					})
+				
+					uni.hideLoading();
+				
+				}).catch(error => {
+				
+					uni.hideLoading();
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+				
+				
+			},
+		}
+	}
+</script>
+
+<style lang="scss">
+	.jpmain {
+		padding-bottom: 120rpx;
+	}
+
+	.list {
+		background-color: rgba(255, 255, 255, 1);
+
+		margin: 20rpx 0;
+
+		.item:not(:last-child) {
+			border-bottom: 1px solid rgba(232, 232, 232, 1);
+		}
+
+		.item {
+			padding: 24rpx;
+			display: flex;
+			align-items: center;
+			justify-content: space-between;
+
+			.name {
+				width: 40%;
+				font-size: 32rpx;
+				color: #777777;
+
+				span {
+					color: red
+				}
+
+				white-space: pre;
+			}
+
+			.value {
+				font-size: 32rpx;
+				width: 60%;
+				display: flex;
+				justify-content: space-between;
+
+				input::placeholder {
+					color: #AAAAAA;
+				}
+
+				.img {
+					width: 40rpx;
+					height: 40rpx;
+
+				}
+
+				.textarea {
+					background-color: rgba(241, 242, 245, 1);
+					width: 100%;
+					border-radius: 4px;
+				}
+
+			}
+		}
+
+		.item-plus {
+			flex-direction: column;
+
+			.value,
+			.name {
+				width: 100%;
+			}
+
+			.name {
+				padding-bottom: 32rpx;
+			}
+		}
+	}
+
+	.floating-button {
+		position: fixed;
+		bottom: 0;
+		/* 距离底部 20px */
+		width: 100%;
+		display: flex;
+		height: 120rpx;
+		justify-content: center;
+		background-color: rgba(255, 255, 255, 1);
+
+		.button {
+			margin-top: 24rpx;
+			border-radius: 50px;
+			height: 80rpx;
+			width: 80%;
+			display: flex;
+			align-items: center;
+			justify-content: center;
+			padding: 12rpx;
+
+			background-color: rgba(22, 119, 255, 1);
+			color: rgba(255, 255, 255, 1);
+			font-size: 36rpx;
+		}
+	}
+</style>

+ 288 - 0
pages/team/teamList.vue

@@ -0,0 +1,288 @@
+<template>
+	<view>
+		<u-navbar title="团队成员" title-color="#101010" ></u-navbar>
+		<view class="top">
+			<view class="search">
+				<view class="searchBox">
+					<u-search shape="square" placeholder="搜索授权用户" maxlength="12" v-model="testName" :show-action="false"
+						:animation="true"></u-search>
+					<u-button type="primary" size="mini" @click="testBtn">搜素</u-button>
+				</view>
+			</view>
+		</view>
+		
+
+		<view class="list"  >
+			<view class="item" 
+			 v-for="(item,index) in list" 
+			
+			 :key="index">
+				
+				<view class="icon">
+					
+					<image class="img" v-if="item.headImg" :src="item.headImg" mode=""></image>
+					
+					<image class="img" v-else src="@/assets/img/默认头像.png" mode=""></image>
+				</view>
+				
+				<view class="body">
+					<view class="line1">
+						<view class="title">
+							{{item.realName}}
+		
+						</view>
+						
+					</view>
+					
+					<view class="line2">
+						<view class="value">
+							{{item.userName}}
+		
+						</view>
+					
+					</view>
+					
+		
+				</view>
+				<u-icon name="arrow-right" size="24" color="#BBBBBB" v-if="0"></u-icon>
+			</view>
+			
+			
+		</view>
+		<u-divider :isnone="list.length==0" nonetext="没有找到相关内容" border-color="#CFD2D5">已经到底了</u-divider>
+		<view class="floating-button">
+			<view class="button"  @click="gotoUrl('/pages/team/teamAdd')" >
+				
+				添加人员
+			</view>
+			
+		</view>
+	</view>
+</template>
+
+<script>
+	import * as API from '@/apis/pagejs/pagesTeam.js'
+	
+	export default {
+		data() {
+			return {
+				list:[],
+				listForm:{
+					pageIndex: 1,
+					pageSize: 20,
+					recordsTotal: 1,
+					status:0,
+					roleName:"XJ,XJADMIN",
+					
+					roleName:"XJ",
+				},
+				testName: "",
+				queryName: "",
+				
+				lockId:"",
+				lockName:"",
+				current:0,
+				tabslist:[
+					{
+						name: '待处理'
+					}, {
+						name: '已处理'
+					}
+				]
+			};
+		},
+		onLoad(op) {
+			
+			
+		},
+		onShow(){
+			this.getList()
+		},
+		methods: {
+			submit(){
+					
+			},
+			testBtn() {
+			
+				this.list = []
+				//this.listForm.pageIndex=1
+				this.listForm.name=	this.testName
+				this.getList()
+				
+			},
+			getList(bl) {
+				if(bl){
+					this.listForm.pageIndex = 1
+				}
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+					 
+				API.userList(this.listForm).then((res) => {
+					this.queryName = this.testName
+					var list=[]
+					
+					if (this.listForm.pageIndex == 1) {
+						list = res.data.data;
+					} else {
+						list = [
+							...list,
+							...res.data.data
+						];
+					}
+					this.list = res.data.data
+					uni.hideLoading();
+				
+				}).catch(error => {
+				
+					uni.hideLoading();
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+		}
+		
+	}
+</script>
+
+<style lang="scss" scoped>
+
+		.list {
+			padding: 24rpx 32rpx;
+background-color: rgba(255,255,255,1);
+			.item {
+				display: flex;
+				border-bottom: 1px solid rgba(232, 232, 232, 1);
+				padding: 12rpx 0;
+				margin: 12rpx 0;
+
+				.img {
+					width: 72rpx;
+					height: 72rpx;
+
+				}
+
+				.body {
+					margin: 0 12rpx;
+					width: 100%;
+
+					.line1,
+					.line2 {
+
+						display: flex;
+						justify-content: space-between;
+					}
+					.line2 {
+						color: rgba(119,119,119,1);
+						font-size: 24rpx;
+						margin-top: 8rpx;
+					}
+					.line1 {
+						.title {
+							color: rgba(51, 51, 51, 1);
+							font-size: 28rpx;
+							font-weight: bold;
+						}
+
+						.status {
+							background-color:  rgba(255, 61, 0, 1);
+							font-size: 24rpx;
+							color:#fff;
+							padding: 2rpx 8rpx;
+							//border-radius: 4px;
+
+						}
+						
+						.status0 {
+							background-color:  rgba(255, 61, 0, 1);
+							
+						}
+						.status1 {
+							background-color:  #007aff;
+							
+						}
+
+						.status2 {
+							background-color:  #ff9900;
+							
+						}
+
+						.status3 {
+							background-color:  #19be6b;
+							
+						}
+
+						.status4 {
+							border: 1px solid rgba(255, 61, 0, 1);
+							color: rgba(255, 61, 0, 1);
+						}
+					}
+					
+					.errorDesc{
+						margin: 8rpx 0;
+						 width: 480rpx;
+						     color: #777777;
+						     font-size: 24rpx;
+						 overflow: hidden;
+						    text-overflow: ellipsis;
+						    white-space: nowrap; /* 禁止换行,强制单行 */
+					}
+				}
+			}
+
+			.item:last-child {
+			  border-bottom:0px solid rgba(232,232,232,1);
+			}
+		}
+		
+		.top{
+			
+			border-bottom: 1px solid #e8e8e8;
+				
+		}
+		
+		.search {
+		
+			padding: 16rpx 32rpx;
+			background: #fff;
+			   
+		
+			.searchBox {
+				display: flex;
+				align-items: center;
+				background: #F2F2F2;
+				padding: 1px 16rpx;
+				border-radius: 8px;
+				justify-content: space-between;
+			}
+		}
+		
+		
+		.floating-button {
+			position: fixed; 
+			  bottom: 0;    /* 距离底部 20px */
+			    width: 100%;
+				 display: flex;
+				  height: 120rpx;
+				    justify-content: center;
+				background-color: rgba(255,255,255,1);
+				.button{
+					margin-top: 24rpx;
+					border-radius: 50px;
+				 height: 80rpx;
+					width: 80%;
+					display: flex;
+					    align-items: center;
+					    justify-content: center;
+						padding:12rpx;
+						
+						background-color: rgba(22,119,255,1);
+						color: rgba(255,255,255,1);
+						font-size: 36rpx;
+				}
+		}
+		
+</style>