【修改】试卷任务增加修改操作,试卷换题增加关键字搜索条件,mysql出题增加数据库名字段

This commit is contained in:
YOHO\20373
2025-06-16 22:21:22 +08:00
committed by 陆光LG
parent ff42d33cbb
commit bd9d131643
19 changed files with 234 additions and 145 deletions

View File

@@ -202,6 +202,12 @@
clearable
style="flex: 1; min-width: 180px;"
/>
<el-input
v-model="queryParams.keywords"
placeholder="试题关键字"
clearable
style="flex: 1; min-width: 180px;"
/>
<el-button type="primary" @click="handleQuery"><Icon icon="ep:search" class="mr-5px" />搜索</el-button>
<el-button @click="resetSearch"> <Icon icon="ep:refresh" class="mr-5px" />重置</el-button>
<el-button @click="resetRandom" > 随机换题</el-button>
@@ -223,7 +229,7 @@
<dict-tag :type="DICT_TYPE.EXAM_QUE_DIFF" :value="scope.row.quLevel" />
</template>
</el-table-column>
<!-- <el-table-column label="知识点" align="center" prop="pointNames" :show-overflow-tooltip="true" /> -->
<el-table-column label="关键字" align="center" prop="keywords" :show-overflow-tooltip="true" />
<!-- <el-table-column label="审核状态" align="center" prop="audit" :show-overflow-tooltip="true">
<template #default="scope">
<dict-tag :type="DICT_TYPE.QUESTION_AUDIT" :value="scope.row.audit" />
@@ -416,6 +422,7 @@ const queryParams = reactive({
status:"0",
specialtyName:"",
courseName:"",
keywords:""
})
const emit = defineEmits(['done']);
const visible = defineModel({ type: Boolean }); // 对应 v-model
@@ -471,6 +478,7 @@ const resetSearch = () => {
queryParams.pointNames = '';
queryParams.quLevel = '';
queryParams.quNum = '';
queryParams.keywords= "",
queryParams.pageNo = 1;
getList();
};

View File

@@ -94,8 +94,7 @@
</template>
</Dialog>
</template>
<script setup>
<script setup lang="ts">
import { ref, reactive, nextTick } from 'vue';
import { onMounted } from 'vue';
import { useFormData } from '@/utils/use-form-data';
@@ -131,8 +130,8 @@ const specialtyOptions = ref([]);
taskNum:'',
taskSpecialty: '',
taskType: '0',
isTemplate: '',
status: '',
isTemplate: 1,
status: 0,
updateTime: '',
updateBy: '',
deptId: '',
@@ -189,7 +188,8 @@ const fetchSpecialtyOptions = async () => {
saveOrUpdate(form)
.then((msg) => {
loading.value = false;
message.success(msg);
message.success('修改成功');
handleCancel();
emit('done');
})
@@ -201,15 +201,15 @@ const fetchSpecialtyOptions = async () => {
};
/** 弹窗打开事件 */
const open = async (type, row) => {
// if (props.data) {
// assignFields(props.data);
// isUpdate.value = true;
// } else {
// resetFields();
// isUpdate.value = false;
// }
resetFields();
const open = async (type: 'create' | 'update', data?: any) => {
console.log(data+"datadatadata")
if (data) {
assignFields(data);
isUpdate.value = true;
} else {
resetFields();
isUpdate.value = false;
}
// 设置批次为 当前时间 + 5位随机数
const now = new Date();
const pad = (n) => n.toString().padStart(2, '0');

View File

@@ -91,8 +91,8 @@
<template #default="scope">
<el-switch
v-model="scope.row.status"
:active-value="'0'"
:inactive-value="'1'"
:active-value="0"
:inactive-value="1"
@change="handleStatusChange(scope.row)"
/>
</template>
@@ -106,6 +106,13 @@
/>
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button
link
type="primary"
@click="openForm('update', scope.row)"
>
修改
</el-button>
<el-button
link
type="primary"
@@ -221,12 +228,11 @@ const handleSelectionChange = (rows) => {
/** 添加/修改操作 */
const formRef = ref();
const openForm = (type: string, id?: number) => {
const openForm = (type: string, row?: object) => {
showAdd.value = true
nextTick(() => {
taskAddRef.value?.open(type, id)
taskAddRef.value?.open(type, row)
});
}
const openEdit = (type: string, row?: object) => {
@@ -282,12 +288,12 @@ const handleStatusChange = async (row: any) => {
loading.value = true;
// 调用API更新状态
await SmsChannelApi.updateTaskStatus(row.taskId, row.status);
message.success(row.status === '0' ? '已启用' : '已停用');
message.success(row.status === 0 ? '已启用' : '已停用');
// 刷新列表
await getList();
} catch (error) {
// 如果请求失败,恢复原来的状态
row.status = row.status === '0' ? '1' : '0';
row.status = row.status === 0 ? 1 : 0;
message.error('状态更新失败');
} finally {
loading.value = false;