From da57fbd8e7fa021614fb32502fb1520ea4e34e1e Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 18 五月 2026 11:35:16 +0800
Subject: [PATCH] 浪潮 1.样式修改

---
 src/views/productionPlan/productionPlan/index.vue |  175 +++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 143 insertions(+), 32 deletions(-)

diff --git a/src/views/productionPlan/productionPlan/index.vue b/src/views/productionPlan/productionPlan/index.vue
index 0c8399c..233b1a4 100644
--- a/src/views/productionPlan/productionPlan/index.vue
+++ b/src/views/productionPlan/productionPlan/index.vue
@@ -13,6 +13,14 @@
                     style="width: 160px;"
                     @keyup.enter="handleQuery" />
         </el-form-item>
+<!--        <el-form-item label="閿�鍞悎鍚屽彿:"-->
+<!--                      prop="salesContractNo">-->
+<!--          <el-input v-model="searchForm.salesContractNo"-->
+<!--                    placeholder="璇疯緭鍏�"-->
+<!--                    clearable-->
+<!--                    style="width: 160px;"-->
+<!--                    @keyup.enter="handleQuery" />-->
+<!--        </el-form-item>-->
         <el-form-item label="闇�姹傛棩鏈熻寖鍥�:"
                       prop="dateRange">
           <el-date-picker v-model="searchForm.dateRange"
@@ -88,6 +96,13 @@
         <template #qtyRequired="{ row }">
           {{ row.qtyRequired || '-' }}<span style="color:rgba(12, 46, 40, 0.76)"> {{ row.unit || '鏂�' }}</span>
         </template>
+        <template #salesContractNo="{ row }">
+          <el-button type="primary"
+                     text
+                     link
+                     @click="showDetail(row)">{{ row.salesContractNo }}
+          </el-button>
+        </template>
       </PIMTable>
     </div>
     <!-- 鍚堝苟涓嬪彂寮圭獥 -->
@@ -95,7 +110,7 @@
                destroy-on-close
                title="鍚堝苟涓嬪彂"
                width="600px">
-      <el-form :model="mergeForm"
+      <el-form :model="mergeForm" :rules="mergeFormRules"
                label-width="120px">
         <el-row :gutter="20">
           <el-col :span="10">
@@ -124,12 +139,24 @@
                            @change="onBlur"
                            style="width: 100%" />
         </el-form-item>
+        <el-form-item label="杞﹂棿" prop="workshopId" required>
+          <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">
-          <el-button @click="isShowNewModal = false">鍙栨秷</el-button>
           <el-button type="primary"
                      @click="handleMergeSubmit">纭畾涓嬪彂</el-button>
+          <el-button @click="isShowNewModal = false">鍙栨秷</el-button>
         </span>
       </template>
     </el-dialog>
@@ -221,9 +248,9 @@
       </el-form>
       <template #footer>
         <span class="dialog-footer">
-          <el-button @click="dialogVisible = false">鍙栨秷</el-button>
           <el-button type="primary"
                      @click="handleSubmit">纭畾</el-button>
+          <el-button @click="dialogVisible = false">鍙栨秷</el-button>
         </span>
       </template>
     </el-dialog>
@@ -238,6 +265,7 @@
     toRefs,
     getCurrentInstance,
     computed,
+    watch,
   } from "vue";
   import { useRouter } from "vue-router";
   import dayjs from "dayjs";
@@ -251,8 +279,10 @@
     productionPlanUpdate,
     productionPlanDelete,
     productionPlanCombine,
+    exportProductionPlan,
   } 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";
 
@@ -264,11 +294,6 @@
     return Promise.resolve({ code: 200, msg: "鍚屾鎴愬姛" });
   };
 
-  const exportProductionPlan = () => {
-    console.log("Mock exportProductionPlan called");
-    return Promise.resolve();
-  };
-
   // const productionPlanCombine = payload => {
   //   console.log("Mock productionPlanCombine called with:", payload);
   //   return Promise.resolve({ code: 200, msg: "鍚堝苟涓嬪彂鎴愬姛" });
@@ -278,45 +303,49 @@
     {
       label: "涓荤敓浜ц鍒掑彿",
       prop: "mpsNo",
-      width: "150px",
+      minWidth: "150px",
+      align: "center",
     },
-    {
-      label: "鏉ユ簮",
-      prop: "source",
-      width: "150px",
-      dataType: "tag",
-      formatType: params => {
-        return params == "閿�鍞�" ? "primary" : "info";
-      },
-      formatData: params => {
-        return params == "閿�鍞�" ? "閿�鍞�" : "鍐呴儴";
-      },
-    },
+    // {
+    //   label: "鏉ユ簮",
+    //   prop: "source",
+    //   width: "150px",
+    //   dataType: "tag",
+    //   formatType: params => {
+    //     return params == "閿�鍞�" ? "primary" : "info";
+    //   },
+    //   formatData: params => {
+    //     return params == "閿�鍞�" ? "閿�鍞�" : "鍐呴儴";
+    //   },
+    // },
     {
       label: "浜у搧鍚嶇О",
       prop: "productName",
-      width: "200px",
+      minWidth: "200px",
       dataType: "tag",
       formatType: params => {
         return "primary";
       },
+      align: "center",
     },
     {
       label: "浜у搧瑙勬牸",
       prop: "model",
-      width: "150px",
+      minWidth: "150px",
       className: "spec-cell",
+      align: "center",
     },
     {
       label: "鍗曚綅",
       prop: "unit",
       width: "100px",
+      align: "center",
     },
     {
       label: "鎵�闇�鏁伴噺",
       prop: "qtyRequired",
-      width: "150px",
-      align: "right",
+      minWidth: "150px",
+      align: "center",
       dataType: "slot",
       slot: "qtyRequired",
       className: "volume-cell",
@@ -343,32 +372,54 @@
         };
         return statusMap[cell] || "";
       },
+      align: "center",
     },
     {
       label: "宸蹭笅鍙戞暟閲�",
       prop: "quantityIssued",
-      width: "120px",
+      minWidth: "120px",
       className: "spec-cell",
+      align: "center",
       // formatData: (cell, row) => (cell ? `${cell}${row.unit || "鏂�"}` : 0),
     },
     {
       label: "闇�姹傛棩鏈�",
       prop: "requiredDate",
-      width: "160px",
+      minWidth: "160px",
       className: "date-cell",
       formatData: cell => (cell ? dayjs(cell).format("YYYY-MM-DD") : ""),
+      align: "center",
     },
     {
       label: "鎵胯鏃ユ湡",
       prop: "promisedDeliveryDate",
-      width: "160px",
+      minWidth: "160px",
       className: "date-cell",
       formatData: cell => (cell ? dayjs(cell).format("YYYY-MM-DD") : ""),
+      align: "center",
     },
+    // {
+    //   label: "閿�鍞悎鍚屽彿",
+    //   prop: "salesContractNo",
+    //   width: "200px",
+    //   dataType: "slot",
+    //   slot: "salesContractNo",
+    // },
+    // {
+    //   label: "瀹㈡埛鍚嶇О",
+    //   prop: "customerName",
+    //   width: "150px",
+    // },
+    // {
+    //   label: "椤圭洰鍚嶇О",
+    //   prop: "projectName",
+    //   width: "150px",
+    // },
     {
       label: "澶囨敞",
-      width: "150px",
+      minWidth: "150px",
       prop: "remark",
+      align: "center",
     },
     {
       dataType: "action",
@@ -382,7 +433,7 @@
           type: "primary",
           link: true,
           showHide: row => {
-            return row.status == 0;
+            return row.status == 0 && row.source != "閿�鍞�";
           },
           clickFun: row => {
             handleEdit(row);
@@ -398,12 +449,13 @@
             mergeForm.productName = row.productName || "";
             mergeForm.model = row.model || "";
             mergeForm.totalAssignedQuantity =
-              Number(row.qtyRequired || 0) - Number(row.quantityIssued || 0);
+                Number(row.qtyRequired || 0) - Number(row.quantityIssued || 0);
             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);
+                Number(row.qtyRequired || 0) - Number(row.quantityIssued || 0);
             isShowNewModal.value = true;
           },
         },
@@ -430,6 +482,12 @@
   });
   const selectedRows = ref([]);
 
+  const mergeFormRules = {
+    workshopId: [
+      { required: true, message: '璇烽�夋嫨杞﹂棿', trigger: 'change' }
+    ]
+  }
+
   // 浜у搧绫诲埆姹囨�荤粺璁℃暟鎹�
   const categorySummary = ref([]);
   // 浜у搧绫诲埆姹囨�诲脊绐楁帶鍒�
@@ -444,6 +502,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();
+    }
   });
 
   // 瀵煎叆鐩稿叧
@@ -568,6 +664,7 @@
   const data = reactive({
     searchForm: {
       mpsNo: "",
+      salesContractNo: "",
       productName: "",
       model: "",
       status: "",
@@ -596,6 +693,7 @@
     }
     Object.assign(searchForm.value, {
       mpsNo: "",
+      salesContractNo: "",
       productName: "",
       model: "",
       status: "",
@@ -716,9 +814,18 @@
     mergeForm.planCompleteTime = firstRow.requiredDate || "";
     mergeForm.productId = firstRow.productId || "";
     mergeForm.ids = selectedRows.value.map(row => row.id);
+    mergeForm.workshopId = firstRow.workshopId ?? undefined;
 
     // 鎵撳紑寮圭獥
     isShowNewModal.value = true;
+  };
+  const showDetail = row => {
+    router.push({
+      path: "/salesManagement/salesLedger",
+      query: {
+        salesContractNo: row.salesContractNo,
+      },
+    });
   };
 
   // 澶勭悊鍚堝苟涓嬪彂鎻愪氦
@@ -727,6 +834,10 @@
       ElMessage.warning("璇疯緭鍏ョ敓浜ф暟閲�");
       return;
     }
+    if(!mergeForm.workshopId){
+      ElMessage.warning("璇烽�夋嫨杞﹂棿");
+      return;
+    }
     console.log(sumAssignedQuantity.value, "sumAssignedQuantity");
 
     // 楠岃瘉totalAssignedQuantity涓嶈兘澶т簬鎬绘柟鏁�

--
Gitblit v1.9.3