feat
parent
f57bb95d40
commit
eab086a874
|
|
@ -17,7 +17,7 @@ const formatVideoDuration = (hours) => {
|
|||
|
||||
/** 班级详情 — 课程 Tab:班级课程查询 */
|
||||
function ClassCourseTab(props) {
|
||||
const { classId } = props;
|
||||
const { classId, history } = props;
|
||||
const [searchForm] = Form.useForm();
|
||||
const [query, setQuery] = useState({ current: 1, size: 10 });
|
||||
const [selectOpen, setSelectOpen] = useState(false);
|
||||
|
|
@ -84,7 +84,7 @@ function ClassCourseTab(props) {
|
|||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
onClick={() => message.info("课程查看功能待接入")}
|
||||
onClick={() => {history.push(`/container/EduTraining/CourseManage/Add?courseId=${record.courseId}&mode=view`)}}
|
||||
>
|
||||
查看
|
||||
</Button>
|
||||
|
|
|
|||
|
|
@ -68,6 +68,8 @@ function ClassPaperConfig(props) {
|
|||
/** 班级已绑定的试卷 id(来自班级详情) */
|
||||
const [paperId, setPaperId] = useState("");
|
||||
const [configOpen, setConfigOpen] = useState(false);
|
||||
/** 新增/编辑试卷弹窗开关 */
|
||||
const [addOpen, setAddOpen] = useState(false);
|
||||
/** 试卷详情/预览弹窗展示的试卷 id */
|
||||
const [previewPaperId, setPreviewPaperId] = useState("");
|
||||
|
||||
|
|
@ -95,18 +97,12 @@ function ClassPaperConfig(props) {
|
|||
|
||||
<PaperConfigModal
|
||||
open={configOpen}
|
||||
classId={classId}
|
||||
paperId={paperId}
|
||||
paper={props.paper}
|
||||
courseware={props.courseware}
|
||||
basicLoading={props.paper?.paperBasicLoading}
|
||||
fetchBasicInfo={props.paperBasicInfo}
|
||||
paperPage={props.paperPage}
|
||||
paperRuleGenerate={props.paperRuleGenerate}
|
||||
coursewarePage={props.coursewarePage}
|
||||
classBindPaper={props.classBindPaper}
|
||||
onPreview={(id) => setPreviewPaperId(id)}
|
||||
onBound={loadClassPaper}
|
||||
onAdd={() => setAddOpen(true)}
|
||||
resetModelState={props.resetModelState}
|
||||
onClose={() => setConfigOpen(false)}
|
||||
/>
|
||||
|
|
@ -120,6 +116,25 @@ function ClassPaperConfig(props) {
|
|||
resetModelState={props.resetModelState}
|
||||
onClose={() => setPreviewPaperId("")}
|
||||
/>
|
||||
|
||||
<PaperAddModal
|
||||
open={addOpen}
|
||||
mode={paperId ? "edit" : "add"}
|
||||
classId={classId}
|
||||
paper={props.paper}
|
||||
courseware={props.courseware}
|
||||
paperPage={props.paperPage}
|
||||
paperRuleGenerate={props.paperRuleGenerate}
|
||||
coursewarePage={props.coursewarePage}
|
||||
classBindPaper={props.classBindPaper}
|
||||
onPreview={(id) => setPreviewPaperId(id)}
|
||||
resetModelState={props.resetModelState}
|
||||
onCancel={() => setAddOpen(false)}
|
||||
onSuccess={() => {
|
||||
setAddOpen(false);
|
||||
loadClassPaper();
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
@ -127,28 +142,20 @@ function ClassPaperConfig(props) {
|
|||
/** 配置试卷弹窗:已绑定时展示试卷信息(查看/编辑/下载),未绑定时提供新增 */
|
||||
function PaperConfigModal({
|
||||
open,
|
||||
classId,
|
||||
paperId,
|
||||
paper,
|
||||
courseware,
|
||||
basicLoading,
|
||||
fetchBasicInfo,
|
||||
paperPage,
|
||||
paperRuleGenerate,
|
||||
coursewarePage,
|
||||
classBindPaper,
|
||||
onPreview,
|
||||
onBound,
|
||||
onAdd,
|
||||
resetModelState,
|
||||
onClose,
|
||||
}) {
|
||||
const [basicInfo, setBasicInfo] = useState(null);
|
||||
const [addOpen, setAddOpen] = useState(false);
|
||||
|
||||
// 打开且有绑定试卷时才查询基本信息;paperId 变化(换绑)后重新查询
|
||||
useEffect(() => {
|
||||
if (!open) {
|
||||
setAddOpen(false);
|
||||
resetModelState?.(NS_PAPER, { paperBasicLoading: false });
|
||||
return;
|
||||
}
|
||||
|
|
@ -187,7 +194,7 @@ function PaperConfigModal({
|
|||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
onClick={() => setAddOpen(true)}
|
||||
onClick={() => onAdd()}
|
||||
>
|
||||
编辑
|
||||
</Button>
|
||||
|
|
@ -224,7 +231,7 @@ function PaperConfigModal({
|
|||
type="primary"
|
||||
icon={<PlusOutlined />}
|
||||
style={{ marginBottom: 12 }}
|
||||
onClick={() => setAddOpen(true)}
|
||||
onClick={() => onAdd()}
|
||||
>
|
||||
新增
|
||||
</Button>
|
||||
|
|
@ -245,25 +252,6 @@ function PaperConfigModal({
|
|||
),
|
||||
}}
|
||||
/>
|
||||
|
||||
<PaperAddModal
|
||||
open={addOpen}
|
||||
mode={paperId ? "edit" : "add"}
|
||||
classId={classId}
|
||||
paper={paper}
|
||||
courseware={courseware}
|
||||
paperPage={paperPage}
|
||||
paperRuleGenerate={paperRuleGenerate}
|
||||
coursewarePage={coursewarePage}
|
||||
classBindPaper={classBindPaper}
|
||||
onPreview={onPreview}
|
||||
resetModelState={resetModelState}
|
||||
onCancel={() => setAddOpen(false)}
|
||||
onSuccess={() => {
|
||||
setAddOpen(false);
|
||||
onBound();
|
||||
}}
|
||||
/>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import SearchForm from "~/components/SearchForm";
|
|||
import TableAction from "@cqsjjb/jjb-react-admin-component/TableAction";
|
||||
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||
import { NS_COURSEWARE } from "~/enumerate/namespace";
|
||||
import StaffViewModal from "~/components/StaffViewModal";
|
||||
import {
|
||||
CLASS_STUDENT_EXAM_STATUS_OPTIONS,
|
||||
CLASS_STUDENT_FACE_AUTH_MAP,
|
||||
|
|
@ -35,6 +36,7 @@ function ClassStudentTab(props) {
|
|||
const [searchForm] = Form.useForm();
|
||||
const [query, setQuery] = useState({ current: 1, size: 10 });
|
||||
const [selectOpen, setSelectOpen] = useState(false);
|
||||
const [viewId, setViewId] = useState("");
|
||||
const {
|
||||
classStudentList: dataSource,
|
||||
classStudentTotal: total,
|
||||
|
|
@ -117,7 +119,9 @@ function ClassStudentTab(props) {
|
|||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
onClick={() => message.info("学员查看功能待接入")}
|
||||
onClick={() => {
|
||||
setViewId(record.fileNumber || record.id);
|
||||
}}
|
||||
>
|
||||
查看
|
||||
</Button>
|
||||
|
|
@ -225,7 +229,11 @@ function ClassStudentTab(props) {
|
|||
},
|
||||
}}
|
||||
/>
|
||||
|
||||
<StaffViewModal
|
||||
open={!!viewId}
|
||||
currentId={viewId}
|
||||
onCancel={() => setViewId("")}
|
||||
/>
|
||||
<StudentSelectModal
|
||||
open={selectOpen}
|
||||
loading={props.courseware?.orgPersonnelLoading}
|
||||
|
|
@ -233,15 +241,16 @@ function ClassStudentTab(props) {
|
|||
dataSource={props.courseware?.orgPersonnelList}
|
||||
total={props.courseware?.orgPersonnelTotal}
|
||||
requestPage={props.orgPersonnelPage}
|
||||
selectedPhones={tableSource.map((item) => item.phone)}
|
||||
tableSource={tableSource}
|
||||
onOk={async (rows) => {
|
||||
// 批量新增班级学员
|
||||
const res = await props.classStudentBatchSave(
|
||||
rows.map(({ userName, deptName, account }) => ({
|
||||
rows.map(({ userName, deptName, account, fileNumber, id }) => ({
|
||||
classId,
|
||||
studentName: userName,
|
||||
department: deptName,
|
||||
phone: account,
|
||||
fileNumber: fileNumber|| id,
|
||||
})),
|
||||
);
|
||||
if (res?.success === false) return;
|
||||
|
|
@ -263,19 +272,21 @@ function StudentSelectModal({
|
|||
dataSource,
|
||||
total,
|
||||
requestPage,
|
||||
selectedPhones,
|
||||
tableSource,
|
||||
onOk,
|
||||
onCancel,
|
||||
}) {
|
||||
const [query, setQuery] = useState({ current: 1, size: 10 });
|
||||
const [keyword, setKeyword] = useState("");
|
||||
const [selectedRows, setSelectedRows] = useState([]);
|
||||
const ids= tableSource.map(item=>item.fileNumber);
|
||||
|
||||
|
||||
const handleSearch = (params) => {
|
||||
setQuery(params);
|
||||
requestPage({
|
||||
...params,
|
||||
employmentStatusCode: 1,
|
||||
...params,
|
||||
employmentStatusCode: 1,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -345,7 +356,7 @@ function StudentSelectModal({
|
|||
preserveSelectedRowKeys: true,
|
||||
selectedRowKeys: selectedRows.map((r) => r.id),
|
||||
getCheckboxProps: (record) => ({
|
||||
disabled: selectedPhones.includes(record.account),
|
||||
disabled: ids.includes(record.fileNumber || record.id),
|
||||
}),
|
||||
onChange: (_, rows) => setSelectedRows(rows),
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ function ClassAddPage(props) {
|
|||
label: "课程",
|
||||
disabled: !unlocked,
|
||||
children: unlocked ? (
|
||||
<CourseTab classId={savedClassId} />
|
||||
<CourseTab classId={savedClassId} history={props.history} />
|
||||
) : null,
|
||||
},
|
||||
]}
|
||||
|
|
|
|||
Loading…
Reference in New Issue