fix page error[metadata/appauth/dict] (#199)
diff --git a/src/routes/System/AppAuth/SearchContent.js b/src/routes/System/AppAuth/SearchContent.js
index 5366014..b8cffd2 100644
--- a/src/routes/System/AppAuth/SearchContent.js
+++ b/src/routes/System/AppAuth/SearchContent.js
@@ -26,7 +26,6 @@
e.preventDefault();
const searchCont= this.props.form.getFieldsValue()
this.props.onClick(searchCont)
- // console.log(searchCont)
};
diff --git a/src/routes/System/AppAuth/index.js b/src/routes/System/AppAuth/index.js
index b97ce97..39dbb70 100644
--- a/src/routes/System/AppAuth/index.js
+++ b/src/routes/System/AppAuth/index.js
@@ -48,8 +48,7 @@
}
componentWillMount() {
- const { currentPage } = this.state;
- this.getAllAuths(currentPage);
+ this.query()
this.initPluginColumns();
}
@@ -74,10 +73,22 @@
};
onSelectChange = selectedRowKeys => {
- this.setState({ selectedRowKeys });
+ this.setState({ selectedRowKeys }, this.query);
};
- // 发送请求获取数据
+ query = () =>{
+ const { dispatch } = this.props;
+ const { appKey,phone,currentPage } = this.state;
+ dispatch({
+ type: "auth/fetch",
+ payload: {
+ appKey,
+ phone,
+ currentPage,
+ pageSize: 20
+ }
+ });
+ }
getAllAuths = page => {
const { dispatch } = this.props;
@@ -93,52 +104,31 @@
});
};
- // 发送请求获取所有元数据信息
- // getAllMetaDel = () => {
- // const { dispatch } = this.props;
- // dispatch({
- // type: "auth/fetchMeta",
- // payload: {
- // currentPage: 1,
- // pageSize: 10
- // },
- // callback: datas => datas
- // })
- // }
-
- // 分页数据
-
pageOnchange = page => {
- this.setState({ currentPage: page });
- this.getAllAuths(page);
+ this.setState({ currentPage: page }, this.query);
};
- // 关闭弹框
-
- closeModal = () => {
+ closeModal = (refresh) => {
+ if (refresh) {
+ this.setState({ popup: "" }, this.query);
+ }
this.setState({ popup: "" });
};
- // 编辑弹框
-
editClick = record => {
const { dispatch } = this.props;
const { currentPage } = this.state;
- // const authName = this.state.appKey;
dispatch({
type: "auth/fetchItem",
payload: {
id: record.id
},
callback: (auth) => {
-
this.setState({
popup: (
<AddModal
{...auth}
handleOk={values => {
- // const { appKey, appSecret, authParamVOList, enabled, id, phone,userId } = values;
- // 发送更新请求
dispatch({
type: "auth/update",
payload: {
@@ -151,7 +141,7 @@
pageSize: 20
},
callback: () => {
- this.closeModal();
+ this.closeModal(true);
}
});
}}
@@ -196,8 +186,6 @@
this.closeModal();
}}
handleOk={values => {
- // const { appKey, appSecret, enabled, id, authParamVOList } = values;
- // 发送更新请求
dispatch({
type: "auth/updateDel",
payload: values,
@@ -207,7 +195,7 @@
pageSize: 20
},
callback: () => {
- this.closeModal();
+ this.closeModal(true);
}
});
}}
@@ -216,43 +204,18 @@
})
}
})
-
}
})
}
-
-
- // 点击搜索事件
-
searchClick = res => {
- // console.log(res)
- const {dispatch} = this.props;
- dispatch({
- type: "auth/fetch",
- payload: {
- appKey: res.appKey?res.appKey:null,
- phone: res.phone?res.phone:null,
- pageSize: 20,
- currentPage: 1
- }
- })
-
-
-
-
-
-
- this.setState({ currentPage: 1 });
+ this.setState({ currentPage: 1, appKey : res.appKey, phone: res.phone, }, this.query);
};
- // 点击删除事件
-
deleteClick = () => {
const { dispatch } = this.props;
const { selectedRowKeys } = this.state;
if (selectedRowKeys && selectedRowKeys.length > 0) {
- // 发送删除请求
dispatch({
type: "auth/delete",
payload: {
@@ -260,7 +223,7 @@
},
fetchValue: {},
callback: () => {
- this.setState({ selectedRowKeys: [] })
+ this.setState({ selectedRowKeys: [], currentPage: 1,},this.query)
}
});
} else {
@@ -278,25 +241,21 @@
type: "auth/fetchMetaGroup",
payload: {},
callback: (metaGroup)=>{
-
this.setState({
popup: (
<AddTable
metaGroup={metaGroup}
handleOk={values => {
- // const { appKey, appSecret, enabled } = values;
- // 发送添加请求
dispatch({
type: "auth/add",
payload: values,
fetchValue: {
- // appKey: authName,
currentPage,
pageSize: 20
},
callback: () => {
- this.setState({ selectedRowKeys: [] })
- this.closeModal();
+ this.setState({ selectedRowKeys: [], currentPage : 1 })
+ this.closeModal(true);
}
});
}}
@@ -310,8 +269,6 @@
})
};
- // 批量启用或禁用
-
enableClick = () => {
const {dispatch} = this.props;
const {selectedRowKeys} = this.state;
@@ -330,7 +287,7 @@
},
fetchValue: {},
callback: () => {
- this.setState({selectedRowKeys: []});
+ this.setState({selectedRowKeys: []}, this.query);
}
})
}
@@ -442,7 +399,6 @@
fixed: "right",
render: (text, record) => {
return (
- // 弹窗中的编辑事件
<AuthButton perms="system:authen:edit">
<div
className="edit"
@@ -506,14 +462,8 @@
return (
<div className="plug-content-wrap">
- {/* 头部导航栏 */}
<div style={{ display: "flex",alignItems: 'center' }}>
-
-
- {/* 内联查询 */}
- <SearchContent onClick={res=>this.searchClick(res)} />
-
- {/* 删除勾选按钮 */}
+ <SearchContent onClick={this.searchClick} />
<AuthButton perms="system:authen:delete">
<Popconfirm
title={getIntlContent("SHENYU.COMMON.DELETE")}
@@ -532,7 +482,6 @@
</Button>
</Popconfirm>
</AuthButton>
- {/* 添加数据按钮 */}
<AuthButton perms="system:authen:add">
<Button
style={{ marginLeft: 20 }}
@@ -542,7 +491,6 @@
{getIntlContent("SHENYU.SYSTEM.ADDDATA")}
</Button>
</AuthButton>
- {/* 批量启用或禁用按钮 */}
<AuthButton perms="system:authen:disable">
<Button
style={{ marginLeft: 20 }}
@@ -552,7 +500,6 @@
{getIntlContent("SHENYU.PLUGIN.BATCH")}
</Button>
</AuthButton>
- {/* 同步数据按钮 */}
<AuthButton perms="system:authen:modify">
<Button
style={{ marginLeft: 20 }}
diff --git a/src/routes/System/Dict/index.js b/src/routes/System/Dict/index.js
index 517ce2f..a862ed3 100644
--- a/src/routes/System/Dict/index.js
+++ b/src/routes/System/Dict/index.js
@@ -45,8 +45,7 @@
}
componentWillMount() {
- const { currentPage } = this.state;
- this.getAllDict(currentPage);
+ this.query()
this.initPluginColumns();
}
@@ -71,27 +70,26 @@
};
onSelectChange = selectedRowKeys => {
- this.setState({ selectedRowKeys });
+ this.setState({ selectedRowKeys }, this.query);
};
- getAllDict = page => {
+ query = () =>{
const { dispatch } = this.props;
- const { type, dictName, dictCode } = this.state;
+ const { type, dictName, dictCode, currentPage } = this.state;
dispatch({
type: "shenyuDict/fetch",
payload: {
type,
dictName,
dictCode,
- currentPage: page,
+ currentPage,
pageSize: 12
}
});
- };
+ }
pageOnchange = page => {
- this.setState({ currentPage: page });
- this.getAllDict(page);
+ this.setState({ currentPage: page }, this.query);
};
closeModal = () => {
@@ -110,9 +108,7 @@
id: record.id
},
callback: user => {
- // console.log(user)
this.setState({
-
popup: (
<AddModal
isShow={false}
@@ -141,16 +137,7 @@
},
callback: () => {
this.closeModal();
- dispatch({
- type: "shenyuDict/fetch",
- payload: {
- type: currentType,
- dictName:currentDictName,
- dictCode:currentDictCode,
- pageSize: 12,
- callback: () => { }
- }
- });
+ this.query()
}
});
}}
@@ -165,23 +152,19 @@
};
searchTypeOnchange = e => {
- const type = e.target.value;
- this.setState({ type });
+ this.setState({ type : e.target.value, currentPage: 1}, this.query);
};
searchDictCodeOnchange = e => {
- const dictCode = e.target.value;
- this.setState({ dictCode });
+ this.setState({ dictCode : e.target.value, currentPage: 1}, this.query);
};
searchDictNameOnchange = e => {
- const dictName = e.target.value;
- this.setState({ dictName });
+ this.setState({ dictName : e.target.value ,currentPage: 1}, this.query);
};
searchClick = () => {
- this.getAllDict(1);
- this.setState({ currentPage: 1 });
+ this.setState({ currentPage: 1 }, this.query);
};
deleteClick = () => {
@@ -201,17 +184,7 @@
pageSize: 12
},
callback: () => {
- this.setState({ selectedRowKeys: [] });
- dispatch({
- type: "shenyuDict/fetch",
- payload: {
- type,
- dictName,
- dictCode,
- pageSize: 12,
- callback: () => { }
- }
- });
+ this.setState({ selectedRowKeys: [], currentPage: 1 }, this.query);
}
});
} else {
@@ -245,16 +218,7 @@
pageSize: 12
},
callback: () => {
- this.setState({ selectedRowKeys: [] });
- this.closeModal();
- dispatch({
- type: "shenyuDict/fetch",
- payload: {
- currentPage: 1,
- pageSize: 12,
- callback: () => { }
- }
- });
+ this.setState({ selectedRowKeys: [], currentPage: 1 }, this.query);
}
});
}}
@@ -268,7 +232,7 @@
enableClick = () => {
const { dispatch } = this.props;
- const { type, dictName, dictCode, selectedRowKeys } = this.state;
+ const {selectedRowKeys } = this.state;
if (selectedRowKeys && selectedRowKeys.length > 0) {
dispatch({
@@ -277,7 +241,6 @@
id: selectedRowKeys[0]
},
callback: user => {
-
dispatch({
type: "shenyuDict/updateEn",
payload: {
@@ -286,17 +249,7 @@
},
fetchValue: {},
callback: () => {
- this.setState({ selectedRowKeys: [] });
- dispatch({
- type: "shenyuDict/fetch",
- payload: {
- type,
- dictName,
- dictCode,
- pageSize: 12,
- callback: () => { }
- }
- });
+ this.setState({ selectedRowKeys: [], currentPage: 1 }, this.query);
}
});
}
@@ -312,7 +265,7 @@
localeName: locale
});
getCurrentLocale(this.state.localeName);
- };
+ }
initPluginColumns() {
this.setState({
diff --git a/src/routes/System/Metadata/index.js b/src/routes/System/Metadata/index.js
index 9c3e8d2..28f4375 100644
--- a/src/routes/System/Metadata/index.js
+++ b/src/routes/System/Metadata/index.js
@@ -43,8 +43,7 @@
}
componentWillMount() {
- const { currentPage } = this.state;
- this.getAllMetadata(currentPage);
+ this.query()
this.initPluginColumns();
}
@@ -69,25 +68,24 @@
};
onSelectChange = selectedRowKeys => {
- this.setState({ selectedRowKeys });
+ this.setState({ selectedRowKeys }, this.query);
};
- getAllMetadata = page => {
+ query = () => {
const { dispatch } = this.props;
- const { appName } = this.state;
+ const { appName, currentPage } = this.state;
dispatch({
type: "metadata/fetch",
payload: {
appName,
- currentPage: page,
+ currentPage,
pageSize: 12
}
});
};
pageOnchange = page => {
- this.setState({ currentPage: page });
- this.getAllMetadata(page);
+ this.setState({ currentPage: page }, this.query);
};
closeModal = () => {
@@ -104,16 +102,13 @@
id: record.id
},
callback: user => {
- // console.log(user)
this.setState({
-
popup: (
<AddModal
isShow={false}
{...user}
handleOk={values => {
const { appName, methodName,id, parameterTypes,path,pathDesc, rpcExt, rpcType, serviceName } = values;
-
dispatch({
type: "metadata/update",
payload: {
@@ -149,22 +144,17 @@
};
searchOnchange = e => {
- const appName = e.target.value;
- this.setState({ appName });
+ this.setState({ appName: e.target.value, currentPage: 1 },this.query);
};
searchClick = () => {
- this.getAllMetadata(1);
- this.setState({ currentPage: 1 });
+ this.setState({ currentPage: 1 }, this.query);
};
deleteClick = () => {
const { dispatch } = this.props;
const { appName, currentPage, selectedRowKeys } = this.state;
if (selectedRowKeys && selectedRowKeys.length > 0) {
- // console.log('000000000000000000')
- // console.log(selectedRowKeys)
- // console.log('000000000000000000')
dispatch({
type: "metadata/delete",
payload: {
@@ -176,7 +166,7 @@
pageSize: 12
},
callback: () => {
- this.setState({ selectedRowKeys: [] });
+ this.setState({ selectedRowKeys: [], currentPage: 1 }, this.query);
}
});
} else {
@@ -214,7 +204,7 @@
pageSize: 12
},
callback: () => {
- this.setState({ selectedRowKeys: [] });
+ this.setState({ selectedRowKeys: [], currentPage: 1 }, this.query);
this.closeModal();
}
});
@@ -251,7 +241,7 @@
pageSize: 12
},
callback: () => {
- this.setState({ selectedRowKeys: [] });
+ this.setState({ selectedRowKeys: [] }, this.query);
}
});
}