【修改】 试卷软件环境根据试卷方案中试题自动获取

This commit is contained in:
dlaren
2025-08-07 15:11:31 +08:00
committed by 陆光LG
parent 65b24f01d7
commit d318f21838
9 changed files with 85 additions and 119 deletions

View File

@@ -17,3 +17,6 @@ export const getAppCheck = async (taskId: string) => {
export const deleteAppCheck = async (id: string) => {
return await request.get({ url: '/exam/app/delete/' + id })
}
export const createAppCheckList = async (taskId: string) => {
return await request.get({ url: '/exam/app/getAppCheckListByTaskId/' + taskId })
}

View File

@@ -1,34 +1,6 @@
<template>
<!-- 搜索工作栏 -->
<el-dialog v-model="ruleDialogVisible" title="规则设置" width="600px">
<!-- 弹窗内容 -->
<el-form-item label="判分规则" prop="roles">
<el-select
v-model="formData.roles"
placeholder="请选择判分规则"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.SCORE_ROLES)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<!-- 弹窗底部按钮 -->
<template #footer>
<span class="dialog-footer">
<el-button @click="ruleDialogVisible = false">取消</el-button>
<el-button type="primary" @click="handleRuleSave">保存</el-button>
</span>
</template>
</el-dialog>
<ContentWrap>
<el-form
class="-mb-15px"
@@ -64,11 +36,7 @@
<el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
<el-button
type="primary"
plain
@click="openForm('create')"
>
<el-button type="primary" plain @click="openForm('create')">
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<el-button type="danger" plain @click="toggleExpandAll">
@@ -88,11 +56,7 @@
v-if="refreshTable"
>
<el-table-column prop="name" label="专业名称" />
<el-table-column prop="status" label="判分规则">
<template #default="scope">
<dict-tag :type="DICT_TYPE.SCORE_ROLES" :value="scope.row.roles" />
</template>
</el-table-column>
<el-table-column prop="roles" label="软件环境" />
<el-table-column prop="status" label="状态">
<template #default="scope">
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
@@ -107,20 +71,10 @@
/>
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button
link
type="primary"
@click="openForm('update', scope.row.id)"
>
<el-button link type="primary" @click="openForm('update', scope.row.id)">
修改
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
>
删除
</el-button>
<el-button link type="danger" @click="handleDelete(scope.row.id)"> 删除 </el-button>
<!-- 第三级才显示规则按钮 -->
<el-button
v-if="scope.row.level === 3"
@@ -128,13 +82,26 @@
type="warning"
@click="handleRule(scope.row)"
>
规则
软件环境
</el-button>
</template>
</el-table-column>
</el-table>
</ContentWrap>
<el-dialog v-model="ruleDialogVisible" title="软件环境" width="600px">
<!-- 弹窗内容 -->
<el-form-item label="软件环境" prop="roles">
<el-input v-model="formData.roles" style="width: 240px" placeholder="输入对应需要软件名称" />
</el-form-item>
<!-- 弹窗底部按钮 -->
<template #footer>
<span class="dialog-footer">
<el-button @click="ruleDialogVisible = false">取消</el-button>
<el-button type="primary" @click="handleRuleSave">保存</el-button>
</span>
</template>
</el-dialog>
<!-- 表单弹窗添加/修改 -->
<SpecialtyForm ref="formRef" @success="getList" />
</template>
@@ -167,26 +134,23 @@ const ruleDialogVisible = ref(false) // 控制弹窗显示
const currentRuleRow = ref<any>(null) // 当前点击的那一行数据
const formData = ref({
roles: '',
id:''
id: ''
})
const handleRule =async (row: any) => {
const handleRule = async (row: any) => {
currentRuleRow.value = row.id
const res = await SpecialtyApi.getSpecialtyRole(currentRuleRow.value)
console.log(res)
formData.value.roles=res;
const res = await SpecialtyApi.getSpecialtyRole(currentRuleRow.value)
console.log(res)
formData.value.roles = res
ruleDialogVisible.value = true
}
const handleRuleSave = async() => {
formData.value.id=currentRuleRow.value;
const data = formData.value
const res = await SpecialtyApi.setSpecialtyRole(data)
message.success(t(res))
handleQuery()
const handleRuleSave = async () => {
formData.value.id = currentRuleRow.value
const data = formData.value
const res = await SpecialtyApi.setSpecialtyRole(data)
message.success(t(res))
handleQuery()
ruleDialogVisible.value = false
}
/** 查询部门列表 */
const getList = async () => {
@@ -194,8 +158,8 @@ const getList = async () => {
try {
const data = await SpecialtyApi.getSpecialtyPage(queryParams)
console.log(data)
const treeData = handleTree(data)
list.value = addLevelToTree(treeData)
const treeData = handleTree(data)
list.value = addLevelToTree(treeData)
} finally {
loading.value = false
}
@@ -210,7 +174,6 @@ const toggleExpandAll = () => {
})
}
/** 搜索按钮操作 */
const handleQuery = () => {
getList()
@@ -243,7 +206,7 @@ const handleDelete = async (id: number) => {
}
// 递归添加 level 字段
const addLevelToTree = (nodes, level = 1) => {
return nodes.map(node => {
return nodes.map((node) => {
const newNode = { ...node, level }
if (newNode.children && newNode.children.length > 0) {
newNode.children = addLevelToTree(newNode.children, level + 1)

View File

@@ -335,7 +335,7 @@
</el-tab-pane>
<el-tab-pane label="考试环境配置" name="tab5">
<div class="block" @blur.capture="handleFormChange">
<el-button @click="openAddForm">新增</el-button>
<el-button @click="asyncApp">同步软件环境</el-button>
<el-table v-if="isAppTrue" :data="tableData" style="width: 100%">
<el-table-column prop="appName" label="名称" align="center" />
<el-table-column label="操作" align="center" width="100px">
@@ -398,13 +398,14 @@ const showAdd = ref(false)
const taskAddRef = ref()
const message = useMessage() // 消息弹窗
const isAppTrue = ref(true)
// 打开新增表单
const openAddForm = () => {
showAdd.value = true
nextTick(() => {
taskAddRef.value?.open()
// 同步软件环境
const asyncApp = () => {
AppApi.createAppCheckList(props.taskId).then(() => {
getList()
})
}
const reload = () => {
getList()
}
@@ -427,7 +428,6 @@ const openAppForm = async () => {
setTimeout(() => {
isAppTrue.value = true
}, 0)
}
}

View File

@@ -335,7 +335,7 @@
</el-tab-pane>
<el-tab-pane label="考试环境配置" name="tab5">
<div class="block" @blur.capture="handleFormChange">
<el-button @click="openAddForm">新增</el-button>
<el-button @click="asyncApp">同步软件环境</el-button>
<el-table v-if="isAppTrue" :data="tableData" style="width: 100%">
<el-table-column prop="appName" label="名称" align="center" />
<el-table-column label="操作" align="center" width="100px">
@@ -398,13 +398,14 @@ const showAdd = ref(false)
const taskAddRef = ref()
const message = useMessage() // 消息弹窗
const isAppTrue = ref(true)
// 打开新增表单
const openAddForm = () => {
showAdd.value = true
nextTick(() => {
taskAddRef.value?.open()
// 同步软件环境
const asyncApp = () => {
AppApi.createAppCheckList(props.taskId).then(() => {
getList()
})
}
const reload = () => {
getList()
}
@@ -427,7 +428,6 @@ const openAppForm = async () => {
setTimeout(() => {
isAppTrue.value = true
}, 0)
}
}

View File

@@ -335,7 +335,7 @@
</el-tab-pane>
<el-tab-pane label="考试环境配置" name="tab5">
<div class="block" @blur.capture="handleFormChange">
<el-button @click="openAddForm">新增</el-button>
<el-button @click="asyncApp">同步软件环境</el-button>
<el-table v-if="isAppTrue" :data="tableData" style="width: 100%">
<el-table-column prop="appName" label="名称" align="center" />
<el-table-column label="操作" align="center" width="100px">
@@ -398,13 +398,14 @@ const showAdd = ref(false)
const taskAddRef = ref()
const message = useMessage() // 消息弹窗
const isAppTrue = ref(true)
// 打开新增表单
const openAddForm = () => {
showAdd.value = true
nextTick(() => {
taskAddRef.value?.open()
// 同步软件环境
const asyncApp = () => {
AppApi.createAppCheckList(props.taskId).then(() => {
getList()
})
}
const reload = () => {
getList()
}
@@ -427,7 +428,6 @@ const openAppForm = async () => {
setTimeout(() => {
isAppTrue.value = true
}, 0)
}
}

View File

@@ -335,7 +335,7 @@
</el-tab-pane>
<el-tab-pane label="考试环境配置" name="tab5">
<div class="block" @blur.capture="handleFormChange">
<el-button @click="openAddForm">新增</el-button>
<el-button @click="asyncApp">同步软件环境</el-button>
<el-table v-if="isAppTrue" :data="tableData" style="width: 100%">
<el-table-column prop="appName" label="名称" align="center" />
<el-table-column label="操作" align="center" width="100px">
@@ -398,13 +398,14 @@ const showAdd = ref(false)
const taskAddRef = ref()
const message = useMessage() // 消息弹窗
const isAppTrue = ref(true)
// 打开新增表单
const openAddForm = () => {
showAdd.value = true
nextTick(() => {
taskAddRef.value?.open()
// 同步软件环境
const asyncApp = () => {
AppApi.createAppCheckList(props.taskId).then(() => {
getList()
})
}
const reload = () => {
getList()
}
@@ -427,7 +428,6 @@ const openAppForm = async () => {
setTimeout(() => {
isAppTrue.value = true
}, 0)
}
}

View File

@@ -335,7 +335,7 @@
</el-tab-pane>
<el-tab-pane label="考试环境配置" name="tab5">
<div class="block" @blur.capture="handleFormChange">
<el-button @click="openAddForm">新增</el-button>
<el-button @click="asyncApp">同步软件环境</el-button>
<el-table v-if="isAppTrue" :data="tableData" style="width: 100%">
<el-table-column prop="appName" label="名称" align="center" />
<el-table-column label="操作" align="center" width="100px">
@@ -398,13 +398,14 @@ const showAdd = ref(false)
const taskAddRef = ref()
const message = useMessage() // 消息弹窗
const isAppTrue = ref(true)
// 打开新增表单
const openAddForm = () => {
showAdd.value = true
nextTick(() => {
taskAddRef.value?.open()
// 同步软件环境
const asyncApp = () => {
AppApi.createAppCheckList(props.taskId).then(() => {
getList()
})
}
const reload = () => {
getList()
}
@@ -427,7 +428,6 @@ const openAppForm = async () => {
setTimeout(() => {
isAppTrue.value = true
}, 0)
}
}

View File

@@ -335,7 +335,7 @@
</el-tab-pane>
<el-tab-pane label="考试环境配置" name="tab5">
<div class="block" @blur.capture="handleFormChange">
<el-button @click="openAddForm">新增</el-button>
<el-button @click="asyncApp">同步软件环境</el-button>
<el-table v-if="isAppTrue" :data="tableData" style="width: 100%">
<el-table-column prop="appName" label="名称" align="center" />
<el-table-column label="操作" align="center" width="100px">
@@ -398,13 +398,14 @@ const showAdd = ref(false)
const taskAddRef = ref()
const message = useMessage() // 消息弹窗
const isAppTrue = ref(true)
// 打开新增表单
const openAddForm = () => {
showAdd.value = true
nextTick(() => {
taskAddRef.value?.open()
// 同步软件环境
const asyncApp = () => {
AppApi.createAppCheckList(props.taskId).then(() => {
getList()
})
}
const reload = () => {
getList()
}
@@ -427,7 +428,6 @@ const openAppForm = async () => {
setTimeout(() => {
isAppTrue.value = true
}, 0)
}
}

View File

@@ -335,7 +335,7 @@
</el-tab-pane>
<el-tab-pane label="考试环境配置" name="tab5">
<div class="block" @blur.capture="handleFormChange">
<el-button @click="openAddForm">新增</el-button>
<el-button @click="asyncApp">同步软件环境</el-button>
<el-table v-if="isAppTrue" :data="tableData" style="width: 100%">
<el-table-column prop="appName" label="名称" align="center" />
<el-table-column label="操作" align="center" width="100px">
@@ -398,13 +398,14 @@ const showAdd = ref(false)
const taskAddRef = ref()
const message = useMessage() // 消息弹窗
const isAppTrue = ref(true)
// 打开新增表单
const openAddForm = () => {
showAdd.value = true
nextTick(() => {
taskAddRef.value?.open()
// 同步软件环境
const asyncApp = () => {
AppApi.createAppCheckList(props.taskId).then(() => {
getList()
})
}
const reload = () => {
getList()
}
@@ -427,7 +428,6 @@ const openAppForm = async () => {
setTimeout(() => {
isAppTrue.value = true
}, 0)
}
}