知与行后台管理端

audit.jsx 6.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. import React, { useState, useEffect } from 'react';
  2. import { Col, Row, Button, Modal, Input, Pagination, message } from 'antd'
  3. import ZmageImg from '../../../components/ZmageImg/ZmageImg'
  4. import request from '../../../utils/request';
  5. import apis from '../../../services/apis';
  6. import { router } from 'umi';
  7. import AuthButton from '../../../components/AuthButton';
  8. import moment from 'moment';
  9. const unaudited = {
  10. // color :'rgb(255, 126, 72)'
  11. float: "right", fontWeight: "bold", marginRight: '30px'
  12. }
  13. const auditPass = {
  14. // color : '#FF7E48',
  15. color: 'green',
  16. float: "right", fontWeight: "bold", marginRight: '30px'
  17. }
  18. const noauditPass = {
  19. color: ' #fc515c',
  20. float: "right", fontWeight: "bold", marginRight: '30px'
  21. }
  22. function body (props) {
  23. const documentVerifyId = props.location.query.id
  24. const [data, setData] = useState([])
  25. const [datas, setDatas] = useState({})
  26. // const [status,setStatus] = useState()
  27. useEffect(() => {
  28. getList()
  29. // setVisible(false)
  30. // setReasonValue()
  31. // useState(2)
  32. }, [])
  33. // , documentVerifyId: documentVerifyId
  34. function getList (params) {
  35. // 网路请求
  36. console.log(props, '1111')
  37. request({ ...apis.system.documentVerifyDetail, urlData: { id: documentVerifyId }, params: params }).then(data => {
  38. console.log('data:', data.records)
  39. setDatas(data)
  40. setData(data.records)
  41. }).catch(err => {
  42. // eslint-disable-next-line no-unused-expressions
  43. })
  44. }
  45. const cancelPage = () => {
  46. router.push({
  47. pathname: '/system/document/list',
  48. });
  49. }
  50. const Card = (props) => {
  51. const [visible, setVisible] = useState()
  52. const [reasonValue, setReasonValue] = useState('')
  53. useEffect(() => {
  54. setVisible(false)
  55. }, [])
  56. function onVerify (params) {
  57. // 网路请求
  58. console.log(reasonValue, "111212")
  59. request({ ...apis.system.updateVerify, urlData: { id: props.data.documentVerifyId }, data: { verifyStatus: params, rejectReason: reasonValue } }).then(data => {
  60. console.log(data, "datadata")
  61. getList()
  62. }).catch(err => {
  63. })
  64. }
  65. const handleOk = (data) => {
  66. if (data == 1) {
  67. Modal.confirm({
  68. title: '审核通过后,将给当前用户发放积分 确认审核通过?',
  69. okText: '确认',
  70. cancelText: '取消',
  71. onOk () {
  72. onVerify(1)
  73. }
  74. });
  75. } else {
  76. setVisible(true)
  77. }
  78. }
  79. const showModal = () => {
  80. setVisible(true)
  81. };
  82. const handleOk1 = e => {
  83. console.log(reasonValue, "2222");
  84. if (reasonValue ) {
  85. // console.log(e);
  86. onVerify(2)
  87. console.log(reasonValue, "11111111");
  88. setVisible(false)
  89. } else {
  90. message.info("不能为空")
  91. }
  92. };
  93. const handleCancel = e => {
  94. setVisible(false)
  95. };
  96. const Reason = e => {
  97. console.log(e.target.value)
  98. // e.target.
  99. setReasonValue(e.target.value)
  100. }
  101. // console.log("props", props.data)
  102. const carddata = props.data.imgList
  103. return (
  104. <>
  105. <div style={{ background: '#ffffff', padding: '40px', marginTop: '30px', borderRadius: '12px', boxShadow: '0px 0px 16px 2px rgba(0,0,0,0.12)' }}>
  106. <p style={{ fontSize: '0.096rem' }}>
  107. <span>资料说明:{props.data.documentTitle} </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  108. <span style={props.data.verifyStatus == 0 ? unaudited : props.data.verifyStatus == 1 ? auditPass : noauditPass} >
  109. {props.data.verifyStatus == 0 ? "待审核" : props.data.verifyStatus == 1 ? "审核通过" : "不通过"}
  110. </span>
  111. </p>
  112. <p style={{ fontSize: '0.096rem' }}>提交时间:{moment(props.data.createDate).format('YYYY-MM-DD HH:mm:ss')} </p>
  113. <div style={{ fontSize: '0.096rem' }}>资料图片:
  114. <Row gutter={16}>
  115. {
  116. // data.consultant && data.consultant.projects.map((item, _) => <span>{item}</span>)
  117. carddata.map((data, inx) =>
  118. <Col span={4} style={{ textAlign: "center" }}>
  119. <ZmageImg style={{ width: '128px', height: '128px', marginTop: '30px' }} src={data.img} />
  120. </Col>
  121. )
  122. }
  123. </Row>
  124. </div>
  125. {props.data.verifyStatus == 0 && <div style={{ marginTop: '10px', display: 'flex', justifyContent: 'center' }}>
  126. <AuthButton name="admin.documentVerify.id.put" noRight={null}>
  127. <Button type="primary" style={{ marginTop: '30px' }} onClick={() => handleOk(1)}>通过</Button>
  128. </AuthButton>
  129. &nbsp;&nbsp;&nbsp;&nbsp;
  130. <AuthButton name="admin.documentVerify.id.put" noRight={null}>
  131. <Button style={{ marginTop: '30px' }} onClick={() => handleOk(2)}>不通过</Button>
  132. </AuthButton>
  133. </div>}
  134. {props.data.verifyStatus == 2 && <p style={{ fontSize: '0.096rem',marginTop: '30px' }}>驳回原因:{props.data.rejectReason} </p>}
  135. <Modal
  136. title="驳回原因"
  137. visible={visible}
  138. onOk={handleOk1}
  139. onCancel={handleCancel}
  140. okText="确认"
  141. cancelText="取消"
  142. >
  143. <Input value={reasonValue} onChange={e => Reason(e)} />
  144. </Modal>
  145. </div>
  146. </>
  147. )
  148. // return <div>111</div>
  149. }
  150. const changePageNum = (pageNumber) => {
  151. getList({ pageNum: pageNumber, pageSize: 5 })
  152. }
  153. return (
  154. <>
  155. {/* <div>111</div> */}
  156. <div>
  157. {
  158. // data.consultant && data.consultant.projects.map((item, _) => <span>{item}</span>)
  159. data.map((data, inx) =>
  160. <Card data={data}></Card>
  161. )
  162. }
  163. {/* <Card data = {data.records}></Card> */}
  164. <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
  165. <Pagination showQuickJumper defaultCurrent={1} total={datas.total} pageSize={datas.size} onChange={changePageNum} current={datas.current} />
  166. </div>
  167. </div>
  168. </>
  169. )
  170. }
  171. export default body