|
@@ -155,7 +155,7 @@ const steps = reactive(
|
|
|
{
|
|
|
title: '组卷流程完成',
|
|
|
children: [
|
|
|
- { title: '组卷流程完成', optional: false, description: '试卷内容和答题卡已确认,可进行考试' },
|
|
|
+ { title: '组卷流程完成', optional: false, description: '试卷内容和答题卡已确认,可进行下一步' },
|
|
|
],
|
|
|
},
|
|
|
],
|
|
@@ -387,10 +387,10 @@ function judgeStepCompleted(val: unknown) {
|
|
|
return (!!val) || (typeof val === 'object' && !!(val?.value))
|
|
|
}
|
|
|
|
|
|
-function handleCompleteTask(gid: number, pid: number, cid: number, val?: unknown) {
|
|
|
+function handleCompleteTask(gid: number, pid: number, cid: number, val?: unknown): Promise<any> {
|
|
|
const _ykl_lc_ = JSON.parse(sessionStorage.getItem('ykl_lc')!)
|
|
|
_ykl_lc_.processList[gid][pid][cid] = val || 1
|
|
|
- request({
|
|
|
+ return request({
|
|
|
url: '/yzy/kmksyjlc/save',
|
|
|
data: {
|
|
|
ykl_id,
|
|
@@ -406,8 +406,8 @@ function handleCompleteTask(gid: number, pid: number, cid: number, val?: unknown
|
|
|
grouping: true,
|
|
|
})
|
|
|
sessionStorage.setItem('ykl_lc', JSON.stringify(_ykl_lc_))
|
|
|
-
|
|
|
stepsReactiveMap[gid][pid][cid] = val || 1
|
|
|
+ return res
|
|
|
}
|
|
|
}).catch(() => {
|
|
|
ElMessage({
|
|
@@ -418,7 +418,7 @@ function handleCompleteTask(gid: number, pid: number, cid: number, val?: unknown
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-function handleJumpTask(gid: number, pid: number, idy: number) {
|
|
|
+async function handleJumpTask(gid: number, pid: number, idy: number) {
|
|
|
// todo: 验证任务是否完成
|
|
|
if (judgeStepCompleted(stepsReactiveMap[gid][pid][idy])) {
|
|
|
return ElMessage({
|
|
@@ -428,12 +428,15 @@ function handleJumpTask(gid: number, pid: number, idy: number) {
|
|
|
})
|
|
|
}
|
|
|
// stepsReactiveMap[gid][pid][idy] = 1
|
|
|
- handleCompleteTask(gid, pid, idy)
|
|
|
- if (pid === stepsReactiveMap[gid].length - 1)
|
|
|
- return
|
|
|
- const line = lineList[gid][pid][idy]
|
|
|
- line.setOptions({ color: '#003eee' })
|
|
|
- document.querySelectorAll('.leader-line')[line._id - 1]?.classList.add('z10')
|
|
|
+ const res = await handleCompleteTask(gid, pid, idy)
|
|
|
+ if (res.code === '1') {
|
|
|
+ if (pid !== stepsReactiveMap[gid].length - 1) {
|
|
|
+ const line = lineList[gid][pid][idy]
|
|
|
+ line.setOptions({ color: '#003eee' })
|
|
|
+ document.querySelectorAll('.leader-line')[line._id - 1]?.classList.add('z10')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return res
|
|
|
}
|
|
|
|
|
|
onBeforeRouteLeave(() => {
|
|
@@ -442,7 +445,7 @@ onBeforeRouteLeave(() => {
|
|
|
|
|
|
function handleCompleteTaskAuto() {
|
|
|
const { gid, pid, cid } = JSON.parse(sessionStorage.getItem('StepId')!)
|
|
|
- handleJumpTask(gid, pid, cid)
|
|
|
+ return handleJumpTask(gid, pid, cid)
|
|
|
}
|
|
|
|
|
|
const TaskEventMap: { [key: string]: () => void } = {
|
|
@@ -458,6 +461,10 @@ const TaskEventMap: { [key: string]: () => void } = {
|
|
|
'考场设置(可选)': () => {
|
|
|
windowPushState(`${window.GLOBAL_CONFIG.base}/exam-room-set.html?id=${ykl_lc.ze_id}`)
|
|
|
},
|
|
|
+ '组卷流程完成': async () => {
|
|
|
+ await handleCompleteTaskAuto()
|
|
|
+ currentStep = 1
|
|
|
+ },
|
|
|
// 先上传后划块
|
|
|
'答题卡扫描': () => {
|
|
|
window.open(`BozeduYuejuan://${user.value.token},${ykl_lc.ze_id},${window.GLOBAL_CONFIG.yzy},upload_papers`, '_blank')
|
|
@@ -472,48 +479,88 @@ const TaskEventMap: { [key: string]: () => void } = {
|
|
|
window.open(`BozeduYuejuan://${user.value.token},${ykl_lc.ze_id},${window.GLOBAL_CONFIG.yzy}`, '_blank')
|
|
|
handleCompleteTaskAuto()
|
|
|
},
|
|
|
- '平台接收试卷确认': () => {
|
|
|
- handleCompleteTaskAuto()
|
|
|
+ '平台接收试卷确认': async () => {
|
|
|
+ await handleCompleteTaskAuto()
|
|
|
+ windowPushState(`${window.GLOBAL_CONFIG.base}/marking-answer-sheet-liankao.html?ze_id=${ykl_lc.ze_id}`)
|
|
|
},
|
|
|
'批阅任务分配': () => {
|
|
|
+ windowPushState(`${window.GLOBAL_CONFIG.base}/taskassignment-liankao.html`)
|
|
|
},
|
|
|
'阅卷': () => {
|
|
|
+ windowPushState(`${window.GLOBAL_CONFIG.base}/single-review-liankao.html?ze_id=${ykl_lc.ze_id}`)
|
|
|
},
|
|
|
'成绩发布': () => {
|
|
|
+ let loading = false
|
|
|
+
|
|
|
ElMessageBox.confirm('选择实时发布时需等待浏览器处理结束;正常发布则无需等待', '选择发布成绩的方式', {
|
|
|
confirmButtonText: '实时发布',
|
|
|
cancelButtonText: '正常发布',
|
|
|
type: 'info',
|
|
|
- }).then(() => {
|
|
|
- request({
|
|
|
- url: '/yzy/kmksyjlc/save',
|
|
|
- data: {
|
|
|
- ykl_id,
|
|
|
- yk: {
|
|
|
- ykl_lc: JSON.stringify({
|
|
|
- ...ykl_lc,
|
|
|
- ykl_lc_cjfb: 1,
|
|
|
- }),
|
|
|
- },
|
|
|
- },
|
|
|
- }).then((res) => {
|
|
|
- if (res.code === '1') {
|
|
|
- ElMessage({
|
|
|
- message: '操作成功',
|
|
|
- type: 'success',
|
|
|
- grouping: true,
|
|
|
- })
|
|
|
- ykl_lc.ykl_lc_cjfb = 1
|
|
|
+ distinguishCancelAndClose: true,
|
|
|
+ beforeClose: async (action, instance, done) => {
|
|
|
+ if (action === 'confirm') {
|
|
|
+ // 实时发布
|
|
|
+ console.log('实时发布')
|
|
|
+ instance.confirmButtonLoading = loading = true
|
|
|
+ try {
|
|
|
+ const res0 = await request({
|
|
|
+ url: '/openapi/crontab/datamaker.php',
|
|
|
+ data: {
|
|
|
+ ykl_id,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ if (res0.code !== '1')
|
|
|
+ throw new Error(res0.msg)
|
|
|
+ const res1 = await handleCompleteTaskAuto()
|
|
|
+ if (res1.code !== '1')
|
|
|
+ throw new Error(res1.msg)
|
|
|
+ ykl_lc.ykl_stat_ready = 2
|
|
|
+ ElMessage.success('发布成功')
|
|
|
+ }
|
|
|
+ catch (error) {
|
|
|
+ console.error('发布失败', error)
|
|
|
+ }
|
|
|
+
|
|
|
+ instance.confirmButtonLoading = loading = false
|
|
|
}
|
|
|
- }).catch(() => {
|
|
|
- ElMessage({
|
|
|
- message: '操作失败',
|
|
|
- type: 'error',
|
|
|
- grouping: true,
|
|
|
- })
|
|
|
- })
|
|
|
+ else if (action === 'cancel') {
|
|
|
+ // 正常发布
|
|
|
+ console.log('正常发布')
|
|
|
+ instance.cancelButtonLoading = loading = true
|
|
|
+ try {
|
|
|
+ const res0 = await request({
|
|
|
+ url: '/yzy/kmksyjlc/save',
|
|
|
+ data: {
|
|
|
+ ykl_id,
|
|
|
+ yk: {
|
|
|
+ ykl_sffbcj: 1,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ })
|
|
|
+ if (res0.code !== '1')
|
|
|
+ throw new Error(res0.msg)
|
|
|
+ const res1 = await handleCompleteTaskAuto()
|
|
|
+ if (res1.code !== '1')
|
|
|
+ throw new Error(res1.msg)
|
|
|
+ ykl_lc.ykl_stat_ready = 1
|
|
|
+ ElMessage.success('发布中...')
|
|
|
+ }
|
|
|
+ catch (error) {
|
|
|
+ console.error('发布失败', error)
|
|
|
+ }
|
|
|
+ instance.cancelButtonLoading = loading = false
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ console.log('取消发布')
|
|
|
+ return loading ? ElMessage.warning('发布中,请勿关闭弹窗') : done()
|
|
|
+ }
|
|
|
+ },
|
|
|
})
|
|
|
},
|
|
|
+ '修改成绩': async () => {
|
|
|
+ await handleCompleteTaskAuto()
|
|
|
+ routerPush({ name: 'process-xgcj-id', params: { id: ykl_lc.ze_id } })
|
|
|
+ },
|
|
|
'考试关闭': () => {
|
|
|
ElMessageBox({
|
|
|
title: '提示',
|
|
@@ -587,6 +634,15 @@ const TaskEventMap: { [key: string]: () => void } = {
|
|
|
{{ '跳过' }}
|
|
|
</div>
|
|
|
</template>
|
|
|
+ <template v-else-if="task.title === '成绩发布'">
|
|
|
+ <div
|
|
|
+ class="min-w-60px cursor-pointer rounded bg-light-50 py-3px text-center text-xs"
|
|
|
+ @click="beforeClickTask(currentStep, idx, idy) && (TaskEventMap[task.title] ? TaskEventMap[task.title]() : handleCompleteTaskAuto())"
|
|
|
+ >
|
|
|
+ {{ judgeStepCompleted(stepsReactiveMap[currentStep][idx][idy])
|
|
|
+ ? (ykl_lc.ykl_stat_ready === 1 ? '发布中…' : '已发布') : '成绩发布' }}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
<template v-else>
|
|
|
<div
|
|
|
class="min-w-60px cursor-pointer rounded bg-light-50 py-3px text-center text-xs"
|