detail.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. import ModuleTitle from '@/components/ModuleTitle/moduleTitle';
  2. import FileViewerModal from '@/components/FileViewerNew';
  3. import {
  4. Divider,
  5. Form,
  6. Modal,
  7. Row,
  8. Col,
  9. Input,
  10. Radio,
  11. InputNumber,
  12. Card,
  13. } from 'antd';
  14. import dayjs from 'dayjs';
  15. import { useEffect, useState } from 'react';
  16. import { useParams, useRequest, useNavigate } from 'umi';
  17. import { Status } from './component/Modal';
  18. import styles from './index.less';
  19. import AuditSteps from './component/AuditSteps';
  20. import { queryAuditByCode } from '../../services/contract';
  21. const ContractDetail = ({ data }) => {
  22. const [form] = Form.useForm();
  23. const FORMAT = 'YYYY-MM-DD';
  24. const [fileViewerVisible, setFileViewerVisible] = useState(false);
  25. const [fileViewerData, setFileViewerData] = useState();
  26. const [attachData, setAttachData] = useState({
  27. attach: [],
  28. attach_extend: [],
  29. });
  30. useEffect(() => {
  31. form.resetFields();
  32. if (data?.status >= Status.Checking) runAudit({ extend_code: data.code });
  33. let result = { attach: [], attach_extend: [] };
  34. if (data?.attach) {
  35. let att = JSON.parse(data.attach);
  36. result.attach = att.map((item, idx) => {
  37. return { ...item, uid: idx, status: 'done' };
  38. });
  39. }
  40. if (data?.attach_extend) {
  41. let att = JSON.parse(data.attach_extend);
  42. result.attach_extend = att.map((item, idx) => {
  43. return { ...item, uid: idx, status: 'done' };
  44. });
  45. }
  46. setAttachData(result);
  47. }, [data]);
  48. //获取OA 归档审批列表
  49. const { data: auditData, run: runAudit } = useRequest(
  50. (data) => queryAuditByCode({ ...data, extend_type: 0 }),
  51. {
  52. manual: true,
  53. formatResult: (res) => {
  54. if (res?.data) {
  55. return res.data;
  56. } else {
  57. if (data?.status == Status.CheckReject) {
  58. return { ...oldAuditList, audit_status: 2 };
  59. }
  60. return oldAuditList;
  61. }
  62. },
  63. },
  64. );
  65. const handlePreViewSingle = (data) => {
  66. if (!data) return;
  67. const arr = data.name.split('.');
  68. const type = arr[arr.length - 1];
  69. const dataItem = { url: data.url, name: data.name, type };
  70. setFileViewerData(dataItem);
  71. setFileViewerVisible(true);
  72. };
  73. return (
  74. <>
  75. <Card title={data?.status == Status.Checking ? '归档审批' : '作废审批'}>
  76. <Form
  77. form={form}
  78. // initialValues={data}
  79. labelCol={{ span: 7 }}
  80. wrapperCol={{ span: 17 }}
  81. >
  82. <ModuleTitle title="存档人信息" />
  83. <Row>
  84. <Col span={10} offset={1}>
  85. <Form.Item
  86. name="created_name"
  87. initialValue={data?.created_name}
  88. label="存档人:"
  89. >
  90. <Input disabled />
  91. </Form.Item>
  92. <Form.Item
  93. name="company_name"
  94. label="所属公司:"
  95. tooltip="请选择该存档合同所属公司"
  96. initialValue={data?.company_name}
  97. rules={[
  98. {
  99. required: true,
  100. message: '请填写所属公司',
  101. },
  102. ]}
  103. >
  104. <Input disabled />
  105. </Form.Item>
  106. </Col>
  107. <Col span={10}>
  108. <Form.Item
  109. name="created_on"
  110. initialValue={data?.created_on || dayjs().format(FORMAT)}
  111. label="存档时间:"
  112. >
  113. <Input disabled />
  114. </Form.Item>
  115. <Form.Item
  116. name="dep_id"
  117. label="所属部门:"
  118. initialValue={data?.dep_name}
  119. rules={[
  120. {
  121. required: true,
  122. message: '请选择所属部门',
  123. },
  124. ]}
  125. >
  126. <Input disabled />
  127. </Form.Item>
  128. </Col>
  129. </Row>
  130. <ModuleTitle title="经办人信息" />
  131. <Row>
  132. <Col span={10} offset={1}>
  133. <Form.Item
  134. name="deal_by"
  135. label="经办人:"
  136. tooltip="经办人应负责合同审批流程、签字盖章、合同原件存档和电子档案存档。母公司的经办人为OA审批提交人,也是存档人。子公司经办人由子公司合同专员填写,一般是合同审批时的提交人或者是合同实际执行的负责人"
  137. initialValue={data?.deal_by}
  138. rules={[
  139. {
  140. required: true,
  141. message: '请选择经办人',
  142. },
  143. ]}
  144. >
  145. <Input disabled />
  146. </Form.Item>
  147. </Col>
  148. <Col span={10}>
  149. <Form.Item
  150. name="created_dep"
  151. label="签约承办部门:"
  152. tooltip="请选择该存档合同的实际履行部门,一般为经办人所在部门"
  153. initialValue={data?.created_dep}
  154. rules={[
  155. {
  156. required: true,
  157. message: '请选择签约承办部门',
  158. },
  159. ]}
  160. >
  161. <Input disabled />
  162. </Form.Item>
  163. </Col>
  164. </Row>
  165. <ModuleTitle title="合同信息" />
  166. <Row>
  167. <Col span={10} offset={1}>
  168. <Form.Item
  169. name="is_supplement"
  170. label="是否补充协议:"
  171. tooltip="合同名称"
  172. initialValue={0}
  173. rules={[
  174. {
  175. required: true,
  176. message: '请填写合同名称',
  177. },
  178. ]}
  179. >
  180. <Radio.Group disabled>
  181. <Radio value={1}>是</Radio>
  182. <Radio value={0}>否</Radio>
  183. </Radio.Group>
  184. </Form.Item>
  185. <Form.Item
  186. name="name"
  187. label="合同名称:"
  188. tooltip="请与OA审批时填写的合同名称一致"
  189. initialValue={data?.name}
  190. rules={[
  191. {
  192. required: true,
  193. message: '请填写合同名称',
  194. },
  195. ]}
  196. >
  197. <Input disabled />
  198. </Form.Item>
  199. <Form.Item
  200. name="effect_on"
  201. label="合同签订日期:"
  202. initialValue={data?.effect_on}
  203. tooltip="合同主体各方签字盖章完成之日,以最后签字盖章的为准"
  204. rules={[
  205. {
  206. required: true,
  207. message: '请填写合同名称',
  208. },
  209. ]}
  210. >
  211. <Input disabled />
  212. </Form.Item>
  213. <Form.Item
  214. name="project_name"
  215. label="项目名称:"
  216. tooltip="不涉及项目请选“日常项目”"
  217. initialValue={data?.project_name}
  218. rules={[
  219. {
  220. required: true,
  221. message: '请填写项目名称',
  222. },
  223. ]}
  224. >
  225. <Input disabled />
  226. </Form.Item>
  227. <Form.Item
  228. name="party_a"
  229. label="甲方:"
  230. tooltip="合同主体可以下拉选择,可选项需要经办人在“主页--供应商管理”中创建。经办人可以维护和更新供应商信息。"
  231. initialValue={data?.party_a}
  232. rules={[
  233. {
  234. required: true,
  235. message: '请选择甲方',
  236. },
  237. ]}
  238. >
  239. <Input disabled />
  240. </Form.Item>
  241. </Col>
  242. <Col span={10}>
  243. <Form.Item
  244. style={{ opacity: data?.is_supplement ? 1 : 0 }}
  245. name="parent_code"
  246. tooltip="请先查询原合同编号,原合同未录入本系统的,需先录入存档。"
  247. initialValue={data?.parent_code}
  248. label="原合同编号:"
  249. >
  250. <Input disabled />
  251. </Form.Item>
  252. <Form.Item
  253. name="code"
  254. tooltip="合同编号按《合同管理办法》的合同编码规则编号。"
  255. initialValue={data?.code}
  256. label="合同编号:"
  257. >
  258. <Input disabled />
  259. </Form.Item>
  260. <Form.Item
  261. label="合同总价款:"
  262. name="amount"
  263. tooltip="请与OA审批时填写的“合同金额”一致。不涉及金额填“0”"
  264. initialValue={data?.amount}
  265. rules={[
  266. {
  267. required: true,
  268. message: '请输入合同总价款',
  269. },
  270. ]}
  271. >
  272. <InputNumber
  273. style={{ width: '100%' }}
  274. precision={2}
  275. addonAfter="万元"
  276. disabled
  277. />
  278. </Form.Item>
  279. <Form.Item
  280. name="project_code"
  281. initialValue={data?.project_code}
  282. label="项目编号:"
  283. >
  284. <Input disabled />
  285. </Form.Item>
  286. <Form.Item
  287. name="party_b"
  288. label="乙方:"
  289. tooltip="合同主体可以下拉选择,可选项需要经办人在“主页--供应商管理”中创建。经办人可以维护和更新供应商信息。"
  290. initialValue={data?.party_b}
  291. rules={[
  292. {
  293. required: true,
  294. message: '请选择乙方',
  295. },
  296. ]}
  297. >
  298. <Input disabled />
  299. </Form.Item>
  300. </Col>
  301. </Row>
  302. <Form.Item
  303. name="party_c"
  304. label="丙方(及其他):"
  305. tooltip="可多选。合同主体可以下拉选择,可选项需要经办人在“主页--供应商管理”中创建。经办人可以维护和更新供应商信息。"
  306. initialValue={data?.party_c ? data?.party_c.split(',') : []}
  307. labelCol={{ span: 4 }}
  308. >
  309. <Input disabled />
  310. </Form.Item>
  311. <Form.Item
  312. name="perform"
  313. initialValue={data?.perform}
  314. label="合同履行情况:"
  315. labelCol={{ span: 4 }}
  316. >
  317. <Input.TextArea disabled />
  318. </Form.Item>
  319. <Row>
  320. <Col span={10} offset={1}>
  321. <Form.Item
  322. label="合同及合同附件上传:"
  323. tooltip="请上传合同正式盖章文本的扫描件(含技术协议、质保承诺等附件),不得用照片、图片格式,不得遗漏附件"
  324. name="attach"
  325. initialValue={attachData.attach}
  326. >
  327. <ul>
  328. {data?.attach &&
  329. JSON.parse(data?.attach)?.map((item, idx) => (
  330. <li key={`${idx}_${item.name}`}>
  331. <a onClick={() => handlePreViewSingle(item)}>
  332. {item.name}
  333. </a>
  334. </li>
  335. ))}
  336. </ul>
  337. </Form.Item>
  338. <Form.Item
  339. name="archives_dep"
  340. initialValue={data?.archives_dep}
  341. label="合同原件存档部门:"
  342. tooltip="母公司财务部和采购部门的合同请选择“财务部”,其他部门请选择“行政部”,子公司合同选择“综合管理部”"
  343. rules={[
  344. {
  345. required: true,
  346. message: '请选择合同原件存档部门',
  347. },
  348. ]}
  349. >
  350. <Input disabled />
  351. </Form.Item>
  352. </Col>
  353. <Col span={10}>
  354. <Form.Item
  355. name="attach_extend"
  356. label="合同相关资料上传:"
  357. initialValue={attachData.attach_extend}
  358. tooltip={
  359. <div>
  360. 依据《合同管理办法》,合同相关资料需要作为合同电子档案的一部分,包括:
  361. <br />
  362. 1)合同会审纪要或投资决策通知书(如有);
  363. <br />
  364. 2)合同相对方的营业执照等资质证的复印件(首次签约的须加盖公章)、个人身份证复印件(合同一方为自然人时提供);
  365. <br />
  366. 3)合同相对方经办人员的授权委托书原件及其身份证复印件(如有);
  367. <br />
  368. 4)
  369. 涉及房屋或场地租赁的,还应提供房屋及场地的权属证明资料,但如果续签租赁合同,且房屋所有权人没有发生变更的,在附具相关说明后可不再提供上述资料;
  370. <br />
  371. 5)其他资料。
  372. </div>
  373. }
  374. >
  375. <ul>
  376. {data?.attach_extend &&
  377. JSON.parse(data?.attach_extend)?.map((item, idx) => (
  378. <li key={`${idx}_${item.name}`}>
  379. <a onClick={() => handlePreViewSingle(item)}>
  380. {item.name}
  381. </a>
  382. </li>
  383. ))}
  384. </ul>
  385. </Form.Item>
  386. </Col>
  387. </Row>
  388. {data?.status > Status.Checking && (
  389. <>
  390. <ModuleTitle title="归档流程" />
  391. <div className={styles.modelItem}>
  392. <AuditSteps {...auditData} statusText="已归档" />
  393. </div>
  394. </>
  395. )}
  396. {data?.status > Status.CalChecking && (
  397. <>
  398. <ModuleTitle title="作废信息" />
  399. <Form.Item
  400. name="cancel_desc"
  401. label="作废原因:"
  402. initialValue={data?.cancel_desc}
  403. labelCol={{ span: 4 }}
  404. rules={[
  405. {
  406. required: true,
  407. message: '请填写作废原因',
  408. },
  409. ]}
  410. >
  411. <Input disabled />
  412. </Form.Item>
  413. </>
  414. )}
  415. </Form>
  416. </Card>
  417. <FileViewerModal
  418. data={fileViewerData}
  419. visible={fileViewerVisible}
  420. onCancel={() => {
  421. setFileViewerVisible(false);
  422. }}
  423. />
  424. </>
  425. );
  426. };
  427. export default ContractDetail;