From 0c43d4789561810ccd8d126c4ef83c0ed95b3481 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Wed, 17 Jan 2024 17:24:12 +0800 Subject: [PATCH 1/5] master --- src/pages/calcTable/index.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/calcTable/index.tsx b/src/pages/calcTable/index.tsx index 761078a..6e949fe 100644 --- a/src/pages/calcTable/index.tsx +++ b/src/pages/calcTable/index.tsx @@ -123,7 +123,9 @@ const index: FunctionComponent = (props) => { }); }; const rowSelection = { - columnWidth: 60, + columnWidth: 60, hideSelectAll: isDetailTable, + renderCell: (value: boolean, record: any, index: number, originNode: React.ReactNode) => (isDetailTable ? + {index + 1} : originNode), selectedRowKeys: selectedRowKeys, onChange: (selectedRowKeys: React.Key[]) => { setSelectedRowKeys(selectedRowKeys); From e02c97c41acbb9adeaf8e106685a9031d1aa337e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Wed, 24 Jan 2024 15:35:50 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=B0=81=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/config.js | 1 + src/pages/unitTable/index.less | 123 +++++++++++++++++++++++++ src/pages/unitTable/index.tsx | 58 ++++++++++++ src/pages/unitTable/renderColsOpts.tsx | 106 +++++++++++++++++++++ 4 files changed, 288 insertions(+) create mode 100644 src/pages/unitTable/index.less create mode 100644 src/pages/unitTable/index.tsx create mode 100644 src/pages/unitTable/renderColsOpts.tsx diff --git a/src/layouts/config.js b/src/layouts/config.js index 4b582b2..d091876 100644 --- a/src/layouts/config.js +++ b/src/layouts/config.js @@ -20,6 +20,7 @@ module.exports = { "/welfareArchiveTable.*": "blank", "/salaryFileTable.*": "blank", "/OCTable.*": "blank", + "/unitTable.*": "blank", "/manage.*": "manage", "/portal.*": "template", "/passport/oauth-in": "blank", diff --git a/src/pages/unitTable/index.less b/src/pages/unitTable/index.less new file mode 100644 index 0000000..40485fe --- /dev/null +++ b/src/pages/unitTable/index.less @@ -0,0 +1,123 @@ +.multi_fun_table { + background: #fff; + + :global { + .ant-btn-link { + height: inherit !important; + } + + .ant-btn-link, .ant-dropdown-trigger { + padding: 0; + font-size: 12px; + color: #333; + } + + .ant-btn-link:hover { + color: #00a9ff; + + span { + text-decoration: underline; + } + } + + .ant-table-tbody > tr.ant-table-row:hover > td { + background: #e9f7ff; + } + + .anticon-more { + font-size: 16px; + cursor: pointer; + } + + .ant-spin-container { + .ant-pagination { + font-size: 12px; + align-items: center; + margin-right: 8px; + + .ant-pagination-item, .ant-pagination-prev, .ant-pagination-next { + min-width: 28px; + height: 28px; + line-height: 28px; + border-radius: 6px; + + & > button { + border-radius: 6px; + } + } + + .ant-pagination-item-active { + background: var(--ant-primary-color); + border: none; + + & > a { + color: #FFF; + } + } + + .ant-pagination-options { + .ant-select { + font-size: 12px; + + .ant-select-selector { + height: 28px; + border-radius: 6px; + + .ant-select-selection-search-input { + height: 26px; + line-height: 26px; + } + + .ant-select-selection-item { + line-height: 26px; + } + } + + .ant-select-item { + font-size: 12px; + } + } + + .ant-pagination-options-quick-jumper { + height: 28px; + line-height: 28px; + + & > input { + border-radius: 6px; + height: 28px; + } + } + } + } + } + + .ant-table-thead > tr > th { + background-color: #f7fbfe; + } + + th, td { + font-size: 12px; + + .ant-form-item { + margin-bottom: 0; + + .ant-input-number { + width: 100%; + } + } + } + } +} + +:global { + .ant-dropdown-placement-bottomRight { + .ant-dropdown-menu { + max-height: inherit !important; + } + } + + .ant-dropdown-menu-item { + font-size: 12px; + color: #333; + } +} diff --git a/src/pages/unitTable/index.tsx b/src/pages/unitTable/index.tsx new file mode 100644 index 0000000..01af5ae --- /dev/null +++ b/src/pages/unitTable/index.tsx @@ -0,0 +1,58 @@ +import React, { FC, useEffect, useState } from "react"; +import { Table } from "antd"; +import { PaginationData } from "rc-pagination"; +import { exceptStr, paginationAction } from "@/utils/common"; +import { renderCols } from "@/pages/unitTable/renderColsOpts"; +import styles from "./index.less"; + +const UnitTable: FC = (props) => { + const [columns, setColumns] = useState>([]); + const [dataSource, setDataSource] = useState>([]); + const [pageInfo, setPageInfo] = useState>({}); + const [i18n, setI18n] = useState({}); + const [permission, setPermission] = useState(false); + const [scrollHeight, setScrollHeight] = useState(undefined); + + useEffect(() => { + window.parent.postMessage({ type: "init" }, "*"); + window.addEventListener("message", receiveMessageFromIndex, false); + return () => { + window.removeEventListener("message", receiveMessageFromIndex, false); + }; + }, []); + const receiveMessageFromIndex = (event: any) => { + const data: any = exceptStr(event.data); + if (!_.isEmpty(data)) { + const { columns, dataSource, pageInfo, scrollHeight, i18n, showOperateBtn } = data; + setI18n(i18n); + setScrollHeight(scrollHeight); + setColumns(columns); + setDataSource(dataSource); + setPageInfo(pageInfo); + setPermission(showOperateBtn); + } + }; + const onChange = (current: number, pageSize: number) => { + setPageInfo((prevState) => { + const { pageSize: size } = prevState; + window.parent.postMessage( + { + type: "turn", + payload: { id: "PAGEINFO", params: { ...pageInfo, current: size === pageSize ? current : 1, pageSize } } + }, + "*" + ); + return { ...pageInfo, current: size === pageSize ? current : 1, pageSize }; + }); + }; + return ; +}; + +export default UnitTable; diff --git a/src/pages/unitTable/renderColsOpts.tsx b/src/pages/unitTable/renderColsOpts.tsx new file mode 100644 index 0000000..1825946 --- /dev/null +++ b/src/pages/unitTable/renderColsOpts.tsx @@ -0,0 +1,106 @@ +import React from "react"; +import { Button, Dropdown, MenuProps, Space, Typography } from "antd"; +import { MoreOutlined } from "@ant-design/icons"; + +const { Text } = Typography; + +/* + * Author: 黎永顺 + * Description:社保福利台账列表项 + * Params: + * Date: 2024/1/23 + */ +export function renderCols(initialState: any[], type: string, i18n?: AnyObject, permission?: boolean) { + return React.useMemo(() => { + if (type === "welfareRecord") { + return [..._.map(_.filter(initialState, o => o.dataIndex !== "id"), g => { + let col = { ...g, ellipsis: true, fixed: g.dataIndex === "billMonth", width: 180 }; + switch (g.dataIndex) { + case "billMonth": + col = { + ...col, + width: 120, + render: (text: string, record: any) => { + const { billStatus } = record; + return (); + } + }; + break; + case "billStatus": + col = { + ...col, width: 100, render: (text: string) => ( + + {text === "1" ? i18n?.["已归档"] : i18n?.["未归档"]} + + ) + }; + break; + case "paymentOrganization": + col = { ...col, width: 200 }; + break; + case "socialNum": + case "otherNum": + case "fundNum": + col = { ...col, width: 118 }; + break; + case "remarks": + col = { ...col, width: 200 }; + break; + default: + col = { ...col }; + break; + } + return col; + }), { + dataIndex: "operate", title: i18n?.["操作"], width: 185, fixed: "right", + render: (__: string, record: any) => { + const { billStatus } = record; + const items: MenuProps["items"] = [ + { + key: "DeleteList", + label: i18n?.["删除"], + onClick: () => postMessageToParent("DELRC", record) + } + ]; + return ( + + { + !permission ? + : + <> + { + billStatus === "0" && + <> + + + + + + + } + + } + + ); + } + }]; + } + return []; + }, [initialState, type, i18n, permission]); +} + +const postMessageToParent = (type: string, params: any) => { + window.parent.postMessage({ type: "turn", payload: { id: type, params } }, "*"); +}; From b333b32f0195cb94469f1a7312460a0c0e07747f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Tue, 30 Jan 2024 13:52:01 +0800 Subject: [PATCH 3/5] master --- src/global.less | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/global.less b/src/global.less index 5711cfd..efe5926 100644 --- a/src/global.less +++ b/src/global.less @@ -70,9 +70,9 @@ div, iframe, aside, main { - scrollbar-color: #ccc transparent; + //scrollbar-color: #ccc transparent; /* 第一个方块颜色,第二个轨道颜色(用于更改火狐浏览器样式) */ - scrollbar-width: thin; + //scrollbar-width: thin; /* 火狐滚动条无法自定义宽度,只能通过此属性使滚动条宽度变细 */ &::-webkit-scrollbar-track { From fc48c2c20d03eba616ee5663d474620469888b6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Fri, 2 Feb 2024 14:33:48 +0800 Subject: [PATCH 4/5] master --- src/pages/taxDeclareTable/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/taxDeclareTable/index.tsx b/src/pages/taxDeclareTable/index.tsx index 1e4cef7..28d90b0 100644 --- a/src/pages/taxDeclareTable/index.tsx +++ b/src/pages/taxDeclareTable/index.tsx @@ -40,7 +40,7 @@ const TaxDeclareTable: FC = (props) => { render: (_: any, record: any) => ( - {/**/} + ) } From 7152e7e8895b899a2022e7b17700e34d2848aefb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Wed, 21 Feb 2024 15:49:16 +0800 Subject: [PATCH 5/5] master --- src/pages/unitTable/index.tsx | 6 ++-- src/pages/unitTable/renderColsOpts.tsx | 41 ++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/pages/unitTable/index.tsx b/src/pages/unitTable/index.tsx index 01af5ae..683f9f1 100644 --- a/src/pages/unitTable/index.tsx +++ b/src/pages/unitTable/index.tsx @@ -6,6 +6,7 @@ import { renderCols } from "@/pages/unitTable/renderColsOpts"; import styles from "./index.less"; const UnitTable: FC = (props) => { + const [unitTableType, setUnitTableType] = useState(""); const [columns, setColumns] = useState>([]); const [dataSource, setDataSource] = useState>([]); const [pageInfo, setPageInfo] = useState>({}); @@ -23,9 +24,10 @@ const UnitTable: FC = (props) => { const receiveMessageFromIndex = (event: any) => { const data: any = exceptStr(event.data); if (!_.isEmpty(data)) { - const { columns, dataSource, pageInfo, scrollHeight, i18n, showOperateBtn } = data; + const { columns, dataSource, pageInfo, scrollHeight, i18n, showOperateBtn, unitTableType } = data; setI18n(i18n); setScrollHeight(scrollHeight); + setUnitTableType(unitTableType); setColumns(columns); setDataSource(dataSource); setPageInfo(pageInfo); @@ -46,7 +48,7 @@ const UnitTable: FC = (props) => { }); }; return
o.dataIndex !== "id"), g => { + let col = { ...g, ellipsis: true, fixed: g.dataIndex === "billMonth", width: 180 }; + switch (g.dataIndex) { + case "billMonth": + col = { + ...col, + width: 120, + render: (text: string, record: any) => { + const { billStatus } = record; + return (); + } + }; + break; + case "billStatus": + col = { + ...col, width: 100, render: (text: string) => ( + + {text === "1" ? i18n?.["已归档"] : i18n?.["未归档"]} + + ) + }; + break; + case "paymentOrganization": + col = { ...col, width: 200 }; + break; + case "socialNum": + case "otherNum": + case "fundNum": + col = { ...col, width: 118 }; + break; + case "remarks": + col = { ...col, width: 200 }; + break; + default: + col = { ...col }; + break; + } + return col; + })]; } return []; }, [initialState, type, i18n, permission]);