From 23cde0fb91fa8466001f64bc160d4a698b85f041 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期四, 14 三月 2024 13:31:15 +0800
Subject: [PATCH] #

---
 pages/project/jmAGV/home.vue |  254 ++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 212 insertions(+), 42 deletions(-)

diff --git a/pages/project/jmAGV/home.vue b/pages/project/jmAGV/home.vue
index 62594b9..8e39df4 100644
--- a/pages/project/jmAGV/home.vue
+++ b/pages/project/jmAGV/home.vue
@@ -16,26 +16,50 @@
 		<view>
 			<uni-popup ref="revise" type="dialog">
 				<view class="popup">
-					<view>{{text}}</view>
+					<view  class="popup3-input-title">{{text}}</view>
 					<view class="button-nk" @click="upTray()">{{btnTitle1}}</view>
-					<view class="button-nk" @click="downTray">{{btnTitle2}}</view>
+					<view class="button-nk" @click="downTray()">{{btnTitle2}}</view>
+					<view v-show="outType" class="button-nk" @click="downTray1()">{{btnTitle3}}</view>
 				</view>
 			</uni-popup>
 		</view>
 		
-		<!-- <view>
-			<uni-popup ref="revise2" type="dialog">
+		<view>
+			<uni-popup ref="numberPopup" type="dialog">
 				<view class="popup2">
-					<view>123</view>
-					<view class="button-nk" @click="inHouse">鎵樼洏-浠撳簱(鍏ュ簱)</view>
-					<view class="button-nk" @click="outHouse">浠撳簱-鎵樼洏(鍑哄簱)</view>
+					<view  class="popup3-input-title">{{tipsTitle}}</view>
+					<view class="button-nk" @click="goUp(2)">2涓�</view>
+					<view class="button-nk" @click="goUp(4)">4涓�</view>
 				</view>
 			</uni-popup>
-		</view> -->
+		</view>
+		
+		<view>
+			<uni-popup ref="inputPopup" type="dialog">
+				<view class="popup3">
+					<view class="popup3-input-title">{{tipsTitle}}</view>
+					<view class="popup3-input-box">
+						<text>{{desc}}:</text>
+						<view style="margin-left: 3rpx;">
+							<input type="text" v-model="code"/>
+						</view>
+					</view>
+					<view class="popup3-input-box" v-if="meterShow">
+						<text>绫虫暟:</text>
+						<view style="margin-left: 3rpx;">
+							<input type="text" v-model="meter"/>
+						</view>
+					</view>
+					<view class="button-nk" @click="confirm(2)">纭畾</view>
+				</view>
+			</uni-popup>
+		</view>
+		
 	</view>
 </template>
 
 <script>
+import code from '../../../uni_modules/uview-ui/libs/config/props/code';
 	export default {
 		data() {
 			return {
@@ -54,22 +78,32 @@
 					{name: '10鍙峰湴闈㈢珯',code:'10-C1',traget: '10-A1',type: 'foolr'}
 				],
 				traySiteList: [
-					{name: '1鍙锋墭鐩樼珯',code:'1-A1',inTraget: '1-C1',type: 'tray'},
-					{name: '2鍙锋墭鐩樼珯',code:'2-A1',inTraget: '1-C1',type: 'tray'},
-					{name: '3鍙锋墭鐩樼珯',code:'3-A1',inTraget: '1-C1',type: 'tray'},
-					{name: '4鍙锋墭鐩樼珯',code:'4-A1',inTraget: '1-C1',type: 'tray'},
-					{name: '5鍙锋墭鐩樼珯',code:'5-A1',inTraget: '1-C1',type: 'tray'},
-					{name: '6鍙锋墭鐩樼珯',code:'6-A1',inTraget: '1-C1',type: 'tray'},
-					{name: '7鍙锋墭鐩樼珯',code:'7-A1',inTraget: '1-C1',type: 'tray'},
-					{name: '8鍙锋墭鐩樼珯',code:'8-A1',inTraget: '1-C1',type: 'tray'},
-					{name: '9鍙锋墭鐩樼珯',code:'9-A1',inTraget: '1-C1',type: 'tray'},
-					{name: '10鍙锋墭鐩樼珯',code:'10-A1',inTraget: '1-C1',type: 'tray'}
+					{name: '1鍙锋墭鐩樼珯',code:'KW-1',type: 'tray'},
+					{name: '2鍙锋墭鐩樼珯',code:'KW-2',type: 'tray'},
+					{name: '3鍙锋墭鐩樼珯',code:'KW-3',type: 'tray'},
+					{name: '4鍙锋墭鐩樼珯',code:'KW-4',type: 'tray'},
+					{name: '5鍙锋墭鐩樼珯',code:'KW-5',type: 'tray'},
+					{name: '6鍙锋墭鐩樼珯',code:'KW-6',type: 'tray'},
+					{name: '7鍙锋墭鐩樼珯',code:'KW-7',type: 'tray'},
+					{name: '8鍙锋墭鐩樼珯',code:'KW-8',type: 'tray'},
+					{name: '9鍙锋墭鐩樼珯',code:'KW-9',type: 'tray'},
+					{name: '10鍙锋墭鐩樼珯',code:'KW-10',type: 'tray'}
 				],
 				item: '',
 				text: '',
 				btnTitle1: '',
 				btnTitle2: '',
-				stationType: 'load'
+				btnTitle3: '',
+				outType: '',
+				stationType: 'load',
+				type: '' ,
+				originLocal: '',
+				targetLocal: '',
+				code: '',
+				meter: '',
+				meterShow: '',
+				desc: '',
+				tipsTitle: ''
 			}
 		},
 		onShow() {
@@ -82,34 +116,145 @@
 				this.item = item
 				this.text = item.name
 				if (type == 'left') {
+					this.outType = false
 					this.btnTitle1 = '鍦伴潰绔欐斁缃墭鐩�(涓婃灦)'
-					this.btnTitle2 = '鎵樼洏绔欏彇缃墭鐩�(涓嬫灦)'
+					this.btnTitle2 = '鎵樼洏绔欏彇缃湴闈�(涓嬫灦)'
 				} else {
+					this.outType = true
 					this.btnTitle1 = '鎵樼洏-浠撳簱(鍏ュ簱)'
-					this.btnTitle2 = '浠撳簱-鎵樼洏(鍑哄簱)'
+					this.btnTitle2 = '浠撳簱-绌烘墭鐩�(鍑哄簱)'
+					this.btnTitle3 = '浠撳簱-婊℃墭鐩�(鍑哄簱)'
 				}
 				this.$refs.revise.open(type)
 			},
+			// 鍦伴潰绔欎笂鏋� / 鎵樼洏绔欏叆搴撴寜閽�
 			upTray() {
-				let _this = this 
+				if (this.item.type == 'foolr') {
+					this.type = 'load', // 涓婃灦
+					this.originLocal = this.item.code,
+					this.targetLocal = this.item.traget
+					this.tipsTitle = '涓婃灦鏁伴噺'
+					this.numberPopup()
+				} else {
+					this.type = 'in' // 鍏ュ簱
+					this.originLocal = this.item.code,
+					this.targetLocal = 'KW-J'
+					this.pakin()
+				}
+			},
+			downTray() {
+				if (this.item.type == 'foolr') {
+					this.type = 'unload', // 涓嬫灦
+					this.originLocal = this.item.traget,
+					this.targetLocal = this.item.code
+					this.tipsTitle = '涓嬫灦鏁伴噺'
+					this.numberPopup()
+				} else {
+					this.type = 'out1' // 鍑哄簱
+					this.originLocal = 'KW-C'
+					this.targetLocal = this.item.code
+					this.inputPopup()
+				}
+			},
+			downTray1() {
+				if (this.item.type == 'foolr') {
+					this.type = 'unload', // 涓嬫灦
+					this.originLocal = this.item.traget,
+					this.targetLocal = this.item.code
+				} else {
+					this.type = 'out2' // 鍑哄簱
+					this.originLocal = 'KW-C'
+					this.targetLocal = this.item.code
+					this.inputPopup()
+				}
+			},
+			numberPopup() {
+				this.$refs.numberPopup.open('center')
+			},
+			inputPopup() {
+				if (this.type == 'out1') {
+					this.tipsTitle = '绌烘墭鐩樺嚭搴�'
+					this.desc = '鐗╂枡鐮�'
+					this.meterShow = false
+				} else {
+					this.tipsTitle = '婊℃墭鐩樺嚭搴�'
+					this.desc = '璁㈠崟鍙�'
+					this.meterShow = true
+				}
+				this.$refs.inputPopup.open('center')
+			},
+			// 涓� / 涓� 鏋舵暟閲�
+			goUp(num) {
+				let data = {}
+				data = {
+					originLocal: this.originLocal,
+					targetLocal: this.targetLocal,
+					type: this.type,
+					anfme: num,
+				}
+				this.webServer(data)
+				setTimeout(()=>{
+					this.$refs.numberPopup.close()
+				},300)
+			},
+			pakin() {
+				let data = {}
+				data = {
+					originLocal: this.originLocal,
+					targetLocal: this.targetLocal,
+					type: this.type,
+				}
+				this.webServer(data)
+				setTimeout(()=>{
+					this.$refs.numberPopup.close()
+				},300)
+			},
+			confirm() {
+				let data = {}
+				if (this.type == 'out1') {
+					data = {
+						originLocal: this.originLocal,
+						targetLocal: this.targetLocal,
+						type: this.type,
+						matnr: this.code,
+						anfme: 4
+					}
+				} else {
+					data = {
+						originLocal: this.originLocal,
+						targetLocal: this.targetLocal,
+						type: this.type,
+						orderNo: this.code,
+						meter: this.meter
+					}
+				}
+				this.webServer(data)
+				setTimeout(()=>{
+					this.$refs.inputPopup.close()
+					this.code = ''
+					this.meter = ''
+				},300)
+			},
+			// 鎵�鏈夋湇鍔�
+			webServer(data) {
+				let _this = this
 				uni.request({
-					url: `${_this.baseUrl}/agv/inBound`,
-					data: {
-						originLocal: _this.item.code,
-						targetLocal: _this.item.traget,
-						type: 'load'
-					},
+					url: `${_this.baseUrl}/agv/requestTask`,
+					data: data,
 					header: { 'token': uni.getStorageSync('token') },
 					method: 'POST',
 					success(res) {
-						console.log(res);
+						res = res.data
+						if (res.code === 200) {
+							this.$refs.revise.close()
+							uni.showToast({ title: '鎿嶄綔鎴愬姛', icon: "none", position: 'top' })
+						} else {
+							uni.showToast({ title: res.msg, icon: "none", position: 'top' })
+						}
+						
 					}
 				})
-			},
-			downTray() {
-				
 			}
-			
 		}
 	}
 </script>
@@ -126,12 +271,13 @@
 		/* margin: 1%; */
 		background-color: azure;
 	}
-	.zcard {
+	/* .zcard {
 		margin: 10px 100px;
-		/* background-color: blanchedalmond; */
-	}
+		background-color: #409EFF;
+	} */
 	.zcard-flex {
 		/* background-color: coral; */
+		margin-top: 20rpx;
 		width: 100%;
 		height: 100%;
 		display: flex;
@@ -141,15 +287,15 @@
 		align-items: center;
 	}
 	.button-nk {
-		margin: 10rpx;
-		padding: 20rpx 70rpx;
+		margin: 10rpx 0rpx;
+		/* padding: 20rpx 70rpx; */
 		/* background-color: azure; */
-		min-width: 200rpx;
+		min-width: 150rpx;
 		/* margin: 0 auto; */
-		height: 50px;
+		height: 50rpx;
 		text-align: center;
-		line-height: 50px;
-		font-size: 20px;
+		line-height: 50rpx;
+		font-size: 20rpx;
 		background-color: #409EFF;
 		color: #ECF0F1;
 		border-radius: 7px;
@@ -180,5 +326,29 @@
 		display: flex;
 		flex-direction: column;
 		justify-content: space-around;
+		border-radius: 10rpx;
+	}
+	.popup3 {
+		background-color: #eee;
+		width: 50vw;
+		padding: 0 10vw;
+		display: flex;
+		flex-direction: column;
+		justify-content: space-around;
+		border-radius: 10rpx;
+		color: #565656;
+	}
+	.popup3-input-title {
+		text-align: center;
+		margin: 10rpx;
+		font-size: 18px;
+		font-weight: bold;
+	}
+	.popup3-input-box  {
+		display: flex;
+		border: 1px solid #cecece;
+		border-radius: 5rpx;
+		padding: 2rpx 10rpx;
+		margin: 20rpx;
 	}
 </style>

--
Gitblit v1.9.1