data.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import { BasicColumn, FormSchema } from '/@/components/Table';
  2. import { listDictModel, uploadApi } from '/@/api/common';
  3. export const columns: BasicColumn[] = [
  4. {
  5. title: '封面',
  6. dataIndex: 'cover',
  7. },
  8. {
  9. title: '标题',
  10. dataIndex: 'title',
  11. },
  12. {
  13. title: '分类',
  14. dataIndex: 'type',
  15. },
  16. {
  17. title: '上传时间',
  18. dataIndex: 'updateTime',
  19. },
  20. {
  21. title: '上传人',
  22. dataIndex: 'updatorName',
  23. },
  24. {
  25. title: '状态',
  26. dataIndex: 'disable',
  27. },
  28. ];
  29. // 表单新增编辑
  30. export const dataFormSchema: FormSchema[] = [
  31. {
  32. label: '宣教标题',
  33. field: 'title',
  34. component: 'Input',
  35. componentProps: {},
  36. },
  37. {
  38. label: '宣教分类',
  39. field: 'type',
  40. required: true,
  41. component: 'ApiSelect',
  42. componentProps: {
  43. api: listDictModel,
  44. params: {
  45. dictCode: 'het',
  46. },
  47. placeholder: '请选择宣教分类',
  48. },
  49. },
  50. {
  51. label: '封面',
  52. field: 'cover',
  53. component: 'XTUpload',
  54. componentProps: ({ formModel, schema }) => {
  55. return {
  56. api: uploadApi,
  57. maxSize: 10,
  58. maxNumber: 5,
  59. helpText: '仅支持上传jpg/png/pdf文件,文件大小不超过2M',
  60. accept: ['image/*', '.pdf', '.doc', 'docx', 'xls'],
  61. onChange: data => {
  62. console.log('🚀 ~ file: data.ts:57 ~ data:', data);
  63. formModel[schema.field] = data;
  64. },
  65. };
  66. },
  67. colProps: {
  68. span: 22,
  69. },
  70. },
  71. {
  72. label: '宣教内容',
  73. field: 'content',
  74. component: 'Editor',
  75. colProps: {
  76. span: 24,
  77. },
  78. },
  79. ];