75 lines
1.8 KiB
TypeScript
75 lines
1.8 KiB
TypeScript
import {
|
|
Price,
|
|
Datetime,
|
|
} from 'oak-domain/lib/types/DataType';
|
|
import { EntityShape } from 'oak-domain/lib/types/Entity';
|
|
import { EntityDesc, ActionDef } from 'oak-domain/lib/types';
|
|
import { Schema as Account } from './Account';
|
|
import { Schema as SettlePlan } from './SettlePlan';
|
|
import { Schema as AccountOper } from './AccountOper';
|
|
|
|
export interface Schema extends EntityShape {
|
|
account: Account;
|
|
plan: SettlePlan;
|
|
price: Price;
|
|
opers?: AccountOper[];
|
|
settledAt?: Datetime;
|
|
closedAt?: Datetime;
|
|
};
|
|
|
|
type IState = 'unsettled' | 'settled' | 'closed';
|
|
type IAction = 'settle' | 'close';
|
|
|
|
export const IActionDef: ActionDef<IAction, IState> = {
|
|
stm: {
|
|
settle: ['unsettled', 'settled'],
|
|
close: ['unsettled', 'closed'],
|
|
},
|
|
is: 'unsettled',
|
|
};
|
|
|
|
type Action = IAction;
|
|
|
|
export const entityDesc: EntityDesc<Schema, Action, '', {
|
|
iState: IState,
|
|
}> = {
|
|
locales: {
|
|
zh_CN: {
|
|
name: '结算明细',
|
|
attr: {
|
|
account: '帐号',
|
|
plan: '结算计划',
|
|
price: '变化金额',
|
|
iState: '结算状态',
|
|
opers: '相关帐户操作',
|
|
settledAt: '结算时间',
|
|
closedAt: '关闭时间'
|
|
},
|
|
action: {
|
|
settle: '结算',
|
|
close: '关闭',
|
|
},
|
|
v: {
|
|
iState: {
|
|
unsettled: '未结算',
|
|
settled: '已结算',
|
|
closed: '已关闭',
|
|
},
|
|
},
|
|
},
|
|
},
|
|
style: {
|
|
icon: {
|
|
settle: '',
|
|
close: '',
|
|
},
|
|
color: {
|
|
iState: {
|
|
unsettled: '#52BE80',
|
|
settled: '#2E86C1',
|
|
closed: '#8C949C'
|
|
},
|
|
}
|
|
},
|
|
}
|