From 846e1e0767ebc2a4851e35c58688a3ccd0e753e4 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期五, 08 五月 2026 16:37:45 +0800
Subject: [PATCH] 主生产计划下发的时候进行车间选择

---
 src/views/productionPlan/productionPlan/index.vue |   54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/src/views/productionPlan/productionPlan/index.vue b/src/views/productionPlan/productionPlan/index.vue
index 46d0548..589cbd5 100644
--- a/src/views/productionPlan/productionPlan/index.vue
+++ b/src/views/productionPlan/productionPlan/index.vue
@@ -131,6 +131,18 @@
                            @change="onBlur"
                            style="width: 100%" />
         </el-form-item>
+        <el-form-item label="杞﹂棿">
+          <el-select v-model="mergeForm.workshopId"
+                     placeholder="璇烽�夋嫨杞﹂棿"
+                     clearable
+                     filterable
+                     style="width: 100%">
+            <el-option v-for="item in workshopOptions"
+                       :key="item.id"
+                       :label="item.name"
+                       :value="item.id" />
+          </el-select>
+        </el-form-item>
       </el-form>
       <template #footer>
         <span class="dialog-footer">
@@ -243,6 +255,7 @@
     toRefs,
     getCurrentInstance,
     computed,
+    watch,
   } from "vue";
   import { useRouter } from "vue-router";
   import dayjs from "dayjs";
@@ -258,6 +271,7 @@
     productionPlanCombine,
   } from "@/api/productionPlan/productionPlan.js";
   import { productTreeList, modelListPage } from "@/api/basicData/product.js";
+  import { workshopPage } from "@/api/basicData/workshop.js";
   import PIMTable from "./components/PIMTable.vue";
   import ImportDialog from "@/components/Dialog/ImportDialog.vue";
 
@@ -425,6 +439,7 @@
             mergeForm.planCompleteTime = row.requiredDate || "";
             mergeForm.productId = row.productId || "";
             mergeForm.ids = [row.id];
+            mergeForm.workshopId = row.workshopId ?? undefined;
             sumAssignedQuantity.value =
               Number(row.qtyRequired || 0) - Number(row.quantityIssued || 0);
             isShowNewModal.value = true;
@@ -467,6 +482,44 @@
     totalAssignedQuantity: 0,
     planCompleteTime: "",
     productId: "",
+    workshopId: undefined,
+    ids: [],
+  });
+
+  const workshopOptions = ref([]);
+
+  function parseWorkshopPagePayload(res) {
+    const payload = res?.data;
+    if (!payload) {
+      return { records: [], total: 0 };
+    }
+    if (Array.isArray(payload)) {
+      return { records: payload, total: payload.length };
+    }
+    const records = payload.records ?? payload.list ?? payload.rows ?? [];
+    const total = Number(payload.total ?? payload.totalCount ?? 0);
+    return { records: Array.isArray(records) ? records : [], total };
+  }
+
+  const fetchWorkshopOptions = () => {
+    workshopPage({
+      name: "",
+      principal: "",
+      contactPhone: "",
+      current: 1,
+      size: 999,
+    }).then(res => {
+      if (res.code === 200) {
+        const { records } = parseWorkshopPagePayload(res);
+        workshopOptions.value = records;
+      }
+    });
+  };
+
+  watch(isShowNewModal, val => {
+    if (val) {
+      fetchWorkshopOptions();
+    }
   });
 
   // 瀵煎叆鐩稿叧
@@ -739,6 +792,7 @@
     mergeForm.planCompleteTime = firstRow.requiredDate || "";
     mergeForm.productId = firstRow.productId || "";
     mergeForm.ids = selectedRows.value.map(row => row.id);
+    mergeForm.workshopId = firstRow.workshopId ?? undefined;
 
     // 鎵撳紑寮圭獥
     isShowNewModal.value = true;

--
Gitblit v1.9.3