From 5a4e4f0ac1e40f45ce4e78b1ae57637c84a64fc7 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期四, 26 十月 2023 13:34:46 +0800
Subject: [PATCH] 添加统计日志

---
 minipro_standard/pages_adjust/pages/manualFeed/manualFeed.vue |   72 ++++++++++++++++++++++++++----------
 1 files changed, 52 insertions(+), 20 deletions(-)

diff --git a/minipro_standard/pages_adjust/pages/manualFeed/manualFeed.vue b/minipro_standard/pages_adjust/pages/manualFeed/manualFeed.vue
index e500034..1e7d32f 100644
--- a/minipro_standard/pages_adjust/pages/manualFeed/manualFeed.vue
+++ b/minipro_standard/pages_adjust/pages/manualFeed/manualFeed.vue
@@ -41,13 +41,18 @@
 					<div class="tl_list_item">
 						<div class="tl_list_item_label">鎶曟枡鏁伴噺{{ item.unitAttribute }}</div>
 						<div class="tl_list_item_go">
-							<input type="text" @blur="changeNumber(item.num, index, item.unitAttribute)"
+							<input type="text"  @blur="changeNumber(item.num, index, item.unitAttribute)"
 								v-model="item.num" />
 						</div>
 					</div>
 				</div>
 			</u-swipe-action-item>
 		</u-swipe-action>
+		<view class="" style="height: 88rpx;"></view>
+		<u-safe-bottom></u-safe-bottom>
+		<div class="tl_footer">
+			<button class="tl_footer_submit" v-preventReClick @click="submit">鎻愪氦</button>
+		</div>
 		<SelectMaterial ref="selectMaterial" @selectAction="getValue" />
 		<!-- <SelectMultipleMaterial ref="selectMultipleMaterial" @selected="getMaterails"/> -->
 	</view>
@@ -148,35 +153,28 @@
 					unitAttribute: ''
 				})
 			},
-			changeNumber(num, index, unitAttribute) {
+			changeNumber(num, index, unitAttribute) {
+				
 				if (unitAttribute === 0 && num !== '') {
 					if (!positiveInteger.test(num)) {
-						uni.$u.toast({
-							message: '鍙兘杈撳叆姝f暣鏁�'
-						})
+						uni.$u.toast('鍙兘杈撳叆姝f暣鏁�')
 						this.materialList[index].num = ''
 					}
 				} else if (unitAttribute === 1 && num !== '') {
 					if (!number.test(num)) {
-						uni.$u.toast({
-							message: '鍙兘杈撳叆姝f暣鏁版垨灏忔暟锛堟渶澶氬洓浣嶏級'
-						})
+						uni.$u.toast('鍙兘杈撳叆姝f暣鏁版垨灏忔暟锛堟渶澶氬洓浣嶏級')
 						this.materialList[index].num = ''
 					}
 				}
 				if (num <= 0) {
-					uni.$u.toast({
-						message: '鎶曟枡鏁伴噺涓嶈兘灏忎簬绛変簬0'
-					})
+					uni.$u.toast('鎶曟枡鏁伴噺涓嶈兘灏忎簬绛変簬0')
 					this.materialList[index].num = ''
 				}
 			},
-			getValue(v) {
+			getValue(item) {
 				for (let i = 0; i < this.materialList.length; i++) {
 					if (item.id === this.materialList[i].id) {
-						uni.$u.toast({
-							message: '涓嶈兘閲嶅閫夋嫨鐩稿悓鐗╂枡'
-						})
+						uni.$u.toast('涓嶈兘閲嶅閫夋嫨鐩稿悓鐗╂枡')
 						return
 					}
 				}
@@ -190,9 +188,42 @@
 				this.materialList[this.index].qualityType = item.qualityType
 				this.materialList[this.index].unitAttribute = item.unitAttribute
 			},
-			// getMaterails({materials}) {
-			// 	console.log(item);
-			// }
+			submit() {
+				let temp = this.materialList.findIndex(item => !item.id || !item.num)
+				if (temp != -1) {
+					uni.$u.toast(`璇峰厛瀹屽杽绗�${temp + 1}鏉℃姇鏂欎俊鎭痐)
+					return
+				}
+				let total = this.materialList.reduce((accumulator, currentValue) => accumulator + Number(currentValue.num),
+					0)
+				console.log(total);
+				if (this.info.bomType != 1 && this.info.hasBom != 1) {
+					if (total > this.info.planNum) {
+						uni.$u.toast(`鎶曟枡鏁伴噺涓嶈兘澶т簬璁″垝鏁伴噺`)
+						return
+					}
+				}
+				let recordList = this.materialList.map(item => {
+					return {
+						wstockId: item.id,
+						num: item.num
+					}
+				})
+				createMaterialStandard({
+					id: this.workorderId,
+					recordList
+				}).then(res => {
+					if (res.code === 200) {
+						// Toast.success({ message: '鎶曟枡鎴愬姛', duration: 2000, forbidClick: true })
+						// setTimeout(() => {
+						//   router.go(-1)
+						// }, 2000)
+						uni.$u.toast(`鎶曟枡鎴愬姛`)
+						uni.$emit('addMaterial')
+						uni.navigateBack()
+					}
+				})
+			}
 		}
 	}
 </script>
@@ -341,9 +372,10 @@
 			width: 100%;
 			position: fixed;
 			bottom: 0;
-			left: 0;
-			padding: 0 30rpx 68rpx 30rpx;
+			padding: 0 30rpx calc(env(safe-area-inset-bottom) + 20rpx);
 			box-sizing: border-box;
+			z-index: 999;
+			background-color: #fff;
 
 			.tl_footer_submit {
 				width: 690rpx;

--
Gitblit v1.9.3