sms.template.data.ts 1.5 KB

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