feat(projects): page manage_role

This commit is contained in:
Soybean
2024-01-28 00:44:21 +08:00
parent 2724169eb6
commit 237c6d227e
23 changed files with 909 additions and 60 deletions

View File

@ -1,3 +1,5 @@
import { $t } from '@/locales';
/**
* Transform record to option
*
@ -20,5 +22,17 @@ export function transformRecordToOption<T extends Record<string, string>>(record
return Object.entries(record).map(([value, label]) => ({
value,
label
})) as Common.Option<keyof T>[];
})) as CommonType.Option<keyof T>[];
}
/**
* Translate options
*
* @param options
*/
export function translateOptions(options: CommonType.Option<string>[]) {
return options.map(option => ({
...option,
label: $t(option.label as App.I18n.I18nKey)
}));
}