master
This commit is contained in:
commit
c8fc78ac0f
|
|
@ -17,13 +17,14 @@ interface OwnProps {
|
|||
i18n?: any;
|
||||
pattern?: number;
|
||||
calcDetail?: boolean; //查看详情页面
|
||||
mzgOptPermission?: boolean; //二开美之高操作权限
|
||||
children?: any;
|
||||
}
|
||||
|
||||
type Props = OwnProps;
|
||||
|
||||
const customTableTitle: FunctionComponent<Props> = (props) => {
|
||||
const { dataIndex, title, onHandleFormulatd, i18n = {}, pattern, dataType, calcDetail, children } = props;
|
||||
const { dataIndex, title, onHandleFormulatd, i18n = {}, pattern, dataType, calcDetail, children, mzgOptPermission } = props;
|
||||
const handleToggleSalaryItemVal = (salaryItemId: string, type: string, updateParams: any = {}) => {
|
||||
window.parent.postMessage({ type: "turn", payload: { id: "LOCKING", params: { lockType: type, salaryItemId, ...updateParams } } }, "*");
|
||||
};
|
||||
|
|
@ -37,7 +38,9 @@ const customTableTitle: FunctionComponent<Props> = (props) => {
|
|||
<div className={styles["toogle-lock-tool"]}>
|
||||
<Icon type="icon-piliangsuoding" title={i18n["点击锁定所有解锁的项目值"]} onClick={() => handleToggleSalaryItemVal(dataIndex as string, "LOCK")} />
|
||||
<Icon type="icon-piliangjiesuo" title={i18n["点击解锁所有锁定的项目值"]} onClick={() => handleToggleSalaryItemVal(dataIndex as string, "UNLOCK")} />
|
||||
<Icon type="icon-pilianggengxin" title={i18n["批量更新"]} onClick={() => handleToggleSalaryItemVal(dataIndex as string, "BATCHUPDATE", { pattern, salaryItemName: title, dataType })} />
|
||||
{!mzgOptPermission && (
|
||||
<Icon type="icon-pilianggengxin" title={i18n["批量更新"]} onClick={() => handleToggleSalaryItemVal(dataIndex as string, "BATCHUPDATE", { pattern, salaryItemName: title, dataType })} />
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* Date: 2023/9/14
|
||||
*/
|
||||
import React, { FunctionComponent, useContext, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { Button, Dropdown, Form, Input, InputNumber, MenuProps, Space, Table, Tooltip, Typography } from "antd";
|
||||
import { Button, Checkbox, Dropdown, Form, Input, InputNumber, MenuProps, Space, Table, Tooltip, Typography } from "antd";
|
||||
import { DeleteOutlined, LockOutlined, QuestionCircleOutlined, SettingOutlined, UnlockOutlined } from "@ant-design/icons";
|
||||
import type { FormInstance } from "antd/es/form";
|
||||
import CustomTableTitle from "@/pages/calcTable/customTableTitle";
|
||||
|
|
@ -15,6 +15,7 @@ import type { ColumnType } from "antd/lib/table";
|
|||
import type { PaginationData } from "rc-pagination";
|
||||
import { exceptStr, paginationFun, toDecimal_n } from "@/utils/common";
|
||||
import { IPage } from "@/common/types";
|
||||
import Icon from "../../lib/CustomIcon";
|
||||
import styles from "@/pages/atdTable/components/index.less";
|
||||
|
||||
interface OwnProps {}
|
||||
|
|
@ -51,6 +52,7 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
const [fixed, setFixed] = useState<fixedProps>(true);
|
||||
const [optWidth, setOptWidth] = useState<number>(120); //操作列宽度
|
||||
const [sumRow, setSumRow] = useState<Partial<{}>>({}); //总计行数据
|
||||
const [mzgOptPermission, setMzgOptPermission] = useState<boolean>(false); //美之高操作权限 false 默认可以编辑,true不可编辑
|
||||
const [editCell, setEditCell] = useState<any>({}); //编辑行key
|
||||
const [form] = Form.useForm();
|
||||
|
||||
|
|
@ -78,7 +80,8 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
fixed = true,
|
||||
tableScrollHeight,
|
||||
sumRow,
|
||||
optWidth
|
||||
optWidth,
|
||||
mzgOptPermission = false
|
||||
} = data;
|
||||
setSumRowlistUrl(sumRowlistUrl);
|
||||
setShowTotalCell(showTotalCell);
|
||||
|
|
@ -93,14 +96,66 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
setOptWidth(optWidth);
|
||||
setSelectedRowKeys([...selectedRowKeys, ...rowKeys]);
|
||||
setTableScrollHeight(tableScrollHeight);
|
||||
setColumns(_.map(columns, (o) => ({ ...o, i18n: i18nRes })));
|
||||
setEditCell({});
|
||||
setMzgOptPermission(mzgOptPermission);
|
||||
setColumns([
|
||||
...convertColumns(_.map(columns, (o) => ({ ...o, i18n: i18nRes }))),
|
||||
{
|
||||
title: i18nRes["操作"],
|
||||
dataIndex: "operate",
|
||||
fixed: "right",
|
||||
width: optWidth || 120,
|
||||
render: (__, record) => (
|
||||
<Space>
|
||||
<Button type="link" onClick={() => handleEdit(record?.id, showSee)}>
|
||||
{showSee ? i18nRes["查看"] : i18nRes["编辑"]}
|
||||
</Button>
|
||||
{optWidth && (
|
||||
<>
|
||||
<Button
|
||||
type="link"
|
||||
onClick={() =>
|
||||
handleLockEmp({
|
||||
lockStatus: "LOCK",
|
||||
acctEmpIds: [record?.id]
|
||||
})
|
||||
}
|
||||
>
|
||||
{i18nRes["锁定"]}
|
||||
</Button>
|
||||
<Button
|
||||
type="link"
|
||||
onClick={() =>
|
||||
handleLockEmp({
|
||||
lockStatus: "UNLOCK",
|
||||
acctEmpIds: [record?.id]
|
||||
})
|
||||
}
|
||||
>
|
||||
{i18nRes["解锁"]}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
{record?.lockTime && <Text>{record?.lockTime}</Text>}
|
||||
</Space>
|
||||
)
|
||||
}
|
||||
]);
|
||||
}
|
||||
};
|
||||
const convertColumns: any = (cols: any[]) => {
|
||||
return _.map(cols, (item) => {
|
||||
if (_.isNaN(parseInt(item.dataIndex))) {
|
||||
return { ...item };
|
||||
// 医博肛肠二开
|
||||
if (item.dataIndex === "ybgc-custom") {
|
||||
return {
|
||||
...item,
|
||||
render: (text: string, record: any) => {
|
||||
return <Checkbox checked={record?.calculateStatus === "1"} onChange={(e) => handlePassed(record, e.target.checked)} />;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
return { ...item };
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
...item,
|
||||
|
|
@ -181,6 +236,38 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
})
|
||||
}
|
||||
]);
|
||||
item.rightClickType &&
|
||||
item.rightClickType.includes("MARK") &&
|
||||
(items = [
|
||||
...items,
|
||||
{
|
||||
label: item.i18n["标记"],
|
||||
key: "MARK",
|
||||
icon: <Icon type="icon-biaoji" />,
|
||||
onClick: () =>
|
||||
handleSetMark({
|
||||
lockStatus: "LOCK",
|
||||
acctEmpId: record?.id,
|
||||
salaryItemId: item?.dataIndex
|
||||
})
|
||||
}
|
||||
]);
|
||||
item.rightClickType &&
|
||||
item.rightClickType.includes("UNMARK") &&
|
||||
(items = [
|
||||
...items,
|
||||
{
|
||||
label: item.i18n["取消标记"],
|
||||
key: "UNMARK",
|
||||
icon: <Icon type="icon-quxiaobiaoji" />,
|
||||
onClick: () =>
|
||||
handleSetUnMark({
|
||||
lockStatus: "UNLOCK",
|
||||
acctEmpId: record?.id,
|
||||
salaryItemId: item?.dataIndex
|
||||
})
|
||||
}
|
||||
]);
|
||||
return (
|
||||
<Dropdown menu={{ items: !item.calcDetail || item.rightClickType ? items : [] }} trigger={["contextMenu"]} overlayClassName={styles.contextMenu} destroyPopupOnHide>
|
||||
<span className={styles.contentSpan}>
|
||||
|
|
@ -188,6 +275,7 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
{text}
|
||||
</span>
|
||||
{record.lockItems && record.lockItems.includes(item.dataIndex) ? <LockOutlined title={item.i18n["锁定的项目值"]} /> : null}
|
||||
{record.markItems && record.markItems.includes(item.dataIndex) ? <Icon type="icon-biaoji-copy" title={item.i18n["标记的项目值"]} style={{ marginLeft: 4 }} /> : null}
|
||||
{!_.isEmpty(record[`${item.dataIndex}_feedback`]) ? (
|
||||
<Tooltip title={record[`${item.dataIndex}_feedback`]}>
|
||||
<QuestionCircleOutlined />
|
||||
|
|
@ -221,6 +309,26 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
const handleSetFeedback = (params: any) => {
|
||||
window.parent.postMessage({ type: "turn", payload: { id: "SETFEEDBACK", params } }, "*");
|
||||
};
|
||||
// 安徽国元信托有限责任公司薪酬二开-薪资核算项添加右击添加标记和取消标记的操作
|
||||
const handleSetMark = (params: any) => {
|
||||
window.parent.postMessage({ type: "turn", payload: { id: "MARK", params } }, "*");
|
||||
};
|
||||
const handleSetUnMark = (params: any) => {
|
||||
window.parent.postMessage({ type: "turn", payload: { id: "UNMARK", params } }, "*");
|
||||
};
|
||||
// 医博二开
|
||||
const handlePassed = (params: any, calculateStatus: boolean) => {
|
||||
setDataSource((pre) => {
|
||||
pre = _.map(pre, (o) => {
|
||||
if (o.id === params.id) {
|
||||
return { ...o, calculateStatus: calculateStatus ? "1" : "0" };
|
||||
}
|
||||
return o;
|
||||
});
|
||||
return pre;
|
||||
});
|
||||
window.parent.postMessage({ type: "turn", payload: { id: "CUSTPASSED", params: { ...params, calculateStatus: calculateStatus ? "1" : "0" } } }, "*");
|
||||
};
|
||||
const sizeChange = (pageobj: IPage) => {};
|
||||
const onChange = (pageobj: IPage) => {
|
||||
setPageInfo(() => {
|
||||
|
|
@ -230,8 +338,8 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
};
|
||||
const rowSelection = {
|
||||
columnWidth: 50,
|
||||
columnTitle: isDetailTable && _.isNil(showSee) ? "序号" : "",
|
||||
renderCell: (value: boolean, record: any, index: number, originNode: React.ReactNode) => (isDetailTable && _.isNil(showSee) ? <span>{index + 1}</span> : originNode),
|
||||
columnTitle: isDetailTable && !showSee ? "序号" : "",
|
||||
renderCell: (value: boolean, record: any, index: number, originNode: React.ReactNode) => (isDetailTable && !showSee ? <span>{index + 1}</span> : originNode),
|
||||
selectedRowKeys,
|
||||
preserveSelectedRowKeys: true,
|
||||
onChange: (rowKeys: React.Key[]) => {
|
||||
|
|
@ -245,51 +353,6 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
);
|
||||
}
|
||||
};
|
||||
const cols = useMemo(() => {
|
||||
return [
|
||||
...convertColumns(columns),
|
||||
{
|
||||
title: i18n["操作"],
|
||||
dataIndex: "operate",
|
||||
fixed: "right",
|
||||
width: optWidth || 120,
|
||||
render: (__: any, record: any) => (
|
||||
<Space>
|
||||
<Button type="link" onClick={() => handleEdit(record?.id, showSee)}>
|
||||
{showSee ? i18n["查看"] : i18n["编辑"]}
|
||||
</Button>
|
||||
{optWidth && (
|
||||
<>
|
||||
<Button
|
||||
type="link"
|
||||
onClick={() =>
|
||||
handleLockEmp({
|
||||
lockStatus: "LOCK",
|
||||
acctEmpIds: [record?.id]
|
||||
})
|
||||
}
|
||||
>
|
||||
{i18n["锁定"]}
|
||||
</Button>
|
||||
<Button
|
||||
type="link"
|
||||
onClick={() =>
|
||||
handleLockEmp({
|
||||
lockStatus: "UNLOCK",
|
||||
acctEmpIds: [record?.id]
|
||||
})
|
||||
}
|
||||
>
|
||||
{i18n["解锁"]}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
{record?.lockTime && <Text>{record?.lockTime}</Text>}
|
||||
</Space>
|
||||
)
|
||||
}
|
||||
];
|
||||
}, [columns, editCell, i18n]);
|
||||
const components = {
|
||||
body: {
|
||||
row: EditableRow,
|
||||
|
|
@ -310,7 +373,7 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
x: 1200,
|
||||
y: `calc(100vh - ${tableScrollHeight || (!showTotalCell ? 165 : 200)}px)`
|
||||
}}
|
||||
columns={!isDetailTable || showSee ? cols : _.filter(cols, (o) => o.dataIndex !== "operate")}
|
||||
columns={(!isDetailTable || showSee) && !mzgOptPermission ? columns : _.filter(columns, (o) => o.dataIndex !== "operate")}
|
||||
footer={() => (!isDetailTable ? <CalcExplainFooter i18n={i18n} /> : null)}
|
||||
pagination={
|
||||
!_.isNil(pageInfo)
|
||||
|
|
@ -329,7 +392,7 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
<Table.Summary.Cell index={0} align="center">
|
||||
<Text type="danger">{i18n["总计"]}</Text>
|
||||
</Table.Summary.Cell>
|
||||
<CaclFixedTotal columns={cols} dataSourceUrl={sumRowlistUrl} payload={payload} sumRow={sumRow} />
|
||||
<CaclFixedTotal columns={columns} dataSourceUrl={sumRowlistUrl} payload={payload} sumRow={sumRow} />
|
||||
</Table.Summary.Row>
|
||||
</Table.Summary>
|
||||
)
|
||||
|
|
@ -390,4 +453,4 @@ const EditableCell: React.FC<EditableCellProps> = (props) => {
|
|||
<>{children}</>
|
||||
);
|
||||
return <td {...restProps}>{childNode}</td>;
|
||||
};
|
||||
};
|
||||
|
|
@ -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>
|
||||
}
|
||||
<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>);
|
||||
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>
|
||||
<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,18 +148,27 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
}
|
||||
];
|
||||
return (
|
||||
<Space>
|
||||
{
|
||||
(((_.isNil(DCChiefPermission) || DCChiefPermission) && runStatuses === "fixed") || runStatuses === "ext") ?
|
||||
<Button type="link"
|
||||
onClick={() => handleSalaryFileOperate("CHANGE-SALARY", record)}>{i18n["调薪"]}</Button> :
|
||||
<Button type="link"
|
||||
onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
|
||||
}
|
||||
<Dropdown menu={{ items }} placement="bottomRight">
|
||||
<Button type="link" icon={<MoreOutlined/>}/>
|
||||
</Dropdown>
|
||||
</Space>
|
||||
record?.opts.includes("admin") ?
|
||||
<Space>
|
||||
<Button type="link"
|
||||
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)
|
||||
}
|
||||
]
|
||||
}} placement="bottomRight">
|
||||
<Button type="link" icon={<MoreOutlined/>}/>
|
||||
</Dropdown>
|
||||
</Space>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
|
@ -174,14 +189,30 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
onClick: () => handleSalaryFileOperate("log", record)
|
||||
}
|
||||
];
|
||||
return (<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>);
|
||||
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>
|
||||
<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,54 +221,56 @@ 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>
|
||||
<Button type="link" onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
|
||||
<Button type="link"
|
||||
onClick={() => handleSalaryFileOperate("CANCEL-SALARY-SUSPENSION", record, [record?.id])}>{i18n["取消停薪"]}</Button>
|
||||
{
|
||||
!_.isEmpty(stopItems) &&
|
||||
<Dropdown menu={{ items: stopItems }} placement="bottomRight">
|
||||
<Button type="link" icon={<MoreOutlined/>}/>
|
||||
</Dropdown>
|
||||
}
|
||||
</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>
|
||||
{
|
||||
!_.isEmpty(stopItems) &&
|
||||
<Dropdown menu={{ items: stopItems }} 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)
|
||||
}
|
||||
]
|
||||
}} 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,134 +22,108 @@ 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 { dataIndex } = item;
|
||||
if (dataIndex === "employeeId") {
|
||||
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>
|
||||
};
|
||||
}
|
||||
return {
|
||||
title: "姓名", dataIndex, fixed: "left", width: 150,
|
||||
render: (_: any, record: Partial<any>) => (
|
||||
<span>{record?.userName}</span>
|
||||
)
|
||||
dataIndex,
|
||||
width: 150,
|
||||
title: <span dangerouslySetInnerHTML={{ __html: item.title }} />
|
||||
};
|
||||
}
|
||||
return {
|
||||
dataIndex, width: 150,
|
||||
title: <span dangerouslySetInnerHTML={{ __html: item.title }}/>
|
||||
};
|
||||
});
|
||||
);
|
||||
setDataSource(dataSource);
|
||||
setColumns(
|
||||
!showOperates ? conventColumns :
|
||||
[
|
||||
...conventColumns,
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: "operate",
|
||||
fixed: "right",
|
||||
width: 120,
|
||||
render: (_: any, record: any) => {
|
||||
return (
|
||||
<Button type="link" onClick={() => handleEdit(record)}>编辑</Button>
|
||||
);
|
||||
!showOperates
|
||||
? conventColumns
|
||||
: [
|
||||
...conventColumns,
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: "operate",
|
||||
fixed: "right",
|
||||
width: 120,
|
||||
render: (_: any, record: any) => {
|
||||
return (
|
||||
<Button type="link" onClick={() => handleEdit(record)}>
|
||||
编辑
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
);
|
||||
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
|
||||
rowKey="id"
|
||||
className={styles.tableWrapper}
|
||||
columns={columns}
|
||||
dataSource={dataSource}
|
||||
size="small"
|
||||
rowSelection={rowSelection}
|
||||
pagination={{
|
||||
...paginationFun(pageInfo, sizeChange, onChange),
|
||||
size: "default"
|
||||
}}
|
||||
scroll={{ x: 1200, y: `calc(100vh - 172px)` }}
|
||||
summary={() => {
|
||||
if (_.isEmpty(columns) || !showSumrow) return;
|
||||
return (
|
||||
<Table.Summary fixed>
|
||||
<Table.Summary.Row>
|
||||
{
|
||||
_.isEmpty(sumRow) ? <Spin tip="加载中"/> :
|
||||
_.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={index} key={index}>
|
||||
return (
|
||||
<Table
|
||||
rowKey="id"
|
||||
className={styles.tableWrapper}
|
||||
columns={columns}
|
||||
dataSource={dataSource}
|
||||
size="small"
|
||||
rowSelection={rowSelection}
|
||||
pagination={{
|
||||
...paginationFun(pageInfo, sizeChange, onChange),
|
||||
size: "default"
|
||||
}}
|
||||
scroll={{ x: 1200, y: `calc(100vh - 172px)` }}
|
||||
summary={() => {
|
||||
if (_.isEmpty(sumRow)) return;
|
||||
return (
|
||||
<Table.Summary fixed>
|
||||
<Table.Summary.Row>
|
||||
{_.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={index} key={index}>
|
||||
<Text type="danger">{!_.isNil(sumRow[item.dataIndex]) ? sumRow[item.dataIndex] : "-"}</Text>
|
||||
</Table.Summary.Cell>;
|
||||
})
|
||||
}
|
||||
</Table.Summary.Row>
|
||||
</Table.Summary>
|
||||
);
|
||||
}}
|
||||
/>;
|
||||
</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?.["查看"]}
|
||||
|
|
@ -359,12 +359,20 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject,
|
|||
render: (__: string, record: any) => {
|
||||
return (
|
||||
<Space>
|
||||
<Button type="link" onClick={() => postMessageToParent("EDIT", record)}>
|
||||
{i18n?.["编辑"]}
|
||||
</Button>
|
||||
<Button type="link" onClick={() => postMessageToParent("DEL", record)}>
|
||||
{i18n?.["删除"]}
|
||||
</Button>
|
||||
{record?.opts.includes("admin") ? (
|
||||
<Space>
|
||||
<Button type="link" onClick={() => postMessageToParent("EDIT", record)}>
|
||||
{i18n?.["编辑"]}
|
||||
</Button>
|
||||
<Button type="link" onClick={() => postMessageToParent("DEL", record)}>
|
||||
{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>
|
||||
<Button type="link" onClick={() => postMessageToParent("EDIT", record)}>
|
||||
{i18n?.["编辑"]}
|
||||
</Button>
|
||||
{isSpecial ? (
|
||||
{record?.opts.includes("admin") && (
|
||||
<Button type="link" onClick={() => postMessageToParent("EDIT", record)}>
|
||||
{i18n?.["编辑"]}
|
||||
</Button>
|
||||
)}
|
||||
{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>
|
||||
<Button type="link" onClick={() => handleWelfareOperate("EDIT", record)}>{i18n["编辑"]}</Button>
|
||||
<Dropdown menu={{ items }} placement="bottomRight">
|
||||
<Button type="link" icon={<MoreOutlined/>}/>
|
||||
</Dropdown>
|
||||
</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> : 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…
Reference in New Issue