custom/领悦业务线

This commit is contained in:
lys 2025-01-23 15:36:47 +08:00
parent 70ce4dcbca
commit 6722a5af50
3 changed files with 96 additions and 44 deletions

View File

@ -13,6 +13,9 @@ export const getLYSalaryReportListSum = (params) => {
export const batchDeleteSalaryReport = (params) => {
return postFetch("/api/bs/hrmsalary/ly/salaryReport/batchDelete", params);
};
export const deleteAllSalaryReport = (params) => {
return postFetch("/api/bs/hrmsalary/ly/salaryReport/deleteAll", params);
};
export const getLYPermission = (params) => {
return postFetch("/api/bs/hrmsalary/ly/salaryReport/lyPermission", params);
};
@ -40,9 +43,15 @@ export const getLYFundReportGenerateListSum = (params) => {
export const batchDeleteSIReport = (params) => {
return postFetch("/api/bs/hrmsalary/ly/SIReport/batchDelete", params);
};
export const deleteAllSIReport = (params) => {
return postFetch("/api/bs/hrmsalary/ly/SIReport/deleteAll", params);
};
export const batchDeleteFundReport = (params) => {
return postFetch("/api/bs/hrmsalary/ly/FundReport/batchDelete", params);
};
export const deleteAllFundReport = (params) => {
return postFetch("/api/bs/hrmsalary/ly/FundReport/deleteAll", params);
};
export const exportSIReport = (params) => {
return postExportFetch("/api/bs/hrmsalary/ly/socialReport/export", params);
};

View File

@ -20,19 +20,20 @@ const interfaceType = {
list: API.getLYSalaryReportList,
sum: API.getLYSalaryReportListSum,
export: API.exportSalaryReport,
batchDel: API.batchDeleteSalaryReport
},
"socialFundSum": {
batchDel: API.batchDeleteSalaryReport,
allDel: API.deleteAllSalaryReport
}, "socialFundSum": {
list: API.getLYSIReportList,
sum: API.getLYSIReportGenerateListSum,
export: API.exportSIReport,
batchDel: API.batchDeleteSIReport
},
"fundSum": {
batchDel: API.batchDeleteSIReport,
allDel: API.deleteAllSIReport
}, "fundSum": {
list: API.getLYFundReportList,
sum: API.getLYFundReportGenerateListSum,
export: API.exportFundReport,
batchDel: API.batchDeleteFundReport
batchDel: API.batchDeleteFundReport,
allDel: API.deleteAllFundReport
}
};
@ -40,8 +41,14 @@ class List extends Component {
constructor(props) {
super(props);
this.state = {
dataSource: [], columns: [], pageInfo: { current: 1, pageSize: 10, total: 0 }, loading: false,
selectedRowKeys: [], sumDataSource: {}, payload: {}, visible: false,
dataSource: [],
columns: [],
pageInfo: { current: 1, pageSize: 10, total: 0 },
loading: false,
selectedRowKeys: [],
sumDataSource: {},
payload: {},
visible: false,
voucherDialog: { visible: false, ffgsqcLabel: props.ffgsqcLabel, type: props.type }
};
this.handleDebounce = null;
@ -82,8 +89,7 @@ class List extends Component {
};
postMessageToChild = (payload = {}) => {
const i18n = {
"共": getLabel(18609, "共"), "条": getLabel(18256, "条"),
"总计": getLabel(523, "总计")
"共": getLabel(18609, "共"), "条": getLabel(18256, "条"), "总计": getLabel(523, "总计")
};
const childFrameObj = document.getElementById("unitTable");
childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*");
@ -96,20 +102,27 @@ class List extends Component {
interfaceType[type]["list"](payload).then(async ({ status, data, errormsg }) => {
this.setState({ loading: false });
if (status) {
const { data: { sumRow: sumDataSource } } = isSum ?
await interfaceType[type]["sum"](payload) : { data: { sumRow: this.state.sumDataSource } };
const { data: { sumRow: sumDataSource } } = isSum ? await interfaceType[type]["sum"](payload) : { data: { sumRow: this.state.sumDataSource } };
const { columns, data: result } = data;
const { list: dataSource, pageNum: current, pageSize, total } = result;
this.setState({
pageInfo: { ...pageInfo, current, pageSize, total },
voucherDialog: { ...this.state.voucherDialog, ...query },
dataSource, columns, sumDataSource, payload
dataSource,
columns,
sumDataSource,
payload
}, () => {
onInit();
this.postMessageToChild({
dataSource, pageInfo: this.state.pageInfo, selectedRowKeys,
unitTableType: "custom_lingyue", columns: traverseCols(columns), showTotalCell: true,
sumDataSource: this.state.sumDataSource, scrollHeight: !_.isEmpty(dataSource) ? 195 : 0
dataSource,
pageInfo: this.state.pageInfo,
selectedRowKeys,
unitTableType: "custom_lingyue",
columns: traverseCols(columns),
showTotalCell: true,
sumDataSource: this.state.sumDataSource,
scrollHeight: !_.isEmpty(dataSource) ? 195 : 0
});
});
} else {
@ -136,18 +149,39 @@ class List extends Component {
WeaLoadingGlobal.start();
const promise = interfaceType[type]["export"](payload);
break;
case "ALLDEL":
const { salaryMonth } = query;
Modal.confirm({
title: getLabel(111, "确认信息"), content: getLabel(111, "确认全部删除吗?"), onOk: () => {
interfaceType[type]["allDel"]({ salaryMonth }).then(({ status, errormsg }) => {
if (status) {
message.success(getLabel(111, "操作成功!"));
this.setState({
selectedRowKeys: [], pageInfo: { ...this.state.pageInfo, current: 1 }
}, () => this.getLYList());
} else {
message.error(errormsg);
}
});
}
});
break;
case "BATCHDEL":
if (_.isEmpty(selectedRowKeys)) {
message.warning("未勾选数据!");
return;
}
Modal.confirm({
title: getLabel(111, "确认信息"), content: getLabel(388758, "确认要删除吗?"),
onOk: () => {
title: getLabel(111, "确认信息"), content: getLabel(388758, "确认要删除吗?"), onOk: () => {
interfaceType[type]["batchDel"]({ ids: selectedRowKeys }).then(({ status, errormsg }) => {
if (status) {
message.success(getLabel(111, "操作成功!"));
this.setState({ selectedRowKeys: [] }, () => this.getLYList());
const { pageInfo } = this.state, { current, pageSize, total } = pageInfo;
const totalPage = Math.ceil((total - selectedRowKeys.length) / pageSize);
this.setState({
selectedRowKeys: [],
pageInfo: { ...this.state.pageInfo, current: current > totalPage ? totalPage : current }
}, () => this.getLYList());
} else {
message.error(errormsg);
}
@ -168,23 +202,21 @@ class List extends Component {
if (dom && dataSource.length > 0) {
height = (parseFloat(dom.style.height) > 620 && dataSource.length === 10) ? dataSource.length * 47 + 204.53 : dataSource.length < 10 ? dataSource.length * 47 + 204.53 : parseFloat(dom.style.height) - 32;
}
return (
<div className="custom_lingyue_list" style={{ height }}>
<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>
<GenerateDataDialog type={type} visible={visible} onCancel={() => this.setState({ visible: false })}
onSearch={this.getLYList}/>
<GenerateVouchersDialog {...voucherDialog} onCancel={() => this.setState({
voucherDialog: { ...this.state.voucherDialog, visible: false }
}, () => this.getLYList())}/>
</div>
);
return (<div className="custom_lingyue_list" style={{ height }}>
<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>
<GenerateDataDialog type={type} visible={visible} onCancel={() => this.setState({ visible: false })}
onSearch={this.getLYList}/>
<GenerateVouchersDialog {...voucherDialog} onCancel={() => this.setState({
voucherDialog: { ...this.state.voucherDialog, visible: false }
}, () => this.getLYList())}/>
</div>);
}
}
@ -194,14 +226,22 @@ const traverseCols = arr => {
return _.map(arr, item => {
if (!_.isEmpty(item.children)) {
return {
title: item.text, width: item.width, ellipsis: true,
dataIndex: item.column, children: traverseCols(item.children),
fixed: item.fixed || false, align: "center"
title: item.text,
width: item.width,
ellipsis: true,
dataIndex: item.column,
children: traverseCols(item.children),
fixed: item.fixed || false,
align: "center"
};
} else {
return {
title: item.text, width: item.width, fixed: item.fixed || false,
dataIndex: item.column, ellipsis: true, align: "center"
title: item.text,
width: item.width,
fixed: item.fixed || false,
dataIndex: item.column,
ellipsis: true,
align: "center"
};
}
});

View File

@ -10,8 +10,8 @@
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaDatePicker, WeaFormItem, WeaLocaleProvider, WeaTop } from "ecCom";
import { Button, Dropdown, Menu } from "antd";
import CustomSelect from "../../../components/CustomSelect";
import { Button } from "antd";
import "./index.less";
const getLabel = WeaLocaleProvider.getLabel;
@ -27,7 +27,10 @@ class Layout extends Component {
const { salaryMonth, ffgsqc } = query;
let buttons = [
<Button type="primary" onClick={() => listRef.handleOperate("GENERATE")}>{getLabel(111, "生成数据")}</Button>,
<Button type="ghost" onClick={() => listRef.handleOperate("BATCHDEL")}>{getLabel(111, "批量删除")}</Button>
<Dropdown.Button onClick={() => listRef.handleOperate("ALLDEL")}
overlay={<Menu onClick={({ key }) => listRef.handleOperate(key)}>
<Menu.Item key="BATCHDEL">{getLabel(111, "批量删除")}</Menu.Item>
</Menu>} type="ghost">{getLabel(111, "")}</Dropdown.Button>
];
const dropMenuDatas = [
{ key: "EXPORTALL", icon: <i className="iconfont icon-daochu"/>, content: getLabel(81272, "导出全部") }