From 0a09148f6aa65d402f211f6839404157c1c2227e Mon Sep 17 00:00:00 2001
From: CD配唱片 <CD配唱片>
Date: 星期六, 26 四月 2025 16:16:25 +0800
Subject: [PATCH] 修改计划大表push多次问题和负载统计查询重置

---
 src/views/mainPlan/platePlanList/index.vue |   92 +++++++++++++++++++++++++---------------------
 1 files changed, 50 insertions(+), 42 deletions(-)

diff --git a/src/views/mainPlan/platePlanList/index.vue b/src/views/mainPlan/platePlanList/index.vue
index 0e3de41..d4d98be 100644
--- a/src/views/mainPlan/platePlanList/index.vue
+++ b/src/views/mainPlan/platePlanList/index.vue
@@ -54,10 +54,7 @@
         >
       </el-col>
 
-      <right-toolbar
-        :search="false"
-        @queryTable="getList"
-      ></right-toolbar>
+      <right-toolbar :search="false" @queryTable="getList"></right-toolbar>
     </el-row>
 
     <HxlhTable
@@ -111,7 +108,10 @@
 </template>
 
 <script setup name="Aps_plate_process_stat">
-import { listApsPlateProcessShopStat, listApsPlateProcessShopStatUpdate } from "@/api/mainPlan/apsPlatePlanList";
+import {
+  listApsPlateProcessShopStat,
+  listApsPlateProcessShopStatUpdate,
+} from "@/api/mainPlan/apsPlatePlanList";
 import HxlhTable from "@/components/HxlhTable/index.vue";
 import { getToken } from "@/utils/auth";
 import { nextTick, onMounted, ref } from "vue";
@@ -128,7 +128,7 @@
 const multiple = ref(true);
 const total = ref(0);
 const title = ref("");
-const height = ref(document.documentElement.clientHeight-180 + "px;");
+const height = ref(document.documentElement.clientHeight - 180 + "px;");
 const columnsVersion = ref(0);
 const data = reactive({
   // form: {},
@@ -160,36 +160,36 @@
     title: "涓讳欢鏂欏彿",
     field: "mainPartNumber",
     width: 150,
-    fixed:"left"
+    fixed: "left",
   },
   {
     title: "涓氬姟绫诲瀷",
     field: "businessType",
     width: 120,
-    fixed:"left"
+    fixed: "left",
   },
   {
     title: "鍗曟嵁鍙�",
     field: "documentNumber",
     width: 160,
-    fixed:"left"
+    fixed: "left",
   },
   {
     title: "闇�姹傚垎绫�",
     field: "requirementType",
     width: 100,
-    fixed:"left"
+    fixed: "left",
   },
   {
     title: "鍗曟嵁鐘舵��",
     field: "documentStatus",
     width: 100,
-    fixed:"left"
+    fixed: "left",
   },
   {
     title: "瀹℃牳鏃堕棿",
     field: "updateBy",
-    width: 100
+    width: 100,
   },
   {
     title: "褰撳墠宸ュ簭",
@@ -204,7 +204,7 @@
   {
     title: "涓嬩竴宸ュ簭",
     field: "updateBy",
-    width: 100
+    width: 100,
   },
   {
     title: "涓嬩竴宸ュ簭宸ュ簭璐熻矗浜�",
@@ -232,7 +232,7 @@
   {
     title: "浣庨樁鐮�",
     field: "updateBy",
-    width: 100
+    width: 100,
   },
   {
     title: "鐢熶骇鏁伴噺",
@@ -243,7 +243,7 @@
   {
     title: "宸ュ崟璁″垝涓嬪彂鏃堕棿",
     field: "updateBy",
-    width: 200
+    width: 200,
   },
   {
     title: "绯荤粺瀹屽伐鏃堕棿",
@@ -257,26 +257,29 @@
 async function getList() {
   loading.value = true;
   const response = await listApsPlateProcessShopStat();
-  const listValue = response.data;
-  const resData = listValue.map((item,index)=>{
-    item.deptPlans.map((n, i) => {
-        item[`${i}_startDate`] = n.planStartDate
-        item[`${i}_endDate`] = n.planEndDate 
-    });
-    return  {
-      ...item
-    }
-  })
-  console.log(resData,'resDataresDataresData')
+  let listValue = response.data;
   dynamicList.value = response.shopNames;
   aps_plate_process_statList.value = listValue;
   total.value = response.total;
   loading.value = false;
   await nextTick();
-  const newArray = dynamicList.value.flatMap((item, index) => [
+  aps_plate_process_statList.value = aps_plate_process_statList.value.map(
+    (item, index) => {
+      item.deptPlans.map((n, i) => {
+        item[`${i}_startDate`] = n.planStartDate;
+        item[`${i}_endDate`] = n.planEndDate;
+      });
+      return {
+        ...item,
+      };
+    }
+  );
+  console.log(aps_plate_process_statList.value, "resDataresDataresData");
+  let newArray = [];
+  newArray = dynamicList.value.flatMap((item, index) => [
     {
       title: `${item}寮�濮嬫椂闂碻,
-      field:`${index}_startDate`,
+      field: `${index}_startDate`,
       width: 140,
       formatter: ({ cellValue, row, column }) => {
         let dateStr = "";
@@ -290,16 +293,16 @@
               //   `${item}寮�濮嬫椂闂碻,
               //   "planStartDate"
               // );
-              dateStr =  n.planStartDate;
+              dateStr = n.planStartDate;
             }
           });
         }
-        return dateStr
+        return dateStr;
       },
     },
     {
       title: `${item}缁撴潫鏃堕棿`,
-      field:`${index}_endDate`,
+      field: `${index}_endDate`,
       width: 140,
       formatter: ({ cellValue, row, column }) => {
         let dateStr = "";
@@ -313,22 +316,26 @@
               //   `${item}寮�濮嬫椂闂碻,
               //   "planStartDate"
               // );
-              dateStr =  n.planEndDate;
+              dateStr = n.planEndDate;
             }
           });
         }
-        return dateStr
+        return dateStr;
       },
     },
   ]);
-  newArray.splice(2,0,{
-     title: "鐒婃帴浠堕綈濂楀紑濮嬫椂闂�",
-     field:"hanjie_startDate",
-     width: 140,
-  })
-  await nextTick();
-  columns.value = [...columns.value, ...newArray];              // 寮哄埗缁勪欢閲嶆柊娓叉煋
-  
+  newArray.splice(2, 0, {
+    title: "鐒婃帴浠堕綈濂楀紑濮嬫椂闂�",
+    field: "hanjie_startDate",
+    width: 140,
+  });
+  columns.value = [
+    ...columns.value,
+    ...newArray.filter(
+      (item) => !columns.value.some((col) => col.field === item.field)
+    ),
+  ];
+  // columns.value = columns.value
 }
 
 // // 鍙栨秷鎸夐挳
@@ -400,7 +407,8 @@
 /** 瀵煎嚭鎸夐挳鎿嶄綔 */
 function handleExport() {
   proxy.download(
-    "/aps/plateProcessShopStat/export", {},
+    "/aps/plateProcessShopStat/export",
+    {},
     `aps_plate_process_stat_${new Date().getTime()}.xlsx`
   );
 }

--
Gitblit v1.9.3