|
@@ -47,7 +47,7 @@ const steps = reactive(
|
|
|
{
|
|
|
title: '预划流程完成',
|
|
|
children: [
|
|
|
- { title: '预划流程完成', optional: false, description: '试卷内容和答题卡已确认,可进行考试' },
|
|
|
+ { title: '预划流程完成', optional: false, description: '试卷内容和答题卡已确认,可进行下一步' },
|
|
|
],
|
|
|
},
|
|
|
],
|
|
@@ -155,7 +155,7 @@ const steps = reactive(
|
|
|
{
|
|
|
title: '组卷流程完成',
|
|
|
children: [
|
|
|
- { title: '组卷流程完成', optional: false, description: '试卷内容和答题卡已确认,可进行考试' },
|
|
|
+ { title: '组卷流程完成', optional: false, description: '试卷内容和答题卡已确认,可进行下一步' },
|
|
|
],
|
|
|
},
|
|
|
],
|
|
@@ -266,7 +266,7 @@ const lineList: any[][][] = []
|
|
|
// })
|
|
|
// })
|
|
|
|
|
|
-function handleSwitchGid(id: number) {
|
|
|
+function handleSwitchCurrentStep(id: number) {
|
|
|
currentStep = id
|
|
|
}
|
|
|
|
|
@@ -319,7 +319,10 @@ function routerPush(path: RouteLocationRaw) {
|
|
|
router.push(path)
|
|
|
}
|
|
|
function windowPushState(path: string) {
|
|
|
- window.open(`${location.origin}/${path}`, '_self')
|
|
|
+ // 采取如下方式主要由于chrome下history.back()不会重新load页面
|
|
|
+ sessionStorage.setItem('historyLocation', location.href)
|
|
|
+ // window.open(`${location.origin}/${path}`, '_self')
|
|
|
+ location.replace(`${location.origin}/${path}`)
|
|
|
}
|
|
|
|
|
|
function handleValidTask(currentStep: number, idx: number, idy: number) {
|
|
@@ -387,10 +390,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 +409,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 +421,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 +431,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 +448,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 } = {
|
|
@@ -450,14 +456,22 @@ const TaskEventMap: { [key: string]: () => void } = {
|
|
|
routerPush({ name: 'process-fjct-ze_id-zs_id', params: { ze_id: ykl_lc.ze_id, zs_id: ykl_lc.zs_id } })
|
|
|
},
|
|
|
'预划考号区域': () => {
|
|
|
- windowPushState(`${window.GLOBAL_CONFIG.base}/liankao/dtk/index.html`)
|
|
|
+ windowPushState(`${window.GLOBAL_CONFIG.build}/dtk/index.html`)
|
|
|
},
|
|
|
'制作答题卡': () => {
|
|
|
- windowPushState(`${window.GLOBAL_CONFIG.base}/liankao/dtk/index.html`)
|
|
|
+ windowPushState(`${window.GLOBAL_CONFIG.build}/dtk/index.html`)
|
|
|
},
|
|
|
'考场设置(可选)': () => {
|
|
|
windowPushState(`${window.GLOBAL_CONFIG.base}/exam-room-set.html?id=${ykl_lc.ze_id}`)
|
|
|
},
|
|
|
+ '预划流程完成': async () => {
|
|
|
+ await handleCompleteTaskAuto()
|
|
|
+ currentStep = 1
|
|
|
+ },
|
|
|
+ '组卷流程完成': async () => {
|
|
|
+ await handleCompleteTaskAuto()
|
|
|
+ currentStep = 1
|
|
|
+ },
|
|
|
// 先上传后划块
|
|
|
'答题卡扫描': () => {
|
|
|
window.open(`BozeduYuejuan://${user.value.token},${ykl_lc.ze_id},${window.GLOBAL_CONFIG.yzy},upload_papers`, '_blank')
|
|
@@ -472,48 +486,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: '提示',
|
|
@@ -537,10 +591,10 @@ const TaskEventMap: { [key: string]: () => void } = {
|
|
|
<div class="flex-auto w-1200px m-auto">
|
|
|
<div class="flex flex-auto justify-start divide-x-4 divide-blue-700">
|
|
|
<div class="h-full w-220px">
|
|
|
- <el-steps direction="vertical" :active="gid">
|
|
|
+ <el-steps direction="vertical" :active="currentStep">
|
|
|
<el-step
|
|
|
v-for="({ title, children }, idx) in steps" :key="title" class="cursor-pointer hover:bg-light-600"
|
|
|
- :class="idx === currentStep && 'bg-light-400'" @click="handleSwitchGid(idx)"
|
|
|
+ :class="idx === currentStep && 'bg-light-400'" @click="handleSwitchCurrentStep(idx)"
|
|
|
>
|
|
|
<template #title>
|
|
|
<div class="mb-4 font-normal">
|
|
@@ -587,6 +641,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"
|
|
@@ -625,3 +688,12 @@ const TaskEventMap: { [key: string]: () => void } = {
|
|
|
display: none;
|
|
|
}
|
|
|
</style>
|
|
|
+
|
|
|
+<route>
|
|
|
+ {
|
|
|
+ meta: {
|
|
|
+ title: '考试流程',
|
|
|
+ breadcrumb: true,
|
|
|
+ },
|
|
|
+ }
|
|
|
+</route>
|