template.data.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
  2. // 表单校验
  3. export const rules = reactive({
  4. name: [required],
  5. code: [required],
  6. content: [required],
  7. type: [required],
  8. status: [required]
  9. })
  10. // CrudSchema
  11. const crudSchemas = reactive<VxeCrudSchema>({
  12. primaryKey: 'id',
  13. primaryTitle: '编号',
  14. primaryType: null,
  15. action: true,
  16. actionWidth: '260', // 3个按钮默认200,如有删减对应增减即可
  17. columns: [
  18. {
  19. title: '模版编码',
  20. field: 'code',
  21. isSearch: true
  22. },
  23. {
  24. title: '模板名称',
  25. field: 'name',
  26. isSearch: true
  27. },
  28. {
  29. title: '发件人名称',
  30. field: 'nickname'
  31. },
  32. {
  33. title: '类型',
  34. field: 'type',
  35. dictType: DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE,
  36. dictClass: 'number'
  37. },
  38. {
  39. title: '模版内容',
  40. field: 'content',
  41. table: {
  42. width: 300
  43. },
  44. form: {
  45. component: 'Input',
  46. componentProps: {
  47. type: 'textarea',
  48. rows: 4
  49. },
  50. colProps: {
  51. span: 24
  52. }
  53. }
  54. },
  55. {
  56. title: '状态',
  57. field: 'status',
  58. dictType: DICT_TYPE.COMMON_STATUS,
  59. dictClass: 'number',
  60. isSearch: true
  61. },
  62. {
  63. title: '备注',
  64. field: 'remark'
  65. },
  66. {
  67. title: '创建时间',
  68. field: 'createTime',
  69. isForm: false,
  70. formatter: 'formatDate',
  71. search: {
  72. show: true,
  73. itemRender: {
  74. name: 'XDataTimePicker'
  75. }
  76. },
  77. table: {
  78. width: 180
  79. }
  80. }
  81. ]
  82. })
  83. export const { allSchemas } = useVxeCrudSchemas(crudSchemas)