Skip to content

Commit

Permalink
数据模型页面布局调整和功能改进
Browse files Browse the repository at this point in the history
- 扩展项目列表每页显示数量至8项。
- 移除项目描述字段,统一使用更新时间作为列表内容展示。
- 为项目卡片添加垂直布局和固定列数的网格系统。
- 修改actions列渲染逻辑,优化个人和团队项目的操作展示。
- 修复项目操作组件的参数传递问题,确保各操作功能正确执行。
  • Loading branch information
www.zerocode.net.cn committed Sep 17, 2024
1 parent b6e164f commit 10cb2bc
Showing 1 changed file with 41 additions and 49 deletions.
90 changes: 41 additions & 49 deletions src/pages/dataModels/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type ProjectItem = {
export default () => {
const [state, setState] = useState<ProjectListProps>({
page: 1,
limit: 6,
limit: 8,
total: 0,
projects: [],
order: "updateTime",
Expand All @@ -67,7 +67,7 @@ export default () => {
total: res.data.total,
projects: res.data.records?.map((m: any) => ({
...m,
avatar: '/logo.svg'
avatar: '/logo.svg',
}))
});
} else {
Expand Down Expand Up @@ -135,8 +135,10 @@ export default () => {
),
],
}}
grid={{ gutter: 2, column: 4 }}
itemLayout="vertical"
rowKey="id"
onRow={(record) => ({
onItem={(record) => ({
onClick: () => openProject(record),
style: { cursor: 'pointer' },
})}
Expand All @@ -162,19 +164,6 @@ export default () => {
dataIndex: 'avatar',
search: false,
},
description: {
dataIndex: 'description',
search: false,
render: (text) => (
<Paragraph
type="secondary"
ellipsis={{ tooltip: true }}
style={{ marginBottom: 0, maxWidth: '350px' }}
>
{text}
</Paragraph>
),
},
subTitle: {
render: (_, row) => (
<Space size={0}>
Expand All @@ -190,42 +179,45 @@ export default () => {
search: false,
},
content: {
dataIndex: 'updateTime',
render: (text) => (
<div key="updateTime" style={{color: '#00000073'}}>{text}</div>
render: (_, record) => (
<Space direction="vertical" size="small" style={{ width: '100%' }}>
<Paragraph
type="secondary"
ellipsis={{ rows: 1, tooltip: true }}
style={{ marginBottom: 0 }}
>
{record.description}
</Paragraph>
<div style={{color: '#00000073'}}>更新时间:{record.updateTime}</div>
</Space>
),
},
actions: {
render: (text, row) => {
const actions = [];

if (row.type === '1') { // Personal project
actions.push(
<RenameProject
fetchProjects={() => fetchProjects(null)}
trigger={'ant'}
project={row}
key={'RenameProject' + row.id}
/>,
<RemoveProject
fetchProjects={() => fetchProjects(null)}
project={row}
key={'RemoveProject' + row.id}
/>
);
} else if (row.type === '2') { // Team project
actions.push(
<ConfigProject
project={row}
type={2}
key={'ConfigProject' + row.id}
/>
);
}

return actions;
},
search: false,
cardActionProps: 'actions',
render: (_, record) => [
record.type === '1' && (
<RenameProject
fetchProjects={() => fetchProjects(null)}
trigger={'ant'}
project={record}
key={'RenameProject' + record.id}
/>
),
record.type === '1' && (
<RemoveProject
fetchProjects={() => fetchProjects(null)}
project={record}
key={'RemoveProject' + record.id}
/>
),
record.type === '2' && (
<ConfigProject
project={record}
type={2}
key={'ConfigProject' + record.id}
/>
),
],
},
}}
/>
Expand Down

0 comments on commit 10cb2bc

Please sign in to comment.