yuan
2026-04-25 17e77741270ac0efcade87b37d63bfcb41295ec2
feat(inventory): 新增待审批出入库记录删除及审批状态优化
已修改9个文件
95 ■■■■ 文件已修改
src/api/inventoryManagement/stockInRecord.js 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/inventoryManagement/stockInventory.js 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/inventoryManagement/stockOut.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/inventoryManagement/stockUninventory.js 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/dispatchLog/Record.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/receiptManagement/Record.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/stockManagement/New.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/stockManagement/Record.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/stockManagement/Subtract.vue 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/inventoryManagement/stockInRecord.js
@@ -26,6 +26,14 @@
    });
};
export const batchDeletePendingStockInRecords = (ids) => {
    return request({
        url: "/stockInRecord/pending",
        method: "delete",
        data: ids,
    });
};
// 批量审批入库记录(approvalStatus: approved/rejected)
export const batchApproveStockInRecords = (data) => {
    return request({
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",
src/api/inventoryManagement/stockOut.js
@@ -18,6 +18,15 @@
    });
}
//删除待审批出库信息
export const delPendingStockOut = (ids) => {
    return request({
        url: "/stockOutRecord/pending",
        method: "delete",
        data: ids,
    });
}
// 批量审批出库记录(approvalStatus: approved/rejected)
export const batchApproveStockOutRecords = (data) => {
    return request({
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({
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();
            });
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();
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;
          // 告知父组件已完成
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)">解冻</el-button>
          </template>
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;
          // 告知父组件已完成