2023-03-07 14:47:47 +08:00
|
|
|
|
/*
|
|
|
|
|
|
* Author: 黎永顺
|
|
|
|
|
|
* name: 考勤引用数据查看
|
|
|
|
|
|
* Description:
|
|
|
|
|
|
* Date: 2023/3/7
|
|
|
|
|
|
*/
|
|
|
|
|
|
import React, { Component } from "react";
|
2024-03-15 15:09:16 +08:00
|
|
|
|
import { WeaInputSearch, WeaLocaleProvider, WeaSlideModal, WeaTable, WeaTop } from "ecCom";
|
2023-03-07 14:47:47 +08:00
|
|
|
|
import { viewAttendQuote } from "../../../../apis/attendance";
|
2025-04-23 18:15:24 +08:00
|
|
|
|
import AttendanceDataEditSlide from "./attendanceDataEditSlide";
|
|
|
|
|
|
import { Button } from "antd";
|
2023-03-07 14:47:47 +08:00
|
|
|
|
import "./index.less";
|
|
|
|
|
|
|
2024-03-15 15:09:16 +08:00
|
|
|
|
const { getLabel } = WeaLocaleProvider;
|
|
|
|
|
|
|
2023-03-07 14:47:47 +08:00
|
|
|
|
class AttendanceDataViewSlide extends Component {
|
|
|
|
|
|
constructor(props) {
|
|
|
|
|
|
super(props);
|
|
|
|
|
|
this.state = {
|
2024-03-15 15:09:16 +08:00
|
|
|
|
loading: { query: false }, keyword: "", dataSource: [], columns: [],
|
2025-04-24 11:09:46 +08:00
|
|
|
|
pageInfo: { current: 1, pageSize: 10, total: 0 }, attendanceSlide: { visible: false, record: {} }
|
2023-03-07 14:47:47 +08:00
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentWillReceiveProps(nextProps, nextContext) {
|
2024-01-31 11:37:20 +08:00
|
|
|
|
if (nextProps.visible !== this.props.visible && nextProps.visible) {
|
|
|
|
|
|
document.querySelector(".attendanceRefWrapper").classList.add("zIndex0-attendance");
|
|
|
|
|
|
this.viewAttendQuote({}, nextProps);
|
|
|
|
|
|
} else if (nextProps.visible !== this.props.visible && !nextProps.visible) {
|
|
|
|
|
|
document.querySelector(".attendanceRefWrapper").classList.remove("zIndex0-attendance");
|
2024-08-07 14:05:32 +08:00
|
|
|
|
this.setState({ pageInfo: { current: 1, pageSize: 10, total: 0 } });
|
2024-01-31 11:37:20 +08:00
|
|
|
|
}
|
2023-03-07 14:47:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
viewAttendQuote = (extraPayload = {}, props) => {
|
|
|
|
|
|
const { loading, pageInfo, keyword } = this.state;
|
|
|
|
|
|
const { attendQuoteId } = props;
|
|
|
|
|
|
this.setState({ loading: { ...loading, query: true } });
|
|
|
|
|
|
viewAttendQuote({ ...pageInfo, attendQuoteId, keyword, ...extraPayload }).then(({ status, data }) => {
|
|
|
|
|
|
this.setState({ loading: { ...loading, query: false } });
|
|
|
|
|
|
if (status) {
|
|
|
|
|
|
const { columns, list: dataSource, pageNum: current, pageSize, total } = data.pageInfo;
|
|
|
|
|
|
this.setState({
|
2024-03-15 15:09:16 +08:00
|
|
|
|
pageInfo: { ...pageInfo, current, pageSize, total }, dataSource,
|
2025-04-23 10:52:06 +08:00
|
|
|
|
columns: [
|
|
|
|
|
|
..._.map(columns, (o, i) => ({ ...o, width: 150, fixed: i === 0 ? "left" : null })),
|
|
|
|
|
|
{
|
|
|
|
|
|
title: getLabel(111, "操作"), dataIndex: "operate", width: 80,
|
2025-04-24 11:09:46 +08:00
|
|
|
|
render: (__, record) => (<a href="JavaScript:void(0);" onClick={() => this.setState({
|
|
|
|
|
|
attendanceSlide: { visible: true, record }
|
|
|
|
|
|
})}>{getLabel(111, "编辑")}</a>)
|
2025-04-23 10:52:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
]
|
2023-03-07 14:47:47 +08:00
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
}).catch(() => this.setState({ loading: { ...loading, query: false } }));
|
|
|
|
|
|
};
|
|
|
|
|
|
handleExportAttendQuote = () => {
|
|
|
|
|
|
if (!this.handleDebounce) {
|
|
|
|
|
|
this.handleDebounce = _.debounce(() => {
|
|
|
|
|
|
const { attendQuoteId } = this.props;
|
|
|
|
|
|
const url = `${window.location.origin}/api/bs/hrmsalary/attendQuote/export?attendQuoteId=${attendQuoteId}`;
|
|
|
|
|
|
window.open(url, "_self");
|
|
|
|
|
|
this.handleDebounce = null;
|
|
|
|
|
|
}, 500);
|
|
|
|
|
|
}
|
|
|
|
|
|
this.handleDebounce();
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
|
const { showOperateBtn, salaryYearMonth, ...extra } = this.props;
|
2025-04-24 11:09:46 +08:00
|
|
|
|
const { columns, dataSource, loading, pageInfo, keyword, attendanceSlide } = this.state;
|
2023-03-07 14:47:47 +08:00
|
|
|
|
const pagination = {
|
|
|
|
|
|
...pageInfo,
|
|
|
|
|
|
showTotal: (total) => `共 ${total} 条`,
|
|
|
|
|
|
pageSizeOptions: ["10", "20", "50", "100"],
|
|
|
|
|
|
showSizeChanger: true,
|
|
|
|
|
|
showQuickJumper: true,
|
|
|
|
|
|
onShowSizeChange: (current, pageSize) => {
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
pageInfo: { ...pageInfo, current, pageSize }
|
|
|
|
|
|
}, () => this.viewAttendQuote({}, this.props));
|
|
|
|
|
|
},
|
|
|
|
|
|
onChange: (current) => {
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
pageInfo: { ...pageInfo, current }
|
|
|
|
|
|
}, () => this.viewAttendQuote({}, this.props));
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
2024-03-15 15:09:16 +08:00
|
|
|
|
const btns = [
|
|
|
|
|
|
<Button type="primary" onClick={this.handleExportAttendQuote}>{getLabel(81272, "导出全部")}</Button>,
|
|
|
|
|
|
<WeaInputSearch
|
|
|
|
|
|
value={keyword} placeholder={getLabel(543380, "请输入姓名/部门/工号/手机号")}
|
|
|
|
|
|
onChange={keyword => this.setState({ keyword })}
|
|
|
|
|
|
onSearch={() => this.viewAttendQuote({ current: 1 }, this.props)}
|
|
|
|
|
|
/>
|
|
|
|
|
|
];
|
2023-03-07 14:47:47 +08:00
|
|
|
|
return (
|
2025-04-23 10:52:06 +08:00
|
|
|
|
<WeaSlideModal {...extra} className="attendanceSlideWrapper" top={0} height={100} width={100} measure="%"
|
|
|
|
|
|
direction="right" title={
|
|
|
|
|
|
<WeaTop title={getLabel(525196, "考勤数据")} icon={<i className="icon-coms-fa"/>}
|
|
|
|
|
|
iconBgcolor="#F14A2D"
|
|
|
|
|
|
buttons={showOperateBtn ? btns : btns.slice(1)}/>
|
|
|
|
|
|
}
|
2024-03-15 15:09:16 +08:00
|
|
|
|
content={
|
|
|
|
|
|
<div className="attendance-slide-body">
|
|
|
|
|
|
<div className="attendance-tb-tip">
|
|
|
|
|
|
<div>{getLabel(543376, "考勤周期")}:{salaryYearMonth}</div>
|
|
|
|
|
|
<div></div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<WeaTable
|
|
|
|
|
|
columns={columns} dataSource={dataSource} bordered pagination={pagination}
|
2024-12-04 17:06:29 +08:00
|
|
|
|
loading={loading.query} scroll={{ x: 1200, y: `calc(100vh - 240px)` }}/>
|
2025-04-24 11:09:46 +08:00
|
|
|
|
<AttendanceDataEditSlide {...attendanceSlide}
|
|
|
|
|
|
onSuccess={() => this.viewAttendQuote({}, this.props)}
|
|
|
|
|
|
onClose={() => this.setState({
|
|
|
|
|
|
attendanceSlide: { ...attendanceSlide, visible: false }
|
|
|
|
|
|
})}/>
|
2024-03-15 15:09:16 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
}
|
2023-03-07 14:47:47 +08:00
|
|
|
|
/>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export default AttendanceDataViewSlide;
|