泛微薪资核算iframe表格
This commit is contained in:
parent
22964c13ba
commit
978a248cf3
|
|
@ -31,11 +31,26 @@ class CalculateService extends BasicService {
|
|||
getSysconfcode = async ({ code }: any) => {
|
||||
return this.get(`/api/bs/hrmsalary/sys/conf/code?code=${code}`);
|
||||
};
|
||||
//获取职级信息
|
||||
getRankInfo = async () => {
|
||||
return this.get(`/api/ais/tupu/getRankInfo`);
|
||||
};
|
||||
//合计行
|
||||
getAcctresultsum = async (params: any) => {
|
||||
return this.post(`/api/bs/hrmsalary/salaryacct/acctresult/sum`, params);
|
||||
const { departmentIds = "", positionIds = "", subcompanyIds = "", ...extraParams } = params || {};
|
||||
let queryParams = {
|
||||
...extraParams,
|
||||
departmentIds: departmentIds ? departmentIds.split(",") : undefined,
|
||||
positionIds: positionIds ? positionIds.split(",") : undefined,
|
||||
subcompanyIds: subcompanyIds ? subcompanyIds.split(",") : undefined
|
||||
};
|
||||
for (let key in queryParams) {
|
||||
if (queryParams[key] === "" || queryParams[key] === "0") {
|
||||
delete queryParams[key];
|
||||
}
|
||||
}
|
||||
return this.post(`/api/bs/hrmsalary/salaryacct/acctresult/sum`, queryParams);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
const calculateService = new CalculateService();
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ module.exports = {
|
|||
'/previewTable.*': 'blank',
|
||||
'/standingbookTable.*': 'blank',
|
||||
'/fileTable.*': 'blank',
|
||||
'/rankMapTable.*': 'blank',
|
||||
'/manage.*': 'manage',
|
||||
'/portal.*': 'template',
|
||||
'/passport/oauth-in': 'blank',
|
||||
|
|
|
|||
|
|
@ -155,3 +155,18 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
:global{
|
||||
.rankMapWrapper{
|
||||
.ant-table-thead>tr>th{
|
||||
background: #ED7D31;
|
||||
}
|
||||
}
|
||||
.bg_1_Cols {
|
||||
background: #ED7D31!important;
|
||||
}
|
||||
.bg_2_Cols {
|
||||
background: #DEE0E3!important;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,84 @@
|
|||
import React, { useEffect, useState } from "react";
|
||||
import { Table } from "antd";
|
||||
import API from "@/api";
|
||||
import "../atdTable/components/index.less";
|
||||
|
||||
const RankMapTable: React.FC = () => {
|
||||
const [cols, setCols] = useState<Array<any>>([]);
|
||||
const [dataSource, setDataSource] = useState<Array<any>>([]);
|
||||
useEffect(() => {
|
||||
getRankInfo();
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
if (!_.isEmpty(dataSource)) {
|
||||
setCols(
|
||||
_.map(cols, item => {
|
||||
const dataIndex = item.dataIndex + "_rowSpan";
|
||||
const colsIndex = item.dataIndex.split("_")[1];
|
||||
return {
|
||||
...item,
|
||||
align: "center",
|
||||
className: colsIndex === "1" ? "bg_1_Cols" : colsIndex === "2" ? "bg_2_Cols" : "",
|
||||
render: (text: string, _: any) => {
|
||||
return {
|
||||
children: <span>{text}</span>,
|
||||
props: {
|
||||
rowSpan: _[dataIndex]
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
})
|
||||
);
|
||||
}
|
||||
}, [dataSource]);
|
||||
|
||||
const changeData = (data: any, field: any) => {
|
||||
let count = 0, indexCount = 1;
|
||||
const rowSpan = field + "_rowSpan";
|
||||
try {
|
||||
while (indexCount < data.length) {
|
||||
let item = data.slice(count, count + 1)[0];
|
||||
if (!item[rowSpan]) {
|
||||
item[rowSpan] = 1;
|
||||
}
|
||||
if (item[field] === data[indexCount][field]) {
|
||||
item[rowSpan]++;
|
||||
data[indexCount][rowSpan] = 0;
|
||||
} else {
|
||||
count = indexCount;
|
||||
}
|
||||
indexCount++;
|
||||
}
|
||||
} catch {
|
||||
}
|
||||
return data;
|
||||
};
|
||||
const getRankInfo = () => {
|
||||
API.CalculateService.getRankInfo().then(({ success, data }) => {
|
||||
if (success) {
|
||||
const { data: dataCopy } = data;
|
||||
const { col: columns, data: list } = dataCopy;
|
||||
let tmpV: any = [];
|
||||
_.forEach(_.reduce(columns, (pre: any, cur: any) => ([...pre, cur["dataIndex"]]), []), item => {
|
||||
tmpV = changeData(list, item);
|
||||
});
|
||||
setCols(columns);
|
||||
setDataSource(tmpV);
|
||||
}
|
||||
});
|
||||
};
|
||||
return <div style={{ height: "100%", overflowY: "auto" }}>
|
||||
<Table
|
||||
className="rankMapWrapper"
|
||||
columns={cols}
|
||||
dataSource={dataSource}
|
||||
bordered
|
||||
pagination={false}
|
||||
size="middle"
|
||||
/>;
|
||||
</div>;
|
||||
}
|
||||
;
|
||||
|
||||
export default RankMapTable;
|
||||
Loading…
Reference in New Issue