177 lines
6.4 KiB
JavaScript
177 lines
6.4 KiB
JavaScript
/*
|
|
* CBS推送列表
|
|
*
|
|
* @Author: 黎永顺
|
|
* @Date: 2025/5/8
|
|
* @Wechat:
|
|
* @Email: 971387674@qq.com
|
|
* @description:
|
|
*/
|
|
import React, { Component } from "react";
|
|
import { WeaLocaleProvider, WeaTable, WeaTop } from "ecCom";
|
|
import { Button, message, Modal, Tag } from "antd";
|
|
import * as API from "../../../../apis/custom-apis/liante";
|
|
import LogDialog from "../../../../components/logViewModal";
|
|
import { MonthRangePicker } from "../../../reportView/components/statisticalMicroSettingsSlide";
|
|
import moment from "moment";
|
|
import "./index.less";
|
|
|
|
const getLabel = WeaLocaleProvider.getLabel;
|
|
|
|
class Index extends Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {
|
|
loading: false, columns: [], dataSource: [], selectedRowKeys: [],
|
|
pageInfo: { current: 1, pageSize: 10, total: 0 }, logDialogVisible: false,
|
|
queryParams: {
|
|
salaryYearMonth: [
|
|
moment(new Date()).subtract(1, "year").startOf("year").format("YYYY-MM"),
|
|
moment(new Date()).endOf("year").format("YYYY-MM")
|
|
]
|
|
},
|
|
filterConditions: "[]"
|
|
};
|
|
}
|
|
|
|
componentDidMount() {
|
|
this.getPushCBSList();
|
|
}
|
|
|
|
getPushCBSList = () => {
|
|
const { pageInfo, queryParams } = this.state;
|
|
const payload = { ...pageInfo, ...queryParams };
|
|
this.setState({ loading: true });
|
|
API.getPushCBSList(payload).then(({ status, data }) => {
|
|
this.setState({ loading: false });
|
|
if (status) {
|
|
const { columns, pageInfo: { list: dataSource, pageNum, pageSize, total } } = data;
|
|
this.setState({
|
|
dataSource, pageInfo: { pageNum, pageSize, total },
|
|
columns: [..._.map(_.filter(columns, col => col.column !== "acctTimes"), o => {
|
|
o = { dataIndex: o.column, title: o.text, width: o.width };
|
|
if (o.dataIndex === "salarySob") {
|
|
return {
|
|
...o, render: (text, record) => {
|
|
const { acctTimes } = record;
|
|
return <div className="salarySobNameWrapper">
|
|
<span title={text}>{text}</span>
|
|
<div className="salarySobNameTagWrapper">
|
|
<Tag color="blue">{`${getLabel(15323, "第")}${acctTimes}${getLabel(18929, "次")}`}</Tag>
|
|
</div>
|
|
</div>;
|
|
}
|
|
};
|
|
}
|
|
return o;
|
|
}), {
|
|
dataIndex: "options", title: getLabel(30585, "操作"),
|
|
width: 120, render: (_, record) => (<React.Fragment>
|
|
<a href={`/spa/hrmSalary/static/index.html#/main/hrmSalary/customPage_pushCBS_lt/${record.id}`}
|
|
target="_blank">
|
|
{getLabel(111, "推送")}
|
|
</a>
|
|
{/*<Dropdown*/}
|
|
{/* overlay={*/}
|
|
{/* <Menu>*/}
|
|
{/* <Menu.Item>*/}
|
|
{/* <a href="javascript:void(0);"*/}
|
|
{/* onClick={() => this.onDropMenuClick("log", record.id)}>{getLabel(545781, "操作日志")}</a>*/}
|
|
{/* </Menu.Item>*/}
|
|
{/* </Menu>*/}
|
|
{/* }>*/}
|
|
{/* <a href="javascript:void(0)"><i className="icon-coms-more"/></a>*/}
|
|
{/*</Dropdown>*/}
|
|
</React.Fragment>)
|
|
}]
|
|
});
|
|
}
|
|
});
|
|
};
|
|
pushDataToCBS = (isConfirm = false) => {
|
|
const { selectedRowKeys: salaryCbsIds } = this.state, payload = { salaryCbsIds, isConfirm };
|
|
API.pushDataToCBS(payload).then(({ status, data, errormsg }) => {
|
|
if (status && !!data) {
|
|
Modal.confirm({
|
|
title: getLabel(111, "提示信息"),
|
|
content: data,
|
|
onOk: () => {
|
|
this.pushDataToCBS(true);
|
|
}
|
|
});
|
|
} else if (status && !data) {
|
|
message.success(getLabel(111, "操作成功!"));
|
|
this.getPushCBSList();
|
|
} else if (!status) {
|
|
Modal.warning({ title: getLabel(111, "提示信息"), content: errormsg });
|
|
}
|
|
});
|
|
};
|
|
onDropMenuClick = (key, targetid = "") => {
|
|
switch (key) {
|
|
case "log":
|
|
this.setState({
|
|
logDialogVisible: true,
|
|
filterConditions: targetid ? `[{\"connectCondition\":\"AND\",\"columIndex\":\"targetid\",\"type\":\"=\",\"value\":\"${targetid}\"}]` : "[]"
|
|
});
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
};
|
|
|
|
render() {
|
|
const {
|
|
logDialogVisible, queryParams, filterConditions, dataSource, columns, pageInfo, loading, selectedRowKeys
|
|
} = this.state;
|
|
const { salaryYearMonth } = queryParams;
|
|
const pagination = {
|
|
...pageInfo,
|
|
showTotal: total => `${getLabel(18609, "共")} ${total} ${getLabel(18256, "条")}`,
|
|
showQuickJumper: true,
|
|
showSizeChanger: true,
|
|
pageSizeOptions: ["10", "20", "50", "100"],
|
|
onShowSizeChange: (current, pageSize) => {
|
|
this.setState({
|
|
pageInfo: { ...pageInfo, current, pageSize }
|
|
}, () => this.getPushCBSList());
|
|
},
|
|
onChange: current => {
|
|
this.setState({
|
|
pageInfo: { ...pageInfo, current }
|
|
}, () => this.getPushCBSList());
|
|
}
|
|
};
|
|
const rowSelection = {
|
|
selectedRowKeys, onChange: v => this.setState({ selectedRowKeys: v })
|
|
};
|
|
return (<WeaTop
|
|
title={getLabel(111, "CBS推送")} buttonSpace={10} className="pushCBS"
|
|
icon={<i className="icon-coms-fa"/>} iconBgcolor="#F14A2D" showDropIcon={false}
|
|
buttons={[
|
|
<Button type="primary" disabled={_.isEmpty(selectedRowKeys)}
|
|
onClick={() => this.pushDataToCBS()}>{getLabel(111, "推送")}</Button>,
|
|
<MonthRangePicker dateRange={salaryYearMonth} viewAttr={2}
|
|
onChange={v => this.setState({ queryParams: { salaryYearMonth: v } }, () => this.getPushCBSList())}/>
|
|
]}
|
|
onDropMenuClick={this.onDropMenuClick}
|
|
dropMenuDatas={[
|
|
{
|
|
key: "log", icon: <i className="iconfont icon-caozuorizhi32"/>,
|
|
content: getLabel(545781, "操作日志")
|
|
}
|
|
]}
|
|
>
|
|
<WeaTable
|
|
rowKey="id" scroll={{ x: 1200, y: "calc(100vh - 155px)" }}
|
|
dataSource={dataSource} loading={loading} rowSelection={rowSelection}
|
|
pagination={pagination} columns={columns}
|
|
/>
|
|
<LogDialog visible={logDialogVisible} logFunction="salarcitemadj" filterConditions={filterConditions}
|
|
onCancel={() => this.setState({ logDialogVisible: false })}/>
|
|
</WeaTop>);
|
|
}
|
|
}
|
|
|
|
export default Index;
|