diff --git a/pc4mobx/hrmSalary/apis/calculate.js b/pc4mobx/hrmSalary/apis/calculate.js index b953fa9b..8e4a2d5e 100644 --- a/pc4mobx/hrmSalary/apis/calculate.js +++ b/pc4mobx/hrmSalary/apis/calculate.js @@ -277,6 +277,10 @@ 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); +}; //薪资核算-薪资项目改变否 export const getCompareSobConfig = params => { return WeaTools.callApi("/api/bs/hrmsalary/salaryacct/compareSobConfig", "GET", params); diff --git a/pc4mobx/hrmSalary/apis/ledger.js b/pc4mobx/hrmSalary/apis/ledger.js index 487181bc..d4f64824 100644 --- a/pc4mobx/hrmSalary/apis/ledger.js +++ b/pc4mobx/hrmSalary/apis/ledger.js @@ -155,3 +155,15 @@ export const salarysobRangeImportData = params => { export const getSalaryItemForm = params => { return postFetch("/api/bs/hrmsalary/salarysob/item/getSalaryItemForm", params); }; +//薪资核算规则配置-获取薪资审批规则表单 +export const getSalaryApprovalForm = params => { + return postFetch("/api/bs/hrmsalary/salarysob/salaryApproval/getForm", params); +}; +//薪资核算规则配置-保存薪资审批规则表单 +export const salaryApprovalSaveForm = params => { + return postFetch("/api/bs/hrmsalary/salarysob/salaryApproval/saveForm", params); +}; +//薪资核算规则配置-获取能够添加的项目 +export const getListSalaryItem = params => { + return postFetch("/api/bs/hrmsalary/salarysob/salaryApproval/listSalaryItem", params); +}; diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.js index d4aca862..e06144ba 100644 --- a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.js +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.js @@ -79,6 +79,7 @@ class Index extends Component { renderTabBtns = () => { const { selectedKey, selectedRowKeys } = this.state; + const { calcDetail } = this.props; let tabBtns = []; switch (selectedKey) { case "range": @@ -95,6 +96,7 @@ class Index extends Component { className="icon-coms-Refresh"/>, ]; + calcDetail && tabBtns.splice(0, 2); break; case "add": case "sub": @@ -202,7 +204,7 @@ class Index extends Component { }; render() { - const { calculateStore: { PCSearchForm } } = this.props; + const { calculateStore: { PCSearchForm }, calcDetail } = this.props; const { selectedKey, showSearchAd, searchConditions, pageInfo, loading, selectedRowKeys, columns, dataSource @@ -280,8 +282,8 @@ class Index extends Component { onAdReset={() => PCSearchForm.resetForm()} autoCalculateWidth /> { let width = ""; const { dataIndex } = item; @@ -300,9 +302,10 @@ class Index extends Component { dataIndex: "operate", title: getLabel(30585, "操作"), width: 120, - render: (_, record) => ( - this.handleDeletePCitem([record.id])}>{getLabel(535052, "删除")} + render: (_, record) => ( + {calcDetail ? null : this.handleDeletePCitem([record.id])}>{getLabel(535052, "删除")}} + ) } ]} diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/index.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/index.js index fc07e2f2..4f4944c7 100644 --- a/pc4mobx/hrmSalary/pages/calculate/doCalc/index.js +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/index.js @@ -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,12 @@ class Index extends Component { this.timer = null; } + init = () => { + const { routeParams: { salaryAcctRecordId } } = this.props; + getApprovalInfoByRecordId({ salaryAcctRecordId }).then(({ status, data: approvalInfo }) => { + if (status) this.setState({ approvalInfo }); + }); + }; handleMenuClick = ({ key }) => { switch (key) { case "calc_selected": @@ -139,7 +151,9 @@ class Index extends Component { } }; renderReqBtns = () => { - const { selectedKey, accountExceptInfo } = this.state; + const { routeParams: { salaryAcctRecordId } } = this.props; + const { selectedKey, accountExceptInfo, approvalInfo } = this.state; + const { isOpenApproval, approvalWorkflowUrl, canEdit } = approvalInfo; let reqBtns = []; switch (selectedKey) { case "calc": @@ -150,7 +164,7 @@ class Index extends Component { ); const moreMenu = ( - {getLabel(32935, "导入")} + {canEdit && {getLabel(32935, "导入")}} {getLabel(81272, "导出全部")} {getLabel(544270, "自定义导出")} {getLabel(543249, "线下对比")} @@ -166,6 +180,10 @@ class Index extends Component { this.calc.openAdvanceSearch()} onAdvanceSearch={() => this.calc.onAdSearch(false)}/> ]; + !canEdit && reqBtns.splice(0, 1); + isOpenApproval && reqBtns.unshift(); accountExceptInfo && reqBtns.unshift( this.downloadTxtfile(accountExceptInfo)}/>); @@ -184,14 +202,15 @@ class Index extends Component { element.click(); }; renderContent = () => { - const { selectedKey } = this.state; + const { selectedKey, approvalInfo } = this.state; + const { canEdit } = approvalInfo; let dom = null; switch (selectedKey) { case "person": - dom = ; + dom = ; break; case "calc": - dom = this.calc = dom}/>; + dom = this.calc = dom}/>; break; default: break; @@ -207,7 +226,7 @@ class Index extends Component { const { calculateStore: { setOtherConditions } } = this.props; const { selectedKey, progressVisible, progress, customExpDialog, salaryImpDialog } = this.state; return ( - +
{ + const { saveSalarySobId, editId } = this.props; + API.getSalaryApprovalForm({ salarySobId: editId || saveSalarySobId }).then(({ status, data }) => { + if (status) { + this.setState({ + approvalId: data.id, + approvalItemGroup: _.map(data.approvalItemGroup, item => ({ + ...item, id: String(item.sorted), + approvalItems: _.map(item.approvalItems, o => ({ ...o, id: `${String(item.sorted)}-${String(o.sorted)}` })) + })), + conditions: _.map(acctApprRulesConditions, item => ({ + ...item, items: _.map(item.items, o => ({ + ...o, value: getKey(o) === "isOpenApproval" ? (data[getKey(o)] ? "1" : "0") : data[getKey(o)], + viewAttr: getKey(o) === "approvalWorkflowUrl" ? (data["isOpenApproval"] ? 3 : 2) : o.viewAttr, + hide: getKey(o) !== "isOpenApproval" ? !data["isOpenApproval"] : false, + label: getLabel(o.lanId, o.label) + })) + })) + }, () => { + const { ledgerStore: { AARForm } } = this.props; + AARForm.initFormFields(this.state.conditions); + }); + } + }); + }; + + componentWillUnmount() { + const { ledgerStore: { initAARForm } } = this.props; + initAARForm(); + } + + renderForm = (form, conditions) => { + const { saveSalarySobId, editId } = this.props; + const { approvalItemGroup } = this.state; + const { isFormInit } = form; + const formParams = form.getFormParams(); + let group = []; + isFormInit && conditions && conditions.map(c => { + let items = []; + c.items.map(fields => { + if (getKey(fields) !== "approvalItemGroup") { + items.push({ + com: ( + + + ), + hide: fields.hide + }); + } else { + items.push({ + com: ( + + this.setState({ + approvalItemGroup: _.map(approvalItemGroup, o => ({ + ...o, + approvalItems: (groupId === o.id && !_.isEmpty(items)) ? [...o.approvalItems, ..._.map(items, (k, ki) => ({ + salaryItemId: k.id, salaryItemName: k.name, + id: `${String(o.sorted)}-${String(o.approvalItems.length + ki)}` + }))] : o.approvalItems + })) + }, () => form.updateFields({ approvalItemGroup: { value: this.state.approvalItemGroup } }))} + onEdit={(groupName, groupId) => this.setState({ + 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) : + _.map(approvalItemGroup, o => ({ + ...o, + approvalItems: _.filter(o.approvalItems, oo => oo.id !== item.id) + })) + }, () => form.updateFields({ approvalItemGroup: { value: this.state.approvalItemGroup } }))} + onChange={datas => this.setState({ + approvalItemGroup: datas + }, () => form.updateFields({ approvalItemGroup: { value: datas } }))}/> + ), + hide: fields.hide + }); + } + }); + group.push(); + }); + return group; + }; + convertFormItemViewAttr = (viewAttr) => { + const { ledgerStore: { AARForm } } = this.props; + const { isOpenApproval } = AARForm.getFormParams(); + this.setState({ + conditions: _.map(this.state.conditions, item => ({ + ...item, items: _.map(item.items, o => { + if (getKey(o) === "approvalWorkflowUrl") { + return { ...o, viewAttr, hide: isOpenApproval === "0" }; + } else if (getKey(o) === "approvalItemGroup") { + return { ...o, viewAttr, hide: isOpenApproval === "0" }; + } + return { ...o }; + }) + })) + }); + }; + handleFormItemChange = (value) => { + const { ledgerStore: { AARForm } } = this.props; + const { isOpenApproval } = AARForm.getFormParams(); + if (_.keys(value)[0] === "isOpenApproval") { + this.convertFormItemViewAttr(isOpenApproval === "1" ? 3 : 2); + } + }; + + render() { + const { conditions } = this.state; + const { ledgerStore: { AARForm } } = this.props; + return ( +
+ {this.renderForm(AARForm, conditions)} +
+ ); + } +} + +export default LedgerAccountApprRule; diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAccountApprRuleClassifyNameEditDialog.js b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAccountApprRuleClassifyNameEditDialog.js new file mode 100644 index 00000000..9958b727 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAccountApprRuleClassifyNameEditDialog.js @@ -0,0 +1,70 @@ +/* + * Author: 黎永顺 + * name:审批规则分类编辑 + * Description: + * Date: 2024/4/25 + */ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { WeaDialog, WeaLocaleProvider, WeaTools } from "ecCom"; +import { Button } from "antd"; +import { getSearchs } from "../../../util"; +import { classifyConditions } from "../config"; + +const getKey = WeaTools.getKey; +const getLabel = WeaLocaleProvider.getLabel; + +@inject("ledgerStore") +@observer +class LedgerAccountApprRuleClassifyNameEditDialog extends Component { + constructor(props) { + super(props); + this.state = { conditions: [] }; + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) this.init(nextProps); + if (nextProps.visible !== this.props.visible && !nextProps.visible) this.props.ledgerStore.initAARClassifyForm(); + } + + init = (props) => { + const { ledgerStore: { AARClassifyForm }, groupName, groupId } = props; + this.setState({ + conditions: _.map(classifyConditions, item => ({ + ...item, + items: _.map(item.items, o => ({ ...o, label: getLabel(o.lanId, o.label) })) + })) + }, () => { + AARClassifyForm.initFormFields(this.state.conditions); + groupId && AARClassifyForm.updateFields({ groupName }); + }); + }; + save = () => { + const { ledgerStore: { AARClassifyForm }, groupId } = this.props; + AARClassifyForm.validateForm().then(f => { + if (f.isValid) { + this.props.onCancel(); + this.props.onEdit(AARClassifyForm.getFormParams().groupName, groupId); + } else { + f.showErrors(); + } + }); + }; + + render() { + const { conditions } = this.state; + const { ledgerStore: { AARClassifyForm } } = this.props; + return ( + {getLabel(537558, "保存")} + ]} + > +
{getSearchs(AARClassifyForm, conditions, 1, false)}
+
+ ); + } +} + +export default LedgerAccountApprRuleClassifyNameEditDialog; diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAccountSalaryItemsSet.js b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAccountSalaryItemsSet.js new file mode 100644 index 00000000..1f53c37b --- /dev/null +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAccountSalaryItemsSet.js @@ -0,0 +1,147 @@ +/* + * Author: 黎永顺 + * name: 薪资核算规则配置-审批薪资项目 + * Description: + * Date: 2024/4/24 + */ +import React, { Component } from "react"; +import { WeaButtonIcon, WeaLocaleProvider, WeaSortable, WeaTransfer } from "ecCom"; +import LedgerAccountApprRuleClassifyNameEditDialog from "./ledgerAccountApprRuleClassifyNameEditDialog"; +import * as API from "../../../apis/ledger"; +import { Icon, Modal } from "antd"; +import cs from "classnames"; +import SalaryItemModal from "../../payroll/stepForm/salaryItemModal"; + +const getLabel = WeaLocaleProvider.getLabel; + +class LedgerAccountSalaryItemsSet extends Component { + constructor(props) { + super(props); + this.state = { + editDialog: { visible: false, groupName: "", groupId: "", title: "" }, + salaryItemDialog: { visible: false, title: getLabel(111, "薪资项目项"), options: [], groupId: "" } + }; + } + + handleDeleteClick = (group, item = {}) => { + Modal.confirm({ + title: getLabel(131329, "信息确认"), + content: getLabel(543231, "确认删除本条数据吗?"), + onOk: () => this.props.onDelete(group, item) + }); + }; + handleAddSalaryItems = (group) => { + const { salaryItemDialog } = this.state; + const { salarySobId, datas } = this.props; + const payload = { + 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({ + salaryItemDialog: { + ...salaryItemDialog, visible: true, options: data, groupId: group.id + } + }); + }); + }; + handleConfirm = () => { + const { salaryItemDialog } = this.state; + this.setState({ + salaryItemDialog: { ...salaryItemDialog, visible: false } + }, () => this.props.onAddItems(salaryItemDialog.groupId, _.filter(this.state.salaryItemDialog.options, g => g.checkedSalaryItem))); + }; + + render() { + const { editDialog, salaryItemDialog } = this.state; + const { datas } = this.props; + return ( +
+
+ this.setState({ + editDialog: { visible: true, title: getLabel(111, "添加分类") } + })}/> + +
+
+ this.props.onChange(list)} + renderNodeItem={(item) => { + return
+
+ + {item.groupName} + + this.setState({ + editDialog: { + visible: true, groupName: item.groupName, groupId: item.id, title: getLabel(111, "分类名称编辑") + } + })}/> + this.handleDeleteClick(item)}/> + + + this.handleAddSalaryItems(item)}/> +
+
+ { + !_.isEmpty(item.approvalItems) ? + this.props.onChange( + _.map(datas, child => { + if (child.id === item.id) { + return { ...child, approvalItems: items }; + } + return { ...child }; + }) + )} + renderNodeItem={(filed) => { + return
+
+
{filed.salaryItemName}
+ this.handleDeleteClick(item, filed)}/> +
+
; + }} + className="wea-sortable-salary-item" + /> : +
暂无数据
+ } +
+
; + }} + className="wea-sortable-salary-item" + /> + this.setState({ + editDialog: { ...editDialog, visible: false } + })}/> + this.setState({ + salaryItemDialog: { ...salaryItemDialog, visible: false } + })} onConfirm={this.handleConfirm}> +
+ g.checkedSalaryItem), o => o.id)} + onChange={v => { + this.setState({ + salaryItemDialog: { + ...salaryItemDialog, + options: _.map(salaryItemDialog.options, o => ({ ...o, checkedSalaryItem: _.includes(v, o.id) })) + } + }); + }} + /> +
+
+
+
+ ); + } +} + +export default LedgerAccountSalaryItemsSet; diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSlide.js b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSlide.js index 0150b1e0..33dd326a 100644 --- a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSlide.js +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSlide.js @@ -13,13 +13,15 @@ import LedgerAssociatedPersonnel from "./ledgerAssociatedPersonnel"; import LedgerSalaryAdjustmentRules from "./ledgerSalaryAdjustmentRules"; import LedgerBackCalculatedSalaryItem from "./ledgerBackCalculatedSalaryItem"; import LedgerSalaryItem from "./ledgerSalaryItem"; +import LedgerAccountApprRule from "./ledgerAccountApprRule"; import WeaTopTitle from "../../../components/custom-title/weaTopTitle"; import WeaReqTitle from "../../../components/custom-title/weaReqTitle"; -import { saveAdjustmentRule, saveLedgerBasic, saveLedgerItem } from "../../../apis/ledger"; +import { salaryApprovalSaveForm, saveAdjustmentRule, saveLedgerBasic, saveLedgerItem } from "../../../apis/ledger"; +import { sysConfCodeRule } from "../../../apis/ruleconfig"; import "./index.less"; -const { getLabel } = WeaLocaleProvider; const Step = WeaSteps.Step; +const { getLabel } = WeaLocaleProvider; @inject("taxAgentStore", "ledgerStore") @observer @@ -28,10 +30,18 @@ class LedgerSlide extends Component { super(props); this.state = { current: 0, loading: false, baseSettingInfo: {}, adjustRules: [], - empFields: [], itemGroups: [], saveSalarySobId: "" + empFields: [], itemGroups: [], saveSalarySobId: "", + salaryApprovalStatus: false }; } + async componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) { + const { data } = await sysConfCodeRule({ code: "SALARY_APPROVAL_STATUS" }); + this.setState({ salaryApprovalStatus: data === "1" }); + } + } + componentWillUnmount() { this.setState({ saveSalarySobId: "" @@ -150,7 +160,40 @@ class LedgerSlide extends Component { * Date: 2022/12/14 */ handleSaveSalaryItemParams = (empFields, itemGroups) => this.setState({ empFields, itemGroups }); - + handleDefaultSave = () => { + const { saveSalarySobId } = this.state; + const { state: { approvalId } } = this.approRef.wrappedInstance; + const { ledgerStore: { AARForm } } = this.props; + const { approvalItemGroup, isOpenApproval, ...extra } = AARForm.getFormParams(); + const group = _.map(approvalItemGroup, (item, index) => ({ + groupName: item.groupName, sorted: index, + approvalItems: _.map(item.approvalItems, (o, oi) => ({ + salaryItemId: o.salaryItemId, sorted: oi, + salaryItemName: o.salaryItemName + })) + })); + if (isOpenApproval === "1" && _.isEmpty(extra.approvalWorkflowUrl)) { + AARForm.showError("approvalWorkflowUrl", getLabel(111, "\"审批流程地址\"未填写")); + return; + } else if (isOpenApproval === "1" && _.isEmpty(group)) { + AARForm.showError("approvalItemGroup", getLabel(111, "\"审批薪资项目\"未填写")); + return; + } + const payload = { + ...extra, isOpenApproval: isOpenApproval === "1", id: approvalId, + salarySobId: this.props.editId || saveSalarySobId, + approvalItemGroup: group + }; + this.setState({ loading: true }); + salaryApprovalSaveForm(payload).then(({ status, errormsg }) => { + this.setState({ loading: false }); + if (status) { + message.success(getLabel(111, "保存成功!")); + } else { + message.error(errormsg); + } + }); + }; render() { const { visible, editId, taxAgentStore: { showOperateBtn } } = this.props; const { current, saveSalarySobId, loading } = this.state; diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/config.js b/pc4mobx/hrmSalary/pages/ledgerPage/config.js index 9af48b4d..435e4793 100644 --- a/pc4mobx/hrmSalary/pages/ledgerPage/config.js +++ b/pc4mobx/hrmSalary/pages/ledgerPage/config.js @@ -803,3 +803,57 @@ export const keepDecimalPlaces = [ showname: "5" } ]; +export const acctApprRulesConditions = [ + { + items: [ + { + conditionType: "SWITCH", + domkey: ["isOpenApproval"], + fieldcol: 20, + label: "是否开启审批", + lanId: 111, + labelcol: 4, + viewAttr: 2 + }, + { + conditionType: "INPUT", + domkey: ["approvalWorkflowUrl"], + fieldcol: 20, + label: "审批流程地址", + lanId: 111, + labelcol: 4, + value: "", + viewAttr: 2 + }, + { + conditionType: "CUSTOM", + domkey: ["approvalItemGroup"], + fieldcol: 20, + label: "审批薪资项目", + lanId: 111, + labelcol: 4, + value: "", + viewAttr: 2 + } + ], + defaultshow: true + } +]; +export const classifyConditions = [ + { + items: [ + { + conditionType: "INPUT", + domkey: ["groupName"], + fieldcol: 18, + label: "分类名称", + lanId: 111, + labelcol: 6, + value: "", + rules: "required|string", + viewAttr: 3 + } + ], + defaultshow: true + } +]; diff --git a/pc4mobx/hrmSalary/pages/ruleConfig/conditions.js b/pc4mobx/hrmSalary/pages/ruleConfig/conditions.js index bb22f65e..044602e0 100644 --- a/pc4mobx/hrmSalary/pages/ruleConfig/conditions.js +++ b/pc4mobx/hrmSalary/pages/ruleConfig/conditions.js @@ -201,6 +201,49 @@ export const conditions = [ title: "薪资报表", lanId: 111, defaultshow: true + }, + { + items: [ + { + conditionType: "SWITCH", + domkey: ["SALARY_APPROVAL_STATUS"], + fieldcol: 10, + label: "薪资审批", + lanId: 111, + labelcol: 8, + viewAttr: 2 + }, + { + conditionType: "SWITCH", + domkey: ["APPROVAL_CAN_MANUAL_FILE_STATUS"], + fieldcol: 10, + label: "开启审批的核算记录允许手动归档", + lanId: 111, + labelcol: 8, + viewAttr: 2 + }, + { + conditionType: "SWITCH", + domkey: ["APPROVAL_CAN_RE_CALC_STATUS"], + fieldcol: 10, + label: "开启审批的核算记录允许重新核算", + lanId: 111, + labelcol: 8, + viewAttr: 2 + }, + { + conditionType: "SWITCH", + domkey: ["APPROVAL_CAN_EDIT_RESULT_STATUS"], + fieldcol: 10, + label: "审批流程发起后允许修改核算数据", + lanId: 111, + labelcol: 8, + viewAttr: 2 + } + ], + title: "薪资审批设置", + lanId: 111, + defaultshow: true } // { // items: [ diff --git a/pc4mobx/hrmSalary/pages/ruleConfig/ruleConfig.js b/pc4mobx/hrmSalary/pages/ruleConfig/ruleConfig.js index 8c56b847..8b3c9fd9 100644 --- a/pc4mobx/hrmSalary/pages/ruleConfig/ruleConfig.js +++ b/pc4mobx/hrmSalary/pages/ruleConfig/ruleConfig.js @@ -58,6 +58,13 @@ class RuleConfig extends Component { ...o, viewAttr: (_.isNil(sysinfo.taxDeclarationFunction) || sysinfo.taxDeclarationFunction !== "0") ? 2 : 1 }; + } else if ( + getKey(o) === "APPROVAL_CAN_MANUAL_FILE_STATUS" || getKey(o) === "APPROVAL_CAN_RE_CALC_STATUS" || getKey(o) === "APPROVAL_CAN_EDIT_RESULT_STATUS" + ) { + return { + ...o, label: getLabel(o.lanId, o.label), + hide: sysinfo["SALARY_APPROVAL_STATUS"] === "0" || _.isNil(sysinfo["SALARY_APPROVAL_STATUS"]) + }; } return { ...o }; }) @@ -84,6 +91,10 @@ class RuleConfig extends Component { form.updateFields({ [item]: { value: sysinfo[item] || "1" } }); } else if (item === "OPEN_APPLICATION_ENCRYPT") { form.updateFields({ [item]: { value: _.isNil(sysinfo[item]) ? "1" : (sysinfo[item] || "") } }); + } else if ( + item === "APPROVAL_CAN_MANUAL_FILE_STATUS" || item === "APPROVAL_CAN_RE_CALC_STATUS" || item === "APPROVAL_CAN_EDIT_RESULT_STATUS" + ) { + form.updateFields({ [item]: { value: _.isNil(sysinfo[item]) ? "1" : (sysinfo[item] || "0") } }); } else { form.updateFields({ [item]: { value: sysinfo[item] || "" } }); } @@ -127,6 +138,10 @@ class RuleConfig extends Component { case "taxAgentShowStatus": case "salaryShowStatus": case "adjustShowStatus": + case "SALARY_APPROVAL_STATUS": + case "APPROVAL_CAN_MANUAL_FILE_STATUS": + case "APPROVAL_CAN_RE_CALC_STATUS": + case "APPROVAL_CAN_EDIT_RESULT_STATUS": case "REPORT_ORGANIZATIN_TYPE": if (!this.handleDebounce) { this.handleDebounce = _.debounce(() => { @@ -138,6 +153,10 @@ class RuleConfig extends Component { taxAgentShowStatus: getLabel(111, "显示【个税扣缴义务人】信息"), salaryShowStatus: getLabel(111, "显示工资单页签"), adjustShowStatus: getLabel(111, "显示调薪记录页签"), + SALARY_APPROVAL_STATUS: getLabel(111, "是否开启薪资审批"), + APPROVAL_CAN_MANUAL_FILE_STATUS: getLabel(111, "开启审批的核算记录允许手动归档"), + APPROVAL_CAN_RE_CALC_STATUS: getLabel(111, "开启审批的核算记录允许重新核算"), + APPROVAL_CAN_EDIT_RESULT_STATUS: getLabel(111, "审批流程发起后允许修改核算数据"), REPORT_ORGANIZATIN_TYPE: getLabel(111, "组织信息") }; this.unifiedSettings(key, confTitle[key]); @@ -311,6 +330,20 @@ class RuleConfig extends Component { API.saveSysOperate(payload).then(({ status, errormsg }) => { if (status) { message.success(getLabel(22619, "保存成功!")); + if (confKey === "SALARY_APPROVAL_STATUS") { + this.setState({ + conditions: _.map(this.state.conditions, item => ({ + ...item, items: _.map(item.items, o => { + if ( + getKey(o) === "APPROVAL_CAN_MANUAL_FILE_STATUS" || getKey(o) === "APPROVAL_CAN_RE_CALC_STATUS" || getKey(o) === "APPROVAL_CAN_EDIT_RESULT_STATUS" + ) { + return { ...o, hide: form.getFormParams()[confKey] === "0" }; + } + return { ...o }; + }) + })) + }); + } } else { message.error(errormsg || getLabel(22620, "保存失败!")); } diff --git a/pc4mobx/hrmSalary/stores/ledger.js b/pc4mobx/hrmSalary/stores/ledger.js index 8dc46dc8..0411826d 100644 --- a/pc4mobx/hrmSalary/stores/ledger.js +++ b/pc4mobx/hrmSalary/stores/ledger.js @@ -1,10 +1,9 @@ -import { observable, action, toJS } from "mobx"; +import { action, observable } from "mobx"; import { message } from "antd"; import { WeaForm, WeaTableNew } from "comsMobx"; import * as API from "../apis/ledger"; // 引入API接口文件 import { notNull } from "../util/validate"; -import { categoryConditions } from "../pages/ledgerPage/config"; const { TableStore } = WeaTableNew; @@ -13,6 +12,11 @@ export class LedgerStore { @observable copyForm = new WeaForm(); // 复制form @observable categoryForm = new WeaForm(); // 新增分类form @observable searchForm = new WeaForm(); // 查询form + @observable AARForm = new WeaForm(); // 核算审批规则form + @observable AARClassifyForm = new WeaForm(); // 核算审批规则分类编辑form + + @action initAARForm = (v) => this.AARForm = new WeaForm();//重置核算审批规则form + @action initAARClassifyForm = (v) => this.AARClassifyForm = new WeaForm();//重置审批规则分类编辑form /*******************************************************/ @@ -148,14 +152,14 @@ export class LedgerStore { setItemGroups = itemGroups => { itemGroups = itemGroups ? [...itemGroups] : []; itemGroups && - itemGroups.map(item => { - if (item.items) { - item.items && - item.items.map(i => { - i.key = i.id; - }); - } - }); + itemGroups.map(item => { + if (item.items) { + item.items && + item.items.map(i => { + i.key = i.id; + }); + } + }); this.itemGroups = itemGroups; }; @@ -388,9 +392,9 @@ export class LedgerStore { if (!this.validateBaseFrom(params)) { reject("保存失败"); } - this.saveLoading= true; + this.saveLoading = true; API.saveLedgerBasic(params).then(res => { - this.saveLoading= false; + this.saveLoading = false; if (res.status) { this.salarySobId = res.data; resolve(); @@ -463,9 +467,9 @@ export class LedgerStore { //薪资帐套人员范围(包含)列表 getLedgerPersonRangeInclude = params => { - this.loading= true; + this.loading = true; API.getLedgerPersonRangeInclude(params).then(res => { - this.loading= false; + this.loading = false; if (res.status) { this.setUserTableStore(res.data); } else { @@ -476,9 +480,9 @@ export class LedgerStore { //薪资帐套人员范围(排除)列表 getLedgerPersonRangeExclude = params => { - this.loading= true; + this.loading = true; API.getLedgerPersonRangeExclude(params).then(res => { - this.loading= false; + this.loading = false; if (res.status) { this.setUserTableStore(res.data); } else { @@ -508,12 +512,12 @@ export class LedgerStore { listSalaryItem = (searchValue = "", current = 1) => { let excludeIds = []; this.itemGroups && - this.itemGroups.map(item => { - item.items && - item.items.map(i => { - excludeIds.push(i.salaryItemId); - }); + this.itemGroups.map(item => { + item.items && + item.items.map(i => { + excludeIds.push(i.salaryItemId); }); + }); this.loading = true; API.listSalaryItem({ name: searchValue, excludeIds, current }).then(res => { if (res.status) { @@ -562,7 +566,7 @@ export class LedgerStore { salaryItemId: i.salaryItemId, sortedIndex: index + 1, formulaId: i.formulaId, - itemHide: i.itemHide || "0", + itemHide: i.itemHide || "0" })); return result; } @@ -571,14 +575,14 @@ export class LedgerStore { let params = { salarySobId: this.salarySobId, - empFields: _.map(this.userSelectedList, (it, idx) => ({...it, sortedIndex:idx })), + empFields: _.map(this.userSelectedList, (it, idx) => ({ ...it, sortedIndex: idx })), itemGroups: itemGroups.filter(item => item.id != "default"), items: itemGroups.filter(item => item.id == "default")[0].items }; return new Promise((resolve, reject) => { - this.saveLoading= true; + this.saveLoading = true; API.saveLedgerItem(params).then(res => { - this.saveLoading= false; + this.saveLoading = false; if (res.status) { resolve(); message.success("保存成功"); @@ -626,9 +630,9 @@ export class LedgerStore { ruleParams: this.sobItemRuleDataSource }; return new Promise((resolve, reject) => { - this.saveLoading= true; + this.saveLoading = true; API.saveAdjustmentRule(params).then(res => { - this.saveLoading= false; + this.saveLoading = false; if (res.status) { resolve(); message.success("保存成功");