From 491585f7ad453d889f71dc549f6a4d3dee74828f Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期五, 31 十月 2025 14:48:09 +0800
Subject: [PATCH] 除附件

---
 src/pages/routingInspection/detail/indexJX.vue |  613 ++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 489 insertions(+), 124 deletions(-)

diff --git a/src/pages/routingInspection/detail/indexJX.vue b/src/pages/routingInspection/detail/indexJX.vue
index 754374e..46fdd5f 100644
--- a/src/pages/routingInspection/detail/indexJX.vue
+++ b/src/pages/routingInspection/detail/indexJX.vue
@@ -73,11 +73,22 @@
         <wd-form-item label="寮犲姏璁剧疆" prop="twistTension">
           {{ formatValue(recordData.fixedInfo?.twistTension, "N/m") }}
         </wd-form-item>
-        <wd-form-item label="缁炲埗澶栧緞" prop="twistDiameter">
-          {{ formatValue(recordData.inspectionResult?.twistDiameter, "mm") }}
+        <!-- 缁炲埗澶栧緞锛堝彲缂栬緫锛� -->
+        <wd-form-item label="缁炲埗澶栧緞" prop="twistDiameter" required>
+          <template v-if="isEdit">
+            <wd-input
+              v-model="formData.twistDiameter"
+              placeholder="璇疯緭鍏ョ粸鍒跺寰勶紙mm锛�"
+              type="number"
+            />
+          </template>
+          <template v-else>
+            {{ formatValue(formData.twistDiameter, "mm") }}
+          </template>
         </wd-form-item>
       </wd-col>
     </wd-row>
+
     <!-- 鑷璁板綍璇︽儏妯″潡 -->
     <wd-row>
       <view style="margin: 10rpx">
@@ -97,27 +108,32 @@
         </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"
       >
@@ -125,26 +141,42 @@
           :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,57 +184,115 @@
           :label="formatValue(item.twistName)"
           label-width="400rpx"
           style="color: red"
+          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" />
+          </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">
+            <wd-checkbox-group
+              v-model="formData.productAppearance"
+              inline
+              v-for="(opt, idx) in appearanceOptions"
+              :key="idx"
+              style="text-align: justify"
+            >
+              <wd-checkbox :modelValue="opt.value" style="width: 100px">
+                {{ opt.label }}
+              </wd-checkbox>
+            </wd-checkbox-group>
+          </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-col v-for="(file, index) in allFiles" :key="file.id || index" class="attachment-item">
           <wd-img :width="80" :height="80" :src="file.url" @click="previewImage(file.url)">
             <template #error>
               <view class="error-wrap">鍔犺浇澶辫触</view>
@@ -213,26 +303,276 @@
               </view>
             </template>
           </wd-img>
+          <!-- 缂栬緫妯″紡涓嬫樉绀哄垹闄ゆ寜閽� -->
+          <!-- <wd-icon
+            v-if="isEdit"
+            name="close-circle"
+            class="delete-icon"
+            @click.stop="deleteFile(file.id || index)"
+          ></wd-icon> -->
+        </wd-col>
+        <!-- 涓婁紶鎸夐挳锛堜粎缂栬緫妯″紡鏄剧ず锛� -->
+        <wd-col v-if="isEdit" class="attachment-item upload-btn">
+          <wd-upload
+            :multiple="true"
+            :max-count="5"
+            :before-upload="beforeUpload"
+            @success="handleUploadSuccess"
+            @fail="handleUploadFail"
+          >
+            <view class="upload-icon">+</view>
+          </wd-upload>
         </wd-col>
       </view>
     </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>
+    <Scan ref="scanRef" emitName="scan" />
+    <wd-toast />
   </view>
 </template>
 
 <script setup lang="ts">
+import { ref, reactive, computed } from "vue";
 import { onLoad } from "@dcloudio/uni-app";
 import RoutingInspectionApi from "@/api/routingInspection/routingInspection";
+import Scan from "@/components/scan/index.vue";
+import { useToast } from "wot-design-uni";
 
+// 鏍稿績鐘舵��
 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 deviceUid = ref("");
+const scanRef = ref();
+const toast = useToast();
+
+// 琛ㄥ崟涓存椂鏁版嵁锛堢紪杈戞ā寮忕粦瀹氾級
+const formData = reactive({
+  twistDiameter: "", // 缁炲埗澶栧緞
+  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 allFiles = computed(() => {
+  return [...(recordData.value.structureInfo?.files || []), ...tempFiles.value];
+});
+
+// 鍒濆鍖栬〃鍗曟暟鎹紙鎺ュ彛鏁版嵁鍚屾鍒拌〃鍗曪級
+const initFormData = () => {
+  const structureResult = recordData.value.structureInfo?.structureRecordResult || {};
+  const inspectionResult = recordData.value.inspectionResult || {};
+
+  // 鍩虹鍙紪杈戝瓧娈�
+  formData.twistDiameter = inspectionResult.twistDiameter || "";
+  formData.structureFormula = structureResult.inspectStructure?.structureFormula || "";
+  formData.sampleComplete = inspectionResult.sampleComplete || "";
+  formData.conclusion = structureResult.conclusion || "";
+  // 淇浜у搧澶栬鍜岀粨璁虹殑鏁版嵁鏍煎紡
+  formData.productAppearance = Array.isArray(structureResult.productAppearance)
+    ? structureResult.productAppearance
+    : structureResult.productAppearance
+    ? [structureResult.productAppearance]
+    : [];
+
+  // 寰幆绫诲瓧娈碉紙娣辨嫹璐濋伩鍏嶅師鏁版嵁姹℃煋锛�
+  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;
+    tempFiles.value = []; // 娓呯┖涓存椂鏂囦欢
+    initFormData(); // 鏁版嵁杩斿洖鍚庡垵濮嬪寲琛ㄥ崟
+  } catch (error) {
+    console.error("鑾峰彇璇︽儏澶辫触:", error);
+    uni.showToast({ title: "鍔犺浇澶辫触", icon: "error" });
+  }
+};
+
+// 椤甸潰鍔犺浇
+onLoad((options: any) => {
+  paramsId.value = options.id;
+  getDetailData(options.id, options.deviceType);
+});
+
+// 缂栬緫妯″紡鍒囨崲
+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.twistDiameter) 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("1111", deviceUid.value);
+  if (!deviceUid.value) return uni.showToast({ title: "璇锋壂鎻忎簩缁寸爜", icon: "none" });
+  // 4. 鎻愪氦鏁版嵁鍒版帴鍙�
+  try {
+    const res = await RoutingInspectionApi.strandedPatrolCheckInspection({
+      deviceUid: deviceUid.value,
+      id: paramsId.value,
+      result: {
+        twistDiameter: formData.twistDiameter,
+        structureFormula: formData.structureFormula,
+        structureItems: formData.structureItems,
+        inspectTwist: formData.inspectTwist,
+        productAppearance: formData.productAppearance,
+        conclusion: formData.conclusion,
+        sampleComplete: formData.sampleComplete,
+      },
+      inspectionResult: {
+        sampleComplete: formData.sampleComplete,
+      },
+      processInspectionAttachmentList: tempFiles.value.map((f) => f.url), // 鏂颁笂浼犵殑闄勪欢
+    });
+
+    if (res.code === 200) {
+      uni.showToast({ title: "淇濆瓨鎴愬姛", icon: "success" });
+      isEdit.value = false;
+      getDetailData(paramsId.value, recordData.value.deviceType); // 鍒锋柊鏁版嵁
+    } else {
+      uni.showModal({ title: res.msg || "淇濆瓨澶辫触", icon: "error" });
+    }
+  } catch (e) {
+    console.error("淇濆瓨澶辫触:", e);
+    uni.showModal({ title: e.message || "淇濆瓨澶辫触", icon: "error" });
+  }
+};
+
+// 闄勪欢涓婁紶鍓嶇疆鏍¢獙
+const beforeUpload = (file: any) => {
+  // 闄愬埗鍥剧墖澶у皬涓嶈秴杩�2M
+  const maxSize = 2 * 1024 * 1024;
+  if (file.size > maxSize) {
+    uni.showToast({ title: "鍥剧墖澶у皬涓嶈兘瓒呰繃2M", icon: "none" });
+    return false;
+  }
+  return true;
+};
+
+// 闄勪欢涓婁紶鎴愬姛鍥炶皟
+const handleUploadSuccess = (res: any) => {
+  // 鍋囪鎺ュ彛杩斿洖鏍煎紡: { url: 'xxx', id: 'xxx' }
+  if (Array.isArray(res)) {
+    tempFiles.value = [
+      ...tempFiles.value,
+      ...res.map((file) => ({
+        ...file,
+        id: `temp-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, // 鐢熸垚涓存椂ID
+      })),
+    ];
+  } else {
+    tempFiles.value.push({
+      ...res,
+      id: `temp-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
+    });
+  }
+};
+
+// 闄勪欢涓婁紶澶辫触鍥炶皟
+const handleUploadFail = (err: any) => {
+  uni.showToast({ title: "闄勪欢涓婁紶澶辫触", icon: "error" });
+};
+
+// 鍒犻櫎闄勪欢
+const deleteFile = (id: string | number) => {
+  // 鍒犻櫎涓存椂鏂囦欢
+  tempFiles.value = tempFiles.value.filter((file) => file.id !== id);
+
+  // 濡傛灉鏄師鏈夋枃浠讹紝闇�瑕佹爣璁板垹闄わ紙瀹為檯椤圭洰涓彲鑳介渶瑕佹帴鍙d氦浜掞級
+  if (typeof id !== "string" || !id.startsWith("temp-")) {
+    // 杩欓噷鍙互瀹炵幇鍒犻櫎鍘熸湁鏂囦欢鐨勯�昏緫
+    recordData.value.structureInfo.files = recordData.value.structureInfo.files.filter(
+      (file: any, index: number) => index !== id
+    );
+  }
+};
+
+// 鍥剧墖棰勮
+const previewImage = (url: string) => {
+  previewImageUrl.value = url;
+  show.value = true;
+};
+
+const handleClose = () => {
+  show.value = false;
+};
 
 // 鐘舵�佺被鍨嬫槧灏�
 const getStatusType = (status: number) => {
@@ -266,12 +606,6 @@
   }
 };
 
-// 鑾峰彇澶栬鏂囨湰
-const getAppearanceText = (appearance: string[]) => {
-  if (!appearance || appearance.length === 0) return "-";
-  return appearance.join("銆�");
-};
-
 // 鏍煎紡鍖栦骇鍝佸瑙傛樉绀�
 const formatProductAppearance = (productAppearance: string[]) => {
   if (!productAppearance || productAppearance.length === 0) return "-";
@@ -294,82 +628,40 @@
   });
 };
 
-// 鏍煎紡鍖栫粨鏋勫�兼樉绀�
-const formatStructureValue = (value1: any, value2: any) => {
-  const val1 = value1 || "-";
-  const val2 = value2 ? `${value2}mm` : "-";
-  return { count: val1, diameter: val2 };
+const openScan = () => {
+  scanRef.value.triggerScan();
 };
-
-const getDetailData = async (id: string, deviceType: string) => {
+const getScanCode = (params: any) => {
+  console.log("瀹屾暣鍙傛暟锛�", params);
+  let codeObj = {};
   try {
-    let response;
-    // 鑾峰彇缁炵嚎鍗曚釜缁撴瀯
-    response = await RoutingInspectionApi.getStrandedInspectionStructureInfoById({
-      id: id,
-    });
-    recordData.value = response.data;
-    console.log(recordData.value);
-  } catch (error) {
-    console.error("鑾峰彇璇︽儏澶辫触:", error);
+    codeObj = JSON.parse(params.code);
+  } catch (err) {
+    console.error("JSON瑙f瀽澶辫触锛�", err);
+    toast.error("鎵爜鏁版嵁寮傚父");
+    return; // 瑙f瀽澶辫触鐩存帴杩斿洖锛岄伩鍏嶅悗缁敊璇�
   }
+  deviceUid.value = codeObj?.uid;
+  toast.success("鎵爜鎴愬姛");
 };
-
-onLoad((options: any) => {
-  paramsId.value = options.id;
-  getDetailData(options.id, options.deviceType);
+// 纭繚鍏堢Щ闄ゅ啀娣诲姞鐩戝惉
+const setupScanListener = () => {
+  uni.$off("scan", getScanCode); // 鍏堢Щ闄ゆ棫鐨�
+  uni.$on("scan", getScanCode); // 鍐嶆坊鍔犳柊鐨�
+};
+onUnmounted(() => {
+  // 寮�鍚箍鎾洃鍚簨浠�
+  uni.$off("scan", getScanCode);
+  console.log("绂诲紑1");
 });
-
-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",
-  //   });
-  // }
-};
+onMounted(() => {
+  // 寮�鍚箍鎾洃鍚簨浠�
+  setupScanListener();
+  console.log("鏄剧ず1");
+});
 </script>
+
 <style lang="scss" scoped>
-.placeholder {
-  flex: 1;
-}
 .fixed-header {
   position: fixed;
   top: 44;
@@ -391,14 +683,8 @@
   gap: 10px;
 }
 
-.search-wrapper {
+.placeholder {
   flex: 1;
-  min-width: 0;
-}
-
-:deep(.search-wrapper .wd-search) {
-  width: 100% !important;
-  min-width: 0 !important;
 }
 
 .scan-wrapper {
@@ -413,11 +699,11 @@
 
 .list {
   padding: 12px;
-
   padding-top: 84px;
   background: #f3f9f8;
   min-height: 100vh;
   box-sizing: border-box;
+  overflow-y: auto;
 }
 
 .title {
@@ -439,6 +725,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 +753,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 +793,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