22 lines
649 B
JavaScript
22 lines
649 B
JavaScript
import Table from "@cqsjjb/jjb-react-admin-component/Table";
|
|
import { getIndexColumn } from "../../utils/index";
|
|
import "./index.less";
|
|
|
|
function Table(props) {
|
|
const {
|
|
columns = [],
|
|
showIndexColumn = true,
|
|
useAlignCenter = true,
|
|
indexColumnFixed = "left",
|
|
rowKey = "id",
|
|
...restProps
|
|
} = props;
|
|
function calcColumns() {
|
|
showIndexColumn && columns.unshift({...getIndexColumn(props.pagination), fixed: indexColumnFixed});
|
|
return columns.map(item => ({ align: useAlignCenter ? "center" : "left", ...item }));
|
|
}
|
|
return <Table rowKey={rowKey} columns={calcColumns()} {...restProps} />;
|
|
}
|
|
|
|
export default Table;
|