山西督察-superintend-distribute-web react
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.2 KiB

  1. import React, { useState, useEffect } from 'react';
  2. import { connect } from 'umi';
  3. import { Card, Button } from 'antd';
  4. import FormModal from '@/components/FormModal';
  5. import CardList from '@/components/CardList';
  6. const HCZJ = (props) => {
  7. const {
  8. id,
  9. sysToken,
  10. fetchHCZJtable,
  11. fetchAddHCZJ,
  12. fetchEditHCZJ,
  13. fetchDeleteHCZJ,
  14. onlyRead,
  15. } = props;
  16. const [visible, setVisible] = useState(false);
  17. const [dataList, setDataList] = useState([]);
  18. const getTable = () => {
  19. fetchHCZJtable({ pfId: id, sysToken }).then((res) => {
  20. if (res) {
  21. setDataList(res);
  22. }
  23. });
  24. };
  25. useEffect(() => {
  26. getTable();
  27. }, []);
  28. const handleOpenModal = () => {
  29. setVisible(true);
  30. };
  31. const handleCloseModal = () => {
  32. setVisible(false);
  33. };
  34. return (
  35. <Card title="核查证据">
  36. {
  37. !onlyRead &&
  38. <div className="rightButton">
  39. <Button type="primary" onClick={handleOpenModal} >
  40. 上传核查证据
  41. </Button>
  42. </div>
  43. }
  44. <div>
  45. <CardList
  46. onlyRead={onlyRead}
  47. sourceType={'zj'}
  48. dataSource={dataList}
  49. fetchDeleteHCZJ={fetchDeleteHCZJ}
  50. fetchEditHCZJ={fetchEditHCZJ}
  51. getTable={getTable}
  52. sysToken={sysToken}
  53. />
  54. </div>
  55. {visible && (
  56. <FormModal
  57. visible={visible}
  58. id={id}
  59. sysToken={sysToken}
  60. handleClose={handleCloseModal}
  61. sourceType={'zj'}
  62. actionType={'add'}
  63. fetchAddHCZJ={fetchAddHCZJ}
  64. getTable={getTable}
  65. />
  66. )}
  67. </Card>
  68. );
  69. };
  70. const mapStateToProps = ({ doing }) => ({
  71. ...doing,
  72. });
  73. const mapDispatchToProps = (dispatch) => ({
  74. fetchHCZJtable(params) {
  75. return dispatch({ type: 'doing/fetchHCZJtable', payload: { ...params } });
  76. },
  77. fetchAddHCZJ(params) {
  78. return dispatch({ type: 'doing/fetchAddHCZJ', payload: { ...params } });
  79. },
  80. fetchEditHCZJ(params) {
  81. return dispatch({ type: 'doing/fetchEditHCZJ', payload: { ...params } });
  82. },
  83. fetchDeleteHCZJ(params) {
  84. return dispatch({ type: 'doing/fetchDeleteHCZJ', payload: { ...params } });
  85. },
  86. });
  87. export default connect(mapStateToProps, mapDispatchToProps)(HCZJ);