Commit 78fd7303 authored by chenshouchao's avatar chenshouchao

feat: 删除模板完成

parent 7d03e5ab
...@@ -58,6 +58,7 @@ const RESTAPI = { ...@@ -58,6 +58,7 @@ const RESTAPI = {
API_ACTOR_ENV_OPTIONS:`${BACKEND_API_URI_PREFIX}/cpp/actorenv/usableenv`, // 查询用户应用环境下拉 API_ACTOR_ENV_OPTIONS:`${BACKEND_API_URI_PREFIX}/cpp/actorenv/usableenv`, // 查询用户应用环境下拉
API_SAVE_OPERATOR:`${BACKEND_API_URI_PREFIX}/cpp/workflow/custom/actor`, // 保存自定义批流算子 API_SAVE_OPERATOR:`${BACKEND_API_URI_PREFIX}/cpp/workflow/custom/actor`, // 保存自定义批流算子
API_WORKFLOWSPEC_LIST:`${BACKEND_API_URI_PREFIX}/cpp/workbench/product/workflowspec/list`, // 模板列表 所有的 API_WORKFLOWSPEC_LIST:`${BACKEND_API_URI_PREFIX}/cpp/workbench/product/workflowspec/list`, // 模板列表 所有的
API_WORKFLOWSPEC_DELETE:`${BACKEND_API_URI_PREFIX}/cpp/workbench/workflowspec/delete`, // 删除模板
}; };
export default RESTAPI; export default RESTAPI;
...@@ -122,6 +122,16 @@ const saveOperator = (params: any) => { ...@@ -122,6 +122,16 @@ const saveOperator = (params: any) => {
}); });
}; };
// 删除工作流模板
const deleteWorkflowspec = (params: {
id: string
}) => {
return request({
url:`${Api.API_WORKFLOWSPEC_DELETE}`,
method: "delete",
params
});
};
export { export {
...@@ -134,5 +144,6 @@ export { ...@@ -134,5 +144,6 @@ export {
getActorenvDetail, getActorenvDetail,
getActorEnvOptions, getActorEnvOptions,
getWorkflowspecList, getWorkflowspecList,
saveOperator saveOperator,
deleteWorkflowspec
}; };
...@@ -6,25 +6,27 @@ import MySelect from "@/components/mui/MySelect"; ...@@ -6,25 +6,27 @@ import MySelect from "@/components/mui/MySelect";
import Add from "@mui/icons-material/Add"; import Add from "@mui/icons-material/Add";
import CardTable from "@/components/CommonComponents/CardTable"; import CardTable from "@/components/CommonComponents/CardTable";
import useMyRequest from "@/hooks/useMyRequest"; import useMyRequest from "@/hooks/useMyRequest";
import { getWorkflowspecList } from "@/api/resourceCenter"; import { getWorkflowspecList, deleteWorkflowspec } from "@/api/resourceCenter";
// import AddTemplate from "./AddTemplate"; import MyDialog from "@/components/mui/MyDialog";
import templateIcon from "@/assets/resourceCenter/templateIcon.svg"; import templateIcon from "@/assets/resourceCenter/templateIcon.svg";
import { useStores } from "@/store"; import { useStores } from "@/store";
import { toJS } from "mobx"; import { toJS } from "mobx";
import ProductSelect from "@/components/BusinessComponents/ProductSelect"; import ProductSelect from "@/components/BusinessComponents/ProductSelect";
import WorkFlowEdit from "@/views/WorkFlowEdit"; import WorkFlowEdit from "@/views/WorkFlowEdit";
import { useMessage } from "@/components/MySnackbar";
import style from "./index.module.css"; import style from "./index.module.css";
const UserResourcesTemplate = observer(() => { const UserResourcesTemplate = observer(() => {
const [title, setTitle] = useState(""); const [title, setTitle] = useState("");
const Message = useMessage();
const [showAddTemplate, setShowAddTemplate] = useState(false); const [showAddTemplate, setShowAddTemplate] = useState(false);
const [showProductSelect, setShowProductSelect] = useState(false); const [showProductSelect, setShowProductSelect] = useState(false);
const [showDeleteDialog, setShowDeleteDialog] = useState(false);
const [templateId, setTemplateId] = useState(""); const [templateId, setTemplateId] = useState("");
const [product, setProduct] = useState(""); // 搜索列表用 const [product, setProduct] = useState(""); // 搜索列表用
const [productId, setProductId] = useState(""); // 新增模板用 const [productId, setProductId] = useState(""); // 新增模板用
const [list, setList] = useState([]); const [list, setList] = useState([]);
const { productListStore } = useStores(); const { productListStore } = useStores();
console.log(toJS(productListStore));
const getProductName = (productId: string) => { const getProductName = (productId: string) => {
let res = "-"; let res = "-";
toJS(productListStore.productList).forEach((item) => { toJS(productListStore.productList).forEach((item) => {
...@@ -67,6 +69,10 @@ const UserResourcesTemplate = observer(() => { ...@@ -67,6 +69,10 @@ const UserResourcesTemplate = observer(() => {
color: "rgba(138, 144, 153, 1)", color: "rgba(138, 144, 153, 1)",
marginRight: "12px", marginRight: "12px",
}} }}
onClick={() => {
setShowDeleteDialog(true);
setTemplateId(item.id);
}}
></MyButton> ></MyButton>
<MyButton text="查看" variant="outlined"></MyButton> <MyButton text="查看" variant="outlined"></MyButton>
</div> </div>
...@@ -89,6 +95,21 @@ const UserResourcesTemplate = observer(() => { ...@@ -89,6 +95,21 @@ const UserResourcesTemplate = observer(() => {
}); });
}, [run, title, product]); }, [run, title, product]);
const { run: deleteWorkflowspecFn } = useMyRequest(deleteWorkflowspec, {
onSuccess: () => {
Message.success("删除成功");
setShowDeleteDialog(false);
run({
productId: product === "all" ? "" : product,
title,
});
},
});
const deleteConfirm = () => {
deleteWorkflowspecFn({ id: templateId });
};
return ( return (
<div className={style.template}> <div className={style.template}>
<div className={style.top}> <div className={style.top}>
...@@ -147,6 +168,17 @@ const UserResourcesTemplate = observer(() => { ...@@ -147,6 +168,17 @@ const UserResourcesTemplate = observer(() => {
}} }}
></ProductSelect> ></ProductSelect>
)} )}
{showDeleteDialog && (
<MyDialog
onClose={() => setShowDeleteDialog(false)}
onConfirm={() => deleteConfirm()}
open={showDeleteDialog}
isText={true}
title="提示"
>
确定要删除这个模板吗?
</MyDialog>
)}
</div> </div>
); );
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment