【修改】 试题审核,试题推送、同步

This commit is contained in:
dlaren
2025-08-08 14:55:21 +08:00
parent 532bcf1b0b
commit 06f5d5f65c
2 changed files with 73 additions and 22 deletions

View File

@@ -26,7 +26,10 @@ export const getQuestionAuditList = (params: QuestionQueryVO) => {
export async function auditQuestion(data) {
return await request.post({ url: '/rabbitmq/send' ,data })
return await request.post({ url: '/rabbitmq/sendAudio' ,data })
}
export async function auditQuestionTrue(data) {
return await request.post({ url: '/exam/question/auditQuestion' ,data })
}
export async function rabbitmqConnect() {
return await request.post({ url: '/rabbitmq/connect' })
@@ -170,4 +173,4 @@ export const setPsPoint = (data) => {
export const getPsPointByQuId = (id) => {
return request.get({ url: `/exam/getPoints/getPsPointById/${id}` })
}
}

View File

@@ -113,9 +113,12 @@
</el-form-item>
<!-- 审核按钮单独显示在下一行 -->
<el-form-item>
<el-button v-if="queryParams.audit === '1'" type="primary" plain @click="handleAudit()">
<el-button v-if="queryParams.audit === '1' && sendAudio" type="primary" plain @click="handleAudit()">
<Icon icon="ep:plus" /> 推送审核试题
</el-button>
<el-button v-if="queryParams.audit === '1' && audioTrue" type="primary" plain @click="handleAuditTrue('True')">
<Icon icon="ep:plus" /> 审核试题
</el-button>
<el-button
v-if="queryParams.audit === '' || queryParams.audit === '0'"
type="primary"
@@ -197,7 +200,7 @@
prop="version"
:show-overflow-tooltip="true"
/> -->
<el-table-column label="状态" key="status">
<el-table-column label="状态" key="status" :show-overflow-tooltip="true">
<template #default="scope">
<el-switch
v-model="scope.row.status"
@@ -207,6 +210,18 @@
/>
</template>
</el-table-column>
<el-table-column
label="归属"
align="center"
prop="schoolName"
:show-overflow-tooltip="true"
/>
<el-table-column
label="创建教师"
align="center"
prop="createTeacher"
:show-overflow-tooltip="true"
/>
<el-table-column
label="创建时间"
align="center"
@@ -240,8 +255,8 @@
<!-- 同步弹框 -->
<el-dialog
v-model="syncDialogVisible"
:title="'同步试题'"
width="800px"
:title="'选择推送考点服务器'"
width="500px"
:before-close="handleCloseSyncDialog"
>
<ContentWrap>
@@ -253,26 +268,23 @@
:inline="true"
label-width="68px"
>
<el-form-item label="学校" prop="name">
<el-form-item label="" prop="name">
<el-input
v-model="queryParamsSchool.name"
placeholder="请输入学校名称"
placeholder="请输入考点服务器"
clearable
class="!w-240px"
class="!w-190px"
@keyup.enter="handleQuerySchool"
/>
</el-form-item>
<el-form-item>
<el-button @click="handleQuerySchool">
<Icon icon="ep:search" class="mr-5px" /> 搜索
</el-button>
<el-button @click="resetQuerySchool"><Icon icon="ep:refresh" />重置</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<ContentWrap>
<el-table
v-loading="loadingSchool"
@@ -280,8 +292,8 @@
@selection-change="handleSelectionChangeSchool"
>
<el-table-column type="selection" width="55" />
<el-table-column v-if="false" label="编号" align="center" prop="id" />
<el-table-column label="学校" align="center" prop="name" />
<el-table-column label="编号" align="center" prop="id" width="60"/>
<el-table-column label="考点服务器" align="center" prop="name" />
</el-table>
<Pagination
:total="totalSchool"
@@ -290,7 +302,6 @@
@pagination="getSchoolList"
/>
</ContentWrap>
<template #footer>
<span class="dialog-footer">
<el-button @click="handleCloseSyncDialog">取消</el-button>
@@ -323,6 +334,7 @@
</template>
<script lang="ts" setup>
import { getAccessToken, getRefreshToken, getTenantId, removeToken, setToken } from '@/utils/auth'
import { checkPermi } from '@/utils/permission'
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
@@ -348,6 +360,7 @@ import SpecialtyTree from './SpecialtyTree.vue'
import { handleTree } from '@/utils/tree'
import * as SpecialtyApi from '@/api/points'
import { useSettingStore } from '@/store/modules/settings'
import { TaskStatusEnum } from '@/api/bpm/task'
const settingStore = useSettingStore()
defineOptions({ name: 'SystemUser' })
@@ -373,6 +386,8 @@ const queryParams = reactive({
const queryFormRef = ref() // 搜索的表单
const specialtyList = ref<Tree[]>([]) // 树形结构
const respoint = ref<Tree[]>([]) // 树形结构
const sendAudio = ref(false) // 是否显示推送审核试题按钮
const audioTrue = ref(false) // 是否显示审核试题按钮
/** 获得部门树 */
const getTree = async () => {
@@ -498,13 +513,11 @@ const handleAudit = async () => {
message.error('请至少选择一条数据')
return
}
selectedRows.value = rows.map((d: any) => d.quId)
console.log(selectedRows.value)
const requestBody = {
type: '0',
quIds: selectedRows.value
type: '1',
queueNames: "1_Queue",
questionIds: selectedRows.value
}
await QuestionApi.auditQuestion(requestBody)
message.success(t('推送成功'))
@@ -512,6 +525,29 @@ const handleAudit = async () => {
await getList()
} catch {}
}
// 审核试题
const handleAuditTrue = async (status: string) => {
try {
if (!connectTentStatus.value) {
message.error('请先连接服务器')
return
}
const rows = selections.value
if (!rows.length) {
message.error('请至少选择一条数据')
return
}
selectedRows.value = rows.map((d: any) => d.quId)
const requestBody = {
type: status,
quIds: selectedRows.value
}
await QuestionApi.auditQuestionTrue(requestBody)
message.success(t('审核成功'))
// 刷新列表
await getList()
} catch {}
}
const queryParamsSchool = reactive({
name: '',
pageNo: 1,
@@ -521,6 +557,7 @@ const totalSchool = ref(0) // 列表的总页数
const listSchool = ref([]) // 列表的数
const schoolNameList = ref()
const loadingSchool = ref(true)
const connectTentStatus = ref(false)
const handleTUI = async () => {
try {
const rows = selections.value
@@ -607,14 +644,18 @@ const connectSchoolAll = () => {
const connectTent = async () => {
try {
const res = await QuestionApi.rabbitmqConnect()
console.log(res)
message.success(t(res))
connectTentStatus.value = true;
} catch (error) {
message.error(t(`连接失败: ${error?.message || '未知错误'}`))
}
}
// 同步试题
const connectTong = async () => {
if (!connectTentStatus.value) {
message.error('请先连接服务器')
return
}
try {
const res = await QuestionApi.receiveAll()
message.success(t('同步成功'))
@@ -831,5 +872,12 @@ const handleRole = (row: UserApi.UserVO) => {
/** 初始化 */
onMounted(() => {
getList()
if (getTenantId() == 1) {
sendAudio.value = false
audioTrue.value = true
} else {
sendAudio.value = true
audioTrue.value = false
}
})
</script>