From fb46f0b336222c893e9766c374175daafc922045 Mon Sep 17 00:00:00 2001 From: lys <971387674@qq.com> Date: Thu, 12 Jun 2025 16:29:57 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feature/2.19.1.2501.01-=E8=80=83=E5=8B=A4?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/attendance.js | 4 ++ .../components/attendanceDataComp.js | 36 ++++++------- .../components/attendanceDataViewSlide.js | 39 +++++++++++---- .../pages/dataAcquisition/attendance/index.js | 50 +++++++++++-------- .../dataAcquisition/attendance/index.less | 17 +++++-- 5 files changed, 96 insertions(+), 50 deletions(-) diff --git a/pc4mobx/hrmSalary/apis/attendance.js b/pc4mobx/hrmSalary/apis/attendance.js index 2a96b7de..62937605 100644 --- a/pc4mobx/hrmSalary/apis/attendance.js +++ b/pc4mobx/hrmSalary/apis/attendance.js @@ -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) => { diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js index dd103159..0fa6a508 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js @@ -26,6 +26,7 @@ import moment from "moment"; import SelectItemsWrapper from "../../../../components/selectItemsModal/selectItemsWrapper"; import AttendanceRefrenceDataModal from "./attendanceRefrenceDataModal"; import AttendanceDataViewSlide from "./attendanceDataViewSlide"; +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: [], @@ -133,15 +125,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 || "删除失败"); } @@ -287,7 +288,7 @@ class AttendanceDataComp extends Component { dataSource, columns, pageInfo, loading, importData, importFormPayload, fieldSetPayload, attendanceReferencePayload, attendanceViewPayload } = this.state; - const { showOperateBtn, salaryYearMonth } = this.props; + const { showOperateBtn, salaryYearMonth, selectedRowKeys, onChangeSelectedRowKeys } = this.props; const pagination = { ...pageInfo, showTotal: total => `共 ${total} 条`, @@ -305,6 +306,7 @@ class AttendanceDataComp extends Component { }, () => this.getAttendanceList({ salaryYearMonth: _.compact(salaryYearMonth) })); } }; + const rowSelection = { selectedRowKeys, onChange: onChangeSelectedRowKeys }; return ( this.handleDeleteAttendanceData(record)}>删除 + onClick={() => this.handleDeleteAttendanceData([record.id])}>删除 @@ -344,7 +346,7 @@ class AttendanceDataComp extends Component { ); } } - ]} + ]} rowSelection={rowSelection} rowKey="id" dataSource={dataSource} pagination={pagination} loading={loading.query}/> {/* 考勤引用导入 */} { - 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,28 @@ class AttendanceDataViewSlide extends Component { } this.handleDebounce(); }; + batchDeleteData = () => { + const { selectedRowKeys, pageInfo } = this.state; + batchDeleteData({ attendQuoteDataIds: selectedRowKeys }).then(({ status, errormsg }) => { + if (status) { + message.success(getLabel(111, "操作成功!")); + this.setState({ + selectedRowKeys: [], + 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 = [ , + , this.setState({ keyword })} @@ -115,7 +136,7 @@ class AttendanceDataViewSlide extends Component { direction="right" title={ } iconBgcolor="#F14A2D" - buttons={showOperateBtn ? btns : btns.slice(1)}/> + buttons={showOperateBtn ? btns : btns.slice(2)}/> } content={
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js index e27fc31e..929f207e 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js @@ -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 - { - return current && value2 && current.getTime() > new Date(value2).getTime(); - }} - onChange={(val) => this.handleChangeSalaryMonth([val ? moment(val).format("YYYY-MM") : "", value2])} - /> - - { - return current && value1 && current.getTime() < new Date(value1).getTime(); - }} - onChange={(val) => this.handleChangeSalaryMonth([value1, val ? moment(val).format("YYYY-MM") : ""])} - /> - ; + return
+ + { + return current && value2 && current.getTime() > new Date(value2).getTime(); + }} + onChange={(val) => this.handleChangeSalaryMonth([val ? moment(val).format("YYYY-MM") : "", value2])} + /> + + { + return current && value1 && current.getTime() < new Date(value1).getTime(); + }} + onChange={(val) => this.handleChangeSalaryMonth([value1, val ? moment(val).format("YYYY-MM") : ""])} + /> + +
{ + showOperateBtn && + + } +
+
; }; 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: { showOperateBtn } } = this.props; const topTab = [ { title: "考勤数据", key: "DATA" }, @@ -117,6 +125,8 @@ class Index extends Component { ref={dom => this.attendanceTableRef = dom} showOperateBtn={showOperateBtn} salaryYearMonth={salaryMonth} + selectedRowKeys={selectedRowKeys} + onChangeSelectedRowKeys={v => this.setState({ selectedRowKeys: v })} onFilterLog={(type, targetid) => this.onDropMenuClick(type, targetid)} /> : .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 { From ce19b4b88864d8e4338713a33e41eb76a0c6ed50 Mon Sep 17 00:00:00 2001 From: lys <971387674@qq.com> Date: Thu, 12 Jun 2025 16:56:24 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feature/2.19.1.2501.01-=E8=80=83=E5=8B=A4?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/attendanceDataViewSlide.js | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataViewSlide.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataViewSlide.js index e57660a4..de1eb0ad 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataViewSlide.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataViewSlide.js @@ -8,7 +8,7 @@ import React, { Component } from "react"; import { WeaInputSearch, WeaLocaleProvider, WeaSlideModal, WeaTop } from "ecCom"; import { batchDeleteData, viewAttendQuote } from "../../../../apis/attendance"; import AttendanceDataEditSlide from "./attendanceDataEditSlide"; -import { Button, message, Spin } from "antd"; +import { Button, message, Modal, Spin } from "antd"; import "./index.less"; import { calcPageNo } from "../../../../util"; @@ -18,7 +18,7 @@ class AttendanceDataViewSlide extends Component { constructor(props) { super(props); this.state = { - loading: { query: false }, keyword: "", dataSource: [], selectedRowKeys: [], + loading: { query: false, del: false }, keyword: "", dataSource: [], selectedRowKeys: [], pageInfo: { current: 1, pageSize: 10, total: 0 }, attendanceSlide: { visible: false, record: {} } }; } @@ -104,16 +104,26 @@ class AttendanceDataViewSlide extends Component { this.handleDebounce(); }; batchDeleteData = () => { - const { selectedRowKeys, pageInfo } = this.state; - batchDeleteData({ attendQuoteDataIds: selectedRowKeys }).then(({ status, errormsg }) => { - if (status) { - message.success(getLabel(111, "操作成功!")); - this.setState({ - selectedRowKeys: [], - pageInfo: { ...pageInfo, current: calcPageNo(pageInfo.total, pageInfo.current, 10, selectedRowKeys.length) } - }, () => this.viewAttendQuote()); - } else { - message.error(errormsg); + 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); + } + }); } }); };