research-report.data.ts 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. import type { ResearchReportVO } from '#/api/outcome';
  2. import { getPopupContainer } from '@vben/utils';
  3. import { defineEditShell } from '#/adapter/shell/edit';
  4. import {
  5. editResearchReportMethod,
  6. getResearchReportMethod,
  7. RESEARCH_REPORT_CATEGORY_OPTIONS,
  8. RESEARCH_REPORT_STATUS_OPTIONS,
  9. ResearchReportVOSchema,
  10. } from '#/api/outcome';
  11. export const researchReportForm = defineEditShell<ResearchReportVO>({
  12. scope: 'outcome.researchReport',
  13. title: '研究报告',
  14. submit: editResearchReportMethod,
  15. load: getResearchReportMethod,
  16. shell: {
  17. type: 'modal',
  18. class: '!w-[760px]',
  19. confirmText: '提交报告',
  20. },
  21. form: {
  22. layout: 'vertical',
  23. wrapperClass: 'grid-cols-2',
  24. },
  25. schema: [
  26. {
  27. component: 'Select',
  28. fieldName: 'status',
  29. label: '状态',
  30. dependencies: {
  31. show: false,
  32. triggerFields: ['status'],
  33. },
  34. componentProps: {
  35. options: [...RESEARCH_REPORT_STATUS_OPTIONS],
  36. placeholder: '请选择状态',
  37. getPopupContainer,
  38. },
  39. rules: ResearchReportVOSchema.shape.status,
  40. },
  41. {
  42. component: 'Input',
  43. fieldName: 'title',
  44. label: '报告标题',
  45. formItemClass: 'col-span-2',
  46. componentProps: {
  47. placeholder: '请输入研究报告标题',
  48. },
  49. rules: ResearchReportVOSchema.shape.title,
  50. },
  51. {
  52. component: 'Input',
  53. fieldName: 'leader',
  54. label: '负责人',
  55. componentProps: {
  56. placeholder: '请输入负责人姓名',
  57. },
  58. rules: ResearchReportVOSchema.shape.leader,
  59. },
  60. {
  61. component: 'Select',
  62. fieldName: 'category',
  63. label: '研究类型',
  64. componentProps: {
  65. options: [...RESEARCH_REPORT_CATEGORY_OPTIONS],
  66. placeholder: '请选择研究类型',
  67. getPopupContainer,
  68. },
  69. rules: ResearchReportVOSchema.shape.category,
  70. },
  71. {
  72. component: 'DatePicker',
  73. fieldName: 'startDate',
  74. label: '开始日期',
  75. componentProps: {
  76. class: 'w-full',
  77. format: 'YYYY-MM',
  78. picker: 'month',
  79. placeholder: '年 / 月',
  80. valueFormat: 'YYYY-MM',
  81. getPopupContainer,
  82. },
  83. rules: ResearchReportVOSchema.shape.startDate,
  84. },
  85. {
  86. component: 'DatePicker',
  87. fieldName: 'endDate',
  88. label: '预计结束日期',
  89. componentProps: {
  90. class: 'w-full',
  91. format: 'YYYY-MM',
  92. picker: 'month',
  93. placeholder: '年 / 月',
  94. valueFormat: 'YYYY-MM',
  95. getPopupContainer,
  96. },
  97. rules: ResearchReportVOSchema.shape.endDate,
  98. },
  99. {
  100. component: 'Input',
  101. fieldName: 'fundingSource',
  102. label: '资助来源',
  103. componentProps: {
  104. placeholder: '例如:国家自然科学基金',
  105. },
  106. rules: ResearchReportVOSchema.shape.fundingSource,
  107. },
  108. {
  109. component: 'Input',
  110. fieldName: 'projectNumber',
  111. label: '项目编号',
  112. componentProps: {
  113. placeholder: '请输入项目编号',
  114. },
  115. rules: ResearchReportVOSchema.shape.projectNumber,
  116. },
  117. {
  118. component: 'Input',
  119. fieldName: 'keywords',
  120. label: '关键词',
  121. formItemClass: 'col-span-2',
  122. componentProps: {
  123. placeholder: '多个关键词用分号分隔,例如:中医药;临床研究;疗效评价',
  124. },
  125. rules: ResearchReportVOSchema.shape.keywords,
  126. },
  127. {
  128. component: 'Divider',
  129. fieldName: '_section_content',
  130. formItemClass: 'col-span-2 !mb-0',
  131. hideLabel: true,
  132. componentProps: {
  133. orientation: 'left',
  134. plain: true,
  135. },
  136. label: '研究内容',
  137. },
  138. {
  139. component: 'Textarea',
  140. fieldName: 'abstract',
  141. label: '研究摘要',
  142. formItemClass: 'col-span-2',
  143. componentProps: {
  144. placeholder: '请简要概述研究的背景、目的、方法和预期成果...',
  145. rows: 4,
  146. showCount: false,
  147. },
  148. rules: ResearchReportVOSchema.shape.abstract,
  149. },
  150. {
  151. component: 'Textarea',
  152. fieldName: 'objectives',
  153. label: '研究目标',
  154. formItemClass: 'col-span-2',
  155. componentProps: {
  156. placeholder: '列出本研究的主要目标和次要目标...',
  157. rows: 3,
  158. showCount: false,
  159. },
  160. rules: ResearchReportVOSchema.shape.objectives,
  161. },
  162. {
  163. component: 'Textarea',
  164. fieldName: 'methods',
  165. label: '研究方法',
  166. formItemClass: 'col-span-2',
  167. componentProps: {
  168. placeholder: '描述研究设计、样本选择、数据收集和分析方法...',
  169. rows: 3,
  170. showCount: false,
  171. },
  172. rules: ResearchReportVOSchema.shape.methods,
  173. },
  174. {
  175. component: 'Textarea',
  176. fieldName: 'expectedResults',
  177. label: '预期成果',
  178. formItemClass: 'col-span-2',
  179. componentProps: {
  180. placeholder: '描述预期的研究成果、创新点和应用价值...',
  181. rows: 3,
  182. showCount: false,
  183. },
  184. rules: ResearchReportVOSchema.shape.expectedResults,
  185. },
  186. {
  187. component: 'Input',
  188. fieldName: 'workroomId',
  189. dependencies: {
  190. show: false,
  191. triggerFields: ['workroomId'],
  192. },
  193. rules: ResearchReportVOSchema.shape.workroomId,
  194. },
  195. ],
  196. });