From 27c416bf9742574411401fb67203ee9669e57c8a Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 26 十一月 2025 14:20:02 +0800
Subject: [PATCH] fix: 绞线报工的盘具领用和芯线领用的厂家字段使用字典维护做下拉框

---
 src/pages/production/twist/receive/plate/index.vue    |    4 +
 src/pages/production/twist/receive/plate/form.vue     |   77 +++++++++++++++++++++++++
 src/pages/production/twist/report/draw.vue            |   17 ++++-
 src/pages/production/twist/receive/steelCore/form.vue |   31 +++++++++
 4 files changed, 121 insertions(+), 8 deletions(-)

diff --git a/src/pages/production/twist/receive/plate/form.vue b/src/pages/production/twist/receive/plate/form.vue
index 032e5b0..1d4c19e 100644
--- a/src/pages/production/twist/receive/plate/form.vue
+++ b/src/pages/production/twist/receive/plate/form.vue
@@ -27,13 +27,25 @@
         clearable
         placeholder="璇疯緭鍏ユ暟閲�"
       />
-      <wd-input
+      <wd-picker
+        v-model="model.unit"
+        :columns="unitOptions"
+        label="鍗曚綅"
+        label-width="100px"
+        prop="unit"
+        placeholder="璇烽�夋嫨鍗曚綅"
+        clearable
+        @confirm="handleUnitChange"
+      />
+      <wd-picker
         v-model="model.supplier"
+        :columns="supplierOptions"
         label="鍘傚"
         label-width="100px"
         prop="supplier"
+        placeholder="璇烽�夋嫨鍘傚"
         clearable
-        placeholder="璇疯緭鍏ュ巶瀹�"
+        @confirm="handleSupplierChange"
       />
     </wd-cell-group>
     <wd-toast />
@@ -41,6 +53,7 @@
 </template>
 
 <script setup lang="ts">
+import { onMounted, watch } from "vue";
 import useFormData from "@/hooks/useFormData";
 import TwistApi from "@/api/product/twist";
 import ManageApi from "@/api/product/manage";
@@ -64,6 +77,7 @@
   diskMaterial: undefined, // 鐩樺叿绫诲瀷
   model: undefined, // 灏哄
   amount: undefined, // 鏁伴噺
+  unit: "鍙�", // 鍗曚綅锛岄粯璁ゅ�间负"鍙�"
   supplier: undefined,
   type: "鐩樺叿",
 });
@@ -75,6 +89,12 @@
 // 鐩樺叿绫诲瀷瀛楀吀鏁版嵁
 const diskMaterialOptions = ref<Array<{ label: string; value: string }>>([]);
 const diskMaterialValue = ref("");
+
+// 鍗曚綅瀛楀吀鏁版嵁
+const unitOptions = ref<Array<{ label: string; value: string }>>([]);
+
+// 鍘傚瀛楀吀鏁版嵁
+const supplierOptions = ref<Array<{ label: string; value: string }>>([]);
 
 // 鍔犺浇鐩樺叿绫诲瀷瀛楀吀鏁版嵁
 const loadDiskMaterialDict = async () => {
@@ -91,9 +111,56 @@
   }
 };
 
+// 鍔犺浇鍗曚綅瀛楀吀鏁版嵁
+const loadUnitDict = async () => {
+  try {
+    const res = await ManageApi.dictAPI("technical_weight_unit");
+    if (res.data && Array.isArray(res.data)) {
+      unitOptions.value = res.data.map((item: any) => ({
+        label: item.dictLabel || "",
+        value: item.dictValue || "",
+      }));
+      // 璁剧疆榛樿鍊间负"鍙�"锛屽鏋滃瓧鍏镐腑鏈�"鍙�"閫夐」
+      const defaultOption = unitOptions.value.find(
+        (item) => item.label === "鍙�" || item.value === "鍙�"
+      );
+      if (defaultOption && !model.unit) {
+        model.unit = defaultOption.value;
+      }
+    }
+  } catch (error) {
+    // 鍔犺浇瀛楀吀澶辫触锛岄潤榛樺鐞�
+  }
+};
+
+// 鍔犺浇鍘傚瀛楀吀鏁版嵁
+const loadSupplierDict = async () => {
+  try {
+    const res = await ManageApi.dictAPI("factory");
+    if (res.data && Array.isArray(res.data)) {
+      supplierOptions.value = res.data.map((item: any) => ({
+        label: item.dictLabel || "",
+        value: item.dictValue || "",
+      }));
+    }
+  } catch (error) {
+    // 鍔犺浇瀛楀吀澶辫触锛岄潤榛樺鐞�
+  }
+};
+
 // 澶勭悊鐩樺叿绫诲瀷閫夋嫨
 const handleDiskMaterialChange = (val: any) => {
   model.diskMaterial = val.value;
+};
+
+// 澶勭悊鍗曚綅閫夋嫨
+const handleUnitChange = (val: any) => {
+  model.unit = val.value;
+};
+
+// 澶勭悊鍘傚閫夋嫨
+const handleSupplierChange = (val: any) => {
+  model.supplier = val.value;
 };
 
 // 鐩戝惉 model.diskMaterial 鍙樺寲锛屽悓姝ラ�夋嫨鍣ㄦ樉绀�
@@ -139,6 +206,7 @@
         diskMaterial: model.diskMaterial,
         model: model.model,
         amount: model.amount,
+        unit: model.unit,
         supplier: model.supplier,
         type: model.type,
       };
@@ -175,6 +243,7 @@
     model.diskMaterial = currentItem.diskMaterial;
     model.model = currentItem.model;
     model.amount = currentItem.amount;
+    model.unit = currentItem.unit || "鍙�";
     model.supplier = currentItem.supplier;
     model.type = currentItem.type || "鐩樺叿";
     // 璁剧疆鐩樺叿绫诲瀷鐨勫洖鏄惧��
@@ -188,6 +257,8 @@
 
 onMounted(async () => {
   await loadDiskMaterialDict();
+  await loadUnitDict();
+  await loadSupplierDict();
 });
 
 // 鐩戝惉缂栬緫鏁版嵁鍙樺寲锛岃嚜鍔ㄥ洖鏄�
@@ -198,6 +269,7 @@
       model.diskMaterial = newData.diskMaterial || "";
       model.model = newData.model || "";
       model.amount = newData.amount || "";
+      model.unit = newData.unit || "鍙�";
       model.supplier = newData.supplier || "";
       model.type = newData.type || "鐩樺叿";
       diskMaterialValue.value = newData.diskMaterial || "";
@@ -211,6 +283,7 @@
   model.diskMaterial = undefined;
   model.model = undefined;
   model.amount = undefined;
+  model.unit = "鍙�";
   model.supplier = undefined;
   model.type = "鐩樺叿";
   diskMaterialValue.value = "";
diff --git a/src/pages/production/twist/receive/plate/index.vue b/src/pages/production/twist/receive/plate/index.vue
index 222205a..63a768e 100644
--- a/src/pages/production/twist/receive/plate/index.vue
+++ b/src/pages/production/twist/receive/plate/index.vue
@@ -85,6 +85,10 @@
     prop: "amount",
   },
   {
+    label: "鍗曚綅",
+    prop: "unit",
+  },
+  {
     label: "鍘傚",
     prop: "supplier",
     span: 14,
diff --git a/src/pages/production/twist/receive/steelCore/form.vue b/src/pages/production/twist/receive/steelCore/form.vue
index 4561801..d3fb9a4 100644
--- a/src/pages/production/twist/receive/steelCore/form.vue
+++ b/src/pages/production/twist/receive/steelCore/form.vue
@@ -43,19 +43,22 @@
         clearable
         placeholder="璇疯緭鍏ラ噸閲�"
       />
-      <wd-input
+      <wd-picker
         v-model="model.supplier"
+        :columns="supplierOptions"
         label="鍘傚"
         label-width="100px"
         prop="supplier"
+        placeholder="璇烽�夋嫨鍘傚"
         clearable
-        placeholder="璇疯緭鍏ュ巶瀹�"
+        @confirm="handleSupplierChange"
       />
     </wd-cell-group>
   </wd-form>
 </template>
 
 <script lang="ts" setup>
+import { onMounted, watch } from "vue";
 import useFormData from "@/hooks/useFormData";
 import TwistApi from "@/api/product/twist";
 import ManageApi from "@/api/product/manage";
@@ -95,6 +98,9 @@
 const diskMaterialOptions = ref<Array<{ label: string; value: string }>>([]);
 const diskMaterialValue = ref("");
 
+// 鍘傚瀛楀吀鏁版嵁
+const supplierOptions = ref<Array<{ label: string; value: string }>>([]);
+
 // 鍔犺浇鑺嚎绫诲瀷瀛楀吀鏁版嵁
 const loadDiskMaterialDict = async () => {
   try {
@@ -110,9 +116,29 @@
   }
 };
 
+// 鍔犺浇鍘傚瀛楀吀鏁版嵁
+const loadSupplierDict = async () => {
+  try {
+    const res = await ManageApi.dictAPI("factory");
+    if (res.data && Array.isArray(res.data)) {
+      supplierOptions.value = res.data.map((item: any) => ({
+        label: item.dictLabel || "",
+        value: item.dictValue || "",
+      }));
+    }
+  } catch (error) {
+    // 鍔犺浇瀛楀吀澶辫触锛岄潤榛樺鐞�
+  }
+};
+
 // 澶勭悊鑺嚎绫诲瀷閫夋嫨
 const handleDiskMaterialChange = (val: any) => {
   model.diskMaterial = val.value;
+};
+
+// 澶勭悊鍘傚閫夋嫨
+const handleSupplierChange = (val: any) => {
+  model.supplier = val.value;
 };
 
 // 鐩戝惉 model.diskMaterial 鍙樺寲锛屽悓姝ラ�夋嫨鍣ㄦ樉绀�
@@ -256,6 +282,7 @@
 
 onMounted(async () => {
   await loadDiskMaterialDict();
+  await loadSupplierDict();
 });
 
 defineExpose({
diff --git a/src/pages/production/twist/report/draw.vue b/src/pages/production/twist/report/draw.vue
index 4d11d8f..5a68e30 100644
--- a/src/pages/production/twist/report/draw.vue
+++ b/src/pages/production/twist/report/draw.vue
@@ -161,11 +161,14 @@
                 ></wd-input>
               </wd-form-item>
               <wd-form-item label="缁炲悜" prop="twistedDirection" required>
-                <wd-input
+                <wd-select-picker
                   v-model="localSteelData.twistedDirection"
+                  :columns="twistDirectionColumns"
+                  type="radio"
+                  placeholder="璇烽�夋嫨缁炲悜"
+                  :clearable="false"
                   :disabled="false"
-                  placeholder="璇疯緭鍏�"
-                ></wd-input>
+                />
               </wd-form-item>
               <wd-form-item label="澶栧緞" prop="outerDiameter" required>
                 <wd-input
@@ -199,7 +202,7 @@
 </template>
 
 <script setup lang="ts">
-import { ref, watch, nextTick } from "vue";
+import { ref, watch, nextTick, onMounted } from "vue";
 import { useToast } from "wot-design-uni";
 import TwistApi from "@/api/product/twist";
 import ManageApi from "@/api/product/manage";
@@ -246,6 +249,12 @@
 const paintQualityOptions = ref<Array<{ label: string; value: string | number }>>([]);
 const weldQualityOptions = ref<Array<{ label: string; value: string | number }>>([]);
 
+// 缁炲悜閫夐」
+const twistDirectionColumns = [
+  { label: "宸﹀悜", value: "宸﹀悜" },
+  { label: "鍙冲悜", value: "鍙冲悜" },
+];
+
 // 浠庢暟鎹瓧鍏镐腑鍔犺浇鏁版嵁
 const loadDictData = async () => {
   try {

--
Gitblit v1.9.3