2022-06-29 10:13:21 +08:00
|
|
|
/*
|
|
|
|
|
* Author: 黎永顺
|
2022-09-13 16:39:15 +08:00
|
|
|
* Description:
|
2022-06-29 10:13:21 +08:00
|
|
|
* Date: 2022-05-19 15:18:09
|
|
|
|
|
* LastEditTime: 2022-06-29 10:06:13
|
|
|
|
|
*/
|
2022-09-13 16:39:15 +08:00
|
|
|
import React from "react";
|
2023-03-06 15:06:56 +08:00
|
|
|
import { WeaCheckbox, WeaDialog, WeaInputSearch } from "ecCom";
|
|
|
|
|
import { Button } from "antd";
|
|
|
|
|
import "./index.less";
|
2022-03-14 17:07:26 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
export default class SelectItemModal extends React.Component {
|
2022-09-13 16:39:15 +08:00
|
|
|
constructor(props) {
|
|
|
|
|
super(props);
|
|
|
|
|
this.state = {
|
|
|
|
|
searchValue: ""
|
|
|
|
|
};
|
|
|
|
|
}
|
2022-03-14 17:07:26 +08:00
|
|
|
|
2023-03-06 15:06:56 +08:00
|
|
|
componentWillReceiveProps(nextProps, nextContext) {
|
|
|
|
|
if (
|
|
|
|
|
nextProps.visible !== this.props.visible &&
|
|
|
|
|
!nextProps.visible
|
|
|
|
|
) this.setState({ searchValue: "" });
|
2022-09-13 16:39:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render() {
|
2023-03-06 15:06:56 +08:00
|
|
|
const { searchValue } = this.state;
|
2023-03-07 14:47:47 +08:00
|
|
|
const { title, onSearchItemSet, onShowOnlyChecked, children, ...extra } = this.props;
|
2023-03-06 15:06:56 +08:00
|
|
|
const btns = [<Button type="primary">保存</Button>];
|
|
|
|
|
const moreBtn = {
|
|
|
|
|
datas: [
|
|
|
|
|
{
|
|
|
|
|
key: "recovery",
|
|
|
|
|
content: "恢复默认设置",
|
|
|
|
|
icon: <i className="icon-coms-Flow-setting"/>,
|
|
|
|
|
onClick: key => alert(`点击事物处理函数接受的实参为 ${key}`)
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "setting",
|
|
|
|
|
content: "设为默认设置",
|
|
|
|
|
icon: <i className="icon-coms-Flow-setting"/>,
|
|
|
|
|
onClick: key => alert(`点击事物处理函数接受的实参为 ${key}`)
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
const titleComp = <div className="setHeaderWrapper">
|
|
|
|
|
<span>{title}</span>
|
|
|
|
|
<WeaInputSearch value={searchValue} onChange={searchValue => this.setState({ searchValue })}
|
|
|
|
|
placeholder="请输入关键字" style={{ width: 200 }}
|
|
|
|
|
onSearch={onSearchItemSet}
|
|
|
|
|
/>
|
|
|
|
|
</div>;
|
|
|
|
|
const bottomLeft = <WeaCheckbox content="只显示已选中字段" onChange={onShowOnlyChecked}/>;
|
2022-09-13 16:39:15 +08:00
|
|
|
return (
|
2023-03-06 15:06:56 +08:00
|
|
|
<WeaDialog {...extra} hasScroll title={titleComp}
|
|
|
|
|
style={{ width: 592, height: 248 }}
|
|
|
|
|
buttons={btns} moreBtn={moreBtn}
|
|
|
|
|
initLoadCss className="setWrapper"
|
|
|
|
|
bottomLeft={bottomLeft}
|
2022-09-13 16:39:15 +08:00
|
|
|
>
|
2023-03-06 15:06:56 +08:00
|
|
|
{children}
|
2022-09-13 16:39:15 +08:00
|
|
|
</WeaDialog>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|