sms.channel.data.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. import { reactive } from 'vue'
  2. import { useI18n } from '@/hooks/web/useI18n'
  3. import { required } from '@/utils/formRules'
  4. import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
  5. import { DICT_TYPE } from '@/utils/dict'
  6. const { t } = useI18n() // 国际化
  7. // 表单校验
  8. export const rules = reactive({
  9. signature: [required],
  10. code: [required],
  11. apiKey: [required],
  12. status: [required]
  13. })
  14. // CrudSchema
  15. const crudSchemas = reactive<CrudSchema[]>([
  16. {
  17. label: t('common.index'),
  18. field: 'id',
  19. type: 'index',
  20. form: {
  21. show: false
  22. },
  23. detail: {
  24. show: false
  25. }
  26. },
  27. {
  28. label: '短信签名',
  29. field: 'signature',
  30. search: {
  31. show: true
  32. }
  33. },
  34. {
  35. label: '渠道编码',
  36. field: 'code',
  37. dictType: DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE,
  38. search: {
  39. show: true
  40. }
  41. },
  42. {
  43. label: t('common.status'),
  44. field: 'status',
  45. dictType: DICT_TYPE.COMMON_STATUS,
  46. search: {
  47. show: true
  48. }
  49. },
  50. {
  51. label: '短信 API 的账号',
  52. field: 'apiKey'
  53. },
  54. {
  55. label: '短信 API 的密钥',
  56. field: 'apiSecret'
  57. },
  58. {
  59. label: '短信发送回调 URL',
  60. field: 'callbackUrl'
  61. },
  62. {
  63. label: t('common.createTime'),
  64. field: 'createTime',
  65. form: {
  66. show: false
  67. },
  68. search: {
  69. show: true,
  70. component: 'DatePicker',
  71. componentProps: {
  72. type: 'daterange',
  73. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  74. defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]
  75. }
  76. }
  77. },
  78. {
  79. label: t('table.action'),
  80. field: 'action',
  81. width: '240px',
  82. form: {
  83. show: false
  84. },
  85. detail: {
  86. show: false
  87. }
  88. }
  89. ])
  90. export const { allSchemas } = useCrudSchemas(crudSchemas)