From 2c13ef67e73109e258e09314e81e45f96104d6ee Mon Sep 17 00:00:00 2001 From: lys <971387674@qq.com> Date: Mon, 6 Jan 2025 10:36:52 +0800 Subject: [PATCH] =?UTF-8?q?feature/2.9.42310.01-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=8B=93=E6=89=91=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/taxDeclareTable/index.tsx | 104 +++++++++++++++++++++------- 1 file changed, 79 insertions(+), 25 deletions(-) diff --git a/src/pages/taxDeclareTable/index.tsx b/src/pages/taxDeclareTable/index.tsx index 7110117..854e4af 100644 --- a/src/pages/taxDeclareTable/index.tsx +++ b/src/pages/taxDeclareTable/index.tsx @@ -5,6 +5,7 @@ * Date: 2023/12/27 */ import React, { FC, useEffect, useState } from "react"; +import { FolderViewOutlined } from "@ant-design/icons"; import { Button, Space, Table } from "antd"; import { exceptStr, paginationAction } from "@/utils/common"; import styles from "@/pages/atdTable/components/index.less"; @@ -26,25 +27,69 @@ const TaxDeclareTable: FC = (props) => { const receiveMessageFromIndex = (event: any) => { const data: any = exceptStr(event.data); if (!_.isEmpty(data)) { - const { columns, dataSource, pageInfo, i18n, declareStatus, azOperate=true } = data; + const { columns, dataSource, pageInfo, i18n, declareStatus, azOperate = true } = data; setDataSource(dataSource); setI18n(i18n); setPageInfo(pageInfo); - setColumns((["NOT_DECLARE", "DECLARE_FAIL"].includes(declareStatus) && azOperate) ? [ - ...columns, - { - title: i18n["操作"], - dataIndex: "operate", - fixed: "right", - width: 120, - render: (_: any, record: any) => ( - - - - - ) - } - ] : columns); + setColumns( + ["NOT_DECLARE", "DECLARE_FAIL"].includes(declareStatus) && azOperate + ? [ + ..._.map(columns, (o) => { + // 查看附表字段 + if (o.isAppendix) { + return { + ...o, + render: (text: string, record: any) => ( +
+ {text} + handleViewAppendix({ ...record, dataIndex: o.dataIndex, title: o.title })} + /> +
+ ) + }; + } + return { ...o }; + }), + { + title: i18n["操作"], + dataIndex: "operate", + fixed: "right", + width: 120, + render: (_: any, record: any) => ( + + + + + ) + } + ] + : _.map(columns, (o) => { + // 查看附表字段 + if (o.isAppendix) { + return { + ...o, + render: (text: string, record: any) => ( +
+ {text} + handleViewAppendix({ ...record, dataIndex: o.dataIndex, title: o.title })} + /> +
+ ) + }; + } + return { ...o }; + }) + ); } }; const handleEdit = (record: any) => { @@ -53,6 +98,9 @@ const TaxDeclareTable: FC = (props) => { const handleDelete = (record: any) => { window.parent.postMessage({ type: "turn", payload: { id: "DELETE", params: { ...record } } }, "*"); }; + const handleViewAppendix = (record: any) => { + window.parent.postMessage({ type: "turn", payload: { id: "APPENDIX", params: { ...record } } }, "*"); + }; const onChange = (current: number, pageSize: number) => { setPageInfo((prevState) => { const { pageSize: size } = prevState; @@ -66,15 +114,21 @@ const TaxDeclareTable: FC = (props) => { return { ...pageInfo, current: size === pageSize ? current : 1, pageSize }; }); }; - return ; + return ( +
+ ); }; export default TaxDeclareTable;