产品-薪资核算详情页面的导入添加额外字段添加缓存的功能
This commit is contained in:
parent
7c330c2675
commit
785ecf9ae8
|
|
@ -520,3 +520,14 @@ export const siaccountDetailCommonListSum = (params) => {
|
|||
body: JSON.stringify(params)
|
||||
}).then(res => res.json());
|
||||
};
|
||||
// 导入薪资核算添加表头字段缓存
|
||||
export const cacheImportField = (params) => {
|
||||
return fetch("/api/bs/hrmsalary/salaryacct/acctresult/cacheImportField", {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(params)
|
||||
}).then(res => res.json());
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@ import React from "react";
|
|||
import { Button, Col, Row } from "antd";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { WeaCheckbox, WeaDialog } from "ecCom";
|
||||
|
||||
const APIFox = {};
|
||||
import { cacheImportField } from "../../../../apis/calculate";
|
||||
|
||||
@inject("calculateStore", "standingBookStore")
|
||||
@observer
|
||||
|
|
@ -39,13 +38,25 @@ export default class SelectFieldModal extends React.Component {
|
|||
if (this.props.fieldData.inputItems) {
|
||||
sqlItems = this.props.fieldData.sqlItems;
|
||||
}
|
||||
fieldData.formulaItems = formulaItems;
|
||||
fieldData.inputItems = inputItems;
|
||||
fieldData.sqlItems = sqlItems;
|
||||
|
||||
this.setState({
|
||||
fieldData
|
||||
fieldData.formulaItems = _.map(formulaItems, item => {
|
||||
if (data.checkItems.includes(item.salaryItemId)) {
|
||||
return { ...item, checked: true };
|
||||
}
|
||||
return { ...item };
|
||||
});
|
||||
fieldData.inputItems = _.map(inputItems, item => {
|
||||
if (data.checkItems.includes(item.salaryItemId)) {
|
||||
return { ...item, checked: true };
|
||||
}
|
||||
return { ...item };
|
||||
});
|
||||
fieldData.sqlItems = _.map(sqlItems, item => {
|
||||
if (data.checkItems.includes(item.salaryItemId)) {
|
||||
return { ...item, checked: true };
|
||||
}
|
||||
return { ...item };
|
||||
});
|
||||
this.setState({ fieldData });
|
||||
this.fieldData = fieldData;
|
||||
});
|
||||
} else {
|
||||
|
|
@ -97,10 +108,16 @@ export default class SelectFieldModal extends React.Component {
|
|||
}
|
||||
|
||||
// 添加按钮点击回调
|
||||
handleAddClick() {
|
||||
handleAddClick = async () => {
|
||||
const { status } = await this.cacheImportField();
|
||||
this.props.onAdd(this.fieldData);
|
||||
this.props.onCancel();
|
||||
}
|
||||
};
|
||||
cacheImportField = () => {
|
||||
const salaryItemList = _.reduce(_.keys(this.fieldData), (pre, cur) => ([...pre, ...this.fieldData[cur]]), []);
|
||||
const salaryItems = _.map(_.filter(salaryItemList, it => !!it.checked), item => item.salaryItemId);
|
||||
return cacheImportField({ salaryItems });
|
||||
};
|
||||
|
||||
// 标题checkbox点击
|
||||
handleTitleCheckboxChange(value, flag) {
|
||||
|
|
@ -160,9 +177,7 @@ export default class SelectFieldModal extends React.Component {
|
|||
this.props.onCancel();
|
||||
}}
|
||||
buttons={[
|
||||
<Button type="primary" onClick={() => {
|
||||
this.handleAddClick();
|
||||
}}>添加</Button>
|
||||
<Button type="primary" onClick={this.handleAddClick}>添加</Button>
|
||||
]}
|
||||
>
|
||||
<div style={{ minHeight: "20vh", maxHeight: "50vh", overflow: "hidden auto", padding: "16px 20px" }}>
|
||||
|
|
|
|||
Loading…
Reference in New Issue