From cd897394b6855bff887b2c9d0a74986b5a34f95d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Sat, 28 Jan 2023 10:10:00 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=AD=97=E6=AE=B5=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/fieldManage.js | 11 + pc4mobx/hrmSalary/index.js | 2 + .../fieldManagement/components/fieldSlide.js | 271 ++++++++++++++++++ .../fieldManagement/components/fieldTable.js | 182 ++++++++++++ .../hrmSalary/pages/fieldManagement/index.js | 84 ++++++ .../pages/fieldManagement/index.less | 29 ++ .../components/ledgerBaseSetting.js | 2 +- pc4mobx/hrmSalary/pages/payrollFiles/index.js | 15 +- 8 files changed, 587 insertions(+), 9 deletions(-) create mode 100644 pc4mobx/hrmSalary/apis/fieldManage.js create mode 100644 pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js create mode 100644 pc4mobx/hrmSalary/pages/fieldManagement/components/fieldTable.js create mode 100644 pc4mobx/hrmSalary/pages/fieldManagement/index.js create mode 100644 pc4mobx/hrmSalary/pages/fieldManagement/index.less diff --git a/pc4mobx/hrmSalary/apis/fieldManage.js b/pc4mobx/hrmSalary/apis/fieldManage.js new file mode 100644 index 00000000..f8ac7a27 --- /dev/null +++ b/pc4mobx/hrmSalary/apis/fieldManage.js @@ -0,0 +1,11 @@ +import { WeaTools } from "ecCom"; +import { postFetch } from "../util/request"; + +//获取薪资档案各tab的人数 +export const queryTabTotal = (params) => { + return WeaTools.callApi("/api/bs/hrmsalary/salaryArchive/queryTabTotal", "GET", params); +}; +// 导入档案 +export const salaryFieldList = (params) => { + return postFetch('/api/bs/hrmsalary/salaryField/list', params); +} diff --git a/pc4mobx/hrmSalary/index.js b/pc4mobx/hrmSalary/index.js index 9f796db5..9faba78d 100644 --- a/pc4mobx/hrmSalary/index.js +++ b/pc4mobx/hrmSalary/index.js @@ -31,6 +31,7 @@ import MobilePayroll from "./pages/mobilePayroll"; import SysConfig from "./pages/sysConfig"; import RuleConfig from "./pages/ruleConfig"; import Appconfig from "./pages/appConfig"; +import FieldManagement from "./pages/fieldManagement"; import stores from "./stores"; import "./style/index"; @@ -147,6 +148,7 @@ const Routes = ( + ); diff --git a/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js b/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js new file mode 100644 index 00000000..9d9c7d9c --- /dev/null +++ b/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js @@ -0,0 +1,271 @@ +/* + * Author: 黎永顺 + * name: 编辑新增字段弹框 + * Description: + * Date: 2023/1/19 + */ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { WeaFormItem, WeaHelpfulTip, WeaInput, WeaSelect, WeaSlideModal, WeaTextarea } from "ecCom"; +import { message, Modal, Switch } from "antd"; +import SlideModalTitle from "../../../components/slideModalTitle"; +import { saveAdjustmentRule, saveLedgerBasic, saveLedgerItem } from "../../../apis/ledger"; +import { commonEnumList } from "../../../apis/payrollFiles"; +import { dataTypeOptions, patternOptions, roundingModeOptions } from "../../salaryItem/options"; + +@inject("taxAgentStore") +@observer +class FieldSlide extends Component { + constructor(props) { + super(props); + this.state = { + current: 0, + loading: false, + sharedType: "", + shareTypeList: [], + taxAgentIds: "", + dataType: "number", + roundingMode: "", + pattern: "", + description: "", + }; + } + + componentDidMount() { + const { taxAgentStore } = this.props; + this.commonEnumList(); + const { getTaxAgentSelectListAsAdmin } = taxAgentStore; + getTaxAgentSelectListAsAdmin(); + } + + /* + * Author: 黎永顺 + * Description: 获取可见性列表 + * Params: + * Date: 2023/1/28 + */ + commonEnumList = () => { + const payload = { + enumClass: "com.engine.salary.enums.sicategory.SharedTypeEnum" + } + commonEnumList(payload).then(({ status, data }) => { + if (status) { + const result = _.map(data, it => ({ + key: String(it.value), + showname: it.defaultLabel + })); + this.setState({ + shareTypeList: [{ + key: "", + showname: "" + }, ...result] + }); + } + }); + }; + /* + * Author: 黎永顺 + * Description: 保存基本信息 + * Params: + * Date: 2022/12/12 + */ + saveLedgerBasic = () => { + const { baseSettingInfo, current } = this.state; + const { editId } = this.props; + const { description, canEdit, ...extra } = baseSettingInfo; + const bool = _.every(Object.keys(extra), key => !!extra[key]); + if (!bool || _.isEmpty(baseSettingInfo)) { + Modal.warning({ + title: "信息确认", + content: "必要信息不完整,红色*为必填项!" + }); + return false; + } + this.setState({ loading: true }); + saveLedgerBasic({ ...extra, description, id: editId }).then(({ status, data, errormsg }) => { + this.setState({ loading: false }); + if (status) { + const { onRefreshList } = this.props; + message.success("保存成功"); + onRefreshList(); + !editId && this.setState({ current: current + 1, saveSalarySobId: data }); + } else { + message.error(errormsg || "保存失败"); + } + }).catch(() => this.setState({ loading: false })); + }; + /* + * Author: 黎永顺 + * Description: 保存调薪计薪规则 + * Params: + * Date: 2022/12/12 + */ + saveLedgerAdjustRule = () => { + const { adjustRules, saveSalarySobId } = this.state; + const payload = { + salarySobId: this.props.editId || saveSalarySobId, + ruleParams: adjustRules + }; + this.setState({ loading: true }); + saveAdjustmentRule(payload).then(({ status, errormsg }) => { + this.setState({ loading: false }); + if (status) { + message.success("保存成功"); + this.handleClose(); + } else { + message.success(errormsg || "保存失败"); + } + }).catch(() => this.setState({ loading: false })); + }; + /* + * Author: 黎永顺 + * Description: 薪资项目保存 + * Params: + * Date: 2022/12/14 + */ + saveLedgerItem = () => { + const { empFields, itemGroups, saveSalarySobId } = this.state; + const { editId: salarySobId } = this.props; + const payload = { + empFields, + itemGroups: _.filter(itemGroups, it => it.name !== "未分类"), + items: _.find(itemGroups, it => it.name === "未分类").items || [], + salarySobId: salarySobId || saveSalarySobId + }; + this.setState({ loading: true }); + saveLedgerItem(payload).then(({ status, errormsg }) => { + this.setState({ loading: false }); + if (status) { + message.success("保存成功"); + } else { + message.error(errormsg || "保存失败"); + } + }).catch(() => this.setState({ loading: false })); + }; + handleChangeSlideTab = (current) => { + this.setState({ current: Number(current) }); + }; + /* + * Author: 黎永顺 + * Description: 基础信息字段切换 + * Params: + * Date: 2022/12/9 + */ + handleChangeSaveParams = (baseSettingInfo) => { + this.setState({ baseSettingInfo }); + }; + /* + * Author: 黎永顺 + * Description: 薪资项目保存数据 + * Params: + * Date: 2022/12/14 + */ + handleSaveSalaryItemParams = (empFields, itemGroups) => { + this.setState({ empFields, itemGroups }); + }; + + render() { + const { title, visible, editId, taxAgentStore: { showOperateBtn, taxAgentAdminOption }, onCancel } = this.props; + const { shareTypeList, sharedType, taxAgentIds, dataType, roundingMode, pattern, description } = this.state; + return ( + { + console.log(11111); + }} + /> + } + content={ +
+ + + + + { + }} + /> + + + + { + }} + style={{ width: 200 }} + /> + + { + sharedType === "1" && + + { + }} + /> + + } + + { + }} + style={{ width: 200 }} + /> + + + { + }} + /> + + + { + }} + /> + + + { + }} + /> + +
+ } + onClose={onCancel} + /> + ); + } +} + +export default FieldSlide; + diff --git a/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldTable.js b/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldTable.js new file mode 100644 index 00000000..64f8ca76 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldTable.js @@ -0,0 +1,182 @@ +/* + * Author: 黎永顺 + * name: 字段列表 + * Description: + * Date: 2023/1/19 + */ +import React, { Component } from "react"; +import { WeaTable } from "ecCom"; +import { inject, observer } from "mobx-react"; +import { message, Modal, Switch } from "antd"; +import { salaryFieldList } from "../../../apis/fieldManage"; + +@inject("taxAgentStore") +@observer +class FieldTable extends Component { + constructor(props) { + super(props); + this.state = { + loading: false, + dataSource: [], + columns: [], + pageInfo: { + current: 1, + pageSize: 10, + total: 0 + } + }; + } + + componentDidMount() { + this.salaryFieldList(); + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.doSearch !== this.props.doSearch) this.salaryFieldList({ current: 1 }); + } + + salaryFieldList = (extra = {}) => { + const { name } = this.props; + const { pageInfo } = this.state; + const payload = { name, ...pageInfo, ...extra }; + this.setState({ loading: true }); + salaryFieldList(payload).then(({ status, data }) => { + this.setState({ loading: false }); + if (status) { + const { pageNum: current, pageSize, total, columns, list: dataSource } = data; + this.setState({ + pageInfo: { ...pageInfo, current, pageSize, total }, + dataSource, + columns + }); + } + }); + }; + getColumns = () => { + const { columns } = this.state; + const { taxAgentStore, onEditLedger } = this.props; + const { showOperateBtn } = taxAgentStore; + return _.map([...columns, { + dataIndex: "operate", + display: true, + key: "operate", + title: "操作" + }], item => { + const { dataIndex } = item; + if (dataIndex === "useDefault") { + item.render = (text) => (); + } else if (dataIndex === "operate") { + item.width = 120; + item.render = (text, record) => { + return ; + }; + } else { + item.render = (text) => { + return {text}; + }; + } + return { ...item }; + }); + }; + /* + * Author: 黎永顺 + * Description: 刪除薪资账套 + * Params: + * Date: 2022/12/8 + */ + deleteLedger = (payload) => { + deleteLedger(payload).then(({ status, errormsg }) => { + if (status) { + message.success("删除成功"); + this.salaryFieldList(); + } else { + message.error(errormsg || "删除失败"); + } + }); + }; + /* + * Author: 黎永顺 + * Description: 启用/关闭账套 + * Params: + * Date: 2022/12/8 + */ + changeLedgerStatus = (payload) => { + changeLedgerStatus(payload).then(({ status, errormsg }) => { + if (status) { + message.success("操作成功"); + this.salaryFieldList(); + } else { + message.error(errormsg || "操作成功"); + } + }); + }; + handleResetCopy = () => { + const { copyLedgerModal } = this.state; + this.setState({ + copyLedgerModal: { ...copyLedgerModal, visible: false, id: "", name: "", taxAgenyId: "" } + }); + }; + handleMenuClick = ({ key }, record) => { + const { copyLedgerModal } = this.state; + const { id, name, taxAgentId } = record; + switch (key) { + case "copy": + this.setState({ + copyLedgerModal: { ...copyLedgerModal, visible: true, id, name, taxAgentId } + }); + break; + case "delete": + Modal.confirm({ + title: "信息确认", + content: "确认要删除吗?", + onOk: () => { + this.deleteLedger([id]); + } + }); + break; + default: + break; + } + }; + + render() { + const { dataSource, pageInfo, loading } = this.state; + const pagination = { + ...pageInfo, + showTotal: total => `共 ${total} 条`, + showQuickJumper: true, + showSizeChanger: true, + pageSizeOptions: ["10", "20", "50", "100"], + onShowSizeChange: (current, pageSize) => { + this.setState({ pageInfo: { ...pageInfo, current, pageSize } }, () => { + this.salaryFieldList(); + }); + }, + onChange: current => { + this.setState({ + pageInfo: { ...pageInfo, current } + }, () => { + this.salaryFieldList(); + }); + } + }; + return ( + + ); + } +} + +export default FieldTable; diff --git a/pc4mobx/hrmSalary/pages/fieldManagement/index.js b/pc4mobx/hrmSalary/pages/fieldManagement/index.js new file mode 100644 index 00000000..d42eba87 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/fieldManagement/index.js @@ -0,0 +1,84 @@ +/* + * Author: 黎永顺 + * name: 字段管理 + * Description: + * Date: 2023/1/18 + */ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { Button } from "antd"; +import { WeaInputSearch, WeaTop } from "ecCom"; +import FieldTable from "./components/fieldTable"; +import FieldSlide from "./components/fieldSlide"; +import "./index.less"; + +@inject("taxAgentStore") +@observer +class FieldManagement extends Component { + constructor(props) { + super(props); + this.state = { + searchVal: "", + doSearch: false, + slideparams: { + visible: false, + title: "新建字段", + editId: "" + } + }; + } + + handleEditField = (record) => { + const { slideparams } = this.state; + const { id } = record; + this.setState({ slideparams: { ...slideparams, visible: true, title: "编辑字段", editId: id } }); + }; + handleResetField = () => { + const { slideparams } = this.state; + this.setState({ + slideparams: { + ...slideparams, + visible: false, + title: "新建字段", + editId: "" + } + }); + }; + + render() { + const { searchVal, doSearch, slideparams } = this.state; + const { taxAgentStore } = this.props; + const { showOperateBtn } = taxAgentStore; + const btns = [ + , + this.setState({ searchVal })} + onSearch={() => this.setState({ doSearch: !doSearch })} + /> + ]; + return ( + } + iconBgcolor="#F14A2D" + showDropIcon={false} + buttons={showOperateBtn ? btns : btns.slice(-1)} + > +
+ + this.setState({ doSearch: !doSearch })} + /> +
+
+ ); + } +} + +export default FieldManagement; diff --git a/pc4mobx/hrmSalary/pages/fieldManagement/index.less b/pc4mobx/hrmSalary/pages/fieldManagement/index.less new file mode 100644 index 00000000..f7dd4058 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/fieldManagement/index.less @@ -0,0 +1,29 @@ +.slideOuterWrapper { + .wea-slide-modal-title { + height: initial; + line-height: initial; + text-align: left; + } + + .rodal-close { + z-index: 99; + top: 10px !important; + } + +} + +@media (min-width: 1260px) { + .slideOuterWrapper { + .reqTopWrapper .wea-new-top-req-title > div:first-child > div { + max-width: 100% !important; + } + } +} + +@media screen and (min-width: 1060px) and (max-width: 1260px) { + .slideOuterWrapper { + .reqTopWrapper .wea-new-top-req-title > div:first-child > div { + max-width: calc(100% - 96px) !important; + } + } +} diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerBaseSetting.js b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerBaseSetting.js index 9d9f8ad5..e861b31d 100644 --- a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerBaseSetting.js +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerBaseSetting.js @@ -159,7 +159,7 @@ class LedgerBaseSetting extends Component { { _.map(baseForm, item => { const { key, label, type, options = [], children = [] } = item; - taxAgentIdDisabled = key === "taxAgentId" && taxAgentId; + taxAgentIdDisabled = key === "taxAgentId" && editId && taxAgentId; taxableItemsDisabled = key === "taxableItems" && editId; return { this.setState({ loading: { ...loading, query: false } }); @@ -216,7 +210,6 @@ class Index extends Component { pageSize } }); - this.queryTabTotal(); } }); }; @@ -235,6 +228,7 @@ class Index extends Component { if (status) { const { msg } = data; message.info(msg || "操作成功!"); + this.queryTabTotal(); this.query(); } else { message.error(errormsg || "操作失败!"); @@ -260,6 +254,7 @@ class Index extends Component { API.cancelStop([id]).then(({ status, errormsg }) => { if (status) { message.success("操作成功!"); + this.queryTabTotal(); this.query(); } else { message.error(errormsg || "操作失败!"); @@ -274,6 +269,7 @@ class Index extends Component { this.setState({ selectedRowKeys: [] }, () => { + this.queryTabTotal(); this.query(); }); } else { @@ -312,6 +308,7 @@ class Index extends Component { this.setState({ selectedRowKeys: [] }, () => { + this.queryTabTotal(); this.query(); }); } else { @@ -388,6 +385,7 @@ class Index extends Component { pageInfo={pageInfo} selectedRowKeys={selectedRowKeys} refreshList={() => { + this.queryTabTotal(); this.query(); this.setState({ selectedRowKeys: [] }); }} @@ -423,6 +421,7 @@ class Index extends Component { { + this.queryTabTotal(); this.query(); this.setState({ selectedRowKeys: [] }); }} From 73e8357e222985959364d28f413351f78ab53a56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Sat, 28 Jan 2023 13:42:32 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=AD=97=E6=AE=B5=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/fieldManage.js | 17 +- .../fieldManagement/components/fieldSlide.js | 204 +++++++++--------- .../fieldManagement/components/fieldTable.js | 4 +- .../hrmSalary/pages/fieldManagement/index.js | 22 +- .../pages/fieldManagement/index.less | 3 + 5 files changed, 136 insertions(+), 114 deletions(-) diff --git a/pc4mobx/hrmSalary/apis/fieldManage.js b/pc4mobx/hrmSalary/apis/fieldManage.js index f8ac7a27..5e75f876 100644 --- a/pc4mobx/hrmSalary/apis/fieldManage.js +++ b/pc4mobx/hrmSalary/apis/fieldManage.js @@ -1,11 +1,20 @@ import { WeaTools } from "ecCom"; import { postFetch } from "../util/request"; -//获取薪资档案各tab的人数 -export const queryTabTotal = (params) => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryArchive/queryTabTotal", "GET", params); +//获取编辑详情 +export const getSalaryFieldForm = (params) => { + return WeaTools.callApi("/api/bs/hrmsalary/salaryField/getSalaryForm", "GET", params); }; -// 导入档案 +// 字段管理查询 export const salaryFieldList = (params) => { return postFetch('/api/bs/hrmsalary/salaryField/list', params); } + +// 字段管理查询 +export const saveSalaryField = (params) => { + return postFetch('/api/bs/hrmsalary/salaryField/save', params); +} +// 删除字段管理 +export const deleteSalaryField = (params) => { + return postFetch('/api/bs/hrmsalary/salaryField/delete', params); +} diff --git a/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js b/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js index 9d9c7d9c..5614a9ae 100644 --- a/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js +++ b/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js @@ -6,10 +6,10 @@ */ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; -import { WeaFormItem, WeaHelpfulTip, WeaInput, WeaSelect, WeaSlideModal, WeaTextarea } from "ecCom"; -import { message, Modal, Switch } from "antd"; +import { WeaCheckbox, WeaFormItem, WeaHelpfulTip, WeaInput, WeaSelect, WeaSlideModal, WeaTextarea } from "ecCom"; +import { message, Modal } from "antd"; import SlideModalTitle from "../../../components/slideModalTitle"; -import { saveAdjustmentRule, saveLedgerBasic, saveLedgerItem } from "../../../apis/ledger"; +import { getSalaryFieldForm, saveSalaryField } from "../../../apis/fieldManage"; import { commonEnumList } from "../../../apis/payrollFiles"; import { dataTypeOptions, patternOptions, roundingModeOptions } from "../../salaryItem/options"; @@ -19,15 +19,16 @@ class FieldSlide extends Component { constructor(props) { super(props); this.state = { - current: 0, loading: false, + name: "", + useDefault: "", sharedType: "", shareTypeList: [], taxAgentIds: "", dataType: "number", roundingMode: "", pattern: "", - description: "", + description: "" }; } @@ -38,6 +39,30 @@ class FieldSlide extends Component { getTaxAgentSelectListAsAdmin(); } + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.editId !== this.props.editId && nextProps.editId) { + this.getSalaryFieldForm(nextProps.editId); + } + } + + getSalaryFieldForm = (id) => { + getSalaryFieldForm({ id }).then(({ status, data }) => { + if (status) { + const { name, useDefault, dataType, description, sharedType, roundingMode, taxAgentIds, pattern } = data; + this.setState({ + name, + useDefault: useDefault ? useDefault.toString() : "0", + dataType, + description, + sharedType: sharedType ? sharedType.toString() : "0", + roundingMode: roundingMode ? roundingMode.toString() : "0", + taxAgentIds, + pattern: pattern ? pattern.toString() : "0" + }); + } + }); + }; + /* * Author: 黎永顺 * Description: 获取可见性列表 @@ -47,7 +72,7 @@ class FieldSlide extends Component { commonEnumList = () => { const payload = { enumClass: "com.engine.salary.enums.sicategory.SharedTypeEnum" - } + }; commonEnumList(payload).then(({ status, data }) => { if (status) { const result = _.map(data, it => ({ @@ -65,108 +90,79 @@ class FieldSlide extends Component { }; /* * Author: 黎永顺 - * Description: 保存基本信息 + * Description: 保存字段信息 * Params: * Date: 2022/12/12 */ - saveLedgerBasic = () => { - const { baseSettingInfo, current } = this.state; - const { editId } = this.props; - const { description, canEdit, ...extra } = baseSettingInfo; - const bool = _.every(Object.keys(extra), key => !!extra[key]); - if (!bool || _.isEmpty(baseSettingInfo)) { + saveFieldInfo = () => { + if (_.isEmpty(this.state.name)) { Modal.warning({ title: "信息确认", content: "必要信息不完整,红色*为必填项!" }); return false; } + const { onRefreshList, onCancel, editId } = this.props; + const { name, useDefault, dataType, description, sharedType, roundingMode, taxAgentIds, pattern } = this.state; + const payload = { + name, + useDefault: Number(useDefault), + dataType, + description, + sharedType, + roundingMode: Number(roundingMode), + taxAgentIds, + pattern: Number(pattern) + }; this.setState({ loading: true }); - saveLedgerBasic({ ...extra, description, id: editId }).then(({ status, data, errormsg }) => { + saveSalaryField({ ...payload, id: editId }).then(({ status, errormsg }) => { this.setState({ loading: false }); if (status) { - const { onRefreshList } = this.props; - message.success("保存成功"); onRefreshList(); - !editId && this.setState({ current: current + 1, saveSalarySobId: data }); - } else { - message.error(errormsg || "保存失败"); - } - }).catch(() => this.setState({ loading: false })); - }; - /* - * Author: 黎永顺 - * Description: 保存调薪计薪规则 - * Params: - * Date: 2022/12/12 - */ - saveLedgerAdjustRule = () => { - const { adjustRules, saveSalarySobId } = this.state; - const payload = { - salarySobId: this.props.editId || saveSalarySobId, - ruleParams: adjustRules - }; - this.setState({ loading: true }); - saveAdjustmentRule(payload).then(({ status, errormsg }) => { - this.setState({ loading: false }); - if (status) { - message.success("保存成功"); - this.handleClose(); - } else { - message.success(errormsg || "保存失败"); - } - }).catch(() => this.setState({ loading: false })); - }; - /* - * Author: 黎永顺 - * Description: 薪资项目保存 - * Params: - * Date: 2022/12/14 - */ - saveLedgerItem = () => { - const { empFields, itemGroups, saveSalarySobId } = this.state; - const { editId: salarySobId } = this.props; - const payload = { - empFields, - itemGroups: _.filter(itemGroups, it => it.name !== "未分类"), - items: _.find(itemGroups, it => it.name === "未分类").items || [], - salarySobId: salarySobId || saveSalarySobId - }; - this.setState({ loading: true }); - saveLedgerItem(payload).then(({ status, errormsg }) => { - this.setState({ loading: false }); - if (status) { + onCancel(); + this.handleReset(); message.success("保存成功"); } else { message.error(errormsg || "保存失败"); } }).catch(() => this.setState({ loading: false })); }; - handleChangeSlideTab = (current) => { - this.setState({ current: Number(current) }); - }; /* * Author: 黎永顺 - * Description: 基础信息字段切换 - * Params: - * Date: 2022/12/9 - */ - handleChangeSaveParams = (baseSettingInfo) => { - this.setState({ baseSettingInfo }); - }; - /* - * Author: 黎永顺 - * Description: 薪资项目保存数据 + * Description: 字段项修改 * Params: * Date: 2022/12/14 */ - handleSaveSalaryItemParams = (empFields, itemGroups) => { - this.setState({ empFields, itemGroups }); + handleChangeFields = (type, value) => { + this.setState({ [type]: value }); + }; + handleReset = () => { + this.setState({ + name: "", + useDefault: "", + sharedType: "", + taxAgentIds: "", + dataType: "number", + roundingMode: "", + pattern: "", + description: "" + }); }; render() { - const { title, visible, editId, taxAgentStore: { showOperateBtn, taxAgentAdminOption }, onCancel } = this.props; - const { shareTypeList, sharedType, taxAgentIds, dataType, roundingMode, pattern, description } = this.state; + const { title, visible, taxAgentStore: { showOperateBtn, taxAgentAdminOption }, onCancel } = this.props; + const { + loading, + name, + useDefault, + shareTypeList, + sharedType, + taxAgentIds, + dataType, + roundingMode, + pattern, + description + } = this.state; return ( { - console.log(11111); - }} + onSave={this.saveFieldInfo} /> } content={ -
+
- + this.handleChangeFields("name", value)}/> - { - }} + this.handleChangeFields("useDefault", value)} /> { - }} + onChange={value => this.handleChangeFields("sharedType", value)} style={{ width: 200 }} /> @@ -222,8 +216,7 @@ class FieldSlide extends Component { style={{ width: 200 }} value={taxAgentIds} options={taxAgentAdminOption} - onChange={(value) => { - }} + onChange={value => this.handleChangeFields("taxAgentIds", value)} /> } @@ -231,37 +224,36 @@ class FieldSlide extends Component { { - }} + onChange={value => this.handleChangeFields("dataType", value)} style={{ width: 200 }} /> - + { - }} + onChange={value => this.handleChangeFields("roundingMode", value)} /> - + { - }} + onChange={value => this.handleChangeFields("pattern", value)} /> { - }} + onChange={value => this.handleChangeFields("description", value)} />
} - onClose={onCancel} + onClose={() => { + this.handleReset(); + onCancel(); + }} /> ); } diff --git a/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldTable.js b/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldTable.js index 64f8ca76..08e6a073 100644 --- a/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldTable.js +++ b/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldTable.js @@ -54,7 +54,7 @@ class FieldTable extends Component { }; getColumns = () => { const { columns } = this.state; - const { taxAgentStore, onEditLedger } = this.props; + const { taxAgentStore, onEditLedger, onDeleteLedger } = this.props; const { showOperateBtn } = taxAgentStore; return _.map([...columns, { dataIndex: "operate", @@ -73,7 +73,7 @@ class FieldTable extends Component { onClick={() => onEditLedger(record)}>{showOperateBtn ? "编辑" : "查看"} { showOperateBtn && - onEditLedger(record)}>删除 + onDeleteLedger(record)}>删除 }
; }; diff --git a/pc4mobx/hrmSalary/pages/fieldManagement/index.js b/pc4mobx/hrmSalary/pages/fieldManagement/index.js index d42eba87..ddc9e692 100644 --- a/pc4mobx/hrmSalary/pages/fieldManagement/index.js +++ b/pc4mobx/hrmSalary/pages/fieldManagement/index.js @@ -6,10 +6,11 @@ */ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; -import { Button } from "antd"; +import { Button, message, Modal } from "antd"; import { WeaInputSearch, WeaTop } from "ecCom"; import FieldTable from "./components/fieldTable"; import FieldSlide from "./components/fieldSlide"; +import { deleteSalaryField } from "../../apis/fieldManage"; import "./index.less"; @inject("taxAgentStore") @@ -33,6 +34,22 @@ class FieldManagement extends Component { const { id } = record; this.setState({ slideparams: { ...slideparams, visible: true, title: "编辑字段", editId: id } }); }; + handleDeleteField = (filedIds) => { + Modal.confirm({ + title: "信息确认", + content: "确认要删除吗?", + onOk: () => { + deleteSalaryField(filedIds).then((status, errormsg) => { + if (status) { + message.success("删除成功"); + this.setState({ doSearch: !this.state.doSearch }) + } else { + message.error(errormsg || "删除失败"); + } + }); + } + }); + }; handleResetField = () => { const { slideparams } = this.state; this.setState({ @@ -69,7 +86,8 @@ class FieldManagement extends Component { buttons={showOperateBtn ? btns : btns.slice(-1)} >
- + this.handleDeleteField([record.id])}/> Date: Tue, 31 Jan 2023 10:14:10 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=AD=97=E6=AE=B5=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hrmSalary/pages/fieldManagement/components/fieldSlide.js | 2 +- pc4mobx/hrmSalary/pages/fieldManagement/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js b/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js index 5614a9ae..f51ad144 100644 --- a/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js +++ b/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js @@ -144,7 +144,7 @@ class FieldSlide extends Component { taxAgentIds: "", dataType: "number", roundingMode: "", - pattern: "", + pattern: "2", description: "" }); }; diff --git a/pc4mobx/hrmSalary/pages/fieldManagement/index.js b/pc4mobx/hrmSalary/pages/fieldManagement/index.js index ddc9e692..be149e71 100644 --- a/pc4mobx/hrmSalary/pages/fieldManagement/index.js +++ b/pc4mobx/hrmSalary/pages/fieldManagement/index.js @@ -39,7 +39,7 @@ class FieldManagement extends Component { title: "信息确认", content: "确认要删除吗?", onOk: () => { - deleteSalaryField(filedIds).then((status, errormsg) => { + deleteSalaryField(filedIds).then(({ status, errormsg }) => { if (status) { message.success("删除成功"); this.setState({ doSearch: !this.state.doSearch }) From e9b0a500192c43bbb63dd88f037778c3c289f746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Tue, 31 Jan 2023 10:25:07 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=AD=97=E6=AE=B5=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hrmSalary/pages/fieldManagement/components/fieldSlide.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js b/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js index f51ad144..81de428b 100644 --- a/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js +++ b/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js @@ -27,7 +27,7 @@ class FieldSlide extends Component { taxAgentIds: "", dataType: "number", roundingMode: "", - pattern: "", + pattern: "2", description: "" }; }