sms.channel.data.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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: 'datetimerange',
  73. valueFormat: 'YYYY-MM-DD HH:mm:ss'
  74. }
  75. }
  76. },
  77. {
  78. label: t('table.action'),
  79. field: 'action',
  80. width: '240px',
  81. form: {
  82. show: false
  83. },
  84. detail: {
  85. show: false
  86. }
  87. }
  88. ])
  89. export const { allSchemas } = useCrudSchemas(crudSchemas)