Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
zhoubichuan committed Oct 31, 2023
1 parent 8ded6ab commit 681a41a
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 21 deletions.
48 changes: 41 additions & 7 deletions src/pages/list/list/index.less
Original file line number Diff line number Diff line change
@@ -1,13 +1,47 @@
@import '~antd/es/style/themes/default.less';

.pro-table {
.pro-container {
:global {
.ant-table-container {
height: 100%;
.ant-table-body {
width: 100%;
height: calc(100% - 47px);
overflow: auto;
.ant-pro-grid-content {
.ant-pro-grid-content-children {
height: calc(100vh - 163px);
.ant-pro-layout-watermark-wrapper {
height: 100%;
.ant-pro-page-container-children-content {
height: 100%;
.ant-pro-table {
display: flex;
flex-direction: column;
height: 100%;
.ant-pro-card {
flex: 1;
height: 100%;
.ant-pro-card-body {
.ant-table-wrapper {
height: calc(100% - 64px);
.ant-spin-nested-loading {
height: 100%;
.ant-spin-container {
height: 100%;
.ant-table {
height: calc(100% - 24px);
.ant-table-container {
height: 100%;
.ant-table-body {
width: 100%;
height: calc(100% - 47px);
overflow: auto;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
Expand Down
17 changes: 9 additions & 8 deletions src/pages/list/list/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PlusOutlined, CloseOutlined } from '@ant-design/icons';
import { Button, message, Drawer, Upload, Image, Modal } from 'antd';
import { Button, message, Drawer, Upload, Image, Modal, Select } from 'antd';
import React, { useState, useRef, useEffect } from 'react';
import { PageContainer } from '@ant-design/pro-layout';
import type { ProColumns, ActionType } from '@ant-design/pro-table';
Expand Down Expand Up @@ -195,6 +195,13 @@ const TableList: React.FC = () => {
...templateData.map((item: any) => ({
...item,
...item.table,
renderFormItem: () => {
if (item.search && item.search.type === 'select') {
return <ProFormSelect name={item.dataIndex} options={item.search.data} />;
} else {
return <ProFormText name={item.dataIndex} />;
}
},
render: (dom: any) => {
if (!item.hideInTable && item.table && item.table.type === 'image') {
if (Array.isArray(dom)) {
Expand Down Expand Up @@ -303,11 +310,7 @@ const TableList: React.FC = () => {
});
return (
<PageContainer
style={{
height: `calc(100vh - 208px)`,
display: 'flex',
flexDirection: 'column',
}}
className={classNames('pro-container', styles['pro-container'])}
onTabChange={handleOnTabChange}
header={{
title: false,
Expand Down Expand Up @@ -350,8 +353,6 @@ const TableList: React.FC = () => {
tabActiveKey={tabActiveKey}
>
<ProTable<TableListItem, TableListPagination>
className={classNames('pro-table', styles['pro-table'])}
style={{ height: '100%' }}
sticky
actionRef={actionRef}
ghost={true}
Expand Down
21 changes: 15 additions & 6 deletions src/pages/list/template/1.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
"dataIndex": "type",
"hideInSearch": false,
"hideInTable": false,
"search": {
"type": "select",
"data": [
{ "value": "type", "label": "类型" },
{ "value": "field", "label": "字段" },
{ "value": "data", "label": "数据" }
],
"width": 60
},
"table": {
"type": "select",
"data": [
Expand Down Expand Up @@ -335,7 +344,7 @@
{
"title": "后端增",
"dataIndex": "add",
"hideInSearch": false,
"hideInSearch": true,
"hideInTable": false,
"table": {
"type": "text",
Expand All @@ -352,7 +361,7 @@
{
"title": "后端删",
"dataIndex": "delete",
"hideInSearch": false,
"hideInSearch": true,
"hideInTable": false,
"table": {
"type": "text",
Expand All @@ -369,7 +378,7 @@
{
"title": "后端改",
"dataIndex": "modify",
"hideInSearch": false,
"hideInSearch": true,
"hideInTable": false,
"table": {
"type": "text",
Expand All @@ -386,7 +395,7 @@
{
"title": "后端查",
"dataIndex": "query",
"hideInSearch": false,
"hideInSearch": true,
"hideInTable": false,
"table": {
"type": "text",
Expand All @@ -403,7 +412,7 @@
{
"title": "后端类型",
"dataIndex": "typesof",
"hideInSearch": false,
"hideInSearch": true,
"hideInTable": false,
"table": {
"type": "text",
Expand All @@ -420,7 +429,7 @@
{
"title": "后端默认值",
"dataIndex": "defaults",
"hideInSearch": false,
"hideInSearch": true,
"hideInTable": false,
"table": {
"type": "text",
Expand Down

0 comments on commit 681a41a

Please sign in to comment.