template.data.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. search: {
  58. slots: {
  59. default: 'accountId_search'
  60. }
  61. }
  62. },
  63. {
  64. title: '发送人名称',
  65. field: 'nickname'
  66. },
  67. {
  68. title: '开启状态',
  69. field: 'status',
  70. isSearch: true,
  71. dictType: DICT_TYPE.COMMON_STATUS,
  72. dictClass: 'number'
  73. },
  74. {
  75. title: '备注',
  76. field: 'remark',
  77. isTable: false
  78. },
  79. {
  80. title: '创建时间',
  81. field: 'createTime',
  82. isForm: false,
  83. formatter: 'formatDate',
  84. table: {
  85. width: 180
  86. },
  87. search: {
  88. show: true,
  89. itemRender: {
  90. name: 'XDataTimePicker'
  91. }
  92. }
  93. }
  94. ]
  95. })
  96. export const { allSchemas } = useVxeCrudSchemas(crudSchemas)