提交 ca6810f8 作者: 郁骅焌

提交

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