From 88a34566f7c3f77d90daa3fd57fb0abca3e1b5e6 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期四, 27 二月 2025 09:12:06 +0800
Subject: [PATCH] ll

---
 pda/pages/index/center.vue |  259 ++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 173 insertions(+), 86 deletions(-)

diff --git a/pda/pages/index/center.vue b/pda/pages/index/center.vue
index 54774e0..74990cb 100644
--- a/pda/pages/index/center.vue
+++ b/pda/pages/index/center.vue
@@ -39,8 +39,12 @@
 				</view>
 				<view class="line" v-else>
 					<text class="label">鍚堝悓鍗曞彿</text>
-					<text class="value">{{ item.contractNum }}</text>
+					<text class="value">{{ item.contractNum }}</text>
 					<text class="primaryColor" @click="subDetail(item)">棰勭害璇︽儏</text>
+				</view>
+				<view class="line line2" v-if="item.billCode && item.wmsContractNum">
+					<text class="label">鍚堝悓鍗曞彿</text>
+					<text class="value">{{ item.wmsContractNum }}</text>
 				</view>
 				<view class="line">
 					<text class="label">椹鹃┒鍛�</text>
@@ -48,7 +52,7 @@
 				</view>
 				<view class="line">
 					<text class="label">鎬昏繍杈撻噺</text>
-					<text class="value">{{ item.totalNum }}涓囨敮</text>
+					<text class="value">{{ item.totalNum || item.ioQty}}涓囨敮</text>
 				</view>
 				<view class="line" v-if="item.carrierName">
 					<text class="label">杩愯緭鍏徃</text>
@@ -82,6 +86,10 @@
 					<u-icon name="search" class="mr12" size="19" color="#999999" />
 					<input v-model="platformCallSearch" type="text" placeholder="鎼滅储杞﹁締鐗岀収" placeholder-class="placeholder9"
 						@confirm="callQuery" />
+				</view>
+				<view v-if="platformCallList.length == 0" class="empty_wrap">
+					<image src="@/static/default_nodata@2x.png" />
+					<text>鏆傛棤鎺掗槦杞﹁締</text>
 				</view>
 				<view class="order_list">
 					<scroll-view scroll-y="true" @scrolltolower="callScrolltolower" class="scroll_view">
@@ -104,8 +112,12 @@
 							</view>
 							<view class="line" v-else>
 								<text class="label">鍚堝悓鍗曞彿</text>
-								<text class="value">{{ item.contractNum }}</text>
+								<text class="value">{{ item.contractNum }}</text>
 								<text class="primaryColor" @click="subDetail(item)">棰勭害璇︽儏</text>
+							</view>
+							<view class="line line2" v-if="item.billCode && item.wmsContractNum">
+								<text class="label">鍚堝悓鍗曞彿</text>
+								<text class="value">{{ item.wmsContractNum }}</text>
 							</view>
 							<view class="line">
 								<text class="label">椹鹃┒鍛�</text>
@@ -113,7 +125,7 @@
 							</view>
 							<view class="line">
 								<text class="label">鎬昏繍杈撻噺</text>
-								<text class="value">{{ item.totalNum }}涓囨敮</text>
+								<text class="value">{{ item.totalNum || item.ioQty }}涓囨敮</text>
 							</view>
 							<view class="line" v-if="item.carrierName">
 								<text class="label">杩愯緭鍏徃</text>
@@ -182,9 +194,8 @@
 			<view class="TransformModal">
 				<view class="title">杞Щ鏈堝彴</view>
 				<view class="transform_list">
-					<view class="line" @click="transformPlatClick(item)" v-for="item in TransferList"
-						:key="item.id">
-						<view class="name">{{ item.name }}</view>
+					<view class="line" @click="transformPlatClick(item)" v-for="item in TransferList" :key="item.id">
+						<view class="name">{{ item.name  || item.platformName}}</view>
 						<view class="status" :class="{ green: item.workStatus == 1 }">({{ item.workStatus == 0 ? "绌洪棽" : "浣滀笟涓�" }})
 						</view>
 						<image v-if="transformPlatId == item.id" src="@/static/ic_select@2x.png" class="checked" />
@@ -245,28 +256,47 @@
 				callType: 1,
 
 				transformPlatId: '', // 杞Щ璁板綍鏈堝彴id
-				transformId: '', // 杞Щ璁板綍浠诲姟id
+				transformId: '', // 杞Щ璁板綍浠诲姟id
 				TransferList: [],
-				wmsInfo: {},
-				timer: null
+				wmsInfo: {},
+				timer: null,
+				timer1: null,
 			}
 		},
 		onLoad() {
 			this.getPlatformGroup()
-			// setInterval(() => {
-			// 	this.getPlatformGroup()
-			// }, 1000 * 30)
+		},
+		onHide(){
+			if(this.timer1){
+				clearInterval(this.timer1)
+			}
+			if(this.timer){
+				clearInterval(this.timer)
+			}
+		},
+		onUnload(){
+			if(this.timer1){
+				clearInterval(this.timer1)
+			}
+			if(this.timer){
+				clearInterval(this.timer)
+			}
 		},
-		methods: {
-			getTransferList() {
-				getPlatformWorkData({
-					platformId: this.activePlatform.id
-				}).then(res => {
-					console.log('res.data', res.data);
-					if(res.data && res.data.platformJobList){
-						this.TransferList = res.data.platformJobList
-					}
-				})
+		methods: {
+			getTransferList() {
+				getPlatformGroupList({
+					queryData: 1,
+					queryType: 1
+				}).then(res => {
+					const platformGroupList = res.data || []
+					if (platformGroupList.length > 0) {
+						const {
+							activePlatformGroup
+						} = this
+						const temp = platformGroupList.find(i => i.id === activePlatformGroup.id)
+						this.TransferList = temp.platformList || []
+					}
+				})
 			},
 			getPlatformGroup() {
 				getPlatformGroupList({
@@ -277,45 +307,60 @@
 					if (this.platformGroupList.length > 0) {
 						this.activePlatformGroup = this.platformGroupList[0]
 						if (this.activePlatformGroup.platformList && this.activePlatformGroup.platformList.length > 0) {
-							this.activePlatform = this.activePlatformGroup.platformList[0]
-							this.getPlatformTask()
-							this.timer = setInterval(() => {	
-								this.getPlatformTask()
-							}, 60 * 1000)
+							this.activePlatform = this.activePlatformGroup.platformList[0]
+							this.getPlatformTask()
+							this.timer = setInterval(() => {
+								this.getPlatformTask()
+							}, 120 * 1000)
 						}
 					}
 				})
 			},
 			getPlatformTask() {
-				uni.showLoading({title:"鍔犺浇涓�..."})
+				if(this.timer1){
+					clearInterval(this.timer1)
+				}
 				getPlatformWorkData({
 					platformId: this.activePlatform.id
-				}).then(res => {
-					uni.hideLoading()
-					this.platformTaskInfo = res.data
-					this.circulInitTaskList()
-					setInterval(() => {
-						this.circulInitTaskList()
+				}).then(res => {
+					this.platformTaskInfo = res.data
+					this.currentDate = new Date(res.data.currentDate).getTime()
+					this.circulInitTaskList()
+					this.currentDate = this.currentDate + 1000
+					this.timer1 = setInterval(() => {
+						this.circulInitTaskList()
+						this.currentDate = this.currentDate + 1000
 					}, 1000)
-				}, () => {
-					uni.hideLoading()
-				})
+				}, () => {})
 			},
-			circulInitTaskList() {
+			circulInitTaskList() {
+				let time = this.currentDate
 				if (this.platformTaskInfo && this.platformTaskInfo.platformJobList && this.platformTaskInfo.platformJobList
 					.length > 0) {
-					let time = new Date()
-					this.platformTaskInfo.platformJobList.forEach(item => {
-						if (item.newCallDate) {
-							let timeNum = time.getTime() - new Date(item.newCallDate).getTime()
+					this.platformTaskInfo.platformJobList.forEach(item => {
+						if(item.wmsContractNum){
+							item.wmsContractNum = item.wmsContractNum.split(',').join('锛�')
+						}
+						if (item.newCallDate) {
+							let timeNum = 0
+							if(time > new Date(item.newCallDate).getTime()){
+								timeNum = time - new Date(item.newCallDate).getTime()
+							}else{
+								timeNum = 0
+							}
 							if (timeNum > 3600000) {
 								item.callDateTemp = dayjs.duration(timeNum).format('H灏忔椂m鍒唖绉�')
 							} else {
 								item.callDateTemp = dayjs.duration(timeNum).format('m鍒唖绉�')
 							}
 						}
-						if (item.newStartDate) {
-							let timeNum = time.getTime() - new Date(item.newStartDate).getTime()
+						if (item.newStartDate) {
+							let timeNum = 0
+							if(time > new Date(item.newStartDate).getTime()){
+								timeNum = time - new Date(item.newStartDate).getTime()
+							}else{
+								timeNum = 0
+							}
 							if (timeNum > 3600000) {
 								item.startDateTemp = dayjs.duration(timeNum).format('H灏忔椂m鍒唖绉�')
 							} else {
@@ -330,11 +375,11 @@
 				const index = e.indexs[0]
 				this.activePlatformGroup = this.platformGroupList[index]
 				if (this.activePlatformGroup.platformList && this.activePlatformGroup.platformList.length > 0) {
-					this.activePlatform = this.activePlatformGroup.platformList[0]
-					this.getPlatformTask()
-					clearInterval(this.timer)
-					this.timer = setInterval(() => {
-						this.getPlatformTask()
+					this.activePlatform = this.activePlatformGroup.platformList[0]
+					this.getPlatformTask()
+					clearInterval(this.timer)
+					this.timer = setInterval(() => {
+						this.getPlatformTask()
 					}, 60 * 1000)
 				}
 				this.showPlatformgroup = false
@@ -350,26 +395,30 @@
 					this.wmsInfo = res.data
 					this.showDetail = true
 				})
-			},
-			subDetail(item) {
-				uni.navigateTo({
-				  url: `/pages/index/SubDetail?id=${item.bookId}`
-				})
+			},
+			subDetail(item) {
+				uni.navigateTo({
+					url: `/pages/index/SubDetail?id=${item.bookId}`
+				})
 			},
 			handleFinish(item) {
 				finishWork({
 					jobId: item.id
 				}).then(res => {
-					this.showToast('瀹屾垚浣滀笟')
-					this.getPlatformTask()
+						if (res && res.code == 200) {
+							this.showToast('瀹屾垚浣滀笟')
+							this.getPlatformTask()
+						}
 				})
 			},
 			handleWork(item) { // 寮�濮嬩綔涓�
 				beginWork({
 					jobId: item.id
 				}).then(res => {
-					this.showToast('宸插紑濮嬩綔涓�')
-					this.getPlatformTask()
+					if (res && res.code == 200) {
+						this.showToast('宸插紑濮嬩綔涓�')
+						this.getPlatformTask()
+					}
 				})
 			},
 			handlePass(item) {
@@ -400,18 +449,24 @@
 					platformInPark({
 						jobId: item.id,
 						platformId: activePlatform.id
-					}).then(res => {
-						this.showToast('鍙彿鎴愬姛')
-						this.getPlatformCallList()
+					}).then(res => {
+						if (res && res.code == 200) {
+							this.showToast('鍙彿鎴愬姛')
+							this.getPlatformCallList()
+						}
+						
 					})
 				} else { // 鏈堝彴鍙彿
 					platformCallNumber({
 						platformId: activePlatform.id,
 						jobId: item.id
-					}).then(res => {
-						this.showToast('鍙彿鎴愬姛')
-						this.getPlatformCallList()
-						this.getPlatformTask()
+					}).then(res => {
+						if (res && res.code == 200) {
+							this.showToast('鍙彿鎴愬姛')
+							this.getPlatformCallList()
+							this.getPlatformTask()
+						}
+						
 					})
 				}
 			},
@@ -454,7 +509,12 @@
 					page: platformCallPage
 				}).then(res => {
 					if (res.data && res.data.records) {
-						this.platformCallList = [...this.platformCallList, ...res.data.records]
+						this.platformCallList = [...this.platformCallList, ...res.data.records]
+						this.platformCallList.forEach(item => {
+							if(item.wmsContractNum){
+								item.wmsContractNum = item.wmsContractNum.split(',').join('锛�')
+							}
+						})
 						this.platformCallTotal = res.data.total
 					}
 				})
@@ -485,7 +545,7 @@
 					activePlatform
 				} = this
 				this.transformId = item.id
-				this.transformPlatId = activePlatform.id
+				this.transformPlatId = activePlatform.id
 				this.getTransferList()
 				this.showTransform = true
 			},
@@ -508,6 +568,10 @@
 	}
 </script>
 <style lang="scss">
+	page {
+		background-color: #f1f2f2;
+	}
+
 	.main_app {
 		padding: 0rpx;
 		height: calc(100vh - 44px);
@@ -525,18 +589,20 @@
 				flex-wrap: wrap;
 
 				.item {
-					width: 210rpx;
+					width: 220rpx;
 					height: 80rpx;
-					display: flex;
-					justify-content: center;
-					align-items: center;
+					line-height: 80rpx;
+					text-align: center;
 					background: #ffffff;
 					border-radius: 8rpx;
 					border: 1rpx solid #999999;
 					font-size: 30rpx;
 					color: #222222;
-					margin-bottom: 20rpx;
-					margin-right: 30rpx;
+					margin-bottom: 15rpx;
+					margin-right: 15rpx;
+					white-space: nowrap;
+					overflow: hidden;
+					text-overflow: ellipsis;
 
 					&:nth-of-type(3n) {
 						margin-right: 0;
@@ -614,6 +680,7 @@
 						justify-content: center;
 						align-items: center;
 						height: 100%;
+
 						&:nth-of-type(1) {
 							background: #e9f5f6;
 							padding: 0 12rpx;
@@ -644,12 +711,15 @@
 				margin-bottom: 20rpx;
 
 				.label {
-					width: 144rpx;
-					color: #666666;
+					width: 132rpx;
+					color: #666666;
+					flex-shrink: 0;
 				}
 
 				.value {
-					flex: 1;
+					flex: 1;
+					display: flex;
+					flex-wrap: wrap;
 				}
 			}
 
@@ -717,7 +787,7 @@
 	.PlatformCallModal {
 		height: calc(100vh - 44px);
 		padding: 30rpx;
-		
+
 		.title {
 			text-align: center;
 			margin: 0 0 30rpx;
@@ -736,6 +806,7 @@
 		.order_list {
 			height: calc(100% - 160rpx);
 			margin-top: 20rpx;
+
 			.scroll_view {
 				height: 100%;
 			}
@@ -743,7 +814,8 @@
 			.platform_ing {
 				border-radius: 8rpx;
 				border: 1rpx solid #dfe2e8;
-				&:nth-of-type(1){
+
+				&:nth-of-type(1) {
 					margin-top: 0;
 				}
 			}
@@ -788,7 +860,8 @@
 					.label {
 						font-size: 28rpx;
 						color: #666666;
-						width: 88rpx;
+						width: 88rpx;
+						flex-shrink: 0;
 					}
 
 					.value {
@@ -902,6 +975,7 @@
 		padding: 36rpx 30rpx;
 		border-radius: 12rpx;
 		box-shadow: 0 0 6rpx rgba(0, 0, 0, 0.5);
+
 		.modal_title {
 			font-weight: 600;
 			font-size: 32rpx;
@@ -910,37 +984,46 @@
 			text-align: center;
 			margin-bottom: 36rpx;
 		}
-		.contract_wrap{
-			height: calc( 100% - 400rpx );
+
+		.contract_wrap {
+			height: calc(100% - 400rpx);
 			overflow-y: auto;
 		}
+
 		.contract_list {
 			border-top: 1rpx solid #E5E5E5;
 			margin-bottom: 30rpx;
 			padding-top: 30rpx;
-			&:nth-last-child(1){
+
+			&:nth-last-child(1) {
 				margin-bottom: 0;
 			}
+
 			.list {
 				background: #f7f7f7;
 				border-radius: 8rpx;
 				padding: 20rpx;
-				.item{
+
+				.item {
 					border-bottom: 1rpx solid #e5e5e5;
 					padding-bottom: 20rpx;
 					margin-bottom: 20rpx;
-					&:nth-last-child(1){
+
+					&:nth-last-child(1) {
 						border: none;
 						padding-bottom: 0;
 						margin-bottom: 0;
 					}
 				}
+
 				.line {
 					display: flex;
 					margin-bottom: 20rpx;
-					&:nth-last-child(1){
+
+					&:nth-last-child(1) {
 						margin-bottom: 0rpx;
 					}
+
 					.label {
 						color: #666666;
 						width: 92rpx;
@@ -1020,5 +1103,9 @@
 				}
 			}
 		}
+	}
+	.line2{
+		margin-right: -30rpx;
+		padding-right: 0;
 	}
 </style>
\ No newline at end of file

--
Gitblit v1.9.3