email.data.ts 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import { BasicColumn } from '/@/components/Table';
  2. import { FormSchema } from '/@/components/Table';
  3. import { h } from 'vue';
  4. import { Tag } from 'ant-design-vue';
  5. import { useI18n } from '/@/hooks/web/useI18n';
  6. import moment from 'moment';
  7. const { t } = useI18n();
  8. export const columns: BasicColumn[] = [
  9. {
  10. title: '邮件主题',
  11. dataIndex: 'emailSubject',
  12. width: 160,
  13. },
  14. {
  15. title: '收件人',
  16. dataIndex: 'emailTo',
  17. width: 160,
  18. },
  19. {
  20. title: '状态',
  21. dataIndex: 'status',
  22. width: 100,
  23. customRender: ({ record }) => {
  24. const status = record.status;
  25. const success = status === 'SUCCESS';
  26. const color = success ? 'green' : 'red';
  27. const successText: string = t('routes.common.system.tableSuccessStatus');
  28. const failedText: string = t('routes.common.system.tableFailedStatus');
  29. const text = success ? successText : failedText;
  30. return h(Tag, { color: color }, () => text);
  31. },
  32. },
  33. {
  34. title: '用途',
  35. dataIndex: 'templatePurposeDictText',
  36. width: 160,
  37. },
  38. {
  39. title: '备注',
  40. dataIndex: 'remark',
  41. width: 120,
  42. slots: {
  43. customRender: 'remark',
  44. },
  45. },
  46. {
  47. title: '发送时间',
  48. dataIndex: 'sendTime',
  49. width: 180,
  50. },
  51. ];
  52. export const searchFormSchema: FormSchema[] = [
  53. {
  54. field: 'emailSubject',
  55. label: '邮件主题',
  56. component: 'Input',
  57. componentProps: {
  58. maxLength: 255,
  59. placeholder: '请输入邮件主题',
  60. },
  61. dynamicRules: () => {
  62. return [
  63. {
  64. required: false,
  65. validator: (_, value) => {
  66. if (String(value).length > 255) {
  67. return Promise.reject('字数不超过255个字');
  68. }
  69. return Promise.resolve();
  70. },
  71. },
  72. ];
  73. },
  74. colProps: { span: 6 },
  75. },
  76. {
  77. field: 'sendTime',
  78. label: '发送时间',
  79. component: 'RangePicker',
  80. componentProps: {
  81. showTime: {
  82. defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],
  83. },
  84. },
  85. colProps: { span: 6 },
  86. },
  87. ];