data.ts 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. import { DescItem } from '/@/components/Description';
  2. import { BasicColumn, FormSchema } from '/@/components/Table';
  3. import { validateStr } from '/@/utils/validate';
  4. export const columns: BasicColumn[] = [
  5. {
  6. title: '门户编码',
  7. dataIndex: 'code',
  8. },
  9. {
  10. title: '门户名称',
  11. dataIndex: 'name',
  12. },
  13. {
  14. title: '门户类型',
  15. dataIndex: 'type',
  16. },
  17. ];
  18. // 表单列定义
  19. export const searchFormSchema: FormSchema[] = [
  20. {
  21. label: '门户编码',
  22. field: 'code',
  23. component: 'Input',
  24. componentProps: {
  25. placeholder: '请输入门户编码',
  26. },
  27. },
  28. {
  29. label: '门户名称',
  30. field: 'name',
  31. component: 'Input',
  32. componentProps: {
  33. placeholder: '请输入门户名称',
  34. },
  35. },
  36. ];
  37. // 表单新增编辑
  38. export const dataFormSchema: FormSchema[] = [
  39. {
  40. label: '门户编码',
  41. field: 'code',
  42. component: 'Input',
  43. componentProps: {
  44. placeholder: '请输入门户编码',
  45. },
  46. dynamicRules: () => {
  47. return [
  48. {
  49. required: true,
  50. validator: async (_, value) => {
  51. if (!value) {
  52. return Promise.reject('门户编码不能为空');
  53. }
  54. if (validateStr(value)) {
  55. return Promise.reject('门户编码为字母或数字组成');
  56. }
  57. return Promise.resolve();
  58. },
  59. },
  60. ];
  61. },
  62. },
  63. {
  64. label: '门户名称',
  65. field: 'name',
  66. required: true,
  67. component: 'Input',
  68. componentProps: {
  69. placeholder: '请输入门户名称',
  70. },
  71. },
  72. {
  73. label: '备注',
  74. field: 'remark',
  75. component: 'InputTextArea',
  76. componentProps: {
  77. placeholder: '请输入备注',
  78. },
  79. },
  80. ];
  81. // 表单详情查看
  82. export const viewSchema: DescItem[] = [
  83. {
  84. label: '门户编码',
  85. field: 'code',
  86. },
  87. {
  88. label: '门户名称',
  89. field: 'name',
  90. },
  91. {
  92. label: '门户类型',
  93. field: 'type',
  94. },
  95. {
  96. label: '备注',
  97. field: 'remark',
  98. },
  99. ];