|
|
|
@ -19,6 +19,7 @@ const AntdTable: FC<ITableProps> = (props) => {
|
|
|
|
|
const [loading, setLoading] = useState<ILoading>({});
|
|
|
|
|
const [columns, setColumns] = useState<any[]>([]);
|
|
|
|
|
const [dataSource, setDataSource] = useState<any[]>([]);
|
|
|
|
|
const [i18n, setI18n] = useState<Partial<{}>>({});
|
|
|
|
|
const [sumRow, setSumRow] = useState<Partial<{}>>({});//薪资核算总计行数据
|
|
|
|
|
const [showSumrow, setShowSumrow] = useState<boolean>(false);//薪资核算总计行是否隐藏
|
|
|
|
|
useEffect(() => {
|
|
|
|
@ -37,7 +38,7 @@ const AntdTable: FC<ITableProps> = (props) => {
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
const getPCDataList = (params: any = {}) => {
|
|
|
|
|
let { type, listType, hasOperate = true, ...extraParams } = params;
|
|
|
|
|
let { type, listType, hasOperate = true, i18n: newI18n, ...extraParams } = params;
|
|
|
|
|
setLoading({ query: true });
|
|
|
|
|
setTab(type);
|
|
|
|
|
setUsertab(listType);
|
|
|
|
@ -48,7 +49,7 @@ const AntdTable: FC<ITableProps> = (props) => {
|
|
|
|
|
if (type === "PC") {
|
|
|
|
|
if (listType === "SA") {
|
|
|
|
|
const { columns = [], list = [], total, pageSize: size, pageNum } = dataCopy;
|
|
|
|
|
setColumns(getUserListColumns(columns));
|
|
|
|
|
setColumns(getUserListColumns(columns, newI18n));
|
|
|
|
|
setDataSource(list);
|
|
|
|
|
setPageParams({ ...pageParams, total, size, pageNum });
|
|
|
|
|
} else if (listType === "MA") {
|
|
|
|
@ -60,7 +61,7 @@ const AntdTable: FC<ITableProps> = (props) => {
|
|
|
|
|
} else {
|
|
|
|
|
const { columns = [], pageInfo = {} } = dataCopy;
|
|
|
|
|
const { list = [], total, pageSize: size, pageNum } = pageInfo;
|
|
|
|
|
setColumns(getColumns(columns, hasOperate));
|
|
|
|
|
setColumns(getColumns(columns, hasOperate, newI18n));
|
|
|
|
|
setDataSource(list);
|
|
|
|
|
setPageParams({ ...pageParams, total, size, pageNum });
|
|
|
|
|
const confCode: any = await API.CalculateService.getSysconfcode({ code: "OPEN_ACCT_RESULT_SUM" });
|
|
|
|
@ -80,10 +81,10 @@ const AntdTable: FC<ITableProps> = (props) => {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
const getUserListColumns = (acctemployeeListColumns: any) => {
|
|
|
|
|
const getUserListColumns = (acctemployeeListColumns: any, newI18n:any) => {
|
|
|
|
|
let tmpColumns = [...acctemployeeListColumns, {
|
|
|
|
|
key: "cz",
|
|
|
|
|
title: "操作",
|
|
|
|
|
title: newI18n["操作"],
|
|
|
|
|
render: (text: string, record: any) => {
|
|
|
|
|
return (
|
|
|
|
|
<Button type="link" style={{ padding: "0" }}
|
|
|
|
@ -97,7 +98,7 @@ const AntdTable: FC<ITableProps> = (props) => {
|
|
|
|
|
);
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
删除
|
|
|
|
|
{newI18n["删除"]}
|
|
|
|
|
</Button>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
@ -129,7 +130,7 @@ const AntdTable: FC<ITableProps> = (props) => {
|
|
|
|
|
return tmpColumns;
|
|
|
|
|
};
|
|
|
|
|
//薪资核算页面列表
|
|
|
|
|
const getColumns = (column: any, hasOperate: boolean = true) => {
|
|
|
|
|
const getColumns = (column: any, hasOperate: boolean = true, newI18n: any) => {
|
|
|
|
|
let tmpColumns = [...column];
|
|
|
|
|
tmpColumns = tmpColumns.filter(item => item.hide == "FALSE").map((item, index) => {
|
|
|
|
|
let result = { ...item };
|
|
|
|
@ -147,7 +148,7 @@ const AntdTable: FC<ITableProps> = (props) => {
|
|
|
|
|
item.lockStatus && <span className={styles.titleIcon}>
|
|
|
|
|
{
|
|
|
|
|
item.lockStatus === "UNLOCK" && <LockOutlined
|
|
|
|
|
title="点击锁定所有解锁的项目值"
|
|
|
|
|
title={newI18n["点击锁定所有解锁的项目值"]}
|
|
|
|
|
onClick={() => {
|
|
|
|
|
window.parent.postMessage(
|
|
|
|
|
{
|
|
|
|
@ -161,7 +162,7 @@ const AntdTable: FC<ITableProps> = (props) => {
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
item.lockStatus !== "UNLOCK" && <UnlockOutlined
|
|
|
|
|
title="点击解锁所有锁定的项目值"
|
|
|
|
|
title={newI18n["点击解锁所有锁定的项目值"]}
|
|
|
|
|
onClick={() => {
|
|
|
|
|
window.parent.postMessage(
|
|
|
|
|
{
|
|
|
|
@ -196,7 +197,7 @@ const AntdTable: FC<ITableProps> = (props) => {
|
|
|
|
|
return <span className={styles.contentSpan}>
|
|
|
|
|
<span title={text} className={styles.contentTitle}>{text}</span>
|
|
|
|
|
{
|
|
|
|
|
result.lockStatus === "LOCK" ? <LockOutlined title="锁定的项目值"/> : null
|
|
|
|
|
result.lockStatus === "LOCK" ? <LockOutlined title={newI18n["锁定的项目值"]}/> : null
|
|
|
|
|
}
|
|
|
|
|
</span>;
|
|
|
|
|
};
|
|
|
|
@ -219,7 +220,7 @@ const AntdTable: FC<ITableProps> = (props) => {
|
|
|
|
|
{
|
|
|
|
|
child.lockStatus === "UNLOCK" &&
|
|
|
|
|
<LockOutlined
|
|
|
|
|
title="点击锁定所有解锁的项目值"
|
|
|
|
|
title={newI18n["点击锁定所有解锁的项目值"]}
|
|
|
|
|
onClick={() => {
|
|
|
|
|
window.parent.postMessage(
|
|
|
|
|
{
|
|
|
|
@ -234,7 +235,7 @@ const AntdTable: FC<ITableProps> = (props) => {
|
|
|
|
|
{
|
|
|
|
|
child.lockStatus !== "UNLOCK" &&
|
|
|
|
|
<UnlockOutlined
|
|
|
|
|
title="点击解锁所有锁定的项目值"
|
|
|
|
|
title={newI18n["点击解锁所有锁定的项目值"]}
|
|
|
|
|
onClick={() => {
|
|
|
|
|
window.parent.postMessage(
|
|
|
|
|
{
|
|
|
|
@ -256,7 +257,7 @@ const AntdTable: FC<ITableProps> = (props) => {
|
|
|
|
|
return <span className={styles.contentSpan}>
|
|
|
|
|
<span title={text} className={styles.contentTitle}>{text}</span>
|
|
|
|
|
{
|
|
|
|
|
child.lockStatus === "LOCK" ? <LockOutlined title="锁定的项目值"/> : null
|
|
|
|
|
child.lockStatus === "LOCK" ? <LockOutlined title={newI18n["锁定的项目值"]}/> : null
|
|
|
|
|
}
|
|
|
|
|
</span>;
|
|
|
|
|
};
|
|
|
|
@ -273,7 +274,7 @@ const AntdTable: FC<ITableProps> = (props) => {
|
|
|
|
|
return result;
|
|
|
|
|
});
|
|
|
|
|
hasOperate && tmpColumns.push({
|
|
|
|
|
title: "操作",
|
|
|
|
|
title: newI18n["操作"],
|
|
|
|
|
key: "cz",
|
|
|
|
|
width: "100px",
|
|
|
|
|
fixed: "right",
|
|
|
|
@ -286,7 +287,7 @@ const AntdTable: FC<ITableProps> = (props) => {
|
|
|
|
|
},
|
|
|
|
|
"*"
|
|
|
|
|
);
|
|
|
|
|
}}>编辑</Button>;
|
|
|
|
|
}}>{newI18n["编辑"]}</Button>;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return tmpColumns;
|
|
|
|
@ -295,8 +296,9 @@ const AntdTable: FC<ITableProps> = (props) => {
|
|
|
|
|
setDataSource([]);
|
|
|
|
|
const data: any = exceptStr(event.data);
|
|
|
|
|
if (!_.isEmpty(data)) {
|
|
|
|
|
const { selectedRowKeys, ...extraData } = data;
|
|
|
|
|
getPCDataList({ ...extraData, ...pageParams });
|
|
|
|
|
const { selectedRowKeys, i18n, ...extraData } = data;
|
|
|
|
|
setI18n(i18n);
|
|
|
|
|
getPCDataList({ ...extraData, ...pageParams, i18n });
|
|
|
|
|
if (selectedRowKeys) setSelected(selectedRowKeys);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -337,7 +339,7 @@ const AntdTable: FC<ITableProps> = (props) => {
|
|
|
|
|
// rowSelection={tab === "PC" && usertab === "SA" ? rowSelection : undefined}
|
|
|
|
|
rowSelection={rowSelection}
|
|
|
|
|
pagination={{
|
|
|
|
|
...paginationFun(pageParams, sizeChange, onChange),
|
|
|
|
|
...paginationFun(pageParams, sizeChange, onChange, i18n),
|
|
|
|
|
size: "default"
|
|
|
|
|
}}
|
|
|
|
|
scroll={{
|
|
|
|
@ -358,10 +360,11 @@ const AntdTable: FC<ITableProps> = (props) => {
|
|
|
|
|
<Table.Summary fixed>
|
|
|
|
|
<Table.Summary.Row>
|
|
|
|
|
{
|
|
|
|
|
_.isEmpty(sumRow) ? <Spin tip="加载中"/> :
|
|
|
|
|
_.isEmpty(sumRow) ? <Spin tip={i18n["加载中"]}/> :
|
|
|
|
|
_.map([{}, ...totalColumns], (item, index) => {
|
|
|
|
|
if (index === 0) {
|
|
|
|
|
return <Table.Summary.Cell index={0} align="center"><Text type="danger">总计</Text></Table.Summary.Cell>;
|
|
|
|
|
return <Table.Summary.Cell index={0} align="center"><Text
|
|
|
|
|
type="danger">{i18n["总计"]}</Text></Table.Summary.Cell>;
|
|
|
|
|
}
|
|
|
|
|
return <Table.Summary.Cell index={index} key={index}>
|
|
|
|
|
<Text type="danger">{sumRow[item.dataIndex] || "-"}</Text>
|
|
|
|
|