From f26f29d84e0a68831a6af14dab3eec5500496d2e Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 28 五月 2025 16:48:52 +0800
Subject: [PATCH] 初始化项目

---
 pages/product/outputRegister/workstationList.vue |  156 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 156 insertions(+), 0 deletions(-)

diff --git a/pages/product/outputRegister/workstationList.vue b/pages/product/outputRegister/workstationList.vue
new file mode 100644
index 0000000..036ea00
--- /dev/null
+++ b/pages/product/outputRegister/workstationList.vue
@@ -0,0 +1,156 @@
+<template>
+	<view class="wrap">
+		<view class="search">
+			<u-search v-model="query.workstationNo" placeholder="璇疯緭鍏ュ伐浣滅珯缂栧彿" @clear="search" @custom="search" @search="search">
+			</u-search>
+		</view>
+		<scroll-view class="scroll-list" scroll-y="true" @scrolltolower="loadMore">
+
+			<u-cell-group class="list" :border="false">
+				<view class="content" v-for="(item, index) in workStationList" :key="item.workstationNo" :index="index"
+					@click="selectWorkstation(item)">
+					<view class="row-list">
+						<span class="span-lable">宸ヤ綔绔欑紪鍙�: </span>{{ item.workstationNo }}
+					</view>
+					<view class="row-list">
+						<span class="span-lable">宸ヤ綔绔欏悕绉�: </span>{{ item.name }}
+					</view>
+					<view class="row-list">
+						<span class="span-lable">澶囨敞: </span>{{ item.remark }}
+					</view>
+				</view>
+			</u-cell-group>
+			<view class="loadmore" @click="loadMore">
+				<u-loadmore :status="loadStatus"></u-loadmore>
+			</view>
+		</scroll-view>		
+		<scan></scan>
+	</view>
+</template>
+<script>
+	import scan from "@/components/scan/scan.vue";
+	export default {
+		components: {
+		   scan
+		  },
+		data() {
+			return {
+				query: {
+					current: 1,
+					size: 20
+				},
+				workStationList: [],
+				loadStatus: 'loadmore',
+			};
+		},
+		onLoad() {
+			this.loadList();
+		},
+		onShow() {
+			let that = this
+			  
+			uni.$off('scan') // 姣忔杩涙潵鍏� 绉婚櫎鍏ㄥ眬鑷畾涔変簨浠剁洃鍚櫒
+			uni.$on('scan', function(data) {
+			 console.log('onscan');
+			 //鎵爜鎴愬姛鍚庣殑鍥炶皟锛屼綘鍙互鍐欒嚜宸辩殑閫昏緫浠g爜鍦ㄨ繖閲�
+			 console.log('鎵爜缁撴灉锛�', data.code);
+				let sanCode=data.code
+				let formatData = JSON.parse(sanCode.replace(/\n/g,"").replace(/\s*/g,''));
+				// console.log('formatData锛�', formatData);
+				// console.log('formatData.lot_batch_no锛�', formatData.workstation);
+				
+				if(formatData.workstation!=""||formatData.workstation!=undefined)
+				{
+					that.findWorkstation(formatData.workstation)
+				}
+						
+			})
+		},
+		onNavigationBarButtonTap(e) {
+			uni.scanCode({
+				success: res => {
+					try {
+						const result = JSON.parse(res.result)
+		
+					} catch (e) {}
+				}
+			});
+		},
+		methods: {
+			findWorkstation(workstationNo){
+				let queryParam={
+					current:1,
+					size:20,
+					workstationNo:workstationNo
+				}
+				this.$u.api.outputRegister.fetchWorkstationList(queryParam).then(res => {
+					if (!res.data.records || res.data.records.length == 0) {
+						this.$u.toast('鏈壘鍒板搴斿伐浣滅珯');
+					}else{
+						this.selectWorkstation(res.data.records[0])
+					}
+				});
+			},
+			loadMore() {
+				this.loadStatus = "loading";
+				setTimeout(() => {
+					this.query.current += 1;
+					this.loadList();
+				}, 100);
+			},
+			loadList() {
+				// 鏌ヨ宸ヤ綔绔欏垪琛�
+				this.$u.api.outputRegister.fetchWorkstationList(this.query).then(res => {
+					if (!res.data.records || res.data.records.length == 0) {
+						this.loadStatus = "nomore";
+						return;
+					}
+				
+					this.workStationList = this.workStationList.concat(res.data.records);
+					this.total = res.data.total;
+					this.query.current = res.data.current;
+					this.query.size = res.data.size;
+					this.loadStatus = "loadmore";
+				});
+			},
+			search(value) {
+				this.workStationList = [];
+				this.query.current = 1;
+				this.query.workstationNo = value;
+				this.loadList();
+			},
+			selectWorkstation(workstation) {
+				this.refreshLastPage(workstation)
+			},
+
+			//鍒锋柊涓婁竴涓〉闈�
+			refreshLastPage(workstation) {
+				// 鍛婄煡 A.vue 鏇存柊鏁版嵁
+				// 鑾峰彇椤甸潰鏍�
+				let pages = getCurrentPages()
+
+				// 鑾峰彇涓婁竴椤垫爤
+				let prevPage = pages[pages.length - 2]
+
+				// 瑙﹀彂涓婁竴椤� upData 鍑芥暟(骞舵惡甯﹀弬鏁�)
+				prevPage.$vm.setWorkstation(workstation)
+
+				// 杩斿洖涓婁竴椤�
+				uni.navigateBack({
+					delta: 1
+				})
+			}
+		}
+	};
+</script>
+<style lang="scss">
+	.list .content {
+		font-size: 12px;
+		background-color: #efefef;
+		box-sizing: border-box;
+		border-radius: 14rpx;
+		margin: 8px;
+		padding: 5px 10px;
+		box-shadow: none;
+	}
+</style>

--
Gitblit v1.9.3