Merge pull request #256 from catchonme/master

修复crud同步地址栏数据格式不一致导致initFetch失效
This commit is contained in:
liaoxuezhi 2019-09-24 11:25:38 +08:00 committed by GitHub
commit db4b77f46a
4 changed files with 6 additions and 5 deletions

View File

@ -168,7 +168,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
if (syncLocation && location && (location.query || location.search)) {
store.updateQuery(
location.query || qs.parse(location.search.substring(1)),
qs.parse(location.search.substring(1)),
undefined,
pageField,
perPageField
@ -218,7 +218,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
if (props.syncLocation && props.location && props.location.search !== nextProps.location.search) {
// 同步地址栏,那么直接检测 query 是否变了,变了就重新拉数据
store.updateQuery(
nextProps.location.query || qs.parse(nextProps.location.search.substring(1)),
qs.parse(nextProps.location.search.substring(1)),
undefined,
nextProps.pageField,
nextProps.perPageField
@ -413,6 +413,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
search: boolean = true
) {
const {store, syncLocation, env, pageField, perPageField} = this.props;
values = syncLocation ? qs.parse(qs.stringify(values)) : values;
store.updateQuery(
{

View File

@ -1322,7 +1322,7 @@ export default class Table extends React.Component<TableProps, object> {
<div className={cx('Table-header', headerClassName)} key="header">
{render('header', header, {
...(editable === false ? otherProps : null),
ata: store.getData(data)
data: store.getData(data)
})}
</div>
) : null;

View File

@ -91,7 +91,7 @@ export const CRUDStore = ServiceStore.named('CRUDStore')
updater &&
isObjectShallowModified(originQuery, self.query, false) &&
setTimeout(() => updater(`?${qs.stringify(self.query)}`), 4);
setTimeout(() => updater(`?${qs.stringify(self.query, { encodeValuesOnly: true })}`), 4);
}
const fetchInitData: (

View File

@ -263,7 +263,7 @@ export const TableStore = iRendererStore
return createObject(superData, {
items: self.rows.map(item => item.data),
selectedItems: self.selectedRows.map(item => item.data),
unSeelctedItems: getUnSelectedRows().map(item => item.data)
unSelectedItems: getUnSelectedRows().map(item => item.data)
});
}