Compare commits

...

36 Commits

Author SHA1 Message Date
lys c8fc78ac0f master 2025-10-14 16:39:30 +08:00
lys 7d97bf043c Merge branch 'master' into feature/核算表格双击编辑
# Conflicts:
#	public/css/iconfont/demo_index.html
#	public/css/iconfont/iconfont.css
#	public/css/iconfont/iconfont.js
#	public/css/iconfont/iconfont.json
#	public/css/iconfont/iconfont.ttf
#	public/css/iconfont/iconfont.woff
#	public/css/iconfont/iconfont.woff2
2025-09-16 14:58:27 +08:00
lys 62708e104a feature/业务线管理 2025-07-04 14:59:32 +08:00
lys b200c940e1 Merge branch 'master' into feature/业务线管理 2025-07-03 13:44:20 +08:00
lys b361ad6ce5 Merge branch 'master' into feature/业务线管理 2025-06-19 10:09:21 +08:00
lys d4e797ecd1 Merge branch 'master' into feature/业务线管理 2025-06-19 10:06:14 +08:00
lys 2892f4c6ee feature/业务线管理 2025-06-19 10:04:34 +08:00
lys c3013e2586 Merge branch 'master' into feature/业务线管理 2025-06-19 09:19:51 +08:00
lys e2eb2f97a9 feature/业务线管理 2025-06-19 09:10:07 +08:00
lys 7174baa119 Merge branch 'master' into feature/核算表格双击编辑
# Conflicts:
#	src/pages/calcTable/index.tsx
2025-06-18 13:55:07 +08:00
lys 0f9d4e833c Merge branch 'master' into feature/业务线管理
# Conflicts:
#	src/pages/unitTable/renderColsOpts.tsx
2025-06-12 13:51:32 +08:00
lys ed3e74621a feature/业务线管理 2025-04-25 09:04:51 +08:00
lys a15b0d83f7 Merge branch 'master' into feature/业务线管理 2025-04-24 16:56:06 +08:00
lys e672532907 feature/业务线管理 2025-04-14 16:44:32 +08:00
lys f3be2b68f6 Merge branch 'master' into feature/业务线管理 2025-04-14 16:40:45 +08:00
lys e0c9fcf654 feature/核算表格双击编辑 2025-03-26 17:02:10 +08:00
lys 9e3e4e6546 feature/核算表格双击编辑 2025-03-26 16:17:09 +08:00
lys 78643df60d Merge branch 'master' into feature/业务线管理 2025-03-13 15:12:20 +08:00
lys 8908b23300 feature/业务线管理 2025-02-28 13:38:35 +08:00
lys 4f9bc70fc7 Merge branch 'master' into feature/业务线管理 2025-02-12 15:27:39 +08:00
lys 069131b999 Merge branch 'master' into feature/业务线管理 2025-01-22 11:15:35 +08:00
lys 9702881965 Merge branch 'master' into feature/业务线管理 2024-11-26 14:42:05 +08:00
lys 5f37df75cc feature/业务线管理 2024-11-15 15:49:13 +08:00
lys 7b95a64415 Merge branch 'master' into feature/业务线管理 2024-11-15 15:20:13 +08:00
lys 979a35dc54 Merge branch 'master' into feature/业务线管理 2024-11-04 13:56:24 +08:00
lys 597c00af41 Merge branch 'master' into feature/业务线管理
# Conflicts:
#	src/pages/unitTable/renderColsOpts.tsx
2024-10-30 18:14:28 +08:00
lys 4580128814 Merge branch 'master' into feature/业务线管理 2024-10-23 09:56:59 +08:00
lys c86656f970 Merge branch 'master' into feature/业务线管理 2024-10-22 15:32:47 +08:00
lys d375704faf Merge branch 'master' into feature/业务线管理 2024-10-21 18:13:36 +08:00
lys 78faf02e22 样式修改 2024-10-16 11:21:12 +08:00
lys ee0eaf67ad Merge branch 'master' into feature/业务线管理 2024-10-16 10:14:09 +08:00
黎永顺 d82ca76290 Merge branch 'master' into feature/业务线管理
# Conflicts:
#	src/pages/salaryFileTable/index.tsx
#	src/pages/welfareArchiveTable/index.tsx
2024-10-12 16:12:19 +08:00
黎永顺 3a5e06a6e7 Merge branch 'master' into feature/业务线管理
# Conflicts:
#	src/pages/salaryFileTable/index.tsx
#	src/pages/welfareArchiveTable/index.tsx
2024-09-30 10:25:43 +08:00
黎永顺 b72ccf78d7 Merge branch 'master' into feature/业务线管理 2024-09-27 09:20:31 +08:00
黎永顺 bba707b041 业务线管理 2024-09-26 16:16:01 +08:00
黎永顺 793d7acefb 业务线管理 2024-09-11 10:10:11 +08:00
8 changed files with 456 additions and 289 deletions

View File

@ -268,16 +268,16 @@
background-color: #f7fbfe;
}
.ant-form-item {
margin-bottom: 0;
}
.ant-input-number {
width: 100% !important;
}
th, td {
font-size: var(--data-size);
.ant-form-item {
margin-bottom: 0;
.ant-input-number {
width: 100%;
}
}
}
.ant-typography {

View File

@ -11,8 +11,7 @@ type Props = OwnProps;
const CalcExplainFooter: FunctionComponent<Props> = (props) => {
const { i18n } = props;
return (
<div className={styles["explain-icon-area"]}>
return (<div className={styles["explain-icon-area"]}>
<div className={styles["icon-item"]}>
<Icon type="icon-piliangsuoding" />
<span>{i18n["批量锁定"]}</span>
@ -29,18 +28,19 @@ const CalcExplainFooter: FunctionComponent<Props> = (props) => {
<UnlockOutlined />
<span>{i18n["当前状态未锁定,右击锁定"]}</span>
</div>
{(i18n["反馈信息,右击删除反馈信息"] || i18n["反馈信息,右击设置反馈信息"]) && (
<div className={styles["icon-item"]}>
{(i18n["反馈信息,右击删除反馈信息"] || i18n["反馈信息,右击设置反馈信息"]) && (<div className={styles["icon-item"]}>
<QuestionCircleOutlined />
<span>{i18n["反馈信息,右击删除反馈信息"] || i18n["反馈信息,右击设置反馈信息"]}</span>
</div>
)}
</div>)}
<div className={styles["icon-item"]}>
<Icon type="icon-pilianggengxin" />
<span>{i18n["批量更新"]}</span>
</div>
</div>
);
<div className={styles["icon-item"]}>
<Icon type="icon-shuangji" />
<span>{i18n["双击单元格更新"]}</span>
</div>
</div>);
};
export default CalcExplainFooter;

View File

@ -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>

View File

@ -4,26 +4,40 @@
* Description:
* Date: 2023/9/14
*/
import React, { FunctionComponent, useEffect, useState } from "react";
import type { MenuProps } from "antd";
import { Button, Dropdown, Space, Table, Tooltip, Typography } from "antd";
import React, { FunctionComponent, useContext, useEffect, useMemo, useRef, useState } from "react";
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";
import CalcExplainFooter from "@/pages/calcTable/calcExplainFooter";
import CaclFixedTotal from "./calcFixedTotal";
import type { ColumnType } from "antd/lib/table";
import type { PaginationData } from "rc-pagination";
import { exceptStr, paginationFun } from "@/utils/common";
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 {}
interface EditableRowProps {}
interface EditableCellProps {
editCell?: any;
children?: React.ReactNode;
record?: any;
pattern?: number;
rowIndex?: number;
dataIndex?: any;
handleSave?: (type: string, record: any) => void;
}
type Props = OwnProps;
type fixedProps = boolean | "top" | "bottom";
const { Text } = Typography;
const index: FunctionComponent<Props> = (props) => {
const EditableContext = React.createContext<FormInstance<any> | null>(null);
const Index: FunctionComponent<Props> = (props) => {
const [columns, setColumns] = useState<ColumnType<any>[]>([]);
const [dataSource, setDataSource] = useState<any[]>([]);
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
@ -36,7 +50,11 @@ const index: FunctionComponent<Props> = (props) => {
const [tableScrollHeight, setTableScrollHeight] = useState<Number>(0);
const [payload, setPayload] = useState<string>("");
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();
useEffect(() => {
window.parent.postMessage({ type: "init" }, "*");
@ -62,7 +80,8 @@ const index: FunctionComponent<Props> = (props) => {
fixed = true,
tableScrollHeight,
sumRow,
optWidth
optWidth,
mzgOptPermission = false
} = data;
setSumRowlistUrl(sumRowlistUrl);
setShowTotalCell(showTotalCell);
@ -74,8 +93,10 @@ const index: FunctionComponent<Props> = (props) => {
setSumRow(sumRow);
setPageInfo(pageInfo);
setDataSource(dataSource);
setOptWidth(optWidth);
setSelectedRowKeys([...selectedRowKeys, ...rowKeys]);
setTableScrollHeight(tableScrollHeight);
setMzgOptPermission(mzgOptPermission);
setColumns([
...convertColumns(_.map(columns, (o) => ({ ...o, i18n: i18nRes }))),
{
@ -124,7 +145,17 @@ const index: FunctionComponent<Props> = (props) => {
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,
@ -132,11 +163,21 @@ const index: FunctionComponent<Props> = (props) => {
children: convertColumns(_.map(item.children, (o) => ({ ...o, i18n: item.i18n }))),
className: styles["td_odd"],
i18n: item.i18n,
onCell: (record: any) => ({
onCell: (record: any, rowIndex: number) => ({
className: !_.isEmpty(record[`${item.dataIndex}_feedback`]) && styles["feedbackBg"],
editCell,
record,
rowIndex,
pattern: item.pattern,
dataIndex: item.dataIndex,
onContextMenu: (e: any) => {
(!item.calcDetail || item.rightClickType) && e.preventDefault();
}
},
onDoubleClick: (e: any) => {
e.preventDefault();
!item.calcDetail || item.rightClickType ? setEditCell({ dataIndex: item?.dataIndex, rowIndex }) : null;
},
handleSave
}),
render: (text: string, record: any) => {
let items: MenuProps["items"] = !item.calcDetail
@ -195,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}>
@ -202,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 />
@ -215,6 +289,10 @@ const index: FunctionComponent<Props> = (props) => {
}
});
};
const handleSave = (salaryItemId: string, row: any) => {
const params = { salaryItemId, idList: [row?.id], value: row[salaryItemId] };
window.parent.postMessage({ type: "turn", payload: { id: "EDITCELL", params } }, "*");
};
const handleFormulaTd = (dataIndex: string) => {
window.parent.postMessage({ type: "turn", payload: { id: "FORMULA", params: { dataIndex } } }, "*");
};
@ -231,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(() => {
@ -240,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[]) => {
@ -255,44 +353,104 @@ const index: FunctionComponent<Props> = (props) => {
);
}
};
const components = {
body: {
row: EditableRow,
cell: EditableCell
}
};
return (
<Table
rowKey="id"
size="small"
bordered
className={styles.tableWrapper}
dataSource={dataSource}
rowSelection={rowSelection}
scroll={{
x: 1200,
y: `calc(100vh - ${tableScrollHeight || (!showTotalCell ? 165 : 200)}px)`
}}
columns={!isDetailTable || showSee ? columns : _.filter(columns, (o) => o.dataIndex !== "operate")}
footer={() => (!isDetailTable ? <CalcExplainFooter i18n={i18n} /> : null)}
pagination={
!_.isNil(pageInfo)
? {
...paginationFun(pageInfo, sizeChange, onChange, i18n),
size: "default"
}
: false
}
summary={() =>
!showTotalCell ? (
<></>
) : (
<Table.Summary fixed={fixed}>
<Table.Summary.Row>
<Table.Summary.Cell index={0} align="center">
<Text type="danger">{i18n["总计"]}</Text>
</Table.Summary.Cell>
<CaclFixedTotal columns={columns} dataSourceUrl={sumRowlistUrl} payload={payload} sumRow={sumRow} />
</Table.Summary.Row>
</Table.Summary>
)
}
/>
<Form form={form} component={false}>
<Table
rowKey="id"
size="small"
bordered
className={styles.tableWrapper}
dataSource={dataSource}
rowSelection={rowSelection}
components={components}
scroll={{
x: 1200,
y: `calc(100vh - ${tableScrollHeight || (!showTotalCell ? 165 : 200)}px)`
}}
columns={(!isDetailTable || showSee) && !mzgOptPermission ? columns : _.filter(columns, (o) => o.dataIndex !== "operate")}
footer={() => (!isDetailTable ? <CalcExplainFooter i18n={i18n} /> : null)}
pagination={
!_.isNil(pageInfo)
? {
...paginationFun(pageInfo, sizeChange, onChange, i18n),
size: "default"
}
: false
}
summary={() =>
!showTotalCell ? (
<></>
) : (
<Table.Summary fixed={fixed}>
<Table.Summary.Row>
<Table.Summary.Cell index={0} align="center">
<Text type="danger">{i18n["总计"]}</Text>
</Table.Summary.Cell>
<CaclFixedTotal columns={columns} dataSourceUrl={sumRowlistUrl} payload={payload} sumRow={sumRow} />
</Table.Summary.Row>
</Table.Summary>
)
}
/>
</Form>
);
};
export default index;
export default Index;
const EditableRow: React.FC<EditableRowProps> = (props) => {
const [form] = Form.useForm();
return (
<Form form={form} component={false}>
<EditableContext.Provider value={form}>
<tr {...props} />
</EditableContext.Provider>
</Form>
);
};
const EditableCell: React.FC<EditableCellProps> = (props) => {
const { children, editCell, record, dataIndex, rowIndex, handleSave, ...restProps } = props;
const form = useContext(EditableContext)!;
const inputRef = useRef<any>(null);
useEffect(() => {
if (dataIndex && editCell && editCell.dataIndex === dataIndex && editCell.rowIndex === rowIndex) {
toggleEdit();
inputRef.current!.focus();
}
}, [editCell, dataIndex, rowIndex]);
const toggleEdit = () => {
form.setFieldsValue({ [dataIndex]: record[dataIndex] });
};
const onSave = _.debounce(async (e) => {
try {
let values = await form.validateFields();
if (record[`${_.keys(values)[0]}_type`] === "number") {
values = {
...values,
[_.keys(values)[0]]: !!_.get(values, _.keys(values)[0]) || _.get(values, _.keys(values)[0]) === 0 ? toDecimal_n(_.get(values, _.keys(values)[0]), restProps?.pattern) : ""
};
}
handleSave?.(_.keys(values)[0], { ...record, ...values });
} catch (errInfo) {
console.log("Save failed:", errInfo);
}
}, 200);
let childNode =
dataIndex && editCell && editCell.dataIndex === dataIndex && editCell.rowIndex === rowIndex ? (
<Form.Item style={{ margin: 0 }} name={dataIndex}>
{record[`${dataIndex}_type`] === "number" ? (
<InputNumber ref={inputRef} onPressEnter={onSave} onBlur={onSave} precision={restProps?.pattern} />
) : (
<Input value={record[dataIndex]} onPressEnter={onSave} onBlur={onSave} ref={inputRef} />
)}
</Form.Item>
) : (
<>{children}</>
);
return <td {...restProps}>{childNode}</td>;
};

View File

@ -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}

View File

@ -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;

View File

@ -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>

View File

@ -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" }}
/>);
};