Geen omschrijving

config-data.tsx 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import type { FormSchemaGetter } from '#/adapter/form';
  2. // 编辑表单配置
  3. export const drawerFormSchema: FormSchemaGetter = () => [
  4. {
  5. component: 'Input',
  6. fieldName: 'title',
  7. label: '标题',
  8. componentProps: {
  9. placeholder: '请输入章节标题',
  10. },
  11. rules: 'required',
  12. },
  13. {
  14. component: 'Input',
  15. fieldName: 'content',
  16. label: '内容',
  17. componentProps: {
  18. placeholder: '请输入章节内容',
  19. rows: 10,
  20. },
  21. // 使用自定义插槽渲染Tinymce编辑器
  22. slot: 'content',
  23. rules: 'required',
  24. },
  25. {
  26. component: 'Input',
  27. fieldName: 'attachments',
  28. label: '附件',
  29. componentProps: {
  30. placeholder: '请上传附件',
  31. readonly: true,
  32. },
  33. },
  34. ];
  35. // 提醒表单配置
  36. export const remindFormSchema: FormSchemaGetter = () => [
  37. {
  38. component: 'Input',
  39. fieldName: 'remindContent',
  40. label: '提醒内容',
  41. componentProps: {
  42. placeholder: '请输入提醒内容',
  43. rows: 4,
  44. maxlength: 200,
  45. type: 'textarea',
  46. showWordLimit: true,
  47. },
  48. // 使用自定义插槽渲染文本域
  49. slot: 'remindContent',
  50. rules: 'required',
  51. },
  52. {
  53. // 组件需要在 #/adapter.ts内注册,并加上类型
  54. component: 'ApiSelect',
  55. // 对应组件的参数
  56. componentProps: {
  57. placeholder: '请选择或搜索提醒人',
  58. // 菜单接口转options格式
  59. afterFetch: (data: { name: string; path: string }[]) => {
  60. return data.map((item: any) => ({
  61. label: item.name,
  62. value: item.path,
  63. }));
  64. },
  65. // 菜单接口
  66. api: () => {},
  67. },
  68. // 字段名
  69. fieldName: 'remindPerson',
  70. // 界面显示的label
  71. label: '提醒人',
  72. },
  73. ];