sms.template.data.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. type: [required],
  10. status: [required],
  11. code: [required],
  12. name: [required],
  13. content: [required],
  14. apiTemplateId: [required],
  15. channelId: [required]
  16. })
  17. // CrudSchema
  18. const crudSchemas = reactive<CrudSchema[]>([
  19. {
  20. label: t('common.index'),
  21. field: 'id',
  22. type: 'index',
  23. form: {
  24. show: false
  25. },
  26. detail: {
  27. show: false
  28. }
  29. },
  30. {
  31. label: '模板编码',
  32. field: 'code',
  33. search: {
  34. show: true
  35. }
  36. },
  37. {
  38. label: '模板名称',
  39. field: 'name',
  40. search: {
  41. show: true
  42. }
  43. },
  44. {
  45. label: '模板内容',
  46. field: 'content'
  47. },
  48. {
  49. label: '短信 API 的模板编号',
  50. field: 'apiTemplateId',
  51. search: {
  52. show: true
  53. }
  54. },
  55. {
  56. label: '短信类型',
  57. field: 'type',
  58. dictType: DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE
  59. },
  60. {
  61. label: t('common.status'),
  62. field: 'status',
  63. dictType: DICT_TYPE.COMMON_STATUS
  64. },
  65. {
  66. label: t('form.remark'),
  67. field: 'remark',
  68. table: {
  69. show: false
  70. }
  71. },
  72. {
  73. label: t('common.createTime'),
  74. field: 'createTime',
  75. form: {
  76. show: false
  77. },
  78. search: {
  79. show: true,
  80. component: 'DatePicker',
  81. componentProps: {
  82. type: 'daterange',
  83. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  84. defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]
  85. }
  86. }
  87. },
  88. {
  89. label: t('table.action'),
  90. field: 'action',
  91. width: '320px',
  92. form: {
  93. show: false
  94. },
  95. detail: {
  96. show: false
  97. }
  98. }
  99. ])
  100. export const { allSchemas } = useCrudSchemas(crudSchemas)