From 8cc901ed214f3885b34a07d0520fbcfd50063439 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 19 十一月 2025 14:30:39 +0800
Subject: [PATCH] fix: 完成绞线自检,生产确认等功能新增

---
 src/pages/production/twist/selfInspect/index.vue |  730 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 659 insertions(+), 71 deletions(-)

diff --git a/src/pages/production/twist/selfInspect/index.vue b/src/pages/production/twist/selfInspect/index.vue
index 9d524c2..7e35f3f 100644
--- a/src/pages/production/twist/selfInspect/index.vue
+++ b/src/pages/production/twist/selfInspect/index.vue
@@ -1,109 +1,697 @@
 <template>
   <view class="list">
-    <z-paging ref="pagingRef" v-model="cardList" :fixed="false" @query="getList">
-      <template #top>
-        <CardTitle title="缁炵嚎鑷" :hideAction="false" />
-      </template>
-      <wd-card v-for="(item, index) in cardList" :key="index" type="rectangle" custom-class="round">
-        <template #title>
-          <view class="flex justify-between">
-            <view>
-              <wd-icon name="a-rootlist" color="#0D867F"></wd-icon>
-              <text class="text-[#252525] ml-2 font-medium">{{ item.inspectionProject }}</text>
-            </view>
-            <view class="text-[#A8A8A8]" @click="toEdit">缂栬緫</view>
-          </view>
-        </template>
-        <ProductionCard :data="cardAttr" :value="item" color="#0D867F" />
-      </wd-card>
-    </z-paging>
-    <wd-popup v-model="dialog.visible" position="bottom" custom-class="yl-popup">
-      <view class="action px-3">
-        <wd-button type="text" @click="cancel">鍙栨秷</wd-button>
-        <wd-button type="text" @click="submit">纭畾</wd-button>
+    <!-- 鍩烘湰淇℃伅妯″潡 -->
+    <wd-row>
+      <view style="margin: 10rpx" class="flex justify-between items-center">
+        <text class="title">鍩烘湰淇℃伅</text>
+        <view class="flex gap-2">
+          <wd-button v-if="!isEdit" type="primary" size="small" icon="edit" @click="handleEdit">
+            缂栬緫
+          </wd-button>
+          <wd-button v-if="isEdit" type="info" size="small" icon="close" @click="handleCancel">
+            鍙栨秷
+          </wd-button>
+          <wd-button v-if="isEdit" type="success" size="small" icon="check" @click="handleSave">
+            淇濆瓨
+          </wd-button>
+        </view>
       </view>
-      <SelfInspectForm />
+      <wd-col :span="24">
+        <wd-form-item label="鏃ユ湡" prop="recordDate">
+          {{ formatDate(formData.recordDate) }}
+        </wd-form-item>
+        <wd-form-item label="鏈哄彴" prop="deviceModel">
+          {{ formatValue(formData.deviceModel) }}
+        </wd-form-item>
+        <wd-form-item label="鐝" prop="workShift">
+          {{ formatValue(formData.workShift) }}
+        </wd-form-item>
+        <wd-form-item label="浜у搧绫诲埆" prop="productType">
+          {{ formatValue(formData.productType) }}
+        </wd-form-item>
+        <wd-form-item label="鍨嬪彿瑙勬牸" prop="model">
+          {{ formatValue(formData.model) }}
+        </wd-form-item>
+        <wd-form-item label="鐢熶骇闀垮害" prop="actuallyLength">
+          {{ formatValue(formData.actuallyLength, "m") }}
+        </wd-form-item>
+        <wd-form-item label="鎴愬搧绾跨洏鍙�" prop="systemNo">
+          {{ formatValue(formData.systemNo) }}
+        </wd-form-item>
+        <wd-form-item label="寮犲姏璁剧疆" prop="tensionSetting">
+          <template v-if="isEdit">
+            <wd-input v-model="formData.tensionSetting" placeholder="璇疯緭鍏ュ紶鍔涜缃�" clearable />
+          </template>
+          <template v-else>
+            {{ formatValue(formData.tensionSetting, "") }}
+          </template>
+        </wd-form-item>
+      </wd-col>
+    </wd-row>
+
+    <!-- 宸ヨ壓璁板綍妯″潡 -->
+    <wd-row>
+      <view style="margin: 10rpx" class="flex justify-between items-center">
+        <text class="title">宸ヨ壓璁板綍</text>
+        <wd-button
+          v-if="!isEdit"
+          type="primary"
+          size="small"
+          icon="file-add"
+          @click="handleAddInspection"
+        >
+          娣诲姞鑷
+        </wd-button>
+      </view>
+      <wd-col :span="24">
+        <wd-card
+          v-for="(item, index) in inspectionList"
+          :key="index"
+          type="rectangle"
+          custom-class="round"
+          style="margin-bottom: 12px"
+        >
+          <template #title>
+            <view class="flex justify-between">
+              <view>
+                <text class="text-[#252525] font-medium">
+                  璁板綍浣嶇疆:
+                  {{
+                    getRecordPositionLabel(
+                      item.recordPosition || item.structureRecordResult?.recordPosition
+                    )
+                  }}
+                </text>
+              </view>
+            </view>
+          </template>
+          <view class="px-3 pb-3">
+            <view class="flex mb-2">
+              <text class="text-[#646874] mr-3">鎴愬搧缁撴瀯:</text>
+              <text class="text-[#252525]">
+                {{
+                  item.structureRecordResult?.inspectStructure?.structureFormula ||
+                  item.structureFormula ||
+                  "-"
+                }}
+              </text>
+            </view>
+            <view class="flex mb-2">
+              <text class="text-[#646874] mr-3">鎴愬搧澶栬:</text>
+              <text class="text-[#252525]">
+                {{
+                  getAppearanceLabel(
+                    item.structureRecordResult?.productAppearance || item.productAppearance
+                  )
+                }}
+              </text>
+            </view>
+            <view class="flex mb-2">
+              <text class="text-[#646874] mr-3">缁撹:</text>
+              <text
+                class="text-[#252525]"
+                :style="{
+                  color:
+                    (item.structureRecordResult?.conclusion || item.conclusion) === '鍚堟牸'
+                      ? '#67C23A'
+                      : '#F56C6C',
+                }"
+              >
+                {{ item.structureRecordResult?.conclusion || item.conclusion || "-" }}
+              </text>
+            </view>
+            <view class="flex">
+              <text class="text-[#646874] mr-3">璁板綍浜�:</text>
+              <text class="text-[#252525]">{{ item.createUserName || "-" }}</text>
+            </view>
+          </view>
+          <template #footer>
+            <view class="flex justify-end gap-2">
+              <wd-button size="small" plain @click="handleViewInspection(item, index)">
+                鏌ョ湅
+              </wd-button>
+              <wd-button
+                v-if="!isEdit"
+                size="small"
+                plain
+                type="primary"
+                @click="handleEditInspection(item, index)"
+              >
+                淇敼
+              </wd-button>
+              <wd-button
+                v-if="!isEdit"
+                size="small"
+                plain
+                type="error"
+                @click="handleDeleteInspection(index)"
+              >
+                鍒犻櫎
+              </wd-button>
+            </view>
+          </template>
+        </wd-card>
+        <view v-if="inspectionList.length === 0" class="text-center py-10 text-[#999]">
+          鏆傛棤宸ヨ壓璁板綍
+        </view>
+      </wd-col>
+    </wd-row>
+
+    <!-- 鑷寮圭獥 -->
+    <wd-popup
+      v-model="inspectionDialogVisible"
+      position="bottom"
+      custom-class="yl-popup"
+      :close-on-click-modal="false"
+    >
+      <view class="action px-3">
+        <wd-button type="text" @click="inspectionDialogVisible = false">鍙栨秷</wd-button>
+        <wd-button v-if="!isViewMode" type="text" @click="handleSaveInspection">淇濆瓨</wd-button>
+      </view>
+      <SelfInspectForm
+        ref="inspectionFormRef"
+        :form-data="inspectionForm"
+        :structure-items="structureItems"
+        :twist-items="twistItems"
+        :is-view-mode="isViewMode"
+        :record-location="recordLocation"
+        :appearance-options="appearanceOptions"
+        @update:form-data="(val) => Object.assign(inspectionForm, val)"
+        @update:structure-items="(val) => (structureItems = val)"
+        @update:twist-items="(val) => (twistItems = val)"
+      />
     </wd-popup>
     <wd-toast />
   </view>
 </template>
 
 <script setup lang="ts">
-import CardTitle from "@/components/card-title/index.vue";
-import ProductionCard from "../../components/ProductionCard.vue";
 import { useToast } from "wot-design-uni";
 import SelfInspectForm from "./form.vue";
+import TwistApi from "@/api/product/twist";
 import ManageApi from "@/api/product/manage";
+import { onLoad } from "@dcloudio/uni-app";
+import { ref, reactive } from "vue";
 
-const pagingRef = ref();
-const paramsId = ref();
+const paramsId = ref<string | number>("");
 const toast = useToast();
-const dialog = reactive({
-  visible: false,
+const isEdit = ref(false);
+const isViewMode = ref(false);
+const loading = ref(false);
+
+// 鍩烘湰淇℃伅琛ㄥ崟鏁版嵁
+const formData = reactive({
+  id: undefined as number | string | undefined,
+  recordDate: "",
+  deviceModel: "",
+  workShift: "",
+  productType: "",
+  model: "",
+  actuallyLength: "",
+  systemNo: "",
+  tensionSetting: "",
+  createUserName: "",
 });
-const cardAttr = ref<any[]>([
-  {
-    label: "鍗曚綅",
-    prop: "inspectionUnit",
-  },
-  {
-    label: "鏍囧噯鍊�",
-    prop: "standardValue",
-  },
-  {
-    label: "鑷鍊�",
-    prop: "inspectionItem",
-  },
-  {
-    label: "鑷缁撴灉",
-    prop: "inspectionResult",
-    color: "#FF1E1E",
-  },
-]);
-const cardList = ref<any[]>([]);
 
-// const addReport = () => {
-//   dialog.visible = true;
-// };
+// 宸ヨ壓璁板綍鍒楄〃
+const inspectionList = ref<any[]>([]);
 
-const toEdit = () => {
-  uni.navigateTo({
-    url: "/pages/production/twist/selfInspect/edit",
+// 鑷寮圭獥
+const inspectionDialogVisible = ref(false);
+const inspectionFormRef = ref();
+const currentEditIndex = ref(-1);
+
+// 鑷琛ㄥ崟鏁版嵁
+const inspectionForm = reactive({
+  recordPosition: "",
+  structureFormula: "",
+  productAppearance: ["鏃犲瑙傞棶棰�"],
+  conclusion: "鍚堟牸",
+  createUserName: "",
+  twistedOuterDiameter: "",
+});
+
+// 缁撴瀯妫�鏌ユ暟鎹�
+const structureItems = ref<any[]>([]);
+
+// 缁炵嚎宸ヨ壓鏁版嵁
+const twistItems = ref<any[]>([]);
+
+// 瀛樺偍浠庢帴鍙h幏鍙栫殑缁撴瀯鍏紡
+const structureFormulaFromApi = ref("");
+
+// 瀛楀吀鏁版嵁
+const recordLocation = ref<any>([]);
+const appearanceOptions = ref<Array<{ label: string; value: string }>>([]);
+
+// 鑾峰彇澶栬鏍囩
+const getAppearanceLabel = (value: string | string[]) => {
+  if (Array.isArray(value)) {
+    return value.join("銆�") || "鏃�";
+  } else {
+    return value || "鏃�";
+  }
+};
+
+// 鑾峰彇璁板綍浣嶇疆鏍囩
+const getRecordPositionLabel = (value: string) => {
+  const option = recordLocation.value.find((item: any) => item.value === value);
+  return option ? option.label : value || "-";
+};
+
+// 鏍煎紡鍖栨暟鍊兼樉绀�
+const formatValue = (value: any, unit?: string) => {
+  if (value === null || value === undefined || value === "") return "-";
+  return unit ? `${value}${unit}` : value;
+};
+
+// 鏍煎紡鍖栨棩鏈熸樉绀�
+const formatDate = (date: string) => {
+  if (!date) return "-";
+  return new Date(date).toLocaleDateString("zh-CN", {
+    year: "numeric",
+    month: "2-digit",
+    day: "2-digit",
   });
 };
-const submit = () => {
-  toast.show("鎻愪氦");
-  dialog.visible = false;
+
+// 璁$畻鑺傚緞姣�
+const calculatePitchRatio = (pitch: string, dia: string) => {
+  if (!pitch || !dia) return "-";
+  const pitchNum = parseFloat(pitch);
+  const diaNum = parseFloat(dia);
+  if (isNaN(pitchNum) || isNaN(diaNum) || diaNum === 0) return "-";
+  return (pitchNum / diaNum).toFixed(2);
 };
 
-const cancel = () => {
-  toast.show("鍙栨秷");
-  dialog.visible = false;
+// 鍒濆鍖栨暟鎹�
+const getData = async () => {
+  if (!paramsId.value) {
+    console.warn("wireId 涓嶅瓨鍦�");
+    return;
+  }
+
+  loading.value = true;
+  try {
+    // 鑾峰彇鍩烘湰淇℃伅
+    const { code, data } = await TwistApi.getStrandedWireInspectionRecordStyleByWireId({
+      wireId: paramsId.value,
+    });
+
+    if (code === 200 && data) {
+      // 鍥炴樉鏁版嵁鍒拌〃鍗�
+      if (data.fixedInfo) {
+        Object.assign(formData, data.fixedInfo);
+      }
+
+      if (data.tensionSetting !== undefined) {
+        formData.tensionSetting = data.tensionSetting;
+      }
+
+      // 澶勭悊缁撴瀯妫�鏌ユ暟鎹�
+      if (data.inspectStructure) {
+        if (data.inspectStructure.structureFormula) {
+          structureFormulaFromApi.value = data.inspectStructure.structureFormula;
+          inspectionForm.structureFormula = data.inspectStructure.structureFormula;
+        }
+
+        if (data.inspectStructure.structureItems) {
+          structureItems.value = data.inspectStructure.structureItems.map((item: any) => ({
+            ...item,
+            actualValue1: "",
+            actualValue2: "",
+          }));
+        }
+      }
+
+      // 澶勭悊缁炵嚎宸ヨ壓鏁版嵁
+      if (data.inspectTwist) {
+        twistItems.value = data.inspectTwist.map((item: any) => ({
+          ...item,
+          pitch: "",
+        }));
+      }
+    }
+
+    // 鑾峰彇鑷鍒楄〃鏁版嵁
+    await getInspectionList();
+
+    // 鑾峰彇瀛楀吀鏁版嵁
+    await loadDictData();
+  } catch (error) {
+    console.error("鑾峰彇鑷鏁版嵁澶辫触:", error);
+    toast.error("鑾峰彇鑷鏁版嵁澶辫触");
+  } finally {
+    loading.value = false;
+  }
 };
 
-const getList = async () => {
-  const { data } = await ManageApi.getSelfInspection({
-    outPutId: paramsId.value,
-    type: "缁炵嚎",
+// 鑾峰彇鑷鍒楄〃鏁版嵁
+const getInspectionList = async () => {
+  if (!paramsId.value) {
+    console.warn("wireId 涓嶅瓨鍦�");
+    return;
+  }
+
+  try {
+    const { code, data } = await TwistApi.getStrandedInspectionInfoByWireId({
+      wireId: paramsId.value,
+    });
+
+    if (code === 200 && data) {
+      inspectionList.value = data.structureInfos || [];
+      inspectionList.value = inspectionList.value.map((item: any) => {
+        return {
+          ...item.structureRecordResult,
+          ...item,
+          structureFormula:
+            item.structureRecordResult?.inspectStructure?.structureFormula || item.structureFormula,
+        };
+      });
+    }
+  } catch (error) {
+    console.error("鑾峰彇鑷鍒楄〃澶辫触:", error);
+  }
+};
+
+// 鍔犺浇瀛楀吀鏁版嵁
+const loadDictData = async () => {
+  try {
+    // 璁板綍浣嶇疆瀛楀吀
+    const recordLocationRes = await ManageApi.dictAPI("record_location");
+    if (recordLocationRes.data && Array.isArray(recordLocationRes.data)) {
+      recordLocation.value = recordLocationRes.data.map((item: any) => ({
+        label: item.dictLabel || "",
+        value: item.dictValue || "",
+      }));
+    }
+
+    // 澶栬閫夐」瀛楀吀
+    const appearanceRes = await ManageApi.dictAPI("draw_appearance_quality");
+    if (appearanceRes.data && Array.isArray(appearanceRes.data)) {
+      appearanceOptions.value = appearanceRes.data.map((item: any) => ({
+        label: item.dictLabel || "",
+        value: item.dictValue || "",
+      }));
+    }
+  } catch (error) {
+    console.error("鍔犺浇瀛楀吀鏁版嵁澶辫触:", error);
+  }
+};
+
+// 淇濆瓨鍩烘湰淇℃伅
+const handleSave = async () => {
+  if (!formData.tensionSetting) {
+    toast.warning("璇疯緭鍏ュ紶鍔涜缃�");
+    return;
+  }
+
+  try {
+    const submitData = {
+      wireId: paramsId.value,
+      strandedWireInspectionRecordId: formData.id,
+      tensionSetting: formData.tensionSetting,
+    };
+
+    const { code } = await TwistApi.saveStrandedWireInspectionFixedRecord(submitData);
+    if (code === 200) {
+      toast.success("淇濆瓨鎴愬姛");
+      isEdit.value = false;
+      await getData();
+    } else {
+      toast.error("淇濆瓨澶辫触");
+    }
+  } catch (error) {
+    console.error("淇濆瓨澶辫触:", error);
+    toast.error("淇濆瓨澶辫触");
+  }
+};
+
+// 缂栬緫
+const handleEdit = () => {
+  isEdit.value = true;
+};
+
+// 鍙栨秷
+const handleCancel = () => {
+  isEdit.value = false;
+  getData();
+};
+
+// 娣诲姞鑷
+const handleAddInspection = () => {
+  currentEditIndex.value = -1;
+  isViewMode.value = false;
+
+  // 娓呯┖琛ㄥ崟
+  Object.assign(inspectionForm, {
+    recordPosition: "",
+    structureFormula: structureFormulaFromApi.value || "",
+    productAppearance: ["鏃犲瑙傞棶棰�"],
+    conclusion: "鍚堟牸",
+    createUserName: "",
+    twistedOuterDiameter: "",
   });
-  pagingRef.value.complete(data);
+
+  // 閲嶇疆缁撴瀯椤瑰拰缁炵嚎宸ヨ壓鏁版嵁
+  if (structureItems.value.length > 0) {
+    structureItems.value = structureItems.value.map((item: any) => {
+      let defaultActualValue1 = "";
+      if (item.structureValue && typeof item.structureValue === "string") {
+        const parts = item.structureValue.split("/");
+        if (parts.length > 0 && parts[0].trim()) {
+          defaultActualValue1 = parts[0].trim();
+        }
+      }
+      return {
+        ...item,
+        actualValue1: defaultActualValue1,
+        actualValue2: "",
+      };
+    });
+  }
+
+  if (twistItems.value.length > 0) {
+    twistItems.value = twistItems.value.map((item: any) => ({
+      ...item,
+      direction: item.direction || "",
+      pitch: "",
+    }));
+  }
+
+  inspectionDialogVisible.value = true;
 };
 
-onLoad((options: any) => {
+// 缂栬緫鑷
+const handleEditInspection = (row: any, index: number) => {
+  currentEditIndex.value = index;
+  isViewMode.value = false;
+
+  const recordResult = row.structureRecordResult || {};
+  const inspectStructure = recordResult.inspectStructure || row.inspectStructure || {};
+  const inspectTwist = recordResult.inspectTwist || row.inspectTwist || [];
+
+  // 閲嶇粍琛ㄥ崟鏁版嵁
+  Object.assign(inspectionForm, {
+    recordPosition: recordResult.recordPosition || row.recordPosition || "",
+    structureFormula: inspectStructure.structureFormula || row.structureFormula || "",
+    productAppearance: recordResult.productAppearance || row.productAppearance || ["鏃犲瑙傞棶棰�"],
+    conclusion: recordResult.conclusion || row.conclusion || "鍚堟牸",
+    twistedOuterDiameter:
+      recordResult.twistedOuterDiameter ||
+      inspectStructure.twistedOuterDiameter ||
+      row.twistedOuterDiameter ||
+      "",
+    createUserName: row.createUserName || "",
+  });
+
+  // 閲嶇粍缁撴瀯椤规暟鎹�
+  if (inspectStructure.structureItems) {
+    structureItems.value = inspectStructure.structureItems.map((item: any) => ({
+      ...item,
+      actualValue1: item.actualValue1 || "",
+      actualValue2: item.actualValue2 || "",
+    }));
+  }
+
+  // 閲嶇粍缁炵嚎宸ヨ壓鏁版嵁
+  if (inspectTwist.length > 0) {
+    twistItems.value = inspectTwist.map((item: any) => ({
+      ...item,
+      direction: item.direction || "",
+      pitch: item.pitch || "",
+      dia: item.dia || "",
+      pitchRatio: item.pitchRatio || calculatePitchRatio(item.pitch, item.dia),
+    }));
+  }
+
+  inspectionDialogVisible.value = true;
+};
+
+// 鏌ョ湅鑷
+const handleViewInspection = (row: any, index: number) => {
+  currentEditIndex.value = index;
+  isViewMode.value = true;
+
+  const recordResult = row.structureRecordResult || {};
+  const inspectStructure = recordResult.inspectStructure || row.inspectStructure || {};
+  const inspectTwist = recordResult.inspectTwist || row.inspectTwist || [];
+
+  Object.assign(inspectionForm, {
+    recordPosition: recordResult.recordPosition || row.recordPosition || "",
+    structureFormula: inspectStructure.structureFormula || row.structureFormula || "",
+    productAppearance: recordResult.productAppearance || row.productAppearance || [],
+    conclusion: recordResult.conclusion || row.conclusion || "鍚堟牸",
+    twistedOuterDiameter:
+      recordResult.twistedOuterDiameter ||
+      inspectStructure.twistedOuterDiameter ||
+      row.twistedOuterDiameter ||
+      "",
+    createUserName: row.createUserName || "",
+  });
+
+  if (inspectStructure.structureItems) {
+    structureItems.value = inspectStructure.structureItems.map((item: any) => ({
+      ...item,
+      actualValue1: item.actualValue1 || "",
+      actualValue2: item.actualValue2 || "",
+    }));
+  }
+
+  if (inspectTwist.length > 0) {
+    twistItems.value = inspectTwist.map((item: any) => ({
+      ...item,
+      direction: item.direction || "",
+      pitch: item.pitch || "",
+      dia: item.dia || "",
+      pitchRatio: item.pitchRatio || calculatePitchRatio(item.pitch, item.dia),
+    }));
+  }
+
+  inspectionDialogVisible.value = true;
+};
+
+// 鍒犻櫎鑷
+const handleDeleteInspection = async (index: number) => {
+  const item = inspectionList.value[index];
+  if (!item || !item.id) {
+    toast.error("鍒犻櫎澶辫触锛氳褰旾D涓嶅瓨鍦�");
+    return;
+  }
+
+  uni.showModal({
+    title: "鎻愮ず",
+    content: "纭畾瑕佸垹闄よ繖鏉″伐鑹鸿褰曞悧锛�",
+    success: async (res) => {
+      if (res.confirm) {
+        try {
+          const { code } = await TwistApi.deleteStrandedWireInspectionStructureRecord(item.id);
+          if (code === 200) {
+            inspectionList.value.splice(index, 1);
+            toast.success("鍒犻櫎鎴愬姛");
+          } else {
+            toast.error("鍒犻櫎澶辫触");
+          }
+        } catch (error) {
+          console.error("鍒犻櫎宸ヨ壓璁板綍澶辫触:", error);
+          toast.error("鍒犻櫎澶辫触");
+        }
+      }
+    },
+  });
+};
+
+// 淇濆瓨鑷
+const handleSaveInspection = async () => {
+  if (!inspectionFormRef.value) return;
+
+  const result = await inspectionFormRef.value.validateAll();
+  if (!result.valid) {
+    toast.warning(result.message || "璇峰畬鎴愬繀濉」");
+    return;
+  }
+
+  try {
+    const submitData = {
+      wireId: paramsId.value,
+      strandedWireInspectionRecordId: formData.id,
+      tensionSetting: formData.tensionSetting,
+      recordPosition: inspectionForm.recordPosition,
+      id: currentEditIndex.value >= 0 ? inspectionList.value[currentEditIndex.value].id : undefined,
+      inspectionStructureResult: {
+        twistedOuterDiameter: inspectionForm.twistedOuterDiameter,
+        recordPosition: inspectionForm.recordPosition,
+        inspectStructure: {
+          structureFormula: inspectionForm.structureFormula,
+          structureItems: structureItems.value.map((item: any) => ({
+            structureName: item.structureName,
+            structureValue: item.structureValue,
+            actualValue1: item.actualValue1,
+            actualValue2: item.actualValue2,
+          })),
+        },
+        inspectTwist: twistItems.value.map((item: any) => ({
+          twistName: item.twistName,
+          direction: item.direction,
+          pitch: item.pitch,
+          dia: item.dia,
+          pitchRatio: calculatePitchRatio(item.pitch, item.dia),
+        })),
+        productAppearance: inspectionForm.productAppearance,
+        conclusion: inspectionForm.conclusion,
+      },
+    };
+
+    const { code } = await TwistApi.saveStrandedWireInspectionStructureRecord(submitData);
+    if (code === 200) {
+      toast.success(currentEditIndex.value >= 0 ? "淇敼鎴愬姛" : "娣诲姞鎴愬姛");
+      inspectionDialogVisible.value = false;
+      await getInspectionList();
+    } else {
+      toast.error("淇濆瓨澶辫触");
+    }
+  } catch (error) {
+    console.error("淇濆瓨宸ヨ壓璁板綍澶辫触:", error);
+    toast.error("淇濆瓨澶辫触");
+  }
+};
+
+onLoad(async (options: any) => {
   paramsId.value = options.id;
+  await getData();
 });
 </script>
 
 <style lang="scss" scoped>
 .list {
-  height: calc(100vh - 120px);
   padding: 12px;
   background: #f3f9f8;
+  min-height: 100vh;
+  padding-bottom: 80px;
+}
 
-  :deep() {
-    .round {
-      border-radius: 4px;
-    }
+.title {
+  position: relative;
+  margin-left: 10px;
+  font-size: 16px;
+  font-weight: 500;
+  color: #0d867f;
+}
+
+.title::after {
+  position: absolute;
+  content: "";
+  top: 4px;
+  left: -10px;
+  width: 4px;
+  height: 16px;
+  background: #0d867f;
+  border-radius: 2px;
+}
+
+:deep() {
+  .round {
+    border-radius: 4px;
   }
 }
 

--
Gitblit v1.9.3