zhou zhou
3 天以前 50e95b985a72fcec4a93a2470e9efdfb2620148a
rsf-design/src/views/orders/transfer-item/index.vue
@@ -3,10 +3,10 @@
    <ElCard v-if="activeSourceSummary" class="mb-3">
      <div class="flex items-center justify-between gap-3">
        <div class="flex items-center gap-2 text-sm text-[var(--art-text-gray-600)]">
          <span class="font-medium text-[var(--art-text-gray-900)]">当前来源</span>
          <span>调拨单ID:{{ activeSourceSummary.transferId }}</span>
          <span class="font-medium text-[var(--art-text-gray-900)]">{{ t('pages.orders.transferItem.sourceTitle') }}</span>
          <span>{{ t('pages.orders.transferItem.sourceLabel', { id: activeSourceSummary.transferId }) }}</span>
        </div>
        <ElButton link type="primary" @click="handleClearSourceFilter">查看全部</ElButton>
        <ElButton link type="primary" @click="handleClearSourceFilter">{{ t('common.actions.viewAll') }}</ElButton>
      </div>
    </ElCard>
@@ -59,6 +59,7 @@
<script setup>
  import { computed, onMounted, ref, watch } from 'vue'
  import { useI18n } from 'vue-i18n'
  import { ElButton, ElMessage } from 'element-plus'
  import { useRoute, useRouter } from 'vue-router'
  import { useUserStore } from '@/store/modules/user'
@@ -77,23 +78,24 @@
  import { createTransferItemTableColumns } from './transferItemTable.columns.js'
  import {
    TRANSFER_ITEM_REPORT_STYLE,
    TRANSFER_ITEM_REPORT_TITLE,
    buildTransferItemPageQueryParams,
    buildTransferItemPrintRows,
    buildTransferItemReportMeta,
    buildTransferItemSearchParams,
    createTransferItemSearchState,
    getTransferItemPaginationKey,
    getTransferItemReportTitle,
    getTransferItemStatusOptions,
    normalizeTransferItemRow
  } from './transferItemPage.helpers.js'
  defineOptions({ name: 'TransferItem' })
  const { t } = useI18n()
  const userStore = useUserStore()
  const route = useRoute()
  const router = useRouter()
  const reportTitle = TRANSFER_ITEM_REPORT_TITLE
  const reportTitle = computed(() => getTransferItemReportTitle(t))
  const searchForm = ref(createTransferItemSearchState())
  const selectedRows = ref([])
  const detailDrawerVisible = ref(false)
@@ -111,220 +113,220 @@
  const searchItems = computed(() => [
    {
      label: '关键字',
      label: t('table.keyword'),
      key: 'condition',
      type: 'input',
      props: {
        clearable: true,
        placeholder: '请输入调拨单号/物料编码/物料名称/备注'
        placeholder: t('pages.orders.transferItem.search.conditionPlaceholder')
      }
    },
    {
      label: '开始时间',
      label: t('pages.orders.transferItem.search.timeStart'),
      key: 'timeStart',
      type: 'datetime',
      props: {
        clearable: true,
        format: 'YYYY-MM-DD HH:mm:ss',
        valueFormat: 'YYYY-MM-DD HH:mm:ss',
        placeholder: '请选择开始时间'
        placeholder: t('pages.orders.transferItem.search.timeStartPlaceholder')
      }
    },
    {
      label: '结束时间',
      label: t('pages.orders.transferItem.search.timeEnd'),
      key: 'timeEnd',
      type: 'datetime',
      props: {
        clearable: true,
        format: 'YYYY-MM-DD HH:mm:ss',
        valueFormat: 'YYYY-MM-DD HH:mm:ss',
        placeholder: '请选择结束时间'
        placeholder: t('pages.orders.transferItem.search.timeEndPlaceholder')
      }
    },
    {
      label: '调拨单ID',
      label: t('pages.orders.transferItem.search.transferId'),
      key: 'transferId',
      type: 'inputNumber',
      props: {
        clearable: true,
        controlsPosition: 'right',
        placeholder: '请输入调拨单ID'
        placeholder: t('pages.orders.transferItem.search.transferIdPlaceholder')
      }
    },
    {
      label: '调拨单号',
      label: t('pages.orders.transferItem.search.transferCode'),
      key: 'transferCode',
      type: 'input',
      props: {
        clearable: true,
        placeholder: '请输入调拨单号'
        placeholder: t('pages.orders.transferItem.search.transferCodePlaceholder')
      }
    },
    {
      label: '物料ID',
      label: t('pages.orders.transferItem.search.matnrId'),
      key: 'matnrId',
      type: 'inputNumber',
      props: {
        clearable: true,
        controlsPosition: 'right',
        placeholder: '请输入物料ID'
        placeholder: t('pages.orders.transferItem.search.matnrIdPlaceholder')
      }
    },
    {
      label: '物料名称',
      label: t('table.materialName'),
      key: 'maktx',
      type: 'input',
      props: {
        clearable: true,
        placeholder: '请输入物料名称'
        placeholder: t('pages.orders.transferItem.search.maktxPlaceholder')
      }
    },
    {
      label: '物料编码',
      label: t('table.materialCode'),
      key: 'matnrCode',
      type: 'input',
      props: {
        clearable: true,
        placeholder: '请输入物料编码'
        placeholder: t('pages.orders.transferItem.search.matnrCodePlaceholder')
      }
    },
    {
      label: '单位',
      label: t('table.unit'),
      key: 'unit',
      type: 'input',
      props: {
        clearable: true,
        placeholder: '请输入单位'
        placeholder: t('pages.orders.transferItem.search.unitPlaceholder')
      }
    },
    {
      label: '数量',
      label: t('table.quantity'),
      key: 'anfme',
      type: 'inputNumber',
      props: {
        clearable: true,
        controlsPosition: 'right',
        placeholder: '请输入数量'
        placeholder: t('pages.orders.transferItem.search.anfmePlaceholder')
      }
    },
    {
      label: '已完成数量',
      label: t('pages.orders.transferItem.search.qty'),
      key: 'qty',
      type: 'inputNumber',
      props: {
        clearable: true,
        controlsPosition: 'right',
        placeholder: '请输入已完成数量'
        placeholder: t('pages.orders.transferItem.search.qtyPlaceholder')
      }
    },
    {
      label: '执行数量',
      label: t('pages.orders.transferItem.search.workQty'),
      key: 'workQty',
      type: 'inputNumber',
      props: {
        clearable: true,
        controlsPosition: 'right',
        placeholder: '请输入执行数量'
        placeholder: t('pages.orders.transferItem.search.workQtyPlaceholder')
      }
    },
    {
      label: '批次',
      label: t('table.batch'),
      key: 'batch',
      type: 'input',
      props: {
        clearable: true,
        placeholder: '请输入批次'
        placeholder: t('pages.orders.transferItem.search.batchPlaceholder')
      }
    },
    {
      label: '供应商ID',
      label: t('pages.orders.transferItem.search.splrId'),
      key: 'splrId',
      type: 'inputNumber',
      props: {
        clearable: true,
        controlsPosition: 'right',
        placeholder: '请输入供应商ID'
        placeholder: t('pages.orders.transferItem.search.splrIdPlaceholder')
      }
    },
    {
      label: '规格',
      label: t('pages.orders.transferItem.search.spec'),
      key: 'spec',
      type: 'input',
      props: {
        clearable: true,
        placeholder: '请输入规格'
        placeholder: t('pages.orders.transferItem.search.specPlaceholder')
      }
    },
    {
      label: '型号',
      label: t('pages.orders.transferItem.search.model'),
      key: 'model',
      type: 'input',
      props: {
        clearable: true,
        placeholder: '请输入型号'
        placeholder: t('pages.orders.transferItem.search.modelPlaceholder')
      }
    },
    {
      label: '字段索引',
      label: t('pages.orders.transferItem.search.fieldsIndex'),
      key: 'fieldsIndex',
      type: 'input',
      props: {
        clearable: true,
        placeholder: '请输入字段索引'
        placeholder: t('pages.orders.transferItem.search.fieldsIndexPlaceholder')
      }
    },
    {
      label: '平台行号',
      label: t('pages.orders.transferItem.search.platItemId'),
      key: 'platItemId',
      type: 'input',
      props: {
        clearable: true,
        placeholder: '请输入平台行号'
        placeholder: t('pages.orders.transferItem.search.platItemIdPlaceholder')
      }
    },
    {
      label: '客户订单号',
      label: t('pages.orders.transferItem.search.platOrderCode'),
      key: 'platOrderCode',
      type: 'input',
      props: {
        clearable: true,
        placeholder: '请输入客户订单号'
        placeholder: t('pages.orders.transferItem.search.platOrderCodePlaceholder')
      }
    },
    {
      label: '工单号',
      label: t('pages.orders.transferItem.search.platWorkCode'),
      key: 'platWorkCode',
      type: 'input',
      props: {
        clearable: true,
        placeholder: '请输入工单号'
        placeholder: t('pages.orders.transferItem.search.platWorkCodePlaceholder')
      }
    },
    {
      label: '项目号',
      label: t('pages.orders.transferItem.search.projectCode'),
      key: 'projectCode',
      type: 'input',
      props: {
        clearable: true,
        placeholder: '请输入项目号'
        placeholder: t('pages.orders.transferItem.search.projectCodePlaceholder')
      }
    },
    {
      label: '备注',
      label: t('table.memo'),
      key: 'memo',
      type: 'input',
      props: {
        clearable: true,
        placeholder: '请输入备注'
        placeholder: t('pages.orders.transferItem.search.memoPlaceholder')
      }
    },
    {
      label: '状态',
      label: t('table.status'),
      key: 'status',
      type: 'select',
      props: {
        clearable: true,
        options: getTransferItemStatusOptions()
        options: getTransferItemStatusOptions(t)
      }
    }
  ])
@@ -354,12 +356,13 @@
      paginationKey: getTransferItemPaginationKey(),
      columnsFactory: () =>
        createTransferItemTableColumns({
          handleView: openDetail
          handleView: openDetail,
          t
        })
    },
    transform: {
      dataTransformer: (records) =>
        Array.isArray(records) ? records.map((item) => normalizeTransferItemRow(item)) : []
        Array.isArray(records) ? records.map((item) => normalizeTransferItemRow(item, t)) : []
    }
  })
@@ -368,13 +371,13 @@
    detailLoading.value = true
    try {
      const detail = await guardRequestWithMessage(fetchTransferItemDetail(row.id), {}, {
        timeoutMessage: '调拨明细详情加载超时,已停止等待'
        timeoutMessage: t('pages.orders.transferItem.messages.detailTimeout')
      })
      detailData.value = normalizeTransferItemRow(detail)
      detailData.value = normalizeTransferItemRow(detail, t)
    } catch (error) {
      detailDrawerVisible.value = false
      detailData.value = {}
      ElMessage.error(error?.message || '获取调拨明细详情失败')
      ElMessage.error(error?.message || t('pages.orders.transferItem.messages.detailFailed'))
    } finally {
      detailLoading.value = false
    }
@@ -447,11 +450,11 @@
        }
      }),
    resolvePrintRecords,
    buildPreviewRows: (records) => buildTransferItemPrintRows(records),
    buildPreviewRows: (records) => buildTransferItemPrintRows(records, t),
    buildPreviewMeta: (rows) => {
      const now = new Date()
      return {
        reportTitle,
        reportTitle: reportTitle.value,
        reportDate: now.toLocaleDateString('zh-CN'),
        printedAt: now.toLocaleString('zh-CN', { hour12: false }),
        operator: userStore.getUserInfo?.name || userStore.getUserInfo?.username || '',
@@ -467,7 +470,8 @@
    buildTransferItemReportMeta({
      previewMeta: previewMeta.value,
      count: previewRows.value.length,
      orientation: previewMeta.value?.reportStyle?.orientation || TRANSFER_ITEM_REPORT_STYLE.orientation
      orientation: previewMeta.value?.reportStyle?.orientation || TRANSFER_ITEM_REPORT_STYLE.orientation,
      t
    })
  )