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

This commit is contained in:
YOHO\20373
2025-06-16 22:21:22 +08:00
parent 4a365355cb
commit 95ca5a32c5
19 changed files with 234 additions and 145 deletions

View File

@@ -93,7 +93,11 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12">
<el-form-item label="数据库名" prop="tname">
<el-input v-model="formData.tname" placeholder="请输入数据库名" />
</el-form-item>
</el-col>
</el-row> </el-row>
</el-form> </el-form>
@@ -421,7 +425,7 @@ const formData = ref({
analysis: '', analysis: '',
quLevel: 0, quLevel: 0,
pointNames: '', pointNames: '',
tname:'',
subjectName: '', subjectName: '',
status: ' ', status: ' ',
keywords: '', keywords: '',
@@ -808,7 +812,7 @@ const open = async (queryParams: any ,type: string, id?: number) => {
kaodianData.value.quId=id; kaodianData.value.quId=id;
formLoading.value = true formLoading.value = true
try { try {
const res = await QuestionApi.getQuestionnotId(id); const res = await QuestionApi.getQuestion(id);
// 默认两个类型 // 默认两个类型
const fileTypes = ['1', '2']; const fileTypes = ['1', '2'];
@@ -882,8 +886,15 @@ const submitForm = async () => {
data.fileUploads = data.fileUploads?.filter(file => file.url && file.url.trim() !== ''); data.fileUploads = data.fileUploads?.filter(file => file.url && file.url.trim() !== '');
console.log(data, "提交的数据"); console.log(data, "提交的数据");
await QuestionApi.editQuestionNoAudit(data);
message.success(t('common.updateSuccess')); if (formType.value === 'create') {
await QuestionApi.addQuestion(data);
message.success(t('common.createSuccess'));
} else {
await QuestionApi.editQuestion(data);
message.success(t('common.updateSuccess'));
}
dialogVisible.value = false; dialogVisible.value = false;
emit('success'); emit('success');
} finally { } finally {
@@ -904,6 +915,7 @@ const resetForm = () => {
chapteridDictText: '', chapteridDictText: '',
analysis: '', analysis: '',
quLevel: 0, quLevel: 0,
tname:'',
pointNames: '', pointNames: '',
subjectName: '', subjectName: '',
status: '0', status: '0',

View File

@@ -93,7 +93,11 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12">
<el-form-item label="数据库名" prop="tname">
<el-input v-model="formData.tname" placeholder="请输入数据库名" />
</el-form-item>
</el-col>
</el-row> </el-row>
</el-form> </el-form>
@@ -421,7 +425,7 @@ const formData = ref({
analysis: '', analysis: '',
quLevel: 0, quLevel: 0,
pointNames: '', pointNames: '',
tname:'',
subjectName: '', subjectName: '',
status: ' ', status: ' ',
keywords: '', keywords: '',
@@ -911,6 +915,7 @@ const resetForm = () => {
chapteridDictText: '', chapteridDictText: '',
analysis: '', analysis: '',
quLevel: 0, quLevel: 0,
tname:'',
pointNames: '', pointNames: '',
subjectName: '', subjectName: '',
status: '0', status: '0',

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -202,6 +202,12 @@
clearable clearable
style="flex: 1; min-width: 180px;" 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 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="resetSearch"> <Icon icon="ep:refresh" class="mr-5px" />重置</el-button>
<el-button @click="resetRandom" > 随机换题</el-button> <el-button @click="resetRandom" > 随机换题</el-button>
@@ -223,7 +229,7 @@
<dict-tag :type="DICT_TYPE.EXAM_QUE_DIFF" :value="scope.row.quLevel" /> <dict-tag :type="DICT_TYPE.EXAM_QUE_DIFF" :value="scope.row.quLevel" />
</template> </template>
</el-table-column> </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"> <!-- <el-table-column label="审核状态" align="center" prop="audit" :show-overflow-tooltip="true">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.QUESTION_AUDIT" :value="scope.row.audit" /> <dict-tag :type="DICT_TYPE.QUESTION_AUDIT" :value="scope.row.audit" />
@@ -409,6 +415,7 @@ const queryParams = reactive({
pointNames: "", pointNames: "",
subjectName: "", subjectName: "",
quNum:"", quNum:"",
keywords:"",
chapteridDictText:"", chapteridDictText:"",
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
@@ -471,6 +478,7 @@ const resetSearch = () => {
queryParams.pointNames = ''; queryParams.pointNames = '';
queryParams.quLevel = ''; queryParams.quLevel = '';
queryParams.quNum = ''; queryParams.quNum = '';
queryParams.keywords= "",
queryParams.pageNo = 1; queryParams.pageNo = 1;
getList(); getList();
}; };

View File

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

View File

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

View File

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

View File

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

View File

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