Accept Merge Request #78: (hyc -> master)

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

Created By: @华允传
Accepted By: @华允传
URL: https://g-iswv8783.coding.net/p/education/d/pengchen-ui-exam-vue3/git/merge/78?initial=true
This commit is contained in:
华允传
2025-05-23 11:14:09 +08:00
committed by Coding
22 changed files with 581 additions and 41 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

@@ -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

@@ -212,7 +212,7 @@ const open = async (type: 'create' | 'update', data?: any) => {
schemeId: undefined,
taskId: props.taskId,
spName: undefined,
quLevel: undefined,
quLevel: 3,
quTitle:undefined,
keyword: [],
pointName: [],
@@ -375,6 +375,12 @@ watch(
},
{ deep: true }
)
watch(() => form.value.spName, (newVal) => {
if (newVal) {
form.value.quTitle = newVal
}
})
watch(
() => [form.value.quNumbers, form.value.quScores],
() => {

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"
@@ -92,7 +92,46 @@ async function handleStepClick(index) {
}
activeStep.value = index
}
const prevStep = () => {
// 如果下一步是考场设置(第四步),提前校验
if (activeStep.value - 1 === 3) {
validateBeforeStepFour(props.data.taskId)
.then((msg) => {
})
.catch((e) => {
// 校验失败,直接跳到第五步
activeStep.value = 2
return
});
}
if (activeStep.value > 0) {
activeStep.value--
}
}
const nextStep = async () => {
// 如果下一步是考场设置(第四步),提前校验
if (activeStep.value + 1 === 3) {
validateBeforeStepFour(props.data.taskId)
.then((msg) => {
})
.catch((e) => {
// 校验失败,直接跳到第五步
activeStep.value = 4
return
});
}
if (activeStep.value < stepTitles.length - 1) {
activeStep.value++
}
}
/** 打开弹窗 */
const open = async (type, row) => {
isVisible.value = true

View File

@@ -21,7 +21,15 @@
</el-step>
</template>
</el-steps>
<!-- 左右切换箭头按钮 -->
<div style="text-align: center; margin-top: 15px;">
<el-button :disabled="activeStep === 0" @click="prevStep">
上一步
</el-button>
<el-button :disabled="activeStep === stepTitles.length - 1" @click="nextStep">
下一步
</el-button>
</div>
<div style="margin-top: 30px;">
<component
:is="currentComponent"
@@ -109,7 +117,46 @@ const open = async (type, row) => {
})
}
defineExpose({ open })
const prevStep = () => {
// 如果下一步是考场设置(第四步),提前校验
if (activeStep.value - 1 === 2) {
validateBeforeStepFour(props.data.taskId)
.then((msg) => {
})
.catch((e) => {
// 校验失败,直接跳到第五步
activeStep.value = 1
return
});
}
if (activeStep.value > 0) {
activeStep.value--
}
}
const nextStep = async () => {
// 如果下一步是考场设置(第四步),提前校验
if (activeStep.value + 1 === 2) {
validateBeforeStepFour(props.data.taskId)
.then((msg) => {
})
.catch((e) => {
// 校验失败,直接跳到第五步
activeStep.value = 3
return
});
}
if (activeStep.value < stepTitles.length - 1) {
activeStep.value++
}
}
const handleCancel = () => {
isVisible.value = false
}

View File

@@ -213,7 +213,7 @@ const open = async (type: 'create' | 'update', data?: any) => {
schemeId: undefined,
taskId: props.taskId,
spName: undefined,
quLevel: undefined,
quLevel: 3,
quTitle:undefined,
keyword: [],
pointName: [],
@@ -375,6 +375,12 @@ watch(
},
{ deep: true }
)
watch(() => form.value.spName, (newVal) => {
if (newVal) {
form.value.quTitle = newVal
}
})
watch(
() => [form.value.quNumbers, form.value.quScores],
() => {

View File

@@ -199,14 +199,15 @@ const fetchSpecialtyOptions = async () => {
};
/** 弹窗打开事件 */
const handleOpen = () => {
const open = () => {
// if (props.data) {
// 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');
@@ -233,5 +234,5 @@ const fetchSpecialtyOptions = async () => {
onMounted(() => {
fetchSpecialtyOptions();
});
defineExpose({ handleOpen })
defineExpose({ open })
</script>

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"
@@ -21,7 +21,15 @@
</el-step>
</template>
</el-steps>
<!-- 左右切换箭头按钮 -->
<div style="text-align: center; margin-top: 15px;">
<el-button :disabled="activeStep === 0" @click="prevStep">
上一步
</el-button>
<el-button :disabled="activeStep === stepTitles.length - 1" @click="nextStep">
下一步
</el-button>
</div>
<div style="margin-top: 30px;">
<component
:is="currentComponent"
@@ -96,7 +104,46 @@ async function handleStepClick(index) {
}
activeStep.value = index
}
const prevStep = () => {
// 如果下一步是考场设置(第四步),提前校验
if (activeStep.value - 1 === 2) {
validateBeforeStepFour(props.data.taskId)
.then((msg) => {
})
.catch((e) => {
// 校验失败,直接跳到第五步
activeStep.value = 1
return
});
}
if (activeStep.value > 0) {
activeStep.value--
}
}
const nextStep = async () => {
// 如果下一步是考场设置(第四步),提前校验
if (activeStep.value + 1 === 2) {
validateBeforeStepFour(props.data.taskId)
.then((msg) => {
})
.catch((e) => {
// 校验失败,直接跳到第五步
activeStep.value = 3
return
});
}
if (activeStep.value < stepTitles.length - 1) {
activeStep.value++
}
}
/** 打开弹窗 */
const open = async (type, row) => {
isVisible.value = true

View File

@@ -213,7 +213,7 @@ const open = async (type: 'create' | 'update', data?: any) => {
schemeId: undefined,
taskId: props.taskId,
spName: undefined,
quLevel: undefined,
quLevel: 3,
quTitle:undefined,
keyword: [],
pointName: [],
@@ -376,6 +376,12 @@ watch(
},
{ deep: true }
)
watch(() => form.value.spName, (newVal) => {
if (newVal) {
form.value.quTitle = newVal
}
})
watch(
() => [form.value.quNumbers, form.value.quScores],
() => {

View File

@@ -199,7 +199,7 @@ const fetchSpecialtyOptions = async () => {
};
/** 弹窗打开事件 */
const handleOpen = () => {
const open = () => {
// if (props.data) {
// assignFields(props.data);
// isUpdate.value = true;
@@ -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');
@@ -234,5 +234,5 @@ const fetchSpecialtyOptions = async () => {
onMounted(() => {
fetchSpecialtyOptions();
});
defineExpose({ handleOpen })
defineExpose({ open })
</script>

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"
@@ -21,7 +21,15 @@
</el-step>
</template>
</el-steps>
<!-- 左右切换箭头按钮 -->
<div style="text-align: center; margin-top: 15px;">
<el-button :disabled="activeStep === 0" @click="prevStep">
上一步
</el-button>
<el-button :disabled="activeStep === stepTitles.length - 1" @click="nextStep">
下一步
</el-button>
</div>
<div style="margin-top: 30px;">
<component
:is="currentComponent"
@@ -92,7 +100,46 @@ async function handleStepClick(index) {
}
activeStep.value = index
}
const prevStep = () => {
// 如果下一步是考场设置(第四步),提前校验
if (activeStep.value - 1 === 2) {
validateBeforeStepFour(props.data.taskId)
.then((msg) => {
})
.catch((e) => {
// 校验失败,直接跳到第五步
activeStep.value = 1
return
});
}
if (activeStep.value > 0) {
activeStep.value--
}
}
const nextStep = async () => {
// 如果下一步是考场设置(第四步),提前校验
if (activeStep.value + 1 === 2) {
validateBeforeStepFour(props.data.taskId)
.then((msg) => {
})
.catch((e) => {
// 校验失败,直接跳到第五步
activeStep.value = 3
return
});
}
if (activeStep.value < stepTitles.length - 1) {
activeStep.value++
}
}
/** 打开弹窗 */
const open = async (type, row) => {
isVisible.value = true

View File

@@ -213,7 +213,7 @@ const open = async (type: 'create' | 'update', data?: any) => {
schemeId: undefined,
taskId: props.taskId,
spName: undefined,
quLevel: undefined,
quLevel: 3,
quTitle:undefined,
keyword: [],
pointName: [],
@@ -374,6 +374,12 @@ watch(
},
{ deep: true }
)
watch(() => form.value.spName, (newVal) => {
if (newVal) {
form.value.quTitle = newVal
}
})
watch(
() => [form.value.quNumbers, form.value.quScores],
() => {

View File

@@ -199,7 +199,7 @@ const fetchSpecialtyOptions = async () => {
};
/** 弹窗打开事件 */
const handleOpen = () => {
const open = () => {
// if (props.data) {
// assignFields(props.data);
// isUpdate.value = true;
@@ -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');
@@ -234,5 +234,5 @@ const fetchSpecialtyOptions = async () => {
onMounted(() => {
fetchSpecialtyOptions();
});
defineExpose({ handleOpen })
defineExpose({ open })
</script>

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"
@@ -21,7 +21,15 @@
</el-step>
</template>
</el-steps>
<!-- 左右切换箭头按钮 -->
<div style="text-align: center; margin-top: 15px;">
<el-button :disabled="activeStep === 0" @click="prevStep">
上一步
</el-button>
<el-button :disabled="activeStep === stepTitles.length - 1" @click="nextStep">
下一步
</el-button>
</div>
<div style="margin-top: 30px;">
<component
:is="currentComponent"
@@ -94,7 +102,46 @@ async function handleStepClick(index) {
}
activeStep.value = index
}
const prevStep = () => {
// 如果下一步是考场设置(第四步),提前校验
if (activeStep.value - 1 === 2) {
validateBeforeStepFour(props.data.taskId)
.then((msg) => {
})
.catch((e) => {
// 校验失败,直接跳到第一步
activeStep.value = 1
return
});
}
if (activeStep.value > 0) {
activeStep.value--
}
}
const nextStep = async () => {
// 如果下一步是考场设置(第四步),提前校验
if (activeStep.value + 1 === 2) {
validateBeforeStepFour(props.data.taskId)
.then((msg) => {
})
.catch((e) => {
// 校验失败直接跳到第3步
activeStep.value = 3
return
});
}
if (activeStep.value < stepTitles.length - 1) {
activeStep.value++
}
}
/** 打开弹窗 */
const open = async (type, row) => {
isVisible.value = true

View File

@@ -213,7 +213,7 @@ const open = async (type: 'create' | 'update', data?: any) => {
schemeId: undefined,
taskId: props.taskId,
spName: undefined,
quLevel: undefined,
quLevel: 3,
quTitle:undefined,
keyword: [],
pointName: [],
@@ -376,6 +376,12 @@ watch(
},
{ deep: true }
)
watch(() => form.value.spName, (newVal) => {
if (newVal) {
form.value.quTitle = newVal
}
})
watch(
() => [form.value.quNumbers, form.value.quScores],
() => {

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"
@@ -21,7 +21,15 @@
</el-step>
</template>
</el-steps>
<!-- 左右切换箭头按钮 -->
<div style="text-align: center; margin-top: 15px;">
<el-button :disabled="activeStep === 0" @click="prevStep">
上一步
</el-button>
<el-button :disabled="activeStep === stepTitles.length - 1" @click="nextStep">
下一步
</el-button>
</div>
<div style="margin-top: 30px;">
<component
:is="currentComponent"
@@ -105,7 +113,46 @@ const open = async (type, row) => {
})
}
defineExpose({ open })
const prevStep = () => {
// 如果下一步是考场设置(第四步),提前校验
if (activeStep.value - 1 === 3) {
validateBeforeStepFour(props.data.taskId)
.then((msg) => {
})
.catch((e) => {
// 校验失败,直接跳到第五步
activeStep.value = 2
return
});
}
if (activeStep.value > 0) {
activeStep.value--
}
}
const nextStep = async () => {
// 如果下一步是考场设置(第四步),提前校验
if (activeStep.value + 1 === 3) {
validateBeforeStepFour(props.data.taskId)
.then((msg) => {
})
.catch((e) => {
// 校验失败,直接跳到第五步
activeStep.value = 4
return
});
}
if (activeStep.value < stepTitles.length - 1) {
activeStep.value++
}
}
const handleCancel = () => {
isVisible.value = false
}

View File

@@ -213,7 +213,7 @@ const open = async (type: 'create' | 'update', data?: any) => {
schemeId: undefined,
taskId: props.taskId,
spName: undefined,
quLevel: undefined,
quLevel: 3,
quTitle:undefined,
keyword: [],
pointName: [],
@@ -375,6 +375,12 @@ watch(
},
{ deep: true }
)
watch(() => form.value.spName, (newVal) => {
if (newVal) {
form.value.quTitle = newVal
}
})
watch(
() => [form.value.quNumbers, form.value.quScores],
() => {

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"
@@ -22,6 +22,15 @@
</template>
</el-steps>
<!-- 左右切换箭头按钮 -->
<div style="text-align: center; margin-top: 15px;">
<el-button :disabled="activeStep === 0" @click="prevStep">
上一步
</el-button>
<el-button :disabled="activeStep === stepTitles.length - 1" @click="nextStep">
下一步
</el-button>
</div>
<div style="margin-top: 30px;">
<component
:is="currentComponent"
@@ -106,6 +115,47 @@ defineExpose({ open })
const handleCancel = () => {
isVisible.value = false
}
const prevStep = () => {
// 如果下一步是考场设置(第四步),提前校验
if (activeStep.value - 1 === 3) {
validateBeforeStepFour(props.data.taskId)
.then((msg) => {
})
.catch((e) => {
// 校验失败,直接跳到第五步
activeStep.value = 2
return
});
}
if (activeStep.value > 0) {
activeStep.value--
}
}
const nextStep = async () => {
// 如果下一步是考场设置(第四步),提前校验
if (activeStep.value + 1 === 3) {
validateBeforeStepFour(props.data.taskId)
.then((msg) => {
})
.catch((e) => {
// 校验失败,直接跳到第五步
activeStep.value = 4
return
});
}
if (activeStep.value < stepTitles.length - 1) {
activeStep.value++
}
}
</script>
<style scoped>