diff --git a/src/api/courseware/index.js b/src/api/courseware/index.js
index 0d9bef3..bbc9c1c 100644
--- a/src/api/courseware/index.js
+++ b/src/api/courseware/index.js
@@ -120,6 +120,18 @@ export const classRemove = declareRequest(
"Post > @/safetyEval/classManagement/delete",
);
+/** 班级延期 */
+export const classDelay = declareRequest(
+ "classDelayLoading",
+ "Post > @/safetyEval/classManagement/delay",
+);
+
+/** 班级完成(申请开班) */
+export const classComplete = declareRequest(
+ "classCompleteLoading",
+ "Post > @/safetyEval/classManagement/complete",
+);
+
/** 绑定试卷(请求体:{ id, paperId, paperType, examMinutes }) */
export const classBindPaper = declareRequest(
"classBindPaperLoading",
diff --git a/src/pages/Container/EduTraining/ClassManage/Add/index.js b/src/pages/Container/EduTraining/ClassManage/Add/index.js
index db60bb1..627535d 100644
--- a/src/pages/Container/EduTraining/ClassManage/Add/index.js
+++ b/src/pages/Container/EduTraining/ClassManage/Add/index.js
@@ -6,6 +6,7 @@ import {
Form,
Input,
InputNumber,
+ Modal,
Radio,
Row,
Select,
@@ -18,7 +19,7 @@ import dayjs from "dayjs";
import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout";
import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { tools } from "@cqsjjb/jjb-common-lib";
-import { NS_COURSEWARE } from "~/enumerate/namespace";
+import { NS_COURSEWARE, NS_ORG_INFO } from "~/enumerate/namespace";
import {
CLASS_UNIT_TYPE_OPTIONS,
CLASS_YES_NO_OPTIONS,
@@ -35,27 +36,50 @@ function ClassAddPage(props) {
const [form] = Form.useForm();
/** 已保存的班级 id:有值时解锁学员/课程 Tab */
const [savedClassId, setSavedClassId] = useState(router.query.classId);
+ const [orgOptions, setOrgOptions] = useState([]);
+ const [activeTab, setActiveTab] = useState("base");
const isEdit = !!router.query.classId;
+ const [classStatus, setClassStatus] = useState(isEdit ? undefined : 0);
const unlocked = !!savedClassId;
const confirmLoading = props.courseware?.classConfirmLoading;
+ const completeLoading = props.courseware?.classCompleteLoading;
const detailLoading = props.courseware?.classDetailLoading;
/** 是否开启考试:选否时隐藏其余考试相关字段 */
const openExam = Form.useWatch("openExam", form);
+ const handleUnitChange = (unitId) => {
+ const target = orgOptions.find((item) => item.value === unitId);
+ form.setFieldValue("unitName", target?.label);
+ };
+
useEffect(() => {
- if (!isEdit) return;
(async () => {
+ const orgRes = await props.registeredOrgList({ current: 1, size: 200, state: 0 });
+ const list = orgRes?.data || [];
+ const options = list.map((item) => ({
+ label: item.unitName,
+ value: item.id,
+ }));
+ setOrgOptions(options);
+
+ if (!isEdit) return;
const res = await props.classDetail({ id: router.query.classId });
if (res?.success !== false && res?.data) {
const data = res.data;
+ let unitId = data.unitId;
+ if (!unitId && data.unitName) {
+ unitId = options.find((item) => item.label === data.unitName)?.value;
+ }
form.setFieldsValue({
...data,
+ unitId,
trainingDateRange:
data.startDate && data.endDate
? [dayjs(data.startDate), dayjs(data.endDate)]
: undefined,
});
+ setClassStatus(data.status);
} else {
props.history.goBack();
}
@@ -90,6 +114,21 @@ function ClassAddPage(props) {
}
};
+ const handleComplete = () => {
+ Modal.confirm({
+ title: "提示",
+ content: "完成之后将开班,不能再进行其它更改,确认继续吗?",
+ okText: "确定",
+ cancelText: "取消",
+ onOk: async () => {
+ const res = await props.classComplete({ id: savedClassId });
+ if (res?.success === false) return;
+ message.success("完成成功");
+ props.history.goBack();
+ },
+ });
+ };
+
return (
保存
+ {activeTab === "course" && unlocked && classStatus === 0 && (
+
+ )}
}
>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
{
/** 教育培训 — 班级管理 */
function ClassManagePage(props) {
const [searchForm] = Form.useForm();
+ const [delayForm] = Form.useForm();
+ const [delayOpen, setDelayOpen] = useState(false);
+ const [delayRecord, setDelayRecord] = useState(null);
const { courseware } = props;
const { classList, classTotal: total, classLoading: loading } =
courseware || {};
+ const delayLoading = courseware?.classDelayLoading;
const handleSearch = () => {
props.classPage(router.query);
@@ -75,6 +79,30 @@ function ClassManagePage(props) {
});
};
+ const openDelayModal = (record) => {
+ setDelayRecord(record);
+ delayForm.setFieldsValue({
+ delayTime: record.endDate ? dayjs(record.endDate) : dayjs(),
+ });
+ setDelayOpen(true);
+ };
+
+ const handleDelayOk = async () => {
+ try {
+ const values = await delayForm.validateFields();
+ const res = await props.classDelay({
+ id: delayRecord.id,
+ delayTime: values.delayTime.format("YYYY-MM-DD"),
+ });
+ if (res?.success === false) return;
+ message.success("延期成功");
+ setDelayOpen(false);
+ handleSearch();
+ } catch {
+ // 表单校验失败
+ }
+ };
+
const columns = [
{
title: "序号",
@@ -156,23 +184,24 @@ function ClassManagePage(props) {
编辑
- {record.status === 2 && (
+ {record.status === 0 ? (
+
+ ) : (
)}
-
),
},
@@ -263,6 +292,30 @@ function ClassManagePage(props) {
},
}}
/>
+
+ setDelayOpen(false)}
+ onOk={handleDelayOk}
+ confirmLoading={delayLoading}
+ destroyOnHidden
+ >
+
+
+ current && current.startOf("day").isBefore(dayjs().startOf("day"))
+ }
+ />
+
+
+
);
}
diff --git a/src/pages/Container/EduTraining/CourseManage/List/index.js b/src/pages/Container/EduTraining/CourseManage/List/index.js
index e948384..531097c 100644
--- a/src/pages/Container/EduTraining/CourseManage/List/index.js
+++ b/src/pages/Container/EduTraining/CourseManage/List/index.js
@@ -98,13 +98,15 @@ function CourseManagePage(props) {
>
查看
-
+ {record.used !== 1 && (
+
+ )}