From 435036a0ccc171f00679f5db0b1922a098fcf2f2 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期五, 17 十月 2025 10:36:20 +0800
Subject: [PATCH] 核磅录入的字段映射

---
 pages/wareHouse/nuclearScale/nuclearScaleList.vue |   98 ++++++++++++++++++++++++++++++++++---------------
 pages/wareHouse/nuclearScale/index.vue            |    6 +-
 2 files changed, 71 insertions(+), 33 deletions(-)

diff --git a/pages/wareHouse/nuclearScale/index.vue b/pages/wareHouse/nuclearScale/index.vue
index 67c4524..60cdbf1 100644
--- a/pages/wareHouse/nuclearScale/index.vue
+++ b/pages/wareHouse/nuclearScale/index.vue
@@ -258,9 +258,9 @@
       modalList: {},
       showModal: false,
       productTypeMap: {
-        1: "瀵间綋",
-        2: "閾滄潌",
-        3: "瀵间綋2.6",
+        DTO1: "瀵间綋",
+        TG01: "閾滄潌",
+        DT02: "瀵间綋2.6",
       },
       ScanCodeRecord: [],
       background: {
diff --git a/pages/wareHouse/nuclearScale/nuclearScaleList.vue b/pages/wareHouse/nuclearScale/nuclearScaleList.vue
index d862c3e..80fc44c 100644
--- a/pages/wareHouse/nuclearScale/nuclearScaleList.vue
+++ b/pages/wareHouse/nuclearScale/nuclearScaleList.vue
@@ -90,7 +90,8 @@
 									<view class="_label-name">鐢熶骇杞﹂棿锛�</view>
 								</view>
 								<view class="_content">
-									{{ item.workshop }}
+									{{ workshopList[item.workshop] || item.workshop }}
+									<!-- {{ item.workshop }} -->
 								</view>
 							</view>
 							<view class="row-list">
@@ -140,27 +141,31 @@
 				total: 0,
 				pageNum: 1,
 				pageSize: 10,
-				status: 'loading',
-			isLoading: false,
+				status: "loading",
+				isLoading: false,
 				loadText: {
 					loadmore: "鍔犺浇鏇村...",
 					loading: "鍔姏鍔犺浇涓�...",
 					nomore: "娌℃湁鏇村浜�",
 				},
+				workshopList: {}, // 鏀逛负瀵硅薄
 			};
+		},
+		onReady() {
+			this.fetchWorkshops();
 		},
 		onLoad() {
 			this.getlist();
-  },
-	onShow() {
+		},
+		onShow() {
 			this.getlist();
 		},
 		methods: {
 			//鍒涘缓鏍搁攢鍗�
 			openCreateWriteOffForm() {
 				uni.navigateTo({
-					url: '/pages/wareHouse/nuclearScale/createwriteoffform'
-				})
+					url: "/pages/wareHouse/nuclearScale/createwriteoffform",
+				});
 			},
 			getmoreList() {
 				if (this.pageSize >= this.total) {
@@ -168,7 +173,7 @@
 					return;
 				}
 				this.isLoading = true;
-			this.status = "loading";
+				this.status = "loading";
 				setTimeout(() => {
 					this.pageSize += this.pageSize;
 					this.getlist();
@@ -176,10 +181,9 @@
 			},
 			getlist() {
 				this.isLoading = true;
-				this.$u.api.NuclearScaleEntry
-					.getWeighingOrder({
+				this.$u.api.NuclearScaleEntry.getWeighingOrder({
 						current: this.pageNum,
-						size: this.pageSize
+						size: this.pageSize,
 					})
 					.then((res) => {
 						this.handleListResponse(res);
@@ -210,8 +214,7 @@
 					this.list = [];
 					this.pageSize = 10;
 					this.isLoading = true;
-					this.$u.api.NuclearScaleEntry
-						.getWeighingOrder({
+					this.$u.api.NuclearScaleEntry.getWeighingOrder({
 							current: this.pageNum,
 							size: this.pageSize,
 							verificationNo: value,
@@ -232,24 +235,27 @@
 
 			// 宸ュ叿鏂规硶
 			handleListResponse(res) {
-				console.log('API Response:', res);
-				console.log('Response Code:', res.code);
-				console.log('Response Data:', res.data);
-				console.log('Response Records:', res.data ? res.data.records : 'res.data is undefined');
+				console.log("API Response:", res);
+				console.log("Response Code:", res.code);
+				console.log("Response Data:", res.data);
+				console.log(
+					"Response Records:",
+					res.data ? res.data.records : "res.data is undefined"
+				);
 
 				if (res.code != 0) {
 					uni.showToast({
-						title: res.msg || '鑾峰彇鏁版嵁澶辫触',
-						icon: 'none'
+						title: res.msg || "鑾峰彇鏁版嵁澶辫触",
+						icon: "none",
 					});
 					return;
 				}
 
 				if (!res.data) {
-					console.error('res.data is undefined');
+					console.error("res.data is undefined");
 					uni.showToast({
-						title: '鏁版嵁鏍煎紡閿欒',
-						icon: 'none'
+						title: "鏁版嵁鏍煎紡閿欒",
+						icon: "none",
 					});
 					return;
 				}
@@ -260,17 +266,17 @@
 			},
 
 			handleApiError(err) {
-				console.error('API璇锋眰澶辫触:', err);
+				console.error("API璇锋眰澶辫触:", err);
 				uni.showToast({
-					title: '缃戠粶寮傚父锛岃绋嶅悗閲嶈瘯',
-					icon: 'none'
+					title: "缃戠粶寮傚父锛岃绋嶅悗閲嶈瘯",
+					icon: "none",
 				});
 			},
 			formatProductType(type) {
 				const productTypeMap = {
-					1: '瀵间綋',
-					2: '閾滄潌',
-					3: '瀵间綋2.6'
+					DTO1: "瀵间綋",
+					TG01: "閾滄潌",
+					DT02: "瀵间綋2.6",
 				};
 				return productTypeMap[type] || type;
 			},
@@ -295,6 +301,38 @@
 					delta: 1,
 				});
 			},
+			/**
+			 * 鑾峰彇杞﹂棿鍒楄〃
+			 */
+			fetchWorkshops() {
+				this.$u.api
+					.dictData({
+						dictType: "workshop",
+					})
+					.then((res) => {
+						console.log("鑾峰彇杞﹂棿鍒楄〃鍝嶅簲:", res);
+						if (res.code === 0 && res.data.length > 0) {
+							// 鏀逛负瀵硅薄鏄犲皠锛岄敭涓鸿溅闂寸紪鐮侊紝鍊间负杞﹂棿鍚嶇О
+							const workshopMap = {};
+							res.data.forEach((i) => {
+								workshopMap[i.value] = i.label;
+							});
+							this.workshopList = workshopMap;
+						} else {
+							uni.showToast({
+								title: res.msg || "鑾峰彇杞﹂棿鍒楄〃澶辫触",
+								icon: "none",
+							});
+						}
+					})
+					.catch((err) => {
+						uni.showToast({
+							title: "缃戠粶閿欒锛岃幏鍙栬溅闂村垪琛ㄥけ璐�",
+							icon: "none",
+						});
+						console.error("鑾峰彇杞﹂棿鍒楄〃閿欒:", err);
+					});
+			},
 		},
 	};
 </script>
@@ -318,7 +356,6 @@
 		font-size: 50px;
 		position: relative;
 		bottom: 4px;
-
 	}
 
 	.finishProductIn-locno-bg {
@@ -343,7 +380,8 @@
 	.wrap .finishProductIn-locno-scroll-list {
 		height: calc(100vh - var(--window-top, 0) - var(--window-bottom, 0) - 242rpx);
 		width: 100%;
-		min-height: 300rpx; /* 娣诲姞鏈�灏忛珮搴︾‘淇濆厓绱犲缁堝彲瑙� */
+		min-height: 300rpx;
+		/* 娣诲姞鏈�灏忛珮搴︾‘淇濆厓绱犲缁堝彲瑙� */
 	}
 
 	.finishProductIn-locno-scroll-list-group {

--
Gitblit v1.9.3