From 248ef3ba3de9994dc83d2b36690542893f9fb6e6 Mon Sep 17 00:00:00 2001
From: whycq <913841844@qq.com>
Date: 星期四, 28 十一月 2024 16:26:06 +0800
Subject: [PATCH] #

---
 pages/phyz/stationManage/stationManage.vue |  169 +++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 135 insertions(+), 34 deletions(-)

diff --git a/pages/phyz/stationManage/stationManage.vue b/pages/phyz/stationManage/stationManage.vue
index e458353..592f50d 100644
--- a/pages/phyz/stationManage/stationManage.vue
+++ b/pages/phyz/stationManage/stationManage.vue
@@ -1,21 +1,32 @@
 <template>
-	<view>
+	<view style="font-size: 14px;">
 		<view class="code">
 			<uni-search-bar :focus="searchValueFocus" v-model="searchValue"  @input="searchValueInput()"
 				maxlength="500" ancel="cancel" @clear="clear" placeholder="杈撳叆 / 鎵弿 绔欑偣鍙�">
 			</uni-search-bar>
 		</view>
-		<view class="list" style="background-color: #3eb689;color: #fff;" v-if="station">
+		<view class="list" :class="item.style" v-if="stations" v-for="item in stations">
 			<view class="list-left">
-				<view>宸ヤ綅缂栧彿锛歿{station.devNo}}</view>
-				<view>宸ヤ綅鐘舵�侊細{{station.locSts$}}</view>
-				<view>鏉″舰鐮侊細{{station.barcode}}</view>
+				<view>宸ヤ綅缂栧彿锛歿{item.devNo}}</view>
+				<view>绔欑偣鐘舵�侊細{{item.locSts$}}</view>
+				<view>璐ф灦鐮侊細{{item.barcode}}</view>
+				<view>绔欑偣绫诲瀷锛歿{item.locType1$}}</view>
 				<!-- <view class="card-id">{{i + 1}}</view> -->
 			</view>
 			<view class="list-right" @click="getOrderDetl(item)">
 				<uni-icons type="right" color="#fff"></uni-icons>
 			</view>
 		</view>
+		<!-- <view class="list" style="background-color: #3eb689;color: #fff;" v-if="station">
+			<view class="list-left">
+				<view>宸ヤ綅缂栧彿锛歿{station.devNo}}</view>
+				<view>绔欑偣鐘舵�侊細{{station.locSts$}}</view>
+				<view>鏉″舰鐮侊細{{station.barcode}}</view>
+			</view>
+			<view class="list-right" @click="getOrderDetl(item)">
+				<uni-icons type="right" color="#fff"></uni-icons>
+			</view>
+		</view> -->
 		<view class="list" style="background-color: #019fe8;color: #fff;" v-if="wrkMast">
 			<view class="list-left">
 				<view>宸ヤ綔鍙凤細{{wrkMast.wrkNo}}</view>
@@ -41,7 +52,7 @@
 			</view>
 		</view>
 		
-		<view class="list" style="background-color: #fda800;color: #fff;" v-for="wrkMast in waitPakins">
+		<view class="list" style="background-color: #fda800;color: #fff;" v-if="!wrkDetls" v-for="wrkMast in waitPakins">
 			<view class="list-left">
 				<view>鐗╂枡鍙凤細{{wrkMast.matnr}}</view>
 				<view>鐗╂枡鍚嶇О锛歿{wrkMast.maktx}}</view>
@@ -98,27 +109,29 @@
 				searchValueFocus: true,
 				searchValue: '',
 				station: '',
+				stations: [],
 				wrkMast: '',
 				wrkDetls: [],
 				waitPakins: [],
-				barcode: ''
+				barcode: '',
+				option: 'pick'
 			}
 		},
-		onLoad() {
+		onShow() {
 			this.baseUrl = uni.getStorageSync('baseUrl');
 			this.token = uni.getStorageSync('token');
-		},
-		onShow() {
-			
+			this.getBasDevp('all')
+			this.searchValueFocus = true
 		},
 		methods: {
 			searchValueInput() {
 				if (this.searchValue == '') {
 					this.station = ''
+					this.stations = []
 					this.wrkMast = ''
 					this.wrkDetls = []
-				} else {
-					this.getBasDevp()
+				} else if (this.searchValue.length == 7) {
+					this.getBasDevp('one')
 				}
 			},
 			clear() {
@@ -126,7 +139,7 @@
 				this.wrkDetls = []
 			},
 			// 鑾峰彇鏆傚瓨浣�
-			getBasDevp() {
+			getBasDevp(type) {
 				let _this = this
 				uni.request({
 					url: `${_this.baseUrl}/agv/basDevp/list/auth`,
@@ -140,15 +153,31 @@
 					success(res) {
 						res = res.data
 						if (res.code === 200) {
-							for (let item of res.data.records) {
-								_this.station = item
-								if (item.barcode) {
-									_this.getWrkMast(item.barcode)
-									_this.getWaitPakin(item.barcode)
-									
-								} else {
+							if (type == 'all') {
+								for  (let k of res.data.records) {
+									if (k.locSts != 'O') {
+										k['style'] = 'station-wrk'
+									} else {
+										k['style'] = 'station-nowrk'
+									}
 								}
+								_this.stations = res.data.records  
+							} else {
+								res.data.records
+								for (let item of res.data.records) {
+									if (item.locSts != 'O') {
+										item['style'] = 'station-wrk'
+									} else {
+										item['style'] = 'station-nowrk'
+									}
+								}
+								_this.getOrderDetl(res.data.records[0])
 							}
+						} else if (res.code == 403) {
+							uni.showToast({ title: res.msg, icon: "error", position: 'top' })
+							setTimeout(() => { uni.reLaunch({ url: '../../login/login' }); }, 1000);
+						} else {
+							uni.showToast({ title: res.msg, icon: "error", position: 'top' })
 						}
 					}
 				})
@@ -172,6 +201,11 @@
 								_this.waitPakins = res.data.records
 								// _this.getWrkDetl(item.wrkNo)
 							}
+						} else if (res.code == 403) {
+							uni.showToast({ title: res.msg, icon: "error", position: 'top' })
+							setTimeout(() => { uni.reLaunch({ url: '../../login/login' }); }, 1000);
+						} else {
+							uni.showToast({ title: res.msg, icon: "error", position: 'top' })
 						}
 					}
 				})
@@ -195,6 +229,11 @@
 								_this.wrkMast = item
 								_this.getWrkDetl(item.wrkNo)
 							}
+						} else if (res.code == 403) {
+							uni.showToast({ title: res.msg, icon: "error", position: 'top' })
+							setTimeout(() => { uni.reLaunch({ url: '../../login/login' }); }, 1000);
+						} else {
+							uni.showToast({ title: res.msg, icon: "error", position: 'top' })
 						}
 					}
 				})
@@ -215,6 +254,11 @@
 						res = res.data
 						if (res.code === 200) {
 							_this.wrkDetls = res.data.records
+						} else if (res.code == 403) {
+							uni.showToast({ title: res.msg, icon: "error", position: 'top' })
+							setTimeout(() => { uni.reLaunch({ url: '../../login/login' }); }, 1000);
+						} else {
+							uni.showToast({ title: res.msg, icon: "error", position: 'top' })
 						}
 					}
 				})
@@ -227,6 +271,22 @@
 					data: {devNo: e},
 					method: 'POST',
 					success(res) {
+						res = res.data 
+						if (res.code === 200) {
+							_this.searchValue = ''
+							setTimeout(()=> {
+								_this.searchValue = ''
+								_this.station = ''
+								_this.wrkMast = ''
+								_this.wrkDetls = []
+								_this.waitPakins = []
+							},100)  
+						} else if (res.code == 403) {
+							uni.showToast({ title: res.msg, icon: "error", position: 'top' })
+							setTimeout(() => { uni.reLaunch({ url: '../../login/login' }); }, 1000);
+						} else {
+							uni.showToast({ title: res.msg, icon: "error", position: 'top' })
+						}
 					}
 				})
 			},
@@ -240,7 +300,22 @@
 					data: JSON.stringify(devNo),
 					method: 'POST',
 					success(res) {
-						
+						res = res.data
+						if (res.code === 200) {
+							_this.searchValue = ''
+							setTimeout(()=> {
+								_this.searchValue = ''
+								_this.station = ''
+								_this.wrkMast = ''
+								_this.wrkDetls = []
+								_this.waitPakins = []
+							},100)
+						} else if (res.code == 403) {
+							uni.showToast({ title: res.msg, icon: "error", position: 'top' })
+							setTimeout(() => { uni.reLaunch({ url: '../../login/login' }); }, 1000);
+						} else {
+							uni.showToast({ title: res.msg, icon: "error", position: 'top' })
+						}
 					}
 				})
 			},
@@ -269,22 +344,23 @@
 					success(result) {
 						var res = result.data
 						if (res.code === 200) {
+							setTimeout(()=> {
+								that.searchValue = ''
+								that.station = ''
+								that.wrkMast = ''
+								that.wrkDetls = []
+								that.waitPakins = []
+							},300)
 							uni.showToast({
 								title: res.msg,
 								icon: "none",
 								position: 'top'
 							})
 						} else if (res.code == 403) {
-							that.messageText = res.msg
-							that.messageToggle('error')
-							setTimeout(() => {
-								uni.reLaunch({
-									url: '../login/login'
-								});
-							}, 1000);
+							uni.showToast({ title: res.msg, icon: "error", position: 'top' })
+							setTimeout(() => { uni.reLaunch({ url: '../../login/login' }); }, 1000);
 						} else {
-							that.messageText = res.msg
-							that.messageToggle('error')
+							uni.showToast({ title: res.msg, icon: "error", position: 'top' })
 						}
 					}
 				});
@@ -303,9 +379,26 @@
 			reviseConfirm() {
 				this.startPakin('empty')
 				this.$refs.revise.close()
-				setTimeout(()=> {
-					this.getBasDevp()
-				},300)
+			},
+			// 鍓嶅線绔欑偣鏄庣粏椤甸潰
+			getOrderDetl(e) {
+				let _this = this
+				uni.navigateTo({
+					url: "./stationDetl",
+					success: function(res) {
+						// 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�   鍚戝彟澶栦竴涓〉闈紶閫掑�肩殑
+						res.eventChannel.emit('item', {
+							item: e
+						})
+						_this.searchValue = ''
+					},
+					events: {
+						// 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹�  鍙﹀涓�涓〉闈紶杩囨潵鐨�
+						acceptDataFromOpenedPage: function(data) {
+							_this.searchValueFocus = true
+						}
+					},
+				});
 			}
 		}
 	}
@@ -389,4 +482,12 @@
 		align-items: center;
 		color: #409EFF;
 	}
+	.station-wrk {
+		background-color: #ff7356;
+		color: #fff;
+	}
+	.station-nowrk {
+		background-color: #3eb689;
+		color: #fff;
+	}
 </style>
\ No newline at end of file

--
Gitblit v1.9.1