提交 99eed3ea authored 作者: 钟是志's avatar 钟是志

Merge remote-tracking branch 'origin/master'

...@@ -75,11 +75,14 @@ class ListWithAddEditTemplate extends React.Component { ...@@ -75,11 +75,14 @@ class ListWithAddEditTemplate extends React.Component {
if (!headerList) return; if (!headerList) return;
this.setState({ headerList }); this.setState({ headerList });
this.columns = headerList.filter(i => !i.isHidden).slice(0, 10).map(item => ({ this.columns = headerList
title: item.title, .filter(i => !i.isHidden)
dataIndex: item.name, .slice(0, 10)
render: date.includes(item.type) && dateRender, .map(item => ({
})); title: item.title,
dataIndex: item.name,
render: date.includes(item.type) && dateRender,
}));
const operation = { const operation = {
title: '操作', title: '操作',
render: (_, record) => { render: (_, record) => {
...@@ -161,7 +164,10 @@ class ListWithAddEditTemplate extends React.Component { ...@@ -161,7 +164,10 @@ class ListWithAddEditTemplate extends React.Component {
getPage = () => { getPage = () => {
const { objId, filters = {} } = this.props; const { objId, filters = {} } = this.props;
const { formValues, pageData: pagination } = this.state; const {
formValues,
pageData: { pagination },
} = this.state;
const query = { ...formValues, ...filters }; const query = { ...formValues, ...filters };
const pageNo = pagination.current ? pagination.current : 1; const pageNo = pagination.current ? pagination.current : 1;
const pageSize = pagination.pageSize ? pagination.pageSize : 10; const pageSize = pagination.pageSize ? pagination.pageSize : 10;
...@@ -184,21 +190,12 @@ class ListWithAddEditTemplate extends React.Component { ...@@ -184,21 +190,12 @@ class ListWithAddEditTemplate extends React.Component {
}; };
handleStandardTableChange = (pagination, filtersArg, sorter) => { handleStandardTableChange = (pagination, filtersArg, sorter) => {
const filters = Object.keys(filtersArg).reduce((obj, key) => { this.setState(
const newObj = { ...obj }; ({ pageData }) => ({
newObj[key] = getValue(filtersArg[key]); pageData: { ...pageData, pagination },
return newObj; }),
}, {}); this.getPage
);
const params = {
pageNo: pagination.current,
pageSize: pagination.pageSize,
...filters,
};
if (sorter.field) {
params.sorter = `${sorter.field}_${sorter.order}`;
}
this.getPage(params);
}; };
handleAdd = () => { handleAdd = () => {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论