Merge branch 'dev-tmp1' of http://47.92.113.182:3000/cq_anquan/safety-eval-service-frontend into dev-tmp1
commit
4a3a1aba76
|
|
@ -95,6 +95,12 @@ export const courseModify = declareRequest(
|
||||||
"Post > @/safetyEval/courseManagement/modify",
|
"Post > @/safetyEval/courseManagement/modify",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/** 修改课程状态(启用/禁用) */
|
||||||
|
export const courseModifyStatus = declareRequest(
|
||||||
|
"courseLoading",
|
||||||
|
"Post > @/safetyEval/courseManagement/modifyStatus",
|
||||||
|
);
|
||||||
|
|
||||||
/** 分页查询班级 */
|
/** 分页查询班级 */
|
||||||
export const classPage = declareRequest(
|
export const classPage = declareRequest(
|
||||||
"classLoading",
|
"classLoading",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { Badge, Button, Form, Table, message } from "antd";
|
import { Badge, Button, Form, Modal, Table, message } from "antd";
|
||||||
import { PlusOutlined } from "@ant-design/icons";
|
import { PlusOutlined } from "@ant-design/icons";
|
||||||
import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout";
|
import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout";
|
||||||
import TableAction from "@cqsjjb/jjb-react-admin-component/TableAction";
|
import TableAction from "@cqsjjb/jjb-react-admin-component/TableAction";
|
||||||
|
|
@ -33,6 +33,27 @@ function CourseManagePage(props) {
|
||||||
handleSearch();
|
handleSearch();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
/** 启用/禁用 */
|
||||||
|
const onToggleStatus = (record) => {
|
||||||
|
const enabled = record.status === 1;
|
||||||
|
Modal.confirm({
|
||||||
|
title: "提示",
|
||||||
|
content: enabled ? "是否确认禁用该课程?" : "是否确认启用该课程?",
|
||||||
|
okText: "是",
|
||||||
|
cancelText: "否",
|
||||||
|
onOk: async () => {
|
||||||
|
const res = await props.courseModifyStatus({
|
||||||
|
id: record.id,
|
||||||
|
status: enabled ? 0 : 1,
|
||||||
|
});
|
||||||
|
if (res?.success !== false) {
|
||||||
|
message.success("操作成功");
|
||||||
|
handleSearch();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
title: "序号",
|
title: "序号",
|
||||||
|
|
@ -85,10 +106,17 @@ function CourseManagePage(props) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "操作",
|
title: "操作",
|
||||||
width: 180,
|
width: 220,
|
||||||
fixed: "right",
|
fixed: "right",
|
||||||
render: (_, record) => (
|
render: (_, record) => (
|
||||||
<TableAction>
|
<TableAction>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
size="small"
|
||||||
|
onClick={() => onToggleStatus(record)}
|
||||||
|
>
|
||||||
|
{record.status === 1 ? "禁用" : "启用"}
|
||||||
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="link"
|
type="link"
|
||||||
size="small"
|
size="small"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue