113 lines
3.2 KiB
JavaScript
113 lines
3.2 KiB
JavaScript
/*
|
|
* Author: 黎永顺
|
|
* name: 数据采集-列表
|
|
* Description:
|
|
* Date: 2023/2/17
|
|
*/
|
|
import React, { Component } from "react";
|
|
import { inject, observer } from "mobx-react";
|
|
import UnifiedTable from "../../components/UnifiedTable";
|
|
import { getTableDate } from "../../apis/cumDeduct";
|
|
import { Menu, Popover } from "antd";
|
|
|
|
@inject("taxAgentStore")
|
|
@observer
|
|
class DataTables extends Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {
|
|
loading: {
|
|
query: false
|
|
},
|
|
dataSource: [],
|
|
columns: [],
|
|
selectedRowKeys: [],
|
|
pageInfo: {
|
|
current: 1, pageSize: 10, total: 0
|
|
}
|
|
};
|
|
}
|
|
|
|
componentDidMount() {
|
|
this.getTableDate();
|
|
}
|
|
|
|
getTableDate = () => {
|
|
const { loading, pageInfo } = this.state;
|
|
const { url, payload } = this.props;
|
|
const module = { url, ...payload };
|
|
this.setState({ loading: { ...loading, query: true } });
|
|
getTableDate(module).then(({ status, data }) => {
|
|
this.setState({ loading: { ...loading, query: false } });
|
|
if (status) {
|
|
const { columns, list: dataSource, pageNum: current, pageSize, total } = data;
|
|
this.setState({
|
|
pageInfo: { ...pageInfo, current, pageSize, total },
|
|
dataSource,
|
|
columns
|
|
});
|
|
}
|
|
}).catch(() => this.setState({ loading: { ...loading, query: false } }));
|
|
};
|
|
|
|
render() {
|
|
const { columns, dataSource, loading } = this.state;
|
|
const { taxAgentStore: { showOperateBtn } } = this.props;
|
|
return <UnifiedTable
|
|
rowKey="id"
|
|
// rowSelection={rowSelection}
|
|
columns={_.map(columns, item => {
|
|
const { dataIndex } = item;
|
|
if (dataIndex === "username") {
|
|
return {
|
|
...item,
|
|
render: (text, record) => {
|
|
return <a
|
|
className="ellipsis"
|
|
href={`javaScript:openhrm(${record.employeeId});`}
|
|
onClick={e => window.pointerXY(e)}
|
|
title={text}
|
|
>
|
|
{text}
|
|
</a>;
|
|
}
|
|
};
|
|
} else if (dataIndex === "operate") {
|
|
return {
|
|
...item,
|
|
render: (text, record) => (
|
|
<div className="linkWapper">
|
|
<a href="javaScript:void(0);">查看明细</a>
|
|
{
|
|
showOperateBtn &&
|
|
<Popover
|
|
overlayClassName="moreIconWrapper"
|
|
placement="bottomRight"
|
|
content={<Menu onClick={(e) => this.handleOperate(e, record)}>
|
|
<Menu.Item key="edit">编辑</Menu.Item>
|
|
<Menu.Item key="delete">删除</Menu.Item>
|
|
</Menu>} title="">
|
|
<i className="icon-coms-more"/>
|
|
</Popover>
|
|
}
|
|
</div>
|
|
)
|
|
};
|
|
} else {
|
|
return {
|
|
...item,
|
|
render: (text) => {
|
|
return <span className="ellipsis" title={text}> {text} </span>;
|
|
}
|
|
};
|
|
}
|
|
})}
|
|
dataSource={dataSource}
|
|
// pagination={pagination}
|
|
loading={loading.query}
|
|
/>;
|
|
}
|
|
}
|
|
|
|
export default DataTables;
|