zhou zhou
1 天以前 7c2bffa1a495cc4a3a263f654c08c231009c5c4e
rsf-design/src/views/orders/transfer/index.vue
@@ -12,7 +12,7 @@
      <ArtTableHeader v-model:columns="columnChecks" :loading="loading" @refresh="refreshData">
        <template #left>
          <ElSpace wrap>
            <ElButton v-if="canCreate" type="primary" @click="showDialog('add')" v-ripple>新增调拨单</ElButton>
            <ElButton v-if="canCreate" type="primary" @click="showDialog('add')" v-ripple>{{ t('pages.orders.transfer.actions.add') }}</ElButton>
            <ElButton
              v-if="canDelete"
              type="danger"
@@ -20,7 +20,7 @@
              @click="handleBatchDelete"
              v-ripple
            >
              批量删除
              {{ t('common.actions.batchDelete') }}
            </ElButton>
            <ListExportPrint
              class="inline-flex"
@@ -78,6 +78,7 @@
<script setup>
  import { computed, onMounted, reactive, ref } from 'vue'
  import { useRouter } from 'vue-router'
  import { useI18n } from 'vue-i18n'
  import { ElMessage, ElMessageBox } from 'element-plus'
  import { useAuth } from '@/hooks/core/useAuth'
  import { useUserStore } from '@/store/modules/user'
@@ -131,6 +132,7 @@
  const { hasAuth } = useAuth()
  const userStore = useUserStore()
  const router = useRouter()
  const { t } = useI18n()
  const reportTitle = TRANSFER_REPORT_TITLE
  const searchForm = ref(createTransferSearchState())
@@ -157,37 +159,37 @@
  const reportQueryParams = computed(() => buildTransferSearchParams(searchForm.value))
  const searchItems = computed(() => [
    { label: '关键字', key: 'condition', type: 'input', props: { clearable: true, placeholder: '请输入单号/备注/仓库/库区' } },
    { label: '调拨单号', key: 'code', type: 'input', props: { clearable: true, placeholder: '请输入调拨单号' } },
    { label: t('pages.orders.transfer.search.condition'), key: 'condition', type: 'input', props: { clearable: true, placeholder: t('pages.orders.transfer.placeholder.condition') } },
    { label: t('pages.orders.transfer.search.code'), key: 'code', type: 'input', props: { clearable: true, placeholder: t('pages.orders.transfer.placeholder.code') } },
    {
      label: '调拨类型',
      label: t('pages.orders.transfer.search.type'),
      key: 'type',
      type: 'select',
      props: { clearable: true, filterable: true, options: typeOptions.value }
    },
    {
      label: '来源',
      label: t('pages.orders.transfer.search.source'),
      key: 'source',
      type: 'select',
      props: { clearable: true, options: getTransferSourceOptions() }
    },
    {
      label: '执行状态',
      label: t('pages.orders.transfer.search.exceStatus'),
      key: 'exceStatus',
      type: 'select',
      props: { clearable: true, options: getTransferExceStatusOptions() }
    },
    { label: '源仓库', key: 'orgWareName', type: 'input', props: { clearable: true, placeholder: '请输入源仓库' } },
    { label: '目标仓库', key: 'tarWareName', type: 'input', props: { clearable: true, placeholder: '请输入目标仓库' } },
    { label: '源库区', key: 'orgAreaName', type: 'input', props: { clearable: true, placeholder: '请输入源库区' } },
    { label: '目标库区', key: 'tarAreaName', type: 'input', props: { clearable: true, placeholder: '请输入目标库区' } },
    { label: t('pages.orders.transfer.search.orgWareName'), key: 'orgWareName', type: 'input', props: { clearable: true, placeholder: t('pages.orders.transfer.placeholder.orgWareName') } },
    { label: t('pages.orders.transfer.search.tarWareName'), key: 'tarWareName', type: 'input', props: { clearable: true, placeholder: t('pages.orders.transfer.placeholder.tarWareName') } },
    { label: t('pages.orders.transfer.search.orgAreaName'), key: 'orgAreaName', type: 'input', props: { clearable: true, placeholder: t('pages.orders.transfer.placeholder.orgAreaName') } },
    { label: t('pages.orders.transfer.search.tarAreaName'), key: 'tarAreaName', type: 'input', props: { clearable: true, placeholder: t('pages.orders.transfer.placeholder.tarAreaName') } },
    {
      label: '状态',
      label: t('pages.orders.transfer.search.status'),
      key: 'status',
      type: 'select',
      props: { clearable: true, options: getTransferStatusOptions() }
    },
    { label: '备注', key: 'memo', type: 'input', props: { clearable: true, placeholder: '请输入备注' } }
    { label: t('pages.orders.transfer.search.memo'), key: 'memo', type: 'input', props: { clearable: true, placeholder: t('pages.orders.transfer.placeholder.memo') } }
  ])
  function handleSelectionChange(rows) {
@@ -201,7 +203,7 @@
      const response = await guardRequestWithMessage(
        fetchTransferDetail(transferId),
        {},
        { timeoutMessage: '调拨单详情加载超时,已停止等待' }
        { timeoutMessage: t('pages.orders.transfer.messages.detailTimeout') }
      )
      detailData.value = normalizeTransferDetailRecord(response)
    } finally {
@@ -221,7 +223,7 @@
          })
        ),
        { records: [], total: 0, current: detailOrderPagination.current, size: detailOrderPagination.size },
        { timeoutMessage: '关联单据加载超时,已停止等待' }
        { timeoutMessage: t('pages.orders.transfer.messages.ordersTimeout') }
      )
      const normalized = defaultResponseAdapter(response)
      detailOrderRows.value = normalized.records.map((item) => normalizeTransferOrderRow(item))
@@ -231,7 +233,7 @@
    } catch (error) {
      detailOrderRows.value = []
      detailOrderPagination.total = 0
      ElMessage.error(error?.message || '获取关联单据失败')
      ElMessage.error(error?.message || t('pages.orders.transfer.messages.ordersLoadFailed'))
    } finally {
      detailOrdersLoading.value = false
    }
@@ -252,7 +254,7 @@
      detailDrawerVisible.value = false
      detailData.value = {}
      detailOrderRows.value = []
      ElMessage.error(error?.message || '获取调拨单详情失败')
      ElMessage.error(error?.message || t('pages.orders.transfer.messages.detailLoadFailed'))
    }
  }
@@ -261,26 +263,26 @@
      const detail = await guardRequestWithMessage(
        fetchTransferDetail(row.id),
        {},
        { timeoutMessage: '调拨单详情加载超时,已停止等待' }
        { timeoutMessage: t('pages.orders.transfer.messages.detailTimeout') }
      )
      showDialog('edit', detail)
    } catch (error) {
      ElMessage.error(error?.message || '获取调拨单详情失败')
      ElMessage.error(error?.message || t('pages.orders.transfer.messages.detailLoadFailed'))
    }
  }
  async function handlePublish(row) {
    try {
      await ElMessageBox.confirm(`确定要下发调拨单「${row.code || row.id}」吗?`, '下发确认', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
      await ElMessageBox.confirm(t('pages.orders.transfer.messages.publishConfirm', { code: row.code || row.id }), t('pages.orders.transfer.messages.publishTitle'), {
        confirmButtonText: t('common.confirm'),
        cancelButtonText: t('common.cancel'),
        type: 'warning'
      })
      const response = await fetchTransferPubOutStock({ id: row.id })
      if (response?.code !== 200 && response?.success !== true) {
        throw new Error(response?.message || '下发执行失败')
        throw new Error(response?.message || t('pages.orders.transfer.messages.publishFailed'))
      }
      ElMessage.success(response?.message || '下发执行成功')
      ElMessage.success(response?.message || t('pages.orders.transfer.messages.publishSuccess'))
      await refreshData()
      if (detailDrawerVisible.value && activeTransferId.value === row.id) {
        await loadTransferDetail(row.id)
@@ -288,7 +290,7 @@
      }
    } catch (error) {
      if (error === 'cancel' || error?.message === 'cancel') return
      ElMessage.error(error?.message || '下发执行失败')
      ElMessage.error(error?.message || t('pages.orders.transfer.messages.publishFailed'))
    }
  }
@@ -368,7 +370,7 @@
    saveRequest: fetchSaveTransfer,
    updateRequest: fetchUpdateTransfer,
    deleteRequest: fetchDeleteTransfer,
    entityName: '调拨单',
    entityName: t('pages.orders.transfer.entity'),
    resolveRecordLabel: (record) => record?.code || record?.id,
    refreshCreate,
    refreshUpdate,
@@ -387,7 +389,7 @@
    const response = await guardRequestWithMessage(
      fetchDictDataPage({ current: 1, pageSize: 200, dictTypeCode: 'sys_transfer_type', status: 1 }),
      { records: [] },
      { timeoutMessage: '调拨类型选项加载超时,已停止等待' }
      { timeoutMessage: t('pages.orders.transfer.messages.typeOptionsTimeout') }
    )
    typeOptions.value = resolveTransferTypeOptions(defaultResponseAdapter(response).records)
  }
@@ -396,7 +398,7 @@
    const response = await guardRequestWithMessage(
      fetchWarehouseAreasList(),
      { records: [] },
      { timeoutMessage: '库区选项加载超时,已停止等待' }
      { timeoutMessage: t('pages.orders.transfer.messages.areaOptionsTimeout') }
    )
    areaOptions.value = resolveTransferAreaOptions(defaultResponseAdapter(response).records)
  }