yyb
6 天以前 c3179c13129446e6e53b5447caf200c41a0d011f
反审
已修改2个文件
76 ■■■■ 文件已修改
src/api/inventoryManagement/stockInRecord.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/receiptManagement/Record.vue 67 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/inventoryManagement/stockInRecord.js
@@ -41,4 +41,13 @@
        method: "post",
        data,
    });
};
// 批量反审入库记录(仅驳回状态可反审)
export const batchUnapproveStockInRecords = (data) => {
    return request({
        url: "/stockInRecord/unapprove",
        method: "post",
        data,
    });
};
src/views/inventoryManagement/receiptManagement/Record.vue
@@ -71,10 +71,15 @@
      </el-form>
    </div>
    <div class="actions">
      <el-button type="primary" @click="handleBatchApprove">审批</el-button>
      <el-button type="primary"
                 :disabled="!canBatchApprove"
                 @click="handleBatchApprove">审批</el-button>
      <el-button :disabled="!canReverseApprove"
                 @click="handleReverseApprove">反审</el-button>
      <el-button @click="handleOut">导出</el-button>
      <el-button type="danger"
                 plain
                 :disabled="!canDelete"
                 @click="handleDelete">删除
      </el-button>
    </div>
@@ -89,7 +94,7 @@
                height="calc(100vh - 18.5em)">
        <el-table-column align="center"
                         type="selection"
                         :selectable="isRowSelectableForApprove"
                         :selectable="isRowSelectable"
                         width="55"/>
        <el-table-column align="center"
                         label="序号"
@@ -153,6 +158,7 @@
  ref,
  reactive,
  toRefs,
  computed,
  onMounted,
  getCurrentInstance,
} from "vue";
@@ -161,6 +167,7 @@
  getStockInRecordListPage,
  batchDeletePendingStockInRecords,
  batchApproveStockInRecords,
  batchUnapproveStockInRecords,
} from "@/api/inventoryManagement/stockInRecord.js";
import {
  findAllQualifiedStockInRecordTypeOptions, 
@@ -245,9 +252,25 @@
  return status === 0 || status === "0" || status === "pending" || status === "PENDING" || status === null || status === undefined || status === "";
};
const isRowSelectableForApprove = row => {
  return isPendingApproval(row?.approvalStatus);
const isRejectedApproval = status => {
  return status === 2 || status === "2" || status === "rejected" || status === "REJECTED";
};
const isRowSelectable = row => {
  return isPendingApproval(row?.approvalStatus) || isRejectedApproval(row?.approvalStatus);
};
const canBatchApprove = computed(() => {
  return selectedRows.value.length > 0
      && selectedRows.value.every(row => isPendingApproval(row.approvalStatus));
});
const canReverseApprove = computed(() => {
  return selectedRows.value.length > 0
      && selectedRows.value.every(row => isRejectedApproval(row.approvalStatus));
});
const canDelete = computed(() => canBatchApprove.value);
const pageProductChange = obj => {
  page.current = obj.page;
@@ -283,14 +306,40 @@
// 表格选择数据
const handleSelectionChange = selection => {
  selectedRows.value = selection.filter(item => item.id && isPendingApproval(item.approvalStatus));
  selectedRows.value = selection.filter(item => item.id && isRowSelectable(item));
};
const expandedRowKeys = ref([]);
const handleReverseApprove = () => {
  if (!canReverseApprove.value) {
    proxy.$modal.msgWarning("请选择已驳回的数据");
    return;
  }
  const ids = selectedRows.value.map(item => item.id);
  ElMessageBox.confirm("反审后记录将恢复为待审批状态,是否确认反审?", "反审", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
      .then(() => {
        batchUnapproveStockInRecords({ids})
            .then(() => {
              proxy.$modal.msgSuccess("反审成功");
              getList();
            })
            .catch(() => {
              proxy.$modal.msgError("反审失败");
            });
      })
      .catch(() => {
        proxy.$modal.msg("已取消");
      });
};
const handleBatchApprove = () => {
  if (selectedRows.value.length === 0) {
    proxy.$modal.msgWarning("请选择数据");
  if (!canBatchApprove.value) {
    proxy.$modal.msgWarning("请选择待审批的数据");
    return;
  }
  const ids = selectedRows.value.map(item => item.id);
@@ -344,8 +393,8 @@
// 删除
const handleDelete = () => {
  if (selectedRows.value.length === 0) {
    proxy.$modal.msgWarning("请选择数据");
  if (!canDelete.value) {
    proxy.$modal.msgWarning("请选择待审批的数据");
    return;
  }
  const ids = selectedRows.value.map(item => item.id);