Bladeren bron

团队设备分配调整

zhengkaixin 2 weken geleden
bovenliggende
commit
c55da4e989

+ 9 - 0
apis/pagejs/pagesTask.js

@@ -2,6 +2,15 @@
 
 import request from '@/apis/utils/request'
 
+export function teamUserStationUpdateList(data) {
+	var url='/mobile/inspectionUser/teamUserStationUpdateList';
+	return request({
+		method: 'post',
+		data: data,
+		url: url
+	})
+}
+
 
 
 export function errList(data) {

+ 21 - 0
apis/pagejs/pagesTeam.js

@@ -61,3 +61,24 @@ export function teamUserStation(data) {
 	})
 }
 
+
+export function teamUserStationUpdateList(data) {
+	var url='/mobile/inspectionUser/teamUserStationUpdateList';
+	return request({
+		method: 'post',
+		data: data,
+		url: url
+	})
+}
+
+
+
+export function updateUserStation(data) {
+	var url='/mobile/inspectionUser/updateUserStation';
+	return request({
+		method: 'post',
+		data: data,
+		url: url
+	})
+}
+

+ 1 - 1
config/.env.dev.js

@@ -17,7 +17,7 @@ const UNI_APP = {
 
 	openId:"oRGjz7GpSbld27nUK9Q6V6jvXMJo",
 	openId:"oRGjz7DZM-rK3MpkjV6_VnoUhLI0",
-	
+	openId:"123456",
 	
 	//appid
 	VUE_APP_WXAPPID:"wxa9f555dc92a1cbfc",

+ 14 - 0
pages.json

@@ -195,6 +195,20 @@
 			{
 				"navigationBarTitleText" : ""
 			}
+		},
+		{
+			"path" : "pages/team/stationMy",
+			"style" : 
+			{
+				"navigationBarTitleText" : ""
+			}
+		},
+		{
+			"path" : "pages/team/stationAdd",
+			"style" : 
+			{
+				"navigationBarTitleText" : ""
+			}
 		}
 	],
 

+ 2 - 1
pages/task/addTask.vue

@@ -161,6 +161,7 @@
 					})
 					return
 				}
+				this.taskInfo.errorReportIds=mp.join()
 				
 				if (!this.taskInfo.desc) {
 					uni.showToast({
@@ -302,7 +303,7 @@
 						acceptDataFromOpenerPage: (item) => {
 							console.log(item)
 							this.taskInfo.stationId = item.item.id
-							this.stationName = item.item.stationName
+							this.stationName = item.item.name
 							
 							this.$forceUpdate()
 

+ 39 - 18
pages/task/selectStation.vue

@@ -29,7 +29,7 @@
 					
 
 					<view class="v1" >
-						{{item.stationNo}}<span class="y">|</span>{{item.stationName}}
+						{{item.stationNo}}<span class="y">|</span>{{item.name}}
 					</view>
 					
 					<view class="v2" v-if="item.stationAddress" >
@@ -54,6 +54,12 @@
 			return {
 				list: [],
 				testName: "",
+				listForm: {
+					pageIndex: 1,
+					pageSize: 15,
+					recordsTotal: 1,
+				
+				},
 				queryName: "",
 				type: 1,
 				isAll: 0,
@@ -68,30 +74,45 @@
 			}
 			this.getList()
 		},
+		onReachBottom() {
+			if (this.list.length < this.listForm.recordsTotal) {
+				this.myLoadmore();
+			}
+		},
 		methods: {
-			getList() {
+			myLoadmore() {
+				this.listForm.pageIndex += 1;
+				this.getList()
+			},
+			getList(bl) {
+				if (bl) {
+					this.listForm.pageIndex = 1
+				}
 				uni.showLoading({
 					title: "加载中",
 					mask: true,
 				})
-				var obj = {
-					name: this.testName
-				}
-				if (this.type == 3) {
-					obj.buildMode = 2
-				}
-				API.userStationList(obj).then((res) => {
-					this.queryName = this.testName
-					var list = res.data.stationList
-					if (list == null) {
-						list = []
+				this.listForm.id = this.jphelp.getPersonInfo().id
+				this.listForm.queryContent=this.queryName
+				
+			
+				API.teamUserStationUpdateList(this.listForm).then((res) => {
+					
+					var list = this.list
+					
+									
+					
+					if (this.listForm.pageIndex == 1) {
+						list = res.data.data;
+					} else {
+						list = [
+							...list,
+							...res.data.data
+						];
 					}
-					this.list = list
-
-
+					this.list =list
+					this.listForm.recordsTotal=res.data.recordsTotal
 					
-
-
 					uni.hideLoading();
 
 				}).catch(error => {

+ 375 - 0
pages/team/stationAdd.vue

@@ -0,0 +1,375 @@
+<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" 
+			 @click="userHaveBtn(item)"
+			 :key="index">
+				<view class="b1">
+					<view class="v1">
+						{{item.stationNo}}<span class="y">|</span>{{item.name}}
+					</view>
+					
+					<view class="v2" v-if="item.stationAddress">
+						{{item.stationAddress}}
+					</view>
+				</view>
+				
+				
+				<u-icon v-if="radiovalue"
+				color="red"
+				  size="40"
+				  name="minus-circle-fill"
+				></u-icon>
+				
+				<u-icon v-else-if="!item.userHave"
+				color="#1677FF"
+				  size="40"
+				  name="plus-circle-fill"
+				></u-icon>
+				<u-icon v-else
+				color="red"
+				  size="40"
+				  name="minus-circle-fill"
+				></u-icon>
+			</view>
+			
+			
+			
+		</view>
+		<u-divider :isnone="list.length==0" nonetext="没有找到相关内容" border-color="#CFD2D5">已经到底了</u-divider>
+
+		<view class="floating-button">
+			
+			
+			<u-checkbox-group>
+				<u-checkbox v-model="radiovalue"  	@change="radioChange" 
+				shape="circle">全选</u-checkbox>
+			</u-checkbox-group>
+			
+			<view class="button " @click="submit">
+		
+				关联场站
+			</view>
+		
+		</view>
+
+	</view>
+</template>
+
+<script>
+	import * as API from '@/apis/pagejs/pagesTeam.js'
+
+	export default {
+		data() {
+			return {
+				addInfo:{},
+				list: [],
+				listForm: {
+					pageIndex: 1,
+					pageSize: 15,
+					recordsTotal: 1,
+					status: 0,
+					roleName: "XJ,XJADMIN",
+
+					roleName: "XJ",
+				},
+				radiovalue:false,
+				id: "",
+				testName: "",
+				queryName: "",
+			};
+		},
+		onLoad(op) {
+			this.id = op.id
+			this.getInfo()
+			this.getList()
+		},
+		onShow() {
+			
+		},
+		onReachBottom() {
+			if (this.list.length < this.listForm.recordsTotal) {
+				this.myLoadmore();
+			}
+		},
+		methods: {
+			userHaveBtn(item){
+				if(this.radiovalue){
+					this.radiovalue=false
+					this.list.forEach(item=>{
+						item.userHave=false
+					})
+				}
+				item.userHave=!item.userHave
+			},
+			getInfo() {
+			
+				API.teamUser({
+					id:this.id
+				}).then((res) => {
+			
+					this.addInfo=res.data.user
+					if(this.addInfo.authorizedStationEnabled==false){
+						this.radiovalue=true
+					}
+			
+				}).catch(error => {
+			
+					uni.hideLoading();
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			
+			},
+			myLoadmore() {
+				this.listForm.pageIndex += 1;
+				this.getList()
+			},
+			submit(){
+				var list=[]
+				var str=""
+				if(this.radiovalue){
+					str="-1"
+				}else{
+					list=this.list.filter(item=>{
+						return  item.userHave
+					})
+					var str=list.map(item=>{
+						return item.id
+					}).join(',')
+				}
+			
+				
+				
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				
+				API.updateUserStation({
+					id:this.id,
+					stationIds:str,
+				}).then((res) => {
+				
+					const eventChannel = this.getOpenerEventChannel();
+					
+					eventChannel.emit('acceptDataFromOpenerPage', {})
+					uni.hideLoading();
+					uni.showModal({
+						title: '提示',
+						showCancel: false,
+						content: "操作成功",
+						success: res1 => {
+							if (res1.confirm) {
+								uni.navigateBack()
+							} else if (res1.cancel) {
+								//('用户点击取消');
+							}
+						}
+					})
+				
+				}).catch(error => {
+				
+					uni.hideLoading();
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+				
+			},
+			radioChange(e){
+			
+				console.log(e,this.radiovalue)
+				
+			},
+			
+			showqueryName(item) {
+				if (this.queryName) {
+					var name = item.stationName+item.stationNo
+					return name.indexOf(this.queryName) != -1
+
+				} else {
+					return true
+				}
+			},
+			testBtn() {
+
+				this.queryName = this.testName
+				this.getList(1)
+			},
+
+			getList(bl) {
+				if (bl) {
+					this.listForm.pageIndex = 1
+				}
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				this.listForm.id = this.id
+				this.listForm.queryContent=this.queryName
+				
+				API.teamUserStationUpdateList(this.listForm).then((res) => {
+
+					
+					var list = this.list
+					
+									
+					
+					if (this.listForm.pageIndex == 1) {
+						list = res.data.data;
+					} else {
+						list = [
+							...list,
+							...res.data.data
+						];
+					}
+					this.list =list
+					this.listForm.recordsTotal=res.data.recordsTotal
+					
+					uni.hideLoading();
+
+				}).catch(error => {
+
+					uni.hideLoading();
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+
+
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.list {
+		padding-top: 20rpx;
+		    padding-bottom: 60px;
+		.item:not(:last-child) {
+			border-bottom: 2rpx solid rgba(232, 232, 232, 1);
+		}
+
+		.item {
+			padding: 24rpx 32rpx;
+			background: #fff;
+			// display: flex;
+			// flex-direction: column;
+			    display: flex;
+			    flex-direction: row;
+			    justify-content: space-between;
+			.vquery {
+				display: flex;
+				align-items: center;
+			}
+
+			.buildMode {
+				font-size: 24rpx;
+				border: 2rpx solid #bbbbbb;
+				border-radius: 8rpx;
+				color: #1677ff;
+				padding: 2rpx 8rpx;
+				margin: 0 8rpx;
+
+			}
+
+			.buildMode1 {
+				color: #1677ff;
+				border: 2rpx solid #1677ff;
+			}
+
+			.buildMode2 {
+				color: #4CAF50;
+				border: 2rpx solid #4CAF50;
+			}
+
+			.qName {
+				color: #FF5100
+			}
+
+			.v1 {
+				color: rgba(16, 16, 16, 1);
+				font-size: 32rpx;
+			}
+
+			.y {
+				margin: 0 8rpx;
+				color: rgba(119, 119, 119, 1);
+
+			}
+
+			.v2 {
+				color: rgba(119, 119, 119, 1);
+				font-size: 24rpx;
+			}
+
+		}
+	}
+
+	.top {
+
+		border-bottom: 2rpx solid #e8e8e8;
+
+	}
+
+	.search {
+
+		padding: 16rpx 32rpx;
+		background: #fff;
+
+
+		.searchBox {
+			display: flex;
+			align-items: center;
+			background: #F2F2F2;
+			padding: 2rpx 16rpx;
+			border-radius: 16rpx;
+			justify-content: space-between;
+		}
+	}
+	
+	
+	.floating-button {
+		z-index: 999;
+		position: fixed;
+		bottom: 0;
+	
+		width: 100%;
+		display: flex;
+		height: 120rpx;
+	
+		    justify-content: space-around;
+		background-color: rgba(255, 255, 255, 1);
+	
+		.button {
+			margin-top: 24rpx;
+			border-radius: 50px;
+			height: 80rpx;
+			width: 60%;
+			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: 32rpx;
+		}
+		
+	}
+</style>

+ 265 - 0
pages/team/stationMy.vue

@@ -0,0 +1,265 @@
+<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="v1">
+					{{item.stationNo}}<span class="y">|</span>{{item.name}}
+				</view>
+
+				<view class="v2" v-if="item.stationAddress">
+					{{item.stationAddress}}
+				</view>
+
+			</view>
+
+		</view>
+		<u-divider :isnone="list.length==0" nonetext="没有找到相关内容" border-color="#CFD2D5">已经到底了</u-divider>
+
+		<view class="floating-button">
+			
+			
+			<view class="button " @click="gotoTask">
+		
+				关联场站
+			</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",
+				},
+				id: "",
+				testName: "",
+				queryName: "",
+			};
+		},
+		onLoad(op) {
+			this.id = op.id
+			this.getList()
+		},
+		onShow() {
+			
+		},
+		onReachBottom() {
+			if (this.list.length < this.listForm.recordsTotal) {
+				this.myLoadmore();
+			}
+		},
+		methods: {
+			gotoTask(){
+				uni.navigateTo({
+				  url: '/pages/team/stationAdd?id='+this.id,
+				  events: {
+				    // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
+				    acceptDataFromOpenerPage: (data)=>{
+						console.log(data)
+						this.getList(1)
+				    },
+				 
+				  }
+				 
+				})
+			},
+			myLoadmore() {
+				this.listForm.pageIndex += 1;
+				this.getList()
+			},
+			showqueryName(item) {
+				if (this.queryName) {
+					var name = item.name
+					return name.indexOf(this.queryName) != -1
+
+				} else {
+					return true
+				}
+			},
+			testBtn() {
+
+				this.queryName = this.testName
+				this.getList(1)
+			},
+
+			getList(bl) {
+				if (bl) {
+					this.listForm.pageIndex = 1
+				}
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				this.listForm.id = this.id
+				this.listForm.queryContent=this.queryName 
+				API.teamUserStation(this.listForm).then((res) => {
+
+					var list = this.list
+
+				
+					if (this.listForm.pageIndex == 1) {
+						list = res.data.data;
+					} else {
+						list = [
+							...list,
+							...res.data.data
+						];
+					}
+					this.list =list
+					this.listForm.recordsTotal=res.data.recordsTotal
+					uni.hideLoading();
+
+				}).catch(error => {
+
+					uni.hideLoading();
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+
+
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.list {
+		padding-top: 20rpx;
+		padding-bottom: 120rpx;
+		
+		.item:not(:last-child) {
+			border-bottom: 2rpx solid rgba(232, 232, 232, 1);
+		}
+
+		.item {
+			padding: 24rpx 32rpx;
+			background: #fff;
+			display: flex;
+			flex-direction: column;
+
+			.vquery {
+				display: flex;
+				align-items: center;
+			}
+
+			.buildMode {
+				font-size: 24rpx;
+				border: 2rpx solid #bbbbbb;
+				border-radius: 8rpx;
+				color: #1677ff;
+				padding: 2rpx 8rpx;
+				margin: 0 8rpx;
+
+			}
+
+			.buildMode1 {
+				color: #1677ff;
+				border: 2rpx solid #1677ff;
+			}
+
+			.buildMode2 {
+				color: #4CAF50;
+				border: 2rpx solid #4CAF50;
+			}
+
+			.qName {
+				color: #FF5100
+			}
+
+			.v1 {
+				color: rgba(16, 16, 16, 1);
+				font-size: 32rpx;
+			}
+
+			.y {
+				margin: 0 8rpx;
+				color: rgba(119, 119, 119, 1);
+
+			}
+
+			.v2 {
+				color: rgba(119, 119, 119, 1);
+				font-size: 24rpx;
+			}
+
+		}
+	}
+
+	.top {
+
+		border-bottom: 2rpx solid #e8e8e8;
+
+	}
+
+	.search {
+
+		padding: 16rpx 32rpx;
+		background: #fff;
+
+
+		.searchBox {
+			display: flex;
+			align-items: center;
+			background: #F2F2F2;
+			padding: 2rpx 16rpx;
+			border-radius: 16rpx;
+			justify-content: space-between;
+		}
+	}
+	
+	
+	.floating-button {
+		z-index: 999;
+		position: fixed;
+		bottom: 0;
+	
+		width: 100%;
+		display: flex;
+		height: 120rpx;
+	
+		    justify-content: space-around;
+		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: 32rpx;
+		}
+		
+	}
+</style>

+ 7 - 4
pages/team/teamInfo.vue

@@ -62,7 +62,7 @@
 
 		
 				</view>
-				<view class="value">
+				<view class="value" @click="gotoUrl('/pages/team/stationMy?id='+id)" >
 		
 					<span class="totalPage">{{totalPage}}</span>
 					<u-icon name="arrow-right" size="24" color="#BBBBBB" ></u-icon>
@@ -109,12 +109,15 @@
 		onLoad(op) {
 			if(op.id){
 				this.id=op.id
-				this.getInfo()
-				this.getteamUserStation()
+				
 			}
 			
 			
 			
+		},
+		onShow() {
+			this.getInfo()
+			this.getteamUserStation()
 		},
 		methods: {
 			del() {
@@ -170,7 +173,7 @@
 					id:this.id
 				}).then((res) => {
 			
-					this.totalPage=res.data.totalPage
+					this.totalPage=res.data.recordsTotal
 			
 				}).catch(error => {
 			

+ 1 - 0
uni_modules/uview-ui/components/u-radio/u-radio.vue

@@ -180,6 +180,7 @@
 				}
 			},
 			emitEvent() {
+				
 				// u-radio的name不等于父组件的v-model的值时(意味着未选中),才发出事件,避免多次点击触发事件
 				if(this.parentData.value != this.name) this.$emit('change', this.name);
 			},