| | |
| | | <script setup> |
| | | import { computed, reactive, ref } from 'vue' |
| | | import { useRouter } from 'vue-router' |
| | | import { useI18n } from 'vue-i18n' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { useUserStore } from '@/store/modules/user' |
| | | import { useTable } from '@/hooks/core/useTable' |
| | |
| | | |
| | | const userStore = useUserStore() |
| | | const router = useRouter() |
| | | const reportTitle = 'DO单报表' |
| | | const { t } = useI18n() |
| | | const reportTitle = t('pages.orders.delivery.reportTitle') |
| | | const searchForm = ref(createDeliverySearchState()) |
| | | const selectedRows = ref([]) |
| | | const detailDrawerVisible = ref(false) |
| | |
| | | const reportQueryParams = computed(() => buildDeliverySearchParams(searchForm.value)) |
| | | const searchItems = computed(() => [ |
| | | { |
| | | label: '关键字', |
| | | label: t('pages.orders.delivery.search.condition'), |
| | | key: 'condition', |
| | | type: 'input', |
| | | props: { |
| | | clearable: true, |
| | | placeholder: '请输入单号/ERP主单标识/平台单号' |
| | | placeholder: t('pages.orders.delivery.placeholder.condition') |
| | | } |
| | | }, |
| | | { |
| | | label: '单号', |
| | | label: t('pages.orders.delivery.search.code'), |
| | | key: 'code', |
| | | type: 'input', |
| | | props: { |
| | | clearable: true, |
| | | placeholder: '请输入单号' |
| | | placeholder: t('pages.orders.delivery.placeholder.code') |
| | | } |
| | | }, |
| | | { |
| | | label: 'ERP主单标识', |
| | | label: t('pages.orders.delivery.search.platId'), |
| | | key: 'platId', |
| | | type: 'input', |
| | | props: { |
| | | clearable: true, |
| | | placeholder: '请输入ERP主单标识' |
| | | placeholder: t('pages.orders.delivery.placeholder.platId') |
| | | } |
| | | }, |
| | | { |
| | | label: '单据类型', |
| | | label: t('pages.orders.delivery.search.type'), |
| | | key: 'type', |
| | | type: 'input', |
| | | props: { |
| | | clearable: true, |
| | | placeholder: '请输入单据类型' |
| | | placeholder: t('pages.orders.delivery.placeholder.type') |
| | | } |
| | | }, |
| | | { |
| | | label: '业务类型', |
| | | label: t('pages.orders.delivery.search.wkType'), |
| | | key: 'wkType', |
| | | type: 'input', |
| | | props: { |
| | | clearable: true, |
| | | placeholder: '请输入业务类型' |
| | | placeholder: t('pages.orders.delivery.placeholder.wkType') |
| | | } |
| | | }, |
| | | { |
| | | label: '单据来源', |
| | | label: t('pages.orders.delivery.search.source'), |
| | | key: 'source', |
| | | type: 'input', |
| | | props: { |
| | | clearable: true, |
| | | placeholder: '请输入单据来源' |
| | | placeholder: t('pages.orders.delivery.placeholder.source') |
| | | } |
| | | }, |
| | | { |
| | | label: '执行状态', |
| | | label: t('pages.orders.delivery.search.exceStatus'), |
| | | key: 'exceStatus', |
| | | type: 'input', |
| | | props: { |
| | | clearable: true, |
| | | placeholder: '请输入执行状态' |
| | | placeholder: t('pages.orders.delivery.placeholder.exceStatus') |
| | | } |
| | | }, |
| | | { |
| | | label: '备注', |
| | | label: t('pages.orders.delivery.search.memo'), |
| | | key: 'memo', |
| | | type: 'input', |
| | | props: { |
| | | clearable: true, |
| | | placeholder: '请输入备注' |
| | | placeholder: t('pages.orders.delivery.placeholder.memo') |
| | | } |
| | | } |
| | | ]) |
| | |
| | | }) |
| | | ), |
| | | { records: [] }, |
| | | { timeoutMessage: '交接单明细加载超时,已停止等待' } |
| | | { timeoutMessage: t('pages.orders.delivery.messages.itemsTimeout') } |
| | | ) |
| | | const normalizedResponse = defaultResponseAdapter(response) |
| | | detailItemRows.value = normalizedResponse.records.map((item) => normalizeDeliveryItemRow(item)) |
| | |
| | | const detail = await guardRequestWithMessage( |
| | | fetchGetDeliveryDetail(row.id), |
| | | {}, |
| | | { timeoutMessage: '交接单详情加载超时,已停止等待' } |
| | | { timeoutMessage: t('pages.orders.delivery.messages.detailTimeout') } |
| | | ) |
| | | detailData.value = normalizeDeliveryRow(detail) |
| | | } finally { |
| | |
| | | await loadDetailItems(row.id) |
| | | } catch (error) { |
| | | detailDrawerVisible.value = false |
| | | ElMessage.error(error?.message || '获取交接单详情失败') |
| | | ElMessage.error(error?.message || t('pages.orders.delivery.messages.detailLoadFailed')) |
| | | } |
| | | } |
| | | |
| | | async function handleDelete(row) { |
| | | try { |
| | | await ElMessageBox.confirm(`确定要删除交接单「${row.code || row.id}」吗?`, '删除确认', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }) |
| | | await ElMessageBox.confirm( |
| | | t('crud.confirm.deleteMessage', { |
| | | entity: t('pages.orders.delivery.entity'), |
| | | label: row.code || row.id |
| | | }), |
| | | t('crud.confirm.deleteTitle'), |
| | | { |
| | | confirmButtonText: t('common.confirm'), |
| | | cancelButtonText: t('common.cancel'), |
| | | type: 'warning' |
| | | } |
| | | ) |
| | | await fetchDeleteDelivery(row.id) |
| | | ElMessage.success('删除成功') |
| | | ElMessage.success(t('crud.messages.deleteSuccess')) |
| | | await refreshRemove() |
| | | } catch (error) { |
| | | if (error !== 'cancel') { |
| | | ElMessage.error(error?.message || '删除失败') |
| | | ElMessage.error(error?.message || t('crud.messages.deleteFailed')) |
| | | } |
| | | } |
| | | } |