feature/2.10.1.2401.01-社保福利台账列表页面重构

This commit is contained in:
黎永顺 2024-01-23 19:05:57 +08:00
parent e15a88b1f4
commit 6a91ce8b3c
7 changed files with 167 additions and 68 deletions

View File

@ -1,56 +0,0 @@
import { WeaTools } from 'ecCom';
//台账
export const getRecordList = params => {
return WeaTools.callApi('/api/bs/hrmsalary/siaccount/batch/list', 'get', params);
};
export const getCalcForm = params => {
return WeaTools.callApi('/api/bs/hrmsalary/siaccount/accountForm', 'get', params);
};
export const save = params => {
return WeaTools.callApi('/api/bs/hrmsalary/siaccount/save', 'post', params);
};
export const doArchive = params => {
return WeaTools.callApi('/api/bs/hrmsalary/siaccount/file', 'post', params);
};
export const deleteRecord = params => {
return WeaTools.callApi('/api/bs/hrmsalary/siaccount/delete', 'post', params);
};
//核算
export const getCalcTabs = params => {
return WeaTools.callApi('/api/bs/hrmsalary/siaccount/tabList', 'get', params);
};
export const getNormalForm = params => {
return WeaTools.callApi('/api/bs/hrmsalary/siaccount/commonForm', 'get', params);
};
export const saveNormalForm = params => {
return WeaTools.callApi('/api/bs/hrmsalary/siaccount/common/save', 'post', params);
};
export const deleteNormal = params => {
return WeaTools.callApi('/api/bs/hrmsalary/siaccount/common/delete', 'post', params);
};
export const getSupplementaryForm = params => {
return WeaTools.callApi('/api/bs/hrmsalary/siaccount/querySupplementaryForm', 'get', params);
};
export const saveSupplementaryForm = params => {
return WeaTools.callApi('/api/bs/hrmsalary/siaccount/supplementary/save', 'post', params);
};
export const deleteSupplementary = params => {
return WeaTools.callApi('/api/bs/hrmsalary/siaccount/supplementary/delete', 'post', params);
};
// 导出正常缴纳核算
export const exportNormalPaymentAccount = params => {
return WeaTools.callApi('/api/bs/hrmsalary/common/export', 'post', params);
};
// 导出总览
export const exportOverView = params => {
return WeaTools.callApi('/api/bs/hrmsalary/overview/export', 'post', params);
};
// 导出补缴核算
export const exportSupplementaryAccount = params => {
return WeaTools.callApi('/api/bs/hrmsalary/supplementary/export', 'post', params);
};

View File

@ -48,7 +48,7 @@ export const welfareRQConditions = [
colSpan: 1,
conditionType: "SELECT",
domkey: ["paymentOrganization"],
fieldcol: 14,
fieldcol: 8,
label: "个税扣缴义务人",
lanId: 537996,
labelcol: 6,

View File

@ -0,0 +1,97 @@
/*
* Author: 黎永顺
* name:社保福利台账重构-列表
* Description:
* Date: 2024/1/23
*/
import React, { Component } from "react";
import { Spin } from "antd";
import { WeaLocaleProvider } from "ecCom";
import { getIframeParentHeight } from "../../../../util";
import * as API from "../../../../apis/standingBook";
const getLabel = WeaLocaleProvider.getLabel;
class WelfareRecordList extends Component {
constructor(props) {
super(props);
this.state = {
loading: false, dataSource: [], columns: [],
pageInfo: { current: 0, pageSize: 10, total: 0 }
};
}
componentDidMount() {
window.addEventListener("message", this.handleReceive, false);
}
componentWillUnmount() {
window.removeEventListener("message", this.handleReceive, false);
}
handleReceive = ({ data }) => {
const { pageInfo } = this.state;
const { type, payload: { id, params } = {} } = data;
if (type === "init") {
this.getWelfareRecordList();
} else if (type === "turn") {
switch (id) {
case "PAGEINFO":
this.setState({ pageInfo: { ...pageInfo, ...params } }, () => this.getWelfareRecordList());
break;
default:
break;
}
}
};
postMessageToChild = (payload = {}) => {
const i18n = {
"共": getLabel(18609, "共"), "条": getLabel(18256, "条"),
"总计": getLabel(523, "总计"), "已归档": getLabel(18800, "已归档"),
"未归档": getLabel(17999, "已归档"), "操作": getLabel(30585, "操作"),
"核算": getLabel(538780, "核算"), "归档": getLabel(251, "归档"),
"查看": getLabel(33564, "查看"), "重新核算": getLabel(542637, "重新核算"),
"删除": getLabel(535052, "删除")
};
const childFrameObj = document.getElementById("unitTable");
childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*");
};
getWelfareRecordList = () => {
const { queryForm } = this.props;
const { pageInfo } = this.state;
const payload = { ...pageInfo, ...queryForm };
this.setState({ loading: true });
API.getCommonList(payload).then(({ status, data }) => {
this.setState({ loading: false });
if (status) {
const { pageInfo: result } = data;
const { columns, list: dataSource, pageNum: current, pageSize, total } = result;
this.setState({
pageInfo: { ...pageInfo, current, pageSize, total },
dataSource, columns
}, () => this.postMessageToChild({
scrollHeight: 100, dataSource, columns, pageInfo: this.state.pageInfo
}));
}
}).catch(() => this.setState({ loading: false }));
};
render() {
const { loading, dataSource } = this.state;
return (
<div className="salary-welfare-record-list"
style={{ height: getIframeParentHeight(".wea-new-top-content", dataSource.length, 46) + "px" }}>
<Spin spinning={loading}>
<iframe
style={{ border: 0, width: "100%", height: "100%" }}
src="http://localhost:7607/#/unitTable"
// src="/spa/hrmSalary/hrmSalaryCalculateDetail/index.html#/unitTable"
id="unitTable"
/>
</Spin>
</div>
);
}
}
export default WelfareRecordList;

View File

@ -67,18 +67,18 @@ class WelfareRecordQuery extends Component {
wrapperCol={{ span: `${fields.fieldcol}` }} error={form.getError(fields)} tipPosition="bottom"
>
<WeaSwitch fieldConfig={fields} form={form} formParams={formParams}
onChange={this.getWelfareRecordLiost}/>
onChange={this.getWelfareRecordList}/>
</WeaFormItem>)
});
});
group.push(
<WeaSearchGroup col={4} needTigger showGroup={c.defaultshow}
<WeaSearchGroup col={3} needTigger showGroup={c.defaultshow}
items={[
{
com: (<WeaFormItem label={getLabel(542443, "账单月份")} labelCol={{ span: 6 }}
wrapperCol={{ span: 14 }}>
com: (<WeaFormItem label={getLabel(542443, "账单月份")} labelCol={{ span: 4 }}
wrapperCol={{ span: 16 }}>
<MonthRangePicker dateRange={dateRange} viewAttr={2}
onChange={v => this.setState({ dateRange: v }, () => this.getWelfareRecordLiost())}/>
onChange={v => this.setState({ dateRange: v }, () => this.getWelfareRecordList())}/>
</WeaFormItem>)
},
...items
@ -87,14 +87,14 @@ class WelfareRecordQuery extends Component {
});
return group;
};
getWelfareRecordLiost = () => {
getWelfareRecordList = () => {
const { standingBookStore: { welfareRQForm } } = this.props;
const { dateRange } = this.state;
const [startTime, endTime] = dateRange;
const payload = {
...welfareRQForm.getFormParams(), startTime, endTime
};
console.log(payload);
this.props.onSearch(payload);
};
render() {

View File

@ -80,7 +80,7 @@
width: 100%;
padding: 0;
.wea-content {
.wea-content, .wea-form-cell {
padding: 0;
.rangePickerBox {
@ -90,5 +90,12 @@
}
}
}
.salary-welfare-record-list {
.ant-spin-nested-loading,
.ant-spin-container {
height: 99%;
}
}
}
}

View File

@ -10,6 +10,9 @@ import { inject, observer } from "mobx-react";
import { WeaLocaleProvider, WeaTop } from "ecCom";
import { Button } from "antd";
import WelfareRecordQuery from "./components/welfareRecordQuery";
import WelfareRecordList from "./components/welfareRecordList";
import Accountdialog from "./components/accountDialog";
import moment from "moment";
import "./index.less";
const getLabel = WeaLocaleProvider.getLabel;
@ -17,16 +20,55 @@ const getLabel = WeaLocaleProvider.getLabel;
@inject("standingBookStore", "taxAgentStore")
@observer
class StandingBook extends Component {
constructor(props) {
super(props);
this.state = {
queryForm: {
startTime: moment(new Date()).subtract(1, "year").startOf("year").format("YYYY-MM"),
endTime: moment(new Date()).endOf("year").format("YYYY-MM"),
paymentOrganization: ""
},
accountDialog: { visible: false, title: "", loading: false, options: [] }
};
this.wfListRef = null;
}
/*
* Author: 黎永顺
* Description: 社保福利台账重构-核算
* Params:
* Date: 2024/1/23
*/
handleAccount = (formVal) => {
const { billMonth, ...extra } = formVal;
const payload = {
billMonth: moment(billMonth).format("YYYY-MM"),
...extra
};
console.log(formVal, payload);
};
render() {
const { accountDialog, queryForm } = this.state;
const { taxAgentStore: { showOperateBtn } } = this.props;
const rightBtns = [<Button type="primary">{getLabel(538780, "核算")}</Button>];
const rightBtns = [<Button type="primary" onClick={() => this.setState({
accountDialog: { ...accountDialog, visible: true, title: getLabel(538780, "核算") }
})}>{getLabel(538780, "核算")}</Button>];
return (
<div className="salary-welfare-record">
<WeaTop title={getLabel(538002, "社保福利台账")} icon={<i className="icon-coms-fa"/>}
iconBgcolor="#F14A2D" buttons={showOperateBtn ? rightBtns : []}>
<div className="salary-welfare-record-content">
<WelfareRecordQuery/>
<WelfareRecordQuery onSearch={(payload) => {
this.setState({ queryForm: { ...queryForm, ...payload } }, () => this.wfListRef.getWelfareRecordList());
}}/>
<WelfareRecordList ref={dom => this.wfListRef = dom} queryForm={queryForm}/>
</div>
<Accountdialog {...accountDialog}
onCancel={() => this.setState({
accountDialog: { visible: false, title: "", loading: false }
})} onOk={this.handleAccount}
/>
</WeaTop>
</div>
);

View File

@ -127,9 +127,18 @@ export const padding0 = (num, length) => {
return "0." + num;
};
export const toDecimal_n = (num, decimalPlaces) => {
if (num === null || !isFinite(num)) return null
if (num === null || !isFinite(num)) return null;
if (decimalPlaces < 0) return null;
const multiplier = Math.pow(10, decimalPlaces);
const roundedNum = Math.round(num * multiplier) / multiplier;
return roundedNum.toFixed(decimalPlaces);
};
//设置ifrme高度
export const getIframeParentHeight = (selector, total, extraHeight) => {
const dom = document.querySelector(selector);
let height = 280;
if (dom && total > 0) {
height = (parseFloat(dom.style.height) > 620 && total === 10) ? total * 39 + 113 : total < 10 ? total * 39 + 113 : parseFloat(dom.style.height) - extraHeight;
}
return height;
};