refactor: make type more accurate
This commit is contained in:
parent
51a72a50f2
commit
8885db8207
1 changed files with 8 additions and 10 deletions
|
|
@ -44,34 +44,32 @@ const props = withDefaults(
|
|||
const currentBtnOpen = ref<boolean[]>([]);
|
||||
|
||||
function taskOrderStatus(value: TaskOrderStatus, type: 'status' | 'color') {
|
||||
const mappings: Record<string, Record<'status' | 'color', string>> = {
|
||||
Pending: {
|
||||
return {
|
||||
[TaskOrderStatus.Pending]: {
|
||||
status: props.receive ? 'taskOrder.taskInCart' : 'taskOrder.title',
|
||||
color: '--blue-6-hsl',
|
||||
},
|
||||
InProgress: {
|
||||
[TaskOrderStatus.InProgress]: {
|
||||
status: 'taskOrder.inProgress',
|
||||
color: props.receive ? '--blue-6-hsl' : '--orange-5-hsl',
|
||||
},
|
||||
Validate: {
|
||||
[TaskOrderStatus.Validate]: {
|
||||
status: 'taskOrder.inProgress',
|
||||
color: props.receive ? '--blue-6-hsl' : '--orange-5-hsl',
|
||||
},
|
||||
Complete: {
|
||||
[TaskOrderStatus.Complete]: {
|
||||
status: props.receive ? 'taskOrder.sentTask' : 'taskOrder.goodReceipt',
|
||||
color: props.receive ? '--blue-6-hsl' : '--green-8-hsl',
|
||||
},
|
||||
Accept: {
|
||||
[TaskOrderStatus.Accept]: {
|
||||
status: 'taskOrder.receiveTask',
|
||||
color: '--blue-6-hsl',
|
||||
},
|
||||
Submit: {
|
||||
[TaskOrderStatus.Submit]: {
|
||||
status: 'taskOrder.sentTask',
|
||||
color: '--blue-6-hsl',
|
||||
},
|
||||
};
|
||||
|
||||
return mappings[value]?.[type] || '';
|
||||
}[value][type];
|
||||
}
|
||||
|
||||
function getCreatedByName(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue