优化运行轨迹关联名称展示

This commit is contained in:
czl231
2026-08-15 22:40:13 +08:00
parent a663821853
commit e82ae18fb9
6 changed files with 139 additions and 6 deletions

View File

@@ -100,6 +100,24 @@ const contracts: Record<string, ResourceDetailContract> = {
},
},
},
gasorder_track: {
leadingKeys: [
'gasorder_basic_identity', 'staff_account_identity', 'attempt_no',
'started_at', 'completed_at', 'identity', 'status',
],
relationResources: {
gasorder_basic_identity: '/gasorder_basic',
staff_account_identity: '/staff_account',
},
collections: {
points: {
columns: [
'occurred_at', 'received_at', 'longitude', 'latitude', 'accuracy',
'speed', 'direction', 'source', 'request_no',
],
},
},
},
payment_order: {
leadingKeys: [
'payment_no', 'payment_status', 'request_no', 'business_type',

View File

@@ -39,6 +39,7 @@ const aliases: Record<string, string> = {
creator_display_name: '创建方',
contract_display_name: '配送合同',
assigner_name: '分配人',
points: '轨迹点',
};
/** 聚合子表字段可能与全局同名字段具有不同业务语义,按父资源和集合名称覆盖。 */
@@ -85,6 +86,17 @@ const collectionFieldAliases: Record<string, Record<string, string>> = {
started_at: '开始时间',
completed_at: '完成时间',
},
'gasorder_track.points': {
request_no: '上报流水号',
longitude: '经度',
latitude: '纬度',
occurred_at: '定位时间',
received_at: '接收时间',
source: '定位来源',
accuracy: '定位精度',
speed: '行进速度',
direction: '行进方向',
},
'gasorder_basic.confirmations': {
confirmed_at: '确认时间',
confirm_type: '确认方式',
@@ -160,6 +172,8 @@ export function primaryRecord(detail: ResourceRow): ResourceRow {
return detail.order as ResourceRow;
if (detail.contract && typeof detail.contract === 'object')
return detail.contract as ResourceRow;
if (detail.track && typeof detail.track === 'object')
return detail.track as ResourceRow;
return detail;
}

View File

@@ -656,8 +656,22 @@ export const resources: ResourceUiDefinition[] = [
f('from_status'), f('to_status'), f('operator_name'), f('operator_identity'), f('occurred_at'), f('reason'),
]),
define('gasorder_track', '运行轨迹', 'readonly', [
relation('gasorder_basic_identity', '/gasorder_basic'),
relation('staff_account_identity', '/staff_account'),
relation('gasorder_basic_identity', '/gasorder_basic', false, {
label: '配送订单',
listLabel: '配送订单',
listRelationNameOnly: true,
displayRelationLabel: true,
showIdentityCopy: true,
}),
relation('staff_account_identity', '/staff_account', false, {
label: '配送人员',
listLabel: '配送人员',
listRelationNameOnly: true,
displayRelationLabel: true,
showIdentityCopy: true,
// 历史轨迹只限定岗位,不按当前启用、在岗或资质状态过滤。
staffRelation: { roles: ['delivery'] },
}),
f('attempt_no'), f('started_at'), f('completed_at'),
]),
define('gasorder_track_point', '轨迹点', 'readonly', [