Merge branch 'feature/2.19.1.2501.01-考勤数据编辑' into custom/西部信托0401
# Conflicts: # pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js # pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js
This commit is contained in:
commit
c765d95892
|
|
@ -73,6 +73,10 @@ export const importAttendQuoteData = (params) => {
|
|||
export const viewAttendQuote = (params) => {
|
||||
return postFetch("/api/bs/hrmsalary/attendQuote/view", params);
|
||||
};
|
||||
// 批量删除考勤详情
|
||||
export const batchDeleteData = (params) => {
|
||||
return postFetch("/api/bs/hrmsalary/attendQuote/batchDeleteData", params);
|
||||
};
|
||||
|
||||
// 根据所属月和账套获取周期
|
||||
export const getSalaryCycleAndAttendCycle = (params) => {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import SelectItemsWrapper from "../../../../components/selectItemsModal/selectIt
|
|||
import AttendanceRefrenceDataModal from "./attendanceRefrenceDataModal";
|
||||
import AttendanceDataViewSlide from "./attendanceDataViewSlide";
|
||||
import { postFetch } from "../../../../util/request";
|
||||
import { calcPageNo } from "../../../../util";
|
||||
|
||||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
|
||||
|
|
@ -33,17 +34,8 @@ class AttendanceDataComp extends Component {
|
|||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
loading: {
|
||||
query: false,
|
||||
headset: false
|
||||
},
|
||||
dataSource: [],
|
||||
columns: [],
|
||||
pageInfo: {
|
||||
current: 1,
|
||||
pageSize: 10,
|
||||
total: 0
|
||||
},
|
||||
loading: { query: false, headset: false },
|
||||
dataSource: [], columns: [], pageInfo: { current: 1, pageSize: 10, total: 0 },
|
||||
importData: { visible: false, params: {} },
|
||||
importFormPayload: {
|
||||
salaryYearMonth: moment().format("YYYY-MM"), salarySobList: [],
|
||||
|
|
@ -134,15 +126,24 @@ class AttendanceDataComp extends Component {
|
|||
}
|
||||
});
|
||||
};
|
||||
handleDeleteAttendanceData = ({ id }) => {
|
||||
handleDeleteAttendanceData = (payload) => {
|
||||
Modal.confirm({
|
||||
title: "信息确认",
|
||||
content: "确认要删除吗?",
|
||||
onOk: () => {
|
||||
deleteAttendance([id]).then(({ status, errormsg }) => {
|
||||
const { pageInfo } = this.state;
|
||||
deleteAttendance(payload).then(({ status, errormsg }) => {
|
||||
if (status) {
|
||||
message.success("删除成功");
|
||||
this.getAttendanceList();
|
||||
this.setState({
|
||||
pageInfo: {
|
||||
...this.state.pageInfo,
|
||||
current: calcPageNo(pageInfo.total, pageInfo.current, 10, payload.length)
|
||||
}
|
||||
}, () => {
|
||||
this.getAttendanceList();
|
||||
this.props.onChangeSelectedRowKeys([]);
|
||||
});
|
||||
} else {
|
||||
message.error(errormsg || "删除失败");
|
||||
}
|
||||
|
|
@ -288,7 +289,7 @@ class AttendanceDataComp extends Component {
|
|||
dataSource, columns, pageInfo, loading, importData, importFormPayload, fieldSetPayload,
|
||||
attendanceReferencePayload, attendanceViewPayload
|
||||
} = this.state;
|
||||
const { salaryYearMonth } = this.props;
|
||||
const { salaryYearMonth, selectedRowKeys, onChangeSelectedRowKeys } = this.props;
|
||||
const pagination = {
|
||||
...pageInfo,
|
||||
showTotal: total => `共 ${total} 条`,
|
||||
|
|
@ -306,6 +307,7 @@ class AttendanceDataComp extends Component {
|
|||
}, () => this.getAttendanceList({ salaryYearMonth: _.compact(salaryYearMonth) }));
|
||||
}
|
||||
};
|
||||
const rowSelection = { selectedRowKeys, onChange: onChangeSelectedRowKeys };
|
||||
return (
|
||||
<React.Fragment>
|
||||
<WeaTable
|
||||
|
|
@ -323,7 +325,7 @@ class AttendanceDataComp extends Component {
|
|||
{opts.includes("admin") &&
|
||||
<React.Fragment>
|
||||
<a href="javascript: void(0);" style={{ marginRight: 10 }}
|
||||
onClick={() => this.handleDeleteAttendanceData(record)}>删除</a>
|
||||
onClick={() => this.handleDeleteAttendanceData([record.id])}>删除</a>
|
||||
<Dropdown
|
||||
overlay={
|
||||
<Menu>
|
||||
|
|
@ -355,7 +357,7 @@ class AttendanceDataComp extends Component {
|
|||
);
|
||||
}
|
||||
}
|
||||
]}
|
||||
]} rowSelection={rowSelection} rowKey="id"
|
||||
dataSource={dataSource} pagination={pagination} loading={loading.query}/>
|
||||
{/* 考勤引用导入 */}
|
||||
<ImportModal {...importData} importFormPayload={importFormPayload} onCancel={this.handleFinish}
|
||||
|
|
|
|||
|
|
@ -6,10 +6,11 @@
|
|||
*/
|
||||
import React, { Component } from "react";
|
||||
import { WeaInputSearch, WeaLocaleProvider, WeaSlideModal, WeaTop } from "ecCom";
|
||||
import { viewAttendQuote } from "../../../../apis/attendance";
|
||||
import { batchDeleteData, viewAttendQuote } from "../../../../apis/attendance";
|
||||
import AttendanceDataEditSlide from "./attendanceDataEditSlide";
|
||||
import { Button, Spin } from "antd";
|
||||
import { Button, message, Modal, Spin } from "antd";
|
||||
import "./index.less";
|
||||
import { calcPageNo } from "../../../../util";
|
||||
|
||||
const { getLabel } = WeaLocaleProvider;
|
||||
|
||||
|
|
@ -17,7 +18,7 @@ class AttendanceDataViewSlide extends Component {
|
|||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
loading: { query: false }, keyword: "", dataSource: [],
|
||||
loading: { query: false, del: false }, keyword: "", dataSource: [], selectedRowKeys: [],
|
||||
pageInfo: { current: 1, pageSize: 10, total: 0 }, attendanceSlide: { visible: false, record: {} }
|
||||
};
|
||||
}
|
||||
|
|
@ -40,6 +41,10 @@ class AttendanceDataViewSlide extends Component {
|
|||
case "EDIT":
|
||||
this.setState({ attendanceSlide: { visible: true, record: params } });
|
||||
break;
|
||||
case "CHECKBOX":
|
||||
const { selectedRowKeys } = params;
|
||||
this.setState({ selectedRowKeys });
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -52,13 +57,12 @@ class AttendanceDataViewSlide extends Component {
|
|||
this.viewAttendQuote({}, nextProps);
|
||||
} else if (nextProps.visible !== this.props.visible && !nextProps.visible) {
|
||||
document.querySelector(".attendanceRefWrapper").classList.remove("zIndex0-attendance");
|
||||
this.setState({ pageInfo: { current: 1, pageSize: 10, total: 0 } });
|
||||
this.setState({ selectedRowKeys: [], pageInfo: { current: 1, pageSize: 10, total: 0 } });
|
||||
}
|
||||
}
|
||||
|
||||
viewAttendQuote = (extraPayload = {}, props) => {
|
||||
const { loading, pageInfo, keyword } = this.state;
|
||||
const { attendQuoteId } = props || this.props;
|
||||
const { loading, pageInfo, keyword, selectedRowKeys } = this.state, { attendQuoteId } = props || this.props;
|
||||
this.setState({ loading: { ...loading, query: true } });
|
||||
viewAttendQuote({ ...pageInfo, attendQuoteId, keyword, ...extraPayload }).then(({ status, data }) => {
|
||||
this.setState({ loading: { ...loading, query: false } });
|
||||
|
|
@ -67,7 +71,8 @@ class AttendanceDataViewSlide extends Component {
|
|||
this.setState({
|
||||
pageInfo: { ...pageInfo, current, pageSize, total }, dataSource
|
||||
}, () => this.postMessageToChild({
|
||||
pageInfo: this.state.pageInfo, dataSource, showRowSelection: false, unitTableType: "attendanceView",
|
||||
pageInfo: this.state.pageInfo, dataSource, showRowSelection: true, unitTableType: "attendanceView",
|
||||
selectedRowKeys,
|
||||
columns: [
|
||||
..._.map(columns, (o, i) => ({ ...o, width: 150, fixed: i === 0 ? "left" : false })),
|
||||
{
|
||||
|
|
@ -98,12 +103,38 @@ class AttendanceDataViewSlide extends Component {
|
|||
}
|
||||
this.handleDebounce();
|
||||
};
|
||||
batchDeleteData = () => {
|
||||
Modal.confirm({
|
||||
title: getLabel(111, "信息确认"),
|
||||
content: getLabel(111, "确认要删除吗?"),
|
||||
onOk: () => {
|
||||
const { selectedRowKeys, pageInfo, loading } = this.state;
|
||||
this.setState({ loading: { ...loading, del: true } });
|
||||
batchDeleteData({ attendQuoteDataIds: selectedRowKeys }).then(({ status, errormsg }) => {
|
||||
if (status) {
|
||||
message.success(getLabel(111, "操作成功!"));
|
||||
this.setState({
|
||||
selectedRowKeys: [], loading: { ...loading, del: false },
|
||||
pageInfo: {
|
||||
...pageInfo,
|
||||
current: calcPageNo(pageInfo.total, pageInfo.current, 10, selectedRowKeys.length)
|
||||
}
|
||||
}, () => this.viewAttendQuote());
|
||||
} else {
|
||||
message.error(errormsg);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
const { showOperateBtn, salaryYearMonth, ...extra } = this.props;
|
||||
const { loading, keyword, attendanceSlide } = this.state;
|
||||
const { loading, keyword, attendanceSlide, selectedRowKeys } = this.state;
|
||||
const btns = [
|
||||
<Button type="primary" onClick={this.handleExportAttendQuote}>{getLabel(81272, "导出全部")}</Button>,
|
||||
<Button type="ghost" disabled={_.isEmpty(selectedRowKeys)}
|
||||
onClick={this.batchDeleteData}>{getLabel(111, "批量删除")}</Button>,
|
||||
<WeaInputSearch
|
||||
value={keyword} placeholder={getLabel(543380, "请输入姓名/部门/工号/手机号")}
|
||||
onChange={keyword => this.setState({ keyword })}
|
||||
|
|
@ -115,7 +146,7 @@ class AttendanceDataViewSlide extends Component {
|
|||
direction="right" title={
|
||||
<WeaTop title={getLabel(525196, "考勤数据")} icon={<i className="icon-coms-fa"/>}
|
||||
iconBgcolor="#F14A2D"
|
||||
buttons={showOperateBtn ? btns : btns.slice(1)}/>
|
||||
buttons={showOperateBtn ? btns : btns.slice(2)}/>
|
||||
}
|
||||
content={
|
||||
<div className="attendance-slide-body">
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class Index extends Component {
|
|||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
fieldName: "", selectedKey: "DATA", salaryMonth: [],
|
||||
fieldName: "", selectedKey: "DATA", salaryMonth: [], selectedRowKeys: [],
|
||||
logDialogVisible: false, filterConditions: "[]"
|
||||
};
|
||||
}
|
||||
|
|
@ -35,25 +35,33 @@ class Index extends Component {
|
|||
* Date: 2023/2/24
|
||||
*/
|
||||
getAttendanceDataScreen = () => {
|
||||
const { salaryMonth } = this.state;
|
||||
const { salaryMonth, selectedRowKeys } = this.state, { taxAgentStore: { showOperateBtn } } = this.props;
|
||||
const [value1 = "", value2 = ""] = salaryMonth;
|
||||
return <WeaFormItem label="薪资所属月" labelCol={{ span: 2 }} wrapperCol={{ span: 22 }}>
|
||||
<MonthPicker
|
||||
value={value1} format="YYYY-MM"
|
||||
disabledDate={(current) => {
|
||||
return current && value2 && current.getTime() > new Date(value2).getTime();
|
||||
}}
|
||||
onChange={(val) => this.handleChangeSalaryMonth([val ? moment(val).format("YYYY-MM") : "", value2])}
|
||||
/>
|
||||
<span className="to">至</span>
|
||||
<MonthPicker
|
||||
value={value2} format="YYYY-MM"
|
||||
disabledDate={(current) => {
|
||||
return current && value1 && current.getTime() < new Date(value1).getTime();
|
||||
}}
|
||||
onChange={(val) => this.handleChangeSalaryMonth([value1, val ? moment(val).format("YYYY-MM") : ""])}
|
||||
/>
|
||||
</WeaFormItem>;
|
||||
return <div className="attendDataQuery-container">
|
||||
<WeaFormItem label="薪资所属月" labelCol={{ span: 2 }} wrapperCol={{ span: 22 }}>
|
||||
<MonthPicker
|
||||
value={value1} format="YYYY-MM"
|
||||
disabledDate={(current) => {
|
||||
return current && value2 && current.getTime() > new Date(value2).getTime();
|
||||
}}
|
||||
onChange={(val) => this.handleChangeSalaryMonth([val ? moment(val).format("YYYY-MM") : "", value2])}
|
||||
/>
|
||||
<span className="to">至</span>
|
||||
<MonthPicker
|
||||
value={value2} format="YYYY-MM"
|
||||
disabledDate={(current) => {
|
||||
return current && value1 && current.getTime() < new Date(value1).getTime();
|
||||
}}
|
||||
onChange={(val) => this.handleChangeSalaryMonth([value1, val ? moment(val).format("YYYY-MM") : ""])}
|
||||
/>
|
||||
</WeaFormItem>
|
||||
<div>{
|
||||
showOperateBtn &&
|
||||
<Button type="primary" disabled={_.isEmpty(selectedRowKeys)}
|
||||
onClick={() => this.attendanceTableRef.handleDeleteAttendanceData(selectedRowKeys)}>{getLabel(111, "批量删除")}</Button>
|
||||
}
|
||||
</div>
|
||||
</div>;
|
||||
};
|
||||
handleChangeSalaryMonth = (salaryMonth) => this.setState({ salaryMonth }, () => this.attendanceTableRef.getAttendanceList({ salaryYearMonth: _.compact(this.state.salaryMonth) }));
|
||||
handleAddAttendFileds = () => this.fieldMangRef.handleTriggerAttendFileds();
|
||||
|
|
@ -77,7 +85,7 @@ class Index extends Component {
|
|||
};
|
||||
|
||||
render() {
|
||||
const { selectedKey, salaryMonth, fieldName, logDialogVisible, filterConditions } = this.state;
|
||||
const { selectedKey, salaryMonth, fieldName, logDialogVisible, filterConditions, selectedRowKeys } = this.state;
|
||||
const { taxAgentStore: { PageAndOptAuth } } = this.props;
|
||||
const showOperateBtn = PageAndOptAuth.opts.includes("admin");
|
||||
const topTab = [
|
||||
|
|
@ -117,6 +125,8 @@ class Index extends Component {
|
|||
<AttendanceDataComp
|
||||
ref={dom => this.attendanceTableRef = dom}
|
||||
salaryYearMonth={salaryMonth}
|
||||
selectedRowKeys={selectedRowKeys}
|
||||
onChangeSelectedRowKeys={v => this.setState({ selectedRowKeys: v })}
|
||||
onFilterLog={(type, targetid) => this.onDropMenuClick(type, targetid)}
|
||||
/> :
|
||||
<FieldMangComp
|
||||
|
|
|
|||
|
|
@ -3,12 +3,17 @@
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.wea-new-top-req-content {
|
||||
& > .wea-form-item {
|
||||
.attendDataQuery-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
background: #FFF;
|
||||
margin: 8px 16px 0 16px;
|
||||
|
||||
.wea-form-item {
|
||||
height: 46px;
|
||||
line-height: 46px;
|
||||
background: #FFF;
|
||||
margin: 8px 16px 0 16px;
|
||||
flex: 1;
|
||||
|
||||
.wea-form-item-label {
|
||||
line-height: 46px !important;
|
||||
|
|
@ -19,6 +24,10 @@
|
|||
padding: 0 10px
|
||||
}
|
||||
}
|
||||
|
||||
& > div:last-child {
|
||||
padding-right: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.tableWrapper {
|
||||
|
|
|
|||
Loading…
Reference in New Issue