-
{title}
-
-
-
-
- this.setState({ searchValue })}
- placeholder="请输入方案名称"
- onSearch={() => {
- }}
- />
-
-
;
+ componentWillReceiveProps(nextProps, nextContext) {
+ if (nextProps.visible !== this.props.visible) {
+ nextProps.visible && this.sendRangeList(nextProps);
+ this.setState({ selectedRowKeys: [] });
+ }
+ }
+
+ sendRangeList = (props) => {
+ const { grantType, salarySendId, pageCurrent = {} } = props;
+ const { pageInfo, loading, searchValue: targetName } = this.state;
+ const payload = {
+ grantType,
+ salarySendId,
+ targetName,
+ ...pageInfo,
+ ...pageCurrent
+ };
+ this.setState({ loading: { ...loading, query: true } });
+ sendRangeList(payload).then(({ status, data }) => {
+ this.setState({ loading: { ...loading, query: false } });
+ if (status) {
+ const { pageNum: current, pageSize, total, columns, list: dataSource } = data;
+ this.setState({
+ pageInfo: { ...pageInfo, current, pageSize, total },
+ dataSource: _.map(dataSource, it => ({
+ ...it,
+ includeObj: _.map(it.includeObj, child => child.targetName).join(","),
+ excludeObj: _.map(it.excludeObj, child => child.targetName).join(",")
+ })),
+ columns
+ });
+ }
+ });
+ };
+ sendRangeDelete = () => {
+ const { selectedRowKeys, pageInfo } = this.state;
+ const { grantType, salarySendId } = this.props;
+ Modal.confirm({
+ title: "信息确认",
+ content: "确认要删除吗?",
+ onOk: () => {
+ sendRangeDelete(selectedRowKeys).then(({ status, errormsg }) => {
+ if (status) {
+ message.success("刪除成功");
+ this.setState({ selectedRowKeys: [] }, () => {
+ this.sendRangeList({
+ grantType, salarySendId,
+ pageCurrent: {
+ current: calcPageNo(pageInfo.total, pageInfo.current, 10, selectedRowKeys.length)
+ }
+ });
+ });
+ } else {
+ message.error(errormsg || "刪除失败");
+ }
+ });
+ },
+ onCancel: () => {
+ }
+ });
+ };
+ handleOperate = () => {
+ const { grantType, salarySendId, onWithdraw, onGrant } = this.props;
+ const { selectedRowKeys } = this.state;
+ if (_.isEmpty(selectedRowKeys)) {
+ message.warning("您没有需要处理的对象!");
+ return;
+ }
+ Modal.confirm({
+ title: "信息确认",
+ content: `您共选择${selectedRowKeys.length}个对象,确定要${grantType === "grant" ? "发放" : "撤回"}吗?`,
+ onCancel: () => {
+ },
+ onOk: () => {
+ if (grantType === "grant") {
+ onGrant({ ids: [salarySendId], salarySendRangeIds: selectedRowKeys });
+ } else if (grantType === "withdraw") {
+ onWithdraw({ ids: [salarySendId], salarySendRangeIds: selectedRowKeys });
+ }
+ }
+ });
};
render() {
- const { onCancel, visible } = this.props;
+ const { dataSource, columns, pageInfo, loading, selectedRowKeys, dialogVisible, searchValue } = this.state;
+ const { onCancel, visible, grantType, salarySendId, title } = this.props;
+ const pagination = {
+ ...pageInfo,
+ showTotal: total => `共 ${total} 条`,
+ showQuickJumper: true,
+ pageSizeOptions: ["10", "20", "50", "100"],
+ onChange: current => {
+ this.setState({
+ pageInfo: { ...pageInfo, current }
+ }, () => {
+ });
+ }
+ };
+ const rowSelection = {
+ selectedRowKeys,
+ onChange: (selectedRowKeys) => this.setState({ selectedRowKeys })
+ };
return (