feature/2.10.1.2402.01-社保台账导入缓存
This commit is contained in:
parent
91bc849b49
commit
df9e9c9a21
|
|
@ -232,10 +232,6 @@ export const updateLockStatus = (params) => {
|
|||
export const cacheImportField = (params) => {
|
||||
return postFetch("/api/bs/hrmsalary/salaryacct/acctresult/cacheImportField", params);
|
||||
};
|
||||
// 导入社保台账添加表头字段缓存
|
||||
export const cacheWelfareListField = (params) => {
|
||||
return postFetch("/api/bs/hrmsalary/siaccount/cacheWelfareList", params);
|
||||
};
|
||||
//薪资核算-页面查看权限
|
||||
export const salaryacctAcctresultCheckAuth = params => {
|
||||
return WeaTools.callApi("/api/bs/hrmsalary/salaryacct/acctresult/checkAuth", "GET", params);
|
||||
|
|
|
|||
|
|
@ -197,3 +197,11 @@ export const getBalancePaymentGroup = params => {
|
|||
export const addNewBalance = params => {
|
||||
return postFetch("/api/bs/hrmsalary/siaccount/detail/addNewBalance", params);
|
||||
};
|
||||
// 导入社保台账添加表头字段缓存-正常缴纳以及补缴
|
||||
export const cacheWelfareListField = (params) => {
|
||||
return postFetch("/api/bs/hrmsalary/siaccount/cacheWelfareList", params);
|
||||
};
|
||||
// 导入社保台账添加表头字段缓存-补差缓存
|
||||
export const cacheBalanceWelfareList = (params) => {
|
||||
return postFetch("/api/bs/hrmsalary/siaccount/cacheBalanceWelfareList", params);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import React from "react";
|
|||
import { Button, Col, Row } from "antd";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { WeaCheckbox, WeaDialog } from "ecCom";
|
||||
import { cacheImportField, cacheWelfareListField } from "../../../../apis/calculate";
|
||||
import { cacheImportField } from "../../../../apis/calculate";
|
||||
|
||||
@inject("calculateStore", "standingBookStore")
|
||||
@observer
|
||||
|
|
@ -112,8 +112,6 @@ export default class SelectFieldModal extends React.Component {
|
|||
//薪资核算详情页面的导入表单字段缓存功能
|
||||
if (window.location.hash.indexOf("calculateDetail") !== -1) {
|
||||
const { status } = await this.cacheImportField();
|
||||
} else if (window.location.hash.indexOf("standingBookDetail") !== -1) {
|
||||
const { status } = await this.cacheWelfareListField();
|
||||
}
|
||||
this.props.onAdd(this.fieldData);
|
||||
this.props.onCancel();
|
||||
|
|
@ -124,12 +122,6 @@ export default class SelectFieldModal extends React.Component {
|
|||
const salaryItems = _.map(_.filter(salaryItemList, it => !!it.checked), item => item.salaryItemId);
|
||||
return cacheImportField({ salaryItems });
|
||||
};
|
||||
//社保台账导入缓存字段
|
||||
cacheWelfareListField = () => {
|
||||
const salaryItemList = _.reduce(_.keys(this.fieldData), (pre, cur) => ([...pre, ...this.fieldData[cur]]), []);
|
||||
const welfareNames = _.map(_.filter(salaryItemList, it => !!it.checked), item => item.fieldId);
|
||||
return cacheWelfareListField({ welfareNames });
|
||||
};
|
||||
|
||||
// 标题checkbox点击
|
||||
handleTitleCheckboxChange(value, flag) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* Author: 黎永顺
|
||||
* name: 社保福利台账-核算-导入表头设置
|
||||
* Description:
|
||||
* Date: 2024/3/5
|
||||
*/
|
||||
import React, { Component } from "react";
|
||||
import { Button, Col, Row } from "antd";
|
||||
import { WeaCheckbox, WeaDialog, WeaLocaleProvider } from "ecCom";
|
||||
import "./index.less";
|
||||
|
||||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
|
||||
class ImportHeaderSetDialog extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
itemsCheckeds: [], showOnlyChecked: false
|
||||
};
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps, nextContext) {
|
||||
if (nextProps.visible !== this.props.visible && nextProps.visible) {
|
||||
this.setState({ itemsCheckeds: nextProps.selectItems });
|
||||
}
|
||||
}
|
||||
|
||||
handleShowOnlyChecked = (showOnlyChecked) => this.setState({ showOnlyChecked: !!Number(showOnlyChecked) });
|
||||
handleSelectAll = (checked) => {
|
||||
const { itemsByGroup } = this.props;
|
||||
if (checked === "1") {
|
||||
this.setState({ itemsCheckeds: _.map(itemsByGroup, it => it.fieldId) });
|
||||
} else {
|
||||
this.setState({ itemsCheckeds: [] });
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { showOnlyChecked, itemsCheckeds } = this.state;
|
||||
const { itemsByGroup } = this.props;
|
||||
let dataSource = _.map(itemsByGroup, it => {
|
||||
return { ...it, checked: itemsCheckeds.includes(it.fieldId) };
|
||||
});
|
||||
if (showOnlyChecked) {
|
||||
dataSource = _.filter(dataSource, it => !!it.checked);
|
||||
}
|
||||
return (
|
||||
<WeaDialog
|
||||
{...this.props} hasScroll initLoadCss
|
||||
scalable title={getLabel(111, "添加表头字段")}
|
||||
style={{ width: 700, height: 484 }} className="headerSetWrapper"
|
||||
buttons={[
|
||||
<Button type="primary" onClick={() => this.props.onAdd(itemsCheckeds)}>{getLabel(111, "添加")}</Button>,
|
||||
<Button type="ghost" onClick={this.props.onCancel}>{getLabel(111, "取消")}</Button>
|
||||
]}
|
||||
bottomLeft={
|
||||
<React.Fragment>
|
||||
<WeaCheckbox content={getLabel(111, "只显示已选中字段")}
|
||||
onChange={this.handleShowOnlyChecked}/>
|
||||
<WeaCheckbox content={getLabel(111, "全部选中")} style={{ marginLeft: 10 }}
|
||||
onChange={this.handleSelectAll}/>
|
||||
</React.Fragment>
|
||||
}
|
||||
>
|
||||
{
|
||||
<Row gutter={16}>
|
||||
{
|
||||
!_.isEmpty(dataSource) ?
|
||||
_.map(dataSource, it => {
|
||||
const { fieldId, salaryItemName, checked } = it;
|
||||
return <Col span={8} style={{ marginBottom: 16 }}>
|
||||
<WeaCheckbox content={salaryItemName} value={checked ? "1" : "0"}
|
||||
onChange={() => this.setState({ itemsCheckeds: _.xorWith(itemsCheckeds, [fieldId], _.isEqual) })}/>
|
||||
</Col>;
|
||||
}) : <Col span={24} style={{ minHeight: 20, padding: "5%", textAlign: "center" }}>暂无数据</Col>
|
||||
}
|
||||
</Row>
|
||||
}
|
||||
</WeaDialog>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default ImportHeaderSetDialog;
|
||||
|
|
@ -290,3 +290,21 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//导入头部设置
|
||||
.headerSetWrapper {
|
||||
.ant-modal-body {
|
||||
.ant-row {
|
||||
padding: 16px 25px;
|
||||
}
|
||||
}
|
||||
|
||||
.ant-col-8 {
|
||||
padding: 0 8px !important;
|
||||
}
|
||||
|
||||
.wea-content {
|
||||
padding: 8px 16px 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,15 +13,23 @@ import * as API from "../../../../apis/standingBook";
|
|||
import { calcPageNo } from "../../../../util";
|
||||
import RegList from "./regList";
|
||||
import RegEditDetial from "./regEditDetial";
|
||||
import AcctResultImportModal from "../../../calculateDetail/acctResult/importModal/acctResultImportModal";
|
||||
import AddCompensationPersonnelDialog from "./addCompensationPersonnelDialog";
|
||||
import StandingBookCalcImportDialog from "./standingBookCalcImportDialog";
|
||||
import "./index.less";
|
||||
|
||||
class MakeupDifference extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
selectKey: [], fieldData: {}, loading: { save: false }, importDiffModal: { visible: false },
|
||||
selectKey: [], loading: { save: false },
|
||||
importDiffModal: {
|
||||
visible: false,
|
||||
fieldUrl: "getBalanceWelfareList",
|
||||
tmpUrl: "exportSiaccountWelfarebalanceimporttemplatetetemplate",
|
||||
cacheUrl: "cacheBalanceWelfareList",
|
||||
importUrl: "importBalanceInsuranceDetail",
|
||||
importparams: {}
|
||||
},
|
||||
returnEditPersonSlide: {
|
||||
title: "", editId: "", visible: false
|
||||
},
|
||||
|
|
@ -65,7 +73,12 @@ class MakeupDifference extends Component {
|
|||
});
|
||||
break;
|
||||
case "import":
|
||||
this.setState({ importDiffModal: { ...importDiffModal, visible: true } });
|
||||
this.setState({
|
||||
importDiffModal: {
|
||||
...importDiffModal, visible: true,
|
||||
importparams: { billMonth: getQueryString("billMonth") }
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "export":
|
||||
const url = `${window.location.origin}/api/bs/hrmsalary/welfare/balance/export?billMonth=${billMonth}&paymentOrganization=${paymentOrganization}`;
|
||||
|
|
@ -103,7 +116,7 @@ class MakeupDifference extends Component {
|
|||
|
||||
render() {
|
||||
const billMonth = getQueryString("billMonth");
|
||||
const { selectKey, importDiffModal, fieldData, returnEditPersonSlide, addPersonalDialog } = this.state;
|
||||
const { selectKey, importDiffModal, returnEditPersonSlide, addPersonalDialog } = this.state;
|
||||
return (
|
||||
<div className="differenceWrapper">
|
||||
<RegTop
|
||||
|
|
@ -133,22 +146,10 @@ class MakeupDifference extends Component {
|
|||
}, () => isRefresh && this.diffListRef.recessionList())}
|
||||
/>
|
||||
{/*导入补差*/}
|
||||
{
|
||||
importDiffModal.visible &&
|
||||
<AcctResultImportModal
|
||||
visiable={importDiffModal.visible}
|
||||
fieldData={fieldData}
|
||||
onAdd={fieldData => this.setState({ fieldData })}
|
||||
onCancel={() => {
|
||||
this.setState({ importDiffModal: { ...importDiffModal, visible: false }, fieldData: {} }, () => {
|
||||
const name = this.regTopRef.state.name;
|
||||
this.diffListRef.recessionList({ userName: name });
|
||||
});
|
||||
}}
|
||||
isStandingBook
|
||||
standingBookType="difference"
|
||||
/>
|
||||
}
|
||||
<StandingBookCalcImportDialog {...importDiffModal}
|
||||
onCancel={(isInit) => this.setState({
|
||||
importDiffModal: { ...importDiffModal, visible: false }
|
||||
}, () => isInit && this.diffListRef.recessionList())}/>
|
||||
</WeaNewScroll>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import { WeaFormItem, WeaInput, WeaSearchGroup, WeaTab } from "ecCom";
|
|||
import { calcPageNo } from "../../../../util";
|
||||
import { getQueryString } from "../../../../util/url";
|
||||
import ProgressModal from "../../../../components/progressModal";
|
||||
import AcctResultImportModal from "../../../calculateDetail/acctResult/importModal/acctResultImportModal";
|
||||
import StandingBookCalcImportDialog from "./standingBookCalcImportDialog";
|
||||
import AdjustmentSlide from "./adjustmentSlide";
|
||||
import { getCalculateProgress } from "../../../../apis/calculate";
|
||||
import RegEditDetial from "./regEditDetial";
|
||||
|
|
@ -48,7 +48,8 @@ export default class NormalIndex extends Component {
|
|||
progress: 0,
|
||||
fieldData: {}, //选中的表单头信息
|
||||
importParams: { //导入信息的弹框表示
|
||||
visible: false
|
||||
visible: false, fieldUrl: "getWelfareList", tmpUrl: "exportSiaccountWelfareImporttemplate",
|
||||
cacheUrl: "cacheWelfareListField", importUrl: "importInsuranceAcctDetail", importparams: {}
|
||||
},
|
||||
returnEditPersonSlide: {
|
||||
title: "",
|
||||
|
|
@ -473,7 +474,12 @@ export default class NormalIndex extends Component {
|
|||
];
|
||||
const btn4 = [
|
||||
<Button type="primary"
|
||||
onClick={() => this.setState({ importParams: { ...importParams, visible: true } })}>导入数据</Button>
|
||||
onClick={() => this.setState({
|
||||
importParams: {
|
||||
...importParams, visible: true,
|
||||
tmpUrl: selectedKey === "1" ? "exportSiaccountWelfareImporttemplate" : "exportSiaccountWelfaresupplyimporttemplatetemplate"
|
||||
}
|
||||
})}>导入数据</Button>
|
||||
];
|
||||
const btn5 = [
|
||||
<Button type="primary" onClick={this.handleExport}>导出全部</Button>
|
||||
|
|
@ -544,29 +550,10 @@ export default class NormalIndex extends Component {
|
|||
progress={this.state.progress}
|
||||
/>
|
||||
{/*导入弹框*/}
|
||||
{
|
||||
importParams.visible &&
|
||||
<AcctResultImportModal
|
||||
visiable={importParams.visible}
|
||||
fieldData={this.state.fieldData}
|
||||
onAdd={fieldData => {
|
||||
this.setState({
|
||||
fieldData
|
||||
});
|
||||
}}
|
||||
onCancel={() => {
|
||||
this.setState({ importParams: { ...importParams, visible: false }, fieldData: {} }, () => {
|
||||
const { billMonth, selectedKey, paymentOrganization } = this.props;
|
||||
const { current } = this.state;
|
||||
selectedKey === "1"
|
||||
? this.getNormalList({ billMonth, current, paymentOrganization })
|
||||
: this.getSupplementaryList({ billMonth, current, paymentOrganization });
|
||||
});
|
||||
}}
|
||||
isStandingBook
|
||||
standingBookTabKey={selectedKey}
|
||||
/>
|
||||
}
|
||||
<StandingBookCalcImportDialog {...importParams}
|
||||
onCancel={(isInit) => this.setState({
|
||||
importParams: { ...importParams, visible: false }
|
||||
}, () => isInit && this.handleSearch())}/>
|
||||
{/* table */}
|
||||
<div className="tableWrapper">
|
||||
<Spin spinning={loading}>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,136 @@
|
|||
/*
|
||||
* Author: 黎永顺
|
||||
* name: 社保福利台账-核算-导入
|
||||
* Description:
|
||||
* Date: 2024/3/5
|
||||
*/
|
||||
import React, { Component } from "react";
|
||||
import { WeaLocaleProvider } from "ecCom";
|
||||
import { Badge, Button, message } from "antd";
|
||||
import ImportDialog from "../../../../components/importDialog";
|
||||
import ImportHeaderSetDialog from "./importHeaderSetDialog";
|
||||
import * as API from "../../../../apis/standingBook";
|
||||
import { getQueryString } from "../../../../util/url";
|
||||
|
||||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
|
||||
class StandingBookCalcImportDialog extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
headerFieldsDialog: { visible: false, itemsByGroup: [], selectItems: [] },
|
||||
importDialog: {
|
||||
visible: false, title: "", nextloading: false,
|
||||
link: null, importResult: {}, imageId: "",
|
||||
previewUrl: "/api/bs/hrmsalary/siaccount/welfare/preview"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
async componentWillReceiveProps(nextProps, nextContext) {
|
||||
if (nextProps.visible !== this.props.visible && nextProps.visible) {
|
||||
const { fieldUrl } = nextProps;
|
||||
const { data } = await API[fieldUrl]();
|
||||
this.setState({
|
||||
importDialog: {
|
||||
...this.state.importDialog, link: this.handleExportTemp, title: getLabel(24023, "数据导入")
|
||||
},
|
||||
headerFieldsDialog: {
|
||||
...this.state.headerFieldsDialog, itemsByGroup: data,
|
||||
selectItems: _.map(_.filter(data, k => k.checked), o => o.fieldId)
|
||||
}
|
||||
});
|
||||
}
|
||||
this.setState({ importDialog: { ...this.state.importDialog, visible: nextProps.visible } });
|
||||
}
|
||||
|
||||
handleImport = (payload) => {
|
||||
const { importDialog, headerFieldsDialog: { selectItems } } = this.state;
|
||||
if (_.isEmpty(selectItems)) {
|
||||
message.error(getLabel(111, "请选择表头字段"));
|
||||
} else {
|
||||
const { importUrl, importparams = {} } = this.props;
|
||||
this.setState({ importDialog: { ...importDialog, nextloading: true } });
|
||||
API[importUrl]({ ...payload, ...importparams }).then(({ data, status, errormsg }) => {
|
||||
this.setState({ importDialog: { ...importDialog, nextloading: false } });
|
||||
if (status) {
|
||||
this.setState({
|
||||
importDialog: { ...importDialog, ...payload, importResult: data }
|
||||
});
|
||||
} else {
|
||||
message.warning(errormsg);
|
||||
}
|
||||
}).catch(() => this.setState({ importDialog: { ...importDialog, nextloading: false } }));
|
||||
}
|
||||
};
|
||||
handleExportTemp = () => {
|
||||
const { tmpUrl } = this.props;
|
||||
const { headerFieldsDialog: { selectItems, itemsByGroup } } = this.state;
|
||||
if (_.isEmpty(selectItems)) {
|
||||
message.error(getLabel(111, "请选择表头字段"));
|
||||
} else {
|
||||
const billMonth = getQueryString("billMonth");
|
||||
const paymentOrganization = getQueryString("paymentOrganization");
|
||||
const payload = {
|
||||
billMonth,
|
||||
welfareNames: _.map(_.filter(itemsByGroup, k => selectItems.includes(k.fieldId)), o => o.salaryItemName),
|
||||
paymentOrganization: Number(paymentOrganization)
|
||||
};
|
||||
const promise = API[tmpUrl](payload);
|
||||
}
|
||||
};
|
||||
handleSelectedField = () => {
|
||||
this.setState({
|
||||
headerFieldsDialog: {
|
||||
...this.state.headerFieldsDialog, visible: true
|
||||
}
|
||||
});
|
||||
};
|
||||
/*
|
||||
* Author: 黎永顺
|
||||
* Description:表单选项
|
||||
* Params:
|
||||
* Date: 2023/9/18
|
||||
*/
|
||||
renderFormComponent = () => {
|
||||
const { selectItems } = this.state.headerFieldsDialog;
|
||||
return <div style={{ padding: "8px 16px", border: "1px solid #e5e5e5", margin: "4px 0" }}>
|
||||
<Badge
|
||||
count={!_.isEmpty(selectItems) ? selectItems.length : 0}>
|
||||
<Button onClick={this.handleSelectedField}>{getLabel(111, "请选择表头字段")}</Button>
|
||||
</Badge>
|
||||
</div>;
|
||||
};
|
||||
|
||||
render() {
|
||||
const { importDialog, headerFieldsDialog } = this.state;
|
||||
const { cacheUrl } = this.props;
|
||||
return (
|
||||
<React.Fragment>
|
||||
<ImportDialog
|
||||
{...importDialog} onCancel={this.props.onCancel}
|
||||
importParams={this.renderFormComponent()}
|
||||
onResetImportResult={() => this.setState(({
|
||||
importDialog: { ...importDialog, importResult: {}, imageId: "" }
|
||||
}))}
|
||||
nextCallback={imageId => this.setState({ importDialog: { ...importDialog, imageId } })}
|
||||
nextUplaodCallback={imageId => this.handleImport({ imageId })}
|
||||
/>
|
||||
{/*表头设置*/}
|
||||
<ImportHeaderSetDialog {...headerFieldsDialog}
|
||||
onCancel={() => this.setState({
|
||||
headerFieldsDialog: { ...headerFieldsDialog, visible: false }
|
||||
})}
|
||||
onAdd={selectItems => this.setState({
|
||||
headerFieldsDialog: { ...headerFieldsDialog, visible: false, selectItems }
|
||||
}, () => {
|
||||
const { selectItems: welfareNames } = this.state.headerFieldsDialog;
|
||||
const promise = API[cacheUrl]({ welfareNames });
|
||||
})}
|
||||
/>
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default StandingBookCalcImportDialog;
|
||||
Loading…
Reference in New Issue