| | |
| | | <ArtTableHeader v-model:columns="columnChecks" :loading="loading" @refresh="refreshData"> |
| | | <template #left> |
| | | <ElSpace wrap> |
| | | <ElButton v-auth="'add'" @click="showDialog('add')" v-ripple>新增站点区域</ElButton> |
| | | <ElButton v-auth="'add'" @click="handleShowDialog('add')" v-ripple>新增站点区域</ElButton> |
| | | <ElButton |
| | | v-auth="'delete'" |
| | | type="danger" |
| | |
| | | import { defaultResponseAdapter } from '@/utils/table/tableUtils' |
| | | import { guardRequestWithMessage } from '@/utils/sys/requestGuard' |
| | | import { fetchDictDataPage } from '@/api/system-manage' |
| | | import { fetchBasStationPage } from '@/api/bas-station' |
| | | import { fetchBasStationOptionPage } from '@/api/bas-station' |
| | | import { fetchWarehouseAreasList } from '@/api/warehouse-areas' |
| | | import { |
| | | fetchBasStationAreaDetail, |
| | |
| | | const containerTypeOptions = ref([]) |
| | | const stationOptions = ref([]) |
| | | const useStatusOptions = ref([]) |
| | | const stationOptionsLoaded = ref(false) |
| | | const stationOptionsLoading = ref(null) |
| | | let handleDeleteAction = null |
| | | |
| | | const areaLabelMap = computed( |
| | |
| | | } |
| | | } |
| | | |
| | | async function ensureStationOptions() { |
| | | if (stationOptionsLoaded.value) { |
| | | return |
| | | } |
| | | |
| | | if (stationOptionsLoading.value) { |
| | | await stationOptionsLoading.value |
| | | return |
| | | } |
| | | |
| | | stationOptionsLoading.value = (async () => { |
| | | const response = await guardRequestWithMessage( |
| | | fetchBasStationOptionPage( |
| | | { |
| | | current: 1, |
| | | pageSize: 100 |
| | | }, |
| | | { |
| | | showErrorMessage: false |
| | | } |
| | | ), |
| | | { records: [] }, |
| | | { |
| | | timeoutMessage: '站点别名选项加载超时,已停止等待' |
| | | } |
| | | ) |
| | | stationOptions.value = resolveBasStationAreaStationOptions(defaultResponseAdapter(response).records) |
| | | stationOptionsLoaded.value = true |
| | | })() |
| | | |
| | | try { |
| | | await stationOptionsLoading.value |
| | | } finally { |
| | | stationOptionsLoading.value = null |
| | | } |
| | | } |
| | | |
| | | async function handleShowDialog(type, record) { |
| | | await ensureStationOptions() |
| | | showDialog(type, record) |
| | | } |
| | | |
| | | async function openEditDialog(row) { |
| | | try { |
| | | const detail = await guardRequestWithMessage(fetchBasStationAreaDetail(row.id), {}, { |
| | | timeoutMessage: '站点区域详情加载超时,已停止等待' |
| | | }) |
| | | showDialog('edit', detail) |
| | | await handleShowDialog('edit', detail) |
| | | } catch (error) { |
| | | ElMessage.error(error?.message || '获取站点区域详情失败') |
| | | } |
| | |
| | | crossZoneAreaOptions.value = options |
| | | } |
| | | |
| | | async function loadStationOptions() { |
| | | const response = await guardRequestWithMessage( |
| | | fetchBasStationPage({ |
| | | current: 1, |
| | | pageSize: 500 |
| | | }, { |
| | | showErrorMessage: false |
| | | }), |
| | | { records: [] }, |
| | | { |
| | | timeoutMessage: '站点别名选项加载超时,已停止等待' |
| | | } |
| | | ) |
| | | stationOptions.value = resolveBasStationAreaStationOptions(defaultResponseAdapter(response).records) |
| | | } |
| | | |
| | | async function loadContainerTypeOptions() { |
| | | const response = await guardRequestWithMessage( |
| | | fetchDictDataPage({ |
| | |
| | | onMounted(async () => { |
| | | await Promise.allSettled([ |
| | | loadAreaOptions(), |
| | | loadStationOptions(), |
| | | loadContainerTypeOptions(), |
| | | loadUseStatusOptions() |
| | | ]) |