From e7d241cdbaae790d0b077eec0c7acdea76ca9b8d Mon Sep 17 00:00:00 2001 From: lys <971387674@qq.com> Date: Thu, 24 Apr 2025 11:09:46 +0800 Subject: [PATCH] =?UTF-8?q?custom/=E4=B8=87=E5=90=9B=E7=AD=91=E5=A4=A9?= =?UTF-8?q?=E7=A7=91=E6=8A=80-=E5=90=88=E5=B9=B6=E4=B8=9A=E5=8A=A1?= =?UTF-8?q?=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/attendance.js | 8 ++ .../components/attendanceDataEditSlide.js | 89 ++++++++++++++++--- .../components/attendanceDataViewSlide.js | 15 ++-- .../dataAcquisition/attendance/index.less | 24 ++--- 4 files changed, 107 insertions(+), 29 deletions(-) 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 index f339f298..4a64fbfd 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataEditSlide.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataEditSlide.js @@ -7,37 +7,100 @@ * @description: */ import React, { Component } from "react"; -import { WeaLocaleProvider, WeaSlideModal } from "ecCom"; -import { Button } from "antd"; +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 = {}; + this.state = { conditions: [], loading: false }; } componentWillReceiveProps(nextProps, nextContext) { if (nextProps.visible !== this.props.visible && nextProps.visible) { - document.querySelector(".attendanceRefWrapper").classList.add("zIndex0-attendance"); + this.getAttendQuoteData(nextProps); } else if (nextProps.visible !== this.props.visible && !nextProps.visible) { - document.querySelector(".attendanceRefWrapper").classList.remove("zIndex0-attendance"); + form.resetForm(); } } + 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 = [ - + ]; - return ( - } - /> - ); + return (} + iconBgcolor="#F14A2D" buttons={btns}/>} + content={ + }/>); } } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataViewSlide.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataViewSlide.js index 0264cbf2..cdf7c3fd 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataViewSlide.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataViewSlide.js @@ -18,7 +18,7 @@ class AttendanceDataViewSlide extends Component { super(props); this.state = { loading: { query: false }, keyword: "", dataSource: [], columns: [], - pageInfo: { current: 1, pageSize: 10, total: 0 }, visible: false + pageInfo: { current: 1, pageSize: 10, total: 0 }, attendanceSlide: { visible: false, record: {} } }; } @@ -46,8 +46,9 @@ class AttendanceDataViewSlide extends Component { ..._.map(columns, (o, i) => ({ ...o, width: 150, fixed: i === 0 ? "left" : null })), { title: getLabel(111, "操作"), dataIndex: "operate", width: 80, - render: () => ( this.setState({ visible: true })}>{getLabel(111, "编辑")}) + render: (__, record) => ( this.setState({ + attendanceSlide: { visible: true, record } + })}>{getLabel(111, "编辑")}) } ] }); @@ -68,7 +69,7 @@ class AttendanceDataViewSlide extends Component { render() { const { showOperateBtn, salaryYearMonth, ...extra } = this.props; - const { columns, dataSource, loading, pageInfo, keyword, visible } = this.state; + const { columns, dataSource, loading, pageInfo, keyword, attendanceSlide } = this.state; const pagination = { ...pageInfo, showTotal: (total) => `共 ${total} 条`, @@ -110,7 +111,11 @@ class AttendanceDataViewSlide extends Component { - this.setState({ visible: false })}/> + this.viewAttendQuote({}, this.props)} + onClose={() => this.setState({ + attendanceSlide: { ...attendanceSlide, visible: false } + })}/> } /> diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.less b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.less index b8713b71..3b097033 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.less +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.less @@ -3,19 +3,21 @@ display: flex; flex-direction: column; - .wea-form-item { - height: 46px; - line-height: 46px; - background: #FFF; - margin: 8px 16px 0 16px; + .wea-new-top-req-content { + & > .wea-form-item { + height: 46px; + line-height: 46px; + background: #FFF; + margin: 8px 16px 0 16px; - .wea-form-item-label { - line-height: 46px !important; - padding-left: 8px !important; - } + .wea-form-item-label { + line-height: 46px !important; + padding-left: 8px !important; + } - .to { - padding: 0 10px + .to { + padding: 0 10px + } } }