diff --git a/pc4mobx/hrmSalary/apis/statistics.js b/pc4mobx/hrmSalary/apis/statistics.js index 197339b5..e88c8267 100644 --- a/pc4mobx/hrmSalary/apis/statistics.js +++ b/pc4mobx/hrmSalary/apis/statistics.js @@ -66,3 +66,11 @@ export const deleteRangeSetting = (params) => { export const saveRangeSetting = (params) => { return postFetch("/api/bs/hrmsalary/report/statistics/echarts/saveRangeSetting", params); }; +//员工列表 +export const statisticsEmployeeList = (params) => { + return postFetch("/api/bs/hrmsalary/report/statistics/employee/list", params); +}; +//员工详情列表 +export const statisticsEmployeeDetailList = (params) => { + return postFetch("/api/bs/hrmsalary/report/statistics/employee/detailList", params); +}; 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 new file mode 100644 index 00000000..dc89547d --- /dev/null +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/employeeDetails.js @@ -0,0 +1,103 @@ +/* + * Author: 黎永顺 + * name: 员工明细列表 + * Description: + * Date: 2023/5/24 + */ +import React, { Component } from "react"; +import { WeaLocaleProvider, WeaTable } from "ecCom"; +import { statisticsEmployeeList } from "../../../apis/statistics"; +import "../index.less"; + +const { getLabel } = WeaLocaleProvider; + +class EmployeeDetails extends Component { + constructor(props) { + super(props); + this.state = { + loading: false, + dataSource: [], + columns: [], + pageInfo: { + current: 1, + pageSize: 10, + total: 0 + } + }; + } + + componentDidMount() { + this.statisticsEmployeeList(); + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.year !== this.props.year) this.statisticsEmployeeList(nextProps); + } + + statisticsEmployeeList = (props) => { + const { pageInfo } = this.state; + const payload = { + year: props ? props.year : this.props.year, + keyword: props ? props.keyword : this.props.keyword, + ...pageInfo + }; + this.setState({ loading: true }); + statisticsEmployeeList(payload).then(({ status, data }) => { + this.setState({ loading: false }); + if (status) { + const { columns, list: dataSource, pageNum: current, total, pageSize } = data; + this.setState({ + pageInfo: { ...pageInfo, current, pageSize, total }, + dataSource, + columns: [...columns, { + title: "操作", + dataIndex: "operate", + width: 80, + render: (_, record) => { + return {getLabel(111, "查看")}; + } + }] + }); + } + }).catch(() => this.setState({ loading: false })); + }; + + render() { + const { dataSource, loading, columns, pageInfo } = this.state; + const pagination = { + ...pageInfo, + showTotal: total => `${getLabel(111, "共")} ${total} ${getLabel(111, "条")}`, + showQuickJumper: true, + showSizeChanger: true, + pageSizeOptions: ["10", "20", "50", "100"], + onShowSizeChange: (current, pageSize) => { + this.setState({ + pageInfo: { ...pageInfo, current, pageSize } + }, () => { + this.statisticsEmployeeList(); + }); + }, + onChange: current => { + this.setState({ + pageInfo: { ...pageInfo, current } + }, () => { + this.statisticsEmployeeList(); + }); + } + }; + return ( + + ); + } +} + +export default EmployeeDetails; diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.js index fe08d250..20748a27 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.js @@ -6,16 +6,18 @@ */ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; -import { WeaInputSearch, WeaLocaleProvider, WeaReqTop } from "ecCom"; +import { WeaDatePicker, WeaInputSearch, WeaLocaleProvider, WeaReqTop } from "ecCom"; import { Button } from "antd"; import { condition, reportCondition } from "./components/conditions"; import { commonEnumList, reportGetForm } from "../../apis/ruleconfig"; import { dimensionGetForm } from "../../apis/statistics"; +import EmployeeDetails from "./components/employeeDetails"; import StatisticsModal from "./components/statisticsModal"; import DimensionSlide from "./components/dimensionSlide"; import DimensionTable from "./components/dimensionTable"; import ReportList from "./components/reportList"; import ReportForm from "./components/reportForm"; +import moment from "moment"; import "./index.less"; const { getLabel } = WeaLocaleProvider; @@ -31,6 +33,8 @@ class Index extends Component { reportConditions: [], selectedKey: "statistics", reportName: "", + keyword: "", + year: moment().format("YYYY"), slideReq: { visible: false, formId: "" }, @@ -242,8 +246,8 @@ class Index extends Component { render() { const { taxAgentStore: { statisticsReportBtn }, attendanceStore: { statisticsForm, reportForm } } = this.props; - const { selectedKey, modalReq, slideReq, conditions, reportConditions, reportName } = this.state; - const buttons = [ + const { selectedKey, modalReq, slideReq, conditions, reportConditions, reportName, keyword, year } = this.state; + const buttons = selectedKey === "statistics" ? [ , , @@ -251,26 +255,37 @@ class Index extends Component { value={reportName} onChange={reportName => this.setState({ reportName })} onSearch={() => this.handleReqBtnsClick("search")}/> + ] : [ + + {getLabel(111, "年薪资核算人员明细:")} + this.setState({ year })}/> + , + this.setState({ keyword })} + onSearch={() => this.employeeListRef.statisticsEmployeeList()}/> ]; const tabs = [ - { key: "statistics", title: getLabel(111, "统计表") } - // { key: "detail", title: getLabel(111, "员工明细") } + { key: "statistics", title: getLabel(111, "统计表") }, + { key: "detail", title: getLabel(111, "员工明细") } ]; return ( } - iconBgcolor="#F14A2D" buttons={!statisticsReportBtn ? buttons.slice(-1) : buttons} buttonSpace={10} - showDropIcon={false} tabDatas={tabs} className="xc_tj_fx_wrapper" - selectedKey={selectedKey} + title={getLabel(111, "薪酬统计报表")} icon={} selectedKey={selectedKey} + iconBgcolor="#F14A2D" tabDatas={tabs} className="xc_tj_fx_wrapper" showDropIcon={false} + buttons={(!statisticsReportBtn && selectedKey === "statistics") ? buttons.slice(-1) : buttons} buttonSpace={10} onChange={selectedKey => this.setState({ selectedKey }, () => this.state.selectedKey === "statistics" && this.initReportFormCondition())} > { - this.state.selectedKey === "statistics" && - this.reportListRef = dom} - reportName={reportName} - onEdit={this.handleReqBtnsClick} - /> + selectedKey === "statistics" ? + this.reportListRef = dom} + reportName={reportName} + onEdit={this.handleReqBtnsClick} + /> : this.employeeListRef = dom} + keyword={keyword} year={year} + /> } { diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less index 97860916..e0326f2a 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less @@ -5,6 +5,15 @@ width: 220px; } + .employeeYearWrapper { + display: flex; + align-items: center; + + & > span:first-child { + margin-right: 4px; + } + } + .wea-new-top-req-content { background: #FFF; @@ -139,3 +148,31 @@ } } } + +//员工明细 +.employeeTableWrapper { + + .operates i.icon-coms-more { + padding: 5px 0; + display: inline-block; + width: 40px; + font-size: 20px; + color: #333; + cursor: pointer; + font-weight: 400; + } +} + +.operatePopover { + .ant-popover-inner { + min-width: 100px !important; + } + + .ant-popover-inner-content { + padding: 0; + + .ant-menu { + border-right: none; + } + } +} diff --git a/pc4mobx/hrmSalary/pages/employeeView/index.js b/pc4mobx/hrmSalary/pages/employeeView/index.js new file mode 100644 index 00000000..f56c3854 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/employeeView/index.js @@ -0,0 +1,175 @@ +/* + * Author: 黎永顺 + * name: 员工明细查看 + * Description: + * Date: 2023/5/24 + */ +import React, { Component } from "react"; +import { WeaLocaleProvider, WeaSelect, WeaTop } from "ecCom"; +import { WeaTableNew } from "comsMobx"; +import { toJS } from "mobx"; +import { Spin } from "antd"; +import { inject, observer } from "mobx-react"; +import { MonthRangePicker } from "../reportView/components/statisticalMicroSettingsSlide"; +import { optionAddWhole } from "../../util/options"; +import moment from "moment"; +import "./index.less"; + +const WeaTableComx = WeaTableNew.WeaTable; +const { getLabel } = WeaLocaleProvider; + +@inject("taxAgentStore", "payrollFilesStore") +@observer +class Index extends Component { + constructor(props) { + super(props); + this.state = { + loading: false, + taxAgentId: "", + countResult: {}, + salaryMonth: [moment().startOf("year").format("YYYY-MM"), moment().format("YYYY-MM")], + dataSource: [], + pageInfo: { + current: 1, + pageSize: 10, + total: 0 + } + }; + } + + componentWillMount() { + const { taxAgentStore: { fetchTaxAgentOption } } = this.props; + fetchTaxAgentOption(); + } + + componentDidMount() { + this.statisticsEmployeeDetailList(); + window.addEventListener("message", this.handleReceive, false); + } + + handleReceive = ({ data }) => { + const { type, payload: { id, params } = {} } = data; + const { dataSource, pageInfo, countResult } = this.state; + const { payrollFilesStore: { employeeTableStore } } = this.props; + const columns = _.filter(toJS(employeeTableStore.columns), (item) => item.display === "true" && item.dataIndex !== "acctTimes"); + if (type === "init") { + this.postMessageToChild({ + columns: _.map(columns, (it, idx) => ({ + ...it, + width: (it.dataIndex === "taxAgent" || it.dataIndex === "salarySob") ? 176 : it.oldWidth, + fixed: (idx === 1 || idx === 0 || idx === 2) ? "left" : "", + ellipsis: true + })), dataSource, countResult, + showSum: true, pageInfo + }); + } else if (type === "turn") { + if (id === "PAGEINFO") { + const { pageNum: current, size: pageSize } = params; + this.setState({ pageInfo: { ...pageInfo, current, pageSize } }, () => this.statisticsEmployeeDetailList()); + } + } + }; + postMessageToChild = (payload) => { + const childFrameObj = document.getElementById("atdTable"); + const { dataSource, columns, showSum, pageInfo, countResult } = payload; + childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({ + dataSource, columns, showSum, pageInfo, countResult + }), "*"); + }; + + statisticsEmployeeDetailList = () => { + const { params: { employeeId }, payrollFilesStore: { statisticsEmployeeDetailList } } = this.props; + const { taxAgentId, salaryMonth, pageInfo } = this.state; + const payload = { + employeeId, taxAgentId, + salaryMonth: salaryMonth.map(item => moment(item).format("YYYY-MM-DD")), + ...pageInfo + }; + this.setState({ loading: true }); + statisticsEmployeeDetailList(payload).then(({ status, data }) => { + this.setState({ loading: false }); + if (status) { + const { countResult, pageInfo: { list, pageNum: current, pageSize, total } } = data; + this.setState({ + countResult, + dataSource: list || [], + pageInfo: { ...pageInfo, current, pageSize, total } + }, () => { + // this.postMessageToChild({ + // columns: this.state.columns, + // dataSource: this.state.dataSource, + // showSum: false, pageInfo: this.state.pageInfo + // }); + }); + } + }).catch(() => this.setState({ loading: false })); + }; + + getColumns = () => { + const { dataSource, pageInfo, countResult } = this.state; + const { payrollFilesStore: { employeeTableStore } } = this.props; + const columns = _.filter(toJS(employeeTableStore.columns), (item) => item.display === "true" && item.dataIndex !== "acctTimes"); + this.postMessageToChild({ + columns: _.map(columns, (it, idx) => ({ + ...it, + width: (it.dataIndex === "taxAgent" || it.dataIndex === "salarySob") ? 176 : it.oldWidth, + fixed: (idx === 1 || idx === 0 || idx === 2) ? "left" : "", + ellipsis: true + })), dataSource, countResult, + showSum: true, pageInfo + }); + }; + + render() { + const { + location, + taxAgentStore: { showOperateBtn, taxAgentOption }, + payrollFilesStore: { employeeTableStore } + } = 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())}/> + ]; + const dropMenuDatas = [ + { + key: "BTN_COLUMN", + icon: , + content: "显示列定制", + onClick: () => { + employeeTableStore.setColSetVisible(true); + employeeTableStore.tableColSet(true); + } + } + ]; + return ( + {name}{dept}} + icon={} buttons={showOperateBtn ? btns : []} + iconBgcolor="#F14A2D" showDropIcon={true} dropMenuDatas={dropMenuDatas} + > +
+ +