hsy
7 天以前 77b083d347eb8e75eb29a4146238b3f7304489f6
src/views/mes/qc/batchtrace/index.vue
@@ -4,8 +4,10 @@
import { Page, useVbenModal } from '@vben/common-ui';
import { Input, message } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { getBatchPage } from '#/api/mes/wm/batch';
import { getBatchBySn, getBatchPage } from '#/api/mes/wm/batch';
import { useGridColumns, useGridFormSchema } from './data';
import TraceDetail from './modules/trace-detail.vue';
@@ -18,6 +20,19 @@
/** 打开批次追溯详情 */
function handleTrace(row: MesWmBatchApi.Batch) {
  detailModalApi.setData(row).open();
}
/** 根据 SN 反查批次并打开详情 */
async function handleSearchBySn(sn: string) {
  if (!sn) {
    return;
  }
  const batch = await getBatchBySn(sn.trim());
  if (batch) {
    handleTrace(batch);
  } else {
    message.warning(`未找到 SN「${sn}」对应的批次`);
  }
}
const [Grid] = useVbenVxeGrid({
@@ -54,6 +69,15 @@
<template>
  <Page auto-content-height><DetailModal />
    <div class="mb-3 w-80">
      <Input.Search
        placeholder="输入 SN 序列号反查批次"
        enter-button="反查"
        allow-clear
        @search="handleSearchBySn"
      />
    </div>
    <Grid table-title="批次追溯列表">
      <template #actions="{ row }">
        <TableAction