优化配送订单状态中文展示

This commit is contained in:
czl231
2026-08-15 18:36:38 +08:00
parent 38aee33700
commit 963e497bf3
5 changed files with 128 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
/**
* 功能:统一资源列表与详情页面的字段名称、关系、金额、状态和时间展示。
* 版本v1.3.0
* 版本v1.4.0
*/
import dayjs from 'dayjs';
import { staffRoleLabel } from './resource-staff-relation';
@@ -141,6 +141,24 @@ export function contractStatusLabel(status: number) {
);
}
/** 将配送订单业务状态转换为状态机约定的中文名称。 */
export function gasorderStatusLabel(status: number) {
return (
{
0: '草稿',
16: '已创建',
18: '已分配',
19: '充装中',
20: '已就绪',
21: '异常',
22: '已取消',
23: '已完成',
33: '配送中',
34: '待确认',
}[status] ?? `未知(${status}`
);
}
/** 选择关系记录的首选可读名称。 */
export function optionLabel(option: ResourceRow) {
return String(
@@ -227,10 +245,16 @@ function relationLabel(
export function displayRawValue(key: string, value: unknown) {
// 历史合同可能缺少到期时间,明确提示补录,避免将数据缺失误认为无期限合同。
if (key === 'expired_at' && (value == null || value === '')) return '待补录';
// 配送订单尚未分配时不存在工作人员标识,使用业务语义替代通用占位符。
if (key === 'staff_account_identity' && (value == null || value === ''))
return '暂未分配';
if (value == null || value === '') return '-';
if (typeof value === 'boolean') return value ? '是' : '否';
if (key === 'status') return recordStatusLabel(Number(value));
if (key === 'contract_status') return contractStatusLabel(Number(value));
if (key === 'previous_order_status' && Number(value) === 0) return '无';
if (['order_status', 'previous_order_status', 'from_status', 'to_status'].includes(key))
return gasorderStatusLabel(Number(value));
if (key === 'action') {
return (
{