From 2b29d38bf7ee6355463e79fff1c6a90dd7f94c5b Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期二, 12 八月 2025 10:35:39 +0800
Subject: [PATCH] Merge branch 'Dev' of http://101.37.171.70:10101/r/~jhz/STUWMS into Dev

---
 pages/gongxuOut/form.vue |  100 ++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 96 insertions(+), 4 deletions(-)

diff --git a/pages/gongxuOut/form.vue b/pages/gongxuOut/form.vue
index 368e7e9..b6812bc 100644
--- a/pages/gongxuOut/form.vue
+++ b/pages/gongxuOut/form.vue
@@ -99,7 +99,7 @@
                 <view class="form-item">
                     <view class="title">宸ユ椂:</view>
                     <view class="right">
-                        <input v-model="hform.HWorkTimes" placeholder="璇疯緭鍏ュ伐鏃�" />
+                        <input v-model="hform.HWorkTimes" placeholder="璇疯緭鍏ュ伐鏃�" @blur="HWorkTimesChange"/>
                     </view>
                 </view>
                 <view class="form-item">
@@ -111,6 +111,22 @@
                     </checkbox-group>
                 </view>
             </view>
+			<view class="form-item">
+				<view class="title">寮�宸ユ椂闂�:</view>
+				<view class="right">
+					 <uni-datetime-picker v-model="hform.HRelBeginTime" @change="HRelBeginTimeChange" v-if="hform.HIsTimeFlag==1" :hide-second="true">
+						 <input disabled v-model="hform.HRelBeginTime" placeholder="璇烽�夋嫨寮�宸ユ椂闂�"  style="pointer-events: none;"/>
+					 </uni-datetime-picker>
+				</view>
+			</view>
+			<view class="form-item">
+				<view class="title">瀹屽伐鏃堕棿:</view>
+				<view class="right">
+					 <uni-datetime-picker v-model="hform.HRelEndTime" @change="HRelEndTimeChange" v-if="hform.HIsTimeFlag==1" :hide-second="true">
+						 <input disabled v-model="hform.HRelEndTime" placeholder="璇烽�夋嫨瀹屽伐鏃堕棿" />
+					 </uni-datetime-picker>
+				</view>
+			</view>
             <!-- 
                 <view class="title">鏄惁璁℃椂</view>
                 <checkbox-group name="checkboxGroup" @change="onCGChangeHandler">
@@ -515,6 +531,8 @@
 					HProcNumber: '',
                     HNotReportQty: 0,
                     HIsTimeFlag: 0,
+					HRelBeginTime:'',
+					HRelEndTime:'',
                     // HPieceQty:'',
                     HWasterQty: 0,
                     HSourceName: '',
@@ -639,6 +657,10 @@
                 detail
             }) {
                 this.hform.HIsTimeFlag = detail.value[0] || 0
+				if(detail.value[0]){
+					this.getNewHRelBeginDate()
+					this.hform.HRelEndTime = getDateTime.dateTimeStr('y-m-d h:i');
+				}
             },
             //閫氳繃鐧诲綍鐢ㄦ埛鑾峰彇榛樿鍊�
             getDefValByUser() {
@@ -751,7 +773,20 @@
                 console.log(e.detail.value)
                 this.hform.HDate = e.detail.value
             },
-
+			HRelBeginTimeChange(e) {
+			    console.log(e)
+			    this.hform.HRelBeginTime = e
+				this.hform.HWorkTimes=getDateTime.calculateHoursDiff(this.hform.HRelBeginTime,this.hform.HRelEndTime);
+			},
+			HRelEndTimeChange(e) {
+			    console.log(e)
+			    this.hform.HRelEndTime = e
+				this.hform.HWorkTimes=getDateTime.calculateHoursDiff(this.hform.HRelBeginTime,this.hform.HRelEndTime);
+			},
+			HWorkTimesChange(e){
+				console.log(e);
+				this.hform.HRelEndTime = getDateTime.addHoursToDate(this.hform.HRelBeginTime,e.detail.value);
+			},
             //鑾峰彇浜у搧鏁版嵁
             getHMaterList() {
                 var Value = " Where HStopFlag=0  and HEndFlag=1 and HUSEORGID = " + uni.getStorageSync('OrganizationID')
@@ -1389,7 +1424,62 @@
                     },
                 });
             },
-            //鏂板
+            
+			//鑾峰彇鏈�鏂扮殑鎶ュ伐鏃ユ湡
+			getNewHRelBeginDate(){
+				uni.request({
+				    url: this.serverUrl + '/Cj_StationOutBill/get_Display',
+					data:{ 
+						sWhere: ` and HEmpID = N'${this.hform.HEmpID}'`,
+						user: uni.getStorageSync('HUserName'),
+						HBillSubType:'',
+					},
+				    success: (res) => {
+						if(res.data.count == 1){
+							//鑾峰彇鍒楄〃鏁版嵁
+							const listData = res.data.data
+							// 鑾峰彇褰撳墠鏃ユ湡锛堝幓鎺夋椂闂撮儴鍒嗭級
+							const today = new Date();
+							today.setHours(0, 0, 0, 0);
+							if(listData.length==0){
+								this.hform.HRelBeginTime = getDateTime.dateTimeSetHoureStr(7, 40, 0, 0,'y-m-d h:i');
+								this.hform.HWorkTimes=getDateTime.calculateHoursDiff(this.hform.HRelBeginTime,this.hform.HRelEndTime);
+							}else{
+								// 浠庡璞℃暟缁勪腑鎻愬彇鎵�鏈夋棩鏈熷瓧娈靛苟鎵惧埌鏈�澶у��
+								const maxDate = listData.reduce((max, obj) => {
+									const date = new Date(obj[鍑虹珯鏃堕棿]);
+									return date > max ? date : max;
+								}, new Date(0)); // 鍒濆鍊间负鏈�灏忔棩鏈�
+								// 姣旇緝鏈�澶ф棩鏈熷拰浠婂ぉ鐨勬棩鏈熼儴鍒嗭紙涓嶆瘮杈冩椂闂达級
+								const maxDateDateOnly = new Date(maxDate);
+								maxDateDateOnly.setHours(0, 0, 0, 0);
+								  // 姣旇緝鏈�澶ф棩鏈熷拰浠婂ぉ
+								if (maxDateDateOnly.getTime() !== today.getTime()) {
+									// 濡傛灉涓嶆槸浠婂ぉ锛岃繑鍥炲綋鍓嶆棩鏈�
+									this.hform.HRelBeginTime = getDateTime.dateTimeSetHoureStr(7, 40, 0, 0,'y-m-d h:i');
+									this.hform.HWorkTimes=getDateTime.calculateHoursDiff(this.hform.HRelBeginTime,this.hform.HRelEndTime);
+								}else{
+									this.hform.HRelBeginTime = maxDate.replace(/(:\d{2})(:\d{2}\.\d{3})/, '$1');//浣跨敤姝e垯琛ㄨ揪寮忓幓闄ょ鍜屾绉�
+									this.hform.HWorkTimes=getDateTime.calculateHoursDiff(this.hform.HRelBeginTime,this.hform.HRelEndTime);
+								}
+							}
+						}else{
+							uni.showToast({
+								title:res.data.Message,
+								icon:'none'
+							})
+						}
+					},
+					fail: (res) => {
+						console.log(res);
+						uni.showToast({
+							title:'鎺ュ彛璇锋眰澶辫触',
+							icon:'none'
+						})
+					},
+				});
+			},
+			//鏂板
             getNewData() {
                 uni.request({
                     url: this.serverUrl + '/Web/GetMAXNum',
@@ -1644,7 +1734,9 @@
         margin: 20rpx auto;
         padding-bottom: 240rpx;
     }
-
+	picker input{
+		pointer-events: none;
+	}
     .tab_area {
         width: 100%;
         height: 50rpx;

--
Gitblit v1.9.1