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[]>([]);
|
const currentBtnOpen = ref<boolean[]>([]);
|
||||||
|
|
||||||
function taskOrderStatus(value: TaskOrderStatus, type: 'status' | 'color') {
|
function taskOrderStatus(value: TaskOrderStatus, type: 'status' | 'color') {
|
||||||
const mappings: Record<string, Record<'status' | 'color', string>> = {
|
return {
|
||||||
Pending: {
|
[TaskOrderStatus.Pending]: {
|
||||||
status: props.receive ? 'taskOrder.taskInCart' : 'taskOrder.title',
|
status: props.receive ? 'taskOrder.taskInCart' : 'taskOrder.title',
|
||||||
color: '--blue-6-hsl',
|
color: '--blue-6-hsl',
|
||||||
},
|
},
|
||||||
InProgress: {
|
[TaskOrderStatus.InProgress]: {
|
||||||
status: 'taskOrder.inProgress',
|
status: 'taskOrder.inProgress',
|
||||||
color: props.receive ? '--blue-6-hsl' : '--orange-5-hsl',
|
color: props.receive ? '--blue-6-hsl' : '--orange-5-hsl',
|
||||||
},
|
},
|
||||||
Validate: {
|
[TaskOrderStatus.Validate]: {
|
||||||
status: 'taskOrder.inProgress',
|
status: 'taskOrder.inProgress',
|
||||||
color: props.receive ? '--blue-6-hsl' : '--orange-5-hsl',
|
color: props.receive ? '--blue-6-hsl' : '--orange-5-hsl',
|
||||||
},
|
},
|
||||||
Complete: {
|
[TaskOrderStatus.Complete]: {
|
||||||
status: props.receive ? 'taskOrder.sentTask' : 'taskOrder.goodReceipt',
|
status: props.receive ? 'taskOrder.sentTask' : 'taskOrder.goodReceipt',
|
||||||
color: props.receive ? '--blue-6-hsl' : '--green-8-hsl',
|
color: props.receive ? '--blue-6-hsl' : '--green-8-hsl',
|
||||||
},
|
},
|
||||||
Accept: {
|
[TaskOrderStatus.Accept]: {
|
||||||
status: 'taskOrder.receiveTask',
|
status: 'taskOrder.receiveTask',
|
||||||
color: '--blue-6-hsl',
|
color: '--blue-6-hsl',
|
||||||
},
|
},
|
||||||
Submit: {
|
[TaskOrderStatus.Submit]: {
|
||||||
status: 'taskOrder.sentTask',
|
status: 'taskOrder.sentTask',
|
||||||
color: '--blue-6-hsl',
|
color: '--blue-6-hsl',
|
||||||
},
|
},
|
||||||
};
|
}[value][type];
|
||||||
|
|
||||||
return mappings[value]?.[type] || '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCreatedByName(
|
function getCreatedByName(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue