From 74e77ff9778f602e92a9634708fea35b4eb7d42f Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期一, 11 八月 2025 16:38:55 +0800
Subject: [PATCH] 限制报工时间不能是未来时间,与当前时间间隔不能超过15天,补充相关语言

---
 north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue |   38 +++++++++++++++++---------------------
 1 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue b/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue
index 99b3feb..9ed0775 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue
@@ -1003,6 +1003,23 @@
     return
   }
 
+  const reportingWorkTime = titleUploadData.value.reportingWorkTime
+    const currentTime = new Date()
+    const targetTime = new Date(reportingWorkTime)
+    //鏈潵鏃堕棿
+    if (targetTime > currentTime) {
+      ElMessage.error(t('reportingWorks.futureTime'))
+      return
+    }
+    // 涓や釜鏃堕棿鐨勬绉掑樊
+    const diffMs = currentTime - targetTime
+    // 杞崲涓哄ぉ鏁�
+    const diffDays = diffMs / (1000 * 60 * 60 * 24)
+    if (diffDays > 15) {
+      ElMessage.error(t('reportingWorks.longTime'))
+      return
+    }
+
   const seenIds = {}
   const uniqueByOrderNum = xGrid.value.getTableData().fullData.filter(item => {
     // 妫�鏌tem鐨刬d鏄惁宸茬粡鍦╯eenIds涓�
@@ -1282,27 +1299,6 @@
       //鍒ゆ柇鏃╂櫄鐝�
       titleUploadData.value.classes=t('reportingWorks.early')
       titleUploadData.value.reportingWorkTime = formatCurrentTime()
-
-      //澶勭悊缂栧彿鍒�
-      //瀹氫箟瀛樻斁缂栧彿鏁扮粍
-      const s01Values = [];
-      for (let i = 0; i < res.data.Detail.length; i++) {
-        const s01Values = [];
-        // 閬嶅巻 detailList 鏁扮粍锛屾彁鍙� S01 鍊煎埌 s01Values 鏁扮粍
-        if (res.data.Detail[i].other_columns!=null|| res.data.Detail[i].other_columns!=undefined){
-          res.data.Detail.forEach(element => {
-            const otherColumnsObject = JSON.parse(element.other_columns);
-            const s01Value = otherColumnsObject.S01;
-            s01Values.push(s01Value || ''); // 濡傛灉 S01 鍊间负绌猴紝娣诲姞绌哄瓧绗︿覆鎴栬�呭叾浠栭粯璁ゅ��
-          });
-
-          // 灏� s01Values 涓殑鍊艰祴缁欐瘡涓鍗曡鎯呭璞$殑 s01Value 灞炴��
-          res.data.Detail.forEach((detail, index) => {
-            detail.s01Value = index < s01Values.length ? s01Values[index] : ''; // 璧嬪�肩粰 s01Value 灞炴��
-          });
-        }
-
-      }
 
 
       //缁戝畾涓嬫柟琛ㄦ牸

--
Gitblit v1.8.0