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 9869b50e..4f3283b3 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js @@ -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 ( this.handleDeleteAttendanceData(record)}>删除 + onClick={() => this.handleDeleteAttendanceData([record.id])}>删除 @@ -355,7 +357,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,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 = [ , + , this.setState({ keyword })} @@ -115,7 +146,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 1a2de172..257c1d5e 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: { PageAndOptAuth } } = this.props; const showOperateBtn = PageAndOptAuth.opts.includes("admin"); const topTab = [ @@ -117,6 +125,8 @@ class Index extends Component { this.attendanceTableRef = dom} 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 {