From e65a432f5c9fc11d15d53ae0e16e5f4b7d62400a Mon Sep 17 00:00:00 2001
From: wsj <593216709@qq.com>
Date: Sat, 17 Oct 2026 20:53:17 +0800
Subject: [PATCH] feat: api
---
.claude/skills/new-page/templates/table-page/columns.tsx | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 58 insertions(+), 0 deletions(-)
diff --git a/.claude/skills/new-page/templates/table-page/columns.tsx b/.claude/skills/new-page/templates/table-page/columns.tsx
new file mode 100644
index 0000000..df92d82
--- /dev/null
+++ b/.claude/skills/new-page/templates/table-page/columns.tsx
@@ -0,0 +1,58 @@
+import { Button, Space, Tag } from 'antd';
+import type { ProColumns } from '@ant-design/pro-components';
+import type { XxxRecord, XxxStatus } from './types';
+
+const statusMeta: Record<XxxStatus, { text: string; color: string }> = {
+ active: { text: '启用', color: 'success' },
+ disabled: { text: '停用', color: 'default' },
+};
+
+export const createXxxColumns = (options: {
+ onEdit?: (record: XxxRecord) => void;
+ onDelete: (record: XxxRecord) => void;
+}): ProColumns<XxxRecord>[] => [
+ {
+ title: '名称',
+ dataIndex: 'name',
+ width: 240,
+ fieldProps: { placeholder: '请输入名称' },
+ },
+ {
+ title: '状态',
+ dataIndex: 'status',
+ width: 110,
+ valueEnum: {
+ active: { text: '启用' },
+ disabled: { text: '停用' },
+ },
+ render: (_value, record) => (
+ <Tag color={statusMeta[record.status].color} bordered={false}>
+ {statusMeta[record.status].text}
+ </Tag>
+ ),
+ },
+ {
+ title: '创建时间',
+ dataIndex: 'createdAt',
+ width: 170,
+ search: false,
+ },
+ {
+ title: '操作',
+ key: 'action',
+ valueType: 'option',
+ width: 140,
+ render: (_value, record) => (
+ <Space size={0}>
+ {options.onEdit && (
+ <Button type="link" size="small" onClick={() => options.onEdit?.(record)}>
+ 编辑
+ </Button>
+ )}
+ <Button type="link" size="small" danger onClick={() => options.onDelete(record)}>
+ 删除
+ </Button>
+ </Space>
+ ),
+ },
+];
--
Gitblit v1.9.3