common.ts 527 B

12345678910111213141516171819202122232425262728
  1. /**
  2. * 确认状态
  3. */
  4. export enum Confirmation {
  5. Yes = 1, // 是
  6. No = 0, // 否
  7. }
  8. /**
  9. * 获取确认状态列表
  10. * @returns
  11. */
  12. export function getConfirmationList() {
  13. return [
  14. { label: '是', value: Confirmation.Yes },
  15. { label: '否', value: Confirmation.No }
  16. ]
  17. }
  18. /**
  19. * 获取确认状态名称
  20. * @param value
  21. * @returns
  22. */
  23. export function getConfirmationName(value?: number) {
  24. const item = getConfirmationList().find((e) => e.value === value)
  25. return item?.label ?? value
  26. }