山西督察-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.

73 lines
1.3 KiB

  1. import React, { useEffect, useState } from 'react';
  2. import { Table, Card } from 'antd';
  3. import { connect } from 'umi';
  4. import { CCQK } from '@/utils/constants';
  5. import { getDicsName } from '@/utils/utils';
  6. /**
  7. *
  8. *
  9. *
  10. */
  11. const columns = [
  12. {
  13. title: '抽查时间',
  14. dataIndex: 'ccSj',
  15. },
  16. {
  17. title: '抽查人',
  18. dataIndex: 'ccrMc',
  19. },
  20. {
  21. title: '抽查结果',
  22. dataIndex: 'ccjg',
  23. key: 'id',
  24. render: (text) => getDicsName(CCQK, text),
  25. },
  26. {
  27. title: '备注信息',
  28. dataIndex: 'bzxx',
  29. },
  30. ]
  31. const CCJG = (props) => {
  32. const { id, sysToken } = props;
  33. const [ccjg, setCcjg] = useState(null);
  34. const getCcjg = () => {
  35. props.fetchCcjg({ id, sysToken }).then((data) => {
  36. if (data) {
  37. setCcjg(data);
  38. }
  39. });
  40. }
  41. useEffect(() => {
  42. getCcjg();
  43. return () => {
  44. // cleanup
  45. };
  46. }, []);
  47. if (!ccjg) return '';
  48. return (
  49. <Card title="抽查">
  50. <Table
  51. columns={columns}
  52. dataSource={ccjg}
  53. />
  54. </Card>
  55. );
  56. };
  57. const mapStateToProps = ({ doing, }) => ({
  58. doing,
  59. });
  60. const mapDispatchToProps = (dispatch) => ({
  61. fetchCcjg(params) {
  62. return dispatch({ type: 'doing/fetchCcjg', payload: params });
  63. },
  64. });
  65. export default connect(mapStateToProps, mapDispatchToProps)(CCJG);