From 8460eac918d8c8e825a0f78ac0af1c03cad8fd49 Mon Sep 17 00:00:00 2001
From: YLouie <929705085@qq.com>
Date: 星期四, 23 十月 2025 16:53:21 +0800
Subject: [PATCH] 拉丝报工填原材料领用

---
 src/pages/production/twist/report/draw.vue |  164 ++++++++++++++++++++++++++++++++----------------------
 1 files changed, 96 insertions(+), 68 deletions(-)

diff --git a/src/pages/production/twist/report/draw.vue b/src/pages/production/twist/report/draw.vue
index 22a7c7a..9f3a160 100644
--- a/src/pages/production/twist/report/draw.vue
+++ b/src/pages/production/twist/report/draw.vue
@@ -10,8 +10,8 @@
           <view class="form-section">
             <template v-for="(item, index) in localMaterialData" :key="index">
               <view v-if="index > 0" class="mt-4 pt-4 border-t border-gray-100"></view>
-              <wd-form>
-                <wd-form-item label="瑙勬牸鍨嬪彿" prop="spec" required>
+              <wd-form :model="item">
+                <wd-form-item label="瑙勬牸鍨嬪彿" prop="model" required>
                   <wd-input v-model="item.model" :disabled="false" placeholder="璇疯緭鍏�"></wd-input>
                 </wd-form-item>
                 <wd-form-item label="澶栬璐ㄩ噺" prop="appearanceQuality" required>
@@ -59,8 +59,8 @@
           <view class="form-section">
             <template v-for="(item, index) in localSteelData" :key="index">
               <view v-if="index > 0" class="mt-4 pt-4 border-t border-gray-100"></view>
-              <wd-form>
-                <wd-form-item label="瑙勬牸鍨嬪彿" prop="spec" required>
+              <wd-form :model="item">
+                <wd-form-item label="瑙勬牸鍨嬪彿" prop="model" required>
                   <wd-input v-model="item.model" :disabled="false" placeholder="璇疯緭鍏�"></wd-input>
                 </wd-form-item>
                 <wd-form-item label="缁炲悜" prop="twistedDirection" required>
@@ -99,7 +99,7 @@
         </wd-tab>
         <wd-tab title="鐩樺叿棰嗙敤" name="reel">
           <view class="form-section">
-            <wd-form>
+            <wd-form :model="localReelData">
               <wd-form-item label="铻烘瘝鏄惁鍥哄畾" prop="nutFixed" required>
                 <wd-picker
                   v-model="localReelData.nutFixed"
@@ -175,69 +175,85 @@
   </view>
 </template>
 
-<script setup>
+<script setup lang="ts">
 import { ref, watch } from "vue";
 import { useToast } from "wot-design-uni";
 import TwistApi from "@/api/product/twist";
+import ManageApi from "@/api/product/manage";
+
+// 瀹氫箟TypeScript鎺ュ彛
+interface MaterialData {
+  model: string;
+  appearanceQuality: string;
+  dia: string;
+  length: string;
+  windingTightness: string;
+  arrangement: string;
+  edgeDistance: string;
+}
+
+interface SteelData {
+  model: string;
+  twistedDirection: string;
+  outerDiameter: string;
+  scratch: string;
+  oilStain: string;
+}
+
+interface ReelData {
+  nutFixed: string;
+  sidePlateFlat: string;
+  centerPlateFlat: string;
+  paintQuality: string;
+  burrCrack: string;
+  edgeBlunt: string;
+  woodMold: string;
+  weldQuality: string;
+}
 
 // 瀹氫箟缁勪欢鐨刾rops
-const props = defineProps({
-  singleRegulationInfoArray: {
-    type: Array,
-    default: () => [],
-  },
-  steelRegulationInfoArray: {
-    type: Array,
-    default: () => [],
-  },
-  reelToolingInfo: {
-    type: Object,
-    default: () => ({}),
-  },
-  wireId: {
-    type: String,
-    default: "",
-  },
-});
+const props = defineProps<{
+  singleRegulationInfoArray: MaterialData[];
+  steelRegulationInfoArray: SteelData[];
+  reelToolingInfo: ReelData;
+  wireId: string;
+}>();
 
-const appearanceQualityOptions = [
-  {
-    label: "鏈夊垝浼�",
-    value: "鏈夊垝浼�",
-  },
-  {
-    label: "鏈夌鑺�",
-    value: "鏈夌鑺�",
-  },
-  {
-    label: "鏈夐粦鑹叉补姹�",
-    value: "鏈夐粦鑹叉补姹�",
-  },
-  {
-    label: "鏃�",
-    value: "鏃�",
-  },
-];
-const paintQualityOptions = [
-  {
-    label: "瀹屽ソ",
-    value: "瀹屽ソ",
-  },
-  {
-    label: "鐮存崯",
-    value: "鐮存崯",
-  },
-];
-const weldQualityOptions = [
-  {
-    label: "宸茬(鍏�",
-    value: "宸茬(鍏�",
-  },
-  {
-    label: "宸茬(鐨�",
-    value: "宸茬(鐨�",
-  },
-];
+const appearanceQualityOptions = ref<Array<{ label: string; value: string | number }>>([]);
+const paintQualityOptions = ref<Array<{ label: string; value: string | number }>>([]);
+const weldQualityOptions = ref<Array<{ label: string; value: string | number }>>([]);
+
+// 浠庢暟鎹瓧鍏镐腑鍔犺浇鏁版嵁
+const loadDictData = async () => {
+  try {
+    // 鍒嗗埆璋冪敤dictAPI鑾峰彇鍚勪釜瀛楀吀鏁版嵁
+    const paintQualityRes = await ManageApi.dictAPI("draw_paint_quality");
+    const weldQualityRes = await ManageApi.dictAPI("draw_welding_quality");
+    const qualityRes = await ManageApi.dictAPI("draw_appearance_quality");
+
+    // 澶勭悊杩斿洖鏁版嵁锛岃浆鎹负缁勪欢鎵�闇�鐨勬牸寮� {label: string, value: string}
+    if (paintQualityRes.data && Array.isArray(paintQualityRes.data)) {
+      paintQualityOptions.value = paintQualityRes.data.map((item) => ({
+        label: item.dictLabel || "",
+        value: item.dictValue || "",
+      }));
+    }
+    if (weldQualityRes.data && Array.isArray(weldQualityRes.data)) {
+      weldQualityOptions.value = weldQualityRes.data.map((item) => ({
+        label: item.dictLabel || "",
+        value: item.dictValue || "",
+      }));
+    }
+    if (qualityRes.data && Array.isArray(qualityRes.data)) {
+      appearanceQualityOptions.value = qualityRes.data.map((item) => ({
+        label: item.dictLabel || "",
+        value: item.dictValue || "",
+      }));
+    }
+  } catch (error) {
+    console.error("鍔犺浇鏁版嵁瀛楀吀澶辫触:", error);
+  }
+};
 const haveOrNotOptions = [
   {
     label: "鏈�",
@@ -260,13 +276,22 @@
 ];
 // 瀹氫箟缁勪欢鐨別mits
 const emit = defineEmits(["close"]);
-const activeTab = ref("material");
+const activeTab = ref<string>("material");
 const toast = useToast();
 
 // 鏈湴鍝嶅簲寮忔暟鎹紝鐢ㄤ簬瀛樺偍鐢ㄦ埛杈撳叆
-const localMaterialData = ref([]);
-const localSteelData = ref([]);
-const localReelData = ref({});
+const localMaterialData = ref<MaterialData[]>([]);
+const localSteelData = ref<SteelData[]>([]);
+const localReelData = ref<ReelData>({
+  nutFixed: "",
+  sidePlateFlat: "",
+  centerPlateFlat: "",
+  paintQuality: "",
+  burrCrack: "",
+  edgeBlunt: "",
+  woodMold: "",
+  weldQuality: "",
+});
 
 // 鍒濆鍖栨湰鍦版暟鎹�
 const initializeData = () => {
@@ -335,7 +360,7 @@
 watch(() => props.steelRegulationInfoArray, initializeData, { deep: true });
 watch(() => props.reelToolingInfo, initializeData, { deep: true });
 
-const handleTabChange = (tabName) => {
+const handleTabChange = (tabName: string) => {
   activeTab.value = tabName;
 };
 
@@ -446,7 +471,10 @@
     return true;
   }
 };
-
+// 鍦ㄧ粍浠舵寕杞芥椂寮傛鍔犺浇鏁版嵁瀛楀吀
+onMounted(async () => {
+  await loadDictData();
+});
 watch(
   () => [props.singleRegulationInfoArray, props.steelRegulationInfoArray, props.reelToolingInfo],
   () => {

--
Gitblit v1.9.3