From 7d386fa11990ee87601cfc1faca2d4133245c654 Mon Sep 17 00:00:00 2001
From: qingyiay <2386314947@qq.com>
Date: 星期一, 26 六月 2023 14:30:00 +0800
Subject: [PATCH] 修改后台地址

---
 pages/public-page/forward/forward.vue |  120 ++++++++++++++++++++++++++++--------------------------------
 1 files changed, 56 insertions(+), 64 deletions(-)

diff --git a/pages/public-page/forward/forward.vue b/pages/public-page/forward/forward.vue
index 7466107..0c8c3aa 100644
--- a/pages/public-page/forward/forward.vue
+++ b/pages/public-page/forward/forward.vue
@@ -17,9 +17,9 @@
 		<view v-else-if="roleType == 2" class="notice-bar"><u-notice-bar :text="text1" :fontSize="30"></u-notice-bar></view>
 		<view class="card-main">
 			<view class="card-block">
-				<view class="forward-card" v-for="(val, index) in jhOrderPlanForwardList" :key="val.vid">
-					<u-swipe-action>
-						<u-swipe-action-item :options="options1" @click="deleteGroup(index, val)" :name="val.vid">
+				<u-swipe-action>
+					<u-swipe-action-item :options="options1" v-for="(val, index) in jhOrderPlanForwardList" :key="val.vid" :name="val.vid" @click="deleteGroup(index, val)">
+						<view class="forward-card">
 							<view class="card-content">
 								<u--form labelPosition="left" :model="forwardForm" ref="form1">
 									<u-form-item label="杞彂瀵硅薄" labelWidth="21%" ref="item1" @click="forwardObjectClick(index)">
@@ -37,16 +37,23 @@
 												></u--input>
 											</view>
 											<u-checkbox-group v-model="val.checkboxValue1" placement="column" @change="v => checkboxChange(v, index, val)">
-												<u-checkbox size="30" shape="circle" labelSize="30" label="鍏ㄩ儴杞彂" name="鍏ㄩ儴杞彂" :disabled="val.ischecked"></u-checkbox>
+												<u-checkbox
+													size="30"
+													shape="circle"
+													labelSize="30"
+													label="鍏ㄩ儴杞彂"
+													name="鍏ㄩ儴杞彂"
+													:disabled="val.ischecked"
+													:checked="val.isSelected"
+												></u-checkbox>
 											</u-checkbox-group>
 										</view>
 									</u-form-item>
-									<!-- <u-form-item><u-button text="鍒犻櫎鏈粍" :hairline="false" type="error" @click="deleteGroup(index, val)"></u-button></u-form-item> -->
 								</u--form>
 							</view>
-						</u-swipe-action-item>
-					</u-swipe-action>
-				</view>
+						</view>
+					</u-swipe-action-item>
+				</u-swipe-action>
 			</view>
 		</view>
 
@@ -103,7 +110,7 @@
 		this.orderPlanId = params.orderPlanId;
 		this.$reqGet('forwardList', { OrderPlanId: params.orderPlanId }).then(res => {
 			if (res.data.length !== 0 && this.roleType == 1) {
-				this.jhOrderPlanForwardList = res.data.map(item => {
+				this.jhOrderPlanForwardList = res.data.map((item, index) => {
 					return {
 						id: item.id,
 						orderPlanId: item.orderPlanId,
@@ -112,11 +119,11 @@
 						xsUserId: item.xsUserId === null ? 0 : item.xsUserId,
 						fleetId: item.fleetId === null ? 0 : item.fleetId,
 						checkboxValue1: '',
-						vid: new Date().getTime()
+						vid: `${new Date().getTime()}${index}${item.id}`
 					};
 				});
 			} else if (res.data.length !== 0 && this.roleType == 2) {
-				this.jhOrderPlanForwardList = res.data.map(item => {
+				this.jhOrderPlanForwardList = res.data.map((item, index) => {
 					return {
 						id: item.id,
 						orderPlanId: item.orderPlanId,
@@ -125,16 +132,16 @@
 						xsUserId: item.xsUserId === null ? 0 : item.xsUserId,
 						fleetId: item.fleetId === null ? 0 : item.fleetId,
 						checkboxValue1: '',
-						vid: new Date().getTime()
+						vid: `${new Date().getTime()}${index}${item.id}`
 					};
 				});
 			} else {
-				this.jhOrderPlanForwardList = this.jhOrderPlanForwardList.map(v => {
-					if (!v.orderPlanId) {
+				this.jhOrderPlanForwardList = this.jhOrderPlanForwardList.map((item, index) => {
+					if (!item.orderPlanId) {
 						return {
-							...v,
+							...item,
 							orderPlanId: params.orderPlanId,
-							vid: new Date().getTime()
+							vid: `${new Date().getTime()}${index}${item.id}`
 						};
 					}
 				});
@@ -156,7 +163,8 @@
 					carNum: null,
 					xsUserId: 0,
 					fleetId: 0,
-					checkboxValue1: ''
+					checkboxValue1: '',
+					isSelected: false
 				}
 			],
 			// 绱㈠紩锛屽埄鐢ㄧ储寮曟纭樉绀�
@@ -250,29 +258,6 @@
 				};
 			});
 			if (value.length != 0) {
-				let tempforwardSurplus = this.forwardSurplus;
-				let tempcarNumSurplus1 = this.carNumSurplus1;
-				// if (v.id) {
-				// 	this.$reqGet('jhorderplanforward', { forwardId: v.id }).then(res => {
-				// 		this.personalForward = res.data;
-				// 		// 璁$畻鍏ㄩ儴杞彂鏁�
-				// 		// 瀹㈡埛
-				// 		if (this.roleType == 1) {
-				// 			this.jhOrderPlanForwardList[index].carNum = this.allrelay(this.personalForward.carNum, tempcarNumSurplus1);
-				// 			this.calculate(this.jhOrderPlanForwardList);
-				// 			if (tempcarNumSurplus1 == 0) {
-				// 				this.jhOrderPlanForwardList[index].carNum = this.allrelay(0, this.carNumSurplus1);
-				// 			}
-				// 		}
-				// 		tempcarNumSurplus1 = 0;
-				// 		// 璐т唬
-				// 		if (this.roleType == 2) {
-				// 			this.jhOrderPlanForwardList[index].carNum = this.allrelay(this.personalForward.carNum, tempforwardSurplus);
-				// 		}
-				// 		tempforwardSurplus = 0;
-				// 	});
-				// } else { }
-
 				if (this.roleType == 1) {
 					this.jhOrderPlanForwardList[index].carNum = this.allrelay(this.carNumSurplus1, this.jhOrderPlanForwardList[index].carNum);
 					this.calculate(this.jhOrderPlanForwardList);
@@ -289,7 +274,7 @@
 				});
 				this.whetherClick = true;
 			} else {
-				this.jhOrderPlanForwardList[index].carNum = 0;
+				this.jhOrderPlanForwardList[index].carNum = null;
 				this.calculate(this.jhOrderPlanForwardList);
 			}
 		},
@@ -351,8 +336,8 @@
 			}, 0);
 			console.log(total, '鎻愮叅鍗曚竴鍏辩殑鏁版嵁');
 			if (this.roleType == 1) {
-				if (this.cars2 >= total) {
-					this.carNumSurplus1 = this.cars2 - total;
+				if (Number(this.cars2) >= total) {
+					this.carNumSurplus1 = Number(this.cars2) - total;
 					this.whetherClick = false;
 					this.whetherClick1 = false;
 				} else {
@@ -363,8 +348,8 @@
 				}
 			}
 			if (this.roleType == 2) {
-				if (this.carNum >= total) {
-					this.carNumSurplusHuodai = this.carNum - total;
+				if (Number(this.carNum) >= total) {
+					this.carNumSurplusHuodai = Number(this.carNum) - total;
 					this.whetherClick = false;
 					this.whetherClick1 = false;
 				} else {
@@ -379,20 +364,31 @@
 			let time;
 			let that = this;
 			that.$set(that.jhOrderPlanForwardList[index], 'carNum', Number(value));
-			if (that.roleType == 1) {
-				if (that.jhOrderPlanForwardList[index].carNum < that.carNumSurplus1) {
-					that.jhOrderPlanForwardList[index].checkboxValue1 = '';
-				}
-			}
-			if (that.roleType == 2) {
-				if (that.jhOrderPlanForwardList[index].carNum < that.carNumSurplusHuodai) {
-					that.jhOrderPlanForwardList[index].checkboxValue1 = '';
-				}
-			}
 			return (function() {
 				if (!time) {
 					time = setTimeout(() => {
 						that.calculate(that.jhOrderPlanForwardList);
+						if (that.roleType == 1) {
+							if (that.jhOrderPlanForwardList[index].carNum < Number(that.carNumSurplus1)) {
+								that.$set(that.jhOrderPlanForwardList[index], 'checkboxValue1', '');
+								that.jhOrderPlanForwardList.forEach((v, i) => {
+									if (index != i) {
+										v.ischecked = false;
+									}
+								});
+							}
+						}
+
+						if (that.roleType == 2) {
+							if (that.jhOrderPlanForwardList[index].carNum < Number(that.carNumSurplusHuodai)) {
+								that.$set(that.jhOrderPlanForwardList[index], 'checkboxValue1', '');
+								that.jhOrderPlanForwardList.forEach((v, i) => {
+									if (index != i) {
+										v.ischecked = false;
+									}
+								});
+							}
+						}
 						time = null;
 					}, 800);
 				}
@@ -415,7 +411,8 @@
 					fleetId: 0,
 					checkboxValue1: '',
 					ischecked: false,
-					vid: new Date().getTime()
+					vid: new Date().getTime(),
+					isSelected: false
 				});
 			} else {
 				this.jhOrderPlanForwardList.push({
@@ -426,7 +423,8 @@
 					fleetId: 0,
 					checkboxValue1: '',
 					ischecked: true,
-					vid: new Date().getTime()
+					vid: new Date().getTime(),
+					isSelected: false
 				});
 			}
 			this.calculate(this.jhOrderPlanForwardList);
@@ -462,13 +460,7 @@
 					this.$u.toast('璇疯緭鍏ュ悎娉曟暟瀛�');
 					isPass = false;
 					return isPass;
-				}
-				// else if (Number(v.carNum) > Number(this.forwardSurplus)) {
-				// 	this.$u.toast('瓒呰繃鏈�澶ц鍗曞墿浣欓噺');
-				// 	isPass = false;
-				// 	return isPass;
-				// }
-				else {
+				} else {
 					isPass = true;
 					return isPass;
 				}

--
Gitblit v1.9.1