统一平台资源中文展示并修复模拟订单状态
This commit is contained in:
157
frontend/platform_admin/src/api/resource-detail-contract.ts
Normal file
157
frontend/platform_admin/src/api/resource-detail-contract.ts
Normal file
@@ -0,0 +1,157 @@
|
||||
/**
|
||||
* 功能描述:声明平台资源详情的字段顺序、固定关联表列和 JSON 展示规则。
|
||||
* 版本:v1.0.0
|
||||
*/
|
||||
|
||||
export type ResourceCollectionContract = {
|
||||
columns: string[];
|
||||
jsonColumns?: string[];
|
||||
relationIdentityKeys?: Record<string, string>;
|
||||
};
|
||||
|
||||
export type ResourceDetailContract = {
|
||||
leadingKeys?: string[];
|
||||
hiddenKeys?: string[];
|
||||
relationResources?: Record<string, string>;
|
||||
collections?: Record<string, ResourceCollectionContract>;
|
||||
};
|
||||
|
||||
const contracts: Record<string, ResourceDetailContract> = {
|
||||
gasorder_contract: {
|
||||
leadingKeys: [
|
||||
'contract_no', 'contract_status', 'title', 'user_account_identity',
|
||||
'gas_basic_identity', 'delivery_basic_identity', 'identity',
|
||||
],
|
||||
collections: {
|
||||
products: {
|
||||
columns: [
|
||||
'bound_at', 'product_name', 'product_code', 'product_type_name',
|
||||
'product_params', 'unit_price', 'product_info_identity',
|
||||
'unbound_at', 'unbind_reason',
|
||||
],
|
||||
jsonColumns: ['product_params'],
|
||||
},
|
||||
revisions: {
|
||||
columns: [
|
||||
'occurred_at', 'action', 'contract_status', 'effective_at',
|
||||
'expired_at', 'operator_name', 'operator_identity', 'reason',
|
||||
],
|
||||
relationIdentityKeys: { operator_name: 'operator_identity' },
|
||||
},
|
||||
},
|
||||
},
|
||||
gasorder_basic: {
|
||||
leadingKeys: [
|
||||
'order_no', 'request_no', 'order_status', 'gasorder_contract_identity',
|
||||
'creator_type', 'creator_identity', 'user_account_identity',
|
||||
'gas_basic_identity', 'delivery_basic_identity',
|
||||
'staff_account_identity', 'identity', 'status',
|
||||
],
|
||||
hiddenKeys: ['operator_name'],
|
||||
relationResources: {
|
||||
gasorder_contract_identity: '/gasorder_contract',
|
||||
user_account_identity: '/user_account',
|
||||
gas_basic_identity: '/gas_basic',
|
||||
delivery_basic_identity: '/delivery_basic',
|
||||
staff_account_identity: '/staff_account',
|
||||
},
|
||||
collections: {
|
||||
items: {
|
||||
columns: [
|
||||
'product_name', 'product_code', 'product_type_name',
|
||||
'product_params', 'unit_price',
|
||||
],
|
||||
jsonColumns: ['product_params'],
|
||||
},
|
||||
assignments: {
|
||||
columns: [
|
||||
'assigned_at', 'gas_basic_display_name',
|
||||
'delivery_basic_display_name', 'staff_account_display_name',
|
||||
'assigner_name', 'reason',
|
||||
],
|
||||
relationIdentityKeys: {
|
||||
gas_basic_display_name: 'gas_basic_identity',
|
||||
delivery_basic_display_name: 'delivery_basic_identity',
|
||||
staff_account_display_name: 'staff_account_identity',
|
||||
assigner_name: 'assigner_identity',
|
||||
},
|
||||
},
|
||||
statuses: {
|
||||
columns: ['occurred_at', 'from_status', 'to_status', 'operator_name', 'reason'],
|
||||
relationIdentityKeys: { operator_name: 'operator_identity' },
|
||||
},
|
||||
tracks: {
|
||||
columns: [
|
||||
'attempt_no', 'staff_account_display_name',
|
||||
'staff_account_identity', 'started_at', 'completed_at',
|
||||
],
|
||||
relationIdentityKeys: {
|
||||
staff_account_display_name: 'staff_account_identity',
|
||||
},
|
||||
},
|
||||
confirmations: {
|
||||
columns: [
|
||||
'confirmed_at', 'confirm_type', 'recipient_name', 'recipient_phone',
|
||||
'proof_uri', 'remark',
|
||||
],
|
||||
},
|
||||
payments: {
|
||||
columns: ['attempt_no', 'payment_no', 'payment_order_identity', 'amount', 'payment_status'],
|
||||
},
|
||||
},
|
||||
},
|
||||
payment_order: {
|
||||
leadingKeys: [
|
||||
'payment_no', 'payment_status', 'request_no', 'business_type',
|
||||
'business_identity', 'user_identity', 'amount', 'identity',
|
||||
],
|
||||
},
|
||||
wallet_record: {
|
||||
leadingKeys: [
|
||||
'record_no', 'request_no', 'direction', 'trade_type', 'amount',
|
||||
'wallet_basic_identity', 'identity',
|
||||
],
|
||||
},
|
||||
ec_order: {
|
||||
leadingKeys: [
|
||||
'order_no', 'order_status', 'request_no', 'user_account_identity',
|
||||
'payable_amount', 'total_amount', 'identity',
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const jsonFieldKeys = new Set([
|
||||
'params', 'product_params', 'product_snapshot', 'args', 'callback_msg',
|
||||
]);
|
||||
|
||||
/** 返回资源专属详情契约;没有专属规则时使用空契约。 */
|
||||
export function resourceDetailContract(name: string): ResourceDetailContract {
|
||||
return contracts[name] ?? {};
|
||||
}
|
||||
|
||||
/** 判断主详情字段是否应使用完整 JSON 查看器,内容不做脱敏或改写。 */
|
||||
export function isResourceJsonField(key: string) {
|
||||
return jsonFieldKeys.has(key);
|
||||
}
|
||||
|
||||
/** 返回集合字段对应的稳定唯一标识字段。 */
|
||||
export function collectionRelationIdentityKey(
|
||||
resourceName: string,
|
||||
collectionKey: string,
|
||||
column: string,
|
||||
) {
|
||||
return contracts[resourceName]?.collections?.[collectionKey]
|
||||
?.relationIdentityKeys?.[column] ?? '';
|
||||
}
|
||||
|
||||
/** 判断集合字段是否应使用完整 JSON 查看器。 */
|
||||
export function isCollectionJsonField(
|
||||
resourceName: string,
|
||||
collectionKey: string,
|
||||
column: string,
|
||||
) {
|
||||
return Boolean(
|
||||
contracts[resourceName]?.collections?.[collectionKey]
|
||||
?.jsonColumns?.includes(column),
|
||||
);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* 功能:统一资源列表与详情页面的字段名称、关系、金额、状态和时间展示。
|
||||
* 版本:v1.5.0
|
||||
* 版本:v1.6.0
|
||||
*/
|
||||
import dayjs from 'dayjs';
|
||||
import type { RecordPageMode, ResourceRow } from './resource-page-rules';
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
} from './resources';
|
||||
|
||||
const aliases: Record<string, string> = {
|
||||
identity: '唯一标识',
|
||||
identity: '系统唯一标识',
|
||||
id: 'ID',
|
||||
created_at: '创建时间',
|
||||
updated_at: '更新时间',
|
||||
@@ -32,6 +32,13 @@ const aliases: Record<string, string> = {
|
||||
contract: '合同',
|
||||
wallet: '钱包',
|
||||
is_system: '系统内置',
|
||||
gas_basic_display_name: '气站',
|
||||
delivery_basic_display_name: '配送点',
|
||||
staff_account_display_name: '工作人员',
|
||||
user_account_display_name: '用户',
|
||||
creator_display_name: '创建方',
|
||||
contract_display_name: '配送合同',
|
||||
assigner_name: '分配人',
|
||||
};
|
||||
|
||||
/** 聚合子表字段可能与全局同名字段具有不同业务语义,按父资源和集合名称覆盖。 */
|
||||
@@ -71,6 +78,38 @@ const collectionFieldAliases: Record<string, Record<string, string>> = {
|
||||
operator_name: '操作人',
|
||||
reason: '原因',
|
||||
},
|
||||
'gasorder_basic.tracks': {
|
||||
attempt_no: '配送尝试次数',
|
||||
staff_account_display_name: '配送人员',
|
||||
staff_account_identity: '配送人员唯一标识',
|
||||
started_at: '开始时间',
|
||||
completed_at: '完成时间',
|
||||
},
|
||||
'gasorder_basic.confirmations': {
|
||||
confirmed_at: '确认时间',
|
||||
confirm_type: '确认方式',
|
||||
recipient_name: '签收人姓名',
|
||||
recipient_phone: '签收人电话',
|
||||
proof_uri: '凭证地址',
|
||||
remark: '备注',
|
||||
},
|
||||
'gasorder_basic.payments': {
|
||||
attempt_no: '支付尝试次数',
|
||||
payment_no: '支付单号',
|
||||
payment_order_identity: '支付记录唯一标识',
|
||||
amount: '支付金额(元)',
|
||||
payment_status: '支付状态',
|
||||
},
|
||||
'gasorder_contract.revisions': {
|
||||
occurred_at: '发生时间',
|
||||
action: '合同动作',
|
||||
contract_status: '合同状态',
|
||||
effective_at: '生效时间',
|
||||
expired_at: '到期时间',
|
||||
operator_name: '操作人',
|
||||
operator_identity: '操作人唯一标识',
|
||||
reason: '变更原因',
|
||||
},
|
||||
};
|
||||
|
||||
/** 主资源详情中的关联标识使用业务名称,技术标识仅作为辅助复制信息。 */
|
||||
@@ -145,6 +184,15 @@ export function resourceFieldLabel(
|
||||
);
|
||||
}
|
||||
|
||||
/** 判断字段是否具有显式中文契约,未知响应键不得直接回显英文。 */
|
||||
export function hasResourceFieldLabel(
|
||||
definition: ResourceUiDefinition,
|
||||
key: string,
|
||||
collectionKey = '',
|
||||
) {
|
||||
return resourceFieldLabel(definition, key, collectionKey) !== key;
|
||||
}
|
||||
|
||||
/** 将标准实体状态转换为稳定的中文展示。 */
|
||||
export function recordStatusLabel(status: number) {
|
||||
return (
|
||||
@@ -257,11 +305,13 @@ function relationLabel(
|
||||
field: ResourceField,
|
||||
identity: string,
|
||||
relationOptions: Record<string, ResourceRow[]>,
|
||||
row: ResourceRow,
|
||||
) {
|
||||
const match = (relationOptions[field.relation ?? ''] ?? []).find(
|
||||
const resource = fieldRelationResource(field, row);
|
||||
const match = (relationOptions[resource] ?? []).find(
|
||||
(option) => String(option.identity) === identity,
|
||||
);
|
||||
if (!match) return identity;
|
||||
if (!match) return '名称加载失败';
|
||||
if (field.relation === '/staff_account') {
|
||||
return relationOptionLabel(
|
||||
field,
|
||||
@@ -269,9 +319,15 @@ function relationLabel(
|
||||
relationOptions[field.relation ?? ''] ?? [],
|
||||
);
|
||||
}
|
||||
return field.displayRelationLabel
|
||||
? optionLabel(match)
|
||||
: `${optionLabel(match)} · ${identity}`;
|
||||
return optionLabel(match);
|
||||
}
|
||||
|
||||
/** 根据当前记录的主体类型解析静态或动态关系资源。 */
|
||||
export function fieldRelationResource(field: ResourceField, row: ResourceRow) {
|
||||
if (field.relation) return field.relation;
|
||||
if (!field.dynamicRelation) return '';
|
||||
const parentValue = String(row[field.dynamicRelation.parentKey] ?? '');
|
||||
return field.dynamicRelation.resources[parentValue] ?? '';
|
||||
}
|
||||
|
||||
/** 格式化不依赖字段定义的通用值。 */
|
||||
@@ -305,6 +361,77 @@ export function displayRawValue(key: string, value: unknown) {
|
||||
}[String(value)] ?? `未知动作(${String(value)})`
|
||||
);
|
||||
}
|
||||
if (key === 'payment_status') {
|
||||
return (
|
||||
{
|
||||
10: '待支付',
|
||||
20: '确认中',
|
||||
23: '支付成功',
|
||||
30: '已关闭',
|
||||
40: '支付失败',
|
||||
50: '支付异常',
|
||||
}[Number(value)] ?? `未知支付状态(${String(value)})`
|
||||
);
|
||||
}
|
||||
if (key === 'logistics_status') {
|
||||
return (
|
||||
{ 10: '待发货', 20: '已发货', 30: '已收货' }[Number(value)] ??
|
||||
`未知物流状态(${String(value)})`
|
||||
);
|
||||
}
|
||||
if (key === 'confirm_type') {
|
||||
return (
|
||||
{ signature: '签名确认', receipt_code: '收货码确认' }[String(value)] ??
|
||||
`未知确认方式(${String(value)})`
|
||||
);
|
||||
}
|
||||
if (key === 'source') {
|
||||
return (
|
||||
{ gps: 'GPS定位', network: '网络定位', manual: '人工上报' }[
|
||||
String(value)
|
||||
] ?? `未知定位来源(${String(value)})`
|
||||
);
|
||||
}
|
||||
if (key === 'owner_type' || key === 'subject_type') {
|
||||
return (
|
||||
{
|
||||
user: '用户',
|
||||
staff: '工作人员',
|
||||
gas: '气站',
|
||||
delivery: '配送点',
|
||||
platform: '平台',
|
||||
}[String(value)] ?? `未知主体类型(${String(value)})`
|
||||
);
|
||||
}
|
||||
if (key === 'business_type') {
|
||||
return (
|
||||
{
|
||||
gasorder: '气体配送订单',
|
||||
ec_order: '商城订单',
|
||||
recharge: '钱包充值',
|
||||
}[String(value)] ?? `未知业务类型(${String(value)})`
|
||||
);
|
||||
}
|
||||
if (key === 'direction') {
|
||||
return (
|
||||
{ income: '收入', expense: '支出' }[String(value)] ??
|
||||
`未知收支方向(${String(value)})`
|
||||
);
|
||||
}
|
||||
if (key.endsWith('_status')) {
|
||||
return (
|
||||
{
|
||||
10: '待处理', 11: '生效中', 12: '已过期', 13: '已终止',
|
||||
14: '已记录', 15: '已绑定', 16: '已创建', 17: '已下单',
|
||||
18: '已分配', 19: '充装中', 20: '已就绪', 21: '异常',
|
||||
22: '已取消', 23: '已完成', 24: '已入账', 25: '已通过',
|
||||
26: '已驳回', 27: '已报废', 28: '在库', 29: '运输中',
|
||||
30: '使用中', 31: '维修中', 32: '待受理', 33: '配送中',
|
||||
34: '待确认', 35: '已支付', 36: '已发布', 37: '成功',
|
||||
38: '已匹配',
|
||||
}[Number(value)] ?? `未知状态(${String(value)})`
|
||||
);
|
||||
}
|
||||
if (
|
||||
amountKeys.has(key) ||
|
||||
key.endsWith('_amount') ||
|
||||
@@ -363,11 +490,11 @@ export function displayResourceField(
|
||||
: String(value);
|
||||
}
|
||||
if (field.type === 'identity' && typeof value === 'string') {
|
||||
return relationLabel(field, value, relationOptions);
|
||||
return relationLabel(field, value, relationOptions, row);
|
||||
}
|
||||
if (field.type === 'identity-list' && Array.isArray(value)) {
|
||||
return value
|
||||
.map((item) => relationLabel(field, String(item), relationOptions))
|
||||
.map((item) => relationLabel(field, String(item), relationOptions, row))
|
||||
.join('、');
|
||||
}
|
||||
return displayRawValue(field.key, value);
|
||||
|
||||
@@ -302,14 +302,43 @@ const fieldLabels: Record<string, string> = {
|
||||
description: '说明',
|
||||
ec_category_identity: '商品分类唯一标识',
|
||||
ec_product_identity: '商品唯一标识',
|
||||
ec_order_identity: '商城订单唯一标识',
|
||||
gas_basic_identity: '气站唯一标识',
|
||||
gasorder_basic_identity: '配送订单唯一标识',
|
||||
gasorder_contract_identity: '配送合同唯一标识',
|
||||
gasorder_contract_product_identity: '合同气瓶唯一标识',
|
||||
gasorder_contract_product_identities: '合同气瓶唯一标识',
|
||||
producer_account_identity: '生产商唯一标识',
|
||||
product_info_identity: '智能气阀唯一标识',
|
||||
product_type_identity: '智能气阀类型唯一标识',
|
||||
proof_uri: '凭证地址',
|
||||
active: '是否有效',
|
||||
assigner_identity: '分配人唯一标识',
|
||||
assigner_name: '分配人',
|
||||
source: '定位来源',
|
||||
accuracy: '定位精度',
|
||||
speed: '定位速度',
|
||||
received_at: '接收时间',
|
||||
merchant_identity: '商户唯一标识',
|
||||
channel_trade_no: '渠道交易号',
|
||||
subject: '支付标题',
|
||||
failure_code: '失败代码',
|
||||
failure_message: '失败原因',
|
||||
expires_at: '支付过期时间',
|
||||
closed_at: '关闭时间',
|
||||
bind_id: '渠道绑定标识',
|
||||
bank_type: '银行卡类型',
|
||||
bank: '银行编码',
|
||||
in_trade_no: '内部业务流水号',
|
||||
out_trade_no: '外部渠道流水号',
|
||||
logistics_no: '物流单号',
|
||||
logistics_company: '物流公司',
|
||||
logistics_status: '物流状态',
|
||||
shipped_at: '发货时间',
|
||||
gasorder_track_identity: '配送轨迹唯一标识',
|
||||
payment_order_identity: '支付记录唯一标识',
|
||||
related_record_identity: '关联流水唯一标识',
|
||||
icon_name: '图标',
|
||||
recipient_name: '签收人姓名',
|
||||
recipient_phone: '签收人电话',
|
||||
staff_account_identity: '工作人员唯一标识',
|
||||
@@ -343,6 +372,7 @@ const datetimes = new Set([
|
||||
'expired_at', 'produced_at', 'enabled_at', 'started_at', 'completed_at',
|
||||
'occurred_at', 'reviewed_at', 'signed_at', 'effective_at', 'unbound_at',
|
||||
'assigned_at', 'confirmed_at', 'paid_at', 'period_start', 'period_end',
|
||||
'received_at', 'expires_at', 'closed_at', 'shipped_at',
|
||||
]);
|
||||
const textareas = new Set([
|
||||
'params', 'content', 'remark', 'reason', 'terms', 'args', 'callback_msg',
|
||||
@@ -518,7 +548,14 @@ export const resources: ResourceUiDefinition[] = [
|
||||
{ name: '变更智能气阀归属', resource: '/product_info/:identity', method: 'PUT', fields: [relation('warehouse_identity', '/product_warehouse'), relation('gas_basic_identity', '/gas_basic'), relation('delivery_basic_identity', '/delivery_basic'), relation('user_account_identity', '/user_account'), f('action', { required: true, type: 'select', options: [{ label: '入库', value: 'warehouse' }, { label: '分配', value: 'assigned' }, { label: '归还', value: 'returned' }, { label: '人工调整', value: 'manual' }] }), f('reason', { required: true }), f('remark')] },
|
||||
]),
|
||||
define('product_repair', '智能气阀检修记录', 'editable', [relation('product_info_identity', '/product_info', true), f('repair_no', { required: true }), f('repair_type', { required: true }), f('started_at', { required: true }), f('completed_at'), f('result', { type: 'select', options: resourceSearchEnumOptions('product_repair', 'result') }), f('target_product_status', { type: 'select', options: [{ label: '在库', value: 28 }, { label: '运输中', value: 29 }, { label: '使用中', value: 30 }, { label: '报废', value: 27 }] }), f('content'), f('operator'), f('remark')]),
|
||||
define('product_owner', '智能气阀归属记录', 'readonly', []),
|
||||
define('product_owner', '智能气阀归属记录', 'readonly', [
|
||||
relation('product_info_identity', '/product_info'),
|
||||
relation('warehouse_identity', '/product_warehouse'),
|
||||
relation('gas_basic_identity', '/gas_basic'),
|
||||
relation('delivery_basic_identity', '/delivery_basic'),
|
||||
relation('user_account_identity', '/user_account'),
|
||||
f('action'), f('occurred_at'), f('operator_name'), f('operator_identity'), f('reason'), f('remark'),
|
||||
]),
|
||||
|
||||
define('gasorder_contract', '配送合同', 'managed', [
|
||||
f('contract_no', { required: true, listCopyable: true }),
|
||||
@@ -565,7 +602,11 @@ export const resources: ResourceUiDefinition[] = [
|
||||
}), f('unit_price')], 'list', [
|
||||
{ name: '解绑气瓶', resource: '/gasorder_contract_product/:identity/unbind', danger: true, fields: reason },
|
||||
]),
|
||||
define('gasorder_contract_revision', '合同修订记录', 'readonly', []),
|
||||
define('gasorder_contract_revision', '合同修订记录', 'readonly', [
|
||||
relation('gasorder_contract_identity', '/gasorder_contract'),
|
||||
f('action'), f('contract_status'), f('effective_at'), f('expired_at'),
|
||||
f('operator_name'), f('operator_identity'), f('occurred_at'), f('reason'),
|
||||
]),
|
||||
define('gasorder_basic', '气体配送订单', 'append_only', [f('request_no', { required: true }), relation('gasorder_contract_identity', '/gasorder_contract', true, { label: '配送合同', listDisplayKey: 'contract_display_name', detailDisplayKey: 'contract_display_name', listDisplayIdentityCopy: true, showIdentityCopy: true, placeholder: '请选择当前可履约的生效合同', relationFilters: { candidate: 'order' }, relationStrictFilter: true, relationInvalidMessage: '所选配送合同已不可履约,已清空,请重新选择', relationEmptyText: '暂无可下单的生效合同,请先启用或续签配送合同' }), f('creator_type', { required: true, type: 'select', options: resourceSearchEnumOptions('gasorder_basic', 'creator_type') }), f('creator_identity', { label: '创建方', required: true, listDisplayKey: 'creator_display_name', listDisplayIdentityCopy: true, placeholder: '请先选择配送合同和创建方类型', readonlyRelationText: true, relationFilters: { status: '1' }, relationEmptyText: '当前合同下暂无可用的创建方', dynamicRelation: {
|
||||
parentKey: 'creator_type', parentLabel: '创建方类型', contextParentKey: 'gasorder_contract_identity',
|
||||
resources: { user: '/user_account', staff: '/staff_account', delivery: '/delivery_basic', gas: '/gas_basic' },
|
||||
@@ -587,7 +628,7 @@ export const resources: ResourceUiDefinition[] = [
|
||||
parentChangeMessage: '配送合同已变更,请重新选择该合同用户的收货地址',
|
||||
},
|
||||
}), f('gasorder_contract_product_identities', { label: '合同气瓶', required: true, type: 'identity-list', listDisplayKey: 'contract_products_summary', listDetailLink: true, emptyText: '未填写', relation: '/gasorder_contract_product', placeholder: '请输入智能气阀名称、设备类型或设备编码搜索', relationOptionDisplay: 'product-name-type', relationEmptyText: '该合同暂无可用气瓶,请先为合同绑定气瓶', relationLinkage: { parentKey: 'gasorder_contract_identity', optionParentKey: '', filterKey: 'contract_identity', filterOnly: true, requiresParent: true, parentChangeMessage: '配送合同已变更,请重新选择该合同可用的气瓶' } }), f('contact_name', { required: true }), f('contact_phone', { required: true }), f('discount_amount'), f('remark')], 'list', [
|
||||
{ name: '分配订单', resource: '/gasorder_basic/:identity/assign', fields: [relation('delivery_basic_identity', '/delivery_basic', true, { label: '配送点', placeholder: '请选择合同履约范围内的配送点', relationFilters: { status: '1' } }), relation('staff_account_identity', '/staff_account', true, { label: '配送人员', placeholder: '请先选择配送点', relationEmptyText: '该配送点暂无在岗且资质有效的配送人员', staffRelation: { roles: ['delivery'], enabledOnly: true, workStatus: 'on_duty', validCredentialOnly: true } }), ...reason], visibleFor: { field: 'order_status', values: [16, 18] } },
|
||||
{ name: '分配订单', resource: '/gasorder_basic/:identity/assign', fields: [relation('delivery_basic_identity', '/delivery_basic', true, { label: '配送点', placeholder: '请选择合同履约范围内的配送点', relationFilters: { status: '1' } }), relation('staff_account_identity', '/staff_account', true, { label: '配送人员', placeholder: '请选择当前配送点内的配送人员', relationEmptyText: '该配送点暂无在岗且资质有效的配送人员', staffRelation: { roles: ['delivery'], enabledOnly: true, workStatus: 'on_duty', validCredentialOnly: true } }), ...reason], visibleFor: { field: 'order_status', values: [16, 18] } },
|
||||
{ name: '开始罐装', resource: '/gasorder_basic/:identity/filling', fields: reason, visibleFor: { field: 'order_status', values: [18] } },
|
||||
{ name: '待配送', resource: '/gasorder_basic/:identity/ready', fields: reason, visibleFor: { field: 'order_status', values: [19] } },
|
||||
{ name: '开始配送', resource: '/gasorder_basic/:identity/delivering', fields: reason, visibleFor: { field: 'order_status', values: [20] } },
|
||||
@@ -597,34 +638,109 @@ export const resources: ResourceUiDefinition[] = [
|
||||
{ name: '恢复订单', resource: '/gasorder_basic/:identity/recover', fields: reason, visibleFor: { field: 'order_status', values: [21] } },
|
||||
{ name: '取消订单', resource: '/gasorder_basic/:identity/cancel', danger: true, fields: reason, visibleFor: { field: 'order_status', values: [16, 18] } },
|
||||
]),
|
||||
define('gasorder_item', '订单明细', 'readonly', []),
|
||||
define('gasorder_assign', '分配记录', 'readonly', []),
|
||||
define('gasorder_status', '状态记录', 'readonly', []),
|
||||
define('gasorder_track', '运行轨迹', 'readonly', []),
|
||||
define('gasorder_track_point', '轨迹点', 'readonly', []),
|
||||
define('gasorder_confirm', '确认记录', 'readonly', []),
|
||||
define('gasorder_payment', '支付记录', 'readonly', []),
|
||||
define('gasorder_item', '订单明细', 'readonly', [
|
||||
relation('gasorder_basic_identity', '/gasorder_basic'),
|
||||
relation('gasorder_contract_product_identity', '/gasorder_contract_product'),
|
||||
relation('product_info_identity', '/product_info'),
|
||||
f('product_code'), f('product_type_name'), f('product_params'), f('unit_price'), f('active'),
|
||||
]),
|
||||
define('gasorder_assign', '分配记录', 'readonly', [
|
||||
relation('gasorder_basic_identity', '/gasorder_basic'),
|
||||
relation('gas_basic_identity', '/gas_basic'),
|
||||
relation('delivery_basic_identity', '/delivery_basic'),
|
||||
relation('staff_account_identity', '/staff_account'),
|
||||
f('assigner_name'), f('assigner_identity'), f('assigned_at'), f('reason'),
|
||||
]),
|
||||
define('gasorder_status', '状态记录', 'readonly', [
|
||||
relation('gasorder_basic_identity', '/gasorder_basic'),
|
||||
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'),
|
||||
f('attempt_no'), f('started_at'), f('completed_at'),
|
||||
]),
|
||||
define('gasorder_track_point', '轨迹点', 'readonly', [
|
||||
relation('gasorder_track_identity', '/gasorder_track'),
|
||||
f('request_no'), f('longitude'), f('latitude'), f('occurred_at'), f('received_at'),
|
||||
f('source'), f('accuracy'), f('speed'), f('direction'),
|
||||
]),
|
||||
define('gasorder_confirm', '确认记录', 'readonly', [
|
||||
relation('gasorder_basic_identity', '/gasorder_basic'),
|
||||
f('request_no'), f('confirm_type'), f('recipient_name'), f('recipient_phone'),
|
||||
f('proof_uri'), f('confirmed_at'), f('remark'),
|
||||
]),
|
||||
define('gasorder_payment', '支付记录', 'readonly', [
|
||||
relation('gasorder_basic_identity', '/gasorder_basic'),
|
||||
relation('payment_order_identity', '/payment_order'),
|
||||
f('attempt_no'), f('amount'),
|
||||
]),
|
||||
|
||||
define('ec_category', '商品分类', 'writable', [relation('parent_identity', '/ec_category'), f('name', { required: true }), f('sort_no')], 'tree'),
|
||||
define('ec_product', '商品', 'writable', [relation('ec_category_identity', '/ec_category', true), f('product_code', { required: true }), f('name', { required: true }), f('price_amount', { required: true }), f('stock_quantity')]),
|
||||
define('ec_product_attribute', '商品属性', 'writable', [relation('ec_product_identity', '/ec_product', true), f('name', { required: true }), f('value', { required: true }), f('sort_no')]),
|
||||
define('ec_product_image', '商品图片', 'writable', [relation('ec_product_identity', '/ec_product', true), f('image_uri', { required: true }), f('sort_no'), f('is_cover')]),
|
||||
define('ec_cart', '购物车', 'readonly', []),
|
||||
define('ec_order', '商城订单', 'readonly', []),
|
||||
define('ec_order_item', '商城订单明细', 'readonly', []),
|
||||
define('ec_review', '商品评价', 'readonly', []),
|
||||
define('ec_cart', '购物车', 'readonly', [
|
||||
relation('user_account_identity', '/user_account'), relation('ec_product_identity', '/ec_product'),
|
||||
f('quantity'), f('selected'),
|
||||
]),
|
||||
define('ec_order', '商城订单', 'readonly', [
|
||||
f('order_no'), f('request_no'), f('order_status', { type: 'select', options: [
|
||||
{ label: '待支付', value: 16 },
|
||||
{ label: '已支付', value: 18 },
|
||||
{ label: '已取消', value: 22 },
|
||||
], unknownValueLabel: '未知订单状态' }),
|
||||
relation('user_account_identity', '/user_account'), relation('gas_basic_identity', '/gas_basic'),
|
||||
relation('delivery_basic_identity', '/delivery_basic'), relation('user_address_identity', '/user_address'),
|
||||
f('contact_name'), f('contact_phone'), f('product_amount'), f('discount_amount'), f('payable_amount'),
|
||||
f('total_amount'), f('paid_at'), f('logistics_no'), f('logistics_company'), f('logistics_status'),
|
||||
f('shipped_at'), f('received_at'), f('remark'),
|
||||
]),
|
||||
define('ec_order_item', '商城订单明细', 'readonly', [
|
||||
relation('ec_order_identity', '/ec_order'), relation('ec_product_identity', '/ec_product'),
|
||||
f('product_snapshot'), f('quantity'), f('sale_amount'),
|
||||
]),
|
||||
define('ec_review', '商品评价', 'readonly', [
|
||||
relation('ec_order_identity', '/ec_order'), relation('ec_product_identity', '/ec_product'),
|
||||
relation('user_account_identity', '/user_account'), f('score'), f('content'),
|
||||
]),
|
||||
|
||||
define('wallet_basic', '钱包', 'readonly', [f('owner_type'), f('owner_identity'), f('alipay_id'), f('alipay_name'), f('wxpay_id'), f('wxpay_name'), f('balance'), f('withdrawal_balance')], 'list', [
|
||||
define('wallet_basic', '钱包', 'readonly', [f('owner_type'), f('owner_identity', {
|
||||
type: 'identity', label: '归属主体', listRelationNameOnly: true,
|
||||
displayRelationLabel: true, showIdentityCopy: true,
|
||||
dynamicRelation: {
|
||||
parentKey: 'owner_type', parentLabel: '归属类型',
|
||||
resources: { user: '/user_account', staff: '/staff_account', gas: '/gas_basic', delivery: '/delivery_basic' },
|
||||
},
|
||||
}), f('alipay_id'), f('alipay_name'), f('wxpay_id'), f('wxpay_name'), f('balance'), f('withdrawal_balance')], 'list', [
|
||||
{ name: '后台充值', resource: '/wallet_basic/:identity/recharge', fields: [f('request_no', { required: true }), f('amount', { required: true }), f('withdrawable'), ...reason, f('remark')] },
|
||||
{ name: '修改钱包状态', resource: '/wallet_basic/:identity/status', method: 'PATCH', fields: [f('status', { required: true, type: 'select', options: [{ label: '启用', value: 1 }, { label: '停用', value: 2 }, { label: '冻结', value: 4 }] })] },
|
||||
]),
|
||||
define('wallet_bank', '银行卡', 'readonly', []),
|
||||
define('payment_order', '钱包支付记录', 'readonly', []),
|
||||
define('wallet_record', '钱包流水', 'readonly', []),
|
||||
define('wallet_bank', '银行卡', 'readonly', [
|
||||
relation('wallet_basic_identity', '/wallet_basic'), f('bank_name'), f('card_owner'),
|
||||
f('card_no_last4'), f('bind_id'), f('bank_type'), f('bank'),
|
||||
]),
|
||||
define('payment_order', '钱包支付记录', 'readonly', [
|
||||
f('payment_no'), f('request_no'), f('payment_status'), f('business_type'),
|
||||
f('business_identity', { type: 'identity', label: '业务对象', listRelationNameOnly: true, displayRelationLabel: true, showIdentityCopy: true, dynamicRelation: {
|
||||
parentKey: 'business_type', parentLabel: '业务类型', resources: { gasorder: '/gasorder_basic', ec_order: '/ec_order' },
|
||||
} }), relation('user_identity', '/user_account'), f('merchant_identity'), f('channel'), f('pay_type'),
|
||||
f('channel_trade_no'), f('amount'), f('subject'), f('failure_code'), f('failure_message'),
|
||||
f('expires_at'), f('paid_at'), f('closed_at'),
|
||||
]),
|
||||
define('wallet_record', '钱包流水', 'readonly', [
|
||||
relation('wallet_basic_identity', '/wallet_basic'), f('record_no'), f('request_no'),
|
||||
f('direction'), f('trade_type'), f('amount'), f('fee'), f('balance_after'),
|
||||
f('withdrawal_balance_after'), f('in_trade_no'), f('out_trade_no'), f('pay_channel'),
|
||||
f('pay_type'), relation('related_record_identity', '/wallet_record'), f('operator_name'),
|
||||
f('operator_identity'), f('ymd'), f('ym'), f('remark'),
|
||||
]),
|
||||
define('payment_refund', '退款审核', 'readonly', [
|
||||
f('refund_no'), f('business_type'), f('business_identity'), f('user_identity'),
|
||||
f('refund_no'), f('business_type'), f('business_identity', { type: 'identity', label: '业务对象', listRelationNameOnly: true, displayRelationLabel: true, showIdentityCopy: true, dynamicRelation: {
|
||||
parentKey: 'business_type', parentLabel: '业务类型', resources: { gasorder: '/gasorder_basic', ec_order: '/ec_order' },
|
||||
} }), relation('user_identity', '/user_account'),
|
||||
f('amount'), f('reason'), f('description'), f('refund_status'),
|
||||
f('reviewer_identity'), f('review_remark'), f('reviewed_at'), f('completed_at'),
|
||||
relation('reviewer_identity', '/platform_account'), f('review_remark'), f('reviewed_at'), f('completed_at'),
|
||||
], 'list', [
|
||||
{ name: '审核通过并退入钱包', resource: '/payment_refund/:identity/approve', fields: [f('remark')], visibleFor: { field: 'refund_status', values: [10] } },
|
||||
{ name: '驳回退款', resource: '/payment_refund/:identity/reject', danger: true, fields: [f('remark', { required: true })], visibleFor: { field: 'refund_status', values: [10] } },
|
||||
@@ -652,16 +768,30 @@ export const resources: ResourceUiDefinition[] = [
|
||||
{ name: '标记处理完成', resource: '/wallet_apply_cash/:identity/complete', fields: [f('trade_no', { required: true }), f('callback_msg')], visibleFor: { field: 'apply_status', values: [25] } },
|
||||
]),
|
||||
|
||||
define('fin_payment', '财务支付记录', 'readonly', []),
|
||||
define('fin_settlement', '财务结算', 'writable', [f('settlement_no', { required: true }), f('subject_type', { required: true }), f('subject_identity', { required: true }), f('period_start', { required: true }), f('period_end', { required: true })]),
|
||||
define('fin_reconciliation', '财务对账', 'readonly', []),
|
||||
define('fin_payment', '财务支付记录', 'readonly', [
|
||||
relation('ec_order_identity', '/ec_order'), f('payment_status'), f('channel'), f('amount'), f('paid_at'),
|
||||
]),
|
||||
define('fin_settlement', '财务结算', 'writable', [f('settlement_no', { required: true }), f('subject_type', { required: true }), f('subject_identity', {
|
||||
required: true, type: 'identity', label: '结算主体', listRelationNameOnly: true,
|
||||
displayRelationLabel: true, showIdentityCopy: true,
|
||||
dynamicRelation: {
|
||||
parentKey: 'subject_type', parentLabel: '结算主体类型',
|
||||
resources: { gas: '/gas_basic', delivery: '/delivery_basic' },
|
||||
},
|
||||
}), f('period_start', { required: true }), f('period_end', { required: true })]),
|
||||
define('fin_reconciliation', '财务对账', 'readonly', [
|
||||
f('reconciliation_status'), f('channel'), f('bill_date'), f('difference_amount'),
|
||||
]),
|
||||
define('cms_content', '内容', 'writable', [f('content_type', { required: true }), f('title', { required: true }), f('body', { required: true }), f('version_no'), f('publish_status')]),
|
||||
define('cs_ticket', '客服工单', 'writable', [relation('user_account_identity', '/user_account', true), f('ticket_no', { required: true }), f('category', { required: true }), f('priority', { required: true })]),
|
||||
define('platform_account', '平台账户', 'writable', [f('username', { required: true }), f('password', { required: true }), f('display_name'), f('avatar'), f('platform_role_code', { required: true, unknownValueLabel: '未知角色' }), f('phone')]),
|
||||
define('platform_role', '平台角色', 'writable', [f('role_code', { required: true }), f('name', { required: true }), f('location_scope', { required: true, type: 'select', options: resourceSearchEnumOptions('platform_role', 'location_scope') })], 'list', [
|
||||
{ name: '分配菜单', resource: '/platform_role/:identity/menu', method: 'PUT', fields: [f('menu_identities', { type: 'identity-list', relation: '/platform_menu' })] },
|
||||
]),
|
||||
define('platform_menu', '平台菜单', 'readonly', [], 'tree'),
|
||||
define('platform_menu', '平台菜单', 'readonly', [
|
||||
relation('parent_identity', '/platform_menu'), f('group_code'), f('name'), f('icon'),
|
||||
f('path'), f('sort_no'),
|
||||
], 'tree'),
|
||||
];
|
||||
|
||||
export const resourceByPath = Object.fromEntries(
|
||||
|
||||
Reference in New Issue
Block a user