From d0339c7f8fde9437b2e83a5aa6458dded7b010f0 Mon Sep 17 00:00:00 2001
From: tangjie <122778500@qq.com>
Date: Tue, 18 Aug 2026 16:16:14 +0800
Subject: [PATCH] fix
---
jjb.config.js | 4 +-
src/api/courseware/index.js | 28 ++
src/enumerate/constant/index.js | 37 ++
.../EduTraining/CoursewareManage/index.js | 419 ++++++++++++++++++
src/pages/Container/EduTraining/index.js | 6 +
.../DepartmentPosition/index.js | 7 +-
src/pages/Container/Layout/menuConfig.js | 13 +
7 files changed, 510 insertions(+), 4 deletions(-)
create mode 100644 src/api/courseware/index.js
create mode 100644 src/pages/Container/EduTraining/CoursewareManage/index.js
create mode 100644 src/pages/Container/EduTraining/index.js
diff --git a/jjb.config.js b/jjb.config.js
index 26af587..16b38ab 100644
--- a/jjb.config.js
+++ b/jjb.config.js
@@ -12,9 +12,9 @@ module.exports = {
// 可通过环境变量覆盖: SAFETY_EVAL_API_HOST=http://192.168.x.x:8095
//API_HOST: "http://localhost:80",
- // API_HOST: "http://192.168.0.134",
+ API_HOST: "http://192.168.0.134",
// API_HOST: "http://192.168.0.150", //太浅
- API_HOST: "https://gbs-gateway.qhdsafety.com",
+ // API_HOST: "https://gbs-gateway.qhdsafety.com",
//API_HOST: "http://192.168.0.103", //huwei
},
production: {
diff --git a/src/api/courseware/index.js b/src/api/courseware/index.js
new file mode 100644
index 0000000..29a565a
--- /dev/null
+++ b/src/api/courseware/index.js
@@ -0,0 +1,28 @@
+import { declareRequest } from "@cqsjjb/jjb-dva-runtime";
+
+/** 教育培训 — 培训课件管理 */
+
+/** 分页查询课件 */
+export const coursewarePage = declareRequest(
+ "coursewareLoading",
+ "Get > /safetyEval/coursewareManagement/page",
+ "coursewareList: [] | res.data || [] & coursewareTotal: 0 | res.total || 0",
+);
+
+/** 新增课件 */
+export const coursewareAdd = declareRequest(
+ "coursewareConfirmLoading",
+ "Post > @/safetyEval/coursewareManagement/save",
+);
+
+/** 修改课件(启用/禁用等) */
+export const coursewareModify = declareRequest(
+ "coursewareLoading",
+ "Post > @/safetyEval/coursewareManagement/modify",
+);
+
+/** 删除课件 */
+export const coursewareRemove = declareRequest(
+ "coursewareLoading",
+ "Post > @/safetyEval/coursewareManagement/delete",
+);
diff --git a/src/enumerate/constant/index.js b/src/enumerate/constant/index.js
index fd9736d..1895c8b 100644
--- a/src/enumerate/constant/index.js
+++ b/src/enumerate/constant/index.js
@@ -621,3 +621,40 @@ export const PROFESSIONAL_MAJOR_MAP = PROFESSIONAL_MAJOR_OPTIONS.reduce(
(acc, cur) => ({ ...acc, [cur.value]: cur.label }),
{},
);
+
+/** 培训类型(教育培训-课件管理,后端暂无枚举,先约定编码) */
+export const COURSEWARE_TRAINING_TYPE_OPTIONS = [
+ { label: "安全生产相关法律法规", value: "SAFETY_LAW" },
+ { label: "安全管理知识", value: "SAFETY_MANAGE" },
+ { label: "安全技能实操", value: "SAFETY_SKILL" },
+ { label: "应急救援能力", value: "EMERGENCY_RESCUE" },
+ { label: "职业健康防护", value: "OCCUPATIONAL_HEALTH" },
+ { label: "事故案例警示", value: "ACCIDENT_CASE" },
+];
+
+export const COURSEWARE_TRAINING_TYPE_MAP = COURSEWARE_TRAINING_TYPE_OPTIONS.reduce(
+ (acc, cur) => ({ ...acc, [cur.value]: cur.label }),
+ {},
+);
+
+/** 课件状态(1启用/0禁用) */
+export const COURSEWARE_STATUS_OPTIONS = [
+ { label: "启用", value: 1 },
+ { label: "禁用", value: 0 },
+];
+
+export const COURSEWARE_STATUS_MAP = {
+ 1: { label: "启用", status: "success" },
+ 0: { label: "禁用", status: "error" },
+};
+
+/** 课件类型(1视频课件/2文档课件) */
+export const COURSEWARE_TYPE_OPTIONS = [
+ { label: "视频课件", value: 1 },
+ { label: "文档课件", value: 2 },
+];
+
+export const COURSEWARE_TYPE_MAP = COURSEWARE_TYPE_OPTIONS.reduce(
+ (acc, cur) => ({ ...acc, [cur.value]: cur.label }),
+ {},
+);
diff --git a/src/pages/Container/EduTraining/CoursewareManage/index.js b/src/pages/Container/EduTraining/CoursewareManage/index.js
new file mode 100644
index 0000000..f4cb485
--- /dev/null
+++ b/src/pages/Container/EduTraining/CoursewareManage/index.js
@@ -0,0 +1,419 @@
+import React, { useEffect, useState } from "react";
+import {
+ Badge,
+ Button,
+ Descriptions,
+ Form,
+ Input,
+ Modal,
+ Radio,
+ Select,
+ Table,
+ message,
+} from "antd";
+import { PlusOutlined } from "@ant-design/icons";
+import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout";
+import TableAction from "@cqsjjb/jjb-react-admin-component/TableAction";
+import ControlWrapper from "@cqsjjb/jjb-react-admin-component/ControlWrapper";
+import SearchForm from "~/components/SearchForm";
+import AttachmentUpload from "~/components/AttachmentUpload";
+import { AntdTableFuncControl } from "@cqsjjb/jjb-common-decorator/antd";
+import { Connect } from "@cqsjjb/jjb-dva-runtime";
+import { tools } from "@cqsjjb/jjb-common-lib";
+import { NS_COURSEWARE } from "~/enumerate/namespace";
+import {
+ COURSEWARE_STATUS_MAP,
+ COURSEWARE_STATUS_OPTIONS,
+ COURSEWARE_TRAINING_TYPE_MAP,
+ COURSEWARE_TRAINING_TYPE_OPTIONS,
+ COURSEWARE_TYPE_MAP,
+ COURSEWARE_TYPE_OPTIONS,
+} from "~/enumerate/constant";
+
+const { router } = tools;
+
+/** 培训课件管理 */
+function CoursewareManagePage(props) {
+ const [searchForm] = Form.useForm();
+ const [viewRecord, setViewRecord] = useState(null);
+ const [addOpen, setAddOpen] = useState(false);
+ const { courseware } = props;
+ const {
+ coursewareList: dataSource,
+ coursewareTotal: total,
+ coursewareLoading: loading,
+ } = courseware || {};
+
+ const handleSearch = () => {
+ props.coursewarePage(router.query);
+ };
+
+ useEffect(() => {
+ searchForm.setFieldsValue(router.query);
+ handleSearch();
+ }, []);
+
+ /** 启用/禁用 */
+ const onToggleStatus = (record) => {
+ const enabled = record.status === 1;
+ Modal.confirm({
+ title: "提示",
+ content: enabled ? "是否确认禁用该课件?" : "是否确认启用该课件?",
+ okText: "是",
+ cancelText: "否",
+ onOk: async () => {
+ const res = await props.coursewareModify({
+ ...record,
+ status: enabled ? 0 : 1,
+ });
+ if (res?.success !== false) {
+ message.success("操作成功");
+ handleSearch();
+ }
+ },
+ });
+ };
+
+ const onDelete = (record) => {
+ Modal.confirm({
+ title: "提示",
+ content: "数据将会删除,您是否确认删除?",
+ okText: "是",
+ cancelText: "否",
+ onOk: async () => {
+ const res = await props.coursewareRemove({ data: record.id });
+ if (res?.success !== false) {
+ message.success("删除成功");
+ handleSearch();
+ }
+ },
+ });
+ };
+
+ const columns = [
+ {
+ title: "序号",
+ width: 70,
+ render: (_, __, index) => {
+ const current = Number(router.query.current) || 1;
+ const size = Number(router.query.size) || 10;
+ return (current - 1) * size + index + 1;
+ },
+ },
+ {
+ title: "课件名称",
+ dataIndex: "coursewareName",
+ width: 240,
+ ellipsis: true,
+ },
+ {
+ title: "培训类型",
+ dataIndex: "trainingType",
+ width: 160,
+ render: (v) => COURSEWARE_TRAINING_TYPE_MAP[v] ?? (v || "-"),
+ },
+ { title: "讲师名称", dataIndex: "lecturerName", width: 110 },
+ { title: "学时", dataIndex: "creditHours", width: 80 },
+ {
+ title: "课件时长",
+ dataIndex: "classHourDuration",
+ width: 100,
+ render: (v) => (v == null ? "-" : `${v}小时`),
+ },
+ { title: "习题数", dataIndex: "exerciseCount", width: 90 },
+ { title: "上传时间", dataIndex: "createTime", width: 170 },
+ {
+ title: "上传单位",
+ dataIndex: "uploadUnit",
+ width: 200,
+ ellipsis: true,
+ },
+ {
+ title: "状态",
+ dataIndex: "status",
+ width: 90,
+ render: (v) => {
+ const item = COURSEWARE_STATUS_MAP[v];
+ return item ? : "-";
+ },
+ },
+ {
+ title: "操作",
+ width: 200,
+ fixed: "right",
+ render: (_, record) => (
+
+
+
+
+
+
+ ),
+ },
+ ];
+
+ return (
+ }
+ onClick={() => setAddOpen(true)}
+ >
+ 新增课件
+
+ }
+ >
+
+
+ ,
+
+
+ ,
+
+
+ ,
+ ]}
+ onReset={(value) => {
+ router.query = { ...value, current: 1, size: 10 };
+ handleSearch();
+ }}
+ onFinish={(value) => {
+ router.query = { ...value, current: 1, size: 10 };
+ handleSearch();
+ }}
+ />
+
+ `共 ${t} 条`,
+ current: Number(router.query.current) || 1,
+ pageSize: Number(router.query.size) || 10,
+ onChange: (page, pageSize) => {
+ router.query = { ...router.query, current: page, size: pageSize };
+ handleSearch();
+ },
+ }}
+ />
+
+ setViewRecord(null)}
+ >
+
+
+ {viewRecord?.coursewareName}
+
+
+ {COURSEWARE_TRAINING_TYPE_MAP[viewRecord?.trainingType]
+ ?? (viewRecord?.trainingType || "-")}
+
+
+ {COURSEWARE_TYPE_MAP[viewRecord?.coursewareType] || "-"}
+
+
+ {viewRecord?.lecturerName || "-"}
+
+
+ {viewRecord?.creditHours ?? "-"}
+
+
+ {viewRecord?.classHourDuration == null
+ ? "-"
+ : `${viewRecord.classHourDuration}小时`}
+
+
+ {viewRecord?.exerciseCount ?? "-"}
+
+
+ {viewRecord?.uploadUnit || "-"}
+
+
+ {viewRecord?.createTime || "-"}
+
+
+ {COURSEWARE_STATUS_MAP[viewRecord?.status]?.label || "-"}
+
+
+ {viewRecord?.coursewareDescription || "-"}
+
+
+
+
+ {
+ setAddOpen(false);
+ props.resetModelState(NS_COURSEWARE, {
+ coursewareConfirmLoading: false,
+ });
+ }}
+ onSuccess={handleSearch}
+ />
+
+ );
+}
+
+/** 新增课件弹窗 */
+function AddCoursewareModal({
+ open,
+ confirmLoading,
+ requestAdd,
+ onCancel,
+ onSuccess,
+}) {
+ const [form] = Form.useForm();
+
+ const handleCancel = () => {
+ form.resetFields();
+ onCancel();
+ };
+
+ const handleSubmit = async () => {
+ try {
+ const values = await form.validateFields();
+ if (values.coursewareDocument?.some?.((f) => f.status === "uploading")) {
+ message.warning("请等待文件上传完成");
+ return;
+ }
+ values.coursewareDocument =
+ values.coursewareDocument
+ ?.map?.((f) => f.url)
+ .filter(Boolean)
+ .join(",") || undefined;
+ const res = await requestAdd(values);
+ if (res?.success !== false) {
+ message.success("新增成功");
+ handleCancel();
+ onSuccess();
+ }
+ } catch {
+ // validation error
+ }
+ };
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+}
+
+export default Connect(
+ [NS_COURSEWARE],
+ true,
+)(AntdTableFuncControl(CoursewareManagePage));
diff --git a/src/pages/Container/EduTraining/index.js b/src/pages/Container/EduTraining/index.js
new file mode 100644
index 0000000..1a1782a
--- /dev/null
+++ b/src/pages/Container/EduTraining/index.js
@@ -0,0 +1,6 @@
+import React from "react";
+
+/** 教育培训模块路由出口 */
+export default function EduTraining(props) {
+ return props.children;
+}
diff --git a/src/pages/Container/EnterpriseInfo/DepartmentPosition/index.js b/src/pages/Container/EnterpriseInfo/DepartmentPosition/index.js
index 8cf70ff..546f6de 100644
--- a/src/pages/Container/EnterpriseInfo/DepartmentPosition/index.js
+++ b/src/pages/Container/EnterpriseInfo/DepartmentPosition/index.js
@@ -588,7 +588,10 @@ function DepartmentPositionPage(props) {
,
+ children: [
+ {
+ key: "/safetyEval/container/EduTraining/CoursewareManage",
+ label: "培训课件管理",
+ icon: ,
+ },
+ ],
+ },
{
key: "/safetyEval/container/InspNoticeManage",
label: "监管通知管理",