feature/2.12.1.2404.02-薪资账套配置流程审批

This commit is contained in:
黎永顺 2024-04-25 16:07:04 +08:00
parent 10e981d0d3
commit 2e5404bee6
5 changed files with 109 additions and 77 deletions

View File

@ -266,4 +266,8 @@ export const deleteExportTemplate = (params) => {
export const getExportTemplateForm = (params) => {
return postFetch("/api/bs/hrmsalary/salaryacct/acctresult/getExportTemplateForm", params);
};
//薪资审批-薪资核算页面获取审批信息
export const getApprovalInfoByRecordId = params => {
return WeaTools.callApi("/api/bs/hrmsalary/salarysob/salaryApproval/getApprovalInfoByRecordId", "GET", params);
};

View File

@ -9,7 +9,12 @@ import { WeaLocaleProvider, WeaReqTop } from "ecCom";
import { Button, Dropdown, Menu, message, Modal } from "antd";
import { inject, observer } from "mobx-react";
import Layout from "./layout";
import { acctresultAccounting, getCalculateProgress, getExportField } from "../../../apis/calculate";
import {
acctresultAccounting,
getApprovalInfoByRecordId,
getCalculateProgress,
getExportField
} from "../../../apis/calculate";
import AdvanceInputBtn from "./components/advanceInputBtn";
import SalaryCalcPersonConfirm from "./components/salaryCalcPersonConfirm";
import SalaryEditCalc from "./components/salaryEditCalc";
@ -30,6 +35,7 @@ class Index extends Component {
selectedKey: "person", progressVisible: false, progress: 0,
customExpDialog: { visible: false, salaryAcctRecordId: "", checkItems: [], itemsByGroup: [] },
salaryImpDialog: { visible: false, title: "", salaryAcctRecordId: "" },
approvalInfo: {},//审批信息,
accountExceptInfo: "" //核算报错信息,
};
@ -37,6 +43,14 @@ class Index extends Component {
this.timer = null;
}
init = () => {
const { routeParams: { salaryAcctRecordId } } = this.props;
getApprovalInfoByRecordId({ salaryAcctRecordId }).then(({ status, data }) => {
if (status) {
console.log(data);
}
});
};
handleMenuClick = ({ key }) => {
switch (key) {
case "calc_selected":
@ -196,7 +210,7 @@ class Index extends Component {
const { calculateStore: { setOtherConditions } } = this.props;
const { selectedKey, progressVisible, progress, customExpDialog, salaryImpDialog } = this.state;
return (
<Layout {...this.props}>
<Layout {...this.props} init={this.init}>
<div className="salary-calculate-do-calc">
<WeaReqTop
title={getLabel(538011, "薪资核算")} tabDatas={tabs} selectedKey={selectedKey}

View File

@ -31,7 +31,7 @@ class LedgerAccountApprRule extends Component {
init = () => {
const { saveSalarySobId, editId } = this.props;
API.getSalaryApprovalForm({ salarySobId: saveSalarySobId || editId }).then(({ status, data }) => {
API.getSalaryApprovalForm({ salarySobId: editId || saveSalarySobId }).then(({ status, data }) => {
if (status) {
this.setState({
approvalId: data.id,
@ -88,8 +88,8 @@ class LedgerAccountApprRule extends Component {
wrapperCol={{ span: `${fields.fieldcol}` }} error={form.getError(fields)}
tipPosition="bottom"
>
<LedgerAccountSalaryItemsSet datas={approvalItemGroup} salarySobId={saveSalarySobId || editId}
onAdd={(groupId, items) => this.setState({
<LedgerAccountSalaryItemsSet datas={approvalItemGroup} salarySobId={editId || saveSalarySobId}
onAddItems={(groupId, items) => this.setState({
approvalItemGroup: _.map(approvalItemGroup, o => ({
...o,
approvalItems: (groupId === o.id && !_.isEmpty(items)) ? [...o.approvalItems, ..._.map(items, (k, ki) => ({
@ -99,9 +99,11 @@ class LedgerAccountApprRule extends Component {
}))
}, () => form.updateFields({ approvalItemGroup: { value: this.state.approvalItemGroup } }))}
onEdit={(groupName, groupId) => this.setState({
approvalItemGroup: _.map(approvalItemGroup, o => ({
approvalItemGroup: groupId ? _.map(approvalItemGroup, o => ({
...o, groupName: groupId === o.id ? groupName : o.groupName
}))
})) : [{
approvalItems: [], groupName, id: String(approvalItemGroup.length)
}, ...approvalItemGroup]
}, () => form.updateFields({ approvalItemGroup: { value: this.state.approvalItemGroup } }))}
onDelete={(group, item) => this.setState({
approvalItemGroup: _.isEmpty(item) ? _.filter(approvalItemGroup, o => o.id !== group.id) :

View File

@ -28,7 +28,7 @@ class LedgerAccountApprRuleClassifyNameEditDialog extends Component {
}
init = (props) => {
const { ledgerStore: { AARClassifyForm }, groupName } = props;
const { ledgerStore: { AARClassifyForm }, groupName, groupId } = props;
this.setState({
conditions: _.map(classifyConditions, item => ({
...item,
@ -36,7 +36,7 @@ class LedgerAccountApprRuleClassifyNameEditDialog extends Component {
}))
}, () => {
AARClassifyForm.initFormFields(this.state.conditions);
AARClassifyForm.updateFields({ groupName });
groupId && AARClassifyForm.updateFields({ groupName });
});
};
save = () => {
@ -57,7 +57,6 @@ class LedgerAccountApprRuleClassifyNameEditDialog extends Component {
return (
<WeaDialog
{...this.props} style={{ width: 480, height: 80 }} initLoadCss
title={getLabel(111, "分类名称编辑")}
buttons={[
<Button type="primary" onClick={this.save}>{getLabel(537558, "保存")}</Button>
]}

View File

@ -5,7 +5,7 @@
* Date: 2024/4/24
*/
import React, { Component } from "react";
import { WeaLocaleProvider, WeaSortable, WeaTransfer } from "ecCom";
import { WeaButtonIcon, WeaLocaleProvider, WeaSortable, WeaTransfer } from "ecCom";
import LedgerAccountApprRuleClassifyNameEditDialog from "./ledgerAccountApprRuleClassifyNameEditDialog";
import * as API from "../../../apis/ledger";
import { Icon, Modal } from "antd";
@ -18,7 +18,7 @@ class LedgerAccountSalaryItemsSet extends Component {
constructor(props) {
super(props);
this.state = {
editDialog: { visible: false, groupName: "", groupId: "" },
editDialog: { visible: false, groupName: "", groupId: "", title: "" },
salaryItemDialog: { visible: false, title: getLabel(111, "薪资项目项"), options: [], groupId: "" }
};
}
@ -32,9 +32,11 @@ class LedgerAccountSalaryItemsSet extends Component {
};
handleAddSalaryItems = (group) => {
const { salaryItemDialog } = this.state;
const { salarySobId } = this.props;
const { salarySobId, datas } = this.props;
const payload = {
salarySobId, excludeIds: _.map(group.approvalItems, o => o.salaryItemId)
salarySobId, excludeIds: _.reduce(datas, (pre, cur) => {
return pre.concat(_.map(cur.approvalItems, o => o.salaryItemId));
}, [])
};
API.getListSalaryItem(payload).then(({ status, data }) => {
if (status) this.setState({
@ -48,84 +50,95 @@ class LedgerAccountSalaryItemsSet extends Component {
const { salaryItemDialog } = this.state;
this.setState({
salaryItemDialog: { ...salaryItemDialog, visible: false }
}, () => this.props.onAdd(salaryItemDialog.groupId, _.filter(this.state.salaryItemDialog.options, g => g.checkedSalaryItem)));
}, () => this.props.onAddItems(salaryItemDialog.groupId, _.filter(this.state.salaryItemDialog.options, g => g.checkedSalaryItem)));
};
render() {
const { editDialog, salaryItemDialog } = this.state;
const { datas } = this.props;
return (
<div className={cs("salaryItemSettingWrapper", { required: _.isEmpty(datas) })}>
<WeaSortable
datas={datas}
onChange={list => this.props.onChange(list)}
renderNodeItem={(item) => {
return <div className="salaryItemWrapper">
<div className="salaryItemHeader">
<div>
<div style={{ textAlign: "right", padding: "10px 0" }}>
<WeaButtonIcon buttonType="add" type="primary"
onClick={() => this.setState({
editDialog: { visible: true, title: getLabel(111, "添加分类") }
})}/>
</div>
<div className={cs("salaryItemSettingWrapper", { required: _.isEmpty(datas) })}>
<WeaSortable
datas={datas}
onChange={list => this.props.onChange(list)}
renderNodeItem={(item) => {
return <div className="salaryItemWrapper">
<div className="salaryItemHeader">
<span className="titleWrapper">
<span className="salaryClassTitle">{item.groupName}</span>
<span className="iconWrapper">
<i className="icon-coms-edit" onClick={() => this.setState({
editDialog: { visible: true, groupName: item.groupName, groupId: item.id }
editDialog: {
visible: true, groupName: item.groupName, groupId: item.id, title: getLabel(111, "分类名称编辑")
}
})}/>
<i className="icon-coms-Delete" onClick={() => this.handleDeleteClick(item)}/>
</span>
</span>
<i className="icon-coms-Add-to" onClick={() => this.handleAddSalaryItems(item)}/>
</div>
<div className="salaryItemContent">
{
!_.isEmpty(item.approvalItems) ?
<WeaSortable
datas={item.approvalItems}
onChange={(items) => this.props.onChange(
_.map(datas, child => {
if (child.id === item.id) {
return { ...child, approvalItems: items };
}
return { ...child };
})
)}
renderNodeItem={(filed) => {
return <div className="salaryItemList">
<div className="salaryItem" title={filed.salaryItemName}>
<div className="salaryItemName">{filed.salaryItemName}</div>
<Icon type="cross" onClick={() => this.handleDeleteClick(item, filed)}/>
</div>
</div>;
}}
className="wea-sortable-salary-item"
/> :
<div className="empty">暂无数据</div>
}
</div>
</div>;
}}
className="wea-sortable-salary-item"
/>
<LedgerAccountApprRuleClassifyNameEditDialog {...editDialog} {...this.props}
onCancel={() => this.setState({
editDialog: { ...editDialog, visible: false }
})}/>
<SalaryItemModal {...salaryItemDialog}
onCancel={() => this.setState({
salaryItemDialog: { ...salaryItemDialog, visible: false }
})} onConfirm={this.handleConfirm}>
<div className="modalContent">
<WeaTransfer
data={salaryItemDialog.options}
selectedKeys={_.map(_.filter(salaryItemDialog.options, g => g.checkedSalaryItem), o => o.id)}
onChange={v => {
this.setState({
salaryItemDialog: {
...salaryItemDialog,
options: _.map(salaryItemDialog.options, o => ({ ...o, checkedSalaryItem: _.includes(v, o.id) }))
<i className="icon-coms-Add-to" onClick={() => this.handleAddSalaryItems(item)}/>
</div>
<div className="salaryItemContent">
{
!_.isEmpty(item.approvalItems) ?
<WeaSortable
datas={item.approvalItems}
onChange={(items) => this.props.onChange(
_.map(datas, child => {
if (child.id === item.id) {
return { ...child, approvalItems: items };
}
return { ...child };
})
)}
renderNodeItem={(filed) => {
return <div className="salaryItemList">
<div className="salaryItem" title={filed.salaryItemName}>
<div className="salaryItemName">{filed.salaryItemName}</div>
<Icon type="cross" onClick={() => this.handleDeleteClick(item, filed)}/>
</div>
</div>;
}}
className="wea-sortable-salary-item"
/> :
<div className="empty">暂无数据</div>
}
});
}}
/>
</div>
</SalaryItemModal>
</div>
</div>;
}}
className="wea-sortable-salary-item"
/>
<LedgerAccountApprRuleClassifyNameEditDialog {...editDialog} {...this.props}
onCancel={() => this.setState({
editDialog: { ...editDialog, visible: false }
})}/>
<SalaryItemModal {...salaryItemDialog}
onCancel={() => this.setState({
salaryItemDialog: { ...salaryItemDialog, visible: false }
})} onConfirm={this.handleConfirm}>
<div className="modalContent">
<WeaTransfer
data={salaryItemDialog.options}
selectedKeys={_.map(_.filter(salaryItemDialog.options, g => g.checkedSalaryItem), o => o.id)}
onChange={v => {
this.setState({
salaryItemDialog: {
...salaryItemDialog,
options: _.map(salaryItemDialog.options, o => ({ ...o, checkedSalaryItem: _.includes(v, o.id) }))
}
});
}}
/>
</div>
</SalaryItemModal>
</div>
</div>
);
}