From 335baa2c78103508b2519cc14bd60bb60562d543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Thu, 28 Dec 2023 11:12:30 +0800 Subject: [PATCH 01/20] =?UTF-8?q?master-=E4=B8=AA=E7=A8=8E=E7=94=B3?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/config.js | 1 + src/pages/taxDeclareTable/index.tsx | 76 +++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 src/pages/taxDeclareTable/index.tsx diff --git a/src/layouts/config.js b/src/layouts/config.js index 37ef1b4..873e8fe 100644 --- a/src/layouts/config.js +++ b/src/layouts/config.js @@ -16,6 +16,7 @@ module.exports = { "/welfareLedgerTable.*": "blank", "/payrollFilesTable.*": "blank", "/employeeDeclareTable.*": "blank", + "/taxDeclareTable.*": "blank", "/welfareArchiveTable.*": "blank", "/OCTable.*": "blank", "/manage.*": "manage", diff --git a/src/pages/taxDeclareTable/index.tsx b/src/pages/taxDeclareTable/index.tsx new file mode 100644 index 0000000..2223e9e --- /dev/null +++ b/src/pages/taxDeclareTable/index.tsx @@ -0,0 +1,76 @@ +/* + * Author: 黎永顺 + * name: 个税申报表-详情表格 + * Description: + * Date: 2023/12/27 + */ +import React, { FC, useEffect, useState } from "react"; +import { Button, Space, Table } from "antd"; +import { exceptStr, paginationAction } from "@/utils/common"; +import styles from "@/pages/atdTable/components/index.less"; +import { PaginationData } from "rc-pagination"; + +const TaxDeclareTable: FC = (props) => { + const [pageInfo, setPageInfo] = useState>({}); + const [columns, setColumns] = useState>([]); + const [dataSource, setDataSource] = useState>([]); + const [i18n, setI18n] = useState>({}); + + 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, i18n, declareStatus } = data; + setDataSource(dataSource); + setI18n(i18n); + setPageInfo(pageInfo); + setColumns(["NOT_DECLARE", "DECLARE_FAIL"].includes(declareStatus) ? [ + ...columns, + { + title: i18n["操作"], + dataIndex: "operate", + fixed: "right", + width: 120, + render: (_: any, record: any) => ( + + + + ) + } + ] : columns); + } + }; + const handleEdit = (record: any) => { + window.parent.postMessage({ type: "turn", payload: { id: "EDIT", params: { ...record } } }, "*"); + }; + 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 TaxDeclareTable; From b992c06a21b578f2795541b6fd35f229d6f4bdac 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, 29 Dec 2023 10:17:56 +0800 Subject: [PATCH 02/20] master --- src/pages/atdTable/components/index.less | 8 +++----- src/pages/calcTable/calcFixedTotal.tsx | 2 +- src/pages/taxDeclareTable/index.tsx | 4 ++++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/pages/atdTable/components/index.less b/src/pages/atdTable/components/index.less index 12cae05..7cded41 100644 --- a/src/pages/atdTable/components/index.less +++ b/src/pages/atdTable/components/index.less @@ -86,7 +86,7 @@ .expand-th:hover { .toogle-lock-tool { - width: 37%; + display: flex; } } @@ -102,17 +102,15 @@ height: 100%; .title-text { - width: 90%; + flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; - flex: 1 1; cursor: pointer; } .toogle-lock-tool { - display: flex; - width: 0; + display: none; overflow: hidden; height: 100%; justify-content: center; diff --git a/src/pages/calcTable/calcFixedTotal.tsx b/src/pages/calcTable/calcFixedTotal.tsx index f6c50a1..b23504b 100644 --- a/src/pages/calcTable/calcFixedTotal.tsx +++ b/src/pages/calcTable/calcFixedTotal.tsx @@ -49,7 +49,7 @@ const calcFixedTotal: FunctionComponent = (props) => { return (<> { _.map(columns, (item: any, index) => { - return + return { loading ? : {sumRow[item.dataIndex] || "-"} diff --git a/src/pages/taxDeclareTable/index.tsx b/src/pages/taxDeclareTable/index.tsx index 2223e9e..1e4cef7 100644 --- a/src/pages/taxDeclareTable/index.tsx +++ b/src/pages/taxDeclareTable/index.tsx @@ -40,6 +40,7 @@ const TaxDeclareTable: FC = (props) => { render: (_: any, record: any) => ( + {/**/} ) } @@ -49,6 +50,9 @@ const TaxDeclareTable: FC = (props) => { const handleEdit = (record: any) => { window.parent.postMessage({ type: "turn", payload: { id: "EDIT", params: { ...record } } }, "*"); }; + const handleDelete = (record: any) => { + window.parent.postMessage({ type: "turn", payload: { id: "DELETE", params: { ...record } } }, "*"); + }; const onChange = (current: number, pageSize: number) => { setPageInfo((prevState) => { const { pageSize: size } = prevState; From 2f50be171ae2b188860cc24c0aedbc0a2dfaf262 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, 3 Jan 2024 14:31:31 +0800 Subject: [PATCH 03/20] master --- src/pages/calcTable/index.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pages/calcTable/index.tsx b/src/pages/calcTable/index.tsx index 5a78abe..4343872 100644 --- a/src/pages/calcTable/index.tsx +++ b/src/pages/calcTable/index.tsx @@ -20,6 +20,7 @@ interface OwnProps { } type Props = OwnProps; +type fixedProps = boolean | "top" | "bottom"; const { Text } = Typography; const index: FunctionComponent = (props) => { @@ -32,6 +33,7 @@ const index: FunctionComponent = (props) => { const [isDetailTable, setIsDetailTable] = useState(false); const [sumRowlistUrl, setSumRowlistUrl] = useState(""); const [payload, setPayload] = useState(""); + const [fixed, setFixed] = useState(true); useEffect(() => { window.parent.postMessage({ type: "init" }, "*"); @@ -45,13 +47,15 @@ const index: FunctionComponent = (props) => { if (!_.isEmpty(data)) { const { columns, dataSource, pageInfo, selectedRowKeys, i18n: i18nRes = {}, - showTotalCell = false, sumRowlistUrl = "", payload = {}, calcDetail + showTotalCell = false, sumRowlistUrl = "", payload = {}, calcDetail, + fixed = true } = data; setSumRowlistUrl(sumRowlistUrl); setShowTotalCell(showTotalCell); setIsDetailTable(calcDetail); setI18n(i18nRes); setPayload(payload); + setFixed(fixed); setPageInfo(pageInfo); setDataSource(dataSource); setSelectedRowKeys(selectedRowKeys); @@ -140,7 +144,7 @@ const index: FunctionComponent = (props) => { }} summary={() => ( !showTotalCell ? <> : - + {i18n["总计"]} From 156b3288b05ca5fdcc1dfe4ce7ca4188d2fb817c 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, 5 Jan 2024 10:32:13 +0800 Subject: [PATCH 04/20] master --- src/api/calculate.service.ts | 4 +--- src/pages/calcTable/calcFixedTotal.tsx | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/api/calculate.service.ts b/src/api/calculate.service.ts index 27ec01a..d7d843b 100644 --- a/src/api/calculate.service.ts +++ b/src/api/calculate.service.ts @@ -73,9 +73,7 @@ class CalculateService extends BasicService { return this.post(`/api/bs/hrmsalary/salaryacct/acctresult/sum`, queryParams); }; //合计行 - getAcctResultsum = async (params: any) => { - return this.post(`/api/bs/hrmsalary/salaryacct/acctresult/sum`, params); - }; + getAcctResultsum = async (url: string, params: any) => (this.post(url, params)); //社保合计行 getSyMixSum = async (params: any) => { return this.post(`/api/bs/hrmsalary/siaccount/detail/list/syMixSum`, params); diff --git a/src/pages/calcTable/calcFixedTotal.tsx b/src/pages/calcTable/calcFixedTotal.tsx index b23504b..cf35fa6 100644 --- a/src/pages/calcTable/calcFixedTotal.tsx +++ b/src/pages/calcTable/calcFixedTotal.tsx @@ -34,7 +34,7 @@ const calcFixedTotal: FunctionComponent = (props) => { return !_.isEmpty(props.columns) ? flattenFn(props.columns) : []; }, [props.columns]); const dataSourceUrl = useCallback((payload) => { - return API.CalculateService.getAcctResultsum(payload); + return API.CalculateService.getAcctResultsum(props.dataSourceUrl, payload); }, [props.dataSourceUrl]); useEffect(() => { if (!_.isEmpty(props.payload)) { From b9846d5abd40769f69cc061801cd1dabed3c4150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Mon, 8 Jan 2024 18:04:32 +0800 Subject: [PATCH 05/20] master --- src/layouts/config.js | 1 + src/pages/salaryFileTable/index.tsx | 102 ++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 src/pages/salaryFileTable/index.tsx diff --git a/src/layouts/config.js b/src/layouts/config.js index 873e8fe..4b582b2 100644 --- a/src/layouts/config.js +++ b/src/layouts/config.js @@ -18,6 +18,7 @@ module.exports = { "/employeeDeclareTable.*": "blank", "/taxDeclareTable.*": "blank", "/welfareArchiveTable.*": "blank", + "/salaryFileTable.*": "blank", "/OCTable.*": "blank", "/manage.*": "manage", "/portal.*": "template", diff --git a/src/pages/salaryFileTable/index.tsx b/src/pages/salaryFileTable/index.tsx new file mode 100644 index 0000000..4611757 --- /dev/null +++ b/src/pages/salaryFileTable/index.tsx @@ -0,0 +1,102 @@ +/* + * Author: 黎永顺 + * name: 薪资档案重构-档案列表 + * Description: + * Date: 2024/1/8 + */ +import React, { FunctionComponent, useEffect, useMemo, useState } from "react"; +import { ColumnType } from "antd/lib/table"; +import { PaginationData } from "rc-pagination"; +import styles from "@/pages/atdTable/components/index.less"; +import { exceptStr, paginationAction } from "@/utils/common"; +import { Table } from "antd"; + +interface OwnProps { +} + +type Props = OwnProps; + +const Index: FunctionComponent = (props) => { + const [columns, setColumns] = useState[]>([]); + const [dataSource, setDataSource] = useState([]); + const [selectedRowKeys, setSelectedRowKeys] = useState([]); + const [pageInfo, setPageInfo] = useState>({}); + const [i18n, setI18n] = useState({}); + const [runStatuses, setRunStatuses] = useState(""); + const [showOperateBtn, setShowOperateBtn] = useState(false); + + 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, selectedRowKeys, i18n: i18nRes = {}, + runStatuses, showOperateBtn + } = data; + setShowOperateBtn(showOperateBtn); + setRunStatuses(runStatuses); + setI18n(i18nRes); + setPageInfo(pageInfo); + setDataSource(dataSource); + setSelectedRowKeys(selectedRowKeys); + setColumns(columns); + } + }; + 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 }; + }); + }; + const rowSelection = { + columnWidth: 60, + selectedRowKeys: selectedRowKeys, + onChange: (selectedRowKeys: React.Key[]) => { + setSelectedRowKeys(selectedRowKeys); + window.parent.postMessage( + { + type: "turn", + payload: { id: "CHECKBOX", params: { selectedRowKeys } } + }, + "*" + ); + } + }; + const handleWelfareOperate = (type: string, record: any, interfaceParams?: any) => { + window.parent.postMessage( + { + type: "turn", + payload: { id: type, params: { record, interfaceParams } } + }, + "*" + ); + }; + const cols: any = useMemo(() => { + return showOperateBtn ? [...columns] : [...columns]; + }, [columns, runStatuses, i18n, showOperateBtn]); + return (
); +}; + +export default Index; From 58152f05288ef40bdd76142ab66b5085eebe284c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Thu, 11 Jan 2024 14:52:52 +0800 Subject: [PATCH 06/20] master --- src/pages/calcTable/index.tsx | 6 +- src/pages/salaryFileTable/index.tsx | 118 ++++++++++++++++++++++++++-- 2 files changed, 114 insertions(+), 10 deletions(-) diff --git a/src/pages/calcTable/index.tsx b/src/pages/calcTable/index.tsx index 4343872..4a9b626 100644 --- a/src/pages/calcTable/index.tsx +++ b/src/pages/calcTable/index.tsx @@ -32,6 +32,7 @@ const index: FunctionComponent = (props) => { const [showTotalCell, setShowTotalCell] = useState(false); const [isDetailTable, setIsDetailTable] = useState(false); const [sumRowlistUrl, setSumRowlistUrl] = useState(""); + const [tableScrollHeight, setTableScrollHeight] = useState(0); const [payload, setPayload] = useState(""); const [fixed, setFixed] = useState(true); @@ -48,7 +49,7 @@ const index: FunctionComponent = (props) => { const { columns, dataSource, pageInfo, selectedRowKeys, i18n: i18nRes = {}, showTotalCell = false, sumRowlistUrl = "", payload = {}, calcDetail, - fixed = true + fixed = true, tableScrollHeight } = data; setSumRowlistUrl(sumRowlistUrl); setShowTotalCell(showTotalCell); @@ -59,6 +60,7 @@ const index: FunctionComponent = (props) => { setPageInfo(pageInfo); setDataSource(dataSource); setSelectedRowKeys(selectedRowKeys); + setTableScrollHeight(tableScrollHeight); setColumns([...convertColumns(_.map(columns, o => ({ ...o, i18n: i18nRes }))), { title: i18nRes["操作"], dataIndex: "operate", fixed: "right", width: 120, render: (__, record) => () @@ -135,7 +137,7 @@ const index: FunctionComponent = (props) => { return (
o.dataIndex !== "operate")} footer={() => !isDetailTable ? : null} pagination={{ diff --git a/src/pages/salaryFileTable/index.tsx b/src/pages/salaryFileTable/index.tsx index 4611757..52f96f8 100644 --- a/src/pages/salaryFileTable/index.tsx +++ b/src/pages/salaryFileTable/index.tsx @@ -9,7 +9,8 @@ import { ColumnType } from "antd/lib/table"; import { PaginationData } from "rc-pagination"; import styles from "@/pages/atdTable/components/index.less"; import { exceptStr, paginationAction } from "@/utils/common"; -import { Table } from "antd"; +import { Button, Dropdown, MenuProps, Space, Table } from "antd"; +import { MoreOutlined } from "@ant-design/icons"; interface OwnProps { } @@ -24,6 +25,7 @@ const Index: FunctionComponent = (props) => { const [i18n, setI18n] = useState({}); const [runStatuses, setRunStatuses] = useState(""); const [showOperateBtn, setShowOperateBtn] = useState(false); + const [showDelSalaryFileBtn, setShowDelSalaryFileBtn] = useState(false);//待定薪、停薪员工 是否允许删除薪资档案 useEffect(() => { window.parent.postMessage({ type: "init" }, "*"); @@ -38,15 +40,16 @@ const Index: FunctionComponent = (props) => { if (!_.isEmpty(data)) { const { columns, dataSource, pageInfo, selectedRowKeys, i18n: i18nRes = {}, - runStatuses, showOperateBtn + selectedKey, showOperateBtn, showDelSalaryFileBtn } = data; setShowOperateBtn(showOperateBtn); - setRunStatuses(runStatuses); + setRunStatuses(selectedKey); setI18n(i18nRes); setPageInfo(pageInfo); setDataSource(dataSource); setSelectedRowKeys(selectedRowKeys); setColumns(columns); + setShowDelSalaryFileBtn(showDelSalaryFileBtn); } }; const onChange = (current: number, pageSize: number) => { @@ -70,13 +73,13 @@ const Index: FunctionComponent = (props) => { window.parent.postMessage( { type: "turn", - payload: { id: "CHECKBOX", params: { selectedRowKeys } } + payload: { id: "ROWSELECTION", params: { selectedRowKeys } } }, "*" ); } }; - const handleWelfareOperate = (type: string, record: any, interfaceParams?: any) => { + const handleSalaryFileOperate = (type: string, record: any, interfaceParams?: any) => { window.parent.postMessage( { type: "turn", @@ -86,10 +89,109 @@ const Index: FunctionComponent = (props) => { ); }; const cols: any = useMemo(() => { - return showOperateBtn ? [...columns] : [...columns]; - }, [columns, runStatuses, i18n, showOperateBtn]); + if (!_.isEmpty(columns)) { + let opts: any = _.find(columns, o => o.dataIndex === "operate"); + switch (runStatuses) { + case "pending": + opts = { + ...opts, + render: (__: any, record: any) => { + let items: MenuProps["items"] = [ + { + key: "DeleteTodoList", + label: i18n["删除待办"], + onClick: () => handleSalaryFileOperate("DEL-PENDITNG-TO-DO", record, [record?.id]) + }, + { + key: "DeleteFiles", + label: i18n["删除档案"], + onClick: () => handleSalaryFileOperate("DEL-SALARY-FILES", record, [record?.id]) + } + ]; + !showDelSalaryFileBtn && (items = _.dropRight(items)); + return ( + + + + ) + }; + break; + case "suspend": + opts = { + ...opts, + render: (__: any, record: any) => { + const downsizingItems: MenuProps["items"] = [ + { + key: "DeleteTodoList", + label: i18n["删除待办"], + onClick: () => handleSalaryFileOperate("DEL-SUSPEND-TO-DO", record, [record?.id]) + } + ]; + return ( + + + + + + { + !_.isEmpty(stopItems) && + + ) + }]; + } else { + return []; + } + }, [columns, runStatuses, i18n, showOperateBtn, showDelSalaryFileBtn]); return (
Date: Wed, 17 Jan 2024 14:32:26 +0800 Subject: [PATCH 07/20] master --- src/pages/calcTable/calcFixedTotal.tsx | 7 +++++-- src/pages/calcTable/index.tsx | 12 +++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/pages/calcTable/calcFixedTotal.tsx b/src/pages/calcTable/calcFixedTotal.tsx index cf35fa6..769cdb8 100644 --- a/src/pages/calcTable/calcFixedTotal.tsx +++ b/src/pages/calcTable/calcFixedTotal.tsx @@ -15,6 +15,7 @@ interface OwnProps { columns: ColumnType[]; dataSourceUrl: string; payload: any; + sumRow: Partial<{}>; } type Props = OwnProps; @@ -37,15 +38,17 @@ const calcFixedTotal: FunctionComponent = (props) => { return API.CalculateService.getAcctResultsum(props.dataSourceUrl, payload); }, [props.dataSourceUrl]); useEffect(() => { - if (!_.isEmpty(props.payload)) { + if (!_.isEmpty(props.payload) && !props.sumRow) { setLoading(true); dataSourceUrl(props.payload).then(({ data }) => { setLoading(false); const { data: result, status } = data; if (status) setSumRow(result.sumRow || {}); }); + } else { + setSumRow(props.sumRow); } - }, [props.payload]); + }, [props.payload, props.sumRow]); return (<> { _.map(columns, (item: any, index) => { diff --git a/src/pages/calcTable/index.tsx b/src/pages/calcTable/index.tsx index 4a9b626..761078a 100644 --- a/src/pages/calcTable/index.tsx +++ b/src/pages/calcTable/index.tsx @@ -35,6 +35,7 @@ const index: FunctionComponent = (props) => { const [tableScrollHeight, setTableScrollHeight] = useState(0); const [payload, setPayload] = useState(""); const [fixed, setFixed] = useState(true); + const [sumRow, setSumRow] = useState>({});//总计行数据 useEffect(() => { window.parent.postMessage({ type: "init" }, "*"); @@ -49,7 +50,7 @@ const index: FunctionComponent = (props) => { const { columns, dataSource, pageInfo, selectedRowKeys, i18n: i18nRes = {}, showTotalCell = false, sumRowlistUrl = "", payload = {}, calcDetail, - fixed = true, tableScrollHeight + fixed = true, tableScrollHeight, sumRow } = data; setSumRowlistUrl(sumRowlistUrl); setShowTotalCell(showTotalCell); @@ -57,6 +58,7 @@ const index: FunctionComponent = (props) => { setI18n(i18nRes); setPayload(payload); setFixed(fixed); + setSumRow(sumRow); setPageInfo(pageInfo); setDataSource(dataSource); setSelectedRowKeys(selectedRowKeys); @@ -137,19 +139,19 @@ const index: FunctionComponent = (props) => { return (
o.dataIndex !== "operate")} footer={() => !isDetailTable ? : null} - pagination={{ + pagination={!_.isNil(pageInfo) ? { ...paginationFun(pageInfo, sizeChange, onChange, i18n), size: "default" - }} + } : false} summary={() => ( !showTotalCell ? <> : {i18n["总计"]} - + )} 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 08/20] 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 09/20] =?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 10/20] 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 11/20] 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 12/20] 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]); From d171afcafe6053651294b4709be23120c5b565b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Thu, 22 Feb 2024 15:06:29 +0800 Subject: [PATCH 13/20] master --- public/css/iconfont/demo_index.html | 98 ++++++++++++++++++++++++- public/css/iconfont/iconfont.css | 22 +++++- public/css/iconfont/iconfont.js | 2 +- public/css/iconfont/iconfont.json | 28 +++++++ public/css/iconfont/iconfont.ttf | Bin 5580 -> 6540 bytes public/css/iconfont/iconfont.woff | Bin 3428 -> 4076 bytes public/css/iconfont/iconfont.woff2 | Bin 2800 -> 3384 bytes src/pages/unitTable/renderColsOpts.tsx | 79 ++++++++++++++------ 8 files changed, 198 insertions(+), 31 deletions(-) diff --git a/public/css/iconfont/demo_index.html b/public/css/iconfont/demo_index.html index aa55039..57b6890 100644 --- a/public/css/iconfont/demo_index.html +++ b/public/css/iconfont/demo_index.html @@ -54,6 +54,30 @@
    +
  • + +
    payment
    +
    &#xe689;
    +
  • + +
  • + +
    my
    +
    &#xe78b;
    +
  • + +
  • + +
    还款
    +
    &#xe608;
    +
  • + +
  • + +
    编辑
    +
    &#xe600;
    +
  • +
  • 批量更新
    @@ -144,9 +168,9 @@
    @font-face {
       font-family: 'iconfont';
    -  src: url('iconfont.woff2?t=1701833672416') format('woff2'),
    -       url('iconfont.woff?t=1701833672416') format('woff'),
    -       url('iconfont.ttf?t=1701833672416') format('truetype');
    +  src: url('iconfont.woff2?t=1708504618246') format('woff2'),
    +       url('iconfont.woff?t=1708504618246') format('woff'),
    +       url('iconfont.ttf?t=1708504618246') format('truetype');
     }
     

    第二步:定义使用 iconfont 的样式

    @@ -172,6 +196,42 @@
      +
    • + +
      + payment +
      +
      .icon-payment +
      +
    • + +
    • + +
      + my +
      +
      .icon-my +
      +
    • + +
    • + +
      + 还款 +
      +
      .icon-reimbursement +
      +
    • + +
    • + +
      + 编辑 +
      +
      .icon-bianji +
      +
    • +
    • @@ -307,6 +367,38 @@
        +
      • + +
        payment
        +
        #icon-payment
        +
      • + +
      • + +
        my
        +
        #icon-my
        +
      • + +
      • + +
        还款
        +
        #icon-reimbursement
        +
      • + +
      • + +
        编辑
        +
        #icon-bianji
        +
      • +
{ + // @ts-ignore + setExtraParams({ ...extraParams, selectedRowKeys: selectedRowKeys }); + window.parent.postMessage( + { type: "turn", payload: { id: "CHECKBOX", params: { selectedRowKeys } } }, "*" + ); + } + }; + return
) { return React.useMemo(() => { if (type === "welfareRecord") { return [..._.map(_.filter(initialState, o => o.dataIndex !== "id"), g => { @@ -61,13 +62,21 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject, key: "DeleteList", label: i18n?.["删除"], onClick: () => postMessageToParent("DELRC", record) + }, + { + key: "Log", + label: i18n?.["操作日志"], + onClick: () => postMessageToParent("log", record) } ]; return ( { - !permission ? - : + !extraParams?.permission ? + + + + : <> { billStatus === "0" && @@ -88,6 +97,17 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject, onClick={() => postMessageToParent("VIEW", record)}>{i18n?.["查看"]} + postMessageToParent("log", record) + } + ] + }} placement="bottomRight"> + : + !extraParams?.permission ? + + + + : <> @@ -168,9 +197,79 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject, ); } }]; + } else if (type === "bonusStrategy") { + const { selectedKey } = extraParams as { selectedKey: string }; + return [..._.map(initialState, g => { + let col = { ...g, ellipsis: true, fixed: false, width: 120 }; + switch (g.dataIndex) { + case "username": + col = { ...col, fixed: "left" }; + break; + case "taxAgentName": + col = { ...col, width: 200, fixed: "left" }; + break; + case "idNo": + col = { ...col, width: 150 }; + break; + default: + col = { ...col }; + break; + } + return col; + }), { + dataIndex: "operate", title: i18n?.["操作"], width: 185, fixed: "right", + render: (__: string, record: any) => { + let items: MenuProps["items"] = [ + { + key: "DeleteList", + label: i18n?.["删除"], + onClick: () => postMessageToParent("DEL", record) + }, + { + key: "Log", + label: i18n?.["操作日志"], + onClick: () => postMessageToParent("log", record) + } + ]; + selectedKey === "getAnnualbonusaddupList" && items.shift(); + return ( + + { + !extraParams?.permission ? + + { + selectedKey === "getAnnualbonusstrategyList" && + + } + + : + <> + + { + selectedKey === "getAnnualbonusstrategyList" && + + } + { + selectedKey === "getAnnualbonusaddupList" && + + } + + ) + + + + ) }; break; case "3": @@ -133,6 +141,11 @@ const Index: FunctionComponent = (props) => { key: "DeleteTodoList", label: i18n["删除待办"], onClick: () => handleWelfareOperate("DEL-TO-DO-STAY", record, { runStatus: "3" }) + }, + { + key: "Log", + label: i18n["操作日志"], + onClick: () => handleWelfareOperate("log", record) } ]; return ( @@ -155,6 +168,11 @@ const Index: FunctionComponent = (props) => { key: "CancelSuspension", label: i18n["取消停缴"], onClick: () => handleWelfareOperate("CANCEL-STOP", record) + }, + { + key: "Log", + label: i18n["操作日志"], + onClick: () => handleWelfareOperate("log", record) } ]; return ( @@ -174,7 +192,11 @@ const Index: FunctionComponent = (props) => { return showOperateBtn ? [...columns, opts] : [...columns, { ...opts, render: (__: any, record: any) => ( - ) + + + + + ) }]; }, [columns, runStatuses, i18n, showOperateBtn]); return (
Date: Thu, 29 Feb 2024 10:12:40 +0800 Subject: [PATCH 16/20] =?UTF-8?q?master-=E6=96=B0=E5=A2=9E=E5=B9=B4?= =?UTF-8?q?=E7=BB=88=E5=A5=96=E8=AE=A1=E7=A8=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/salaryFileTable/index.tsx | 26 +++++++++++++++------- src/pages/unitTable/renderColsOpts.tsx | 29 ++++++++++++++++++++++++- src/pages/welfareArchiveTable/index.tsx | 21 +++++++++++++----- 3 files changed, 62 insertions(+), 14 deletions(-) diff --git a/src/pages/salaryFileTable/index.tsx b/src/pages/salaryFileTable/index.tsx index b51cb3e..30dd86c 100644 --- a/src/pages/salaryFileTable/index.tsx +++ b/src/pages/salaryFileTable/index.tsx @@ -129,14 +129,24 @@ const Index: FunctionComponent = (props) => { case "ext": opts = { ...opts, - render: (__: any, record: any) => ( - - - - - ) + render: (__: any, record: any) => { + let items: MenuProps["items"] = [ + { + key: "Log", + label: i18n["操作日志"], + onClick: () => handleSalaryFileOperate("log", record) + } + ]; + return ( + + + + - + postMessageToParent("log", record) + }] + }} placement="bottomRight"> + - - ) + render: (__: any, record: any) => { + const items: MenuProps["items"] = [ + { + key: "Log", + label: i18n["操作日志"], + onClick: () => handleWelfareOperate("log", record) + } + ]; + return ( + + + + - + + + } + if (!isNaN(parseFloat(record[upperLimitIndex])) && parseFloat(rowData) > parseFloat(record[upperLimitIndex])) { + return + } else { + return `${rowData}` + } + } return