release/2.19.1.2501.01

This commit is contained in:
lys 2025-04-24 16:38:36 +08:00
parent 9a50947d8a
commit dee1059ca7
2 changed files with 51 additions and 31 deletions

View File

@ -5,9 +5,9 @@
* Date: 2023/3/7 * Date: 2023/3/7
*/ */
import React, { Component } from "react"; import React, { Component } from "react";
import { WeaInputSearch, WeaLocaleProvider, WeaSlideModal, WeaTable, WeaTop } from "ecCom"; import { WeaInputSearch, WeaLocaleProvider, WeaSlideModal, WeaTop } from "ecCom";
import { Button } from "antd";
import { viewAttendQuote } from "../../../../apis/attendance"; import { viewAttendQuote } from "../../../../apis/attendance";
import { Button, Spin } from "antd";
import "./index.less"; import "./index.less";
const { getLabel } = WeaLocaleProvider; const { getLabel } = WeaLocaleProvider;
@ -16,11 +16,31 @@ class AttendanceDataViewSlide extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
loading: { query: false }, keyword: "", dataSource: [], columns: [], loading: { query: false }, keyword: "", dataSource: [], pageInfo: { current: 1, pageSize: 10, total: 0 }
pageInfo: { current: 1, pageSize: 10, total: 0 }
}; };
} }
componentDidMount() {
window.addEventListener("message", this.handleReceive, false);
}
componentWillUnmount() {
window.removeEventListener("message", this.handleReceive, false);
}
handleReceive = async ({ data }) => {
const { type, payload: { id, params } = {} } = data;
if (type === "turn") {
switch (id) {
case "PAGEINFO":
this.setState({ pageInfo: { ...this.state.pageInfo, ...params } }, () => this.viewAttendQuote());
break;
default:
break;
}
}
};
componentWillReceiveProps(nextProps, nextContext) { componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible && nextProps.visible) { if (nextProps.visible !== this.props.visible && nextProps.visible) {
document.querySelector(".attendanceRefWrapper").classList.add("zIndex0-attendance"); document.querySelector(".attendanceRefWrapper").classList.add("zIndex0-attendance");
@ -33,19 +53,29 @@ class AttendanceDataViewSlide extends Component {
viewAttendQuote = (extraPayload = {}, props) => { viewAttendQuote = (extraPayload = {}, props) => {
const { loading, pageInfo, keyword } = this.state; const { loading, pageInfo, keyword } = this.state;
const { attendQuoteId } = props; const { attendQuoteId } = props || this.props;
this.setState({ loading: { ...loading, query: true } }); this.setState({ loading: { ...loading, query: true } });
viewAttendQuote({ ...pageInfo, attendQuoteId, keyword, ...extraPayload }).then(({ status, data }) => { viewAttendQuote({ ...pageInfo, attendQuoteId, keyword, ...extraPayload }).then(({ status, data }) => {
this.setState({ loading: { ...loading, query: false } }); this.setState({ loading: { ...loading, query: false } });
if (status) { if (status) {
const { columns, list: dataSource, pageNum: current, pageSize, total } = data.pageInfo; const { columns, list: dataSource, pageNum: current, pageSize, total } = data.pageInfo;
this.setState({ this.setState({
pageInfo: { ...pageInfo, current, pageSize, total }, dataSource, pageInfo: { ...pageInfo, current, pageSize, total }, dataSource
columns: _.map(columns, (o, i) => ({ ...o, width: 150, fixed: i === 0 ? "left" : null })) }, () => this.postMessageToChild({
}); pageInfo: this.state.pageInfo, dataSource, showRowSelection: false, unitTableType: "attendanceView",
columns: _.map(columns, (o, i) => ({ ...o, width: 150, fixed: i === 0 ? "left" : false }))
}));
} }
}).catch(() => this.setState({ loading: { ...loading, query: false } })); }).catch(() => this.setState({ loading: { ...loading, query: false } }));
}; };
postMessageToChild = (payload = {}) => {
const i18n = {
"操作": getLabel(30585, "操作"), "编辑": getLabel(111, "编辑"), "共": getLabel(18609, "共"),
"条": getLabel(18256, "条")
};
const childFrameObj = document.getElementById("attendanceViewTable");
childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*");
};
handleExportAttendQuote = () => { handleExportAttendQuote = () => {
if (!this.handleDebounce) { if (!this.handleDebounce) {
this.handleDebounce = _.debounce(() => { this.handleDebounce = _.debounce(() => {
@ -60,24 +90,7 @@ class AttendanceDataViewSlide extends Component {
render() { render() {
const { showOperateBtn, salaryYearMonth, ...extra } = this.props; const { showOperateBtn, salaryYearMonth, ...extra } = this.props;
const { columns, dataSource, loading, pageInfo, keyword } = this.state; const { loading, keyword } = this.state;
const pagination = {
...pageInfo,
showTotal: (total) => `${total}`,
pageSizeOptions: ["10", "20", "50", "100"],
showSizeChanger: true,
showQuickJumper: true,
onShowSizeChange: (current, pageSize) => {
this.setState({
pageInfo: { ...pageInfo, current, pageSize }
}, () => this.viewAttendQuote({}, this.props));
},
onChange: (current) => {
this.setState({
pageInfo: { ...pageInfo, current }
}, () => this.viewAttendQuote({}, this.props));
}
};
const btns = [ const btns = [
<Button type="primary" onClick={this.handleExportAttendQuote}>{getLabel(81272, "导出全部")}</Button>, <Button type="primary" onClick={this.handleExportAttendQuote}>{getLabel(81272, "导出全部")}</Button>,
<WeaInputSearch <WeaInputSearch
@ -100,9 +113,16 @@ class AttendanceDataViewSlide extends Component {
<div>{getLabel(543376, "考勤周期")}{salaryYearMonth}</div> <div>{getLabel(543376, "考勤周期")}{salaryYearMonth}</div>
<div></div> <div></div>
</div> </div>
<WeaTable <div style={{ height: `calc(100% - 40px)` }}>
columns={columns} dataSource={dataSource} bordered pagination={pagination} <Spin spinning={loading.query}>
loading={loading.query} scroll={{ x: 1200, y: `calc(100vh - 240px)` }}/> <iframe
style={{ border: 0, width: "100%", height: "100%" }}
// src="http://localhost:7607/#/unitTable"
src="/spa/hrmSalary/hrmSalaryCalculateDetail/index.html#/unitTable"
id="attendanceViewTable"
/>
</Spin>
</div>
</div> </div>
} }
/> />

View File

@ -54,8 +54,8 @@
margin-bottom: 8px; margin-bottom: 8px;
} }
.wea-new-table { .ant-spin-nested-loading, .ant-spin-container {
background: #FFF; height: 100%;
} }
} }