import React from "react"; import { Button, Dropdown, MenuProps, Space, Tooltip, Typography } from "antd"; import { MoreOutlined, QuestionCircleFilled } from "@ant-design/icons"; import { extraType } from "@/pages/unitTable/index"; const { Text } = Typography; /* * Author: 黎永顺 * Description:社保福利台账列表项 * Params: * Date: 2024/1/23 */ export function renderCols(initialState: any[], type: string, i18n?: AnyObject, extraParams?: Partial) { 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, customOptAuth } = record; const items: MenuProps["items"] = [ { key: "DeleteList", label: i18n?.["删除"], onClick: () => postMessageToParent("DELRC", record) }, { key: "Log", label: i18n?.["操作日志"], onClick: () => postMessageToParent("log", record) } ]; return ( {!record?.opts.includes("admin") ? ( postMessageToParent("log", record) } ] }} placement="bottomRight" > {(_.isEmpty(customOptAuth) || customOptAuth.FILE) && ( )} {(_.isEmpty(customOptAuth) || customOptAuth.RECALC) && ( )} postMessageToParent("log", record) } ] }} placement="bottomRight" > )} ) : ( <> {selectedKey === "getAnnualbonusstrategyList" && ( )} {selectedKey === "getAnnualbonusaddupList" && ( )} ); } } ]; } else if (type === "dataAcquisition") { const { isSpecial } = extraParams as { isSpecial: boolean }; return [ ..._.map(initialState, (g) => { let col = { ...g, ellipsis: true, width: 110 }; switch (g.dataIndex) { case "username": case "departmentName": col = { ...col, fixed: true }; break; case "taxAgentName": col = { ...col, fixed: true, width: 180 }; break; case "mobile": col = { ...col, width: 125 }; break; case "operate": col = { ...col, width: 176, 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) } ]; (isSpecial || !record?.opts.includes("admin")) && items.shift(); return ( {record?.opts.includes("admin") && ( )} {isSpecial && record?.opts.includes("admin") ? ( ) : ( )}