|
|
|
@ -111,6 +111,10 @@ const ExamListPage = ({ history }: { history: any }) => { |
|
|
|
|
if (!res) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
message.open({ |
|
|
|
|
type: 'success', |
|
|
|
|
content: '操作成功', |
|
|
|
|
}); |
|
|
|
|
research(); |
|
|
|
|
}).catch(() => { }) |
|
|
|
|
}, |
|
|
|
@ -132,9 +136,28 @@ const ExamListPage = ({ history }: { history: any }) => { |
|
|
|
|
onOk: () => { |
|
|
|
|
const hasWithdrawn = selectedExams.some(exam => exam.publishStatus === 0 || exam.publishStatus === 2); |
|
|
|
|
if (hasWithdrawn) { |
|
|
|
|
const confirm = window.confirm('选中数据当中有无法撤回的数据,是否继续'); |
|
|
|
|
if (!confirm) { |
|
|
|
|
return; |
|
|
|
|
let warn1Arr = selectedExams.filter(exam => exam.publishStatus === 0); |
|
|
|
|
if (warn1Arr && warn1Arr.length) { |
|
|
|
|
let warnMessage = []; |
|
|
|
|
for (let index = 0; index < warn1Arr.length; index ++) { |
|
|
|
|
warnMessage.push(warn1Arr[index].examName); |
|
|
|
|
} |
|
|
|
|
message.open({ |
|
|
|
|
type: 'warning', |
|
|
|
|
content: '操作失败:' + warnMessage.join('、') + '禁止撤回', |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let warn2Arr = selectedExams.filter(exam => exam.publishStatus === 2); |
|
|
|
|
if (warn2Arr && warn2Arr.length) { |
|
|
|
|
let warnMessage = []; |
|
|
|
|
for (let index = 0; index < warn2Arr.length; index ++) { |
|
|
|
|
warnMessage.push(warn2Arr[index].examName); |
|
|
|
|
} |
|
|
|
|
message.open({ |
|
|
|
|
type: 'warning', |
|
|
|
|
content: '操作失败:' + warnMessage.join('、') + '数据已撤回', |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -147,6 +170,10 @@ const ExamListPage = ({ history }: { history: any }) => { |
|
|
|
|
if (!res) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
message.open({ |
|
|
|
|
type: 'success', |
|
|
|
|
content: '操作成功', |
|
|
|
|
}); |
|
|
|
|
research(); |
|
|
|
|
}).catch(() => { }) |
|
|
|
|
} |
|
|
|
@ -167,16 +194,24 @@ const ExamListPage = ({ history }: { history: any }) => { |
|
|
|
|
title: '确认发布', |
|
|
|
|
content: '你确定要发布这些选中的考试吗?', |
|
|
|
|
onOk: () => { |
|
|
|
|
const hasPublishedOrWithdrawn = selectedExams.some(exam => exam.publishStatus === 1 || exam.publishStatus === 2); |
|
|
|
|
const hasPublishedOrWithdrawn = selectedExams.some(exam => exam.publishStatus === 1); |
|
|
|
|
if (hasPublishedOrWithdrawn) { |
|
|
|
|
const confirm = window.confirm('选中数据当中有无法发布的数据,是否继续'); |
|
|
|
|
if (!confirm) { |
|
|
|
|
return; |
|
|
|
|
let warn1Arr = selectedExams.filter(exam => exam.publishStatus === 1); |
|
|
|
|
if (warn1Arr && warn1Arr.length) { |
|
|
|
|
let warnMessage = []; |
|
|
|
|
for (let index = 0; index < warn1Arr.length; index ++) { |
|
|
|
|
warnMessage.push(warn1Arr[index].examName); |
|
|
|
|
} |
|
|
|
|
message.open({ |
|
|
|
|
type: 'warning', |
|
|
|
|
content: '操作失败:' + warnMessage.join('、') + '数据已发布', |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 筛选出可以发布的数据
|
|
|
|
|
const validExams = selectedExams.filter(exam => exam.publishStatus === 0); |
|
|
|
|
const validExams = selectedExams.filter(exam => exam.publishStatus === 0 || exam.publishStatus === 2); |
|
|
|
|
const validIds = validExams.map(exam => String(exam.examId)); |
|
|
|
|
|
|
|
|
|
if (validIds.length > 0) { |
|
|
|
@ -184,6 +219,10 @@ const ExamListPage = ({ history }: { history: any }) => { |
|
|
|
|
if (!res) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
message.open({ |
|
|
|
|
type: 'success', |
|
|
|
|
content: '操作成功', |
|
|
|
|
}); |
|
|
|
|
research(); |
|
|
|
|
}).catch(() => { }) |
|
|
|
|
} |
|
|
|
@ -231,8 +270,9 @@ const ExamListPage = ({ history }: { history: any }) => { |
|
|
|
|
const handleGenerateQrCode = (exam: any) => { |
|
|
|
|
// 实现生成考试码逻辑
|
|
|
|
|
setExamId(exam.examId); |
|
|
|
|
setQrCodeData(exam.examId); |
|
|
|
|
setQrCodeData(exam.path ? exam.path : exam.examId); |
|
|
|
|
setExamName(exam.examName); |
|
|
|
|
debugger |
|
|
|
|
if (exam.captcha) { |
|
|
|
|
setCaptcha(exam.captcha); |
|
|
|
|
} else { |
|
|
|
@ -319,7 +359,7 @@ const ExamListPage = ({ history }: { history: any }) => { |
|
|
|
|
// 判断是否全选
|
|
|
|
|
const isAllSelected = currentPageExamList.length > 0 && selectedRows.length === currentPageExamList.length; |
|
|
|
|
|
|
|
|
|
const columns = [ |
|
|
|
|
const columns: any = [ |
|
|
|
|
{ |
|
|
|
|
title: ( |
|
|
|
|
<Checkbox |
|
|
|
@ -329,6 +369,7 @@ const ExamListPage = ({ history }: { history: any }) => { |
|
|
|
|
), |
|
|
|
|
dataIndex: 'examId', |
|
|
|
|
key: 'examId', |
|
|
|
|
align: 'center', |
|
|
|
|
render: (cellValue: number, record: Exam) => ( |
|
|
|
|
<Checkbox |
|
|
|
|
checked={selectedRows.includes(record.examId)} |
|
|
|
@ -420,7 +461,7 @@ const ExamListPage = ({ history }: { history: any }) => { |
|
|
|
|
> |
|
|
|
|
生成考试码 |
|
|
|
|
</a>)} |
|
|
|
|
{record.publishStatus === 0 || record.publishStatus === 2 && ( |
|
|
|
|
{(record.publishStatus === 0 || record.publishStatus === 2) && ( |
|
|
|
|
<a onClick={() => handlePublishSingle(record.examId)}>发布</a> |
|
|
|
|
)} |
|
|
|
|
{record.publishStatus === 1 && ( |
|
|
|
|