From 6e763136fdf4469143ebbae0b717eb8e9b0ca954 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期一, 03 十一月 2025 17:32:35 +0800
Subject: [PATCH] fix: 完成巡查

---
 src/pages/routingInspection/detail/indexJX.vue |  683 +++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 544 insertions(+), 139 deletions(-)

diff --git a/src/pages/routingInspection/detail/indexJX.vue b/src/pages/routingInspection/detail/indexJX.vue
index 754374e..27572e5 100644
--- a/src/pages/routingInspection/detail/indexJX.vue
+++ b/src/pages/routingInspection/detail/indexJX.vue
@@ -34,6 +34,9 @@
         淇濆瓨
       </wd-button>
       <view class="placeholder"></view>
+      <view class="scan-info">
+        <text class="scan-device-text">褰撳墠鎵爜鏈哄彴: {{ scannedDeviceModel || "鏈壂鐮�" }}</text>
+      </view>
       <view class="scan-wrapper" @click="openScan">
         <wd-icon name="scan" size="24px" color="#0D867F"></wd-icon>
       </view>
@@ -70,14 +73,25 @@
         <wd-form-item label="鐢熶骇闀垮害" prop="actuallyLength">
           {{ formatValue(recordData.fixedInfo?.actuallyLength, "m") }}
         </wd-form-item>
-        <wd-form-item label="寮犲姏璁剧疆" prop="twistTension">
-          {{ formatValue(recordData.fixedInfo?.twistTension, "N/m") }}
+        <wd-form-item label="寮犲姏璁剧疆" prop="tensionSetting">
+          {{ formatValue(recordData.fixedInfo?.tensionSetting, "N/m") }}
         </wd-form-item>
-        <wd-form-item label="缁炲埗澶栧緞" prop="twistDiameter">
-          {{ formatValue(recordData.inspectionResult?.twistDiameter, "mm") }}
+        <!-- 缁炲埗澶栧緞锛堝彲缂栬緫锛� -->
+        <wd-form-item label="缁炲悎澶栧緞" prop="twistedOuterDiameter" required>
+          <template v-if="isEdit">
+            <wd-input
+              v-model="formData.twistedOuterDiameter"
+              placeholder="璇疯緭鍏ョ粸鍚堝寰勶紙mm锛�"
+              type="number"
+            />
+          </template>
+          <template v-else>
+            {{ formatValue(formData.twistedOuterDiameter, "mm") }}
+          </template>
         </wd-form-item>
       </wd-col>
     </wd-row>
+
     <!-- 鑷璁板綍璇︽儏妯″潡 -->
     <wd-row>
       <view style="margin: 10rpx">
@@ -97,54 +111,76 @@
         </wd-form-item>
       </wd-col>
     </wd-row>
+
     <!-- 缁撴瀯妫�鏌ユā鍧� -->
     <wd-row>
       <view style="margin: 10rpx">
         <text class="title">{{ "缁撴瀯妫�鏌�" }}</text>
       </view>
       <wd-col :span="24">
-        <wd-form-item label="鎴愬搧缁撴瀯" prop="inspectStructure">
-          {{
-            recordData.structureInfo.structureRecordResult.inspectStructure.structureFormula || "-"
-          }}
+        <wd-form-item label="鎴愬搧缁撴瀯" prop="structureFormula" required>
+          <template v-if="isEdit">
+            <wd-input v-model="formData.structureFormula" placeholder="璇疯緭鍏ユ垚鍝佺粨鏋�" />
+          </template>
+          <template v-else>
+            {{ formData.structureFormula || "-" }}
+          </template>
         </wd-form-item>
       </wd-col>
     </wd-row>
-    <wd-row v-if="recordData.structureInfo.structureRecordResult.inspectStructure.structureItems">
+
+    <!-- 缁撴瀯鏍囧噯鍊煎拰瀹炴祴锛堝彲缂栬緫锛� -->
+    <wd-row v-if="formData.structureItems.length">
       <view style="margin: 10rpx">
         <text class="title">{{ "缁撴瀯鏍囧噯鍊煎拰瀹炴祴" }}</text>
       </view>
       <wd-col
         :span="24"
-        v-for="(item, index) in recordData.structureInfo.structureRecordResult.inspectStructure
-          .structureItems"
+        v-for="(item, index) in formData.structureItems"
         :key="index"
         style="padding-bottom: 10px"
       >
         <wd-form-item
+          prop="structureItemsGroup"
           :label="formatValue(item.structureName)"
           label-width="400rpx"
           style="color: red"
+          required
         ></wd-form-item>
-        <wd-form-item label="鏍囧噯鍊�" prop="structureValue">
+        <wd-form-item label="鏍囧噯鍊�" prop="structureValue" required>
           {{ formatValue(item.structureValue) }}
         </wd-form-item>
-        <wd-form-item label="瀹炴祴鏍规暟" prop="actualValue1">
-          {{ formatValue(item.actualValue1, "鏍�") }}
+        <wd-form-item label="瀹炴祴鏍规暟" prop="actualValue1" required>
+          <template v-if="isEdit">
+            <wd-input v-model="item.actualValue1" placeholder="璇疯緭鍏ュ疄娴嬫牴鏁�" type="number" />
+          </template>
+          <template v-else>
+            {{ formatValue(item.actualValue1, "鏍�") }}
+          </template>
         </wd-form-item>
-        <wd-form-item label="瀹炴祴鐩村緞" prop="actualValue2">
-          {{ formatValue(item.actualValue2, "mm") }}
+        <wd-form-item label="瀹炴祴鐩村緞" prop="actualValue2" required>
+          <template v-if="isEdit">
+            <wd-input
+              v-model="item.actualValue2"
+              placeholder="璇疯緭鍏ュ疄娴嬬洿寰勶紙mm锛�"
+              type="number"
+            />
+          </template>
+          <template v-else>
+            {{ formatValue(item.actualValue2, "mm") }}
+          </template>
         </wd-form-item>
       </wd-col>
     </wd-row>
-    <!-- 缁炵嚎宸ヨ壓璐ㄩ噺鎺у埗妯″潡 -->
-    <wd-row v-if="recordData.structureInfo?.structureRecordResult?.inspectTwist">
+
+    <!-- 缁炵嚎宸ヨ壓璐ㄩ噺鎺у埗锛堝彲缂栬緫锛� -->
+    <wd-row v-if="formData.inspectTwist.length">
       <view style="margin: 10rpx">
         <text class="title">{{ "缁炵嚎宸ヨ壓璐ㄩ噺鎺у埗" }}</text>
       </view>
       <wd-col
         :span="24"
-        v-for="(item, index) in recordData.structureInfo.structureRecordResult.inspectTwist"
+        v-for="(item, index) in formData.inspectTwist"
         :key="index"
         style="padding-bottom: 10px"
       >
@@ -152,87 +188,365 @@
           :label="formatValue(item.twistName)"
           label-width="400rpx"
           style="color: red"
+          prop="inspectTwistGroup"
+          required
         ></wd-form-item>
-        <wd-form-item label="缁炲悜" prop="direction">
-          {{ formatValue(item.direction) }}
+        <wd-form-item label="缁炲悜" prop="direction" required>
+          <template v-if="isEdit">
+            <wd-select-picker
+              label=""
+              v-model="item.direction"
+              :columns="twistDirectionOptions"
+              type="radio"
+              placeholder="璇烽�夋嫨缁炲悜"
+              :clearable="false"
+            ></wd-select-picker>
+          </template>
+          <template v-else>
+            {{ formatValue(item.direction) }}
+          </template>
         </wd-form-item>
-        <wd-form-item label="鑺傝窛" prop="pitch">{{ formatValue(item.pitch, "mm") }}</wd-form-item>
-        <wd-form-item label="鑺傚緞姣�" prop="pitchRatio">
+        <wd-form-item label="鑺傝窛" prop="pitch" required>
+          <template v-if="isEdit">
+            <wd-input
+              v-model="item.pitch"
+              placeholder="璇疯緭鍏ヨ妭璺濓紙mm锛�"
+              type="number"
+              @input="updatePitchRatio(item)"
+            />
+          </template>
+          <template v-else>
+            {{ formatValue(item.pitch, "mm") }}
+          </template>
+        </wd-form-item>
+        <wd-form-item label="鑺傚緞姣�" prop="pitchRatio" required>
           {{ formatValue(item.pitchRatio) }}
         </wd-form-item>
       </wd-col>
     </wd-row>
-    <!-- 澶栬鍜岀粨璁烘ā鍧� -->
+
+    <!-- 澶栬鍜岀粨璁猴紙鍙紪杈戯級 -->
     <wd-row>
       <view style="margin: 10rpx">
         <text class="title">{{ "澶栬鍜岀粨璁�" }}</text>
       </view>
       <wd-col :span="24">
-        <wd-form-item label="缁撹" prop="conclusion">
-          {{ formatValue(recordData.structureInfo.structureRecordResult.conclusion) }}
+        <wd-form-item label="浜у搧澶栬" prop="productAppearance" required>
+          <template v-if="isEdit">
+            <view style="display: flex; flex-wrap: wrap; gap: 10px">
+              <wd-checkbox
+                v-for="(opt, idx) in appearanceOptions"
+                :key="idx"
+                :value="opt.value"
+                :modelValue="formData.productAppearance.includes(opt.value)"
+                @click="handleAppearanceClick(opt.value)"
+                style="width: 100px"
+              >
+                {{ opt.label }}
+              </wd-checkbox>
+            </view>
+          </template>
+          <template v-else>
+            {{ formatProductAppearance(formData.productAppearance) }}
+          </template>
         </wd-form-item>
-        <wd-form-item label="浜у搧澶栬" prop="productAppearance">
-          {{
-            formatProductAppearance(
-              recordData.structureInfo.structureRecordResult.productAppearance
-            )
-          }}
+        <wd-form-item label="缁撹" prop="conclusion" required>
+          <template v-if="isEdit">
+            <wd-radio-group v-model="formData.conclusion" inline class="conclusion-radio-group">
+              <wd-radio
+                v-for="(opt, idx) in conclusionOptions"
+                :key="idx"
+                :value="opt.value"
+                shape="dot"
+              >
+                {{ opt.label }}
+              </wd-radio>
+            </wd-radio-group>
+          </template>
+          <template v-else>
+            {{ formatValue(formData.conclusion) }}
+          </template>
         </wd-form-item>
       </wd-col>
     </wd-row>
+
     <!-- 宸℃缁撴灉妯″潡 -->
     <wd-row>
       <view style="margin: 10rpx">
         <text class="title">{{ "宸℃缁撴灉" }}</text>
       </view>
       <wd-col :span="24">
-        <wd-form-item label="鏍峰搧鏄惁榻愬叏" prop="sampleComplete">
-          {{ formatValue(recordData.inspectionResult?.sampleComplete) }}
+        <wd-form-item label="鏍峰搧鏄惁榻愬叏" prop="sampleComplete" required>
+          <template v-if="isEdit">
+            <wd-radio-group v-model="formData.sampleComplete" inline class="conclusion-radio-group">
+              <wd-radio
+                v-for="(opt, idx) in sampleCompleteOptions"
+                :key="idx"
+                :value="opt.value"
+                shape="dot"
+              >
+                {{ opt.label }}
+              </wd-radio>
+            </wd-radio-group>
+          </template>
+          <template v-else>
+            {{ formatValue(formData.sampleComplete) }}
+          </template>
         </wd-form-item>
       </wd-col>
     </wd-row>
-    <!-- 闄勪欢妯″潡 -->
+
+    <!-- 闄勪欢妯″潡锛堝惈涓婁紶鍔熻兘锛� -->
     <wd-row class="attachment-section">
       <view style="margin: 10rpx">
         <text class="title">{{ "闄勪欢" }}</text>
       </view>
-      <!-- 鐢� flex 瀹瑰櫒鍖呰9鍥剧墖鍒楋紝瀹炵幇鑷姩鎹㈣ -->
-      <view class="attachment-grid">
-        <wd-col
-          v-for="(file, index) in recordData.structureInfo.files"
-          :key="index"
-          class="attachment-item"
-        >
-          <wd-img :width="80" :height="80" :src="file.url" @click="previewImage(file.url)">
-            <template #error>
-              <view class="error-wrap">鍔犺浇澶辫触</view>
-            </template>
-            <template #loading>
-              <view class="loading-wrap">
-                <wd-loading />
-              </view>
-            </template>
-          </wd-img>
-        </wd-col>
-      </view>
+      <wd-col :span="24">
+        <AttachmentUpload
+          :detailData="detailData"
+          :isEdit="isEdit"
+          :deviceType="paramsType"
+          ref="attachmentRef"
+          v-if="detailDataLoaded"
+        />
+      </wd-col>
     </wd-row>
+
     <wd-popup v-model="show" custom-style="border-radius:32rpx;" @close="handleClose">
       <div class="image-preview">
         <img :src="previewImageUrl" alt="棰勮鍥剧墖" style="width: 100%; height: auto" />
       </div>
     </wd-popup>
+    <wd-toast />
   </view>
 </template>
 
 <script setup lang="ts">
-import { onLoad } from "@dcloudio/uni-app";
+import { ref, reactive, computed, onUnmounted } from "vue";
+import { onLoad, onShow, onHide } from "@dcloudio/uni-app";
 import RoutingInspectionApi from "@/api/routingInspection/routingInspection";
+import { useToast } from "wot-design-uni";
+import AttachmentUpload from "../upload.vue";
+import { useUserStore } from "@/store/modules/user";
+import { useScanCode } from "@/composables/useScanCode";
 
+const paramsType = ref("");
 const paramsId = ref("");
-const recordData = ref<any>({});
+const recordData = ref<any>({ structureInfo: { files: [], structureRecordResult: {} } });
 const show = ref(false);
 const previewImageUrl = ref("");
 const isEdit = ref(false);
+const tempFiles = ref<any[]>([]); // 涓存椂瀛樺偍鏂颁笂浼犵殑闄勪欢
+const toast = useToast();
+const attachmentRef = ref<any>(null);
+const detailData = reactive<any>({});
+const detailDataLoaded = ref(false);
+
+// 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛淇℃伅
+const userStore = useUserStore();
+const userInfo: any = computed(() => userStore.userInfo);
+
+// 浣跨敤鎵爜绠$悊 composable锛堝叏灞�鐩戝惉鍣紝涓嶉殢椤甸潰鍒囨崲鍏抽棴锛�
+const {
+  deviceUid,
+  deviceModel: scannedDeviceModel,
+  loadFromCache,
+  enableListener,
+} = useScanCode("scanJX");
+
+const formData = reactive({
+  twistedOuterDiameter: "", // 缁炲埗澶栧緞
+  structureFormula: "", // 鎴愬搧缁撴瀯
+  structureItems: [], // 缁撴瀯鏍囧噯鍊煎拰瀹炴祴
+  inspectTwist: [], // 缁炵嚎宸ヨ壓璐ㄩ噺鎺у埗
+  productAppearance: [] as string[], // 浜у搧澶栬锛堟敼涓烘暟缁勫瓨鍌ㄩ�変腑鍊硷級
+  conclusion: "", // 缁撹锛堟敼涓烘暟缁勫瓨鍌ㄩ�変腑鍊硷級
+  sampleComplete: "", // 鏍峰搧鏄惁榻愬叏
+});
+
+const twistDirectionOptions = [
+  { label: "宸﹀悜", value: "宸﹀悜" },
+  { label: "鍙冲悜", value: "鍙冲悜" },
+];
+
+const appearanceOptions = [
+  { label: "鏃犲瑙傞棶棰�", value: "鏃犲瑙傞棶棰�" },
+  { label: "琛ㄩ潰鍒掍激", value: "琛ㄩ潰鍒掍激" },
+  { label: "鐩村緞涓嶅潎", value: "鐩村緞涓嶅潎" },
+  { label: "鍏朵粬缂洪櫡", value: "鍏朵粬缂洪櫡" },
+];
+
+const conclusionOptions = [
+  { label: "鍚堟牸", value: "鍚堟牸" },
+  { label: "涓嶅悎鏍�", value: "涓嶅悎鏍�" },
+];
+const sampleCompleteOptions = [
+  { label: "鏄�", value: "鏄�" },
+  { label: "鍚�", value: "鍚�" },
+];
+
+const initFormData = () => {
+  const structureResult = recordData.value.structureInfo?.structureRecordResult || {};
+  const inspectionResult = recordData.value.inspectionResult || {};
+
+  formData.twistedOuterDiameter =
+    recordData.value.structureInfo.structureRecordResult.twistedOuterDiameter || "";
+  formData.structureFormula = structureResult.inspectStructure?.structureFormula || "";
+  formData.sampleComplete = inspectionResult.sampleComplete || "";
+  formData.conclusion = structureResult.conclusion || "";
+
+  // 鍒濆鍖栦骇鍝佸瑙�
+  const appearance = Array.isArray(structureResult.productAppearance)
+    ? structureResult.productAppearance
+    : structureResult.productAppearance
+      ? [structureResult.productAppearance]
+      : [];
+  formData.productAppearance = appearance;
+
+  formData.structureItems = JSON.parse(
+    JSON.stringify(structureResult.inspectStructure?.structureItems || [])
+  );
+  formData.inspectTwist = JSON.parse(JSON.stringify(structureResult.inspectTwist || []));
+
+  formData.inspectTwist.forEach((item: any) => {
+    if (!item.direction) item.direction = "";
+  });
+};
+
+const getDetailData = async (id: string, deviceType: string) => {
+  try {
+    const response = await RoutingInspectionApi.getStrandedInspectionStructureInfoById({ id });
+    recordData.value = response.data;
+    detailData.value = response.data.structureInfo;
+
+    // 濡傛灉璁板綍浜轰负绌猴紝榛樿璁剧疆涓哄綋鍓嶇櫥褰曠敤鎴�
+    if (recordData.value.structureInfo && !recordData.value.structureInfo.createUserName) {
+      recordData.value.structureInfo.createUserName =
+        userInfo.value?.nickName || userInfo.value?.userName || "";
+    }
+
+    console.log("detailData.value", detailData.value);
+    tempFiles.value = []; // 娓呯┖涓存椂鏂囦欢
+    initFormData(); // 鏁版嵁杩斿洖鍚庡垵濮嬪寲琛ㄥ崟
+    detailDataLoaded.value = true; // 鏁版嵁鍔犺浇瀹屾垚鍚庯紝娓叉煋瀛愮粍浠�
+    console.log("鐖剁粍浠�-鏁版嵁灏辩华鍚庢墦鍗�");
+  } catch (error) {
+    console.error("鑾峰彇璇︽儏澶辫触:", error);
+    uni.showToast({ title: "鍔犺浇澶辫触", icon: "error" });
+  }
+};
+
+// 椤甸潰鍔犺浇
+onLoad((options: any) => {
+  try {
+    paramsId.value = options.id;
+    paramsType.value = options.deviceType;
+    getDetailData(options.id, options.deviceType);
+  } catch (error) {
+    console.error("鑾峰彇璇︽儏澶辫触:", error);
+    uni.showToast({ title: "鍔犺浇澶辫触", icon: "error" });
+  }
+});
+
+// 缂栬緫妯″紡鍒囨崲
+const editList = () => {
+  isEdit.value = true;
+};
+
+// 鍙栨秷缂栬緫锛堥噸缃〃鍗曪級
+const close = () => {
+  isEdit.value = false;
+  tempFiles.value = [];
+  initFormData();
+};
+
+// 淇濆瓨缂栬緫锛堝惈蹇呭~椤规牎楠岋級
+const saveList = async () => {
+  // 1. 鍩虹瀛楁鏍¢獙
+  if (!formData.structureFormula) return uni.showToast({ title: "鎴愬搧缁撴瀯涓哄繀濉」", icon: "none" });
+  if (!formData.twistedOuterDiameter)
+    return uni.showToast({ title: "缁炲埗澶栧緞涓哄繀濉」", icon: "none" });
+  if (!formData.productAppearance.length)
+    return uni.showToast({ title: "浜у搧澶栬涓哄繀濉」", icon: "none" });
+  if (!formData.conclusion) return uni.showToast({ title: "缁撹涓哄繀濉」", icon: "none" });
+  if (!formData.sampleComplete)
+    return uni.showToast({ title: "鏍峰搧鏄惁榻愬叏涓哄繀濉」", icon: "none" });
+  // 2. 缁撴瀯椤瑰惊鐜牎楠�
+  for (const item of formData.structureItems) {
+    if (!item.structureValue)
+      return uni.showToast({ title: `${item.structureName}鏍囧噯鍊间负蹇呭~椤筦, icon: "none" });
+    if (!item.actualValue1)
+      return uni.showToast({ title: `${item.structureName}瀹炴祴鏍规暟涓哄繀濉」`, icon: "none" });
+    if (!item.actualValue2)
+      return uni.showToast({ title: `${item.structureName}瀹炴祴鐩村緞涓哄繀濉」`, icon: "none" });
+  }
+
+  // 3. 缁炵嚎宸ヨ壓椤瑰惊鐜牎楠�
+  for (const item of formData.inspectTwist) {
+    if (!item.direction)
+      return uni.showToast({ title: `${item.twistName}缁炲悜涓哄繀濉」`, icon: "none" });
+    if (!item.pitch) return uni.showToast({ title: `${item.twistName}鑺傝窛涓哄繀濉」`, icon: "none" });
+    if (!item.pitchRatio)
+      return uni.showToast({ title: `${item.twistName}鑺傚緞姣斾负蹇呭~椤筦, icon: "none" });
+  }
+  // 楠岃瘉鎵爜鏁版嵁锛堜粠缂撳瓨鎴栨柊鎵爜鑾峰彇锛�
+  console.log("淇濆瓨鍓嶆鏌� deviceUid:", deviceUid.value);
+  if (!deviceUid.value) {
+    return uni.showToast({
+      title: "璇峰厛鎵弿璁惧浜岀淮鐮�",
+      icon: "none",
+      duration: 2000,
+    });
+  }
+  const { newFiles } = attachmentRef.value.getSubmitFiles();
+  console.log("newFiles", newFiles);
+  const allFileIds = [...newFiles];
+  try {
+    const res = await RoutingInspectionApi.strandedPatrolCheckInspection({
+      deviceUid: deviceUid.value,
+      id: paramsId.value,
+      result: {
+        twistedOuterDiameter: formData.twistedOuterDiameter,
+        structureFormula: formData.structureFormula,
+        structureItems: formData.structureItems,
+        inspectTwist: formData.inspectTwist,
+        productAppearance: formData.productAppearance,
+        conclusion: formData.conclusion,
+        sampleComplete: formData.sampleComplete,
+      },
+      inspectionResult: {
+        sampleComplete: formData.sampleComplete,
+      },
+      processInspectionAttachmentList: allFileIds,
+    });
+
+    if (res.code === 200) {
+      // 璁剧疆鍒锋柊鏍囪锛屽憡璇夊垪琛ㄩ〉闇�瑕佸埛鏂�
+      uni.setStorageSync("needRefreshInspectionList", true);
+
+      uni.showToast({
+        title: "淇濆瓨鎴愬姛",
+        icon: "success",
+        duration: 1500,
+      });
+      // 寤惰繜杩斿洖鍒楄〃椤碉紝璁╃敤鎴风湅鍒版垚鍔熸彁绀�
+      setTimeout(() => {
+        uni.navigateBack({
+          delta: 1,
+        });
+      }, 1500);
+    } else {
+      uni.showModal({ title: res.msg || "淇濆瓨澶辫触", icon: "error" });
+    }
+  } catch (e) {
+    console.error("淇濆瓨澶辫触:", e);
+    uni.showModal({ title: e.message || "淇濆瓨澶辫触", icon: "error" });
+  }
+};
+
+const handleClose = () => {
+  show.value = false;
+};
 
 // 鐘舵�佺被鍨嬫槧灏�
 const getStatusType = (status: number) => {
@@ -242,11 +556,11 @@
     case 1:
       return "danger"; // 宸查┏鍥�
     case 2:
-      return "info"; // 寰呭鏍�
+      return "primary"; // 寰呭鏍�
     case 3:
       return "success"; // 閫氳繃
     default:
-      return "info";
+      return "default";
   }
 };
 
@@ -264,12 +578,6 @@
     default:
       return "鏈煡";
   }
-};
-
-// 鑾峰彇澶栬鏂囨湰
-const getAppearanceText = (appearance: string[]) => {
-  if (!appearance || appearance.length === 0) return "-";
-  return appearance.join("銆�");
 };
 
 // 鏍煎紡鍖栦骇鍝佸瑙傛樉绀�
@@ -294,82 +602,94 @@
   });
 };
 
-// 鏍煎紡鍖栫粨鏋勫�兼樉绀�
-const formatStructureValue = (value1: any, value2: any) => {
-  const val1 = value1 || "-";
-  const val2 = value2 ? `${value2}mm` : "-";
-  return { count: val1, diameter: val2 };
+// 璁$畻鑺傚緞姣�
+const calculatePitchRatio = (pitch: string, dia: string) => {
+  // 濡傛灉pitch鎴杁ia涓虹┖锛屽垯杩斿洖"-"
+  if (!pitch || !dia) return "-";
+
+  // 灏唒itch鍜宒ia杞崲涓烘诞鐐规暟
+  const pitchNum = parseFloat(pitch);
+  const diaNum = parseFloat(dia);
+
+  // 濡傛灉pitchNum鎴杁iaNum鏄疦aN锛屾垨鑰卍iaNum涓�0锛屽垯杩斿洖"-"
+  if (isNaN(pitchNum) || isNaN(diaNum) || diaNum === 0) return "-";
+
+  // 璁$畻pitchNum鍜宒iaNum鐨勬瘮鍊硷紝骞朵繚鐣欎袱浣嶅皬鏁�
+  return (pitchNum / diaNum).toFixed(2);
 };
 
-const getDetailData = async (id: string, deviceType: string) => {
-  try {
-    let response;
-    // 鑾峰彇缁炵嚎鍗曚釜缁撴瀯
-    response = await RoutingInspectionApi.getStrandedInspectionStructureInfoById({
-      id: id,
-    });
-    recordData.value = response.data;
-    console.log(recordData.value);
-  } catch (error) {
-    console.error("鑾峰彇璇︽儏澶辫触:", error);
+// 鏇存柊鑺傚緞姣旓紙褰撹妭璺濆彉鍖栨椂鑷姩璁$畻锛�
+const updatePitchRatio = (item: any) => {
+  // 浣跨敤缁炲悎澶栧緞浣滀负鐩村緞鏉ヨ绠楄妭寰勬瘮
+  const dia = item.dia;
+  item.pitchRatio = calculatePitchRatio(item.pitch, dia);
+};
+
+// 澶勭悊浜у搧澶栬閫夋嫨鐨勪簰鏂ラ�昏緫
+const handleAppearanceClick = (value: string) => {
+  const currentValues = [...formData.productAppearance];
+  const isCurrentlyChecked = currentValues.includes(value);
+
+  let newSelection: string[] = [];
+
+  if (value === "鏃犲瑙傞棶棰�") {
+    if (isCurrentlyChecked) {
+      // 鍙栨秷閫変腑"鏃犲瑙傞棶棰�"
+      newSelection = [];
+    } else {
+      // 閫変腑"鏃犲瑙傞棶棰�"锛屾竻绌哄叾浠栭�夐」
+      newSelection = ["鏃犲瑙傞棶棰�"];
+    }
+  } else {
+    // 鐐瑰嚮鍏朵粬閫夐」
+    if (isCurrentlyChecked) {
+      // 鍙栨秷閫変腑璇ラ�夐」
+      newSelection = currentValues.filter((v) => v !== value);
+    } else {
+      // 閫変腑璇ラ�夐」锛岀Щ闄�"鏃犲瑙傞棶棰�"
+      const filteredValues = currentValues.filter((v) => v !== "鏃犲瑙傞棶棰�");
+      newSelection = [...filteredValues, value];
+    }
   }
+
+  formData.productAppearance = newSelection;
 };
 
-onLoad((options: any) => {
-  paramsId.value = options.id;
-  getDetailData(options.id, options.deviceType);
+const openScan = () => {
+  console.log("indexJX - 鐐瑰嚮鎵爜鎸夐挳锛堝叏灞�鎵爜妯″紡锛屾棤闇�鎵嬪姩瑙﹀彂锛�");
+  // 鍏ㄥ眬鎵爜妯″紡涓嬶紝纭欢鎵爜浼氳嚜鍔ㄨЕ鍙戯紝鏃犻渶鎵嬪姩璋冪敤
+  uni.showToast({
+    title: "璇蜂娇鐢ㄦ壂鐮佹灙鎵弿",
+    icon: "none",
+  });
+};
+
+// 椤甸潰鏄剧ず鏃剁殑澶勭悊
+onShow(() => {
+  console.log("========== indexJX - onShow 瑙﹀彂 ==========");
+  // 閲嶆柊鍚敤鐩戝惉鍣紙纭繚鐩戝惉鍣ㄦ湁鏁堬級
+  enableListener();
+  // 鍔犺浇缂撳瓨锛堟洿鏂癠I鏄剧ず锛�
+  const cachedData = loadFromCache();
+
+  // 濡傛灉娌℃湁缂撳瓨鏁版嵁锛屾彁绀虹敤鎴烽渶瑕佹壂鐮�
+  if (!cachedData || !cachedData.uid) {
+    console.log("鈿狅笍 鏈娴嬪埌鎵爜缂撳瓨锛岀敤鎴烽渶瑕佹壂鎻忚澶囦簩缁寸爜");
+    // 鍦ㄧ紪杈戞ā寮忎笅鎵嶆彁绀�
+    if (isEdit.value) {
+      setTimeout(() => {
+        uni.showToast({
+          title: "璇锋壂鎻忚澶囦簩缁寸爜鍚庡啀淇濆瓨",
+          icon: "none",
+          duration: 2000,
+        });
+      }, 500);
+    }
+  }
 });
-
-const previewImage = (url: string) => {
-  previewImageUrl.value = url;
-  show.value = true;
-};
-
-const handleClose = () => {
-  show.value = false;
-};
-
-// 缂栬緫鍒楄〃
-const editList = () => {};
-
-// 鍏抽棴
-const close = () => {};
-
-// 淇濆瓨鍒楄〃
-const saveList = async () => {
-  // try {
-  //   let response;
-  //   // 淇濆瓨鍒楄〃
-  //   response = await RoutingInspectionApi.saveStrandedInspectionStructureInfo({
-  //     id: paramsId.value,
-  //     structureInfo: recordData.value.structureInfo,
-  //   });
-  //   if (response.code === 200) {
-  //     uni.showToast({
-  //       title: "淇濆瓨鎴愬姛",
-  //       icon: "success",
-  //     });
-  //     // 鍒锋柊璇︽儏鏁版嵁
-  //     getDetailData(paramsId.value, recordData.value.deviceType);
-  //   } else {
-  //     uni.showToast({
-  //       title: response.msg || "淇濆瓨澶辫触",
-  //       icon: "error",
-  //     });
-  //   }
-  // } catch (error) {
-  //   console.error("淇濆瓨鍒楄〃澶辫触:", error);
-  //   uni.showToast({
-  //     title: "淇濆瓨澶辫触",
-  //     icon: "error",
-  //   });
-  // }
-};
 </script>
+
 <style lang="scss" scoped>
-.placeholder {
-  flex: 1;
-}
 .fixed-header {
   position: fixed;
   top: 44;
@@ -391,14 +711,20 @@
   gap: 10px;
 }
 
-.search-wrapper {
+.placeholder {
   flex: 1;
-  min-width: 0;
 }
 
-:deep(.search-wrapper .wd-search) {
-  width: 100% !important;
-  min-width: 0 !important;
+.scan-info {
+  display: flex;
+  align-items: center;
+  margin-right: 10px;
+
+  .scan-device-text {
+    font-size: 14px;
+    color: #0d867f;
+    font-weight: 500;
+  }
 }
 
 .scan-wrapper {
@@ -413,11 +739,11 @@
 
 .list {
   padding: 12px;
-
   padding-top: 84px;
   background: #f3f9f8;
   min-height: 100vh;
   box-sizing: border-box;
+  overflow-y: auto;
 }
 
 .title {
@@ -439,6 +765,20 @@
   border-radius: 2px;
 }
 
+// 浜у搧澶栬鍜岀粨璁洪�夋嫨鍣ㄦ牱寮忥紙涓�琛屼袱涓級
+.checkbox-group {
+  display: flex;
+  flex-wrap: wrap;
+  gap: 16rpx;
+  padding: 8rpx 0;
+}
+
+.checkbox-item {
+  width: calc(50% - 8rpx);
+  margin-bottom: 8rpx;
+}
+
+// 闄勪欢鐩稿叧鏍峰紡
 .attachment-section {
   width: 100%;
 }
@@ -453,6 +793,39 @@
 .attachment-item {
   width: calc(25% - 10px);
   box-sizing: border-box;
+  position: relative;
+}
+
+.upload-btn {
+  width: 80px;
+  height: 80px;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  border: 1px dashed #ccc;
+  border-radius: 4px;
+  box-sizing: border-box;
+}
+
+.upload-icon {
+  font-size: 32px;
+  color: #0d867f;
+}
+
+// 闄勪欢鍒犻櫎鍥炬爣
+.delete-icon {
+  position: absolute;
+  top: -8px;
+  right: -8px;
+  width: 24px;
+  height: 24px;
+  background-color: rgba(255, 0, 0, 0.8);
+  color: white;
+  border-radius: 50%;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  z-index: 10;
 }
 
 @media (max-width: 768px) {
@@ -460,4 +833,36 @@
     width: calc(25% - 10px);
   }
 }
-</style>
\ No newline at end of file
+
+// 缂栬緫妯″紡涓嬭〃鍗曠粍浠舵牱寮忎紭鍖�
+:deep(.wd-form-item) {
+  margin-bottom: 8rpx;
+}
+
+:deep(.wd-input, .wd-select, .wd-radio-group, .wd-checkbox-group) {
+  width: 100%;
+  box-sizing: border-box;
+}
+
+:deep(.wd-form-item__label) {
+  &::after {
+    content: "*";
+    color: red;
+    margin-left: 4rpx;
+  }
+}
+
+// 淇閫夋嫨鍣ㄦ牱寮�
+:deep(.wd-select) {
+  width: 100%;
+}
+
+:deep(.wd-checkbox) {
+  margin-right: 0;
+}
+.conclusion-radio-group {
+  display: flex;
+  align-items: flex-start; // 鍨傜洿鏂瑰悜椤堕儴瀵归綈锛堜笂绉诲叧閿級
+  gap: 20rpx; // 閫夐」涔嬮棿鐨勯棿璺�
+}
+</style>

--
Gitblit v1.9.3