yyb
2026-05-11 3682ad63b5bdb47228325dea1efe2bb9069254a5
src/pages/inventoryManagement/scanOut/scanOut.fields.ts
@@ -1,6 +1,19 @@
import { computed, type Ref } from "vue";
import { CONTRACT_KIND, type ContractKind } from "./scanOut.constants";
const outboundQuantityRows = [
  { label: "已出库数量", key: "shippedQuantity" },
  { label: "不合格出库数量", key: "unqualifiedShippedQuantity" },
  { label: "不合格入库数量", key: "unqualifiedStockedQuantity" },
  { label: "剩余出库数量", key: "remainingShippedQuantity" },
] as const;
const inboundQuantityRows = [
  { label: "已入库数量", key: "stockedQuantity" },
  { label: "不合格入库数量", key: "unqualifiedStockedQuantity" },
  { label: "剩余入库数量", key: "remainingQuantity" },
] as const;
export const detailFieldRowsSales = [
  { label: "楼层编号", key: "floorCode" },
  { label: "产品大类", key: "productCategory" },
@@ -15,12 +28,12 @@
  { label: "重箱", key: "heavyBox" },
  { label: "产品状态", key: "approveStatus" },
  { label: "入库状态", key: "productStockStatus" },
  { label: "发货状态", key: "ledgerShippingStatus" },
  { label: "快递公司", key: "expressCompany" },
  { label: "快递单号", key: "expressNumber" },
  { label: "发货车牌", key: "shippingCarNumber" },
  { label: "发货日期", key: "shippingDate" },
  { label: "数量", key: "quantity" },
  { label: "剩余数量", key: "remainingQuantity" },
  { label: "税率(%)", key: "taxRate" },
  { label: "含税单价(元)", key: "taxInclusiveUnitPrice" },
  { label: "含税总价(元)", key: "taxInclusiveTotalPrice" },
@@ -33,7 +46,6 @@
  { label: "单位", key: "unit" },
  { label: "数量", key: "quantity" },
  { label: "可用数量", key: "availableQuality" },
  { label: "剩余数量", key: "remainingQuantity" },
  { label: "退货数量", key: "returnQuality" },
  { label: "税率(%)", key: "taxRate" },
  { label: "含税单价(元)", key: "taxInclusiveUnitPrice" },
@@ -46,9 +58,9 @@
  { label: "产品大类", key: "productCategory" },
  { label: "规格型号", key: "specificationModel" },
  { label: "数量", key: "quantity" },
  { label: "剩余数量", key: "remainingQuantity" },
  { label: "产品状态", key: "approveStatus" },
  { label: "入库状态", key: "productStockStatus" },
  { label: "发货状态", key: "ledgerShippingStatus" },
] as const;
export const summaryFieldRowsPurchase = [
@@ -57,22 +69,23 @@
  { label: "单位", key: "unit" },
  { label: "数量", key: "quantity" },
  { label: "可用数量", key: "availableQuality" },
  { label: "剩余数量", key: "remainingQuantity" },
] as const;
type FieldRow = { label: string; key: string };
type ScanScene = "outbound" | "inbound";
export function useScanOutFieldRows(contractKindRef: Ref<ContractKind>) {
export function useScanOutFieldRows(contractKindRef: Ref<ContractKind>, scene: ScanScene = "outbound") {
  const quantityRows = scene === "inbound" ? inboundQuantityRows : outboundQuantityRows;
  const fieldRowsByContractKind = {
    [CONTRACT_KIND.sales]: {
      detail: detailFieldRowsSales,
      summary: summaryFieldRowsSales,
      detail: [...detailFieldRowsSales, ...quantityRows],
      summary: [...summaryFieldRowsSales, ...quantityRows],
    },
    [CONTRACT_KIND.purchase]: {
      detail: detailFieldRowsPurchase,
      summary: summaryFieldRowsPurchase,
      detail: [...detailFieldRowsPurchase, ...quantityRows],
      summary: [...summaryFieldRowsPurchase, ...quantityRows],
    },
  } as const satisfies Record<ContractKind, { detail: readonly FieldRow[]; summary: readonly FieldRow[] }>;
  } satisfies Record<ContractKind, { detail: readonly FieldRow[]; summary: readonly FieldRow[] }>;
  const currentContractFieldRows = computed(() => fieldRowsByContractKind[contractKindRef.value]);