7 小时以前 08bb5d242135e2c1f0fc17d2b5f7ae548275a3a2
src/views/mes/pro/bagCode/index.vue
@@ -14,11 +14,13 @@
    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 ReplaceModal from "./modules/replace-form.vue";
@@ -28,6 +30,11 @@
  const [GenerateFormModal, generateFormModalApi] = useVbenModal({
    connectedComponent: GenerateModal,
    destroyOnClose: true,
  });
  const [BindBatchFormModal, bindBatchFormModalApi] = useVbenModal({
    connectedComponent: BindBatchModal,
    destroyOnClose: true,
  });
@@ -178,10 +185,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 +303,7 @@
<template>
  <Page auto-content-height>
    <GenerateFormModal @success="handleRefresh" />
    <BindBatchFormModal @success="handleRefresh" />
    <BindPalletFormModal @success="handleRefresh" />
    <ReplaceFormModal @success="handleReplaceSuccess" />
    <QrTraceQueryModal />
@@ -295,6 +318,12 @@
              onClick: handleGenerate,
            },
            {
              label: '录入批次',
              type: 'primary',
              auth: ['mes:pro-bag-code:update'],
              onClick: handleBindBatch,
            },
            {
              label: '绑定托盘',
              type: 'primary',
              auth: ['mes:pro-bag-code:update'],