薪酬统计分析添加员工明细列表的统计行

This commit is contained in:
黎永顺 2023-05-26 14:51:17 +08:00
parent 28a7bb7f64
commit 11ac288541
3 changed files with 87 additions and 37 deletions

View File

@ -6,7 +6,6 @@
*/
import React, { Component } from "react";
import { WeaLocaleProvider, WeaTable } from "ecCom";
import { Dropdown, Menu } from "antd";
import { statisticsEmployeeList } from "../../../apis/statistics";
import "../index.less";
@ -51,20 +50,12 @@ class EmployeeDetails extends Component {
pageInfo: { ...pageInfo, current, pageSize, total },
dataSource,
columns: [...columns, {
title: "",
title: "操作",
dataIndex: "operate",
width: 80,
render: (_, record) => {
return <div className="operates">
<Dropdown overlay={
<Menu>
<Menu.Item><a target="_blank"
href={`${window.location.origin}/spa/hrmSalary/static/index.html#/main/hrmSalary/analysisOfSalaryStatistics/${record.id}?name=${record.name}&dept=${record.department || ""}`}>{getLabel(111, "查看")}</a></Menu.Item>
</Menu>
} overlayStyle={{ width: "auto", height: "auto" }}>
<i className="icon-coms-more"/>
</Dropdown>
</div>;
return <a target="_blank"
href={`${window.location.origin}/spa/hrmSalary/static/index.html#/main/hrmSalary/analysisOfSalaryStatistics/${record.id}?name=${record.name}&dept=${record.department || ""}`}>{getLabel(111, "查看")}</a>;
}
}]
});

View File

@ -6,17 +6,19 @@
*/
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 { statisticsEmployeeDetailList } from "../../apis/statistics";
import { optionAddWhole } from "../../util/options";
import moment from "moment";
import "./index.less";
const WeaTableComx = WeaTableNew.WeaTable;
const { getLabel } = WeaLocaleProvider;
@inject("taxAgentStore")
@inject("taxAgentStore", "payrollFilesStore")
@observer
class Index extends Component {
constructor(props) {
@ -24,9 +26,9 @@ class Index extends Component {
this.state = {
loading: false,
taxAgentId: "",
countResult: {},
salaryMonth: [moment().startOf("year").format("YYYY-MM"), moment().format("YYYY-MM")],
dataSource: [],
columns: [],
pageInfo: {
current: 1,
pageSize: 10,
@ -47,11 +49,18 @@ class Index extends Component {
handleReceive = ({ data }) => {
const { type, payload: { id, params } = {} } = data;
const { columns, dataSource, pageInfo } = this.state;
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, dataSource,
showSum: false, pageInfo
columns: _.map(columns, (it, idx) => ({
...it,
width: (it.dataIndex === "taxAgent" || it.dataIndex === "salarySob") ? 176 : it.oldWidth,
fixed: (idx === 1 || idx === 0) ? "left" : "",
ellipsis: true
})), dataSource, countResult,
showSum: true, pageInfo
});
} else if (type === "turn") {
if (id === "PAGEINFO") {
@ -62,14 +71,14 @@ class Index extends Component {
};
postMessageToChild = (payload) => {
const childFrameObj = document.getElementById("atdTable");
const { dataSource, columns, showSum, pageInfo } = payload;
const { dataSource, columns, showSum, pageInfo, countResult } = payload;
childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({
dataSource, columns, showSum, pageInfo
dataSource, columns, showSum, pageInfo, countResult
}), "*");
};
statisticsEmployeeDetailList = () => {
const { params: { employeeId } } = this.props;
const { params: { employeeId }, payrollFilesStore: { statisticsEmployeeDetailList } } = this.props;
const { taxAgentId, salaryMonth, pageInfo } = this.state;
const payload = {
employeeId, taxAgentId,
@ -80,30 +89,43 @@ class Index extends Component {
statisticsEmployeeDetailList(payload).then(({ status, data }) => {
this.setState({ loading: false });
if (status) {
const { columns, pageInfo: { list, pageNum: current, pageSize, total } } = data;
const { countResult, pageInfo: { list, pageNum: current, pageSize, total } } = data;
this.setState({
columns: _.map(columns, (it, idx) => ({
...it,
dataIndex: it.text, width: 150,
title: it.width, align: "left",
fixed: (idx === 1 || idx === 0) ? "left" : "",
ellipsis: true
})),
countResult,
dataSource: list || [],
pageInfo: { ...pageInfo, current, pageSize, total }
}, () => {
this.postMessageToChild({
columns: this.state.columns,
dataSource: this.state.dataSource,
showSum: false, pageInfo: this.state.pageInfo
});
// 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) ? "left" : "",
ellipsis: true
})), dataSource, countResult,
showSum: true, pageInfo
});
};
render() {
const { location, taxAgentStore: { showOperateBtn, taxAgentOption } } = this.props;
const {
location,
taxAgentStore: { showOperateBtn, taxAgentOption },
payrollFilesStore: { employeeTableStore }
} = this.props;
const { salaryMonth, taxAgentId, loading } = this.state;
const { query: { dept, name } } = location;
const btns = [
@ -112,11 +134,22 @@ class Index extends Component {
<WeaSelect options={optionAddWhole(taxAgentOption)} value={taxAgentId} style={{ width: 200 }}
onChange={v => this.setState({ taxAgentId: v }, () => this.statisticsEmployeeDetailList())}/>
];
const dropMenuDatas = [
{
key: "BTN_COLUMN",
icon: <i className="icon-coms-Custom"/>,
content: "显示列定制",
onClick: () => {
employeeTableStore.setColSetVisible(true);
employeeTableStore.tableColSet(true);
}
}
];
return (
<WeaTop
title={<span><span style={{ marginRight: 8 }}>{name}</span><span>{dept}</span></span>}
icon={<i className="icon-coms-fa"/>} buttons={showOperateBtn ? btns : []}
iconBgcolor="#F14A2D" showDropIcon={false}
iconBgcolor="#F14A2D" showDropIcon={true} dropMenuDatas={dropMenuDatas}
>
<div className="employeeDetailWrapper">
<Spin spinning={loading}>
@ -128,6 +161,12 @@ class Index extends Component {
/>
</Spin>
</div>
<WeaTableComx
style={{ display: "none" }}
comsWeaTableStore={employeeTableStore}
needScroll={true}
columns={this.getColumns()}
/>
</WeaTop>
);
}

View File

@ -1,12 +1,15 @@
import { action, observable } from "mobx";
import { WeaTableNew } from "comsMobx";
import * as API from "../apis/payrollFiles";
import { statisticsEmployeeDetailList } from "../apis/statistics";
const { TableStore } = WeaTableNew;
export class PayrollFilesStore {
@observable tableStore = new TableStore();
@action("列表查询")
@observable employeeTableStore = new TableStore();
@action("薪资档案-列表查询")
queryList = (payload = {}, searchItemsValue = {}, url = "") => {
return new Promise((resolve, reject) => {
const { departmentIds, positionIds, subcompanyIds, ...extra } = searchItemsValue;
@ -28,4 +31,21 @@ export class PayrollFilesStore {
});
});
};
@action("薪酬统计列表员工详情-列表查询")
statisticsEmployeeDetailList = (payload) => {
return new Promise((resolve, reject) => {
statisticsEmployeeDetailList(payload).then(res => {
const { data, status } = res;
if (status) {
const { dataKey } = data;
const { datas } = dataKey;
this.employeeTableStore.getDatas(datas); // table 请求数据
}
resolve(res);
}).catch(() => {
reject();
});
});
};
}