[feat]:[FL-108][表格操作列风格统一]
统一所有表格页面的操作列按钮布局,参考用户管理页面,只保留两个按钮在外展示,其余操作按钮使用纵向省略号进行隐藏。 修改的页面: - tower-models: 编辑、上传图片保留外显,删除移至下拉菜单 - power-lines: 编辑、专业参数保留外显,删除移至下拉菜单 - atp-models: 详情、编辑保留外显,删除移至下拉菜单 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
Button,
|
||||
Card,
|
||||
Col,
|
||||
Dropdown,
|
||||
Form,
|
||||
Input,
|
||||
Modal,
|
||||
@@ -20,7 +21,9 @@ import {
|
||||
Tag,
|
||||
Typography,
|
||||
type CardProps,
|
||||
type MenuProps,
|
||||
} from "antd";
|
||||
import { MoreOutlined } from "@ant-design/icons";
|
||||
import type { ColumnsType } from "antd/es/table";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState, type CSSProperties, type ComponentType } from "react";
|
||||
|
||||
@@ -367,38 +370,57 @@ export default function AtpModelsPage() {
|
||||
{
|
||||
title: "操作",
|
||||
key: "actions",
|
||||
render: (_, item) => (
|
||||
<Space wrap>
|
||||
<Link href={`/admin/atp-models/${item.id}`}>
|
||||
<Button size="small" type="primary">
|
||||
详情
|
||||
render: (_, item) => {
|
||||
const moreMenuItems: MenuProps["items"] = [
|
||||
{
|
||||
key: "delete",
|
||||
label: "删除",
|
||||
danger: true,
|
||||
disabled: !canManage || deleteMutation.isPending,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<Space wrap>
|
||||
<Link href={`/admin/atp-models/${item.id}`}>
|
||||
<Button size="small" type="primary">
|
||||
详情
|
||||
</Button>
|
||||
</Link>
|
||||
<Button
|
||||
size="small"
|
||||
disabled={!canManage}
|
||||
onClick={() => {
|
||||
setEditingAsset(item);
|
||||
form.setFieldsValue(toFormValues(item));
|
||||
setModalOpen(true);
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
</Button>
|
||||
</Link>
|
||||
<Button
|
||||
size="small"
|
||||
disabled={!canManage}
|
||||
onClick={() => {
|
||||
setEditingAsset(item);
|
||||
form.setFieldsValue(toFormValues(item));
|
||||
setModalOpen(true);
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
</Button>
|
||||
<Popconfirm
|
||||
title="删除模型"
|
||||
description="这会同时删除其版本与运行记录。"
|
||||
okText="删除"
|
||||
cancelText="取消"
|
||||
onConfirm={() => void deleteMutation.mutateAsync(item.id)}
|
||||
disabled={!canManage}
|
||||
>
|
||||
<Button size="small" danger disabled={!canManage}>
|
||||
删除
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
),
|
||||
<Dropdown
|
||||
menu={{
|
||||
items: moreMenuItems,
|
||||
onClick: ({ key }) => {
|
||||
if (key === "delete") {
|
||||
Modal.confirm({
|
||||
title: "删除模型",
|
||||
content: "这会同时删除其版本与运行记录。",
|
||||
okText: "删除",
|
||||
cancelText: "取消",
|
||||
okButtonProps: { danger: true },
|
||||
onOk: () => void deleteMutation.mutateAsync(item.id),
|
||||
});
|
||||
}
|
||||
},
|
||||
}}
|
||||
trigger={["click"]}
|
||||
>
|
||||
<Button size="small" icon={<MoreOutlined />} disabled={!canManage} />
|
||||
</Dropdown>
|
||||
</Space>
|
||||
);
|
||||
},
|
||||
},
|
||||
],
|
||||
[canManage, deleteMutation, form],
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
App,
|
||||
Alert,
|
||||
Button,
|
||||
Dropdown,
|
||||
Empty,
|
||||
Form,
|
||||
Input,
|
||||
@@ -17,7 +18,9 @@ import {
|
||||
Space,
|
||||
Table,
|
||||
Typography,
|
||||
type MenuProps,
|
||||
} from "antd";
|
||||
import { MoreOutlined } from "@ant-design/icons";
|
||||
import type { DefaultOptionType } from "antd/es/select";
|
||||
import type { ColumnsType } from "antd/es/table";
|
||||
import type { CSSProperties } from "react";
|
||||
@@ -1335,38 +1338,57 @@ export default function AdminPowerLinesPage() {
|
||||
{
|
||||
title: "操作",
|
||||
key: "actions",
|
||||
width: 160,
|
||||
width: 120,
|
||||
fixed: "right",
|
||||
render: (_: unknown, row) => (
|
||||
<Space size={8}>
|
||||
{canTowerManage && (
|
||||
<Button size="small" onClick={() => openEditTowerModal(row)}>
|
||||
编辑
|
||||
</Button>
|
||||
)}
|
||||
{canTowerManage && (
|
||||
<Button size="small" onClick={() => openTowerProfileModal(row)}>
|
||||
专业参数
|
||||
</Button>
|
||||
)}
|
||||
{canTowerManage && (
|
||||
<Popconfirm
|
||||
title="删除杆塔"
|
||||
description={`确认删除杆塔 ${row.tower_no} 吗?`}
|
||||
okText="删除"
|
||||
cancelText="取消"
|
||||
okButtonProps={{ danger: true }}
|
||||
onConfirm={async () => {
|
||||
await deleteTowerMutation.mutateAsync(row.id);
|
||||
}}
|
||||
>
|
||||
<Button size="small" danger loading={deleteTowerMutation.isPending}>
|
||||
删除
|
||||
render: (_: unknown, row) => {
|
||||
const moreMenuItems: MenuProps["items"] = [
|
||||
{
|
||||
key: "delete",
|
||||
label: "删除",
|
||||
danger: true,
|
||||
disabled: deleteTowerMutation.isPending,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<Space size="small" wrap>
|
||||
{canTowerManage && (
|
||||
<Button size="small" onClick={() => openEditTowerModal(row)}>
|
||||
编辑
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
)}
|
||||
</Space>
|
||||
),
|
||||
)}
|
||||
{canTowerManage && (
|
||||
<Button size="small" onClick={() => openTowerProfileModal(row)}>
|
||||
专业参数
|
||||
</Button>
|
||||
)}
|
||||
{canTowerManage && (
|
||||
<Dropdown
|
||||
menu={{
|
||||
items: moreMenuItems,
|
||||
onClick: ({ key }) => {
|
||||
if (key === "delete") {
|
||||
Modal.confirm({
|
||||
title: "删除杆塔",
|
||||
content: `确认删除杆塔 ${row.tower_no} 吗?`,
|
||||
okText: "删除",
|
||||
cancelText: "取消",
|
||||
okButtonProps: { danger: true },
|
||||
onOk: async () => {
|
||||
await deleteTowerMutation.mutateAsync(row.id);
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
}}
|
||||
trigger={["click"]}
|
||||
>
|
||||
<Button size="small" icon={<MoreOutlined />} />
|
||||
</Dropdown>
|
||||
)}
|
||||
</Space>
|
||||
);
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import {
|
||||
App,
|
||||
Button,
|
||||
Dropdown,
|
||||
Empty,
|
||||
Form,
|
||||
Input,
|
||||
@@ -19,7 +20,9 @@ import {
|
||||
Table,
|
||||
Tag,
|
||||
Typography,
|
||||
type MenuProps,
|
||||
} from "antd";
|
||||
import { MoreOutlined } from "@ant-design/icons";
|
||||
import type { ColumnsType } from "antd/es/table";
|
||||
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from "react";
|
||||
|
||||
@@ -553,34 +556,53 @@ export default function AdminTowerModelsPage() {
|
||||
{
|
||||
title: "操作",
|
||||
key: "actions",
|
||||
width: 240,
|
||||
width: 120,
|
||||
fixed: "right",
|
||||
render: (_: unknown, row) => (
|
||||
<Space size={8}>
|
||||
{canManage && <Button size="small" onClick={() => openEdit(row)}>编辑</Button>}
|
||||
{canManage && (
|
||||
<Button size="small" onClick={() => setUploadModel(row)}>
|
||||
上传图片
|
||||
</Button>
|
||||
)}
|
||||
{canManage && (
|
||||
<Popconfirm
|
||||
title="删除杆塔模型"
|
||||
description={`确认删除模型 ${row.code} 吗?`}
|
||||
okText="删除"
|
||||
cancelText="取消"
|
||||
okButtonProps={{ danger: true }}
|
||||
onConfirm={async () => {
|
||||
await deleteMutation.mutateAsync(row.id);
|
||||
}}
|
||||
>
|
||||
<Button size="small" danger loading={deleteMutation.isPending}>
|
||||
删除
|
||||
render: (_: unknown, row) => {
|
||||
const moreMenuItems: MenuProps["items"] = [
|
||||
{
|
||||
key: "delete",
|
||||
label: "删除",
|
||||
danger: true,
|
||||
disabled: deleteMutation.isPending,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<Space size="small" wrap>
|
||||
{canManage && <Button size="small" onClick={() => openEdit(row)}>编辑</Button>}
|
||||
{canManage && (
|
||||
<Button size="small" onClick={() => setUploadModel(row)}>
|
||||
上传图片
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
)}
|
||||
</Space>
|
||||
),
|
||||
)}
|
||||
{canManage && (
|
||||
<Dropdown
|
||||
menu={{
|
||||
items: moreMenuItems,
|
||||
onClick: ({ key }) => {
|
||||
if (key === "delete") {
|
||||
Modal.confirm({
|
||||
title: "删除杆塔模型",
|
||||
content: `确认删除模型 ${row.code} 吗?`,
|
||||
okText: "删除",
|
||||
cancelText: "取消",
|
||||
okButtonProps: { danger: true },
|
||||
onOk: async () => {
|
||||
await deleteMutation.mutateAsync(row.id);
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
}}
|
||||
trigger={["click"]}
|
||||
>
|
||||
<Button size="small" icon={<MoreOutlined />} />
|
||||
</Dropdown>
|
||||
)}
|
||||
</Space>
|
||||
);
|
||||
},
|
||||
},
|
||||
],
|
||||
[canManage, deleteMutation, fetchWithAuth, handleImagePreviewError, openEdit],
|
||||
|
||||
Reference in New Issue
Block a user