diff --git a/pc4mobx/hrmSalary/apis/attendance.js b/pc4mobx/hrmSalary/apis/attendance.js index 50fdc9c2..2a96b7de 100644 --- a/pc4mobx/hrmSalary/apis/attendance.js +++ b/pc4mobx/hrmSalary/apis/attendance.js @@ -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); +}; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataEditSlide.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataEditSlide.js new file mode 100644 index 00000000..995e5eea --- /dev/null +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataEditSlide.js @@ -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 = [ + {getLabel(111, "保存")} + ]; + return (} + iconBgcolor="#F14A2D" buttons={btns}/>} + content={ + }/>); + } +} + +export default AttendanceDataEditSlide; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataViewSlide.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataViewSlide.js index 2f4804b6..9b7e1113 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataViewSlide.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataViewSlide.js @@ -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 = [ {getLabel(81272, "导出全部")}, ]; return ( - } - iconBgcolor="#F14A2D" - buttons={showOperateBtn ? btns : btns.slice(1)}/> - } + } + iconBgcolor="#F14A2D" + buttons={showOperateBtn ? btns : btns.slice(1)}/> + } content={ @@ -123,6 +133,11 @@ class AttendanceDataViewSlide extends Component { /> + this.viewAttendQuote({}, this.props)} + onClose={() => this.setState({ + attendanceSlide: { ...attendanceSlide, visible: false } + })}/> } />