Compare commits

...

21 Commits

Author SHA1 Message Date
lys e672532907 feature/业务线管理 3 months ago
lys f3be2b68f6 Merge branch 'master' into feature/业务线管理 3 months ago
lys 78643df60d Merge branch 'master' into feature/业务线管理 4 months ago
lys 8908b23300 feature/业务线管理 4 months ago
lys 4f9bc70fc7 Merge branch 'master' into feature/业务线管理 5 months ago
lys 069131b999 Merge branch 'master' into feature/业务线管理 5 months ago
lys 9702881965 Merge branch 'master' into feature/业务线管理 7 months ago
lys 5f37df75cc feature/业务线管理 8 months ago
lys 7b95a64415 Merge branch 'master' into feature/业务线管理 8 months ago
lys 979a35dc54 Merge branch 'master' into feature/业务线管理 8 months ago
lys 597c00af41 Merge branch 'master' into feature/业务线管理
# Conflicts:
#	src/pages/unitTable/renderColsOpts.tsx
8 months ago
lys 4580128814 Merge branch 'master' into feature/业务线管理 8 months ago
lys c86656f970 Merge branch 'master' into feature/业务线管理 8 months ago
lys d375704faf Merge branch 'master' into feature/业务线管理 8 months ago
lys 78faf02e22 样式修改 9 months ago
lys ee0eaf67ad Merge branch 'master' into feature/业务线管理 9 months ago
黎永顺 d82ca76290 Merge branch 'master' into feature/业务线管理
# Conflicts:
#	src/pages/salaryFileTable/index.tsx
#	src/pages/welfareArchiveTable/index.tsx
9 months ago
黎永顺 3a5e06a6e7 Merge branch 'master' into feature/业务线管理
# Conflicts:
#	src/pages/salaryFileTable/index.tsx
#	src/pages/welfareArchiveTable/index.tsx
9 months ago
黎永顺 b72ccf78d7 Merge branch 'master' into feature/业务线管理 9 months ago
黎永顺 bba707b041 业务线管理 9 months ago
黎永顺 793d7acefb 业务线管理 10 months ago

@ -24,9 +24,7 @@ const Index: FunctionComponent<Props> = (props) => {
const [pageInfo, setPageInfo] = useState<Partial<PaginationData>>({});
const [i18n, setI18n] = useState<any>({});
const [runStatuses, setRunStatuses] = useState<string>("");
const [showOperateBtn, setShowOperateBtn] = useState<boolean>(false);
const [showDelSalaryFileBtn, setShowDelSalaryFileBtn] = useState<boolean>(false);//待定薪、停薪员工 是否允许删除薪资档案
const [DCChiefPermission, setDCChiefPermission] = useState<undefined>(undefined);//二开权限(大成)
useEffect(() => {
window.parent.postMessage({ type: "init" }, "*");
@ -40,10 +38,8 @@ const Index: FunctionComponent<Props> = (props) => {
const data: any = exceptStr(event.data);
if (!_.isEmpty(data)) {
const {
columns, dataSource, pageInfo, selectedRowKeys: rowKeys = [], i18n: i18nRes = {},
selectedKey, showOperateBtn, showDelSalaryFileBtn, DCChiefPermission
columns, dataSource, pageInfo, selectedRowKeys: rowKeys = [], i18n: i18nRes = {}, selectedKey, showDelSalaryFileBtn
} = data;
setShowOperateBtn(showOperateBtn);
setRunStatuses(selectedKey);
setI18n(i18nRes);
setPageInfo(pageInfo);
@ -51,7 +47,6 @@ const Index: FunctionComponent<Props> = (props) => {
setSelectedRowKeys([...rowKeys, ...selectedRowKeys]);
setColumns(columns);
setShowDelSalaryFileBtn(showDelSalaryFileBtn);
setDCChiefPermission(DCChiefPermission);
}
};
const onChange = (current: number, pageSize: number) => {
@ -113,19 +108,30 @@ const Index: FunctionComponent<Props> = (props) => {
}
];
!showDelSalaryFileBtn && (items = _.dropRight(items));
return (<Space>
{
(_.isNil(DCChiefPermission) || DCChiefPermission) ?
return (
record?.opts.includes("admin") ?
<Space>
<Button type="link"
onClick={() => handleSalaryFileOperate("EDIT", record)}>{i18n["编辑"]}</Button> :
<Button type="link" onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
}
onClick={() => handleSalaryFileOperate("EDIT", record)}>{i18n["编辑"]}</Button>
<Button type="link"
onClick={() => handleSalaryFileOperate("ADD-TO-SALARYPAYMENT", record, [record?.id])}>{i18n["设为发薪人员"]}</Button>
<Dropdown menu={{ items }} placement="bottomRight">
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
</Space>);
</Space> : <Space>
<Button type="link"
onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
<Dropdown menu={{
items: [
{
key: "Log", label: i18n["操作日志"], onClick: () => handleSalaryFileOperate("log", record)
}
]
}} placement="bottomRight">
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
</Space>
);
}
};
break;
@ -142,15 +148,24 @@ const Index: FunctionComponent<Props> = (props) => {
}
];
return (
record?.opts.includes("admin") ?
<Space>
{
(((_.isNil(DCChiefPermission) || DCChiefPermission) && runStatuses === "fixed") || runStatuses === "ext") ?
<Button type="link"
onClick={() => handleSalaryFileOperate("CHANGE-SALARY", record)}>{i18n["调薪"]}</Button> :
onClick={() => handleSalaryFileOperate("CHANGE-SALARY", record)}>{i18n["调薪"]}</Button>
<Dropdown menu={{ items }} placement="bottomRight">
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
</Space> :
<Space>
<Button type="link"
onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
<Dropdown menu={{
items: [
{
key: "Log", label: i18n["操作日志"], onClick: () => handleSalaryFileOperate("log", record)
}
<Dropdown menu={{ items }} placement="bottomRight">
]
}} placement="bottomRight">
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
</Space>
@ -174,14 +189,30 @@ const Index: FunctionComponent<Props> = (props) => {
onClick: () => handleSalaryFileOperate("log", record)
}
];
return (<Space>
return (
record?.opts.includes("admin") ?
<Space>
<Button type="link" onClick={() => handleSalaryFileOperate("EDIT", record)}>{i18n["编辑"]}</Button>
<Button type="link"
onClick={() => handleSalaryFileOperate("SALARY-SUSPENSION", record, [record?.id])}>{i18n["停薪"]}</Button>
<Dropdown menu={{ items: downsizingItems }} placement="bottomRight">
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
</Space>);
</Space> :
<Space>
<Button type="link"
onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
<Dropdown menu={{
items: [
{
key: "Log", label: i18n["操作日志"], onClick: () => handleSalaryFileOperate("log", record)
}
]
}} placement="bottomRight">
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
</Space>
);
}
};
break;
@ -190,19 +221,21 @@ const Index: FunctionComponent<Props> = (props) => {
...opts,
render: (__: any, record: any) => {
let stopItems: MenuProps["items"] = [
{
key: "Log",
label: i18n["操作日志"],
onClick: () => handleSalaryFileOperate("log", record)
},
{
key: "CancelSuspension",
label: i18n["删除档案"],
onClick: () => handleSalaryFileOperate("DEL-SALARY-FILES", record, [record?.id])
},
{
key: "Log",
label: i18n["操作日志"],
onClick: () => handleSalaryFileOperate("log", record)
}
];
!showDelSalaryFileBtn && (stopItems = _.dropRight(stopItems));
return (<Space>
return (
record?.opts.includes("admin") ?
<Space>
<Button type="link" onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
<Button type="link"
onClick={() => handleSalaryFileOperate("CANCEL-SALARY-SUSPENSION", record, [record?.id])}>{i18n["取消停薪"]}</Button>
@ -212,32 +245,32 @@ const Index: FunctionComponent<Props> = (props) => {
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
}
</Space>);
</Space> :
<Space>
<Button type="link"
onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
<Dropdown menu={{
items: [
{
key: "Log", label: i18n["操作日志"], onClick: () => handleSalaryFileOperate("log", record)
}
]
}} placement="bottomRight">
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
</Space>
);
}
};
break;
default:
break;
}
return showOperateBtn ? [..._.filter(columns, o => o.dataIndex !== "operate"), opts] :
[..._.filter(columns, o => o.dataIndex !== "operate"), {
...opts,
render: (__: any, record: any) => (
<Space>
{
(DCChiefPermission && (runStatuses === "pending" || runStatuses === "fixed")) ?
<Button type="link"
onClick={() => handleSalaryFileOperate(runStatuses === "fixed" ? "CHANGE-SALARY" : "EDIT", record)}>{runStatuses === "fixed" ? i18n["调薪"] : i18n["编辑"]}</Button> :
<Button type="link" onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
}
<Button type="link" onClick={() => handleSalaryFileOperate("log", record)}>{i18n["操作日志"]}</Button>
</Space>
)
}];
return [..._.filter(columns, o => o.dataIndex !== "operate"), opts];
} else {
return [];
}
}, [columns, runStatuses, i18n, showOperateBtn, showDelSalaryFileBtn, DCChiefPermission]);
}, [columns, runStatuses, i18n, showDelSalaryFileBtn]);
return (<Table
rowKey="id" size="small" className={styles.tableWrapper}
columns={cols} dataSource={dataSource} rowSelection={rowSelection}

@ -1,9 +1,8 @@
import React, { FC, useEffect, useState } from "react";
import { Button, Spin, Table, Typography } from "antd";
import { Button, Table, Typography } from "antd";
import { exceptStr, paginationFun } from "@/utils/common";
import { defaultPage, IPage } from "@/common/types";
import styles from "@/pages/atdTable/components/index.less";
import API from "@/api";
const { Text } = Typography;
const StandingbookTable: FC = (props) => {
@ -12,7 +11,6 @@ const StandingbookTable: FC = (props) => {
const [dataSource, setDataSource] = useState<Array<any>>([]);
const [pageInfo, setPageInfo] = useState<IPage>(defaultPage);
const [sumRow, setSumRow] = useState<Partial<{}>>({});
const [showSumrow, setShowSumrow] = useState<boolean>(false);
useEffect(() => {
window.parent.postMessage({ type: "init" }, "*");
@ -24,30 +22,33 @@ const StandingbookTable: FC = (props) => {
const receiveMessageFromIndex = async (event: any) => {
const data: any = exceptStr(event.data);
if (!_.isEmpty(data)) {
const {
columns, dataSource, pageInfo, showOperates, selectedRowKeys,
sumpayload, selectedKey
} = data;
const { columns, dataSource, pageInfo, showOperates, selectedRowKeys, sumRow } = data;
const { current: pageNum, pageSize: size, total } = pageInfo;
const conventColumns = _.map(_.filter(columns, it => it.dataIndex !== "id"), item => {
const conventColumns = _.map(
_.filter(columns, (it) => it.dataIndex !== "id"),
(item) => {
const { dataIndex } = item;
if (dataIndex === "employeeId") {
return {
title: "姓名", dataIndex, fixed: "left", width: 150,
render: (_: any, record: Partial<any>) => (
<span>{record?.userName}</span>
)
title: "姓名",
dataIndex,
fixed: "left",
width: 150,
render: (_: any, record: Partial<any>) => <span>{record?.userName}</span>
};
}
return {
dataIndex, width: 150,
title: <span dangerouslySetInnerHTML={{ __html: item.title }}/>
dataIndex,
width: 150,
title: <span dangerouslySetInnerHTML={{ __html: item.title }} />
};
});
}
);
setDataSource(dataSource);
setColumns(
!showOperates ? conventColumns :
[
!showOperates
? conventColumns
: [
...conventColumns,
{
title: "操作",
@ -56,7 +57,9 @@ const StandingbookTable: FC = (props) => {
width: 120,
render: (_: any, record: any) => {
return (
<Button type="link" onClick={() => handleEdit(record)}></Button>
<Button type="link" onClick={() => handleEdit(record)}>
</Button>
);
}
}
@ -64,61 +67,27 @@ const StandingbookTable: FC = (props) => {
);
setPageInfo({ pageNum, size, total });
setSelected(selectedRowKeys);
const confCode: any = await API.CalculateService.getSysconfcode({ code: "OPEN_ACCT_RESULT_SUM" });
setShowSumrow(confCode.data.status && confCode.data.data === "1");
if (confCode.data.status && confCode.data.data === "1") {
const sumRowlist: any = selectedKey === "1" ? await API.CalculateService.siaccountDetailCommonListSum(sumpayload) :
selectedKey === "3" ? await API.CalculateService.siaccountDetailSupplementaryListSum(sumpayload) :
selectedKey === "regression" ? await API.CalculateService.siaccountDetailRecessionListSum(sumpayload) :
selectedKey === "difference" ? await API.CalculateService.siaccountDetailBalanceListSum(sumpayload) : {
data: {
status: false,
data: { sumRow: {} }
}
};
if (sumRowlist.data.status) {
if (!_.isEmpty(sumRowlist.data.data.sumRow)) {
setSumRow(sumRowlist.data.data.sumRow);
} else {
setSumRow({ [new Date().getTime()]: new Date().getTime() });
}
}
if (sumRowlist.data.status && _.isNil(sumRowlist.data.data.sumRow)) {
setSumRow({ [new Date().getTime()]: new Date().getTime() });
}
}
setSumRow(sumRow);
}
};
const handleEdit = (record: any) => {
window.parent.postMessage({ type: "turn", payload: { id: "EDIT", params: { ...record } } }, "*");
};
const sizeChange = (pageobj: IPage) => {
};
const sizeChange = (pageobj: IPage) => {};
const onChange = (pageobj: IPage) => {
setPageInfo({ ...pageInfo, ...pageobj });
window.parent.postMessage(
{
type: "turn",
payload: { id: "PAGEINFO", params: { ...pageInfo, ...pageobj } }
},
"*"
);
window.parent.postMessage({ type: "turn", payload: { id: "PAGEINFO", params: { ...pageInfo, ...pageobj } } }, "*");
};
const rowSelection = {
selectedRowKeys: selected,
columnWidth: 80,
columnWidth: 60,
onChange: (selectedRowKeys: Array<any>) => {
setSelected(selectedRowKeys);
window.parent.postMessage(
{
type: "turn",
payload: { id: "ROWSELECT", params: { selectedRowKeys } }
},
"*"
);
window.parent.postMessage({ type: "turn", payload: { id: "ROWSELECT", params: { selectedRowKeys } } }, "*");
}
};
return <Table
return (
<Table
rowKey="id"
className={styles.tableWrapper}
columns={columns}
@ -131,27 +100,30 @@ const StandingbookTable: FC = (props) => {
}}
scroll={{ x: 1200, y: `calc(100vh - 172px)` }}
summary={() => {
if (_.isEmpty(columns) || !showSumrow) return;
if (_.isEmpty(sumRow)) return;
return (
<Table.Summary fixed>
<Table.Summary.Row>
{
_.isEmpty(sumRow) ? <Spin tip="加载中"/> :
_.map([{}, ...columns], (item, index) => {
{_.map([{}, ...columns], (item, index) => {
if (index === 0) {
return <Table.Summary.Cell index={0} key={index} align="center"><Text
type="danger"></Text></Table.Summary.Cell>;
return (
<Table.Summary.Cell index={0} key={index} align="center">
<Text type="danger"></Text>
</Table.Summary.Cell>
);
}
return <Table.Summary.Cell index={index} key={index}>
return (
<Table.Summary.Cell index={index} key={index}>
<Text type="danger">{!_.isNil(sumRow[item.dataIndex]) ? sumRow[item.dataIndex] : "-"}</Text>
</Table.Summary.Cell>;
})
}
</Table.Summary.Cell>
);
})}
</Table.Summary.Row>
</Table.Summary>
);
}}
/>;
/>
);
};
export default StandingbookTable;

@ -27,7 +27,7 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject,
render: (text: string, record: any) => {
const { billStatus } = record;
return (
<Button type="link" onClick={() => postMessageToParent(billStatus === "0" && extraParams?.permission ? "CALC" : "VIEW", record)}>
<Button type="link" onClick={() => postMessageToParent(billStatus === "0" && record?.opts.includes("admin") ? "CALC" : "VIEW", record)}>
{text}
</Button>
);
@ -84,7 +84,7 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject,
];
return (
<Space>
{!extraParams?.permission ? (
{!record?.opts.includes("admin") ? (
<Space>
<Button type="link" onClick={() => postMessageToParent("VIEW", record)}>
{i18n?.["查看"]}
@ -358,6 +358,8 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject,
fixed: "right",
render: (__: string, record: any) => {
return (
<Space>
{record?.opts.includes("admin") ? (
<Space>
<Button type="link" onClick={() => postMessageToParent("EDIT", record)}>
{i18n?.["编辑"]}
@ -366,6 +368,12 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject,
{i18n?.["删除"]}
</Button>
</Space>
) : (
<Button type="link" onClick={() => postMessageToParent("VIEW", record)}>
{i18n?.["查看"]}
</Button>
)}
</Space>
);
}
}
@ -404,13 +412,15 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject,
onClick: () => postMessageToParent("log", record)
}
];
isSpecial && items.shift();
(isSpecial || !record?.opts.includes("admin")) && items.shift();
return (
<Space>
{record?.opts.includes("admin") && (
<Button type="link" onClick={() => postMessageToParent("EDIT", record)}>
{i18n?.["编辑"]}
</Button>
{isSpecial ? (
)}
{isSpecial && record?.opts.includes("admin") ? (
<Button type="link" onClick={() => postMessageToParent("DEL", record)}>
{i18n?.["删除"]}
</Button>

@ -25,7 +25,6 @@ const Index: FunctionComponent<Props> = (props) => {
const [pageInfo, setPageInfo] = useState<Partial<PaginationData>>({});
const [i18n, setI18n] = useState<any>({});
const [runStatuses, setRunStatuses] = useState<string>("");
const [showOperateBtn, setShowOperateBtn] = useState<boolean>(false);
useEffect(() => {
window.parent.postMessage({ type: "init" }, "*");
@ -38,11 +37,7 @@ const Index: FunctionComponent<Props> = (props) => {
const receiveMessageFromIndex = (event: any) => {
const data: any = exceptStr(event.data);
if (!_.isEmpty(data)) {
const {
columns, dataSource, pageInfo, selectedRowKeys: rowKeys = [], i18n: i18nRes = {},
runStatuses, showOperateBtn
} = data;
setShowOperateBtn(showOperateBtn);
const { columns, dataSource, pageInfo, selectedRowKeys: rowKeys = [], i18n: i18nRes = {}, runStatuses } = data;
setRunStatuses(runStatuses);
setI18n(i18nRes);
setPageInfo(pageInfo);
@ -87,6 +82,14 @@ const Index: FunctionComponent<Props> = (props) => {
};
const cols: any = useMemo(() => {
let opts: any = { title: i18n["操作"], dataIndex: "operate", fixed: "right", width: 185 };
const UnAuthOpts = (record: any) => (<Space>
<Button type="link" onClick={() => handleWelfareOperate("VIEW", record)}>{i18n["查看"]}</Button>
<Dropdown menu={{
items: [{ key: "Log", label: i18n["操作日志"], onClick: () => handleWelfareOperate("log", record) }]
}} placement="bottomRight">
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
</Space>);
switch (runStatuses) {
case "1":
opts = {
@ -109,13 +112,13 @@ const Index: FunctionComponent<Props> = (props) => {
onClick: () => handleWelfareOperate("log", record)
}
];
return (<Space>
return (record?.opts.includes("admin") ? <Space>
<Button type="link" onClick={() => handleWelfareOperate("EDIT", record)}>{i18n["编辑"]}</Button>
<Button type="link" onClick={() => handleWelfareOperate("ADD-TO-PAY", record)}>{i18n["增员"]}</Button>
<Dropdown menu={{ items }} placement="bottomRight">
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
</Space>);
</Space> : UnAuthOpts(record));
}
};
break;
@ -131,13 +134,12 @@ const Index: FunctionComponent<Props> = (props) => {
onClick: () => handleWelfareOperate("log", record)
}
];
return (
<Space>
return (record?.opts.includes("admin") ? <Space>
<Button type="link" onClick={() => handleWelfareOperate("EDIT", record)}>{i18n["编辑"]}</Button>
<Dropdown menu={{ items }} placement="bottomRight">
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
</Space>);
</Space> : UnAuthOpts(record));
}
};
break;
@ -157,14 +159,14 @@ const Index: FunctionComponent<Props> = (props) => {
onClick: () => handleWelfareOperate("log", record)
}
];
return (<Space>
return (record?.opts.includes("admin") ? <Space>
<Button type="link" onClick={() => handleWelfareOperate("EDIT", record)}>{i18n["编辑"]}</Button>
<Button type="link"
onClick={() => handleWelfareOperate("STAY-DEL-TO-STOP", record)}>{i18n["减员"]}</Button>
<Dropdown menu={{ items: downsizingItems }} placement="bottomRight">
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
</Space>);
</Space> : UnAuthOpts(record));
}
};
break;
@ -184,38 +186,27 @@ const Index: FunctionComponent<Props> = (props) => {
onClick: () => handleWelfareOperate("log", record)
}
];
return (<Space>
return (record?.opts.includes("admin") ? <Space>
<Button type="link" onClick={() => handleWelfareOperate("VIEW", record)}>{i18n["查看"]}</Button>
<Button type="link"
onClick={() => handleWelfareOperate("DEL-ARCHIVE", record)}>{i18n["删除档案"]}</Button>
<Dropdown menu={{ items: stopItems }} placement="bottomRight">
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
</Space>);
</Space> : UnAuthOpts(record));
}
};
break;
default:
break;
}
return showOperateBtn ? [...columns, opts] : [...columns, {
...opts,
render: (__: any, record: any) => (
<Space>
<Button type="link" onClick={() => handleWelfareOperate("VIEW", record)}>{i18n["查看"]}</Button>
<Button type="link" onClick={() => handleWelfareOperate("log", record)}>{i18n["操作日志"]}</Button>
</Space>
)
}];
}, [columns, runStatuses, i18n, showOperateBtn]);
return [...columns, opts];
}, [columns, runStatuses, i18n]);
return (<Table
rowKey="baseInfo" size="small" className={styles.tableWrapper}
rowKey="baseInfoId" size="small" className={styles.tableWrapper}
columns={cols} dataSource={dataSource} rowSelection={rowSelection}
scroll={{ x: 1200, y: `calc(100vh - 103px)` }}
pagination={{
...paginationAction(pageInfo, i18n, onChange),
size: "default"
}}
pagination={{ ...paginationAction(pageInfo, i18n, onChange), size: "default" }}
/>);
};

Loading…
Cancel
Save