【修改】前端试题界面,推送试题按钮权限,细节优化

This commit is contained in:
YOHO\20373
2025-05-23 11:13:17 +08:00
parent 79aed6696c
commit 441f109cf7
16 changed files with 205 additions and 25 deletions

View File

@@ -16,7 +16,7 @@
<el-form-item label="班级" prop="className">
<el-input v-model="formData.className" placeholder="请输入班级" />
</el-form-item>
<el-form-item label="考试状态" prop="examStatus">
<el-form-item label="任务状态" prop="examStatus">
<el-radio-group v-model="formData.examStatus">
<el-radio value="1">请选择字典生成</el-radio>
</el-radio-group>

View File

@@ -175,7 +175,7 @@
<el-table-column label="用户账号" align="center" prop="username" />
<el-table-column label="用户姓名" align="center" prop="nickname" />
<el-table-column label="班级" align="center" prop="className" />
<el-table-column label="任务状态" align="center" prop="examStatus">
<el-table-column label="考试状态" align="center" prop="examStatus">
<template #default="scope">
<dict-tag :type="DICT_TYPE.EXAM_STATUS" :value="scope.row.examStatus" />
</template>

View File

@@ -398,9 +398,6 @@ const confirmSync = () => {
ElMessage.error('推送失败');
});
}
};
const connectSchoolAll = () => {

View File

@@ -113,16 +113,27 @@
<!-- </el-button>-->
</el-form-item>
<!-- 审核按钮单独显示在下一行 -->
<el-form-item v-if="queryParams.audit === '1'" >
<el-form-item >
<el-button
v-if="queryParams.audit === '1'"
type="primary"
plain
@click="handleAudit()"
>
<Icon icon="ep:plus" /> 推送试题
<Icon icon="ep:plus" /> 推送审核试题
</el-button>
<el-button
v-if="queryParams.audit === '' || queryParams.audit === '0'"
type="primary"
plain
@click="handleTUI()"
v-hasPermi="['question:create']"
>
<Icon icon="ep:top" />推送试题
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<ContentWrap>
@@ -244,6 +255,74 @@
</el-col>
</el-row>
<!-- 同步弹框 -->
<el-dialog
v-model="syncDialogVisible"
:title="'同步试题'"
width="800px"
:before-close="handleCloseSyncDialog"
>
<ContentWrap>
<!-- 搜索表单 -->
<el-form
class="-mb-15px"
:model="queryParamsSchool"
ref="queryFormRefSchool"
:inline="true"
label-width="68px"
>
<el-form-item label="学校" prop="name">
<el-input
v-model="queryParamsSchool.name"
placeholder="请输入试卷编号"
clearable
class="!w-240px"
@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" :data="listSchool" @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>
<Pagination
:total="totalSchool"
v-model:page="queryParamsSchool.pageNo"
v-model:limit="queryParamsSchool.pageSize"
@pagination="getSchoolList"
/>
</ContentWrap>
<template #footer>
<span class="dialog-footer">
<el-button @click="handleCloseSyncDialog">取消</el-button>
<el-button @click="connectSchoolAll">测试连接</el-button>
<el-button type="primary" @click="confirmSync">确定</el-button>
</span>
</template>
</el-dialog>
<!-- 添加或修改选择题 -->
<ChoiceForm ref="formRef" @success="getList" />
<!-- 添加或修改C语言程序设计 -->
@@ -287,6 +366,7 @@ const { t } = useI18n() // 国际化
const loading = ref(true) // 列表的加载中
const total = ref(0) // 列表的总页数
const list = ref([]) // 列表的数
const queryParams = reactive({
specialtyName: "",
courseName: "",
@@ -295,6 +375,7 @@ const queryParams = reactive({
chapteridDictText:"",
pageNo: 1,
pageSize: 10,
audit:""
})
const queryFormRef = ref() // 搜索的表单
const specialtyList = ref<Tree[]>([]) // 树形结构
@@ -312,7 +393,7 @@ const getTreePoint = async () => {
respoint.value.push(...handleTree(res))
}
const syncDialogVisible = ref(false)
/** 查询列表 */
const getList = async () => {
@@ -395,6 +476,17 @@ const handleSpecialtyNodeClick = async (row: any) => {
const handleSelectionChange = (rows) => {
selections.value = rows;
}
const selectedSchool = ref([]);
const handleSelectionChangeSchool = (rows) => {
selectedSchool.value = rows;
}
const selectedRows = ref<string[]>([])
const handleAudit = async () => {
try {
@@ -411,12 +503,105 @@ const handleAudit = async () => {
type: '0',
quIds: selectedRows.value
}
await QuestionApi.auditQuestion(requestBody)
// await QuestionApi.auditQuestion(requestBody)
message.success(t('推送成功'))
// 刷新列表
await getList()
} catch {}
}
const queryParamsSchool = reactive({
name:'',
pageNo: 1,
pageSize: 10,
})
const totalSchool = ref(0) // 列表的总页数
const listSchool = ref([]) // 列表的数
const schoolNameList = ref();
const loadingSchool = ref(true)
const handleTUI = async () => {
try {
const rows = selections.value;
if (!rows.length) {
message.error('请至少选择一条数据');
return;
}
selectedRows.value = rows.map((d: any) => d.quId);
getSchoolList();
syncDialogVisible.value = true
} catch {}
}
const getSchoolList = async () => {
loadingSchool.value = true
try {
const data = await QuestionApi.getSchoolName(queryParamsSchool);
listSchool.value = data.list
totalSchool.value = data.total
} finally {
loadingSchool.value = false
}
}
const handleQuerySchool = () => {
queryParamsSchool.pageNo = 1
getSchoolList()
}
const handleCloseSyncDialog = () => {
syncDialogVisible.value = false
queryParamsSchool.name = ''
listSchool.value = []
totalSchool.value = 0
}
const confirmSync = () => {
if (selectedSchool.value.length === 0) {
ElMessage.warning('请先选择要同步的学校');
return;
}
const selectedIds = selectedSchool.value.map(item => item.ququeName);
console.log('选中的ID:', selectedIds);
const rows = selections.value;
selectedRows.value = rows.map((d: any) => d.quId);
console.log(selectedRows.value+"选中的试题")
const payload = {
queueNames: selectedIds,
questionIds: selectedRows.value
};
console.log(payload+"payload")
QuestionApi.doPush(payload).then(
() => {
ElMessage.success('推送成功');
syncDialogVisible.value = false;
getList();
}
).catch(() => {
ElMessage.error('推送失败');
}
);
};
const connectSchoolAll = () => {
if (selectedSchool.value.length === 0) {
ElMessage.warning('请先选择要连接的学校');
return;
}
const selectedIds = selectedSchool.value.map(item => item.ququeName);
console.log('选中的ID:', selectedIds);
QuestionApi.connectSchoolAll(selectedIds).then(() => {
ElMessage.success('连接成功');
}).catch(() => {
ElMessage.error('同步失败');
});
};
const connectTent = async () => {
try {
const res = await QuestionApi.rabbitmqConnect();

View File

@@ -200,13 +200,8 @@ const fetchSpecialtyOptions = async () => {
/** 弹窗打开事件 */
const open = () => {
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');

View File

@@ -1,6 +1,6 @@
<template>
<Dialog v-model="isVisible" :title="'修改试卷任务'" width="1460" >
<Dialog v-model="isVisible" :title="'修改试卷任务'" width="85%" >
<el-form
ref="formRef"
:model="form"

View File

@@ -204,9 +204,10 @@ const fetchSpecialtyOptions = async () => {
// assignFields(props.data);
// isUpdate.value = true;
// } else {
// resetFields();
//
// isUpdate.value = false;
// }
resetFields();
// 设置批次为 当前时间 + 5位随机数
const now = new Date();
const pad = (n) => n.toString().padStart(2, '0');

View File

@@ -1,6 +1,6 @@
<template>
<Dialog v-model="isVisible" :title="'修改试卷任务'" width="1460" >
<Dialog v-model="isVisible" :title="'修改试卷任务'" width="85%" >
<el-form
ref="formRef"
:model="form"

View File

@@ -207,7 +207,7 @@ const fetchSpecialtyOptions = async () => {
// resetFields();
// isUpdate.value = false;
// }
resetFields();
// 设置批次为 当前时间 + 5位随机数
const now = new Date();
const pad = (n) => n.toString().padStart(2, '0');

View File

@@ -1,6 +1,6 @@
<template>
<Dialog v-model="isVisible" :title="'修改试卷任务'" width="1460" >
<Dialog v-model="isVisible" :title="'修改试卷任务'" width="85%" >
<el-form
ref="formRef"
:model="form"

View File

@@ -207,7 +207,7 @@ const fetchSpecialtyOptions = async () => {
// resetFields();
// isUpdate.value = false;
// }
resetFields();
// 设置批次为 当前时间 + 5位随机数
const now = new Date();
const pad = (n) => n.toString().padStart(2, '0');

View File

@@ -1,6 +1,6 @@
<template>
<Dialog v-model="isVisible" :title="'修改试卷任务'" width="1460" >
<Dialog v-model="isVisible" :title="'修改试卷任务'" width="85%" >
<el-form
ref="formRef"
:model="form"

View File

@@ -207,6 +207,7 @@ const fetchSpecialtyOptions = async () => {
// resetFields();
// isUpdate.value = false;
// }
resetFields();
// 设置批次为 当前时间 + 5位随机数
const now = new Date();
const pad = (n) => n.toString().padStart(2, '0');

View File

@@ -1,6 +1,6 @@
<template>
<Dialog v-model="isVisible" :title="'修改试卷任务'" width="1460" >
<Dialog v-model="isVisible" :title="'修改试卷任务'" width="85%" >
<el-form
ref="formRef"
:model="form"

View File

@@ -209,6 +209,7 @@ const fetchSpecialtyOptions = async () => {
// resetFields();
// isUpdate.value = false;
// }
resetFields();
// 设置批次为 当前时间 + 5位随机数
const now = new Date();
const pad = (n) => n.toString().padStart(2, '0');

View File

@@ -1,6 +1,6 @@
<template>
<Dialog v-model="isVisible" :title="'修改试卷任务'" width="1460" >
<Dialog v-model="isVisible" :title="'修改试卷任务'" width="85%" >
<el-form
ref="formRef"
:model="form"