From faa1b4e58a3b9ff41e446687b2d3a31e6709bd4b Mon Sep 17 00:00:00 2001
From: buhuazhen <hua100783@gmail.com>
Date: 星期一, 23 三月 2026 16:01:12 +0800
Subject: [PATCH] feat(productionProcess): 添加工序机台选择功能到编辑表单

---
 src/views/productionManagement/productionProcess/index.vue |   59 ++++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 52 insertions(+), 7 deletions(-)

diff --git a/src/views/productionManagement/productionProcess/index.vue b/src/views/productionManagement/productionProcess/index.vue
index 67430cb..00b8b71 100644
--- a/src/views/productionManagement/productionProcess/index.vue
+++ b/src/views/productionManagement/productionProcess/index.vue
@@ -70,7 +70,7 @@
 </template>
 
 <script setup>
-  import { onMounted, ref, reactive, toRefs, getCurrentInstance } from "vue";
+  import { onMounted, ref, reactive, toRefs, getCurrentInstance, computed } from "vue";
   import NewProcess from "@/views/productionManagement/productionProcess/New.vue";
   import EditProcess from "@/views/productionManagement/productionProcess/Edit.vue";
   import ImportDialog from "@/components/Dialog/ImportDialog.vue";
@@ -81,6 +81,7 @@
     downloadTemplate,
   } from "@/api/productionManagement/productionProcess.js";
   import { getToken } from "@/utils/auth";
+  import { getDeviceLedger } from "@/api/equipmentManagement/ledger";
 
   const data = reactive({
     searchForm: {
@@ -98,10 +99,28 @@
       label: "宸ュ簭鍚嶇О",
       prop: "name",
     },
-
+    {
+      label: "宸ュ簭鏈哄彴",
+      prop: "deviceName",
+    },
+    {
+      label: "宸ュ簭绫诲瀷",
+      prop: "typeText",
+    },
     {
       label: "宸ヨ祫瀹氶",
       prop: "salaryQuota",
+    },
+    {
+      label: "宸ュ簭",
+      prop: "process",
+    },
+    {
+      label: "鏄惁璐ㄦ",
+      prop: "isQuality",
+      formatData: (params) => {
+        return params ? "鏄�" : "鍚�";
+      },
     },
     {
       label: "澶囨敞",
@@ -130,6 +149,15 @@
   ]);
   const tableData = ref([]);
   const selectedRows = ref([]);
+  const deviceList = ref([]);
+  const deviceNameMap = computed(() => {
+    const map = new Map();
+    (deviceList.value || []).forEach((d) => {
+      if (d?.id == null) return;
+      map.set(d.id, d.deviceName ?? "");
+    });
+    return map;
+  });
   const tableLoading = ref(false);
   const isShowNewModal = ref(false);
   const isShowEditModal = ref(false);
@@ -142,6 +170,15 @@
     total: 0,
   });
   const { proxy } = getCurrentInstance();
+
+  const loadDeviceList = async () => {
+    try {
+      const res = await getDeviceLedger();
+      deviceList.value = Array.isArray(res?.data) ? res.data : [];
+    } catch (e) {
+      deviceList.value = [];
+    }
+  };
 
   // 瀵煎叆鐩稿叧閰嶇疆
   const importAction =
@@ -167,9 +204,16 @@
     listPage(params)
       .then(res => {
         tableLoading.value = false;
-        tableData.value = res.data.records.map(item => ({
-          ...item,
-        }));
+        const records = Array.isArray(res?.data?.records) ? res.data.records : [];
+        const map = deviceNameMap.value;
+        tableData.value = records.map(item => {
+          const deviceName = item?.deviceName ?? map.get(item?.deviceId) ?? "";
+          return {
+            ...item,
+            deviceName,
+            typeText: item.type !== undefined && item.type !== null ? (item.type === 0 ? "璁℃椂" : "璁′欢") : "",
+          };
+        });
         page.total = res.data.total;
       })
       .catch(err => {
@@ -239,7 +283,6 @@
       importDialogRef.value.submit();
     }
   };
-
   // 瀵煎叆鎴愬姛
   const handleImportSuccess = response => {
     if (response.code === 200) {
@@ -301,7 +344,9 @@
   // };
 
   onMounted(() => {
-    getList();
+    loadDeviceList().finally(() => {
+      getList();
+    });
   });
 </script>
 

--
Gitblit v1.9.3