提交 ca6810f8 作者: 郁骅焌

提交

上级 06ce14bc
......@@ -8,9 +8,9 @@
export default {
dev: {
'/ebd/': {
// target: 'http://47.103.50.109:9051',
target: 'http://47.103.50.109:9051',
// target: 'http://47.103.50.109:9050',
target: 'http://192.168.1.247:8040',
// target: 'http://192.168.1.247:8040',
changeOrigin: true,
pathRewrite: {
'^/ebd': '',
......
import React, { useEffect, useState, useImperativeHandle, useRef } from 'react';
import React, { useEffect, useState, useImperativeHandle, useRef, useMemo } from 'react';
import { ConfigProvider, Table, Card } from 'antd';
import { useFullscreen } from '@umijs/hooks';
import TableSearchForm from '@/components/Common/TableSearchForm';
......@@ -30,6 +30,7 @@ const initState = {
* 8、onMouseLeaveRow
* 9、onContextMenuRow
* 10、toolOptionConfig
* 11、hiddeTool 隐藏工具栏
* 表格工具['reload', 'hiddensearch', 'density', 'fullScreen']
*/
const SageTable = React.forwardRef((props, ref) => {
......@@ -69,6 +70,7 @@ const SageTable = React.forwardRef((props, ref) => {
// 工具相关
toolBarRender: toolBarRenderProps,
toolOptionConfig: toolOptionConfigProps,
hiddeTool = false,
// 其余表格属性
...tableProps
} = props;
......@@ -239,16 +241,32 @@ const SageTable = React.forwardRef((props, ref) => {
const paginationState = paginationProps !== undefined ? paginationProps : tableState.pagination;
const loadingState = loadingProps !== undefined ? loadingProps : loading;
// 是否有序号
const columnsState = columnsProps !== undefined ? columnsProps.slice() : [];
if (hasNumber) {
columnsState.unshift({
title: '序号',
render: (text, record, index) =>
`${(paginationState.current - 1) * paginationState.pageSize + index + 1}`,
align: 'center',
width: 60,
});
// const columnsState = columnsProps !== undefined ? columnsProps.slice() : [];
const getLatestColumnsState = () => {
let columnsState = columnsProps !== undefined ? columnsProps.slice() : [];
// 处理列配置
if (hasNumber) {
columnsState.unshift({
title: '序号',
render: (text, record, index) => {
let serialNumber = 0
if (paginationState) {
serialNumber = `${(paginationState.current - 1) * paginationState.pageSize + index + 1}`
} else {
serialNumber = index + 1
}
return serialNumber
},
align: 'center',
width: 60,
});
}
// 隐藏hidden属性列
columnsState = columnsState.filter(item => !item.hidden)
return columnsState
}
const latestColumnsState = useMemo(() => getLatestColumnsState(), [props.columns, tableState])
const tableSearchFormProps = {
searchFields: searchFieldsProps,
......@@ -363,11 +381,13 @@ const SageTable = React.forwardRef((props, ref) => {
<TableSearchForm ref={tableSearchFormRef} {...tableSearchFormProps} />
)}
<TableTool tableSize={tableSizeState} isFullscreen={isFullscreen} {...tableToolProps} />
{
!hiddeTool ? <TableTool tableSize={tableSizeState} isFullscreen={isFullscreen} {...tableToolProps} /> : null
}
<Table
size={tableSizeState}
columns={columnsState}
columns={latestColumnsState}
dataSource={dataSourceState}
pagination={paginationState}
loading={loadingState}
......
......@@ -120,7 +120,7 @@ const GlobalModel = {
*returnTab({ payload }, { put, select }) {
const globalState = yield select(state => state.global)
dropByCacheKey(payload.closePath)
// dropByCacheKey(payload.closePath)
const tabPanes = globalState.tabPanes.slice()
let removeIndex;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论