|
|
import React, { useEffect, useState } from 'react';import { Table, Card } from 'antd';import { connect } from 'umi';
import { CCQK } from '@/utils/constants';import { getDicsName } from '@/utils/utils';/** * * * */
const columns = [ { title: '抽查时间', dataIndex: 'ccSj', }, { title: '抽查人', dataIndex: 'ccrMc', }, { title: '抽查结果', dataIndex: 'ccjg', key: 'id', render: (text) => getDicsName(CCQK, text), }, { title: '备注信息', dataIndex: 'bzxx', },]
const CCJG = (props) => { const { id, sysToken } = props; const [ccjg, setCcjg] = useState(null);
const getCcjg = () => { props.fetchCcjg({ id, sysToken }).then((data) => { if (data) { setCcjg(data); } }); }
useEffect(() => { getCcjg(); return () => { // cleanup
}; }, []);
if (!ccjg) return '';
return ( <Card title="抽查"> <Table columns={columns} dataSource={ccjg} /> </Card> );};
const mapStateToProps = ({ doing, }) => ({ doing,});const mapDispatchToProps = (dispatch) => ({ fetchCcjg(params) { return dispatch({ type: 'doing/fetchCcjg', payload: params }); },});export default connect(mapStateToProps, mapDispatchToProps)(CCJG);
|