From 93d07961c7d3817e55e8e21271b46c10f4394a6c 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 May 2023 13:27:17 +0800 Subject: [PATCH] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=BB=9F=E8=AE=A1=E5=88=86?= =?UTF-8?q?=E6=9E=90-=E5=91=98=E5=B7=A5=E6=98=8E=E7=BB=86=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/index.js | 2 + .../components/dimensionTable.js | 12 +- .../components/employeeDetails.js | 6 +- pc4mobx/hrmSalary/pages/employeeView/index.js | 120 ++++++++++++++++++ .../hrmSalary/pages/employeeView/index.less | 9 ++ .../statisticalMicroSettingsSlide.js | 2 +- pc4mobx/hrmSalary/util/options.js | 32 ++--- 7 files changed, 161 insertions(+), 22 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/employeeView/index.js create mode 100644 pc4mobx/hrmSalary/pages/employeeView/index.less diff --git a/pc4mobx/hrmSalary/index.js b/pc4mobx/hrmSalary/index.js index 3037a01b..024d2217 100644 --- a/pc4mobx/hrmSalary/index.js +++ b/pc4mobx/hrmSalary/index.js @@ -33,6 +33,7 @@ import RuleConfig from "./pages/ruleConfig"; import Appconfig from "./pages/appConfig"; import FieldManagement from "./pages/fieldManagement"; import AnalysisOfSalaryStatistics from "./pages/analysisOfSalaryStatistics"; +import EmployeeList from "./pages/employeeView"; import ReportView from "./pages/reportView"; import stores from "./stores"; @@ -155,6 +156,7 @@ const Routes = ( + ); diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionTable.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionTable.js index fb5a4cb1..48eecf43 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionTable.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionTable.js @@ -91,9 +91,15 @@ class DimensionTable extends Component { render: (_, record) => { return ( - onEdit(record.id)}>{getLabel(111, "编辑")} - this.dimensionDelete([record.id])}>{getLabel(111, "删除")} + { + record.canEdit && + onEdit(record.id)}>{getLabel(111, "编辑")} + } + { + record.canDelete && + this.dimensionDelete([record.id])}>{getLabel(111, "删除")} + } ); } diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/employeeDetails.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/employeeDetails.js index 9b2c79ed..6d9d0274 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/employeeDetails.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/employeeDetails.js @@ -54,13 +54,15 @@ class EmployeeDetails extends Component { title: "", dataIndex: "operate", width: 80, - render: () => { + render: (_, record) => { return
+ { + window.open(`${window.location.origin}/spa/hrmSalary/static/index.html#/main/hrmSalary/analysisOfSalaryStatistics/${record.id}?name=${record.name}&dept=${record.department || ""}`); + }}> {getLabel(111, "查看")} } diff --git a/pc4mobx/hrmSalary/pages/employeeView/index.js b/pc4mobx/hrmSalary/pages/employeeView/index.js new file mode 100644 index 00000000..86a3353f --- /dev/null +++ b/pc4mobx/hrmSalary/pages/employeeView/index.js @@ -0,0 +1,120 @@ +/* + * Author: 黎永顺 + * name: 员工明细查看 + * Description: + * Date: 2023/5/24 + */ +import React, { Component } from "react"; +import { WeaLocaleProvider, WeaSelect, WeaTop } from "ecCom"; +import { Spin } from "antd"; +import { inject, observer } from "mobx-react"; +import { MonthRangePicker } from "../reportView/components/statisticalMicroSettingsSlide"; +import { statisticsEmployeeDetailList } from "../../apis/statistics"; +import { optionAddWhole } from "../../util/options"; +import moment from "moment"; +import "./index.less"; + +const { getLabel } = WeaLocaleProvider; + +@inject("taxAgentStore") +@observer +class Index extends Component { + constructor(props) { + super(props); + this.state = { + loading: false, + taxAgentId: "", + salaryMonth: [moment().startOf("year").format("YYYY-MM"), moment().format("YYYY-MM")], + dataSource: [], + columns: [] + }; + } + + componentWillMount() { + const { taxAgentStore: { fetchTaxAgentOption } } = this.props; + fetchTaxAgentOption(); + } + + componentDidMount() { + this.statisticsEmployeeDetailList(); + window.addEventListener("message", this.handleReceive, false); + } + + handleReceive = ({ data }) => { + const { type } = data; + if (type === "init") { + const { columns, dataSource } = this.state; + this.postMessageToChild({ + columns, dataSource, + showSum: false + }); + } else if (type === "turn") { + } + }; + postMessageToChild = (payload) => { + const childFrameObj = document.getElementById("atdTable"); + const { dataSource, columns, showSum } = payload; + childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({ + dataSource, columns, showSum + }), "*"); + }; + + statisticsEmployeeDetailList = () => { + const { params: { employeeId } } = this.props; + const { taxAgentId, salaryMonth } = this.state; + const payload = { employeeId, taxAgentId, salaryMonth }; + this.setState({ loading: true }); + statisticsEmployeeDetailList(payload).then(({ status, data }) => { + this.setState({ loading: false }); + if (status) { + const { columns, pageInfo: { list } } = data; + this.setState({ + columns: _.map(columns, it => ({ + ...it, + dataIndex: it.column, width: 150, + title: it.text, align: "left" + })), + dataSource: list || [] + }, () => { + this.postMessageToChild({ + columns: this.state.columns, + dataSource: this.state.dataSource, + showSum: false + }); + }); + } + }).catch(() => this.setState({ loading: false })); + }; + + render() { + const { location, taxAgentStore: { showOperateBtn, taxAgentOption } } = this.props; + const { salaryMonth, taxAgentId, loading } = this.state; + const { query: { dept, name } } = location; + const btns = [ + this.setState({ salaryMonth: v }, () => this.statisticsEmployeeDetailList())}/>, + this.setState({ taxAgentId: v }, () => this.statisticsEmployeeDetailList())}/> + ]; + return ( + {name}{dept}} + icon={} buttons={showOperateBtn ? btns : []} + iconBgcolor="#F14A2D" showDropIcon={false} + > +
+ +