template.data.ts 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
  2. // 表单校验
  3. export const rules = reactive({
  4. name: [required],
  5. code: [required],
  6. accountId: [required],
  7. title: [required],
  8. content: [required],
  9. params: [required],
  10. status: [required]
  11. })
  12. // CrudSchema
  13. const crudSchemas = reactive<VxeCrudSchema>({
  14. primaryKey: 'id', // 默认的主键ID
  15. primaryTitle: '编号', // 默认显示的值
  16. primaryType: null,
  17. action: true,
  18. actionWidth: '260',
  19. columns: [
  20. {
  21. title: '模板编码',
  22. field: 'code',
  23. isSearch: true
  24. },
  25. {
  26. title: '模板名称',
  27. field: 'name',
  28. isSearch: true
  29. },
  30. {
  31. title: '模板标题',
  32. field: 'title'
  33. },
  34. {
  35. title: '模板内容',
  36. field: 'content',
  37. form: {
  38. component: 'Editor',
  39. colProps: {
  40. span: 24
  41. },
  42. componentProps: {
  43. valueHtml: ''
  44. }
  45. }
  46. },
  47. {
  48. title: '邮箱账号',
  49. field: 'accountId',
  50. isSearch: true,
  51. table: {
  52. width: 200,
  53. slots: {
  54. default: 'accountId_default'
  55. }
  56. }
  57. },
  58. {
  59. title: '发送人名称',
  60. field: 'nickname'
  61. },
  62. {
  63. title: '开启状态',
  64. field: 'status',
  65. isSearch: true,
  66. dictType: DICT_TYPE.COMMON_STATUS,
  67. dictClass: 'number'
  68. },
  69. {
  70. title: '备注',
  71. field: 'remark',
  72. isTable: false
  73. },
  74. {
  75. title: '创建时间',
  76. field: 'createTime',
  77. isForm: false,
  78. formatter: 'formatDate',
  79. table: {
  80. width: 180
  81. },
  82. search: {
  83. show: true,
  84. itemRender: {
  85. name: 'XDataTimePicker'
  86. }
  87. }
  88. }
  89. ]
  90. })
  91. export const { allSchemas } = useVxeCrudSchemas(crudSchemas)