泛微薪资核算iframe表格

custom-新弘农业/V2-薪资核算表格添加序号列
黎永顺 2 years ago
parent d02b30d6e4
commit 561a8a28f8

@ -13,7 +13,7 @@ export default defineConfig({
// changeOrigin: true,
// },
'/api': {
target: 'http://192.168.0.50:7602/api',
target: 'http://192.168.10.11:7602/api',
changeOrigin: true,
pathRewrite: {
'^/api': '',

@ -37,7 +37,7 @@ const AntdTable: FC<ITableProps> = (props) => {
}, []);
const getPCDataList = (params: any = {}) => {
let { type, listType, ...extraParams } = params;
let { type, listType, hasOperate = true, ...extraParams } = params;
setLoading({ query: true });
setTab(type);
setUsertab(listType);
@ -60,7 +60,7 @@ const AntdTable: FC<ITableProps> = (props) => {
} else {
const { columns = [], pageInfo = {} } = dataCopy;
const { list = [], total, pageSize: size, pageNum } = pageInfo;
setColumns(getColumns(columns));
setColumns(getColumns(columns, hasOperate));
setDataSource(list);
setPageParams({ ...pageParams, total, size, pageNum });
const confCode: any = await API.CalculateService.getSysconfcode({ code: "OPEN_ACCT_RESULT_SUM" });
@ -99,10 +99,33 @@ const AntdTable: FC<ITableProps> = (props) => {
);
}
}];
tmpColumns = _.map(tmpColumns, (item) => {
if (item.dataIndex === "costCenter") {
return {
...item,
width: 110,
render: (text: string, r: any) => {
const { costCenter } = r;
return (
<a href="javascript: void(0);" onClick={() => {
window.parent.postMessage(
{
type: "PC",
data: { id: "COSTCENTER", data: costCenter }
},
"*"
);
}}>{costCenter.name || ""}</a>
);
}
};
}
return { ...item };
});
return tmpColumns;
};
//薪资核算页面列表
const getColumns = (column: any) => {
const getColumns = (column: any, hasOperate: boolean = true) => {
let tmpColumns = [...column];
tmpColumns = tmpColumns.filter(item => item.hide == "FALSE").map((item, index) => {
let result = { ...item };
@ -153,6 +176,26 @@ const AntdTable: FC<ITableProps> = (props) => {
result.oldWidth = result.width;
result.width = "150px";
result.ellipsis = true;
result.render = (text: string, r: any) => {
if (item.column === "costCenter") {
const { costCenter } = r;
return <a href="javascript: void(0);" onClick={() => {
window.parent.postMessage(
{
type: "PR",
data: { id: "COSTCENTER", data: costCenter }
},
"*"
);
}}>{!_.isEmpty(costCenter) ? costCenter.name : ""}</a>;
}
return <span className={styles.contentSpan}>
<span>{text}</span>
{
result.lockStatus === "LOCK" ? <LockOutlined title="锁定的项目值"/> : null
}
</span>;
};
if (result.children) {
result.width = (result.children.length * 150) + "px";
result.children.map((child: any) => {
@ -225,7 +268,7 @@ const AntdTable: FC<ITableProps> = (props) => {
return result;
});
tmpColumns.push({
hasOperate && tmpColumns.push({
title: "操作",
key: "cz",
width: "100px",
@ -313,7 +356,6 @@ const AntdTable: FC<ITableProps> = (props) => {
{
_.isEmpty(sumRow) ? <Spin tip="加载中"/> :
_.map([{}, ...totalColumns], (item, index) => {
console.log(sumRow[item.dataIndex]);
if (index === 0) {
return <Table.Summary.Cell index={0}><Text type="danger"></Text></Table.Summary.Cell>;
}

Loading…
Cancel
Save