spring
2026-04-24 ba516e0748b221ae59aff5fdc681b83893386397
fix: 出入库审批
已修改4个文件
148 ■■■■■ 文件已修改
src/api/inventoryManagement/stockInRecord.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/inventoryManagement/stockOut.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/dispatchLog/Record.vue 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/receiptManagement/Record.vue 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/inventoryManagement/stockInRecord.js
@@ -24,4 +24,13 @@
        method: "delete",
        data: ids,
    });
};
// 批量审批入库记录(approvalStatus: approved/rejected)
export const batchApproveStockInRecords = (data) => {
    return request({
        url: "/stockInRecord/approve",
        method: "post",
        data,
    });
};
src/api/inventoryManagement/stockOut.js
@@ -17,3 +17,12 @@
        data: ids,
    });
}
// 批量审批出库记录(approvalStatus: approved/rejected)
export const batchApproveStockOutRecords = (data) => {
    return request({
        url: "/stockOutRecord/approve",
        method: "post",
        data,
    });
}
src/views/inventoryManagement/dispatchLog/Record.vue
@@ -27,6 +27,7 @@
                >
            </div>
            <div>
                <el-button type="primary" @click="handleBatchApprove">审批</el-button>
                <el-button @click="handleOut">导出</el-button>
                <el-button type="danger" plain @click="handleDelete">删除</el-button>
                <el-button type="primary" plain @click="handlePrint">打印</el-button>
@@ -93,6 +94,11 @@
            {{ getRecordType(scope.row.recordType) }}
          </template>
        </el-table-column>
                <el-table-column label="审批状态" prop="approvalStatus" show-overflow-tooltip>
                    <template #default="scope">
                        {{ getApprovalStatusLabel(scope.row.approvalStatus) }}
                    </template>
                </el-table-column>
            </el-table>
            <pagination
                v-show="total > 0"
@@ -115,6 +121,7 @@
import {
    getStockOutPage,
    delStockOut,
    batchApproveStockOutRecords,
} from "@/api/inventoryManagement/stockOut.js";
import {
  findAllQualifiedStockOutRecordTypeOptions, findAllUnQualifiedStockOutRecordTypeOptions,
@@ -190,6 +197,25 @@
  return stockRecordTypeOptions.value.find(item => item.value === recordType)?.label || ''
}
const approvalStatusLabelMap = {
    0: "待审批",
    1: "通过",
    2: "驳回",
    pending: "待审批",
    approved: "通过",
    rejected: "驳回",
    PENDING: "待审批",
    APPROVED: "通过",
    REJECTED: "驳回",
};
const getApprovalStatusLabel = (status) => {
    if (status === null || status === undefined || status === "") {
        return "待审批";
    }
    return approvalStatusLabelMap[status] || "待审批";
};
// 获取来源类型选项
const fetchStockRecordTypeOptions = () => {
  if (props.type === '0') {
@@ -213,6 +239,44 @@
};
const expandedRowKeys = ref([]);
const handleBatchApprove = () => {
    if (selectedRows.value.length === 0) {
        proxy.$modal.msgWarning("请选择数据");
        return;
    }
    const ids = selectedRows.value.map((item) => item.id);
    ElMessageBox.confirm("请选择审批结果", "审批", {
        confirmButtonText: "通过",
        cancelButtonText: "驳回",
        type: "warning",
        distinguishCancelAndClose: true,
    })
        .then(() => {
            batchApproveStockOutRecords({ ids, approvalStatus: "通过" })
                .then(() => {
                    proxy.$modal.msgSuccess("审批通过成功");
                    getList();
                })
                .catch(() => {
                    proxy.$modal.msgError("审批通过失败");
                });
        })
        .catch((action) => {
            if (action === "cancel") {
                batchApproveStockOutRecords({ ids, approvalStatus: "驳回" })
                    .then(() => {
                        proxy.$modal.msgSuccess("审批驳回成功");
                        getList();
                    })
                    .catch(() => {
                        proxy.$modal.msgError("审批驳回失败");
                    });
                return;
            }
            proxy.$modal.msg("已取消");
        });
};
// 导出
const handleOut = () => {
    ElMessageBox.confirm("是否确认导出?", "导出", {
src/views/inventoryManagement/receiptManagement/Record.vue
@@ -31,6 +31,7 @@
        </el-button>
      </div>
      <div>
        <el-button type="primary" @click="handleBatchApprove">审批</el-button>
        <el-button @click="handleOut">导出</el-button>
        <el-button type="danger"
                   plain
@@ -86,6 +87,13 @@
            {{ getRecordType(scope.row.recordType) }}
          </template>
        </el-table-column>
        <el-table-column label="审批状态"
                         prop="approvalStatus"
                         show-overflow-tooltip>
          <template #default="scope">
            {{ getApprovalStatusLabel(scope.row.approvalStatus) }}
          </template>
        </el-table-column>
      </el-table>
      <pagination v-show="total > 0"
                  :total="total"
@@ -110,6 +118,7 @@
import {
  getStockInRecordListPage,
  batchDeleteStockInRecords,
  batchApproveStockInRecords,
} from "@/api/inventoryManagement/stockInRecord.js";
import {
  findAllQualifiedStockInRecordTypeOptions, findAllUnQualifiedStockInRecordTypeOptions,
@@ -159,6 +168,25 @@
  return stockRecordTypeOptions.value.find(item => item.value === recordType)?.label || ''
}
const approvalStatusLabelMap = {
  0: "待审批",
  1: "通过",
  2: "驳回",
  pending: "待审批",
  approved: "通过",
  rejected: "驳回",
  PENDING: "待审批",
  APPROVED: "通过",
  REJECTED: "驳回",
};
const getApprovalStatusLabel = (status) => {
  if (status === null || status === undefined || status === "") {
    return "待审批";
  }
  return approvalStatusLabelMap[status] || "待审批";
};
const pageProductChange = obj => {
  page.current = obj.page;
  page.size = obj.limit;
@@ -202,6 +230,44 @@
const expandedRowKeys = ref([]);
const handleBatchApprove = () => {
  if (selectedRows.value.length === 0) {
    proxy.$modal.msgWarning("请选择数据");
    return;
  }
  const ids = selectedRows.value.map(item => item.id);
  ElMessageBox.confirm("请选择审批结果", "审批", {
    confirmButtonText: "通过",
    cancelButtonText: "驳回",
    type: "warning",
    distinguishCancelAndClose: true,
  })
      .then(() => {
        batchApproveStockInRecords({ids, approvalStatus: "通过"})
            .then(() => {
              proxy.$modal.msgSuccess("审批通过成功");
              getList();
            })
            .catch(() => {
              proxy.$modal.msgError("审批通过失败");
            });
      })
      .catch((action) => {
        if (action === "cancel") {
          batchApproveStockInRecords({ids, approvalStatus: "驳回"})
              .then(() => {
                proxy.$modal.msgSuccess("审批驳回成功");
                getList();
              })
              .catch(() => {
                proxy.$modal.msgError("审批驳回失败");
              });
          return;
        }
        proxy.$modal.msg("已取消");
      });
};
// 导出
const handleOut = () => {
  ElMessageBox.confirm("是否确认导出?", "导出", {