From 5c8951e28e9f2fbdbe730ddf264eeba313647ea9 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期四, 13 七月 2023 16:32:53 +0800
Subject: [PATCH] #

---
 pages/AGV/AGVStart.vue |   96 +++++++++++++++++++++++++++++++++---------------
 1 files changed, 66 insertions(+), 30 deletions(-)

diff --git a/pages/AGV/AGVStart.vue b/pages/AGV/AGVStart.vue
index 94f076a..7010001 100644
--- a/pages/AGV/AGVStart.vue
+++ b/pages/AGV/AGVStart.vue
@@ -1,29 +1,19 @@
 <template>
 	<view>
 		<view class="code">
-			<!-- <view class="item">
-				<view class="code-decs">鎵樼洏鐮�:</view>
-				<input type="text" placeholder=" 鎵爜 / 杈撳叆" v-model="barcode" :focus="barcodeFocus"
-					@input="barcodeInput()">
-			</view> -->
-			<!-- <view class="item">
-				<view class="code-decs">鏆傚瓨浣�:</view>
-				<input type="text" placeholder=" 鎵爜 / 杈撳叆" v-model="stationCode" :focus="matFocus" @input="stationCodeInput()">
-				<view class="item-right">
-					<button></button> -->
-					<!-- <text style="text-align: right;color: #409EFF;" @click="selectMat()">鎻愬彇+</text> -->
-					<!-- <uni-icons type="right" color="#c1c1c1"></uni-icons> -->
-				<!-- </view>
-			</view> -->
 			<view class="item">
 				<view class="code-decs">妤煎彿:</view>
 				<uni-combox :candidates="floorList" placeholder="璇烽�夋嫨妤煎彿" v-model="floor" @input="getFloor"></uni-combox>
 			</view>
+			<view class="item">
+				<view class="code-decs">鏆傚瓨浣�:</view>
+				<input type="text" placeholder=" 鎵爜 / 杈撳叆" v-model="stationCode" :focus="stationCodeFocus"
+					@input="stationCodeInput()">
+			</view>
 		</view>
+		
 		<view class="mat-list-title">
-			<view style="width: 200rpx;"></view>
-			<view style="-webkit-flex: 1;flex: 1;">鍟嗗搧鍒楄〃</view>
-			<view style="width: 200rpx;"><button size="mini" type="primary" @click="getChecked">鎻愬彇</button></view>
+			<view style="-webkit-flex: 1;flex: 1;">绔欑偣鍒楄〃</view>
 		</view>
 		<scroll-view>
 			<view class="list" v-for="(item,i) in dataList" :key="i" :class="'bg-'+item.color">
@@ -118,6 +108,7 @@
 				token: '',
 				barcode: '',
 				stationCode: '',
+				stationCodeFocus: true,
 				dataList: [],
 				count: 0,
 				rowNum: '',
@@ -145,6 +136,52 @@
 			this.token = uni.getStorageSync('token');
 		},
 		methods: {
+			stationCodeInput() {
+				setTimeout(() => {
+					var len = this.stationCode.length
+					if (len != 15) {
+						this.stationCode = ''
+						this.stationCodeFocus = true
+						uni.showToast({
+							title: '鏆傚瓨鐮佹湁璇閲嶈瘯',
+							icon: "none",
+							position: 'top'
+						});
+						return;
+					}
+					this.pushDevNo()
+					this.stationCodeFocuss()
+				}, 200)
+			},
+			pushDevNo() {
+				var devNo = {"devNo":this.stationCode}
+				if (this.dataList.length == 0) {
+					this.dataList.push(devNo)
+					return
+				}
+				var flag = false
+				for(var i = 0; i < this.dataList.length; i++ ) {
+					if (this.dataList[i].devNo == devNo.devNo) {
+						this.messageText = "绔欑偣閲嶅"
+						this.messageToggle('warn')
+						return
+					} else {
+						flag = true
+					}
+				}
+				if(flag) {
+					this.dataList.push(devNo)
+				}
+				
+			},
+			stationCodeFocuss() {
+				let that = this;
+				this.stationCode = ''
+				that.stationCodeFocus = false;
+				setTimeout(() => {
+					that.stationCodeFocus = true;
+				}, 100);
+			},
 			getChecked() {
 				var checkedList = []
 				for(var i = 0; i < this.dataList.length; i++) {
@@ -161,6 +198,9 @@
 			},
 			getFloor() {
 				let that = this
+				if (this.floor == '') {
+					return
+				}
 				uni.request({
 					url: that.baseUrl + '/agvMobile/getBasDevp/auth',
 					data: {
@@ -174,20 +214,16 @@
 						res = res.data
 						for(var i = 0; i < res.data.length; i++) {
 							if (res.data[i].locSts === 'F') {
-								res.data[i]["color"] = "red"
+								// res.data[i]["color"] = "red"
+								that.dataList.push(res.data[i])
 							}
 						}
-						that.dataList = res.data
-						console.log(that.dataList);
 					}
 				});
 			},
 			messageToggle(type) {
 				this.msgType1 = type
 				this.$refs.message.open()
-			},
-			stationCodeInput() {
-				this.dataList.push(this.stationCode)
 			},
 			// barcode input 浜嬩欢
 			barcodeInput() {
@@ -388,10 +424,13 @@
 				this.$refs.combConfirm.close()
 			},
 			comb() {
+				this.devNo = []
 				uni.vibrateShort();
 				let that = this;
-				for (var i = 0; i < that.dataList.length; i++) {
-					that.devNo.push(that.dataList[i].devNo)
+				for (var i = 0; i < this.dataList.length; i++) {
+					if (this.dataList[i].checked) {
+						this.devNo.push(this.dataList[i].devNo)
+					}
 				}
 				uni.request({
 					url: that.baseUrl + '/agvMobile/pakin/auth',
@@ -408,9 +447,6 @@
 							that.resst();
 							that.messageText = "鍚姩鎴愬姛"
 							that.messageToggle('success')
-							// const innerAudioContext = uni.createInnerAudioContext();
-							// innerAudioContext.src = '/static/music/pakinOk.mp3';
-							// innerAudioContext.play()
 						} else if (res.code == 403) {
 							that.messageText = res.msg
 							that.messageToggle('error')
@@ -468,7 +504,7 @@
 		color: #666666;
 	}
 	.list:first-child {
-		margin-top: 260rpx;
+		margin-top: 360rpx;
 	}
 	.aside {
 		width: 100rpx;
@@ -521,7 +557,7 @@
 		width: 100%;
 		background-color: white;
 		position: fixed;
-		margin-top: 100rpx;
+		margin-top: 200rpx;
 		z-index: 9;
 		/* border-top: 1px solid #DCDFE6; */
 		text-align: center;

--
Gitblit v1.9.1