From 79769f8e0350bd5473005af41cc01974edd06d8b Mon Sep 17 00:00:00 2001
From: CD配唱片 <CD配唱片>
Date: 星期一, 28 四月 2025 10:31:24 +0800
Subject: [PATCH] 提交管路,气柜负载统计不同颜色字段

---
 src/views/mainPlan/gasPlanning/index.vue |  242 ++++++++++++++++++++++++++++--------------------
 1 files changed, 142 insertions(+), 100 deletions(-)

diff --git a/src/views/mainPlan/gasPlanning/index.vue b/src/views/mainPlan/gasPlanning/index.vue
index a4e9fe4..a55c53a 100644
--- a/src/views/mainPlan/gasPlanning/index.vue
+++ b/src/views/mainPlan/gasPlanning/index.vue
@@ -31,7 +31,22 @@
       </el-row>
     </el-form>
     <div class="box_container">
-      <div class="title_text">绠¤矾瑙勫垝浜ц兘</div>
+      <el-row>
+        <el-col :span="22">
+          <div class="title_text">绠¤矾瑙勫垝浜ц兘</div>
+        </el-col>
+        <el-col :span="2">
+          <el-button
+            class="title_btn"
+            type="primary"
+            @click="saveRowEvent"
+            v-hasPermi="['aps:gasPipelineCapacityPlan:add']"
+          >
+            淇濆瓨
+          </el-button>
+        </el-col>
+      </el-row>
+
       <div class="tabel_container">
         <!-- <HxlhTable
           style="width: 100%"
@@ -55,7 +70,7 @@
           show-overflow
           :loading="loading"
           :height="height"
-          :edit-config="{ trigger: 'manual', mode: 'row', showStatus: true }"
+          :edit-config="{ trigger: 'click', mode: 'row', showStatus: true }"
           :data="routePlanList"
           size="small"
           @cell-click="cellClickEvent"
@@ -149,27 +164,40 @@
               <el-input type="textarea" v-model="row.remark" />
             </template>
           </vxe-column>
-          <vxe-column title="鎿嶄綔" width="200" fixed="right">
-            <!-- <template #default="{ row }">
-                <vxe-button @click="handleSave(row)" :loading="row.loading"
-                  >淇濆瓨</vxe-button
-                > -->
+          <!-- <vxe-column title="鎿嶄綔" width="200" fixed="right">
             <template #default="{ row }">
               <template v-if="hasEditStatus(row)">
-                <el-button @click="saveRowEvent(row)" v-hasPermi="['aps:gasPipelineCapacityPlan:add']">淇濆瓨</el-button>
+                <el-button
+                  @click="saveRowEvent(row)"
+                  v-hasPermi="['aps:gasPipelineCapacityPlan:add']"
+                  >淇濆瓨</el-button
+                >
                 <el-button @click="cancelRowEvent()">鍙栨秷</el-button>
               </template>
               <template v-else>
                 <el-button @click="editRowEvent(row)">缂栬緫</el-button>
               </template>
             </template>
-            <!-- </template> -->
-          </vxe-column>
+          </vxe-column> -->
         </vxe-table>
       </div>
     </div>
     <div class="box_container">
-      <div class="title_text">姘旀煖瑙勫垝浜ц兘</div>
+      <el-row>
+        <el-col :span="22">
+          <div class="title_text">姘旀煖瑙勫垝浜ц兘</div>
+        </el-col>
+        <el-col :span="2">
+          <el-button
+            class="title_btn"
+            type="primary"
+            @click="saveRowEvent1"
+            v-hasPermi="['aps:gasPipelineCapacityPlan:add']"
+          >
+            淇濆瓨
+          </el-button>
+        </el-col>
+      </el-row>
       <div class="tabel_container">
         <!-- <HxlhTable
           style="width: 100%"
@@ -279,22 +307,21 @@
               <el-input type="textarea" v-model="row.remark" />
             </template>
           </vxe-column>
-          <vxe-column title="鎿嶄綔" width="200" fixed="right">
-            <!-- <template #default="{ row }">
-                <el-button @click="handleSave(row)" :loading="row.loading"
-                  >淇濆瓨</el-button
-                > -->
+          <!-- <vxe-column title="鎿嶄綔" width="200" fixed="right">
             <template #default="{ row }">
               <template v-if="hasEditStatus1(row)">
-                <el-button @click="saveRowEvent1(row)" v-hasPermi="['aps:gasPipelineCapacityPlan:add']">淇濆瓨</el-button>
+                <el-button
+                  @click="saveRowEvent1(row)"
+                  v-hasPermi="['aps:gasPipelineCapacityPlan:add']"
+                  >淇濆瓨</el-button
+                >
                 <el-button @click="cancelRowEvent1()">鍙栨秷</el-button>
               </template>
               <template v-else>
                 <el-button @click="editRowEvent1(row)">缂栬緫</el-button>
               </template>
             </template>
-            <!-- </template> -->
-          </vxe-column>
+          </vxe-column> -->
         </vxe-table>
         <!-- <div class="btn_center">
           <el-button type="primary" @click="handleSave2">淇濆瓨</el-button>
@@ -314,8 +341,8 @@
     date: "",
   },
 });
-const tableRef = ref()
-const tableRef1 = ref()
+const tableRef = ref();
+const tableRef1 = ref();
 const { queryParams } = toRefs(data);
 const gasPlanList = ref([]);
 const routePlanList = ref([]);
@@ -407,20 +434,27 @@
 //     type: "html",
 //   },
 // ]);
-const hasEditStatus = (row) => {
-  const $table = tableRef.value
-  if ($table) {
-    return $table.isEditByRow(row)
-  }
-}
-const editRowEvent = (row) => {
-  const $table = tableRef.value
-  if ($table) {
-    $table.setEditRow(row)
-  }
-}
+// const hasEditStatus = (row) => {
+//   const $table = tableRef.value;
+//   if ($table) {
+//     return $table.isEditByRow(row);
+//   }
+// };
+// const editRowEvent = (row) => {
+//   const $table = tableRef.value;
+//   if ($table) {
+//     $table.setEditRow(row);
+//   }
+// };
 const saveRowEvent = (row) => {
-  const $table = tableRef.value
+  if (!queryParams.value.date) {
+    ElMessage({
+      message: "璇烽�夋嫨骞存湀",
+      type: "error",
+    });
+    return;
+  }
+  const $table = tableRef.value;
   if ($table) {
     $table.clearEdit().then(() => {
       // loading.value = true
@@ -428,30 +462,37 @@
       //   loading.value = false
       //   VxeUI.modal.message({ content: `淇濆瓨鎴愬姛锛乶ame=${row.name}`, status: 'success' })
       // }, 300)
-      handleSave(row)
-    })
+      handleSave("绠¤矾");
+    });
   }
-}
-const cancelRowEvent = () => {
-  const $table = tableRef.value
-  if ($table) {
-    $table.clearEdit()
-  }
-}
-const hasEditStatus1 = (row) => {
-  const $table = tableRef1.value
-  if ($table) {
-    return $table.isEditByRow(row)
-  }
-}
-const editRowEvent1 = (row) => {
-  const $table = tableRef1.value
-  if ($table) {
-    $table.setEditRow(row)
-  }
-}
+};
+// const cancelRowEvent = () => {
+//   const $table = tableRef.value;
+//   if ($table) {
+//     $table.clearEdit();
+//   }
+// };
+// const hasEditStatus1 = (row) => {
+//   const $table = tableRef1.value;
+//   if ($table) {
+//     return $table.isEditByRow(row);
+//   }
+// };
+// const editRowEvent1 = (row) => {
+//   const $table = tableRef1.value;
+//   if ($table) {
+//     $table.setEditRow(row);
+//   }
+// };
 const saveRowEvent1 = (row) => {
-  const $table = tableRef1.value
+  if (!queryParams.value.date) {
+    ElMessage({
+      message: "璇烽�夋嫨骞存湀",
+      type: "error",
+    });
+    return;
+  }
+  const $table = tableRef1.value;
   if ($table) {
     $table.clearEdit().then(() => {
       // loading.value = true
@@ -459,16 +500,16 @@
       //   loading.value = false
       //   VxeUI.modal.message({ content: `淇濆瓨鎴愬姛锛乶ame=${row.name}`, status: 'success' })
       // }, 300)
-      handleSave2(row)
-    })
+      handleSave("姘旀煖");
+    });
   }
-}
-const cancelRowEvent1 = () => {
-  const $table = tableRef1.value
-  if ($table) {
-    $table.clearEdit()
-  }
-}
+};
+// const cancelRowEvent1 = () => {
+//   const $table = tableRef1.value;
+//   if ($table) {
+//     $table.clearEdit();
+//   }
+// };
 async function getRouteList(year, month) {
   const res = await listGasPlan({
     major: "绠¤矾",
@@ -480,9 +521,11 @@
   routePlanList.value = routePlanList.value.map((item, index) => {
     return {
       ...item,
-      dayProduceType: item.dayProduceType == null ? "" : item.dayProduceType,
+      dayProduceType:
+        item.dayProduceType == null ? "鍗曚汉鏃ヤ骇鍑�" : item.dayProduceType,
       dayProduceNum: item.dayProduceNum == null ? "0" : item.dayProduceNum,
-      dayProduceUnit: item.dayProduceUnit == null ? "涓�" : item.dayProduceUnit,
+      dayProduceUnit:
+        item.dayProduceUnit == null ? "灏忔椂" : item.dayProduceUnit,
       personnelNumber:
         item.personnelNumber == null ? "1" : item.personnelNumber,
       dayProduceAllNum:
@@ -504,14 +547,15 @@
     year,
     month,
   });
-  console.log(res.rows, "getList");
   gasPlanList.value = res.rows;
   gasPlanList.value = gasPlanList.value.map((item, index) => {
     return {
       ...item,
-      dayProduceType: item.dayProduceType == null ? "" : item.dayProduceType,
+      dayProduceType:
+        item.dayProduceType == null ? "鍗曚汉鏃ヤ骇鍑�" : item.dayProduceType,
       dayProduceNum: item.dayProduceNum == null ? "0" : item.dayProduceNum,
-      dayProduceUnit: item.dayProduceUnit == null ? "涓�" : item.dayProduceUnit,
+      dayProduceUnit:
+        item.dayProduceUnit == null ? "灏忔椂" : item.dayProduceUnit,
       personnelNumber:
         item.personnelNumber == null ? "1" : item.personnelNumber,
       dayProduceAllNum:
@@ -533,56 +577,51 @@
   row.monthProduceAllNum = row.dayProduceAllNum * row.days;
 }
 function handleQuery() {
-  if(!queryParams.value.date){
+  if (!queryParams.value.date) {
     ElMessage({
       message: "璇烽�夋嫨骞存湀",
       type: "error",
     });
     return;
   }
-  console.log(queryParams.value.date, "scsciciisc");
   const year = queryParams.value.date.split("-")[0];
   const month = parseInt(queryParams.value.date.split("-")[1]);
   getRouteList(year, month);
   getGasList(year, month);
 }
 function resetQuery() {
-  queryParams.value.date = ""
+  queryParams.value.date = "";
 }
-async function handleSave(row) {
+async function handleSave(major) {
   const year = queryParams.value.date.split("-")[0];
   const month = parseInt(queryParams.value.date.split("-")[1]);
-  console.log(row, "baocun");
-  // gasPlanList.value = gasPlanList.value.map((item) => {
-  //   return {
-  //     ...item,
-  //     major: "姘斾綋",
-  //     year,
-  //     month,
-  //   };
-  // });
-  // routePlanList.value = routePlanList.value.map((item) => {
-  //   return {
-  //     ...item,
-  //     major: "绠¤矾",
-  //     year,
-  //     month,
-  //   };
-  // });
-  const res = await getGasPlanSave([
-    {
-      ...row,
-      major: "绠¤矾",
-      year,
-      month,
-    },
-  ]);
+  if (major === "绠¤矾") {
+    routePlanList.value = routePlanList.value.map((item) => {
+      return {
+        ...item,
+        major: "绠¤矾",
+        year,
+        month,
+      };
+    });
+    await getGasPlanSave([...routePlanList.value]);
+  } else {
+    gasPlanList.value = gasPlanList.value.map((item) => {
+      return {
+        ...item,
+        major: "姘旀煖",
+        year,
+        month,
+      };
+    });
+    await getGasPlanSave([...gasPlanList.value]);
+  }
+
   ElMessage({
     message: "鏁版嵁淇濆瓨鎴愬姛",
     type: "success",
   });
   handleQuery();
-  console.log(res, "akiwjciwj");
 }
 async function handleSave2(row) {
   const year = queryParams.value.date.split("-")[0];
@@ -635,6 +674,9 @@
     padding-top: 20px;
     margin-left: 20px;
   }
+  .title_btn {
+    margin-top: 20px;
+  }
   .tabel_container {
     width: 98%;
     margin: 20px auto;

--
Gitblit v1.9.3