| | |
| | | <ArtTableHeader v-model:columns="columnChecks" :loading="loading" @refresh="refreshData"> |
| | | <template #left> |
| | | <ElSpace wrap> |
| | | <ElButton v-auth="'add'" @click="handleShowDialog('add')" v-ripple>新增站点区域</ElButton> |
| | | <ElButton v-auth="'add'" @click="handleShowDialog('add')" v-ripple |
| | | >新增站点区域</ElButton |
| | | > |
| | | <ElButton |
| | | v-auth="'delete'" |
| | | type="danger" |
| | |
| | | detailDrawerVisible.value = true |
| | | detailLoading.value = true |
| | | try { |
| | | const detail = await guardRequestWithMessage(fetchBasStationAreaDetail(row.id), {}, { |
| | | timeoutMessage: '站点区域详情加载超时,已停止等待' |
| | | }) |
| | | const detail = await guardRequestWithMessage( |
| | | fetchBasStationAreaDetail(row.id), |
| | | {}, |
| | | { |
| | | timeoutMessage: '站点区域详情加载超时,已停止等待' |
| | | } |
| | | ) |
| | | detailData.value = normalizeBasStationAreaDetailRecord(detail, { |
| | | resolveAreaLabel, |
| | | resolveCrossZoneAreaLabel, |
| | |
| | | timeoutMessage: '站点别名选项加载超时,已停止等待' |
| | | } |
| | | ) |
| | | stationOptions.value = resolveBasStationAreaStationOptions(defaultResponseAdapter(response).records) |
| | | stationOptions.value = resolveBasStationAreaStationOptions( |
| | | defaultResponseAdapter(response).records |
| | | ) |
| | | stationOptionsLoaded.value = true |
| | | })() |
| | | |
| | |
| | | |
| | | async function openEditDialog(row) { |
| | | try { |
| | | const detail = await guardRequestWithMessage(fetchBasStationAreaDetail(row.id), {}, { |
| | | timeoutMessage: '站点区域详情加载超时,已停止等待' |
| | | }) |
| | | const detail = await guardRequestWithMessage( |
| | | fetchBasStationAreaDetail(row.id), |
| | | {}, |
| | | { |
| | | timeoutMessage: '站点区域详情加载超时,已停止等待' |
| | | } |
| | | ) |
| | | await handleShowDialog('edit', detail) |
| | | } catch (error) { |
| | | ElMessage.error(error?.message || '获取站点区域详情失败') |
| | | } |
| | | } |
| | | |
| | | const { columns, columnChecks, data, loading, pagination, getData, replaceSearchParams, resetSearchParams, handleSizeChange, handleCurrentChange, refreshData, refreshCreate, refreshUpdate, refreshRemove } = |
| | | useTable({ |
| | | core: { |
| | | apiFn: fetchBasStationAreaPage, |
| | | apiParams: buildBasStationAreaPageQueryParams(searchForm.value), |
| | | paginationKey: getBasStationAreaPaginationKey(), |
| | | columnsFactory: () => |
| | | createBasStationAreaTableColumns({ |
| | | handleView: openDetail, |
| | | handleEdit: hasAuth('update') ? openEditDialog : null, |
| | | handleDelete: hasAuth('delete') ? (row) => handleDeleteAction?.(row) : null, |
| | | canEdit: hasAuth('update'), |
| | | canDelete: hasAuth('delete') |
| | | }) |
| | | }, |
| | | transform: { |
| | | dataTransformer: (records) => { |
| | | if (!Array.isArray(records)) { |
| | | return [] |
| | | } |
| | | return records.map((item) => |
| | | normalizeBasStationAreaListRow(item, { |
| | | resolveAreaLabel, |
| | | resolveCrossZoneAreaLabel, |
| | | resolveContainerTypeLabel, |
| | | resolveTypeLabel, |
| | | resolveStationAliasLabel, |
| | | resolveUseStatusLabel |
| | | }) |
| | | ) |
| | | const { |
| | | columns, |
| | | columnChecks, |
| | | data, |
| | | loading, |
| | | pagination, |
| | | getData, |
| | | replaceSearchParams, |
| | | resetSearchParams, |
| | | handleSizeChange, |
| | | handleCurrentChange, |
| | | refreshData, |
| | | refreshCreate, |
| | | refreshUpdate, |
| | | refreshRemove |
| | | } = useTable({ |
| | | core: { |
| | | apiFn: fetchBasStationAreaPage, |
| | | apiParams: buildBasStationAreaPageQueryParams(searchForm.value), |
| | | paginationKey: getBasStationAreaPaginationKey(), |
| | | columnsFactory: () => |
| | | createBasStationAreaTableColumns({ |
| | | handleView: openDetail, |
| | | handleEdit: hasAuth('update') ? openEditDialog : null, |
| | | handleDelete: hasAuth('delete') ? (row) => handleDeleteAction?.(row) : null, |
| | | canEdit: hasAuth('update'), |
| | | canDelete: hasAuth('delete') |
| | | }) |
| | | }, |
| | | transform: { |
| | | dataTransformer: (records) => { |
| | | if (!Array.isArray(records)) { |
| | | return [] |
| | | } |
| | | return records.map((item) => |
| | | normalizeBasStationAreaListRow(item, { |
| | | resolveAreaLabel, |
| | | resolveCrossZoneAreaLabel, |
| | | resolveContainerTypeLabel, |
| | | resolveTypeLabel, |
| | | resolveStationAliasLabel, |
| | | resolveUseStatusLabel |
| | | }) |
| | | ) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | const { |
| | | dialogVisible, |
| | |
| | | const response = await guardRequestWithMessage(fetchWarehouseAreasList(), [], { |
| | | timeoutMessage: '库区选项加载超时,已停止等待' |
| | | }) |
| | | const options = resolveBasStationAreaWarehouseAreaOptions(defaultResponseAdapter(response).records) |
| | | const options = resolveBasStationAreaWarehouseAreaOptions( |
| | | defaultResponseAdapter(response).records |
| | | ) |
| | | areaOptions.value = options |
| | | crossZoneAreaOptions.value = options |
| | | } |
| | |
| | | { records: [] }, |
| | | { timeoutMessage: '容器类型选项加载超时,已停止等待' } |
| | | ) |
| | | containerTypeOptions.value = resolveBasStationAreaContainerTypeOptions(defaultResponseAdapter(response).records) |
| | | containerTypeOptions.value = resolveBasStationAreaContainerTypeOptions( |
| | | defaultResponseAdapter(response).records |
| | | ) |
| | | } |
| | | |
| | | async function loadUseStatusOptions() { |
| | |
| | | { records: [] }, |
| | | { timeoutMessage: '使用状态选项加载超时,已停止等待' } |
| | | ) |
| | | useStatusOptions.value = resolveBasStationAreaUseStatusOptions(defaultResponseAdapter(response).records) |
| | | useStatusOptions.value = resolveBasStationAreaUseStatusOptions( |
| | | defaultResponseAdapter(response).records |
| | | ) |
| | | } |
| | | |
| | | onMounted(async () => { |