考试安排二次提示修改

main
hujunpeng 3 months ago
parent 6378a17782
commit f32019c4af
  1. 74
      packages/examination/src/views/exam-online/compoents/ExamListPage.tsx

@ -90,18 +90,37 @@ const ExamListPage = ({ history }: { history: any }) => {
// 批量删除 // 批量删除
const handleDeleteSelected = async () => { const handleDeleteSelected = async () => {
const ids = selectedRows.map((value) => { return String(value) }); const ids = selectedRows.map((value) => { return String(value) });
const res = await doDelete(ids); if (ids ===null || ids.length === 0) {
message.warning('请选择要删除的考试');
return;
}
Modal.confirm({
title: '确认删除',
content: '你确定要删除这些选中的考试吗?',
onOk: () => {
const res = doDelete(ids);
if (!res) { if (!res) {
return; return;
} }
research(); research();
},
onCancel: () => {
},
});
}; };
// 批量撤回 // 批量撤回
const handleWithdrawSelected = async () => { const handleWithdrawSelected = async () => {
const selectedExams = currentPageExamList.filter(exam => selectedRows.includes(exam.examId)); const selectedExams = currentPageExamList.filter(exam => selectedRows.includes(exam.examId));
if (selectedExams ===null || selectedExams.length === 0) {
message.warning('请选择要撤回的考试');
return;
}
Modal.confirm({
title: '确认撤回',
content: '你确定要撤回这些选中的考试吗?',
onOk: () => {
const hasWithdrawn = selectedExams.some(exam => exam.publishStatus === 0 || exam.publishStatus === 2); const hasWithdrawn = selectedExams.some(exam => exam.publishStatus === 0 || exam.publishStatus === 2);
if (hasWithdrawn) { if (hasWithdrawn) {
const confirm = window.confirm('选中数据当中有无法撤回的数据,是否继续'); const confirm = window.confirm('选中数据当中有无法撤回的数据,是否继续');
if (!confirm) { if (!confirm) {
@ -114,19 +133,30 @@ const ExamListPage = ({ history }: { history: any }) => {
const validIds = validExams.map(exam => String(exam.examId)); const validIds = validExams.map(exam => String(exam.examId));
if (validIds.length > 0) { if (validIds.length > 0) {
const res = await doCancel(validIds); const res = doCancel(validIds);
if (!res) { if (!res) {
return; return;
} }
research(); research();
} }
},
onCancel: () => {
},
});
}; };
// 批量发布 // 批量发布
const handlePublishSelected = async () => { const handlePublishSelected = async () => {
const selectedExams = currentPageExamList.filter(exam => selectedRows.includes(exam.examId)); const selectedExams = currentPageExamList.filter(exam => selectedRows.includes(exam.examId));
if (selectedExams ===null || selectedExams.length === 0) {
message.warning('请选择要发布的考试');
return;
}
Modal.confirm({
title: '确认发布',
content: '你确定要发布这些选中的考试吗?',
onOk: () => {
const hasPublishedOrWithdrawn = selectedExams.some(exam => exam.publishStatus === 1 || exam.publishStatus === 2); const hasPublishedOrWithdrawn = selectedExams.some(exam => exam.publishStatus === 1 || exam.publishStatus === 2);
if (hasPublishedOrWithdrawn) { if (hasPublishedOrWithdrawn) {
const confirm = window.confirm('选中数据当中有无法发布的数据,是否继续'); const confirm = window.confirm('选中数据当中有无法发布的数据,是否继续');
if (!confirm) { if (!confirm) {
@ -139,12 +169,16 @@ const ExamListPage = ({ history }: { history: any }) => {
const validIds = validExams.map(exam => String(exam.examId)); const validIds = validExams.map(exam => String(exam.examId));
if (validIds.length > 0) { if (validIds.length > 0) {
const res = await doPublish(validIds); const res = doPublish(validIds);
if (!res) { if (!res) {
return; return;
} }
research(); research();
} }
},
onCancel: () => {
},
});
}; };
// 新增考试 // 新增考试
@ -179,32 +213,56 @@ const ExamListPage = ({ history }: { history: any }) => {
// 发布 // 发布
const handlePublishSingle = async (examId: number) => { const handlePublishSingle = async (examId: number) => {
Modal.confirm({
title: '确认发布',
content: '你确定要发布这个考试吗?',
onOk: () => {
const ids = [String(examId)]; const ids = [String(examId)];
const res = await doPublish(ids); const res = doPublish(ids);
if (!res) { if (!res) {
return; return;
} }
research(); research();
},
onCancel: () => {
},
});
}; };
// 撤回 // 撤回
const handleWithdrawSingle = async (examId: number) => { const handleWithdrawSingle = async (examId: number) => {
Modal.confirm({
title: '确认撤回',
content: '你确定要撤回这个考试吗?',
onOk: () => {
const ids = [String(examId)]; const ids = [String(examId)];
const res = await doCancel(ids); const res = doCancel(ids);
if (!res) { if (!res) {
return; return;
} }
research(); research();
},
onCancel: () => {
},
});
}; };
// 删除 // 删除
const handleDeleteSingle = async (examId: number) => { const handleDeleteSingle = async (examId: number) => {
Modal.confirm({
title: '确认删除',
content: '你确定要删除这个考试吗?',
onOk: () => {
const ids = [String(examId)]; const ids = [String(examId)];
const res = await doDelete(ids); const res = doDelete(ids);
if (!res) { if (!res) {
return; return;
} }
research(); research();
},
onCancel: () => {
},
});
}; };
// 页面重新查询 // 页面重新查询

Loading…
Cancel
Save