2 天以前 46624ce480a3c14da21f39cc4ad5f7eecea2bb1e
src/views/mes/pro/bagCode/index.vue
@@ -14,13 +14,16 @@
    exportBagCodeExcel,
    exportBagQr,
    getBagCodePage,
    bindBagCodeBatch,
    unbindBagCodePallet,
  } from "#/api/mes/pro/bagCode";
  import { $t } from "#/locales";
  import { useGridColumns, useGridFormSchema } from "./data";
  import BindBatchModal from "./modules/bind-batch.vue";
  import BindPalletModal from "./modules/bind-pallet.vue";
  import GenerateModal from "./modules/generate-form.vue";
  import RawGenerateModal from "./modules/raw-generate-form.vue";
  import ReplaceModal from "./modules/replace-form.vue";
  import QrTraceModal from "../components/qr-trace-modal.vue";
@@ -28,6 +31,16 @@
  const [GenerateFormModal, generateFormModalApi] = useVbenModal({
    connectedComponent: GenerateModal,
    destroyOnClose: true,
  });
  const [RawGenerateFormModal, rawGenerateFormModalApi] = useVbenModal({
    connectedComponent: RawGenerateModal,
    destroyOnClose: true,
  });
  const [BindBatchFormModal, bindBatchFormModalApi] = useVbenModal({
    connectedComponent: BindBatchModal,
    destroyOnClose: true,
  });
@@ -54,6 +67,11 @@
  /** 生成数据包 */
  function handleGenerate() {
    generateFormModalApi.open();
  }
  /** 生成原始袋码 */
  function handleRawGenerate() {
    rawGenerateFormModalApi.open();
  }
  /** 替换成功后展示结果并刷新列表 */
@@ -178,10 +196,25 @@
      .open();
  }
  /** 批量录入生产批次 */
  function handleBindBatch() {
    const records = getSelectedRecords();
    if (!records) return;
    if (records.some((record) => record.status !== MesProBagCodeStatusEnum.GENERATED || record.batchId)) {
      message.warning("请选择未录入批次且状态为已生成的袋码");
      return;
    }
    bindBatchFormModalApi.setData({ ids: records.map((record) => record.id!) }).open();
  }
  /** 批量绑定托盘 */
  function handleBindPallet() {
    const records = getSelectedRecords();
    if (!records) return;
    if (records.some((record) => !record.batchId)) {
      message.warning("请先录入生产批次,再绑定托盘");
      return;
    }
    const batchIds = new Set(records.map((record) => record.batchId));
    if (batchIds.size > 1) {
      message.warning("请选择同一批次下的袋码进行绑定");
@@ -281,6 +314,8 @@
<template>
  <Page auto-content-height>
    <GenerateFormModal @success="handleRefresh" />
    <RawGenerateFormModal @success="handleRefresh" />
    <BindBatchFormModal @success="handleRefresh" />
    <BindPalletFormModal @success="handleRefresh" />
    <ReplaceFormModal @success="handleReplaceSuccess" />
    <QrTraceQueryModal />
@@ -295,6 +330,18 @@
              onClick: handleGenerate,
            },
            {
              label: '生成原始袋码',
              icon: ACTION_ICON.ADD,
              auth: ['mes:pro-bag-code:create'],
              onClick: handleRawGenerate,
            },
            {
              label: '录入批次',
              type: 'primary',
              auth: ['mes:pro-bag-code:update'],
              onClick: handleBindBatch,
            },
            {
              label: '绑定托盘',
              type: 'primary',
              auth: ['mes:pro-bag-code:update'],