| | |
| | | import { $t } from '@/locales' |
| | | |
| | | const STATUS_META = { |
| | | 1: { text: '正常', type: 'success', bool: true }, |
| | | 0: { text: '冻结', type: 'danger', bool: false } |
| | | 1: { text: $t('common.status.normal'), type: 'success', bool: true }, |
| | | 0: { text: $t('common.status.frozen'), type: 'danger', bool: false } |
| | | } |
| | | |
| | | const TYPE_OPTIONS = [ |
| | | { label: '智能站点', value: 0 }, |
| | | { label: '普通站点', value: 1 } |
| | | { label: $t('pages.basicInfo.basStationArea.type.smart'), value: 0 }, |
| | | { label: $t('pages.basicInfo.basStationArea.type.normal'), value: 1 } |
| | | ] |
| | | |
| | | const BINARY_OPTIONS = [ |
| | | { label: '否', value: 0 }, |
| | | { label: '是', value: 1 } |
| | | { label: $t('common.status.no'), value: 0 }, |
| | | { label: $t('common.status.yes'), value: 1 } |
| | | ] |
| | | |
| | | const STATUS_OPTIONS = [ |
| | | { label: '正常', value: 1 }, |
| | | { label: '冻结', value: 0 } |
| | | { label: $t('common.status.normal'), value: 1 }, |
| | | { label: $t('common.status.frozen'), value: 0 } |
| | | ] |
| | | |
| | | export const BAS_STATION_AREA_REPORT_TITLE = '站点区域报表' |
| | | export const BAS_STATION_AREA_REPORT_TITLE = $t('pages.basicInfo.basStationArea.reportTitle') |
| | | export const BAS_STATION_AREA_REPORT_STYLE = { |
| | | titleAlign: 'center', |
| | | titleLevel: 'strong', |
| | |
| | | } |
| | | |
| | | function normalizeBooleanText(value) { |
| | | if (value === 1 || value === '1' || value === true || value === '是') { |
| | | return '是' |
| | | if (value === 1 || value === '1' || value === true || value === $t('common.status.yes')) { |
| | | return $t('common.status.yes') |
| | | } |
| | | if (value === 0 || value === '0' || value === false || value === '否') { |
| | | return '否' |
| | | if (value === 0 || value === '0' || value === false || value === $t('common.status.no')) { |
| | | return $t('common.status.no') |
| | | } |
| | | return normalizeText(value) || '--' |
| | | return normalizeText(value) || $t('common.placeholder.empty') |
| | | } |
| | | |
| | | function normalizeIdArray(values = []) { |
| | |
| | | }) |
| | | .filter(Boolean) |
| | | |
| | | return labels.length ? labels.join('、') : '--' |
| | | return labels.length ? labels.join($t('common.listSeparator')) : $t('common.placeholder.empty') |
| | | } |
| | | |
| | | function getStatusMeta(status) { |
| | |
| | | if (status === false || Number(status) === 0) { |
| | | return STATUS_META[0] |
| | | } |
| | | return { text: '未知', type: 'info', bool: false } |
| | | return { text: $t('common.status.unknown'), type: 'info', bool: false } |
| | | } |
| | | |
| | | export function createBasStationAreaSearchState() { |
| | |
| | | } |
| | | return { |
| | | value: Number(value), |
| | | label: normalizeText(item.name || item.areaName || item.code || item.areaCode || `库区 ${value}`) |
| | | label: normalizeText(item.name || item.areaName || item.code || item.areaCode || `${$t('menu.warehouseAreas')} ${value}`) |
| | | } |
| | | }) |
| | | .filter(Boolean) |
| | |
| | | } |
| | | return { |
| | | value: Number(value), |
| | | label: normalizeText(item.stationName || item.stationId || item.name || `站点 ${value}`) |
| | | label: normalizeText(item.stationName || item.stationId || item.name || `${$t('menu.basStation')} ${value}`) |
| | | } |
| | | }) |
| | | .filter(Boolean) |
| | |
| | | return { |
| | | ...record, |
| | | id: normalizeIdValue(record.id), |
| | | stationAreaName: normalizeText(record.stationAreaName) || '--', |
| | | stationAreaId: normalizeText(record.stationAreaId) || '--', |
| | | stationAreaName: normalizeText(record.stationAreaName) || $t('common.placeholder.empty'), |
| | | stationAreaId: normalizeText(record.stationAreaId) || $t('common.placeholder.empty'), |
| | | type: normalizeIdValue(record.type), |
| | | typeText: normalizeText( |
| | | record.type$ || record.typeText || resolvers.resolveTypeLabel?.(typeValue) || typeValue |
| | | ) || '--', |
| | | ) || $t('common.placeholder.empty'), |
| | | inAble: normalizeIdValue(record.inAble), |
| | | inAbleText: normalizeBooleanText(record.inAble), |
| | | outAble: normalizeIdValue(record.outAble), |
| | | outAbleText: normalizeBooleanText(record.outAble), |
| | | useStatus: normalizeText(record.useStatus), |
| | | useStatusText: normalizeText(record.useStatus$ || record.useStatusText || resolvers.resolveUseStatusLabel?.(record.useStatus) || record.useStatus) || '--', |
| | | useStatusText: |
| | | normalizeText(record.useStatus$ || record.useStatusText || resolvers.resolveUseStatusLabel?.(record.useStatus) || record.useStatus) || |
| | | $t('common.placeholder.empty'), |
| | | area: normalizeIdValue(areaId), |
| | | areaText: normalizeText(record.area$ || record.areaText || resolvers.resolveAreaLabel?.(areaId) || '') || '--', |
| | | areaText: normalizeText(record.area$ || record.areaText || resolvers.resolveAreaLabel?.(areaId) || '') || $t('common.placeholder.empty'), |
| | | isCrossZone: normalizeIdValue(record.isCrossZone), |
| | | isCrossZoneText: normalizeBooleanText(record.isCrossZone), |
| | | crossZoneArea: crossZoneAreaIds, |
| | | crossZoneAreaText: |
| | | resolveOptionText(crossZoneAreaIds, resolvers.resolveCrossZoneAreaLabel, record.crossZoneAreaText || []) || '--', |
| | | resolveOptionText(crossZoneAreaIds, resolvers.resolveCrossZoneAreaLabel, record.crossZoneAreaText || []) || |
| | | $t('common.placeholder.empty'), |
| | | isWcs: normalizeIdValue(record.isWcs), |
| | | isWcsText: normalizeBooleanText(record.isWcs), |
| | | wcsData: normalizeText(record.wcsData) || '--', |
| | | wcsData: normalizeText(record.wcsData) || $t('common.placeholder.empty'), |
| | | containerType: containerTypeIds, |
| | | containerTypeText: |
| | | resolveOptionText(containerTypeIds, resolvers.resolveContainerTypeLabel, record.containerTypesText || []) || '--', |
| | | barcode: normalizeText(record.barcode) || '--', |
| | | resolveOptionText(containerTypeIds, resolvers.resolveContainerTypeLabel, record.containerTypesText || []) || |
| | | $t('common.placeholder.empty'), |
| | | barcode: normalizeText(record.barcode) || $t('common.placeholder.empty'), |
| | | autoTransfer: normalizeIdValue(record.autoTransfer), |
| | | autoTransferText: normalizeBooleanText(record.autoTransfer), |
| | | stationAlias: stationAliasIds, |
| | |
| | | stationAliasIds, |
| | | resolvers.resolveStationAliasLabel, |
| | | stationAliasNames.length ? stationAliasNames : record.stationAliasText || [] |
| | | ) || '--', |
| | | ) || $t('common.placeholder.empty'), |
| | | status: normalizeIdValue(record.status), |
| | | statusText: statusMeta.text, |
| | | statusType: statusMeta.type, |
| | | statusBool: record.statusBool !== void 0 ? Boolean(record.statusBool) : statusMeta.bool, |
| | | memo: normalizeText(record.memo) || '--', |
| | | createByText: normalizeText(record.createBy$ || record.createByText || ''), |
| | | createTimeText: normalizeText(record.createTime$ || record.createTime || ''), |
| | | updateByText: normalizeText(record.updateBy$ || record.updateByText || ''), |
| | | updateTimeText: normalizeText(record.updateTime$ || record.updateTime || '') |
| | | memo: normalizeText(record.memo) || $t('common.placeholder.empty'), |
| | | createByText: normalizeText(record.createBy$ || record.createByText || '') || $t('common.placeholder.empty'), |
| | | createTimeText: normalizeText(record.createTime$ || record.createTime || '') || $t('common.placeholder.empty'), |
| | | updateByText: normalizeText(record.updateBy$ || record.updateByText || '') || $t('common.placeholder.empty'), |
| | | updateTimeText: normalizeText(record.updateTime$ || record.updateTime || '') || $t('common.placeholder.empty') |
| | | } |
| | | } |
| | | |