diff --git a/src/components/UseLazyLoadingSelect/index.js b/src/components/UseLazyLoadingSelect/index.js index 6063c127..c5b39f3f 100644 --- a/src/components/UseLazyLoadingSelect/index.js +++ b/src/components/UseLazyLoadingSelect/index.js @@ -10,6 +10,8 @@ const UseLazyLoadingSelect = ({ width, onChangePage, disabled = false, + onKeywordChange, + keyword = "", }) => { let firstOpen = true; const [loading, setLoading] = useState(true); @@ -74,6 +76,8 @@ const UseLazyLoadingSelect = ({ disabled={disabled} onOpenChange={handleOpenChange} renderOptionList={renderOptionList} + onKeywordChange={onKeywordChange} + keyword={keyword} /> ); diff --git a/src/pages/distributor/adddistributorinfo/adddistributorinfo.js b/src/pages/distributor/adddistributorinfo/adddistributorinfo.js index e9bc4c20..c12ae080 100644 --- a/src/pages/distributor/adddistributorinfo/adddistributorinfo.js +++ b/src/pages/distributor/adddistributorinfo/adddistributorinfo.js @@ -168,6 +168,7 @@ export default class adduserinfo extends React.Component { ], //身份类型 limit: 15, page: 1, + keyword: "", }; } @@ -190,16 +191,7 @@ export default class adduserinfo extends React.Component { this.directList(params); } - componentDidUpdate(prevProps, prevState) { - // 典型用法(不要忘记比较 props): - if (this.state.page !== prevState.page) { - let params = { - limit: this.state.limit, - page: this.state.page, - }; - this.directList(params); - } - } + componentDidUpdate(prevProps, prevState) {} // 获取分销商数据 directList(param) { @@ -298,6 +290,11 @@ export default class adduserinfo extends React.Component { this.setState({ page: that.state.page + 1, }); + let params = { + limit: this.state.limit, + page: that.state.page + 1, + }; + this.directList(params); closeLoading && closeLoading(); } //校验分销商名称 @@ -536,6 +533,16 @@ export default class adduserinfo extends React.Component { changeKind() { this.setState({ pwdtype: "password" }); } + onKeywordChange(e) { + console.log("keyword ==>", e); + let params = { + limit: this.state.limit, + page: this.state.page, + key_word: e, + }; + this.directList(params); + this.setState({ keyword: e }); + } render() { const companyOptions = this.state.companyList; //校验规则 @@ -1147,6 +1154,8 @@ export default class adduserinfo extends React.Component { value={this.state.model.direct_reseller_id} onChangePage={this.onChangePageSelect.bind(this)} disabled={this.state.isSelectDirect} + keyword={this.state.keyword} + onKeywordChange={this.onKeywordChange.bind(this)} onChange={(e) => { this.onDirectChange(e); Bus.emit("change", "direct_reseller_id", e);