diff --git a/pc4mobx/hrmSalary/apis/variableSalary.js b/pc4mobx/hrmSalary/apis/variableSalary.js new file mode 100644 index 00000000..8cd818b5 --- /dev/null +++ b/pc4mobx/hrmSalary/apis/variableSalary.js @@ -0,0 +1,53 @@ +import { WeaTools } from "ecCom"; +import { postExportFetch, postFetch } from "../util/request"; + +//浮动薪酬项目列表 +export const getVariableSalaryItemList = params => { + return postFetch("/api/bs/hrmsalary/variableSalaryItem/listPage", params); +}; +//删除浮动薪酬项目 +export const deleteVariableSalaryItem = params => { + return postFetch("/api/bs/hrmsalary/variableSalaryItem/delete", params); +}; +//获取浮动薪酬项目详情 +export const getVariableSalaryItemDetail = params => { + return postFetch("/api/bs/hrmsalary/variableSalaryItem/getDetail", params); +}; +//保存/更新 浮动薪酬项目 +export const saveVariableSalaryItem = params => { + return postFetch("/api/bs/hrmsalary/variableSalaryItem/save", params); +}; + +//创建浮动薪酬档案时获取项目信息 +export const getCreateForm = params => { + return postFetch("/api/bs/hrmsalary/variableSalary/getCreateForm", params); +}; +//创建浮动薪酬档案 +export const createVariableSalary = params => { + return postFetch("/api/bs/hrmsalary/variableSalary/createData", params); +}; +//创建浮动薪酬档案 +export const getVariableSalaryList = params => { + return postFetch("/api/bs/hrmsalary/variableSalary/list", params); +}; +//导入浮动薪酬档案 +export const importVariableSalary = params => { + return postFetch("/api/bs/hrmsalary/variableSalary/importData", params); +}; +//删除浮动薪酬档案 +export const deleteVariableSalary = params => { + return postFetch("/api/bs/hrmsalary/variableSalary/deleteSelectData", params); +}; +//获取浮动薪酬档案明细 +export const getVariableSalaryDetail = params => { + return postFetch("/api/bs/hrmsalary/variableSalary/getDetail", params); +}; +// 获取当前管理员下的所有的个税扣缴义务人 +export const getAdminTaxAgentList = () => { + return WeaTools.callApi("/api/bs/hrmsalary/siaccount/getAdminTaxAgentList", "get", {}); +}; +// 浮动薪酬档案导出 +export const exportVariableSalary = (params) => { + return postExportFetch("/api/bs/hrmsalary/variableSalary/export", params); +}; + diff --git a/pc4mobx/hrmSalary/index.js b/pc4mobx/hrmSalary/index.js index 65df6344..912e2ebe 100644 --- a/pc4mobx/hrmSalary/index.js +++ b/pc4mobx/hrmSalary/index.js @@ -53,6 +53,7 @@ import ExternalPersonManage from "./pages/externalPersonManage"; import AdjustSalaryManage from "./pages/adjustSalaryManage"; import TopologyMap from "./pages/topologyMap"; import SupplementaryCalc from "./pages/supplementaryCalc"; +import VariableSalary from "./pages/variableSalary"; import Layout from "./layout"; import stores from "./stores"; @@ -114,6 +115,7 @@ const DataAcquisition = (props) => props.children; // externalPersonManage 非系统人员管理 // adjustSalaryManage 档案管理 // supplementaryCalc 补算 +// variableSalary 浮动薪酬 const Routes = ( @@ -169,6 +171,7 @@ const Routes = ( + ); diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.js new file mode 100644 index 00000000..8c0983da --- /dev/null +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.js @@ -0,0 +1,35 @@ +/* + * Author: 黎永顺 + * name:薪酬统计报表-高级搜索 + * Description: + * Date: 2024/3/26 + */ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { Button } from "antd"; +import { WeaInputSearch, WeaLocaleProvider } from "ecCom"; +import "./index.less"; + +const getLabel = WeaLocaleProvider.getLabel; + +@inject("baseTableStore") +@observer +class Index extends Component { + render() { + const { baseTableStore: { VSalryForm }, searchType } = this.props; + return ( +
+ VSalryForm.updateFields({ username: v })} + onSearch={this.props.onAdvanceSearch} + /> + { + searchType === "advance" && + } +
+ ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.less b/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.less new file mode 100644 index 00000000..f301e571 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.less @@ -0,0 +1,28 @@ +.variable-advance-search { + display: flex; + align-items: center; + position: relative; + top: -1.5px; + + .wea-advanced-search { + top: 1px; + left: -1px; + height: 28px; + line-height: 1; + border-radius: 0; + position: relative; + color: #474747; + padding: 4px 15px; + } + + .wea-advanced-search:hover { + border: 1px solid #dadada; + color: #474747; + } + + .text-elli { + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + } +} diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js new file mode 100644 index 00000000..1635c3a4 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js @@ -0,0 +1,146 @@ +/* + * 浮动薪酬 + * 新建编辑薪资档案 + * @Author: 黎永顺 + * @Date: 2024/8/8 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { WeaLocaleProvider, WeaSlideModal, WeaTools } from "ecCom"; +import { Button, message } from "antd"; +import { getSearchs } from "../../../../util"; +import { salaryFileConditions } from "../../conditions"; +import * as API from "../../../../apis/variableSalary"; + +const getKey = WeaTools.getKey; +const getLabel = WeaLocaleProvider.getLabel; + +@inject("baseTableStore") +@observer +class Index extends Component { + constructor(props) { + super(props); + this.state = { + conditions: [], loading: false + }; + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) { + document.querySelector(".variable_salary_wrapper").classList.add("zIndex0-weaslide-title"); + this.initForm(nextProps); + } else if (nextProps.visible !== this.props.visible && !nextProps.visible) { + document.querySelector(".variable_salary_wrapper").classList.remove("zIndex0-weaslide-title"); + this.props.baseTableStore.initVSSalaryFileForm(); + } + } + + initForm = (props) => { + const { baseTableStore: { VSSalaryFileForm }, detail, taxAgentOption } = props; + API.getCreateForm().then(({ data }) => { + this.setState({ + conditions: [ + ..._.map(salaryFileConditions, item => ({ + ...item, items: _.map(item.items, o => { + if (getKey(o) === "taxAgentIds") { + return { + ...o, viewAttr: !_.isEmpty(detail) ? 1 : 3, label: getLabel(o.lanId, o.label), + options: taxAgentOption, value: detail[getKey(o)] || "" + }; + } + return { + ...o, viewAttr: !_.isEmpty(detail) ? 1 : 3, label: getLabel(o.lanId, o.label), + value: detail[getKey(o)] || "" + }; + }) + })), + { + items: _.map(data, o => ({ + conditionType: "INPUT", + domkey: [String(o.id)], + fieldcol: 14, + label: o.name, + labelcol: 6, + value: detail[`${String(o.id)}_variableItem`] || "", + viewAttr: !_.isEmpty(detail) ? 1 : 2 + })), + title: "", col: 2, + defaultshow: true + } + ] + }, () => { + VSSalaryFileForm.initFormFields(this.state.conditions); + if (!_.isEmpty(detail)) { + VSSalaryFileForm.updateFields({ + employeeId: { + value: detail["employeeId"], + valueSpan: detail["username"], + valueObj: [{ id: detail["employeeId"], name: detail["username"] }] + } + }); + } + }); + }); + }; + convertPayload = (payload) => { + const itemValueList = []; + return _.reduce(_.keys(payload), (pre, cur) => { + if (!_.isNaN(parseInt(cur))) { + itemValueList.push({ variableItemId: cur, itemValue: payload[cur] }); + return { ...pre, itemValueList }; + } + return { ...pre, [cur]: payload[cur] }; + }, {}); + }; + save = () => { + const { baseTableStore: { VSSalaryFileForm }, onSearch, id } = this.props; + VSSalaryFileForm.validateForm().then(f => { + if (f.isValid) { + const payload = VSSalaryFileForm.getFormParams(); + this.setState({ loading: true }); + API.createVariableSalary({ ...this.convertPayload(payload), id }) + .then(({ status, errormsg }) => { + this.setState({ loading: false }); + if (status) { + message.success(getLabel(30700, "操作成功")); + this.props.onClose(onSearch()); + } else { + message.error(errormsg); + } + }).catch(() => this.setState({ loading: false })); + } else { + f.showErrors(); + } + }); + }; + renderTitle = () => { + const { loading } = this.state, { title, detail } = this.props; + return
+
+
+
{title}
+
+
+ { + _.isEmpty(detail) && + + } +
+
; + }; + + render() { + const { conditions } = this.state; + const { baseTableStore: { VSSalaryFileForm }, onClose } = this.props; + return ( onClose()} + top={0} width={800} height={100} measureT="%" measureX="px" measureY="%" title={this.renderTitle()} + content={
{getSearchs(VSSalaryFileForm, conditions)}
} + />); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileImportDialog/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileImportDialog/index.js new file mode 100644 index 00000000..c8917e45 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileImportDialog/index.js @@ -0,0 +1,120 @@ +/* + * 浮动薪酬 + * 薪资档案导入 + * @Author: 黎永顺 + * @Date: 2024/8/8 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { WeaCheckbox, WeaDatePicker, WeaFormItem, WeaLocaleProvider } from "ecCom"; +import ImportDialog from "../../../../components/importDialog"; +import * as API from "../../../../apis/variableSalary"; +import { convertToUrlString } from "../../../../util/url"; + +const getLabel = WeaLocaleProvider.getLabel; + +class Index extends Component { + constructor(props) { + super(props); + this.state = { + importDialog: { + nextloading: false, link: "/api/bs/hrmsalary/variableSalary/downloadTemplate", + importResult: {}, imageId: "", hasData: false, salaryMonth: "", + previewUrl: "/api/bs/hrmsalary/variableSalary/preview" + } + }; + } + + componentWillReceiveProps(nextProps, nextContext) { + const { importDialog } = this.state; + if (nextProps.visible !== this.props.visible && nextProps.visible) { + const { baseTableStore: { VSalryForm }, salaryMonth, taxAgentIds } = nextProps; + const payload = { + salaryMonth, taxAgentIds, ...VSalryForm.getFormParams(), hasData: importDialog.hasData + }; + this.setState({ + importDialog: { ...importDialog, salaryMonth, link: `${importDialog.link}?${convertToUrlString(payload)}` } + }); + } else { + this.setState({ + importDialog: { + nextloading: false, link: "/api/bs/hrmsalary/variableSalary/downloadTemplate", hasData: false, + importResult: {}, imageId: "", previewUrl: "/api/bs/hrmsalary/variableSalary/preview", salaryMonth: "" + } + }); + } + } + + handleImport = (payload) => { + const { taxAgentIds } = this.props; + const { importDialog } = this.state; + const { salaryMonth } = importDialog; + this.setState({ importDialog: { ...importDialog, nextloading: true } }); + API.importVariableSalary({ + ...payload, salaryMonth, taxAgentIds: _.isEmpty(taxAgentIds) ? [] : taxAgentIds.split(",") + }).then(({ data, status }) => { + this.setState({ importDialog: { ...importDialog, nextloading: false } }); + if (status) { + this.setState({ + importDialog: { ...importDialog, ...payload, importResult: data } + }); + } + }).catch(() => this.setState({ importDialog: { ...importDialog, nextloading: false } })); + }; + renderFormComponent = () => { + const { baseTableStore: { VSalryForm }, taxAgentIds } = this.props; + const { importDialog } = this.state; + const { salaryMonth: month, hasData } = importDialog; + return
+ + { + const payload = { salaryMonth: val, hasData, taxAgentIds, ...VSalryForm.getFormParams() }; + this.setState({ + importDialog: { + ...importDialog, salaryMonth: val, + link: `/api/bs/hrmsalary/variableSalary/downloadTemplate?${convertToUrlString(payload)}` + } + }); + }}/> + +
; + }; + + render() { + const { importDialog } = this.state; + return ( + this.setState({ + importDialog: { ...importDialog, importResult: {}, imageId: "", link: null } + })} + importParams={this.renderFormComponent()} + exportDataDom={ + { + const { baseTableStore: { VSalryForm }, taxAgentIds } = this.props; + const { salaryMonth } = importDialog; + const payload = { salaryMonth, taxAgentIds, ...VSalryForm.getFormParams(), hasData: val === "1" }; + this.setState({ + importDialog: { + ...importDialog, hasData: val === "1", + link: `/api/bs/hrmsalary/variableSalary/downloadTemplate?${convertToUrlString(payload)}` + } + }); + }} + /> + } + nextCallback={imageId => this.setState({ importDialog: { ...importDialog, imageId } })} + nextUplaodCallback={imageId => this.handleImport({ imageId })} + /> + ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileList/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileList/index.js new file mode 100644 index 00000000..f3b0e52a --- /dev/null +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileList/index.js @@ -0,0 +1,162 @@ +/* + * 浮动薪酬 + * 薪资档案列表 + * @Author: 黎永顺 + * @Date: 2024/8/8 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { WeaLocaleProvider } from "ecCom"; +import { WeaTableNew } from "comsMobx"; +import { message, Modal, Spin } from "antd"; +import * as API from "../../../../apis/variableSalary"; +import { toJS } from "mobx"; + +const WeaTableComx = WeaTableNew.WeaTable; +const getLabel = WeaLocaleProvider.getLabel; + +@inject("baseTableStore") +@observer +class Index extends Component { + constructor(props) { + super(props); + this.state = { + pageInfo: { current: 1, pageSize: 10, total: 0 }, loading: false, dataSource: [], columns: [] + }; + } + + componentDidMount() { + window.addEventListener("message", this.handleReceive, false); + window.addEventListener("resize", this.handleResize, false); + this.getVariableSalaryList(); + } + + componentWillUnmount() { + window.removeEventListener("message", this.handleReceive, false); + window.removeEventListener("resize", this.handleResize, false); + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.isQuery !== this.props.isQuery) this.setState({ + pageInfo: { ...this.state.pageInfo, current: 1 } + }, () => this.getVariableSalaryList()); + } + + handleReceive = async ({ data }) => { + const { type, payload: { id, params } = {} } = data; + if (type === "init") { + this.getColumns(); + } else if (type === "turn") { + switch (id) { + case "PAGEINFO": + this.setState({ + pageInfo: { ...this.state.pageInfo, ...params } + }, () => this.getVariableSalaryList()); + break; + case "DEL": + this.handleDelete([params.id]); + break; + case "VIEW": + this.handleView(params.id); + break; + default: + break; + } + } + }; + getVariableSalaryList = () => { + const { baseTableStore: { VSalryForm, getVariableSalaryList }, salaryMonth, taxAgentIds } = this.props; + const { pageInfo } = this.state; + const { departmentIds } = VSalryForm.getFormParams(); + this.setState({ loading: true }); + getVariableSalaryList({ + ...pageInfo, salaryMonth, taxAgentIds: _.isEmpty(taxAgentIds) ? [] : taxAgentIds.split(","), + ...VSalryForm.getFormParams(), departmentIds: !_.isEmpty(departmentIds) ? departmentIds.split(",") : [] + }).then(({ status, data }) => { + this.setState({ loading: false }); + if (status) { + const { pageInfo: result } = data; + const { list: dataSource, pageNum: current, pageSize, total } = result; + this.setState({ + pageInfo: { ...pageInfo, current, pageSize, total }, dataSource + } + ); + } + }); + }; + handleView = (id) => { + API.getVariableSalaryDetail({ id }).then(({ status, data }) => { + if (status) this.props.onViewSalaryFile(data.data); + }); + }; + handleDelete = (ids) => { + Modal.confirm({ + title: getLabel(111, "信息确认"), + content: getLabel(111, "确认删除吗?"), + onOk: () => { + API.deleteVariableSalary({ ids }).then(({ status, errormsg }) => { + if (status) { + message.success(getLabel(111, "删除成功")); + this.getVariableSalaryList(); + } else { + message.error(errormsg); + } + }); + } + }); + }; + getColumns = () => { + const { baseTableStore: { SFTableStore }, showOperateBtn } = this.props; + const columns = _.map(_.filter(toJS(SFTableStore.columns), (item) => item.display === "true"), (it, idx) => ({ + dataIndex: it.dataIndex, title: it.title, align: "left", + width: 150, ellipsis: true + })); + if (!_.isEmpty(columns)) { + this.postMessageToChild({ + columns, showOperateBtn, dataSource: this.state.dataSource, scrollHeight: 98, + pageInfo: this.state.pageInfo, unitTableType: "variableSalary" + }); + } + return columns; + }; + 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 { loading, dataSource } = this.state; + const { baseTableStore: { SFTableStore } } = this.props; + const dom = document.querySelector(".wea-new-top-req-content"); + let height = 280; + if (dom && dataSource.length > 0) { + height = (parseFloat(dom.style.height) > 620 && dataSource.length === 10) ? dataSource.length * 46 + 108 : dataSource.length < 10 ? dataSource.length * 46 + 108 : parseFloat(dom.style.height) - 16; + } + return ( + +
+ +