feature/2.19.1.2501.01-考勤数据编辑

This commit is contained in:
lys 2025-06-03 18:14:36 +08:00
parent 2b639ad388
commit d58890beed
3 changed files with 142 additions and 10 deletions

View File

@ -78,3 +78,11 @@ export const viewAttendQuote = (params) => {
export const getSalaryCycleAndAttendCycle = (params) => {
return WeaTools.callApi("/api/bs/hrmsalary/attendQuote/getSalaryCycleAndAttendCycle", "get", params);
};
// 获取考勤详情信息
export const getAttendQuoteData = (params) => {
return postFetch("/api/bs/hrmsalary/attendQuote/getData", params);
};
// 编辑考勤引用数据
export const editAttendQuoteData = (params) => {
return postFetch("/api/bs/hrmsalary/attendQuote/editData", params);
};

View File

@ -0,0 +1,109 @@
/*
* 考勤引用数据编辑
* @Author: 黎永顺
* @Date: 2025/4/23
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
import React, { Component } from "react";
import { WeaLocaleProvider, WeaSlideModal, WeaTop } from "ecCom";
import { editAttendQuoteData, getAttendQuoteData } from "../../../../apis/attendance";
import FormInfo from "../../../../components/FormInfo";
import { WeaForm } from "comsMobx";
import { Button, message } from "antd";
import "./index.less";
const { getLabel } = WeaLocaleProvider;
const form = new WeaForm();
const baseInforFields = ["username", "departmentName", "mobile", "jobNum", "idNo"];
class AttendanceDataEditSlide extends Component {
constructor(props) {
super(props);
this.state = { conditions: [], loading: false };
}
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible && nextProps.visible) {
this.getAttendQuoteData(nextProps);
} else if (nextProps.visible !== this.props.visible && !nextProps.visible) {
form.resetForm();
this.setState({ conditions: [], loading: false });
}
}
getAttendQuoteData = (props) => {
const { record } = props || this.props, { id } = record;
getAttendQuoteData({ id }).then(({ status, data }) => {
if (status) {
const { columns, data: result } = data;
this.setState({
conditions: [{
defaultshow: true,
items: [
..._.map(baseInforFields, o => ({
conditionType: "INPUT",
domkey: [o],
fieldcol: 14,
label: _.find(columns, k => k.column === o).text,
labelcol: 8,
value: result[o] || "",
viewAttr: 1
})),
..._.map(_.filter(columns, o => !baseInforFields.includes(o.column)), k => ({
conditionType: "INPUT",
domkey: [k.column],
fieldcol: 14,
rules: "",
label: k.text,
labelcol: 8,
value: result[k.column] || "",
viewAttr: 2
}))
]
}]
}, () => form.initFormFields(this.state.conditions));
}
});
};
save = () => {
form.validateForm().then(f => {
if (f.isValid) {
const { record } = this.props, { id } = record;
const { username, departmentName, mobile, jobNum, idNo, ...formData } = form.getFormParams();
const payload = { id, attendQuoteData: { ...formData } };
this.setState({ loading: true });
editAttendQuoteData(payload).then(({ status, errormsg }) => {
this.setState({ loading: false });
if (status) {
message.success(getLabel(30700, "操作成功"));
this.props.onClose();
this.props.onSuccess();
} else {
message.error(errormsg);
}
}).catch(() => this.setState({ loading: false }));
} else {
f.showErrors();
}
});
};
render() {
const { record } = this.props, { username } = record, { conditions, loading } = this.state;
const btns = [
<Button type="primary" disabled={_.isEmpty(conditions)} onClick={this.save}
loading={loading}>{getLabel(111, "保存")}</Button>
];
return (<WeaSlideModal {...this.props} className="editAttendanceSlide" top={0} height={100} width={1000}
measureX="px" measureT="%" measureY="%" direction="right"
title={<WeaTop title={username} icon={<i className="icon-coms-fa"/>}
iconBgcolor="#F14A2D" buttons={btns}/>}
content={<FormInfo className="form-dialog-layout" center={false} itemRender={{}} form={form}
formFields={conditions} colCount={2}/>
}/>);
}
}
export default AttendanceDataEditSlide;

View File

@ -7,6 +7,7 @@
import React, { Component } from "react";
import { WeaInputSearch, WeaLocaleProvider, WeaSlideModal, WeaTop } from "ecCom";
import { viewAttendQuote } from "../../../../apis/attendance";
import AttendanceDataEditSlide from "./attendanceDataEditSlide";
import { Button, Spin } from "antd";
import "./index.less";
@ -16,7 +17,8 @@ class AttendanceDataViewSlide extends Component {
constructor(props) {
super(props);
this.state = {
loading: { query: false }, keyword: "", dataSource: [], pageInfo: { current: 1, pageSize: 10, total: 0 }
loading: { query: false }, keyword: "", dataSource: [],
pageInfo: { current: 1, pageSize: 10, total: 0 }, attendanceSlide: { visible: false, record: {} }
};
}
@ -35,6 +37,9 @@ class AttendanceDataViewSlide extends Component {
case "PAGEINFO":
this.setState({ pageInfo: { ...this.state.pageInfo, ...params } }, () => this.viewAttendQuote());
break;
case "EDIT":
this.setState({ attendanceSlide: { visible: true, record: params } });
break;
default:
break;
}
@ -63,7 +68,13 @@ class AttendanceDataViewSlide extends Component {
pageInfo: { ...pageInfo, current, pageSize, total }, dataSource
}, () => this.postMessageToChild({
pageInfo: this.state.pageInfo, dataSource, showRowSelection: false, unitTableType: "attendanceView",
columns: _.map(columns, (o, i) => ({ ...o, width: 150, fixed: i === 0 ? "left" : false }))
columns: [
..._.map(columns, (o, i) => ({ ...o, width: 150, fixed: i === 0 ? "left" : false })),
{
title: getLabel(111, "操作"), dataIndex: "operate", fixed: "right",
operateType: [{ key: "EDIT", label: getLabel(111, "编辑") }]
}
]
}));
}
}).catch(() => this.setState({ loading: { ...loading, query: false } }));
@ -90,7 +101,7 @@ class AttendanceDataViewSlide extends Component {
render() {
const { showOperateBtn, salaryYearMonth, ...extra } = this.props;
const { loading, keyword } = this.state;
const { loading, keyword, attendanceSlide } = this.state;
const btns = [
<Button type="primary" onClick={this.handleExportAttendQuote}>{getLabel(81272, "导出全部")}</Button>,
<WeaInputSearch
@ -100,13 +111,12 @@ class AttendanceDataViewSlide extends Component {
/>
];
return (
<WeaSlideModal {...extra} className="attendanceSlideWrapper"
top={0} height={100} width={800} measureT="%" measureX="px" measureY="%" direction="right"
title={
<WeaTop title={getLabel(525196, "考勤数据")} icon={<i className="icon-coms-fa"/>}
iconBgcolor="#F14A2D"
buttons={showOperateBtn ? btns : btns.slice(1)}/>
}
<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)}/>
}
content={
<div className="attendance-slide-body">
<div className="attendance-tb-tip">
@ -123,6 +133,11 @@ class AttendanceDataViewSlide extends Component {
/>
</Spin>
</div>
<AttendanceDataEditSlide {...attendanceSlide}
onSuccess={() => this.viewAttendQuote({}, this.props)}
onClose={() => this.setState({
attendanceSlide: { ...attendanceSlide, visible: false }
})}/>
</div>
}
/>