salary-management-front/pc4mobx/hrmSalary/pages/custom-pages/liante/cbsDetail/index.js

88 lines
2.9 KiB
JavaScript

/*
* CBS推送列表详情
* salaryCbsId
* @Author: 黎永顺
* @Date: 2025/5/8
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
import React, { Component } from "react";
import { WeaLocaleProvider, WeaReqTop } from "ecCom";
import { Button, Col, message, Modal, Row } from "antd";
import * as API from "../../../../apis/custom-apis/liante";
import PushedDetailList from "./pushedDetailList";
import "../cbsList/index.less";
const getLabel = WeaLocaleProvider.getLabel;
class Index extends Component {
constructor(props) {
super(props);
this.state = {
selectedKey: "0", baseInfo: {}, queryParams: {}, isQuery: false,
selectedRowKeys: []
};
}
componentDidMount() {
const { params } = this.props, { salaryCbsId: id } = params;
API.getPushCBSBaseInfo({ id }).then(({ status, data }) => {
if (status) this.setState({ baseInfo: data });
});
}
pushDataToCBS = (ids, isConfirm) => {
const payload = { ids, isConfirm }, { isQuery } = this.state;
API.pushDataToCBS(payload).then(({ status, data, errormsg }) => {
if (status && !!data) {
Modal.confirm({
title: getLabel(111, "提示信息"),
content: data,
onOk: () => {
this.pushDataToCBS(ids, true);
}
});
} else if (status && !data) {
message.success(getLabel(111, "操作成功!"));
this.setState({ isQuery: !isQuery, selectedRowKeys: [] });
} else if (!status) {
Modal.warning({ title: getLabel(111, "提示信息"), content: errormsg });
}
});
};
render() {
const { selectedKey, baseInfo, queryParams, isQuery, selectedRowKeys } = this.state;
const tabs = [
{
title: getLabel(111, "未推送"), key: "0",
buttons: [
<Button type="primary" disabled={_.isEmpty(selectedRowKeys)}
onClick={() => this.pushDataToCBS(selectedRowKeys, false)}>{getLabel(111, "推送所选")}</Button>
]
},
{ title: getLabel(111, "已推送"), key: "1", buttons: [] }
];
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,
queryParams: { ...queryParams, name: "", salarySobId: "" }
})}
buttons={_.find(tabs, o => selectedKey === o.key).buttons}>
<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}
setSelectedRowKeys={v => this.setState({ selectedRowKeys: v })}/>
</WeaReqTop>);
}
}
export default Index;