From f2232657e8109b0ed4f76b3913e0d4b9713e2af6 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期一, 18 三月 2024 07:54:56 +0800
Subject: [PATCH] #

---
 pages/project/jmAGV/home.vue |  200 +++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 164 insertions(+), 36 deletions(-)

diff --git a/pages/project/jmAGV/home.vue b/pages/project/jmAGV/home.vue
index 45bfd9d..61a83ab 100644
--- a/pages/project/jmAGV/home.vue
+++ b/pages/project/jmAGV/home.vue
@@ -1,5 +1,6 @@
 <template>
 	<view class="container">
+		<uni-icons type="bars" size="30" color="#b1b3b8" class="select" @click="jump()"></uni-icons>
 		<!-- 宸� -->
 		<view class="zcard">
 			<view class="zcard-flex">
@@ -13,10 +14,11 @@
 			</view>
 		</view>
 		
+		
 		<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 v-show="outType" class="button-nk" @click="downTray1()">{{btnTitle3}}</view>
@@ -27,7 +29,7 @@
 		<view>
 			<uni-popup ref="numberPopup" type="dialog">
 				<view class="popup2">
-					<view>涓婃灦鏁伴噺</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>
@@ -35,11 +37,28 @@
 		</view>
 		
 		<view>
-			<uni-popup ref="numberPopup" type="dialog">
-				<view class="popup2">
-					<view>涓婃灦鏁伴噺</view>
-					<view class="button-nk" @click="goUp(2)">2涓�</view>
-					<view class="button-nk" @click="goUp(4)">4涓�</view>
+			<uni-popup ref="inputPopup" type="dialog">
+				<view class="popup3">
+					<view class="popup3-input-title">{{tipsTitle}}</view>
+					<view class="popup3-input-box2"  :class="item.chose" 
+						v-if="!meterShow" v-for="item in emptyMatList" @click="chose(item.matnr)">
+						<view>
+							{{item.maktx}}
+						</view>
+					</view>
+					<view class="popup3-input-box" v-if="meterShow">
+						<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>
@@ -48,6 +67,7 @@
 </template>
 
 <script>
+import code from '../../../uni_modules/uview-ui/libs/config/props/code';
 	export default {
 		data() {
 			return {
@@ -77,6 +97,7 @@
 					{name: '9鍙锋墭鐩樼珯',code:'KW-9',type: 'tray'},
 					{name: '10鍙锋墭鐩樼珯',code:'KW-10',type: 'tray'}
 				],
+				emptyMatList: [],
 				item: '',
 				text: '',
 				btnTitle1: '',
@@ -87,6 +108,11 @@
 				type: '' ,
 				originLocal: '',
 				targetLocal: '',
+				code: '',
+				meter: '',
+				meterShow: '',
+				desc: '',
+				tipsTitle: '',
 			}
 		},
 		onShow() {
@@ -95,6 +121,11 @@
 			this.token = uni.getStorageSync('token');
 		},
 		methods: {
+			jump() {
+				uni.redirectTo({
+					url: '/pages/project/jmAGV/floorOne'
+				})
+			},
 			click(item,type) {
 				this.item = item
 				this.text = item.name
@@ -110,12 +141,24 @@
 				}
 				this.$refs.revise.open(type)
 			},
+			chose(matnr) {
+				for (let k of this.emptyMatList) {
+					if (k.matnr == matnr) {
+						k.chose = 'chosed'
+					} else {
+						k.chose = ''
+					}
+					this.$forceUpdate() // 寮哄埗鍒锋柊
+				}
+				this.code = matnr
+			},
 			// 鍦伴潰绔欎笂鏋� / 鎵樼洏绔欏叆搴撴寜閽�
 			upTray() {
 				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' // 鍏ュ簱
@@ -129,48 +172,56 @@
 					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() {
-				let _this = this
-				let type = '',originLocal = '',targetLocal = '';
 				if (this.item.type == 'foolr') {
-					type = 'unload', // 涓嬫灦
-					originLocal = this.item.traget,
-					targetLocal = this.item.code
+					this.type = 'unload', // 涓嬫灦
+					this.originLocal = this.item.traget,
+					this.targetLocal = this.item.code
 				} else {
-					type = 'out2' // 鍑哄簱
-					originLocal = 'KW-C'
-					targetLocal = this.item.code
+					this.type = 'out2' // 鍑哄簱
+					this.originLocal = 'KW-C'
+					this.targetLocal = this.item.code
+					this.inputPopup()
 				}
-				// this.text = originLocal + targetLocal
-				uni.request({
-					url: `${_this.baseUrl}/agv/requestTask`,
-					data: {
-						originLocal: originLocal,
-						targetLocal: targetLocal,
-						type: type
-					},
-					header: { 'token': uni.getStorageSync('token') },
-					method: 'POST',
-					success(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' })
-						}
-					}
-				})
 			},
 			numberPopup() {
 				this.$refs.numberPopup.open('center')
+			},
+			inputPopup() {
+				if (this.type == 'out1') {
+					this.tipsTitle = '绌烘墭鐩樺嚭搴�'
+					this.desc = '鐗╂枡鐮�'
+					this.meterShow = false
+					let that = this
+					uni.request({
+						url: `${that.baseUrl}/agv/getEmptyMat`,
+						header: { 'token': uni.getStorageSync('token') },
+						method: 'GET',
+						success(res) {
+							res = res.data
+							if (res.code === 200) {
+								res.data['chose'] = ''
+								that.emptyMatList = res.data
+								
+							}
+						}
+					})
+				} else {
+					this.tipsTitle = '婊℃墭鐩樺嚭搴�'
+					this.desc = '璁㈠崟鍙�'
+					this.meterShow = true
+					this.$refs.inputPopup.open('center')
+				}
+				this.$refs.inputPopup.open('center')
 			},
 			// 涓� / 涓� 鏋舵暟閲�
 			goUp(num) {
@@ -194,6 +245,35 @@
 					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) {
@@ -225,6 +305,7 @@
 		/* background-color: aqua; */
 		display: grid;
 		grid-template-columns: 50% 50%;
+		width: 100%;
 
 	}
 	.btn-box {
@@ -250,7 +331,7 @@
 		margin: 10rpx 0rpx;
 		/* padding: 20rpx 70rpx; */
 		/* background-color: azure; */
-		min-width: 150rpx;
+		min-width: 100rpx;
 		/* margin: 0 auto; */
 		height: 50rpx;
 		text-align: center;
@@ -286,5 +367,52 @@
 		display: flex;
 		flex-direction: column;
 		justify-content: space-around;
+		border-radius: 10rpx;
+	}
+	.popup3 {
+		background-color: #eee;
+		max-height: 80vw;
+		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;
+	}
+	.popup3-input-box2 {
+		display: flex;
+		border: 1px solid #cecece;
+		border-radius: 5rpx;
+		padding: 2rpx 10rpx;
+		margin: 10rpx;
+		background-color: #FFF;
+	}
+	.chosed {
+		background-color: #67C23A;
+		color: #e8e8e8;
+	}
+	.select {
+		position: absolute;
+		bottom: 12px;
+		right: 16px;
+		border-radius: 10px;
+		padding: 4px 10px;
+		box-shadow: inset 2px 2px 2px rgba(0, 0, 0, .3),
+			inset -2px -2px 2px rgba(255, 255, 255, .7),
+			-2px -2px 2px rgba(0, 0, 0, .4);
 	}
 </style>

--
Gitblit v1.9.1