feat(inspection): 添加检查项删除功能
- 在检查列表页面引入 Modal 和 message 组件 - 实现 onDelete 函数处理删除逻辑和确认对话框 - 添加删除按钮仅在状态为 98 时显示 - 删除操作成功后刷新数据并显示成功消息 - 确认对话框包含删除警告信息提示连带隐患删除master
parent
d285774449
commit
21961d1cd8
|
|
@ -1,7 +1,7 @@
|
|||
import { Permission } from "@cqsjjb/jjb-common-decorator/permission";
|
||||
|
||||
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||
import { Button, Form, Space } from "antd";
|
||||
import { Button, Form, Space,Modal,message } from "antd";
|
||||
import { useState } from "react";
|
||||
import AddIcon from "zy-react-library/components/Icon/AddIcon";
|
||||
import Page from "zy-react-library/components/Page";
|
||||
|
|
@ -35,6 +35,20 @@ function List(props) {
|
|||
params: { status: "", planId: query.planId, entrance: query.planId ? "3" : "1", planType: query.planId ? 1 : 0 },
|
||||
});
|
||||
|
||||
const onDelete = (id) => {
|
||||
Modal.confirm({
|
||||
title: "删除确认",
|
||||
content: "是否确认删除?删除后连带隐患同时删除。",
|
||||
onOk: async () => {
|
||||
const { success } = await props["inspectionDelete"]({ id });
|
||||
if (success) {
|
||||
message.success("删除成功");
|
||||
getData();
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<Page isShowAllAction={!!props.headerTitle} headerTitle={props.headerTitle}>
|
||||
<Search
|
||||
|
|
@ -136,6 +150,15 @@ function List(props) {
|
|||
</Button>
|
||||
)
|
||||
}
|
||||
{(record.status === 98) && (
|
||||
<Button
|
||||
type="link"
|
||||
danger
|
||||
onClick={() => onDelete(record.id)}
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
)}
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue