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

This commit is contained in:
dlaren
2025-08-08 14:55:21 +08:00
committed by 陆光LG
parent b31a568878
commit b073bec799
2 changed files with 86 additions and 26 deletions

View File

@@ -26,7 +26,10 @@ export const getQuestionAuditList = (params: QuestionQueryVO) => {
export async function auditQuestion(data) { 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() { export async function rabbitmqConnect() {
return await request.post({ url: '/rabbitmq/connect' }) return await request.post({ url: '/rabbitmq/connect' })

View File

@@ -113,9 +113,22 @@
</el-form-item> </el-form-item>
<!-- 审核按钮单独显示在下一行 --> <!-- 审核按钮单独显示在下一行 -->
<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" /> 推送审核试题 <Icon icon="ep:plus" /> 推送审核试题
</el-button> </el-button>
<el-button
v-if="queryParams.audit === '1' && audioTrue"
type="primary"
plain
@click="handleAuditTrue('True')"
>
<Icon icon="ep:plus" /> 审核试题
</el-button>
<el-button <el-button
v-if="queryParams.audit === '' || queryParams.audit === '0'" v-if="queryParams.audit === '' || queryParams.audit === '0'"
type="primary" type="primary"
@@ -197,7 +210,7 @@
prop="version" prop="version"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
/> --> /> -->
<el-table-column label="状态" key="status"> <el-table-column label="状态" key="status" :show-overflow-tooltip="true">
<template #default="scope"> <template #default="scope">
<el-switch <el-switch
v-model="scope.row.status" v-model="scope.row.status"
@@ -207,6 +220,18 @@
/> />
</template> </template>
</el-table-column> </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 <el-table-column
label="创建时间" label="创建时间"
align="center" align="center"
@@ -240,8 +265,8 @@
<!-- 同步弹框 --> <!-- 同步弹框 -->
<el-dialog <el-dialog
v-model="syncDialogVisible" v-model="syncDialogVisible"
:title="'同步试题'" :title="'选择推送考点服务器'"
width="800px" width="500px"
:before-close="handleCloseSyncDialog" :before-close="handleCloseSyncDialog"
> >
<ContentWrap> <ContentWrap>
@@ -253,26 +278,23 @@
:inline="true" :inline="true"
label-width="68px" label-width="68px"
> >
<el-form-item label="学校" prop="name"> <el-form-item label="" prop="name">
<el-input <el-input
v-model="queryParamsSchool.name" v-model="queryParamsSchool.name"
placeholder="请输入学校名称" placeholder="请输入考点服务器"
clearable clearable
class="!w-240px" class="!w-190px"
@keyup.enter="handleQuerySchool" @keyup.enter="handleQuerySchool"
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="handleQuerySchool"> <el-button @click="handleQuerySchool">
<Icon icon="ep:search" class="mr-5px" /> 搜索 <Icon icon="ep:search" class="mr-5px" /> 搜索
</el-button> </el-button>
<el-button @click="resetQuerySchool"><Icon icon="ep:refresh" />重置</el-button> <el-button @click="resetQuerySchool"><Icon icon="ep:refresh" />重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</ContentWrap> </ContentWrap>
<ContentWrap> <ContentWrap>
<el-table <el-table
v-loading="loadingSchool" v-loading="loadingSchool"
@@ -280,8 +302,8 @@
@selection-change="handleSelectionChangeSchool" @selection-change="handleSelectionChangeSchool"
> >
<el-table-column type="selection" width="55" /> <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="id" width="60" />
<el-table-column label="学校" align="center" prop="name" /> <el-table-column label="考点服务器" align="center" prop="name" />
</el-table> </el-table>
<Pagination <Pagination
:total="totalSchool" :total="totalSchool"
@@ -290,7 +312,6 @@
@pagination="getSchoolList" @pagination="getSchoolList"
/> />
</ContentWrap> </ContentWrap>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button @click="handleCloseSyncDialog">取消</el-button> <el-button @click="handleCloseSyncDialog">取消</el-button>
@@ -316,13 +337,13 @@
<FdesignForm ref="fformRef" @success="getList" /> <FdesignForm ref="fformRef" @success="getList" />
<WpsWordForm ref="wformRef" @success="getList" /> <WpsWordForm ref="wformRef" @success="getList" />
<WpsPptxForm ref="pformRef" @success="getList" /> <WpsPptxForm ref="pformRef" @success="getList" />
<SettingForm ref="setformRef" @success="getList"/> <SettingForm ref="setformRef" @success="getList" />
<EmailForm ref="emailformRef" @success="getList" /> <EmailForm ref="emailformRef" @success="getList" />
<WpsExcelForm ref="xlsxformRef" @success="getList" /> <WpsExcelForm ref="xlsxformRef" @success="getList" />
<PsForm ref="psformRef" @success="getList" /> <PsForm ref="psformRef" @success="getList" />
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { getAccessToken, getRefreshToken, getTenantId, removeToken, setToken } from '@/utils/auth'
import { checkPermi } from '@/utils/permission' import { checkPermi } from '@/utils/permission'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download' import download from '@/utils/download'
@@ -338,7 +359,7 @@ import FdesignForm from './FileForm.vue'
import UserImportForm from './UserImportForm.vue' import UserImportForm from './UserImportForm.vue'
import WpsWordForm from './WpsWordForm.vue' import WpsWordForm from './WpsWordForm.vue'
import WpsPptxForm from './WpsPptxForm.vue' import WpsPptxForm from './WpsPptxForm.vue'
import SettingForm from './SettingForm.vue' import SettingForm from './SettingForm.vue'
import WpsExcelForm from './WpsExcelForm.vue' import WpsExcelForm from './WpsExcelForm.vue'
import PsForm from './PsForm.vue' import PsForm from './PsForm.vue'
import EmailForm from './EmailForm.vue' import EmailForm from './EmailForm.vue'
@@ -348,6 +369,7 @@ import SpecialtyTree from './SpecialtyTree.vue'
import { handleTree } from '@/utils/tree' import { handleTree } from '@/utils/tree'
import * as SpecialtyApi from '@/api/points' import * as SpecialtyApi from '@/api/points'
import { useSettingStore } from '@/store/modules/settings' import { useSettingStore } from '@/store/modules/settings'
import { TaskStatusEnum } from '@/api/bpm/task'
const settingStore = useSettingStore() const settingStore = useSettingStore()
defineOptions({ name: 'SystemUser' }) defineOptions({ name: 'SystemUser' })
@@ -373,6 +395,8 @@ const queryParams = reactive({
const queryFormRef = ref() // 搜索的表单 const queryFormRef = ref() // 搜索的表单
const specialtyList = ref<Tree[]>([]) // 树形结构 const specialtyList = ref<Tree[]>([]) // 树形结构
const respoint = ref<Tree[]>([]) // 树形结构 const respoint = ref<Tree[]>([]) // 树形结构
const sendAudio = ref(false) // 是否显示推送审核试题按钮
const audioTrue = ref(false) // 是否显示审核试题按钮
/** 获得部门树 */ /** 获得部门树 */
const getTree = async () => { const getTree = async () => {
@@ -498,13 +522,11 @@ const handleAudit = async () => {
message.error('请至少选择一条数据') message.error('请至少选择一条数据')
return return
} }
selectedRows.value = rows.map((d: any) => d.quId) selectedRows.value = rows.map((d: any) => d.quId)
console.log(selectedRows.value)
const requestBody = { const requestBody = {
type: '0', type: '1',
quIds: selectedRows.value queueNames: '1_Queue',
questionIds: selectedRows.value
} }
await QuestionApi.auditQuestion(requestBody) await QuestionApi.auditQuestion(requestBody)
message.success(t('推送成功')) message.success(t('推送成功'))
@@ -512,6 +534,29 @@ const handleAudit = async () => {
await getList() await getList()
} catch {} } 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({ const queryParamsSchool = reactive({
name: '', name: '',
pageNo: 1, pageNo: 1,
@@ -521,6 +566,7 @@ const totalSchool = ref(0) // 列表的总页数
const listSchool = ref([]) // 列表的数 const listSchool = ref([]) // 列表的数
const schoolNameList = ref() const schoolNameList = ref()
const loadingSchool = ref(true) const loadingSchool = ref(true)
const connectTentStatus = ref(false)
const handleTUI = async () => { const handleTUI = async () => {
try { try {
const rows = selections.value const rows = selections.value
@@ -607,14 +653,18 @@ const connectSchoolAll = () => {
const connectTent = async () => { const connectTent = async () => {
try { try {
const res = await QuestionApi.rabbitmqConnect() const res = await QuestionApi.rabbitmqConnect()
console.log(res)
message.success(t(res)) message.success(t(res))
connectTentStatus.value = true
} catch (error: any) { } catch (error: any) {
message.error(t(`连接失败: ${error?.message || '未知错误'}`)) message.error(t(`连接失败: ${error?.message || '未知错误'}`))
} }
} }
// 同步试题
const connectTong = async () => { const connectTong = async () => {
if (!connectTentStatus.value) {
message.error('请先连接服务器')
return
}
try { try {
const res = await QuestionApi.receiveAll() const res = await QuestionApi.receiveAll()
message.success(t('同步成功')) message.success(t('同步成功'))
@@ -704,7 +754,7 @@ const openForm = (type: string, id?: number) => {
if (chooseQuestionType.value.includes('选择题')) { if (chooseQuestionType.value.includes('选择题')) {
formRef.value.open(queryParams, type, id) formRef.value.open(queryParams, type, id)
} else if (chooseQuestionType.value.includes('编程题')) { } else if (chooseQuestionType.value.includes('编程题')) {
cformRef.value.open(queryParams,type, id) cformRef.value.open(queryParams, type, id)
} else if (chooseQuestionType.value.includes('程序设计')) { } else if (chooseQuestionType.value.includes('程序设计')) {
mformRef.value.open(queryParams, type, id) mformRef.value.open(queryParams, type, id)
} else if (chooseQuestionType.value.includes('网络题')) { } else if (chooseQuestionType.value.includes('网络题')) {
@@ -721,7 +771,7 @@ const openForm = (type: string, id?: number) => {
emailformRef.value.open(queryParams, type, id) emailformRef.value.open(queryParams, type, id)
} else if (chooseQuestionType.value.includes('表格')) { } else if (chooseQuestionType.value.includes('表格')) {
xlsxformRef.value.open(queryParams, type, id) xlsxformRef.value.open(queryParams, type, id)
}else if (chooseQuestionType.value.includes('图像处理')) { } else if (chooseQuestionType.value.includes('图像处理')) {
psformRef.value.open(queryParams, type, id) psformRef.value.open(queryParams, type, id)
} }
} }
@@ -831,5 +881,12 @@ const handleRole = (row: UserApi.UserVO) => {
/** 初始化 */ /** 初始化 */
onMounted(() => { onMounted(() => {
getList() getList()
if (getTenantId() == 1) {
sendAudio.value = false
audioTrue.value = true
} else {
sendAudio.value = true
audioTrue.value = false
}
}) })
</script> </script>