From 10e981d0d3d81b2f6026b54430c87ec6a584d706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Thu, 25 Apr 2024 14:26:06 +0800 Subject: [PATCH 01/38] =?UTF-8?q?feature/2.12.1.2404.02-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E8=B4=A6=E5=A5=97=E9=85=8D=E7=BD=AE=E6=B5=81=E7=A8=8B=E5=AE=A1?= =?UTF-8?q?=E6=89=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/ledger.js | 12 ++ .../components/ledgerAccountApprRule.js | 160 ++++++++++++++++++ ...erAccountApprRuleClassifyNameEditDialog.js | 71 ++++++++ .../components/ledgerAccountSalaryItemsSet.js | 134 +++++++++++++++ .../ledgerPage/components/ledgerSlide.js | 78 +++++++-- pc4mobx/hrmSalary/pages/ledgerPage/config.js | 54 ++++++ pc4mobx/hrmSalary/stores/ledger.js | 58 ++++--- 7 files changed, 527 insertions(+), 40 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAccountApprRule.js create mode 100644 pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAccountApprRuleClassifyNameEditDialog.js create mode 100644 pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAccountSalaryItemsSet.js 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/ledgerPage/components/ledgerAccountApprRule.js b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAccountApprRule.js new file mode 100644 index 00000000..59990157 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAccountApprRule.js @@ -0,0 +1,160 @@ +/* + * Author: 黎永顺 + * name: 薪资核算规则配置 + * Description: + * Date: 2024/4/24 + */ +import React, { Component } from "react"; +import { WeaSwitch } from "comsMobx"; +import { inject, observer } from "mobx-react"; +import { WeaFormItem, WeaLocaleProvider, WeaSearchGroup, WeaTools } from "ecCom"; +import LedgerAccountSalaryItemsSet from "./ledgerAccountSalaryItemsSet"; +import * as API from "../../../apis/ledger"; +import { acctApprRulesConditions } from "../config"; + +const getLabel = WeaLocaleProvider.getLabel; +const getKey = WeaTools.getKey; + +@inject("ledgerStore") +@observer +class LedgerAccountApprRule extends Component { + constructor(props) { + super(props); + this.state = { + conditions: [], approvalId: "", approvalItemGroup: [] + }; + } + + componentDidMount() { + this.init(); + } + + init = () => { + const { saveSalarySobId, editId } = this.props; + API.getSalaryApprovalForm({ salarySobId: saveSalarySobId || editId }).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: _.map(approvalItemGroup, o => ({ + ...o, groupName: groupId === o.id ? groupName : o.groupName + })) + }, () => 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..482f3ea5 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAccountApprRuleClassifyNameEditDialog.js @@ -0,0 +1,71 @@ +/* + * 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 } = 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); + 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..7152c7ba --- /dev/null +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAccountSalaryItemsSet.js @@ -0,0 +1,134 @@ +/* + * Author: 黎永顺 + * name: 薪资核算规则配置-审批薪资项目 + * Description: + * Date: 2024/4/24 + */ +import React, { Component } from "react"; +import { 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: "" }, + 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 } = this.props; + const payload = { + salarySobId, excludeIds: _.map(group.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.onAdd(salaryItemDialog.groupId, _.filter(this.state.salaryItemDialog.options, g => g.checkedSalaryItem))); + }; + + render() { + const { editDialog, salaryItemDialog } = this.state; + const { datas } = this.props; + return ( +
+ this.props.onChange(list)} + renderNodeItem={(item) => { + return
+
+ + {item.groupName} + + this.setState({ + editDialog: { visible: true, groupName: item.groupName, groupId: item.id } + })}/> + 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 5692c526..07c4cd0d 100644 --- a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSlide.js +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSlide.js @@ -6,7 +6,7 @@ */ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; -import { WeaSlideModal, WeaSteps } from "ecCom"; +import { WeaLocaleProvider, WeaSlideModal, WeaSteps } from "ecCom"; import { Button, message, Modal } from "antd"; import SlideModalTitle from "../../../components/slideModalTitle"; import LedgerBaseSetting from "./ledgerBaseSetting"; @@ -14,17 +14,12 @@ import LedgerAssociatedPersonnel from "./ledgerAssociatedPersonnel"; import LedgerSalaryAdjustmentRules from "./ledgerSalaryAdjustmentRules"; import LedgerBackCalculatedSalaryItem from "./ledgerBackCalculatedSalaryItem"; import LedgerSalaryItem from "./ledgerSalaryItem"; -import { saveAdjustmentRule, saveLedgerBasic, saveLedgerItem } from "../../../apis/ledger"; +import LedgerAccountApprRule from "./ledgerAccountApprRule"; +import { salaryApprovalSaveForm, saveAdjustmentRule, saveLedgerBasic, saveLedgerItem } from "../../../apis/ledger"; import "./index.less"; const Step = WeaSteps.Step; -const tabs = [ - { key: 0, title: "基础设置" }, - { key: 1, title: "关联人员" }, - { key: 2, title: "薪资项目" }, - { key: 3, title: "回算薪资项目" }, - { key: 4, title: "调薪计薪规则" } -]; +const getLabel = WeaLocaleProvider.getLabel; @inject("taxAgentStore", "ledgerStore") @observer @@ -95,7 +90,6 @@ class LedgerSlide extends Component { this.setState({ loading: false }); if (status) { message.success("保存成功"); - this.handleClose(); } else { message.success(errormsg || "保存失败"); } @@ -166,6 +160,40 @@ class LedgerSlide extends Component { 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); + } + }); + }; renderChildren = () => { const { current, saveSalarySobId } = this.state; let CurrentDom = null; @@ -189,7 +217,8 @@ class LedgerSlide extends Component { onSaveParams={(adjustRules) => this.setState({ adjustRules })}/>; break; default: - CurrentDom = null; + CurrentDom = + this.approRef = dom} saveSalarySobId={saveSalarySobId}/>; break; } return CurrentDom; @@ -245,13 +274,28 @@ class LedgerSlide extends Component { case 4: CurrentDom = !editId ? [ + , , - + ] : [ - + ]; break; default: + CurrentDom = !editId ? + [ + , + + ] : [ + + ]; break; } } @@ -261,6 +305,14 @@ class LedgerSlide extends Component { render() { const { title, visible, editId, taxAgentStore: { showOperateBtn } } = this.props; const { current } = this.state; + const tabs = [ + { key: 0, title: getLabel(82751, "基础设置") }, + { key: 1, title: getLabel(543467, "关联人员") }, + { key: 2, title: getLabel(542362, "薪资项目") }, + { key: 3, title: getLabel(543468, "回算薪资项目") }, + { key: 4, title: getLabel(543469, "调薪计薪规则") }, + { key: 10, title: getLabel(111, "核算审批规则") } + ]; return ( 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("保存成功"); From 2e5404bee63f1b485bcf4be8e181669f074b00d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Thu, 25 Apr 2024 16:07:04 +0800 Subject: [PATCH 02/38] =?UTF-8?q?feature/2.12.1.2404.02-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E8=B4=A6=E5=A5=97=E9=85=8D=E7=BD=AE=E6=B5=81=E7=A8=8B=E5=AE=A1?= =?UTF-8?q?=E6=89=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/calculate.js | 4 + .../hrmSalary/pages/calculate/doCalc/index.js | 18 ++- .../components/ledgerAccountApprRule.js | 12 +- ...erAccountApprRuleClassifyNameEditDialog.js | 5 +- .../components/ledgerAccountSalaryItemsSet.js | 147 ++++++++++-------- 5 files changed, 109 insertions(+), 77 deletions(-) diff --git a/pc4mobx/hrmSalary/apis/calculate.js b/pc4mobx/hrmSalary/apis/calculate.js index 0abda464..e4431c8a 100644 --- a/pc4mobx/hrmSalary/apis/calculate.js +++ b/pc4mobx/hrmSalary/apis/calculate.js @@ -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); +}; diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/index.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/index.js index d8a8d78e..d7e6dd26 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,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 ( - +
{ 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" > - this.setState({ + 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) : diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAccountApprRuleClassifyNameEditDialog.js b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAccountApprRuleClassifyNameEditDialog.js index 482f3ea5..9958b727 100644 --- a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAccountApprRuleClassifyNameEditDialog.js +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAccountApprRuleClassifyNameEditDialog.js @@ -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 ( {getLabel(537558, "保存")} ]} diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAccountSalaryItemsSet.js b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAccountSalaryItemsSet.js index 7152c7ba..1f53c37b 100644 --- a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAccountSalaryItemsSet.js +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAccountSalaryItemsSet.js @@ -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 ( -
- this.props.onChange(list)} - renderNodeItem={(item) => { - 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 } + 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) })) + 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) })) + } + }); + }} + /> +
+
+
); } From ffeb4283b2b1c2e01bf88c92b8ee64aa8ed9b0f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Fri, 26 Apr 2024 11:23:19 +0800 Subject: [PATCH 03/38] =?UTF-8?q?feature/2.12.1.2404.02-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E8=B4=A6=E5=A5=97=E9=85=8D=E7=BD=AE=E6=B5=81=E7=A8=8B=E5=AE=A1?= =?UTF-8?q?=E6=89=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/pages/calculate/doCalc/index.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/index.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/index.js index d7e6dd26..c1a24fa8 100644 --- a/pc4mobx/hrmSalary/pages/calculate/doCalc/index.js +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/index.js @@ -45,10 +45,8 @@ class Index extends Component { init = () => { const { routeParams: { salaryAcctRecordId } } = this.props; - getApprovalInfoByRecordId({ salaryAcctRecordId }).then(({ status, data }) => { - if (status) { - console.log(data); - } + getApprovalInfoByRecordId({ salaryAcctRecordId }).then(({ status, data: approvalInfo }) => { + if (status) this.setState({ approvalInfo }); }); }; handleMenuClick = ({ key }) => { @@ -144,7 +142,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 } = approvalInfo; let reqBtns = []; switch (selectedKey) { case "calc": @@ -169,6 +169,9 @@ class Index extends Component { this.calc.openAdvanceSearch()} onAdvanceSearch={() => this.calc.onAdSearch(false)}/> ]; + isOpenApproval && reqBtns.unshift(); accountExceptInfo && reqBtns.unshift( this.downloadTxtfile(accountExceptInfo)}/>); From e58f5e73e0c362a83e0b107f48f2f345b1c2479c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Sun, 28 Apr 2024 17:53:12 +0800 Subject: [PATCH 04/38] =?UTF-8?q?feature/2.12.1.2404.02-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E8=B4=A6=E5=A5=97=E9=85=8D=E7=BD=AE=E6=B5=81=E7=A8=8B=E5=AE=A1?= =?UTF-8?q?=E6=89=B9=20=E6=B7=BB=E5=8A=A0=E8=A7=84=E5=88=99=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ledgerPage/components/ledgerSlide.js | 45 ++++++++---- .../hrmSalary/pages/ruleConfig/conditions.js | 68 +++++++++++++++++++ .../hrmSalary/pages/ruleConfig/ruleConfig.js | 51 ++++++++++++-- 3 files changed, 145 insertions(+), 19 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSlide.js b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSlide.js index 07c4cd0d..e97f89c6 100644 --- a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSlide.js +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSlide.js @@ -16,6 +16,7 @@ import LedgerBackCalculatedSalaryItem from "./ledgerBackCalculatedSalaryItem"; import LedgerSalaryItem from "./ledgerSalaryItem"; import LedgerAccountApprRule from "./ledgerAccountApprRule"; import { salaryApprovalSaveForm, saveAdjustmentRule, saveLedgerBasic, saveLedgerItem } from "../../../apis/ledger"; +import { sysConfCodeRule } from "../../../apis/ruleconfig"; import "./index.less"; const Step = WeaSteps.Step; @@ -32,10 +33,18 @@ class LedgerSlide extends Component { baseSettingInfo: {}, adjustRules: [], empFields: [], itemGroups: [], - saveSalarySobId: "" + 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: "" @@ -225,7 +234,7 @@ class LedgerSlide extends Component { }; renderCustomOperate = () => { const { taxAgentStore: { showOperateBtn }, editId } = this.props; - const { current, loading } = this.state; + const { current, loading, salaryApprovalStatus } = this.state; let CurrentDom = []; //管理员操作权限 if (showOperateBtn) { @@ -272,16 +281,25 @@ class LedgerSlide extends Component { ] : []; break; case 4: - CurrentDom = !editId ? - [ - , - , - - ] : [ - - ]; + const btns = salaryApprovalStatus ? [ + , + , + + ] : [ + , + + ]; + CurrentDom = !editId ? btns : [ + + ]; break; default: CurrentDom = !editId ? @@ -304,7 +322,7 @@ class LedgerSlide extends Component { render() { const { title, visible, editId, taxAgentStore: { showOperateBtn } } = this.props; - const { current } = this.state; + const { current, salaryApprovalStatus } = this.state; const tabs = [ { key: 0, title: getLabel(82751, "基础设置") }, { key: 1, title: getLabel(543467, "关联人员") }, @@ -313,6 +331,7 @@ class LedgerSlide extends Component { { key: 4, title: getLabel(543469, "调薪计薪规则") }, { key: 10, title: getLabel(111, "核算审批规则") } ]; + !salaryApprovalStatus && tabs.splice(_.indexOf(tabs, { key: 10 }), 1); return ( ({ - ...item, + ...item, title: getLabel(item.lanId, item.title), items: _.map(item.items, o => { if (getKey(o) === "matchRule" || getKey(o) === "orderRule" || getKey(o) === "ascOrDesc" || getKey(o) === "rule") { - return { ...o, options: _.map(optionsList[getKey(o)], g => ({ key: g.value, showname: g.defaultLabel })) }; + return { + ...o, label: getLabel(o.lanId, o.label), + options: _.map(optionsList[getKey(o)], g => ({ key: g.value, showname: g.defaultLabel })) + }; } else if (getKey(o) === "OPEN_APPLICATION_ENCRYPT") { - return { ...o, viewAttr: sysinfo.showEncryptOperationButton === "true" ? 2 : 1 }; + return { + ...o, label: getLabel(o.lanId, o.label), + viewAttr: sysinfo.showEncryptOperationButton === "true" ? 2 : 1 + }; } else if (getKey(o) === "taxDeclarationFunction") { return { - ...o, + ...o, label: getLabel(o.lanId, o.label), 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 }; + return { ...o, label: getLabel(o.lanId, o.label) }; }) })) }, async () => { @@ -73,6 +86,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] || "" } }); } @@ -116,6 +133,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": const confTitle = { welBaseDiffByPerAndCom: getLabel(111, "福利档案基数区分个人和公司"), welBaseAutoAdjust: getLabel(111, "福利档案导入基数不符合要求时自动调整为上限/下限"), @@ -123,7 +144,11 @@ class RuleConfig extends Component { extEmpsWitch: getLabel(544097, "开启非系统人员"), taxAgentShowStatus: getLabel(111, "显示【个税扣缴义务人】信息"), salaryShowStatus: getLabel(111, "显示工资单页签"), - adjustShowStatus: 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, "审批流程发起后允许修改核算数据") }; this.unifiedSettings(key, confTitle[key]); break; @@ -292,6 +317,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, "保存失败!")); } From 9476ffb62a8b377d16c5919b56d8f0b78e03bdce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Mon, 29 Apr 2024 16:44:46 +0800 Subject: [PATCH 05/38] =?UTF-8?q?feature/2.12.1.2404.02-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E8=B4=A6=E5=A5=97=E9=85=8D=E7=BD=AE=E6=B5=81=E7=A8=8B=E5=AE=A1?= =?UTF-8?q?=E6=89=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/salaryCalcPersonConfirm/index.js | 15 +++++++++------ pc4mobx/hrmSalary/pages/calculate/doCalc/index.js | 12 +++++++----- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.js index 68b7245f..7e1bece3 100644 --- a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.js +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.js @@ -78,6 +78,7 @@ class Index extends Component { renderTabBtns = () => { const { selectedKey, selectedRowKeys } = this.state; + const { calcDetail } = this.props; let tabBtns = []; switch (selectedKey) { case "range": @@ -92,6 +93,7 @@ class Index extends Component { , ]; + calcDetail && tabBtns.splice(0, 2); break; case "add": case "sub": @@ -182,7 +184,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 @@ -252,8 +254,8 @@ class Index extends Component { onAdReset={() => PCSearchForm.resetForm()} autoCalculateWidth /> { let width = ""; const { dataIndex } = item; @@ -272,9 +274,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 c1a24fa8..1455b6a8 100644 --- a/pc4mobx/hrmSalary/pages/calculate/doCalc/index.js +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/index.js @@ -144,7 +144,7 @@ class Index extends Component { renderReqBtns = () => { const { routeParams: { salaryAcctRecordId } } = this.props; const { selectedKey, accountExceptInfo, approvalInfo } = this.state; - const { isOpenApproval, approvalWorkflowUrl } = approvalInfo; + const { isOpenApproval, approvalWorkflowUrl, canEdit } = approvalInfo; let reqBtns = []; switch (selectedKey) { case "calc": @@ -155,7 +155,7 @@ class Index extends Component { ); const moreMenu = ( - {getLabel(32935, "导入")} + {canEdit && {getLabel(32935, "导入")}} {getLabel(81272, "导出全部")} {getLabel(544270, "自定义导出")} {getLabel(543249, "线下对比")} @@ -169,6 +169,7 @@ class Index extends Component { this.calc.openAdvanceSearch()} onAdvanceSearch={() => this.calc.onAdSearch(false)}/> ]; + !canEdit && reqBtns.splice(0, 1); isOpenApproval && reqBtns.unshift(); @@ -190,14 +191,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; From cfdc0cd5a057edbc8438bf075fd1bb3452c71de4 Mon Sep 17 00:00:00 2001 From: lys <971387674@qq.com> Date: Tue, 22 Oct 2024 14:53:36 +0800 Subject: [PATCH 06/38] release/2.16.1.2410.01 --- .../mySalaryBenefits/components/payrollTable/index.js | 2 +- pc4mobx/hrmSalary/pages/payroll/index.less | 5 +++++ .../hrmSalary/pages/payroll/templateBaseSettings.js | 10 +++++++++- pc4mobx/hrmSalary/pages/payrollRelease/index.less | 1 + 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/mySalaryBenefits/components/payrollTable/index.js b/pc4mobx/hrmSalary/pages/mySalaryBenefits/components/payrollTable/index.js index 4e746a70..16f992b3 100644 --- a/pc4mobx/hrmSalary/pages/mySalaryBenefits/components/payrollTable/index.js +++ b/pc4mobx/hrmSalary/pages/mySalaryBenefits/components/payrollTable/index.js @@ -46,7 +46,7 @@ class Index extends Component { if (it.column === "salaryYearMonth" || it.column === "sendTime") { return { dataIndex: it.column, title: it.text, width: it.width, - render: (__, record) => ({moment(record[it["column"]]).format("YYYY-MM")}) + render: (__, record) => ({record[it["column"]]}) }; } return { diff --git a/pc4mobx/hrmSalary/pages/payroll/index.less b/pc4mobx/hrmSalary/pages/payroll/index.less index e0f417dd..f3809e53 100644 --- a/pc4mobx/hrmSalary/pages/payroll/index.less +++ b/pc4mobx/hrmSalary/pages/payroll/index.less @@ -26,6 +26,11 @@ padding: 5px 16px; border-bottom: 1px solid #e5e5e5; + .wea-select { + width: 120px !important; + margin-left: 10px; + } + .wea-input-number { width: 80px !important; margin: 0 10px; diff --git a/pc4mobx/hrmSalary/pages/payroll/templateBaseSettings.js b/pc4mobx/hrmSalary/pages/payroll/templateBaseSettings.js index 9eaa2ece..7d2edc9c 100644 --- a/pc4mobx/hrmSalary/pages/payroll/templateBaseSettings.js +++ b/pc4mobx/hrmSalary/pages/payroll/templateBaseSettings.js @@ -106,7 +106,7 @@ class TemplateBaseSettings extends Component { render() { const { watermarkStatus, watermark, watermarkSet, ackFeedbackSetting, salaryBillViewingLimitSetting } = this.state; const { ackStatus, feedbackStatus, autoAckDays, feedBackUrl, mobileFeedbackUrl } = ackFeedbackSetting; - const { limitMonth, burningAfterReadingMin } = salaryBillViewingLimitSetting; + const { monthType = "SALARY_DATE", limitMonth, burningAfterReadingMin } = salaryBillViewingLimitSetting; return ( @@ -204,6 +204,14 @@ class TemplateBaseSettings extends Component {
{getLabel(111, "仅可查看")} + this.setState({ + salaryBillViewingLimitSetting: { ...salaryBillViewingLimitSetting, monthType } + })} + options={[ + { key: "SALARY_DATE", showname: getLabel(111, "薪资所属月"), selected: true }, + { key: "SEND_DATE", showname: getLabel(111, "发放日期") } + ]}/> this.setState({ salaryBillViewingLimitSetting: { diff --git a/pc4mobx/hrmSalary/pages/payrollRelease/index.less b/pc4mobx/hrmSalary/pages/payrollRelease/index.less index 245c991f..0caebb48 100644 --- a/pc4mobx/hrmSalary/pages/payrollRelease/index.less +++ b/pc4mobx/hrmSalary/pages/payrollRelease/index.less @@ -27,6 +27,7 @@ .salary-payroll-content { padding: 8px 16px; height: 100%; + overflow-y: auto; & > .wea-search-group { background: #FFF; From 02ff34c2021defda8f380f8e83cb65c88845ca84 Mon Sep 17 00:00:00 2001 From: lys <971387674@qq.com> Date: Wed, 23 Oct 2024 09:51:02 +0800 Subject: [PATCH 07/38] release/2.16.1.2410.01 --- .../calculate/doCalc/components/salaryEditCalc/editCalcTable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/editCalcTable.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/editCalcTable.js index d7ffbc62..aa6baf65 100644 --- a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/editCalcTable.js +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/editCalcTable.js @@ -332,7 +332,7 @@ const traverse = (arr, calcDetail) => { return _.map(arr, item => { if (!_.isEmpty(item.children)) { return { - title: item.text, width: item.width + "px", ellipsis: true, + title: item.text, width: item.width + "px", ellipsis: true, calcDetail, dataIndex: item.column, children: traverse(item.children, calcDetail), fixed: item.fixed || false, dataType: item.dataType, align: "center" }; From ef86c4faeffb83881584c5ce4824ef055788ec7b Mon Sep 17 00:00:00 2001 From: lys <971387674@qq.com> Date: Fri, 25 Oct 2024 09:49:15 +0800 Subject: [PATCH 08/38] release/2.16.1.2410.01 --- .../pages/socialSecurityBenefits/standingBook/standingBook.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/standingBook.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/standingBook.js index be80202c..ca615429 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/standingBook.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/standingBook.js @@ -79,7 +79,7 @@ class StandingBook extends Component { this.setState({ accountDialog: { ...this.state.accountDialog, visible: false } }, () => { - this.wfListRef.wrappedInstance.getWelfareRecordList(); + this.wfListRef.getWelfareRecordList(); const calcPayload = { ...payload, creator }; window.open(`/spa/hrmSalary/static/index.html#/main/hrmSalary/socialSecurityBenefits/standingBookDetail?${convertToUrlString(calcPayload)}`); }); @@ -138,7 +138,7 @@ class StandingBook extends Component { onSearch={(payload) => { this.setState({ queryForm: { ...queryForm, ...payload } - }, () => this.wfListRef.wrappedInstance.getWelfareRecordList()); + }, () => this.wfListRef.getWelfareRecordList()); }} onPutAccountOptions={options => this.setState({ accountDialog: { ...accountDialog, options } })} /> From c10e6fb3ee9a7a6fb6cf09bf7b3e02106372357c Mon Sep 17 00:00:00 2001 From: lys <971387674@qq.com> Date: Fri, 25 Oct 2024 11:46:00 +0800 Subject: [PATCH 09/38] =?UTF-8?q?feature/2.16.1.2410.01-=E6=AC=A1=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hrmSalary/pages/ruleConfig/conditions.js | 18 ++++++++++++++++++ pc4mobx/hrmSalary/pages/ruleConfig/form.js | 10 ++++++++-- pc4mobx/hrmSalary/pages/ruleConfig/index.less | 13 +++++++++++++ .../hrmSalary/pages/ruleConfig/ruleConfig.js | 4 +++- 4 files changed, 42 insertions(+), 3 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/ruleConfig/conditions.js b/pc4mobx/hrmSalary/pages/ruleConfig/conditions.js index bb22f65e..783b0cb5 100644 --- a/pc4mobx/hrmSalary/pages/ruleConfig/conditions.js +++ b/pc4mobx/hrmSalary/pages/ruleConfig/conditions.js @@ -59,6 +59,24 @@ export const conditions = [ lanId: 543358, defaultshow: true }, + { + items: [ + { + conditionType: "SWITCH", + domkey: ["openSecondaryAccount"], + fieldcol: 10, + label: "启用主次账号", + tip: "启用后,若有次账号相关档案,则此功能不能关闭。", + tipLanId: 111, + lanId: 111, + labelcol: 8, + viewAttr: 2 + } + ], + title: "主次身份", + lanId: 111, + defaultshow: true + }, { items: [ { diff --git a/pc4mobx/hrmSalary/pages/ruleConfig/form.js b/pc4mobx/hrmSalary/pages/ruleConfig/form.js index 9b17f248..09a946f8 100644 --- a/pc4mobx/hrmSalary/pages/ruleConfig/form.js +++ b/pc4mobx/hrmSalary/pages/ruleConfig/form.js @@ -1,8 +1,9 @@ import React from "react"; -import { WeaFormItem, WeaSearchGroup, WeaTools } from "ecCom"; +import { WeaFormItem, WeaHelpfulTip, WeaLocaleProvider, WeaSearchGroup, WeaTools } from "ecCom"; import { WeaSwitch } from "comsMobx"; const getKey = WeaTools.getKey; +const getLabel = WeaLocaleProvider.getLabel; export const renderRuleForm = (form, condition, onChange) => { const { isFormInit } = form; @@ -14,7 +15,12 @@ export const renderRuleForm = (form, condition, onChange) => { items.push({ com: ( + {fields.label} + {fields.tip && } +
} + labelCol={{ span: `${fields.labelcol}` }} wrapperCol={{ span: `${fields.fieldcol}` }} error={form.getError(fields)} tipPosition="bottom">
diff --git a/pc4mobx/hrmSalary/pages/payrollRelease/index.less b/pc4mobx/hrmSalary/pages/payrollRelease/index.less index 0caebb48..634a44e4 100644 --- a/pc4mobx/hrmSalary/pages/payrollRelease/index.less +++ b/pc4mobx/hrmSalary/pages/payrollRelease/index.less @@ -158,7 +158,7 @@ margin-left: 10px; position: absolute; top: 25%; - right: -208px; + right: -262px; margin-top: -2px; .sftv-item { From 000f36ec0eff3449ae02677fb32b1b428c90e9be Mon Sep 17 00:00:00 2001 From: lys <971387674@qq.com> Date: Mon, 28 Oct 2024 14:57:09 +0800 Subject: [PATCH 11/38] =?UTF-8?q?feature/2.15.2.2409.01=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E4=B8=9A=E5=8A=A1=E7=BA=BF=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fieldManagement/components/fieldSlide.js | 25 +++++++++---------- .../fieldManagement/components/fieldTable.js | 7 +++--- .../hrmSalary/pages/fieldManagement/index.js | 5 ++-- .../salaryFileAdvanceSearchPannel/index.js | 6 ++--- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js b/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js index 8a6533ee..047ced9c 100644 --- a/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js +++ b/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js @@ -22,6 +22,7 @@ import SlideModalTitle from "../../../components/slideModalTitle"; import { getSalaryFieldForm, saveSalaryField } from "../../../apis/fieldManage"; import { commonEnumList } from "../../../apis/payrollFiles"; import { dataTypeOptions, patternOptions, roundingModeOptions } from "../../salaryItem/options"; +import { postFetch } from "../../../util/request"; const getLabel = WeaLocaleProvider.getLabel; @@ -44,15 +45,17 @@ class FieldSlide extends Component { pattern: "2", sortedIndex: "", width: "", - description: "" + description: "", + taxAgentOption: [] }; } componentDidMount() { - const { taxAgentStore } = this.props; this.commonEnumList(); - const { fetchTaxAgentOption } = taxAgentStore; - fetchTaxAgentOption(); + postFetch("/api/bs/hrmsalary/taxAgent/listAuth", { filterType: "ADMIN_DATA" }) + .then(({ status, data }) => { + if (status) this.setState({ taxAgentOption: _.map(data, o => ({ key: String(o.id), showname: o.name })) }); + }); } componentWillReceiveProps(nextProps, nextContext) { @@ -203,13 +206,8 @@ class FieldSlide extends Component { }; render() { - const { - title, - visible, - record: { id: editId }, - taxAgentStore: { taxAgentOption, showSalaryItemBtn, showOperateBtn }, - onCancel - } = this.props; + const { title, visible, record: { id: editId }, onCancel, taxAgentStore: { PageAndOptAuth } } = this.props; + const admin = PageAndOptAuth.opts.includes("admin"); const { loading, name, @@ -224,7 +222,8 @@ class FieldSlide extends Component { pattern, sortedIndex, width, - description + description, + taxAgentOption } = this.state; return ( } diff --git a/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldTable.js b/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldTable.js index 840da963..d470705b 100644 --- a/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldTable.js +++ b/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldTable.js @@ -57,7 +57,8 @@ class FieldTable extends Component { getColumns = () => { const { columns } = this.state; const { taxAgentStore, onEditLedger, onDeleteLedger } = this.props; - const { showSalaryItemBtn, showOperateBtn } = taxAgentStore; + const { PageAndOptAuth } = taxAgentStore; + const admin = PageAndOptAuth.opts.includes("admin"); return _.map([...columns, { dataIndex: "operate", display: true, @@ -72,9 +73,9 @@ class FieldTable extends Component { item.render = (text, record) => { return
onEditLedger(record)}>{(showSalaryItemBtn || showOperateBtn) ? "编辑" : "查看"} + onClick={() => onEditLedger(record)}>{admin ? "编辑" : "查看"} { - record.canDelete && (showSalaryItemBtn || showOperateBtn) && + record.canDelete && admin && onDeleteLedger(record)}>删除 } } iconBgcolor="#F14A2D" className="fieldManageWrapper" - buttons={(showSalaryItemBtn || showOperateBtn) ? btns : btns.slice(-1)} + buttons={admin ? btns : btns.slice(-1)} showDropIcon onDropMenuClick={this.onDropMenuClick} dropMenuDatas={[ { diff --git a/pc4mobx/hrmSalary/pages/payrollFiles/components/salaryFileAdvanceSearchPannel/index.js b/pc4mobx/hrmSalary/pages/payrollFiles/components/salaryFileAdvanceSearchPannel/index.js index 3f164873..bf066c7f 100644 --- a/pc4mobx/hrmSalary/pages/payrollFiles/components/salaryFileAdvanceSearchPannel/index.js +++ b/pc4mobx/hrmSalary/pages/payrollFiles/components/salaryFileAdvanceSearchPannel/index.js @@ -11,7 +11,7 @@ import { inject, observer } from "mobx-react"; import { getSearchs } from "../../../../util"; import * as API from "../../../../apis/payrollFiles"; import { salaryFileSearchConditions } from "../../config"; -import { getTaxAgentSelectList } from "../../../../apis/taxAgent"; +import { postFetch } from "../../../../util/request"; const getLabel = WeaLocaleProvider.getLabel; const getKey = WeaTools.getKey; @@ -29,7 +29,7 @@ class salaryFileAdvanceSearchPannel extends Component { async componentDidMount() { const [{ data: userStatusList }, { data: taxAgentList }] = await Promise.all([ API.commonEnumList({ enumClass: "com.engine.salary.enums.UserStatusEnum" }), - getTaxAgentSelectList() + postFetch("/api/bs/hrmsalary/taxAgent/listAuth", { filterType: "QUERY_DATA" }) ]); this.setState({ searchConditions: _.map(salaryFileSearchConditions, item => { @@ -44,7 +44,7 @@ class salaryFileAdvanceSearchPannel extends Component { } else if (getKey(child) === "taxAgentIds") { return { ...child, - options: _.map(taxAgentList, o => ({ key: o.id, showname: o.content })) + options: _.map(taxAgentList, o => ({ key: String(o.id), showname: o.name })) }; } return { ...child }; From 8488f54aac84b820f1fad6451f3c05be856b0fa9 Mon Sep 17 00:00:00 2001 From: lys <971387674@qq.com> Date: Tue, 29 Oct 2024 09:21:38 +0800 Subject: [PATCH 12/38] release/2.16.1.2410.01 --- .../pages/ledgerPage/components/ledgerSalaryItemTable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItemTable.js b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItemTable.js index 838f44a0..7c160168 100644 --- a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItemTable.js +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItemTable.js @@ -173,7 +173,7 @@ class LedgerSalaryItemTable extends Component { this.setState({ editFormulModal: { ...editFormulModal, visible: true, valueType, dataType, name: salaryItemName, - formulaId: ((valueType.toString() === "2" && (originFormulaContent || originFormulaContent !== " ")) || valueType.toString() === "3" && (originSqlContent || originSqlContent === " ")) ? formulaId : "" + formulaId: ((valueType.toString() === "2" && (originFormulaContent || originFormulaContent !== " ")) || valueType.toString() === "3" && (originSqlContent || originSqlContent !== " ")) ? formulaId : "" } }); }; From c5a62b3c26a2af0d71cfeae7827c04f3197560a8 Mon Sep 17 00:00:00 2001 From: lys <971387674@qq.com> Date: Wed, 30 Oct 2024 10:20:43 +0800 Subject: [PATCH 13/38] =?UTF-8?q?custom/=E4=BA=AC=E8=B4=B5=E6=8A=95?= =?UTF-8?q?=E8=B5=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/dataAcquisition/addItems.js | 4 +- .../dataAcquisition/cumDeduct/columns.js | 6 +- .../pages/dataAcquisition/cumDeduct/index.js | 10 +- .../pages/dataAcquisition/dataTables.js | 94 ++++++++++++++----- .../pages/dataAcquisition/index.less | 15 ++- .../hrmSalary/pages/dataAcquisition/layout.js | 7 +- 6 files changed, 97 insertions(+), 39 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js b/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js index 5b05c2d6..a3a98e5e 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js @@ -61,8 +61,8 @@ class AddItems extends Component { render() { const { form, condition = [] } = this.props; return ( -
- {getSearchs(form, condition)} +
+ {getSearchs(form, condition, 2, false)} 若此员工数据已存在在同期列表中,则当前数据保存后会覆盖列表数据
); diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/columns.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/columns.js index 742d1573..8945d37b 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/columns.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/columns.js @@ -404,7 +404,7 @@ export const dataCollectCondition = [ fieldcol: 12, label: "税款所属期", lanId: 542240, - labelcol: 4, + labelcol: 8, value: "", rules: "required|string", viewAttr: 3 @@ -414,7 +414,7 @@ export const dataCollectCondition = [ domkey: ["taxAgentId"], fieldcol: 12, label: "个税扣缴义务人", - labelcol: 4, + labelcol: 8, lanId: 537996, value: "", options: [], @@ -448,7 +448,7 @@ export const dataCollectCondition = [ isQuickSearch: false, label: "人员", lanId: 30042, - labelcol: 4, + labelcol: 8, rules: "required", viewAttr: 3 } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js index 9f1e481f..2d7d12f6 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js @@ -244,10 +244,12 @@ class Index extends Component { }; this.handleSaveDeduction(payload); } else { - Modal.warning({ - title: "信息确认", - content: "必要信息不完整,红色*为必填项!" - }); + f.showErrors(); + this.forceUpdate(); + // Modal.warning({ + // title: "信息确认", + // content: "必要信息不完整,红色*为必填项!" + // }); } }); }; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js b/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js index e677d531..58acfc56 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js @@ -5,9 +5,9 @@ * Date: 2023/2/17 */ import React, { Component } from "react"; -import UnifiedTable from "../../components/UnifiedTable"; +// import UnifiedTable from "../../components/UnifiedTable"; import { getTableDate } from "../../apis/cumDeduct"; -import { Menu, Popover } from "antd"; +import { Menu, Popover, Spin } from "antd"; import { WeaLocaleProvider } from "ecCom"; const getLabel = WeaLocaleProvider.getLabel; @@ -16,24 +16,44 @@ class DataTables extends Component { constructor(props) { super(props); this.state = { - loading: { - query: false - }, - dataSource: [], - columns: [], - selectedRowKeys: [], - pageInfo: { - current: 1, pageSize: 10, total: 0 - } + loading: { query: false }, dataSource: [], columns: [], selectedRowKeys: [], + pageInfo: { current: 1, pageSize: 10, total: 0 } }; } componentDidMount() { - this.getTableDate(); + window.addEventListener("message", this.handleReceive, false); } + componentWillUnmount() { + window.removeEventListener("message", this.handleReceive, false); + } + + handleReceive = async ({ data }) => { + const { type, payload: { id, params } = {} } = data; + if (type === "init") { + this.getTableDate(); + } else if (type === "turn") { + switch (id) { + case "PAGEINFO": + this.setState({ pageInfo: { ...this.state.pageInfo, ...params } }, () => this.getTableDate()); + break; + case "CHECKBOX": + const { selectedRowKeys } = params; + this.setState({ selectedRowKeys }); + break; + case "DEL": + break; + case "EDIT": + break; + default: + break; + } + } + }; + getTableDate = (extraPayload = {}) => { - const { loading, pageInfo } = this.state; + const { loading, pageInfo, selectedRowKeys } = this.state; const { url, payload } = this.props; const module = { ...pageInfo, url, ...payload, ...extraPayload, @@ -45,10 +65,12 @@ class DataTables extends Component { if (status) { const { columns, list: dataSource, pageNum: current, pageSize, total } = data; this.setState({ - pageInfo: { ...pageInfo, current, pageSize, total }, - dataSource, - columns - }); + pageInfo: { ...pageInfo, current, pageSize, total }, dataSource, columns + }, () => this.postMessageToChild({ + dataSource: this.state.dataSource, scrollHeight: 95, selectedRowKeys, + pageInfo: this.state.pageInfo, unitTableType: "dataAcquisition", + columns: this.state.columns + })); } }).catch(() => this.setState({ loading: { ...loading, query: false } })); }; @@ -59,6 +81,14 @@ class DataTables extends Component { * Date: 2023/2/20 */ handleClearRows = () => this.setState({ selectedRowKeys: [] }); + postMessageToChild = (payload = {}) => { + const i18n = { + "操作": getLabel(30585, "操作"), "编辑": getLabel(111, "编辑"), "共": getLabel(18609, "共"), + "条": getLabel(18256, "条"), "删除": getLabel(111, "删除") + }; + const childFrameObj = document.getElementById("unitTable"); + childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*"); + }; render() { const { columns, dataSource, loading, selectedRowKeys, pageInfo } = this.state; @@ -168,15 +198,27 @@ class DataTables extends Component { }; } }); - return ; + let height = 280; + if (dataSource.length > 0) height = dataSource.length <= 10 ? dataSource.length * 46 + 108 : 500; + return (
+ +