From c39a0308db98f3678253f6318b125631e3eccfea Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期一, 12 一月 2026 14:57:32 +0800
Subject: [PATCH] fix: 日期格式化修正

---
 src/pages/routingInspection/detail/indexJX.vue |   57 +++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 39 insertions(+), 18 deletions(-)

diff --git a/src/pages/routingInspection/detail/indexJX.vue b/src/pages/routingInspection/detail/indexJX.vue
index 1e81d45..3fada74 100644
--- a/src/pages/routingInspection/detail/indexJX.vue
+++ b/src/pages/routingInspection/detail/indexJX.vue
@@ -50,7 +50,7 @@
       </view>
       <wd-col :span="24">
         <wd-form-item label="鏃ユ湡" prop="recordDate">
-          {{ formatDate(recordData.fixedInfo?.recordDate) }}
+          {{ formattedRecordDate }}
         </wd-form-item>
         <wd-form-item label="鐝" prop="workShift">
           {{ formatValue(recordData.fixedInfo?.workShift) }}
@@ -328,6 +328,8 @@
       </div>
     </wd-popup>
     <wd-toast />
+    <!-- 鎵爜缁勪欢 -->
+    <Scan ref="scanRef" emit-name="scanJX" />
   </view>
 </template>
 
@@ -339,6 +341,7 @@
 import AttachmentUpload from "../upload.vue";
 import { useUserStore } from "@/store/modules/user";
 import { useScanCode } from "@/composables/useScanCode";
+import Scan from "@/components/scan/index.vue";
 
 const paramsType = ref("");
 const paramsId = ref("");
@@ -351,6 +354,7 @@
 const attachmentRef = ref<any>(null);
 const detailData = reactive<any>({});
 const detailDataLoaded = ref(false);
+const scanRef = ref(); // 鎵爜缁勪欢寮曠敤
 
 // 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛淇℃伅
 const userStore = useUserStore();
@@ -540,8 +544,10 @@
       inspectionResult: {
         twistedOuterDiameter: formData.twistedOuterDiameter,
         diameterType: formData.diameterType || "缁炲悎澶栧緞(mm)",
-        structureFormula: formData.structureFormula,
-        structureItems: formData.structureItems,
+        inspectStructure: {
+          structureFormula: formData.structureFormula,
+          structureItems: formData.structureItems,
+        },
         inspectTwist: formData.inspectTwist,
         productAppearance: formData.productAppearance,
         conclusion: formData.conclusion,
@@ -635,6 +641,17 @@
   });
 };
 
+// 鏍煎紡鍖栨棩鏈熻绠楀睘鎬э紙鐢ㄤ簬妯℃澘鏄剧ず锛岄伩鍏嶇紪璇戝鐞嗭級
+const formattedRecordDate = computed(() => {
+  const date = recordData.value.fixedInfo?.recordDate;
+  if (!date) return "-";
+  const d = new Date(date);
+  const year = d.getFullYear();
+  const month = String(d.getMonth() + 1).padStart(2, "0");
+  const day = String(d.getDate()).padStart(2, "0");
+  return `${year}-${month}-${day}`;
+});
+
 // 璁$畻鑺傚緞姣�
 const calculatePitchRatio = (pitch: string, dia: string) => {
   // 濡傛灉pitch鎴杁ia涓虹┖锛屽垯杩斿洖"-"
@@ -689,12 +706,16 @@
 };
 
 const openScan = () => {
-  console.log("indexJX - 鐐瑰嚮鎵爜鎸夐挳锛堝叏灞�鎵爜妯″紡锛屾棤闇�鎵嬪姩瑙﹀彂锛�");
-  // 鍏ㄥ眬鎵爜妯″紡涓嬶紝纭欢鎵爜浼氳嚜鍔ㄨЕ鍙戯紝鏃犻渶鎵嬪姩璋冪敤
-  uni.showToast({
-    title: "璇蜂娇鐢ㄦ壂鐮佹灙鎵弿",
-    icon: "none",
-  });
+  console.log("indexJX - 鐐瑰嚮鎵爜鎸夐挳锛岃Е鍙戞壂鐮�");
+  // 瑙﹀彂鎵爜
+  if (scanRef.value) {
+    scanRef.value.triggerScan();
+  } else {
+    uni.showToast({
+      title: "鎵爜缁勪欢鏈垵濮嬪寲",
+      icon: "none",
+    });
+  }
 };
 
 // 椤甸潰鏄剧ず鏃剁殑澶勭悊
@@ -709,15 +730,15 @@
   if (!cachedData || !cachedData.uid) {
     console.log("鈿狅笍 鏈娴嬪埌鎵爜缂撳瓨锛岀敤鎴烽渶瑕佹壂鎻忚澶囦簩缁寸爜");
     // 鍦ㄧ紪杈戞ā寮忎笅鎵嶆彁绀�
-    if (isEdit.value) {
-      setTimeout(() => {
-        uni.showToast({
-          title: "璇锋壂鎻忚澶囦簩缁寸爜鍚庡啀淇濆瓨",
-          icon: "none",
-          duration: 2000,
-        });
-      }, 500);
-    }
+    // if (isEdit.value) {
+    //   setTimeout(() => {
+    //     uni.showToast({
+    //       title: "璇锋壂鎻忚澶囦簩缁寸爜鍚庡啀淇濆瓨",
+    //       icon: "none",
+    //       duration: 2000,
+    //     });
+    //   }, 500);
+    // }
   }
 });
 </script>

--
Gitblit v1.9.3