account.data.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
  2. const { t } = useI18n() // 国际化
  3. // 表单校验
  4. export const rules = reactive({
  5. // mail: [required],
  6. mail: [
  7. { required: true, message: t('profile.rules.mail'), trigger: 'blur' },
  8. {
  9. type: 'email',
  10. message: t('profile.rules.truemail'),
  11. trigger: ['blur', 'change']
  12. }
  13. ],
  14. username: [required],
  15. password: [required],
  16. host: [required],
  17. port: [required],
  18. sslEnable: [required]
  19. })
  20. // CrudSchema
  21. const crudSchemas = reactive<VxeCrudSchema>({
  22. primaryKey: 'id', // 默认的主键 ID
  23. primaryTitle: '编号',
  24. primaryType: 'id',
  25. action: true,
  26. actionWidth: '200', // 3 个按钮默认 200,如有删减对应增减即可
  27. columns: [
  28. {
  29. title: '邮箱',
  30. field: 'mail',
  31. isSearch: true
  32. },
  33. {
  34. title: '用户名',
  35. field: 'username',
  36. isSearch: true
  37. },
  38. {
  39. title: '密码',
  40. field: 'password',
  41. isTable: false
  42. },
  43. {
  44. title: 'SMTP 服务器域名',
  45. field: 'host'
  46. },
  47. {
  48. title: 'SMTP 服务器端口',
  49. field: 'port',
  50. form: {
  51. component: 'InputNumber',
  52. value: 465
  53. }
  54. },
  55. {
  56. title: '是否开启 SSL',
  57. field: 'sslEnable',
  58. dictType: DICT_TYPE.INFRA_BOOLEAN_STRING,
  59. dictClass: 'boolean'
  60. },
  61. {
  62. title: '创建时间',
  63. field: 'createTime',
  64. isForm: false,
  65. formatter: 'formatDate',
  66. table: {
  67. width: 180
  68. }
  69. }
  70. ]
  71. })
  72. export const { allSchemas } = useVxeCrudSchemas(crudSchemas)