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: [] }); }}