sms.template.data.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import { reactive } from 'vue'
  2. import { useI18n } from '@/hooks/web/useI18n'
  3. import { required } from '@/utils/formRules'
  4. import { DICT_TYPE } from '@/utils/dict'
  5. import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
  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<VxeCrudSchema>({
  19. primaryKey: 'id',
  20. primaryType: 'seq',
  21. primaryTitle: '模板编号',
  22. action: true,
  23. actionWidth: '280',
  24. columns: [
  25. {
  26. title: '模板编码',
  27. field: 'code',
  28. isSearch: true
  29. },
  30. {
  31. title: '模板名称',
  32. field: 'name',
  33. isSearch: true
  34. },
  35. {
  36. title: '模板内容',
  37. field: 'content'
  38. },
  39. {
  40. title: '短信 API 的模板编号',
  41. field: 'apiTemplateId',
  42. isSearch: true
  43. },
  44. {
  45. title: '短信类型',
  46. field: 'type',
  47. dictType: DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE,
  48. dictClass: 'number',
  49. table: {
  50. width: 80
  51. }
  52. },
  53. {
  54. title: t('common.status'),
  55. field: 'status',
  56. dictType: DICT_TYPE.COMMON_STATUS,
  57. dictClass: 'number',
  58. table: {
  59. width: 80
  60. }
  61. },
  62. {
  63. title: t('form.remark'),
  64. field: 'remark',
  65. isTable: false
  66. },
  67. {
  68. title: t('common.createTime'),
  69. field: 'createTime',
  70. formatter: 'formatDate',
  71. isForm: false,
  72. search: {
  73. show: true,
  74. itemRender: {
  75. name: 'XDataTimePicker'
  76. }
  77. }
  78. }
  79. ]
  80. })
  81. export const { allSchemas } = useVxeCrudSchemas(crudSchemas)