1) 增加 映射分销商 模糊搜索

This commit is contained in:
zhangds 2022-04-15 18:10:10 +08:00
parent 3bf0ecc1a7
commit f608c84598
2 changed files with 23 additions and 10 deletions

View File

@ -10,6 +10,8 @@ const UseLazyLoadingSelect = ({
width, width,
onChangePage, onChangePage,
disabled = false, disabled = false,
onKeywordChange,
keyword = "",
}) => { }) => {
let firstOpen = true; let firstOpen = true;
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
@ -74,6 +76,8 @@ const UseLazyLoadingSelect = ({
disabled={disabled} disabled={disabled}
onOpenChange={handleOpenChange} onOpenChange={handleOpenChange}
renderOptionList={renderOptionList} renderOptionList={renderOptionList}
onKeywordChange={onKeywordChange}
keyword={keyword}
/> />
</div> </div>
); );

View File

@ -168,6 +168,7 @@ export default class adduserinfo extends React.Component {
], //身份类型 ], //身份类型
limit: 15, limit: 15,
page: 1, page: 1,
keyword: "",
}; };
} }
@ -190,16 +191,7 @@ export default class adduserinfo extends React.Component {
this.directList(params); this.directList(params);
} }
componentDidUpdate(prevProps, prevState) { componentDidUpdate(prevProps, prevState) {}
// 典型用法(不要忘记比较 props
if (this.state.page !== prevState.page) {
let params = {
limit: this.state.limit,
page: this.state.page,
};
this.directList(params);
}
}
// 获取分销商数据 // 获取分销商数据
directList(param) { directList(param) {
@ -298,6 +290,11 @@ export default class adduserinfo extends React.Component {
this.setState({ this.setState({
page: that.state.page + 1, page: that.state.page + 1,
}); });
let params = {
limit: this.state.limit,
page: that.state.page + 1,
};
this.directList(params);
closeLoading && closeLoading(); closeLoading && closeLoading();
} }
//校验分销商名称 //校验分销商名称
@ -536,6 +533,16 @@ export default class adduserinfo extends React.Component {
changeKind() { changeKind() {
this.setState({ pwdtype: "password" }); 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() { render() {
const companyOptions = this.state.companyList; const companyOptions = this.state.companyList;
//校验规则 //校验规则
@ -1147,6 +1154,8 @@ export default class adduserinfo extends React.Component {
value={this.state.model.direct_reseller_id} value={this.state.model.direct_reseller_id}
onChangePage={this.onChangePageSelect.bind(this)} onChangePage={this.onChangePageSelect.bind(this)}
disabled={this.state.isSelectDirect} disabled={this.state.isSelectDirect}
keyword={this.state.keyword}
onKeywordChange={this.onKeywordChange.bind(this)}
onChange={(e) => { onChange={(e) => {
this.onDirectChange(e); this.onDirectChange(e);
Bus.emit("change", "direct_reseller_id", e); Bus.emit("change", "direct_reseller_id", e);