Edit.jsx 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. import React, { useCallback, useEffect, useRef, useState } from "react";
  2. import Edit from "@/components/Page/Edit";
  3. import { Radio, Form } from "antd";
  4. import {
  5. ProForm,
  6. ProFormDatePicker,
  7. ProFormText,
  8. ProFormSelect,
  9. ProFormTextArea,
  10. ProFormDigit,
  11. ProFormRadio,
  12. } from "@ant-design/pro-components/es";
  13. import {
  14. postTaMandatoryLeave,
  15. putTaMandatoryLeave,
  16. getTaMandatoryLeaveById,
  17. } from "@/service/taMandatoryLeave";
  18. import { getSysPosition } from "@/service/sysposition";
  19. import { queryDict } from "@/utils/request";
  20. import { getSysOrg } from "@/service/sysorg";
  21. import { useSearchParams } from "react-router-dom";
  22. const queryPosition = queryDict(getSysPosition, {
  23. labelKey: "name",
  24. valueKey: "positionId",
  25. });
  26. const getOrgId = queryDict(getSysOrg, {
  27. labelKey: "orgId",
  28. valueKey: "orgId",
  29. });
  30. const getOrgName = queryDict(getSysOrg, {
  31. labelKey: "name",
  32. valueKey: "name",
  33. });
  34. const request = {
  35. save: postTaMandatoryLeave,
  36. update: putTaMandatoryLeave,
  37. get: getTaMandatoryLeaveById,
  38. };
  39. export default (props) => {
  40. const formRef = useRef();
  41. const [params] = useSearchParams();
  42. const disabled = params.get("disabled");
  43. const selectChange = [
  44. { label: "是", value: "是" },
  45. { label: "否", value: "否" },
  46. ];
  47. const counterInstitutionsLevelOpt = [
  48. { label: "1.总行部门、直属机构", value: "1.总行部门、直属机构" },
  49. { label: "2.分行各级管理机构本部", value: "2.分行各级管理机构本部" },
  50. { label: "3.基层营业网点(含营业部)", value: "3.基层营业网点(含营业部)" },
  51. ];
  52. const onChangeOrg = (value, e) => {
  53. formRef.current.setFieldValue("orgNum", e.orgId);
  54. formRef.current.setFieldValue("orgName", e.name);
  55. };
  56. return (
  57. <Edit
  58. formRef={formRef}
  59. request={request}
  60. disabled={disabled}
  61. rowKey="leaveId"
  62. labelCol={{ span: 6 }}
  63. renderItems={() => (
  64. <>
  65. {/* <ProFormDigit name="sort" label=" 序 号 :" /> */}
  66. <ProFormText name="headOfficeOrg" label="总 行 部 门" />
  67. <ProFormText
  68. name="employeeNum"
  69. label="员 工 工 号"
  70. rules={[{ required: true }]}
  71. />
  72. <ProFormText
  73. name="employeeName"
  74. label="员 工 姓 名"
  75. rules={[{ required: true }]}
  76. />
  77. <ProFormSelect
  78. onChange={onChangeOrg}
  79. request={getOrgId}
  80. name="orgNum"
  81. label="原单位机构号"
  82. />
  83. <ProFormSelect
  84. rules={[{ required: true }]}
  85. onChange={onChangeOrg}
  86. name="orgName"
  87. label="原单位名称"
  88. request={getOrgName}
  89. />
  90. <ProFormSelect
  91. name="counterInstitutionsLevel"
  92. label="对应机构层次"
  93. options={counterInstitutionsLevelOpt}
  94. />
  95. <ProFormText name="currentPosition" label="当 前 职 位" />
  96. <ProFormSelect
  97. name="counterImpPost"
  98. label="对应重要岗位"
  99. request={queryPosition}
  100. />
  101. <ProFormText
  102. name="counterHeadOfficeLine"
  103. label="对应总行条线"
  104. // options={[{ label: "个人数字金融部", value: "个人数字金融部" }]}
  105. />
  106. <ProFormDatePicker
  107. name="startTimeVacation"
  108. label="休假起始时间"
  109. width="100%"
  110. />
  111. <ProFormDatePicker
  112. name="vacationDeadline"
  113. label="休假截止时间"
  114. width="100%"
  115. />
  116. <ProFormDigit name="mandatoryVacationDay" label="已强制休假天数" />
  117. <ProFormText
  118. name="depSbtDepartureCheck"
  119. label="开展离岗检查/代职检查情况"
  120. />
  121. <ProFormTextArea name="remark" label="备注填写" />
  122. <ProFormRadio.Group
  123. name="checkChange"
  124. label="立 查 立 改:"
  125. options={selectChange}
  126. />
  127. <ProFormRadio.Group
  128. name="checkCorrect"
  129. label="自 查 自 纠:"
  130. options={selectChange}
  131. />
  132. </>
  133. )}
  134. />
  135. );
  136. };