sms.template.data.ts 1.7 KB

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