From d0e8c7cb64d7d219f7cfec8bc87cf699b9cfe7b2 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 08 十一月 2022 12:35:25 +0800 Subject: [PATCH] 2022-11-08 --- src/menu/components/table/base-table/columns/index.jsx | 35 ++++++++++++++++++++++++++++++++--- 1 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/menu/components/table/base-table/columns/index.jsx b/src/menu/components/table/base-table/columns/index.jsx index 3aa43cd..cea83cd 100644 --- a/src/menu/components/table/base-table/columns/index.jsx +++ b/src/menu/components/table/base-table/columns/index.jsx @@ -12,7 +12,7 @@ import './index.scss' const { confirm } = Modal -const EditColumn = asyncIconComponent(() => import('./editColumn')) +const EditColumn = asyncComponent(() => import('./editColumn')) const MarkColumn = asyncIconComponent(() => import('@/menu/components/share/markcomponent')) const CardCellComponent = asyncComponent(() => import('@/menu/components/card/cardcellcomponent')) const PasteComponent = asyncIconComponent(() => import('@/components/paste')) @@ -576,6 +576,16 @@ } const columns = this.handlecolumns(this.state.columns, fields, config) + let groups = null + if (columns.length > 12) { + let g = Math.ceil(columns.length / 8) + let n = Math.ceil(columns.length / g) + groups = [] + + for (let i = 0, len = columns.length; i < len; i += n) { + groups.push(columns.slice(i, i + n)) + } + } return ( <div className={`normal-table-columns ${config.setting.laypage} ${config.wrap.tableType} ${config.wrap.mode || ''}`} id={tableId}> @@ -585,10 +595,29 @@ <MarkColumn columns={fields} type="line" marks={lineMarks} onSubmit={this.updateLineMarks} /> </div> <DndProvider> + {groups ? groups.map((group, i) => { + return <Table + key={i} + rowKey="uuid" + size={config.wrap.size || 'middle'} + bordered={config.wrap.bordered !== 'false'} + components={components} + dataSource={this.state.data} + rowSelection={config.wrap.tableType && i === 0 ? { type: 'radio' } : null} + columns={group} + pagination={i === groups.length - 1 ? { + current: 1, + pageSize: 10, + pageSizeOptions: ['10', '25', '50', '100', '500', '1000'], + showSizeChanger: true, + total: 58, + showTotal: (total, range) => `${range[0]}-${range[1]} 鍏� ${total} 鏉 + } : false} + /> + }) : <Table rowKey="uuid" size={config.wrap.size || 'middle'} - rowClassName="editable-row" bordered={config.wrap.bordered !== 'false'} components={components} dataSource={this.state.data} @@ -602,7 +631,7 @@ total: 58, showTotal: (total, range) => `${range[0]}-${range[1]} 鍏� ${total} 鏉 }} - /> + />} </DndProvider> <EditColumn column={card} fields={fields} submitCol={this.submitCol} cancelCol={this.cancelCol}/> </div> -- Gitblit v1.8.0