From 8a72d17f6cf36376017f51a8039a4ffc90bff885 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期一, 09 三月 2026 17:54:54 +0800
Subject: [PATCH] 主生产计划页面部分

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

diff --git a/src/views/productionPlan/productionPlan/index.vue b/src/views/productionPlan/productionPlan/index.vue
new file mode 100644
index 0000000..15c1fa9
--- /dev/null
+++ b/src/views/productionPlan/productionPlan/index.vue
@@ -0,0 +1,576 @@
+<template>
+  <div class="app-container">
+    <div class="search_form">
+      <el-form :model="searchForm"
+               :inline="true">
+        <el-form-item label="杞﹂棿:">
+          <el-select v-model="searchForm.workshop"
+                     placeholder="璇烽�夋嫨"
+                     clearable
+                     style="width: 160px;"
+                     @change="handleQuery">
+            <el-option label="杞﹂棿1"
+                       value="1" />
+            <el-option label="杞﹂棿2"
+                       value="2" />
+            <el-option label="杞﹂棿3"
+                       value="3" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="鐘舵��:">
+          <el-select v-model="searchForm.status"
+                     placeholder="璇烽�夋嫨"
+                     clearable
+                     style="width: 160px;"
+                     @change="handleQuery">
+            <el-option label="寰呭鐞�"
+                       value="pending" />
+            <el-option label="杩涜涓�"
+                       value="processing" />
+            <el-option label="宸插畬鎴�"
+                       value="completed" />
+          </el-select>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary"
+                     @click="handleQuery">鎼滅储</el-button>
+        </el-form-item>
+      </el-form>
+      <div>
+        <el-button type="primary"
+                   @click="handleMerge">鍜屽苟涓嬪彂</el-button>
+        <el-button type="info"
+                   @click="showCategorySummaryDialog = true">浜у搧绫诲埆姹囨��</el-button>
+        <!-- <el-button type="danger"
+                   @click="handleDelete">鍒犻櫎</el-button> -->
+      </div>
+    </div>
+    <div class="table_list">
+      <PIMTable rowKey="id"
+                :column="tableColumn"
+                :tableData="tableData"
+                :page="page"
+                :tableLoading="tableLoading"
+                :isSelection="true"
+                :selectable="isSelectable"
+                @selection-change="handleSelectionChange"
+                @pagination="pagination">
+      </PIMTable>
+    </div>
+    <!-- 鍚堝苟涓嬪彂寮圭獥 -->
+    <el-dialog v-model="isShowNewModal"
+               title="鍚堝苟涓嬪彂"
+               width="500px">
+      <el-form :model="mergeForm"
+               label-width="120px">
+        <el-form-item label="鐢熶骇璁″垝鍙�">
+          <el-input v-model="mergeForm.productionPlanNo"
+                    disabled />
+        </el-form-item>
+        <el-form-item label="鐢熶骇璁″垝鏁伴噺">
+          <el-input-number v-model="mergeForm.totalManufactureQuantity"
+                           :min="1"
+                           :step="1"
+                           style="width: 100%" />
+        </el-form-item>
+        <el-form-item label="澶囨敞">
+          <el-input v-model="mergeForm.remark"
+                    type="textarea" />
+        </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>
+        </span>
+      </template>
+    </el-dialog>
+    <!-- 浜у搧绫诲埆姹囨�诲脊绐� -->
+    <el-dialog v-model="showCategorySummaryDialog"
+               title="浜у搧绫诲埆姹囨�荤粺璁�"
+               width="400px">
+      <el-table :data="categorySummary"
+                border
+                style="width: 100%">
+        <el-table-column prop="productCategory"
+                         label="浜у搧绫诲埆"
+                         align="center"
+                         width="150" />
+        <el-table-column prop="totalManufactureQuantity"
+                         label="鎬诲埗閫犳暟閲�"
+                         align="center" />
+      </el-table>
+      <template #footer>
+        <span class="dialog-footer">
+          <el-button @click="showCategorySummaryDialog = false">鍏抽棴</el-button>
+        </span>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+  import { onMounted, ref } from "vue";
+  import { ElMessage } from "element-plus";
+  import dayjs from "dayjs";
+  import { productOrderListPage } from "@/api/productionManagement/productionOrder.js";
+  import PIMTable from "./components/PIMTable.vue";
+
+  const tableColumn = ref([
+    {
+      label: "鏉ユ簮",
+      prop: "source",
+      width: "100px",
+    },
+    {
+      label: "鐘舵��",
+      prop: "status",
+      width: "80px",
+    },
+    {
+      label: "瀹℃牳鐘舵��",
+      prop: "auditStatus",
+      width: "100px",
+    },
+    {
+      label: "璁㈠崟鍙�",
+      prop: "orderNo",
+      width: "120px",
+    },
+    {
+      label: "鐢熶骇璁″垝鍙�",
+      prop: "productionPlanNo",
+      width: "140px",
+    },
+    {
+      label: "闆朵欢鍙�",
+      prop: "partNo",
+      width: "120px",
+    },
+    {
+      label: "闆朵欢",
+      prop: "partName",
+      width: "120px",
+    },
+    {
+      label: "浜у搧绫诲埆",
+      prop: "productCategory",
+      width: "100px",
+    },
+    {
+      label: "宸ヨ壓鏂囦欢鍙�",
+      prop: "processFileNo",
+      width: "140px",
+    },
+    {
+      label: "閿�鍞暟閲�",
+      prop: "salesQuantity",
+      width: "100px",
+      align: "right",
+    },
+    {
+      label: "鍒堕�犳暟閲�",
+      prop: "manufactureQuantity",
+      width: "100px",
+      align: "right",
+    },
+    {
+      label: "闆朵欢鍗曚綅",
+      prop: "partUnit",
+      width: "80px",
+    },
+    {
+      label: "涓昏鍒掗渶姹傛棩鏈�",
+      prop: "mainPlanDemandDate",
+      formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
+      width: "140px",
+    },
+    {
+      label: "鎵胯鏃ユ湡",
+      prop: "commitmentDate",
+      formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
+      width: "120px",
+    },
+    {
+      label: "鍒堕�犲睘鎬�",
+      prop: "manufactureProperty",
+      width: "100px",
+    },
+    {
+      label: "澶囨敞",
+      prop: "remark",
+      width: "150px",
+    },
+    {
+      label: "鏇存柊鏃堕棿",
+      prop: "updateTime",
+      formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
+      width: "120px",
+    },
+    {
+      label: "鏇存柊浜�",
+      prop: "updateBy",
+      width: "100px",
+    },
+    {
+      label: "鍒涘缓鏃堕棿",
+      prop: "createTime",
+      formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
+      width: "120px",
+    },
+    {
+      label: "鍒涘缓浜�",
+      prop: "createBy",
+      width: "100px",
+    },
+    {
+      dataType: "action",
+      label: "鎿嶄綔",
+      align: "center",
+      fixed: "right",
+      width: 200,
+      operation: [
+        {
+          name: "涓嬪彂",
+          type: "text",
+          clickFun: row => {
+            // 鍗曠嫭涓嬪彂鎿嶄綔
+            // 璁剧疆琛ㄥ崟鏁版嵁
+            mergeForm.productionPlanNo = row.productionPlanNo;
+            mergeForm.totalManufactureQuantity = row.manufactureQuantity;
+            mergeForm.remark = "";
+
+            // 鎵撳紑寮圭獥
+            isShowNewModal.value = true;
+          },
+        },
+        {
+          name: "杩借釜杩涘害",
+          type: "text",
+          clickFun: row => {
+            // 杩借釜杩涘害鎿嶄綔
+            ElMessage.warning("杩借釜杩涘害鍔熻兘寰呭紑鍙�");
+          },
+        },
+      ],
+    },
+  ]);
+  const tableData = ref([]);
+  const tableLoading = ref(false);
+  const page = reactive({
+    current: 1,
+    size: 100,
+    total: 0,
+  });
+  const selectedRows = ref([]);
+
+  // 浜у搧绫诲埆姹囨�荤粺璁℃暟鎹�
+  const categorySummary = ref([]);
+  // 浜у搧绫诲埆姹囨�诲脊绐楁帶鍒�
+  const showCategorySummaryDialog = ref(false);
+
+  // 鍚堝苟涓嬪彂寮圭獥鎺у埗
+  const isShowNewModal = ref(false);
+  // 鍚堝苟涓嬪彂琛ㄥ崟鏁版嵁
+  const mergeForm = reactive({
+    productionPlanNo: "",
+    totalManufactureQuantity: 0,
+    remark: "",
+  });
+
+  const data = reactive({
+    searchForm: {
+      customerName: "",
+      salesContractNo: "",
+      projectName: "",
+      productCategory: "",
+      specificationModel: "",
+    },
+  });
+  const { searchForm } = toRefs(data);
+
+  // 鏌ヨ鍒楄〃
+  /** 鎼滅储鎸夐挳鎿嶄綔 */
+  const handleQuery = () => {
+    page.current = 1;
+    getList();
+  };
+  const pagination = obj => {
+    page.current = obj.page;
+    page.size = obj.limit;
+    getList();
+  };
+  // 璁$畻浜у搧绫诲埆姹囨�荤粺璁�
+  const calculateCategorySummary = () => {
+    const summary = {};
+
+    // 閬嶅巻琛ㄦ牸鏁版嵁锛屾寜浜у搧绫诲埆姹囨��
+    tableData.value.forEach(row => {
+      const category = row.productCategory;
+      if (!summary[category]) {
+        summary[category] = {
+          productCategory: category,
+          totalManufactureQuantity: 0,
+        };
+      }
+      summary[category].totalManufactureQuantity += row.manufactureQuantity;
+    });
+
+    // 杞崲涓烘暟缁勬牸寮�
+    categorySummary.value = Object.values(summary);
+  };
+
+  const getList = () => {
+    tableLoading.value = true;
+    // 鏋勯�犱竴涓柊鐨勫璞★紝涓嶅寘鍚玡ntryDate瀛楁
+    const params = { ...searchForm.value, ...page };
+    params.entryDate = undefined;
+    tableData.value = [
+      {
+        id: 1,
+        source: "閿�鍞鍗�",
+        status: "寰呭鐞�",
+        auditStatus: "宸插鏍�",
+        orderNo: "SO20260301001",
+        productionPlanNo: "PP20260301001",
+        partNo: "P001",
+        partName: "闆朵欢A",
+        productCategory: "绫诲埆1",
+        processFileNo: "PF20260301001",
+        salesQuantity: 100,
+        manufactureQuantity: 105,
+        partUnit: "涓�",
+        mainPlanDemandDate: "2026-03-15",
+        commitmentDate: "2026-03-10",
+        manufactureProperty: "甯歌",
+        remark: "",
+        updateTime: "2026-03-01",
+        updateBy: "admin",
+        createTime: "2026-03-01",
+        createBy: "admin",
+      },
+      {
+        id: 2,
+        source: "閿�鍞鍗�",
+        status: "寰呭鐞�",
+        auditStatus: "宸插鏍�",
+        orderNo: "SO20260301002",
+        productionPlanNo: "PP20260301001",
+        partNo: "P002",
+        partName: "闆朵欢B",
+        productCategory: "绫诲埆1",
+        processFileNo: "PF20260301002",
+        salesQuantity: 200,
+        manufactureQuantity: 210,
+        partUnit: "涓�",
+        mainPlanDemandDate: "2026-03-15",
+        commitmentDate: "2026-03-10",
+        manufactureProperty: "甯歌",
+        remark: "",
+        updateTime: "2026-03-01",
+        updateBy: "admin",
+        createTime: "2026-03-01",
+        createBy: "admin",
+      },
+      {
+        id: 3,
+        source: "閿�鍞鍗�",
+        status: "杩涜涓�",
+        auditStatus: "宸插鏍�",
+        orderNo: "SO20260301003",
+        productionPlanNo: "PP20260301002",
+        partNo: "P003",
+        partName: "闆朵欢C",
+        productCategory: "绫诲埆2",
+        processFileNo: "PF20260301003",
+        salesQuantity: 150,
+        manufactureQuantity: 155,
+        partUnit: "涓�",
+        mainPlanDemandDate: "2026-03-20",
+        commitmentDate: "2026-03-15",
+        manufactureProperty: "甯歌",
+        remark: "",
+        updateTime: "2026-03-01",
+        updateBy: "admin",
+        createTime: "2026-03-01",
+        createBy: "admin",
+      },
+      {
+        id: 4,
+        source: "閿�鍞鍗�",
+        status: "杩涜涓�",
+        auditStatus: "宸插鏍�",
+        orderNo: "SO20260301004",
+        productionPlanNo: "PP20260301002",
+        partNo: "P004",
+        partName: "闆朵欢D",
+        productCategory: "绫诲埆2",
+        processFileNo: "PF20260301004",
+        salesQuantity: 300,
+        manufactureQuantity: 315,
+        partUnit: "涓�",
+        mainPlanDemandDate: "2026-03-20",
+        commitmentDate: "2026-03-15",
+        manufactureProperty: "甯歌",
+        remark: "",
+        updateTime: "2026-03-01",
+        updateBy: "admin",
+        createTime: "2026-03-01",
+        createBy: "admin",
+      },
+      {
+        id: 5,
+        source: "閿�鍞鍗�",
+        status: "宸插畬鎴�",
+        auditStatus: "宸插鏍�",
+        orderNo: "SO20260301005",
+        productionPlanNo: "PP20260301003",
+        partNo: "P005",
+        partName: "闆朵欢E",
+        productCategory: "绫诲埆3",
+        processFileNo: "PF20260301005",
+        salesQuantity: 250,
+        manufactureQuantity: 260,
+        partUnit: "涓�",
+        mainPlanDemandDate: "2026-03-10",
+        commitmentDate: "2026-03-05",
+        manufactureProperty: "甯歌",
+        remark: "",
+        updateTime: "2026-03-01",
+        updateBy: "admin",
+        createTime: "2026-03-01",
+        createBy: "admin",
+      },
+    ];
+    tableLoading.value = false;
+    page.total = tableData.value.length;
+    // 璁$畻浜у搧绫诲埆姹囨�荤粺璁�
+    calculateCategorySummary();
+    // productOrderListPage(params)
+    //   .then(res => {
+    //     tableLoading.value = false;
+
+    //     tableData.value = res.data.records;
+    //     page.total = res.data.total;
+    //     // 璁$畻浜у搧绫诲埆姹囨�荤粺璁�
+    //     calculateCategorySummary();
+    //   })
+    //   .catch(() => {
+    //     tableLoading.value = false;
+    //   });
+  };
+
+  // 閫変腑鐨勭敓浜ц鍒掑彿
+  const selectedProductionPlanNo = ref("");
+
+  // 琛ㄦ牸閫夋嫨鏁版嵁
+  const handleSelectionChange = selection => {
+    selectedRows.value = selection;
+    // 濡傛灉鏈夐�変腑鐨勮锛岃褰曠涓�涓�変腑琛岀殑鐢熶骇璁″垝鍙�
+    if (selection.length > 0) {
+      selectedProductionPlanNo.value = selection[0].productionPlanNo;
+    } else {
+      // 濡傛灉娌℃湁閫変腑鐨勮锛屾竻绌虹敓浜ц鍒掑彿
+      selectedProductionPlanNo.value = "";
+    }
+  };
+
+  // 鍒ゆ柇琛屾槸鍚﹀彲閫夋嫨
+  const isSelectable = row => {
+    // 濡傛灉娌℃湁閫変腑鐨勮锛屾墍鏈夎閮藉彲閫夋嫨
+    if (!selectedProductionPlanNo.value) {
+      return true;
+    }
+    // 濡傛灉鏈夐�変腑鐨勮锛屽彧鏈夌敓浜ц鍒掑彿鐩稿悓鐨勮鎵嶅彲閫夋嫨
+    return row.productionPlanNo === selectedProductionPlanNo.value;
+  };
+
+  // 澶勭悊鍚堝苟涓嬪彂鎸夐挳鐐瑰嚮
+  const handleMerge = () => {
+    if (selectedRows.value.length === 0) {
+      ElMessage.warning("璇烽�夋嫨瑕佸悎骞朵笅鍙戠殑鐢熶骇璁″垝");
+      return;
+    }
+
+    // 璁$畻鎬诲埗閫犳暟閲�
+    const totalQuantity = selectedRows.value.reduce((sum, row) => {
+      return sum + row.manufactureQuantity;
+    }, 0);
+
+    // 璁剧疆琛ㄥ崟鏁版嵁
+    mergeForm.productionPlanNo = selectedProductionPlanNo.value;
+    mergeForm.totalManufactureQuantity = totalQuantity;
+    mergeForm.remark = "";
+
+    // 鎵撳紑寮圭獥
+    isShowNewModal.value = true;
+  };
+
+  // 澶勭悊鍚堝苟涓嬪彂鎻愪氦
+  const handleMergeSubmit = () => {
+    // 杩欓噷鍙互娣诲姞涓嬪彂閫昏緫
+    ElMessage.success("鍚堝苟涓嬪彂鎴愬姛");
+    isShowNewModal.value = false;
+    // 鍙互閫夋嫨鍒锋柊鍒楄〃鎴栧叾浠栨搷浣�
+  };
+
+  onMounted(() => {
+    getList();
+  });
+</script>
+
+<style scoped lang="scss">
+  .search_form {
+    align-items: start;
+  }
+
+  .summary-section {
+    margin-bottom: 16px;
+  }
+
+  .horizontal-summary {
+    display: flex;
+    flex-wrap: wrap;
+    gap: 20px;
+    padding: 10px 0;
+  }
+
+  .summary-item {
+    flex: 1;
+    min-width: 120px;
+    text-align: center;
+    padding: 10px;
+    background-color: #f5f7fa;
+    border-radius: 4px;
+    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
+  }
+
+  .summary-label {
+    font-size: 14px;
+    color: #606266;
+    margin-bottom: 5px;
+  }
+
+  .summary-value {
+    font-size: 18px;
+    font-weight: 600;
+    color: #303133;
+  }
+
+  ::v-deep .yellow {
+    background-color: #faf0de;
+  }
+
+  ::v-deep .pink {
+    background-color: #fae1de;
+  }
+
+  ::v-deep .red {
+    background-color: #f80202;
+  }
+
+  ::v-deep .purple {
+    background-color: #f4defa;
+  }
+</style>

--
Gitblit v1.9.3