Compare commits
45 Commits
e0c9fcf654
...
c8fc78ac0f
| Author | SHA1 | Date |
|---|---|---|
|
|
c8fc78ac0f | |
|
|
7d97bf043c | |
|
|
4ac19f78fd | |
|
|
49634c9285 | |
|
|
62708e104a | |
|
|
b200c940e1 | |
|
|
d607c2abcf | |
|
|
b361ad6ce5 | |
|
|
e35f1999fb | |
|
|
d4e797ecd1 | |
|
|
0f1f099144 | |
|
|
2892f4c6ee | |
|
|
c3013e2586 | |
|
|
eb126006a1 | |
|
|
e2eb2f97a9 | |
|
|
7174baa119 | |
|
|
0f9d4e833c | |
|
|
2be569f8eb | |
|
|
57811df6e2 | |
|
|
f46a01daf2 | |
|
|
ed3e74621a | |
|
|
a15b0d83f7 | |
|
|
45862052c7 | |
|
|
e672532907 | |
|
|
f3be2b68f6 | |
|
|
4e231ec401 | |
|
|
78643df60d | |
|
|
8908b23300 | |
|
|
4f9bc70fc7 | |
|
|
069131b999 | |
|
|
9702881965 | |
|
|
5f37df75cc | |
|
|
7b95a64415 | |
|
|
979a35dc54 | |
|
|
597c00af41 | |
|
|
4580128814 | |
|
|
c86656f970 | |
|
|
d375704faf | |
|
|
78faf02e22 | |
|
|
ee0eaf67ad | |
|
|
d82ca76290 | |
|
|
3a5e06a6e7 | |
|
|
b72ccf78d7 | |
|
|
bba707b041 | |
|
|
793d7acefb |
|
|
@ -54,6 +54,24 @@
|
|||
<div class="content unicode" style="display: block;">
|
||||
<ul class="icon_lists dib-box">
|
||||
|
||||
<li class="dib">
|
||||
<span class="icon iconfont"></span>
|
||||
<div class="name">标记-copy</div>
|
||||
<div class="code-name">&#xe78c;</div>
|
||||
</li>
|
||||
|
||||
<li class="dib">
|
||||
<span class="icon iconfont"></span>
|
||||
<div class="name">标记</div>
|
||||
<div class="code-name">&#xe604;</div>
|
||||
</li>
|
||||
|
||||
<li class="dib">
|
||||
<span class="icon iconfont"></span>
|
||||
<div class="name">取消标记</div>
|
||||
<div class="code-name">&#xe710;</div>
|
||||
</li>
|
||||
|
||||
<li class="dib">
|
||||
<span class="icon iconfont"></span>
|
||||
<div class="name">双击</div>
|
||||
|
|
@ -210,9 +228,9 @@
|
|||
<pre><code class="language-css"
|
||||
>@font-face {
|
||||
font-family: 'iconfont';
|
||||
src: url('iconfont.woff2?t=1742897212506') format('woff2'),
|
||||
url('iconfont.woff?t=1742897212506') format('woff'),
|
||||
url('iconfont.ttf?t=1742897212506') format('truetype');
|
||||
src: url('iconfont.woff2?t=1750298885691') format('woff2'),
|
||||
url('iconfont.woff?t=1750298885691') format('woff'),
|
||||
url('iconfont.ttf?t=1750298885691') format('truetype');
|
||||
}
|
||||
</code></pre>
|
||||
<h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
|
||||
|
|
@ -238,6 +256,33 @@
|
|||
<div class="content font-class">
|
||||
<ul class="icon_lists dib-box">
|
||||
|
||||
<li class="dib">
|
||||
<span class="icon iconfont icon-biaoji-copy"></span>
|
||||
<div class="name">
|
||||
标记-copy
|
||||
</div>
|
||||
<div class="code-name">.icon-biaoji-copy
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="dib">
|
||||
<span class="icon iconfont icon-biaoji"></span>
|
||||
<div class="name">
|
||||
标记
|
||||
</div>
|
||||
<div class="code-name">.icon-biaoji
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="dib">
|
||||
<span class="icon iconfont icon-quxiaobiaoji"></span>
|
||||
<div class="name">
|
||||
取消标记
|
||||
</div>
|
||||
<div class="code-name">.icon-quxiaobiaoji
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="dib">
|
||||
<span class="icon iconfont icon-shuangji"></span>
|
||||
<div class="name">
|
||||
|
|
@ -472,6 +517,30 @@
|
|||
<div class="content symbol">
|
||||
<ul class="icon_lists dib-box">
|
||||
|
||||
<li class="dib">
|
||||
<svg class="icon svg-icon" aria-hidden="true">
|
||||
<use xlink:href="#icon-biaoji-copy"></use>
|
||||
</svg>
|
||||
<div class="name">标记-copy</div>
|
||||
<div class="code-name">#icon-biaoji-copy</div>
|
||||
</li>
|
||||
|
||||
<li class="dib">
|
||||
<svg class="icon svg-icon" aria-hidden="true">
|
||||
<use xlink:href="#icon-biaoji"></use>
|
||||
</svg>
|
||||
<div class="name">标记</div>
|
||||
<div class="code-name">#icon-biaoji</div>
|
||||
</li>
|
||||
|
||||
<li class="dib">
|
||||
<svg class="icon svg-icon" aria-hidden="true">
|
||||
<use xlink:href="#icon-quxiaobiaoji"></use>
|
||||
</svg>
|
||||
<div class="name">取消标记</div>
|
||||
<div class="code-name">#icon-quxiaobiaoji</div>
|
||||
</li>
|
||||
|
||||
<li class="dib">
|
||||
<svg class="icon svg-icon" aria-hidden="true">
|
||||
<use xlink:href="#icon-shuangji"></use>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
@font-face {
|
||||
font-family: "iconfont"; /* Project id 4257468 */
|
||||
src: url('iconfont.woff2?t=1742897212506') format('woff2'),
|
||||
url('iconfont.woff?t=1742897212506') format('woff'),
|
||||
url('iconfont.ttf?t=1742897212506') format('truetype');
|
||||
src: url('iconfont.woff2?t=1750298885691') format('woff2'),
|
||||
url('iconfont.woff?t=1750298885691') format('woff'),
|
||||
url('iconfont.ttf?t=1750298885691') format('truetype');
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
|
|
@ -13,6 +13,18 @@
|
|||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.icon-biaoji-copy:before {
|
||||
content: "\e78c";
|
||||
}
|
||||
|
||||
.icon-biaoji:before {
|
||||
content: "\e604";
|
||||
}
|
||||
|
||||
.icon-quxiaobiaoji:before {
|
||||
content: "\e710";
|
||||
}
|
||||
|
||||
.icon-shuangji:before {
|
||||
content: "\e6f0";
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -5,6 +5,27 @@
|
|||
"css_prefix_text": "icon-",
|
||||
"description": "",
|
||||
"glyphs": [
|
||||
{
|
||||
"icon_id": "44653522",
|
||||
"name": "标记-copy",
|
||||
"font_class": "biaoji-copy",
|
||||
"unicode": "e78c",
|
||||
"unicode_decimal": 59276
|
||||
},
|
||||
{
|
||||
"icon_id": "14559255",
|
||||
"name": "标记",
|
||||
"font_class": "biaoji",
|
||||
"unicode": "e604",
|
||||
"unicode_decimal": 58884
|
||||
},
|
||||
{
|
||||
"icon_id": "33872224",
|
||||
"name": "取消标记",
|
||||
"font_class": "quxiaobiaoji",
|
||||
"unicode": "e710",
|
||||
"unicode_decimal": 59152
|
||||
},
|
||||
{
|
||||
"icon_id": "39084114",
|
||||
"name": "双击",
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -65,10 +65,10 @@ const OCTable: FC = (props) => {
|
|||
<span>{excelResultValue}</span>
|
||||
</div>
|
||||
{
|
||||
showDifference &&
|
||||
showDifference && !!parseInt(calculateDifference(acctResultValue, excelResultValue || 0)) &&
|
||||
<div className={cs(styles["danger"], styles["comparison-single-row"])}>
|
||||
<span>{lanObj["差值"]}:</span>
|
||||
<span>{calculateDifference(acctResultValue, excelResultValue)}</span>
|
||||
<span>{calculateDifference(acctResultValue, excelResultValue || 0)}</span>
|
||||
</div>
|
||||
}
|
||||
</div>;
|
||||
|
|
@ -104,7 +104,7 @@ const OCTable: FC = (props) => {
|
|||
return <Table
|
||||
rowKey="id" className={styles.tableWrapper}
|
||||
columns={columns} dataSource={dataSource} bordered size="small"
|
||||
scroll={{ x: 1200, y: `calc(100vh - 137px)` }}
|
||||
scroll={{ x: 1200, y: `calc(100vh - 165px)` }}
|
||||
pagination={{
|
||||
...paginationFun(pageInfo, sizeChange, onChange, i18n),
|
||||
size: "default"
|
||||
|
|
|
|||
|
|
@ -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,13 +236,46 @@ 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}>
|
||||
<span title={text} className={styles.contentTitle} style={{ color: `${record?.[item.dataIndex + "_color"]}` }}>
|
||||
<span title={text} className={styles.contentTitle} style={record?.[item.dataIndex + "_color"] ? { color: `${record?.[item.dataIndex + "_color"]}` } : {}}>
|
||||
{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 ? "序号" : "",
|
||||
renderCell: (value: boolean, record: any, index: number, originNode: React.ReactNode) => (isDetailTable ? <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>;
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
.block {
|
||||
height: 300px;
|
||||
border: 3px solid #ccc;
|
||||
margin-bottom: 20px;
|
||||
color: white;
|
||||
padding: 24px;
|
||||
line-height: 32px;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.lazyloadImg{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
&>li{
|
||||
width: 400px;
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;
|
||||
img{
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
import React, { useEffect, useRef } from "react";
|
||||
import styles from "../../index.less";
|
||||
|
||||
interface OwnProps {}
|
||||
|
||||
type Props = OwnProps;
|
||||
|
||||
const Index: React.FC<Props> = (props) => {
|
||||
const itemRef = useRef<HTMLElement[]>([]);
|
||||
const ob = new IntersectionObserver((entries) => {
|
||||
for (const entry of entries) {
|
||||
if (entry.isIntersecting) {
|
||||
const img: any = entry.target;
|
||||
img.src = img.dataset.src;
|
||||
ob.unobserve(entry.target);
|
||||
}
|
||||
}
|
||||
});
|
||||
useEffect(() => {
|
||||
if (itemRef.current) {
|
||||
_.forEach(itemRef.current, (item) => {
|
||||
ob.observe(item);
|
||||
});
|
||||
}
|
||||
|
||||
return () => {
|
||||
if (itemRef.current) {
|
||||
_.forEach(itemRef.current, (item) => {
|
||||
ob.unobserve(item);
|
||||
});
|
||||
}
|
||||
};
|
||||
}, [itemRef.current]);
|
||||
return (
|
||||
<ul className={styles.lazyloadImg}>
|
||||
{_.map(
|
||||
Array.from({ length: 200 }, () => Math.floor(Math.random() * 100)),
|
||||
(item, index) => (
|
||||
<li key={index}>
|
||||
<img data-src={`https://picsum.photos/300/300?random=${index}`} alt="" src={require("../default.jpeg")} ref={(el) => (itemRef.current[index] = el as HTMLElement)} />
|
||||
</li>
|
||||
)
|
||||
)}
|
||||
</ul>
|
||||
);
|
||||
};
|
||||
|
||||
export default Index;
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 8.0 KiB |
|
|
@ -0,0 +1,43 @@
|
|||
import React from "react";
|
||||
import SlideInItem from "./slideInItem";
|
||||
|
||||
interface OwnProps {}
|
||||
|
||||
type Props = OwnProps;
|
||||
|
||||
const list = [
|
||||
{ id: 1, bg: "red" },
|
||||
{ id: 2, bg: "blue" },
|
||||
{ id: 3, bg: "green" },
|
||||
{ id: 4, bg: "yellowgreen" },
|
||||
{ id: 5, bg: "orange" },
|
||||
{ id: 6, bg: "pink" },
|
||||
{ id: 7, bg: "antiquewhite" },
|
||||
{ id: 8, bg: "darkseagreen" },
|
||||
{ id: 9, bg: "purple" },
|
||||
{ id: 10, bg: "red" },
|
||||
{ id: 11, bg: "black" }
|
||||
];
|
||||
const Index: React.FC<Props> = (props) => {
|
||||
const map = new WeakMap();
|
||||
const ob = new IntersectionObserver((entries) => {
|
||||
for (const entry of entries) {
|
||||
if (entry.isIntersecting) {
|
||||
const animation = map.get(entry.target);
|
||||
if (animation) {
|
||||
animation.play();
|
||||
ob.unobserve(entry.target);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return (
|
||||
<>
|
||||
{list.map((item, index) => {
|
||||
return <SlideInItem key={index} item={item} ob={ob} map={map}></SlideInItem>;
|
||||
})}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Index;
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
import React, { useEffect, useRef } from "react";
|
||||
import styles from "../index.less";
|
||||
|
||||
interface OwnProps {
|
||||
item: any;
|
||||
ob: any;
|
||||
map: any;
|
||||
}
|
||||
|
||||
type Props = OwnProps;
|
||||
const SLIDE_FADE_DISTANCE = 50;
|
||||
const SLIDE_FADE_DURATION = 1000;
|
||||
|
||||
const isBelowViewport = (el: HTMLDivElement) => {
|
||||
const rect = el.getBoundingClientRect();
|
||||
return rect.top - SLIDE_FADE_DISTANCE > window.innerHeight;
|
||||
};
|
||||
const slideInItem: React.FC<Props> = (props) => {
|
||||
const { item, ob, map } = props;
|
||||
const itemRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (itemRef.current && ob) {
|
||||
if (!isBelowViewport(itemRef.current)) {
|
||||
return;
|
||||
}
|
||||
const animation = itemRef.current.animate(
|
||||
[
|
||||
{
|
||||
transform: `translateY(${SLIDE_FADE_DISTANCE}px)`,
|
||||
opacity: 0.1
|
||||
},
|
||||
{
|
||||
transform: `translateY(0)`,
|
||||
opacity: 1
|
||||
}
|
||||
],
|
||||
{
|
||||
duration: SLIDE_FADE_DURATION,
|
||||
easing: "ease-in-out",
|
||||
fill: "forwards" // 当动画完成后,保留最后一个关键帧的样式
|
||||
}
|
||||
);
|
||||
animation.pause();
|
||||
map.set(itemRef.current, animation);
|
||||
ob.observe(itemRef.current);
|
||||
}
|
||||
|
||||
return () => {
|
||||
ob.unobserve(itemRef.current);
|
||||
};
|
||||
}, [itemRef.current]);
|
||||
|
||||
return (
|
||||
<div className={styles.block} ref={itemRef} style={{ backgroundColor: item.bg }}>
|
||||
<h3>The most popular component library</h3>
|
||||
|
||||
<h5>for Tailwind CSS</h5>
|
||||
<p>daisyUI adds component class names to Tailwind CSS so you can make beautiful websites faster than ever.</p>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default slideInItem;
|
||||
|
|
@ -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>
|
||||
);
|
||||
|
|
@ -46,7 +46,7 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject,
|
|||
};
|
||||
break;
|
||||
case "paymentOrganization":
|
||||
col = { ...col, width: 200 };
|
||||
col = { ...col, width: g.width || 200 };
|
||||
break;
|
||||
case "socialNum":
|
||||
case "otherNum":
|
||||
|
|
@ -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>
|
||||
|
|
@ -434,6 +444,72 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject,
|
|||
return col;
|
||||
})
|
||||
];
|
||||
} else if (type === "attendanceView") {
|
||||
return [
|
||||
..._.map(initialState, (g) => {
|
||||
let col = { ...g, ellipsis: true };
|
||||
switch (g.dataIndex) {
|
||||
case "operate":
|
||||
col = {
|
||||
...col,
|
||||
ellipsis: false,
|
||||
width: 120,
|
||||
render: (__: string, record: any) => {
|
||||
return (
|
||||
<Space>
|
||||
{_.map(col?.operateType, (o) => (
|
||||
<Button key={o.key} type="link" onClick={() => postMessageToParent(o.key, record)}>
|
||||
{o.label}
|
||||
</Button>
|
||||
))}
|
||||
</Space>
|
||||
);
|
||||
}
|
||||
};
|
||||
break;
|
||||
default:
|
||||
col = { ...col };
|
||||
break;
|
||||
}
|
||||
return col;
|
||||
})
|
||||
];
|
||||
} else if (type === "declare") {
|
||||
return [
|
||||
..._.map(initialState, (g) => {
|
||||
let col = { ...g, ellipsis: true };
|
||||
switch (g.dataIndex) {
|
||||
case "operate":
|
||||
col = {
|
||||
...col,
|
||||
ellipsis: false,
|
||||
width: 120,
|
||||
render: (__: string, record: any) => {
|
||||
return (
|
||||
<Space>
|
||||
{_.map(col?.operateType, (o) => (
|
||||
<Button key={o.key} type="link" onClick={() => postMessageToParent(o.key, record)}>
|
||||
{o.label}
|
||||
</Button>
|
||||
))}
|
||||
</Space>
|
||||
);
|
||||
}
|
||||
};
|
||||
break;
|
||||
default:
|
||||
col = { ...col };
|
||||
break;
|
||||
}
|
||||
return col;
|
||||
})
|
||||
];
|
||||
} else if (type === "cusTitle") {
|
||||
return [
|
||||
..._.map(initialState, (g) => {
|
||||
return { ...g, title: <span dangerouslySetInnerHTML={{ __html: g.title }} /> };
|
||||
})
|
||||
];
|
||||
}
|
||||
return initialState;
|
||||
}, [initialState, type, i18n, extraParams]);
|
||||
|
|
|
|||
|
|
@ -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