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]);