form.ts 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. import { FormConfig } from '@/types/basic-form';
  2. /** 隐患问题类别:1-规章制度类,2-建筑安全类 */
  3. export const DANGER_TYPE_OPTIONS = [
  4. { label: '规章制度类', value: 1 },
  5. { label: '建筑安全类', value: 2 },
  6. ];
  7. /** 问题主要原因:1-人的不安全行为,2-物的不安全状态,3-环境的不利影响,4-管理缺陷 */
  8. export const REASON_OPTIONS = [
  9. { label: '人的不安全行为', value: 1 },
  10. { label: '物的不安全状态', value: 2 },
  11. { label: '环境的不利影响', value: 3 },
  12. { label: '管理缺陷', value: 4 },
  13. ];
  14. /** 隐患台账新增/编辑表单配置(字段顺序:隐患问题类别、隐患问题、问题主要原因、任务来源、整改要求、整改日期、复查人员所属部门、复查人员、举一反三是否推送、举一反三内容、举一反三责任部门、举一反三时限) */
  15. export const HIDDEN_DANGER_FORM_CONFIG: FormConfig[] = [
  16. {
  17. prop: 'typeId',
  18. label: '隐患问题类别:',
  19. component: 'ElSelect',
  20. componentProps: {
  21. placeholder: '请选择隐患问题类别',
  22. style: { width: '100%' },
  23. },
  24. selectOptions: DANGER_TYPE_OPTIONS,
  25. },
  26. {
  27. prop: 'dangerProblem',
  28. label: '隐患问题:',
  29. component: 'ElInput',
  30. componentProps: {
  31. placeholder: '请输入隐患问题描述',
  32. },
  33. },
  34. {
  35. prop: 'reasonId',
  36. label: '问题主要原因:',
  37. component: 'ElSelect',
  38. componentProps: {
  39. placeholder: '请选择问题主要原因',
  40. style: { width: '100%' },
  41. },
  42. selectOptions: REASON_OPTIONS,
  43. },
  44. {
  45. prop: 'taskSource',
  46. label: '任务来源:',
  47. component: 'ElInput',
  48. componentProps: {
  49. placeholder: '如:上级检查、院内自查',
  50. },
  51. },
  52. {
  53. prop: 'rectificationRequirement',
  54. label: '整改要求:',
  55. component: 'ElInput',
  56. componentProps: {
  57. placeholder: '请输入整改要求',
  58. },
  59. },
  60. {
  61. prop: 'rectificationDeadline',
  62. label: '整改日期:',
  63. component: 'ElDatePicker',
  64. componentProps: {
  65. type: 'date',
  66. placeholder: '请选择整改日期',
  67. valueFormat: 'YYYY-MM-DD',
  68. style: { width: '100%' },
  69. },
  70. },
  71. {
  72. prop: 'reviewDepartmentId',
  73. label: '复查人员所属部门:',
  74. slot: 'reviewDepartmentId',
  75. componentProps: {
  76. placeholder: '请选择复查人员所属部门',
  77. style: { width: '100%' },
  78. },
  79. },
  80. {
  81. prop: 'reviewPersonId',
  82. label: '复查人员:',
  83. slot: 'reviewPerson',
  84. componentProps: {
  85. placeholder: '请选择复查人员',
  86. style: { width: '100%' },
  87. },
  88. },
  89. {
  90. prop: 'isDrawLessonsPush',
  91. label: '举一反三是否推送:',
  92. slot: 'isDrawLessonsPush',
  93. },
  94. // {
  95. // prop: 'drawLessonsContent',
  96. // label: '举一反三内容:',
  97. // component: 'ElInput',
  98. // componentProps: {
  99. // placeholder: '选填,推送举一反三时建议填写',
  100. // },
  101. // },
  102. // {
  103. // prop: 'drawLessonsDepartmentIds',
  104. // label: '举一反三责任部门:',
  105. // slot: 'drawLessonsDepartmentIds',
  106. // componentProps: {
  107. // placeholder: '请选择举一反三责任部门,可多选',
  108. // style: { width: '100%' },
  109. // },
  110. // },
  111. // {
  112. // prop: 'drawLessonsDeadline',
  113. // label: '举一反三时限:',
  114. // component: 'ElDatePicker',
  115. // componentProps: {
  116. // type: 'date',
  117. // placeholder: '请选择举一反三时限',
  118. // valueFormat: 'YYYY-MM-DD',
  119. // style: { width: '100%' },
  120. // },
  121. // },
  122. ];
  123. /**
  124. * 整改详情完整表单配置:原有字段(只读)+ 整改完成情况、整改完成时间、附件
  125. * 直接用于整改隐患页的 BasicForm
  126. */
  127. export const HIDDEN_DANGER_RECTIFY_FORM_CONFIG: FormConfig[] = [
  128. {
  129. prop: 'typeId',
  130. label: '隐患问题类别:',
  131. component: 'ElSelect',
  132. componentProps: {
  133. placeholder: '请选择隐患问题类别',
  134. style: { width: '100%' },
  135. disabled: true,
  136. },
  137. selectOptions: DANGER_TYPE_OPTIONS,
  138. },
  139. {
  140. prop: 'dangerProblem',
  141. label: '隐患问题:',
  142. component: 'ElInput',
  143. componentProps: {
  144. placeholder: '请输入隐患问题描述',
  145. disabled: true,
  146. },
  147. },
  148. {
  149. prop: 'reasonId',
  150. label: '问题主要原因:',
  151. component: 'ElSelect',
  152. componentProps: {
  153. placeholder: '请选择问题主要原因',
  154. style: { width: '100%' },
  155. disabled: true,
  156. },
  157. selectOptions: REASON_OPTIONS,
  158. },
  159. {
  160. prop: 'taskSource',
  161. label: '任务来源:',
  162. component: 'ElInput',
  163. componentProps: {
  164. placeholder: '如:上级检查、院内自查',
  165. disabled: true,
  166. },
  167. },
  168. {
  169. prop: 'rectificationRequirement',
  170. label: '整改要求:',
  171. component: 'ElInput',
  172. componentProps: {
  173. placeholder: '请输入整改要求',
  174. disabled: true,
  175. },
  176. },
  177. {
  178. prop: 'rectificationDeadline',
  179. label: '整改日期:',
  180. component: 'ElDatePicker',
  181. componentProps: {
  182. type: 'date',
  183. placeholder: '请选择整改日期',
  184. valueFormat: 'YYYY-MM-DD',
  185. style: { width: '100%' },
  186. disabled: true,
  187. },
  188. },
  189. {
  190. prop: 'reviewDepartmentId',
  191. label: '复查人员所属部门:',
  192. slot: 'reviewDepartmentId',
  193. componentProps: {
  194. placeholder: '请选择复查人员所属部门',
  195. style: { width: '100%' },
  196. disabled: true,
  197. },
  198. },
  199. {
  200. prop: 'reviewPersonId',
  201. label: '复查人员:',
  202. slot: 'reviewPerson',
  203. componentProps: {
  204. placeholder: '请选择复查人员',
  205. style: { width: '100%' },
  206. disabled: true,
  207. },
  208. },
  209. {
  210. prop: 'isDrawLessonsPush',
  211. label: '举一反三是否推送:',
  212. slot: 'isDrawLessonsPush',
  213. componentProps: { disabled: true },
  214. },
  215. // {
  216. // prop: 'drawLessonsContent',
  217. // label: '举一反三内容:',
  218. // component: 'ElInput',
  219. // componentProps: {
  220. // placeholder: '选填,推送举一反三时建议填写',
  221. // disabled: true,
  222. // },
  223. // },
  224. // {
  225. // prop: 'drawLessonsDepartmentIds',
  226. // label: '举一反三责任部门:',
  227. // component: 'ElSelect',
  228. // // slot: 'drawLessonsDepartmentIds',
  229. // componentProps: {
  230. // placeholder: '请选择举一反三责任部门,可多选',
  231. // style: { width: '100%' },
  232. // disabled: true,
  233. // },
  234. // },
  235. // {
  236. // prop: 'drawLessonsDeadline',
  237. // label: '举一反三时限:',
  238. // component: 'ElDatePicker',
  239. // componentProps: {
  240. // type: 'date',
  241. // placeholder: '请选择举一反三时限',
  242. // valueFormat: 'YYYY-MM-DD',
  243. // style: { width: '100%' },
  244. // disabled: true,
  245. // },
  246. // },
  247. // 整改详情额外字段(可编辑,填写后点「整改」提交)
  248. {
  249. prop: 'rectificationCompletionStatus',
  250. label: '整改完成情况:',
  251. component: 'ElInput',
  252. componentProps: {
  253. placeholder: '请输入整改完成情况',
  254. },
  255. },
  256. {
  257. prop: 'rectificationCompletionTime',
  258. label: '整改完成时间:',
  259. component: 'ElDatePicker',
  260. componentProps: {
  261. type: 'date',
  262. placeholder: '请选择整改完成时间',
  263. valueFormat: 'YYYY-MM-DD',
  264. style: { width: '100%' },
  265. },
  266. },
  267. {
  268. prop: 'attachments',
  269. label: '附件:',
  270. slot: 'attachments',
  271. componentProps: {
  272. placeholder: '上传附件文档',
  273. },
  274. },
  275. ];
  276. /**
  277. * 复查详情完整表单配置:整改字段全部禁用 + 复查意见(可编辑,清空)
  278. * 从主列表「复查」进入,底部按钮为「审查通过」「审查不通过」
  279. * 说明:附件字段继续复用整改/新增时的 Upload 组件(通过插槽渲染),仅在复查详情中禁用交互
  280. */
  281. export const HIDDEN_DANGER_REVIEW_FORM_CONFIG: FormConfig[] = [
  282. ...HIDDEN_DANGER_RECTIFY_FORM_CONFIG.map((item) => ({
  283. ...item,
  284. componentProps: { ...item.componentProps, disabled: true },
  285. })),
  286. {
  287. prop: 'reviewComments',
  288. label: '复查意见:',
  289. slot: 'reviewComments',
  290. componentProps: {
  291. placeholder: '请输入复查意见(选填),限300字',
  292. },
  293. },
  294. ];
  295. export const HIDDEN_DANGER_FORM_DATA = {
  296. typeId: undefined as number | undefined,
  297. dangerProblem: '',
  298. reasonId: undefined as number | undefined,
  299. taskSource: '',
  300. rectificationRequirement: '',
  301. rectificationDeadline: '',
  302. reviewDepartmentId: undefined as number | undefined,
  303. reviewPersonId: undefined as number | undefined,
  304. reviewPersonName: '',
  305. isDrawLessonsPush: 0,
  306. drawLessonsContent: '',
  307. drawLessonsDepartmentIds: '',
  308. drawLessonsDeadline: '',
  309. // 提交接口需要,下发时再填
  310. rectificationDepartmentIds: '',
  311. rectificationResponsiblePerson: '',
  312. // 整改详情展示(接口可能返回)
  313. rectificationCompletionStatus: '',
  314. rectificationCompletionTime: '',
  315. attachments: '',
  316. reviewComments: '',
  317. };
  318. export const HIDDEN_DANGER_FORM_RULES = {
  319. typeId: [{ required: true, message: '请选择隐患问题类别', trigger: 'change' }],
  320. dangerProblem: [{ required: true, message: '请输入隐患问题', trigger: 'blur' }],
  321. reasonId: [{ required: true, message: '请选择问题主要原因', trigger: 'change' }],
  322. taskSource: [{ required: true, message: '请输入任务来源', trigger: 'blur' }],
  323. rectificationRequirement: [{ required: true, message: '请输入整改要求', trigger: 'blur' }],
  324. rectificationDeadline: [{ required: true, message: '请选择整改日期', trigger: 'change' }],
  325. reviewDepartmentId: [{ required: true, message: '请选择复查人员所属部门', trigger: 'change' }],
  326. reviewPersonId: [{ required: true, message: '请选择复查人员', trigger: 'change' }],
  327. isDrawLessonsPush: [{ required: true, message: '请选择举一反三是否推送', trigger: 'change' }],
  328. drawLessonsContent: [
  329. {
  330. required: true,
  331. message: '请输入举一反三内容',
  332. trigger: 'blur',
  333. },
  334. ],
  335. drawLessonsDepartmentIds: [
  336. {
  337. required: true,
  338. message: '请选择举一反三责任部门',
  339. trigger: 'change',
  340. },
  341. ],
  342. drawLessonsDeadline: [
  343. {
  344. required: true,
  345. message: '请选择举一反三截止日期',
  346. trigger: 'change',
  347. },
  348. ],
  349. };