159 lines
6.2 KiB
JavaScript
159 lines
6.2 KiB
JavaScript
/*
|
|
* CBS推送列表详情
|
|
* salaryCbsId
|
|
* @Author: 黎永顺
|
|
* @Date: 2025/5/8
|
|
* @Wechat:
|
|
* @Email: 971387674@qq.com
|
|
* @description:
|
|
*/
|
|
import React, { Component } from "react";
|
|
import { WeaInputSearch, WeaLoadingGlobal, WeaLocaleProvider, WeaReqTop } from "ecCom";
|
|
import { Button, Col, Dropdown, Menu, message, Modal, Row } from "antd";
|
|
import { WeaForm, WeaSwitch } from "comsMobx";
|
|
import * as API from "../../../../apis/custom-apis/liante";
|
|
import PushedDetailList from "./pushedDetailList";
|
|
import FormInfo from "../../../../components/FormInfo";
|
|
import { conditions } from "../conditions";
|
|
import cs from "classnames";
|
|
import "../cbsList/index.less";
|
|
|
|
const form = new WeaForm();
|
|
const getLabel = WeaLocaleProvider.getLabel;
|
|
|
|
class Index extends Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {
|
|
selectedKey: "0", baseInfo: {}, queryParams: {}, isQuery: false,
|
|
selectedRowKeys: [], showadvance: false
|
|
};
|
|
}
|
|
|
|
componentWillMount() {
|
|
form.initFormFields(conditions);
|
|
}
|
|
|
|
componentDidMount() {
|
|
const { params } = this.props, { salaryCbsId: id } = params;
|
|
API.getPushCBSBaseInfo({ id }).then(({ status, data }) => {
|
|
if (status) this.setState({ baseInfo: data });
|
|
});
|
|
}
|
|
|
|
pushDataToCBS = (ids, isConfirm, key = "") => {
|
|
const payload = !!key ? { [key]: ids, isConfirm, ...form.getFormParams() } : { ids, isConfirm };
|
|
const { isQuery } = this.state;
|
|
WeaLoadingGlobal.start();
|
|
API.pushDataToCBS(payload).then(({ status, data, errormsg }) => {
|
|
WeaLoadingGlobal.destroy();
|
|
if (status && !!data) {
|
|
Modal.confirm({
|
|
title: getLabel(111, "提示信息"),
|
|
content: data,
|
|
onOk: () => {
|
|
this.pushDataToCBS(ids, true, key);
|
|
}
|
|
});
|
|
} else if (status && !data) {
|
|
message.success(getLabel(111, "操作成功!"));
|
|
this.setState({ isQuery: !isQuery, selectedRowKeys: [] });
|
|
} else if (!status) {
|
|
Modal.warning({ title: getLabel(111, "提示信息"), content: errormsg });
|
|
}
|
|
});
|
|
};
|
|
|
|
onDropMenuClick = (key) => {
|
|
const { selectedRowKeys } = this.state;
|
|
switch (key) {
|
|
case "select":
|
|
this.pushDataToCBS(selectedRowKeys, false);
|
|
break;
|
|
case "all":
|
|
const { params } = this.props, { salaryCbsId } = params;
|
|
this.pushDataToCBS(salaryCbsId, false, "salaryCbsId");
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
};
|
|
|
|
render() {
|
|
const { selectedKey, baseInfo, queryParams, isQuery, selectedRowKeys, showadvance } = this.state;
|
|
const menu = (
|
|
<Menu onClick={({ key }) => this.onDropMenuClick(key)}>
|
|
<Menu.Item key="select" disabled={_.isEmpty(selectedRowKeys)}>{getLabel(111, "推送所选")}</Menu.Item>
|
|
</Menu>
|
|
);
|
|
const tabs = [
|
|
{
|
|
title: getLabel(111, "未推送"), key: "0",
|
|
buttons: [
|
|
<Dropdown.Button overlay={menu} type="primary"
|
|
onClick={() => this.onDropMenuClick("all")}>{getLabel(111, "全部推送")}</Dropdown.Button>,
|
|
<AdvanceWithInput form={form} onShowOrHide={() => this.setState({ showadvance: !showadvance })}
|
|
onSearch={() => this.setState({ isQuery: !isQuery })}/>
|
|
]
|
|
},
|
|
{
|
|
title: getLabel(111, "已推送"), key: "1", buttons: [
|
|
<AdvanceWithInput form={form} onShowOrHide={() => this.setState({ showadvance: !showadvance })}
|
|
onSearch={() => this.setState({ isQuery: !isQuery })}/>
|
|
]
|
|
}
|
|
];
|
|
const itemRender = {
|
|
username: (field, textAreaProps, form, formParams) => {
|
|
return (<WeaSwitch fieldConfig={{ ...field, ...textAreaProps }} form={form} formParams={formParams}
|
|
onChange={() => this.forceUpdate()}/>);
|
|
}
|
|
};
|
|
return (<WeaReqTop
|
|
title={getLabel(111, "CBS推送")} tabDatas={tabs} selectedKey={selectedKey} className="pushCBSDetailWrapper"
|
|
buttonSpace={10} icon={<i className="icon-coms-fa"/>} iconBgcolor="#F14A2D"
|
|
onChange={v => this.setState({
|
|
selectedKey: v, showadvance: false,
|
|
queryParams: { ...queryParams, name: "", salarySobId: "" }
|
|
})}
|
|
buttons={_.find(tabs, o => selectedKey === o.key).buttons}>
|
|
<div className={cs("advance-search-pannel", { "advance-search-pannel-show": showadvance })}>
|
|
<FormInfo center={false} colCount={2} itemRender={itemRender} form={form} formFields={conditions}/>
|
|
<div className="push-advanceSearch-buttons">
|
|
<span style={{ marginLeft: 15 }}><Button type="primary"
|
|
onClick={() => this.setState({
|
|
isQuery: !isQuery, showadvance: !showadvance
|
|
})}>{getLabel(388113, "搜索")}</Button></span>
|
|
<span style={{ marginLeft: 15 }}><Button type="ghost"
|
|
onClick={() => form.resetForm()}>{getLabel(2022, "重置")}</Button></span>
|
|
<span style={{ marginLeft: 15 }}><Button type="ghost"
|
|
onClick={() => this.setState({ showadvance: !showadvance })}>{getLabel(31129, "取消")}</Button></span>
|
|
</div>
|
|
</div>
|
|
<Row className="baseInfo-ant-row">
|
|
<Col span={2}>{getLabel(111, "薪资所属月")}:</Col>
|
|
<Col span={22}>{baseInfo.salaryMonth}</Col>
|
|
</Row>
|
|
<PushedDetailList
|
|
{...this.props} selectedKey={selectedKey} pushDataToCBS={this.pushDataToCBS} isQuery={isQuery}
|
|
selectedRowKeys={selectedRowKeys} form={form}
|
|
setSelectedRowKeys={v => this.setState({ selectedRowKeys: v })}/>
|
|
</WeaReqTop>);
|
|
}
|
|
}
|
|
|
|
export default Index;
|
|
|
|
const AdvanceWithInput = (props) => {
|
|
const { onShowOrHide, onSearch } = props;
|
|
return (<React.Fragment>
|
|
<div className="push-advanceSearch">
|
|
<WeaInputSearch value={form.getFormParams().username}
|
|
onChange={v => form.updateFields({ username: v || "" })}
|
|
onSearch={onSearch}/>
|
|
<Button type="ghost" className="push-advanceBtn" onClick={onShowOrHide}>{getLabel(111, "高级搜索")}</Button>
|
|
</div>
|
|
</React.Fragment>
|
|
);
|
|
};
|