From 17e77741270ac0efcade87b37d63bfcb41295ec2 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期六, 25 四月 2026 14:00:15 +0800
Subject: [PATCH] feat(inventory): 新增待审批出入库记录删除及审批状态优化

---
 src/views/inventoryManagement/dispatchLog/Record.vue       |    8 ++--
 src/views/inventoryManagement/stockManagement/New.vue      |    4 +-
 src/api/inventoryManagement/stockUninventory.js            |   18 +++++++++
 src/api/inventoryManagement/stockOut.js                    |    9 ++++
 src/api/inventoryManagement/stockInRecord.js               |    8 ++++
 src/views/inventoryManagement/stockManagement/Record.vue   |    2 
 src/views/inventoryManagement/stockManagement/Subtract.vue |   20 ++++-----
 src/api/inventoryManagement/stockInventory.js              |   18 +++++++++
 src/views/inventoryManagement/receiptManagement/Record.vue |    8 ++--
 9 files changed, 73 insertions(+), 22 deletions(-)

diff --git a/src/api/inventoryManagement/stockInRecord.js b/src/api/inventoryManagement/stockInRecord.js
index 4c450fb..3142e09 100644
--- a/src/api/inventoryManagement/stockInRecord.js
+++ b/src/api/inventoryManagement/stockInRecord.js
@@ -26,6 +26,14 @@
     });
 };
 
+export const batchDeletePendingStockInRecords = (ids) => {
+    return request({
+        url: "/stockInRecord/pending",
+        method: "delete",
+        data: ids,
+    });
+};
+
 // 鎵归噺瀹℃壒鍏ュ簱璁板綍锛坅pprovalStatus: approved/rejected锛�
 export const batchApproveStockInRecords = (data) => {
     return request({
diff --git a/src/api/inventoryManagement/stockInventory.js b/src/api/inventoryManagement/stockInventory.js
index 10a211d..eafccbf 100644
--- a/src/api/inventoryManagement/stockInventory.js
+++ b/src/api/inventoryManagement/stockInventory.js
@@ -35,6 +35,24 @@
     });
 };
 
+// 鏂板鍏ュ簱璁板綍锛堜粎鍒涘缓璁板綍锛屼笉璋冩暣搴撳瓨锛�
+export const addStockInRecordOnly = (params) => {
+    return request({
+        url: "/stockInventory/addStockInRecordOnly",
+        method: "post",
+        data: params,
+    });
+};
+
+// 鏂板鍑哄簱璁板綍锛堜粎鍒涘缓璁板綍锛屼笉璋冩暣搴撳瓨锛�
+export const addStockOutRecordOnly = (params) => {
+    return request({
+        url: "/stockInventory/addStockOutRecordOnly",
+        method: "post",
+        data: params,
+    });
+};
+
 export const getStockInventoryReportList = (params) => {
     return request({
         url: "/stockInventory/stockInventoryPage",
diff --git a/src/api/inventoryManagement/stockOut.js b/src/api/inventoryManagement/stockOut.js
index f4fc40f..004ba99 100644
--- a/src/api/inventoryManagement/stockOut.js
+++ b/src/api/inventoryManagement/stockOut.js
@@ -18,6 +18,15 @@
     });
 }
 
+//鍒犻櫎寰呭鎵瑰嚭搴撲俊鎭�
+export const delPendingStockOut = (ids) => {
+    return request({
+        url: "/stockOutRecord/pending",
+        method: "delete",
+        data: ids,
+    });
+}
+
 // 鎵归噺瀹℃壒鍑哄簱璁板綍锛坅pprovalStatus: approved/rejected锛�
 export const batchApproveStockOutRecords = (data) => {
     return request({
diff --git a/src/api/inventoryManagement/stockUninventory.js b/src/api/inventoryManagement/stockUninventory.js
index 73907c7..a80474e 100644
--- a/src/api/inventoryManagement/stockUninventory.js
+++ b/src/api/inventoryManagement/stockUninventory.js
@@ -26,6 +26,24 @@
     });
 };
 
+// 鏂板鍏ュ簱璁板綍锛堜粎鍒涘缓璁板綍锛屼笉璋冩暣搴撳瓨锛�
+export const addUnqualifiedStockInRecordOnly = (params) => {
+    return request({
+        url: "/stockUninventory/addStockInRecordOnly",
+        method: "post",
+        data: params,
+    });
+};
+
+// 鏂板鍑哄簱璁板綍锛堜粎鍒涘缓璁板綍锛屼笉璋冩暣搴撳瓨锛�
+export const addUnqualifiedStockOutRecordOnly = (params) => {
+    return request({
+        url: "/stockUninventory/addStockOutRecordOnly",
+        method: "post",
+        data: params,
+    });
+};
+
 // 鍐荤粨搴撳瓨璁板綍
 export const frozenStockUninventory = (params) => {
     return request({
diff --git a/src/views/inventoryManagement/dispatchLog/Record.vue b/src/views/inventoryManagement/dispatchLog/Record.vue
index 061aeeb..80d7515 100644
--- a/src/views/inventoryManagement/dispatchLog/Record.vue
+++ b/src/views/inventoryManagement/dispatchLog/Record.vue
@@ -120,7 +120,7 @@
 import { getCurrentDate } from "@/utils/index.js";
 import {
 	getStockOutPage,
-	delStockOut,
+	delPendingStockOut,
 	batchApproveStockOutRecords,
 } from "@/api/inventoryManagement/stockOut.js";
 import {
@@ -252,7 +252,7 @@
 		distinguishCancelAndClose: true,
 	})
 		.then(() => {
-			batchApproveStockOutRecords({ ids, approvalStatus: "閫氳繃" })
+			batchApproveStockOutRecords({ ids, approvalStatus: 1 })
 				.then(() => {
 					proxy.$modal.msgSuccess("瀹℃壒閫氳繃鎴愬姛");
 					getList();
@@ -263,7 +263,7 @@
 		})
 		.catch((action) => {
 			if (action === "cancel") {
-				batchApproveStockOutRecords({ ids, approvalStatus: "椹冲洖" })
+				batchApproveStockOutRecords({ ids, approvalStatus: 2 })
 					.then(() => {
 						proxy.$modal.msgSuccess("瀹℃壒椹冲洖鎴愬姛");
 						getList();
@@ -307,7 +307,7 @@
 		type: "warning",
 	})
 		.then(() => {
-			delStockOut(ids).then((res) => {
+			delPendingStockOut(ids).then((res) => {
 				proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
 				getList();
 			});
diff --git a/src/views/inventoryManagement/receiptManagement/Record.vue b/src/views/inventoryManagement/receiptManagement/Record.vue
index 013bac5..d8bc1ea 100644
--- a/src/views/inventoryManagement/receiptManagement/Record.vue
+++ b/src/views/inventoryManagement/receiptManagement/Record.vue
@@ -117,7 +117,7 @@
 import {ElMessageBox} from "element-plus";
 import {
   getStockInRecordListPage,
-  batchDeleteStockInRecords,
+  batchDeletePendingStockInRecords,
   batchApproveStockInRecords,
 } from "@/api/inventoryManagement/stockInRecord.js";
 import {
@@ -243,7 +243,7 @@
     distinguishCancelAndClose: true,
   })
       .then(() => {
-        batchApproveStockInRecords({ids, approvalStatus: "閫氳繃"})
+        batchApproveStockInRecords({ids, approvalStatus: 1})
             .then(() => {
               proxy.$modal.msgSuccess("瀹℃壒閫氳繃鎴愬姛");
               getList();
@@ -254,7 +254,7 @@
       })
       .catch((action) => {
         if (action === "cancel") {
-          batchApproveStockInRecords({ids, approvalStatus: "椹冲洖"})
+          batchApproveStockInRecords({ids, approvalStatus: 2})
               .then(() => {
                 proxy.$modal.msgSuccess("瀹℃壒椹冲洖鎴愬姛");
                 getList();
@@ -298,7 +298,7 @@
     type: "warning",
   })
       .then(() => {
-        batchDeleteStockInRecords(ids)
+        batchDeletePendingStockInRecords(ids)
             .then(() => {
               proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
               getList();
diff --git a/src/views/inventoryManagement/stockManagement/New.vue b/src/views/inventoryManagement/stockManagement/New.vue
index c5976b6..eebe313 100644
--- a/src/views/inventoryManagement/stockManagement/New.vue
+++ b/src/views/inventoryManagement/stockManagement/New.vue
@@ -101,7 +101,7 @@
 <script setup>
 import {ref, computed, watch, getCurrentInstance} from "vue";
 import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue";
-import {createStockInventory} from "@/api/inventoryManagement/stockInventory.js";
+import {addStockInRecordOnly} from "@/api/inventoryManagement/stockInventory.js";
 import {createStockUnInventory} from "@/api/inventoryManagement/stockUninventory.js";
 
 const props = defineProps({
@@ -197,7 +197,7 @@
         return;
       }
       if (formState.value.type === 'qualified') {
-        createStockInventory(formState.value).then(res => {
+        addStockInRecordOnly(formState.value).then(res => {
           // 鍏抽棴妯℃�佹
           isShow.value = false;
           // 鍛婄煡鐖剁粍浠跺凡瀹屾垚
diff --git a/src/views/inventoryManagement/stockManagement/Record.vue b/src/views/inventoryManagement/stockManagement/Record.vue
index 340b4b1..b1bb0ea 100644
--- a/src/views/inventoryManagement/stockManagement/Record.vue
+++ b/src/views/inventoryManagement/stockManagement/Record.vue
@@ -36,7 +36,7 @@
         <el-table-column label="鏈�杩戞洿鏂版椂闂�" prop="updateTime" show-overflow-tooltip />
         <el-table-column fixed="right" label="鎿嶄綔" min-width="90" align="center">
           <template #default="scope">
-            <el-button link type="primary" @click="showSubtractModal(scope.row)" :disabled="scope.row.unQualifiedUnLockedQuantity === 0 && scope.row.qualifiedUnLockedQuantity === 0">棰嗙敤</el-button>
+            <el-button link type="primary" @click="showSubtractModal(scope.row)" :disabled="((scope.row.qualifiedUnLockedQuantity || 0) + (scope.row.qualifiedPendingOutQuantity || 0) <= 0) && ((scope.row.unQualifiedUnLockedQuantity || 0) + (scope.row.unQualifiedPendingOutQuantity || 0) <= 0)">棰嗙敤</el-button>
             <el-button link type="primary" v-if="scope.row.unQualifiedUnLockedQuantity > 0 || scope.row.qualifiedUnLockedQuantity > 0" @click="showFrozenModal(scope.row)">鍐荤粨</el-button>
             <el-button link type="primary" v-if="scope.row.qualifiedLockedQuantity > 0 || scope.row.unQualifiedLockedQuantity > 0" @click="showThawModal(scope.row)">瑙e喕</el-button>
           </template>
diff --git a/src/views/inventoryManagement/stockManagement/Subtract.vue b/src/views/inventoryManagement/stockManagement/Subtract.vue
index b0e83c6..2cdfcb6 100644
--- a/src/views/inventoryManagement/stockManagement/Subtract.vue
+++ b/src/views/inventoryManagement/stockManagement/Subtract.vue
@@ -49,8 +49,8 @@
             ]"
         >
           <el-select v-model="formState.type" placeholder="璇烽�夋嫨搴撳瓨绫诲瀷" @change="handleTypeChange">
-            <el-option label="鍚堟牸搴撳瓨" value="qualified" :disabled="props.record.qualifiedUnLockedQuantity <= 0" />
-            <el-option label="涓嶅悎鏍煎簱瀛�" value="unqualified" :disabled="props.record.unQualifiedUnLockedQuantity <= 0" />
+            <el-option label="鍚堟牸搴撳瓨" value="qualified" :disabled="(props.record.qualifiedUnLockedQuantity || 0) + (props.record.qualifiedPendingOutQuantity || 0) <= 0" />
+            <el-option label="涓嶅悎鏍煎簱瀛�" value="unqualified" :disabled="(props.record.unQualifiedUnLockedQuantity || 0) + (props.record.unQualifiedPendingOutQuantity || 0) <= 0" />
           </el-select>
         </el-form-item>
 
@@ -85,8 +85,8 @@
 <script setup>
 import {ref, computed, getCurrentInstance} from "vue";
 import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue";
-import {subtractStockInventory} from "@/api/inventoryManagement/stockInventory.js";
-import {subtractStockUnInventory} from "@/api/inventoryManagement/stockUninventory.js";
+import {addStockOutRecordOnly} from "@/api/inventoryManagement/stockInventory.js";
+import {addUnqualifiedStockOutRecordOnly} from "@/api/inventoryManagement/stockUninventory.js";
 
 const props = defineProps({
   visible: {
@@ -106,14 +106,12 @@
 })
 
 const maxQuality = computed(() => {
-  let max = 0;
   if (formState.value.type === 'qualified') {
-    max = props.record.qualifiedUnLockedQuantity ? props.record.qualifiedUnLockedQuantity :  0;
+    // 鍚堟牸鍙嚭 = 鏈喕缁撻噺 + 寰呭鏍稿嚭搴撻噺锛堝嵆宸茬敵璇蜂絾灏氭湭瀹℃壒鐨勬暟閲忥級
+    return Math.max(1, Number(props.record.qualifiedUnLockedQuantity || 0) + Number(props.record.qualifiedPendingOutQuantity || 0));
   } else {
-    max = props.record.unQualifiedUnLockedQuantity ? props.record.unQualifiedUnLockedQuantity :  0;
+    return Math.max(1, Number(props.record.unQualifiedUnLockedQuantity || 0) + Number(props.record.unQualifiedPendingOutQuantity || 0));
   }
-  // 纭繚 max 鑷冲皯涓� 1锛岄伩鍏� min > max 鐨勯敊璇�
-  return Math.max(max, 1);
 })
 
 const handleTypeChange = () => {
@@ -192,7 +190,7 @@
         return;
       }
       if (formState.value.type === 'qualified') {
-        subtractStockInventory(formState.value).then(res => {
+        addStockOutRecordOnly(formState.value).then(res => {
           // 鍏抽棴妯℃�佹
           isShow.value = false;
           // 鍛婄煡鐖剁粍浠跺凡瀹屾垚
@@ -200,7 +198,7 @@
           proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
         })
       } else {
-        subtractStockUnInventory(formState.value).then(res => {
+        addUnqualifiedStockOutRecordOnly(formState.value).then(res => {
           // 鍏抽棴妯℃�佹
           isShow.value = false;
           // 鍛婄煡鐖剁粍浠跺凡瀹屾垚

--
Gitblit v1.9.3