| | |
| | | const STATUS_META = { |
| | | 1: { text: '正常', type: 'success', bool: true }, |
| | | 0: { text: '冻结', type: 'danger', bool: false } |
| | | 1: { textKey: 'common.status.normal', fallback: 'Normal', type: 'success', bool: true }, |
| | | 0: { textKey: 'common.status.frozen', fallback: 'Frozen', type: 'danger', bool: false } |
| | | } |
| | | |
| | | export const WAREHOUSE_AREAS_REPORT_TITLE = '库区报表' |
| | | export function getWarehouseAreasReportTitle(t) { |
| | | return t('pages.basicInfo.warehouseAreas.reportTitle') |
| | | } |
| | | export const WAREHOUSE_AREAS_REPORT_STYLE = { |
| | | titleAlign: 'center', |
| | | titleLevel: 'strong', |
| | |
| | | return String(value ?? '').trim() |
| | | } |
| | | |
| | | function normalizeFlagText(value) { |
| | | if (value === 1 || value === '1' || value === true || value === '是') { |
| | | return '是' |
| | | function normalizeFlagValue(value) { |
| | | if (value === 1 || value === '1' || value === true || value === '\u662f') { |
| | | return 1 |
| | | } |
| | | if (value === 0 || value === '0' || value === false || value === '否') { |
| | | return '否' |
| | | if (value === 0 || value === '0' || value === false || value === '\u5426') { |
| | | return 0 |
| | | } |
| | | return normalizeText(value) || '-' |
| | | return null |
| | | } |
| | | |
| | | export function createWarehouseAreasSearchState() { |
| | |
| | | } |
| | | } |
| | | |
| | | export function getWarehouseAreasStatusOptions() { |
| | | export function getWarehouseAreasStatusOptions(t) { |
| | | return [ |
| | | { label: '正常', value: 1 }, |
| | | { label: '冻结', value: 0 } |
| | | { label: t('common.status.normal'), value: 1 }, |
| | | { label: t('common.status.frozen'), value: 0 } |
| | | ] |
| | | } |
| | | |
| | | export function getWarehouseAreasFlagOptions() { |
| | | export function getWarehouseAreasFlagOptions(t) { |
| | | return [ |
| | | { label: '否', value: 0 }, |
| | | { label: '是', value: 1 } |
| | | { label: t('common.status.no'), value: 0 }, |
| | | { label: t('common.status.yes'), value: 1 } |
| | | ] |
| | | } |
| | | |
| | |
| | | if (status === false || Number(status) === 0) { |
| | | return STATUS_META[0] |
| | | } |
| | | return { text: '未知', type: 'info', bool: false } |
| | | return { textKey: 'common.status.unknown', fallback: 'Unknown', type: 'info', bool: false } |
| | | } |
| | | |
| | | export function normalizeWarehouseAreasDetailRecord(record = {}) { |
| | | const statusMeta = getWarehouseAreasStatusMeta(record.statusBool ?? record.status) |
| | | const flagMinusValue = normalizeFlagValue(record.flagMinus$ ?? record.flagMinus) |
| | | const flagLabelManageValue = normalizeFlagValue(record.flagLabelMange$ ?? record.flagLabelMange) |
| | | const flagMixValue = normalizeFlagValue(record.flagMix$ ?? record.flagMix) |
| | | return { |
| | | ...record, |
| | | warehouseName: normalizeText(record.warehouseId$ || record.warehouseName || ''), |
| | |
| | | code: normalizeText(record.code || ''), |
| | | name: normalizeText(record.name || ''), |
| | | memo: normalizeText(record.memo || ''), |
| | | flagMinusText: normalizeFlagText(record.flagMinus$ ?? record.flagMinus), |
| | | flagLabelMangeText: normalizeFlagText(record.flagLabelMange$ ?? record.flagLabelMange), |
| | | flagMixText: normalizeFlagText(record.flagMix$ ?? record.flagMix), |
| | | statusText: statusMeta.text, |
| | | flagMinusText: normalizeText(record.flagMinus$ ?? record.flagMinus) || '-', |
| | | flagMinusTextKey: |
| | | flagMinusValue === null ? '' : flagMinusValue ? 'common.status.yes' : 'common.status.no', |
| | | flagLabelMangeText: normalizeText(record.flagLabelMange$ ?? record.flagLabelMange) || '-', |
| | | flagLabelMangeTextKey: |
| | | flagLabelManageValue === null ? '' : flagLabelManageValue ? 'common.status.yes' : 'common.status.no', |
| | | flagMixText: normalizeText(record.flagMix$ ?? record.flagMix) || '-', |
| | | flagMixTextKey: flagMixValue === null ? '' : flagMixValue ? 'common.status.yes' : 'common.status.no', |
| | | statusText: statusMeta.fallback, |
| | | statusTextKey: statusMeta.textKey, |
| | | statusType: statusMeta.type, |
| | | statusBool: record.statusBool !== void 0 ? Boolean(record.statusBool) : statusMeta.bool, |
| | | createByText: normalizeText(record.createBy$ || record.createByText || ''), |
| | |
| | | } |
| | | return records.map((record) => normalizeWarehouseAreasListRow(record)) |
| | | } |
| | | |