gaoluyang
6 小时以前 07f9f8657d057a38792c3822acc9b08d83478967
src/views/inventoryManagement/dispatchLog/Record.vue
@@ -1,6 +1,6 @@
<template>
   <div class="app-container">
      <div class="search_form">
   <div>
      <div class="search_form" style="margin-bottom: 10px;">
         <div>
            <span class="search_title ml10">出库日期:</span>
            <el-date-picker
@@ -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>
@@ -67,6 +68,11 @@
               show-overflow-tooltip
            />
            <el-table-column
               label="批号"
               prop="batchNo"
               show-overflow-tooltip
            />
            <el-table-column
               label="单位"
               prop="unit"
               show-overflow-tooltip
@@ -88,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"
@@ -109,7 +120,8 @@
import { getCurrentDate } from "@/utils/index.js";
import {
   getStockOutPage,
   delStockOut,
   delPendingStockOut,
   batchApproveStockOutRecords,
} from "@/api/inventoryManagement/stockOut.js";
import {
  findAllQualifiedStockOutRecordTypeOptions, findAllUnQualifiedStockOutRecordTypeOptions,
@@ -133,6 +145,10 @@
    type: String,
    required: true,
    default: '0'
  },
  topParentProductId: {
    type: [String, Number],
    default: undefined
  }
})
@@ -163,7 +179,7 @@
};
const getList = () => {
   tableLoading.value = true;
   getStockOutPage({ ...searchForm.value, ...page, type: props.type })
   getStockOutPage({ ...searchForm.value, ...page, type: props.type, topParentProductId: props.topParentProductId })
      .then((res) => {
         tableLoading.value = false;
         tableData.value = res.data.records;
@@ -180,6 +196,25 @@
const getRecordType = (recordType) => {
  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 = () => {
@@ -203,6 +238,44 @@
   console.log("selection", selectedRows.value);
};
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: 1 })
            .then(() => {
               proxy.$modal.msgSuccess("审批通过成功");
               getList();
            })
            .catch(() => {
               proxy.$modal.msgError("审批通过失败");
            });
      })
      .catch((action) => {
         if (action === "cancel") {
            batchApproveStockOutRecords({ ids, approvalStatus: 2 })
               .then(() => {
                  proxy.$modal.msgSuccess("审批驳回成功");
                  getList();
               })
               .catch(() => {
                  proxy.$modal.msgError("审批驳回失败");
               });
            return;
         }
         proxy.$modal.msg("已取消");
      });
};
// 导出
const handleOut = () => {
@@ -234,7 +307,7 @@
      type: "warning",
   })
      .then(() => {
         delStockOut(ids).then((res) => {
         delPendingStockOut(ids).then((res) => {
            proxy.$modal.msgSuccess("删除成功");
            getList();
         });
@@ -405,7 +478,6 @@
      <div class="print-page">
        <div class="delivery-note">
          <div class="header">
            <div class="company-name">英泽防锈新材料有限公司</div>
            <div class="document-title">零售发货单</div>
          </div>
          
@@ -417,7 +489,7 @@
              </div>
              <div>
                <span class="label">客户名称:</span>
                <span class="value">${item.supplierName || '张爱有'}</span>
                <span class="value">${item.supplierName}</span>
              </div>
            </div>
            <div class="info-row">
@@ -537,6 +609,14 @@
   getList();
  fetchStockRecordTypeOptions();
});
watch(
  () => props.topParentProductId,
  () => {
    page.current = 1;
    getList();
  }
);
</script>
<style scoped lang="scss">