From 61939d6a198a44de2f51193e3b4500d78b16b506 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期一, 13 七月 2026 14:40:25 +0800
Subject: [PATCH] 修改生产核算

---
 src/views/productionManagement/productionCosting/index.vue |   62 +++++++++++++++++++++++++++----
 src/api/productionManagement/productionCosting.js          |   18 +++++++++
 2 files changed, 72 insertions(+), 8 deletions(-)

diff --git a/src/api/productionManagement/productionCosting.js b/src/api/productionManagement/productionCosting.js
index 81e6b1b..17ee55a 100644
--- a/src/api/productionManagement/productionCosting.js
+++ b/src/api/productionManagement/productionCosting.js
@@ -29,3 +29,21 @@
     params: query,
   });
 }
+
+// 鎵归噺鏍哥畻
+export function productionAccountingBatchAccounting(data) {
+  return request({
+    url: "/productionAccount/batchAccounting",
+    method: "post",
+    data,
+  });
+}
+
+// 鍗曚釜淇
+export function productionAccountingSingleAdjust(data) {
+  return request({
+    url: "/productionAccount/singleAdjust",
+    method: "post",
+    data,
+  });
+}
diff --git a/src/views/productionManagement/productionCosting/index.vue b/src/views/productionManagement/productionCosting/index.vue
index 2ac2005..be247ce 100644
--- a/src/views/productionManagement/productionCosting/index.vue
+++ b/src/views/productionManagement/productionCosting/index.vue
@@ -95,10 +95,13 @@
                title="鍗曚釜淇"
                width="520px">
       <el-form :model="adjustForm" label-width="120px">
+        <el-form-item label="鎶ュ伐鍗曞彿">
+          <el-input v-model="adjustForm.reportNo" disabled />
+        </el-form-item>
         <el-form-item label="鎶ュ伐浜哄憳">
           <el-input v-model="adjustForm.schedulingUserName" disabled />
         </el-form-item>
-        <el-form-item label="宸ヨ祫">
+        <el-form-item label="淇閲戦">
           <el-input-number v-model="adjustForm.wages" :min="0" :precision="2" style="width: 100%" />
         </el-form-item>
         <el-form-item label="淇璇存槑">
@@ -120,6 +123,8 @@
   import {
     salesLedgerProductionAccountingListProductionDetails,
     salesLedgerProductionAccountingList,
+    productionAccountingBatchAccounting,
+    productionAccountingSingleAdjust,
   } from "@/api/productionManagement/productionCosting.js";
   const { proxy } = getCurrentInstance();
 
@@ -147,7 +152,7 @@
     },
     {
       label: "瀹℃牳鐘舵��",
-      prop: "auditStatusName",
+      prop: "auditStatus",
       minWidth: 100,
       dataType: "tag",
       formatData: val => formatTag(val, {
@@ -166,7 +171,7 @@
     },
     {
       label: "鎶ュ伐绫诲瀷",
-      prop: "reportTypeName",
+      prop: "reportType",
       minWidth: 100,
       dataType: "tag",
       formatData: val => formatTag(val, {
@@ -235,6 +240,11 @@
       prop: "wages",
       minWidth: 100,
     },
+    {
+      label: "淇璇存槑",
+      prop: "adjustRemark",
+      minWidth: 160,
+    },
   ]);
 
   // 宸︿晶姹囨�诲彴璐﹀垪锛堢敓浜т汉銆佷骇閲忋�佸伐璧勩�佸悎鏍肩巼锛�
@@ -273,6 +283,7 @@
   const adjustDialogVisible = ref(false);
   const adjustForm = reactive({
     id: null,
+    reportNo: "",
     schedulingUserName: "",
     wages: 0,
     remark: "",
@@ -436,9 +447,9 @@
     })
       .then(() => {
         proxy.download(
-          "/salesLedger/productionAccounting/export",
+          "/productionAccount/exportSalarySlip",
           { ...searchForm.value },
-          "鐢熶骇鏍哥畻.xlsx"
+          "鐢熶骇宸ヨ祫鏉�.xlsx"
         );
       })
       .catch(() => {
@@ -447,7 +458,22 @@
   };
 
   const handleBatchAccounting = () => {
-    proxy.$modal.msgWarning("褰撳墠椤甸潰宸叉寜瀹℃牳閫氳繃鐨勫悎鏍兼姤宸ユ眹鎬诲伐璧勶紝鎵归噺鏍哥畻鎺ュ彛鍚庣画鍙洿鎺ユ帴鍏ャ��");
+    ElMessageBox.confirm("纭畾瑕佹寜褰撳墠绛涢�夋潯浠舵墽琛屾壒閲忔牳绠楀悧锛�", "鎵归噺鏍哥畻", {
+      confirmButtonText: "纭",
+      cancelButtonText: "鍙栨秷",
+      type: "warning",
+    })
+      .then(() => {
+        const { dateRange, ...batchPayload } = searchForm.value;
+        return productionAccountingBatchAccounting(batchPayload);
+      })
+      .then(() => {
+        proxy.$modal.msgSuccess("鎵归噺鏍哥畻鎴愬姛");
+        reloadData();
+      })
+      .catch(() => {
+        proxy.$modal.msg("宸插彇娑�");
+      });
   };
 
   const handleSingleAdjust = () => {
@@ -461,6 +487,7 @@
     }
     const row = selectedRows.value[0];
     adjustForm.id = row.id;
+    adjustForm.reportNo = row.reportNo || "";
     adjustForm.schedulingUserName = row.schedulingUserName || "";
     adjustForm.wages = Number(row.wages || 0);
     adjustForm.remark = "";
@@ -468,8 +495,27 @@
   };
 
   const confirmAdjust = () => {
-    proxy.$modal.msgSuccess("宸蹭繚瀛樹慨姝h鏄庯紝鍚庣画鍙帴鍏ュ伐璧勪慨姝f帴鍙c��");
-    adjustDialogVisible.value = false;
+    const selectedRow = selectedRows.value[0];
+    if (!selectedRow || !selectedRow.userId) {
+      proxy.$modal.msgWarning("褰撳墠璁板綍缂哄皯鎶ュ伐浜哄憳淇℃伅锛屾棤娉曚慨姝�");
+      return;
+    }
+    if (!adjustForm.wages && adjustForm.wages !== 0) {
+      proxy.$modal.msgWarning("璇疯緭鍏ヤ慨姝i噾棰�");
+      return;
+    }
+    productionAccountingSingleAdjust({
+      productionProductMainId: adjustForm.id,
+      schedulingUserId: selectedRow.userId,
+      schedulingUserName: adjustForm.schedulingUserName,
+      adjustAmount: adjustForm.wages,
+      adjustRemark: adjustForm.remark,
+      adjustUser: proxy.$store?.state?.user?.userId || undefined,
+    }).then(() => {
+      proxy.$modal.msgSuccess("淇鎴愬姛");
+      adjustDialogVisible.value = false;
+      reloadData();
+    }).catch(() => {});
   };
 
   const handleRowAdjust = row => {

--
Gitblit v1.9.3