master
This commit is contained in:
parent
fc48c2c20d
commit
7152e7e889
|
|
@ -6,6 +6,7 @@ import { renderCols } from "@/pages/unitTable/renderColsOpts";
|
|||
import styles from "./index.less";
|
||||
|
||||
const UnitTable: FC = (props) => {
|
||||
const [unitTableType, setUnitTableType] = useState<string>("");
|
||||
const [columns, setColumns] = useState<Array<any>>([]);
|
||||
const [dataSource, setDataSource] = useState<Array<any>>([]);
|
||||
const [pageInfo, setPageInfo] = useState<Partial<PaginationData>>({});
|
||||
|
|
@ -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 <Table rowKey="id" className={styles.multi_fun_table} dataSource={dataSource} size="middle"
|
||||
columns={renderCols(columns, "welfareRecord", i18n, permission)}
|
||||
columns={renderCols(columns, unitTableType, i18n, permission)}
|
||||
scroll={{ x: 1200, y: `calc(100vh - ${scrollHeight || 109}px)` }}
|
||||
pagination={!_.isNil(pageInfo) ? {
|
||||
...paginationAction(pageInfo, i18n, onChange),
|
||||
|
|
|
|||
|
|
@ -96,6 +96,47 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject,
|
|||
);
|
||||
}
|
||||
}];
|
||||
} else if (type === "bonusplan") {
|
||||
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 (<Button type="link"
|
||||
onClick={() => postMessageToParent(billStatus === "0" ? "CALC" : "VIEW", record)}>{text}</Button>);
|
||||
}
|
||||
};
|
||||
break;
|
||||
case "billStatus":
|
||||
col = {
|
||||
...col, width: 100, render: (text: string) => (
|
||||
<Text style={{ maxWidth: "100%" }} ellipsis>
|
||||
{text === "1" ? i18n?.["已归档"] : i18n?.["未归档"]}
|
||||
</Text>
|
||||
)
|
||||
};
|
||||
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]);
|
||||
|
|
|
|||
Loading…
Reference in New Issue