【新增】监控管理试卷任务监控、细节优化

This commit is contained in:
YOHO\20373
2025-05-12 09:26:40 +08:00
committed by 陆光LG
parent 1278962dc2
commit 12cbdaa78a
38 changed files with 1139 additions and 360 deletions

View File

@@ -87,7 +87,7 @@
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-form-item label="别名排序" prop="sort">
<el-input-number v-model="form.sort" />
</el-form-item>
</el-form>
@@ -223,11 +223,28 @@ const open = async (type: 'create' | 'update', data?: any) => {
sort: undefined,
taskSpecialty: props.taskSpecialty
}
// 清除校验
await nextTick()
const allKeys = getAllTreeKeys(pointOptions.value).map(String)
form.value.pointName = allKeys
treeRef.value?.setCheckedKeys(allKeys)
}
}
function getAllTreeKeys(tree: TreeNode[]): number[] {
const keys: number[] = []
const traverse = (nodes: TreeNode[]) => {
for (const node of nodes) {
keys.push(node.value)
if (node.children?.length) {
traverse(node.children)
}
}
}
// 清除校验
await nextTick()
formRef.value?.clearValidate?.()
traverse(tree)
return keys
}
/** --------- 拉取扁平知识点并建树 --------- **/

View File

@@ -37,7 +37,7 @@
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list">
<el-table-column label="方案ID" align="center" prop="schemeId" />
<!-- <el-table-column label="方案ID" align="center" prop="schemeId" /> -->
<el-table-column label="题型" align="center" prop="spName" />
<el-table-column label="难度" align="center" prop="quLevel">
<template #default="scope">
@@ -48,14 +48,24 @@
<span v-else>未知</span>
</template>
</el-table-column>
<el-table-column label="试题别名" align="center" prop="quTitle"/>
<!-- <el-table-column label="关键字" align="center" prop="keywords" /> -->
<el-table-column label="试题数量" align="center" prop="quNumbers"/>
<el-table-column label="每题分数" align="center" prop="quScores"/>
<el-table-column label="小计分数" align="center" prop="subtotalScore"/>
<el-table-column label="试题别名" align="center" prop="quTitle"/>
<el-table-column label="别名排序" align="center">
<template #default="scope">
<el-input-number
v-model="scope.row.sort"
placeholder="请输入排序"
size="small"
:min="0"
style="width: 100px"
@change="(val) => handleSortChange(scope.row, val)"
/>
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button
@@ -77,6 +87,10 @@
</template>
</el-table-column>
</el-table>
<!-- 总分展示区域 -->
<div style="text-align: right; margin: 10px 0; font-weight: bold;">
总分{{ totalScore }}
</div>
<!-- 分页 -->
<Pagination
:total="total"
@@ -136,7 +150,38 @@ const taskEditRef = ref()
const taskAddRef = ref()
const taskTempRef = ref()
const totalScore = computed(() => {
return list.value.reduce((sum, item) => {
// 确保字段存在且为数字
const score = parseFloat(item.subtotalScore) || 0;
return sum + score;
}, 0);
});
// 排序值修改后自动调用接口
const handleSortChange = async (row, newValue) => {
if (newValue < 0) {
message.error('排序不能小于 0')
row.sort = 0
return
}
// 1. 获取所有 quTitle 相同的项
const sameTitleItems = list.value.filter(item => item.quTitle === row.quTitle)
// 2. 批量更新 sort 值
const updateList = sameTitleItems.map(item => ({
...item,
sort: newValue
}))
try {
// 假设后端支持批量更新接口
await Promise.all(updateList.map(item => SmsChannelApi.updateScheme(item)))
message.success('同别名方案的排序已同步更新')
getList()
} catch (error) {
message.error('排序更新失败')
}
}
const loading = ref(false) // 列表的加载中
const total = ref(0) // 列表的总页数

View File

@@ -74,7 +74,7 @@
<!-- 多选列 -->
<el-table-column type="selection" width="55" />
<el-table-column label="试卷id" align="center" prop="paperId" />
<!-- <el-table-column label="试卷id" align="center" prop="paperId" /> -->
<el-table-column label="试卷编号" align="center" prop="num" />
<el-table-column label="使用次数" align="center" prop="counts" />
<el-table-column label="抽卷方式" align="center" prop="rollUp">

View File

@@ -1,6 +1,6 @@
<!-- 编辑弹窗 -->
<template>
<Dialog v-model="visible" :title="'添加试卷任务'" width="460" @open="handleOpen" center>
<Dialog v-model="visible" :title="'添加试卷任务'" width="460" center>
<el-form
ref="formRef"
:model="form"
@@ -8,6 +8,10 @@
label-width="80px"
@submit.prevent=""
>
<el-form-item label="任务编号" prop="taskNum">
<el-input clearable v-model="form.taskNum" placeholder="请输入编号" disabled/>
</el-form-item>
<el-form-item label="任务名称" prop="taskName">
<el-input
clearable
@@ -124,6 +128,7 @@ const specialtyOptions = ref([]);
const [form, resetFields, assignFields] = useFormData({
taskId: void 0,
taskName: '',
taskNum:'',
taskSpecialty: '',
taskType: '0',
isTemplate: '',
@@ -178,6 +183,7 @@ const fetchSpecialtyOptions = async () => {
if (!valid) {
return;
}
visible.value = true;
loading.value = true;
const saveOrUpdate = isUpdate.value ? updateTask : addTask;
saveOrUpdate(form)
@@ -195,14 +201,31 @@ const fetchSpecialtyOptions = async () => {
};
/** 弹窗打开事件 */
const handleOpen = () => {
if (props.data) {
assignFields(props.data);
isUpdate.value = true;
} else {
resetFields();
isUpdate.value = false;
}
const open = async (type, row) => {
// if (props.data) {
// assignFields(props.data);
// isUpdate.value = true;
// } else {
// resetFields();
// isUpdate.value = false;
// }
// 设置批次为 当前时间 + 5位随机数
const now = new Date();
const pad = (n) => n.toString().padStart(2, '0');
const datetimeStr = [
now.getFullYear(),
pad(now.getMonth() + 1),
pad(now.getDate()),
pad(now.getHours()),
pad(now.getMinutes()),
pad(now.getSeconds())
].join('');
const randomNum = Math.floor(Math.random() * 100000).toString().padStart(5, '0');
//taskNum 赋值 randomNum
// 把 taskNum 设置为当前时间+随机数
form.taskNum = `${datetimeStr}${randomNum}`;
nextTick(() => {
nextTick(() => {
formRef.value?.clearValidate?.();
@@ -210,7 +233,8 @@ const fetchSpecialtyOptions = async () => {
});
};
onMounted(() => {
fetchSpecialtyOptions();
});
defineExpose({ open })
</script>

View File

@@ -71,7 +71,6 @@ const props = defineProps({
})
const isVisible = defineModel({ type: Boolean })
const isUpdate = ref(false)
const activeStep = ref(0)
const stepTitles = ['试卷方案', '试卷管理', '参数设置', '考场设置', '人员设置']
@@ -97,9 +96,7 @@ async function handleStepClick(index) {
const open = async (type, row) => {
isVisible.value = true
assignFields(row)
isUpdate.value = true
activeStep.value = 0
nextTick(() => {
formRef.value?.clearValidate?.()
})