diff --git a/src/api/monitor/index.ts b/src/api/monitor/index.ts
index f70dea5..7034f6b 100644
--- a/src/api/monitor/index.ts
+++ b/src/api/monitor/index.ts
@@ -54,6 +54,8 @@ export const MonitorApi = {
updateMonitorStatus:async( data)=>{
return await request.post({ url: `/exam/monitor/updateMonitorStatus` , data })
- }
-
+ },
+ getMonitorTaskPage: async (params: any) => {
+ return await request.get({ url: `/exam/monitorTask/page`, params })
+ },
}
diff --git a/src/api/system/scheme/index.ts b/src/api/system/scheme/index.ts
index 4296307..c445ce2 100644
--- a/src/api/system/scheme/index.ts
+++ b/src/api/system/scheme/index.ts
@@ -36,11 +36,7 @@ export async function addScheme(data) {
* 修改试卷方案
*/
export async function updateScheme(data) {
-
-
return await request.put({ url: '/exam/scheme' , data })
-
-
}
/**
diff --git a/src/views/monitor/monitor/index.vue b/src/views/monitor/monitor/index.vue
index be0c31c..39d25a0 100644
--- a/src/views/monitor/monitor/index.vue
+++ b/src/views/monitor/monitor/index.vue
@@ -5,7 +5,7 @@
- 代考
+ 待考
考试中
考试完成
@@ -17,7 +17,23 @@
确认
+
+
+
+ 取消
+ 下一步
+
+
@@ -226,10 +242,22 @@ import download from '@/utils/download'
import { MonitorApi, MonitorVO } from '@/api/monitor'
import MonitorForm from './MonitorForm.vue'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
+import taskMonitor from './task-monitor.vue'
import * as ClassApi from '@/api/exam/class'
+
+import { ref } from 'vue'
+
+const selectedTaskId = ref(null)
+
+// 接收子组件传递的taskId
+const handleTaskSelected = (taskId: string) => {
+ queryParams.taskId = taskId
+ console.log('父组件接收到的taskId:', taskId)
+}
/** 监控管理 列表 */
defineOptions({ name: 'Monitor' })
-
+// 新增:初始弹框开关
+const initDialogVisible = ref(true);
// 弹窗开关
const dialogVisible = ref(false)
const message = useMessage() // 消息弹窗
@@ -242,7 +270,8 @@ const classNameList = ref();
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
- monitorId:'',
+ monitorId:undefined,
+ taskId:'',
username: undefined,
nickname: undefined,
taskType:undefined,
@@ -264,6 +293,7 @@ const getList = async () => {
classNameList.value = await ClassApi.ClassApi.getClassName()
try {
const data = await MonitorApi.getMonitorPage(queryParams)
+ queryParams.taskId = ''
list.value = data.list
total.value = data.total
} finally {
@@ -342,6 +372,7 @@ const openForm = (type: string, id?: number) => {
ElMessage.success('考试状态更新成功')
dialogVisible.value = false
+ getList()
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
@@ -395,9 +426,20 @@ const fetchTaskList = async (taskType: string) => {
console.error('获取试卷任务失败', error)
}
}
+const handleNextStep = () => {
+ getList()
+ initDialogVisible.value = false
+}
+const handleNextStepCancel = () => {
+ queryParams.taskId = ''
+ getList()
+ initDialogVisible.value = false
+}
+
/** 初始化 **/
onMounted(() => {
- getList()
+
+ initDialogVisible.value = true; // 显示初始弹框
})
\ No newline at end of file
diff --git a/src/views/monitor/monitor/task-monitor.vue b/src/views/monitor/monitor/task-monitor.vue
new file mode 100644
index 0000000..2871a40
--- /dev/null
+++ b/src/views/monitor/monitor/task-monitor.vue
@@ -0,0 +1,284 @@
+
+
+
+
+
+
+
+ 待考
+ 考试中
+ 考试完成
+
+
+
+
+
+ 取消
+ 确认
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 搜索
+ 重置
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ row.paperCount == 0 ? '未设置': `试卷${row.paperCount}张/${row.paperScore}分/${row.queNum}题` }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/task/exam/components/steps/step1/components/step-edit.vue b/src/views/task/exam/components/steps/step1/components/step-edit.vue
index 993aeef..385898a 100644
--- a/src/views/task/exam/components/steps/step1/components/step-edit.vue
+++ b/src/views/task/exam/components/steps/step1/components/step-edit.vue
@@ -87,7 +87,7 @@
-
+
@@ -168,7 +168,6 @@ const form = ref<{
const rules = reactive({
spName: [{ required: true, message: '请选择题型', trigger: 'change' }],
quLevel: [{ required: true, message: '请选择难度', trigger: 'change' }],
- sort: [{ required: true, message: '请设置排序', trigger: 'change' }],
quTitle: [{ required: true, message: '请输入别名', trigger: 'change' }],
pointName: [{ required: true, message: '请选择知识点', trigger: 'change' }],
quNumbers: [{ required: true, message: '请输入试题数量', trigger: 'blur' }],
@@ -223,11 +222,29 @@ const open = async (type: 'create' | 'update', data?: any) => {
sort: undefined,
taskSpecialty: props.taskSpecialty
}
+ // 清除校验
+ await nextTick()
+ const allKeys = getAllTreeKeys(pointOptions.value).map(String)
+ form.value.pointName = allKeys
+ treeRef.value?.setCheckedKeys(allKeys)
}
- // 清除校验
- await nextTick()
- formRef.value?.clearValidate?.()
+
+}
+function getAllTreeKeys(tree: TreeNode[]): number[] {
+ const keys: number[] = []
+
+ const traverse = (nodes: TreeNode[]) => {
+ for (const node of nodes) {
+ keys.push(node.value)
+ if (node.children?.length) {
+ traverse(node.children)
+ }
+ }
+ }
+
+ traverse(tree)
+ return keys
}
/** --------- 拉取扁平知识点并建树 --------- **/
diff --git a/src/views/task/exam/components/steps/step1/index.vue b/src/views/task/exam/components/steps/step1/index.vue
index c4ddf8d..d0d52eb 100644
--- a/src/views/task/exam/components/steps/step1/index.vue
+++ b/src/views/task/exam/components/steps/step1/index.vue
@@ -36,7 +36,7 @@
-
+
@@ -47,14 +47,26 @@
未知
-
-
+
+
+
+ handleSortChange(scope.row, val)"
+ />
+
+
+
+
+
+
+ 总分:{{ totalScore }}
+
{
+ return list.value.reduce((sum, item) => {
+ // 确保字段存在且为数字
+ const score = parseFloat(item.subtotalScore) || 0;
+ return sum + score;
+ }, 0);
+});
+// 排序值修改后自动调用接口
+// 排序值修改后自动调用接口
+const handleSortChange = async (row, newValue) => {
+ if (newValue < 0) {
+ message.error('排序不能小于 0')
+ row.sort = 0
+ return
+ }
+ // 1. 获取所有 quTitle 相同的项
+ const sameTitleItems = list.value.filter(item => item.quTitle === row.quTitle)
+
+ // 2. 批量更新 sort 值
+ const updateList = sameTitleItems.map(item => ({
+ ...item,
+ sort: newValue
+ }))
+
+ try {
+ // 假设后端支持批量更新接口
+ await Promise.all(updateList.map(item => SmsChannelApi.updateScheme(item)))
+ message.success('同别名方案的排序已同步更新')
+ getList()
+ } catch (error) {
+ message.error('排序更新失败')
+ }
+}
/** 查询列表 */
const getList = async () => {
// 1. 并行拉下拉所需的选项
diff --git a/src/views/task/exam/components/steps/step2/index copy.vue b/src/views/task/exam/components/steps/step2/index copy.vue
deleted file mode 100644
index 1755b28..0000000
--- a/src/views/task/exam/components/steps/step2/index copy.vue
+++ /dev/null
@@ -1,211 +0,0 @@
-
-
-
-
-
-
- 搜索
- 重置
-
- 新增
-
-
-
-
-
-
-
-
-
-
-
- 固定
- AB卷
- 随机
- 自选
- 未知
-
-
-
-
- A卷
- B卷
- 未知
-
-
-
-
-
-
-
-
-
-
-
- 编辑
-
-
- 删除
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/views/task/exam/components/steps/step2/index.vue b/src/views/task/exam/components/steps/step2/index.vue
index 35814e0..9661a4a 100644
--- a/src/views/task/exam/components/steps/step2/index.vue
+++ b/src/views/task/exam/components/steps/step2/index.vue
@@ -74,7 +74,7 @@
-
+
diff --git a/src/views/task/exam/components/task-add.vue b/src/views/task/exam/components/task-add.vue
index 6274007..b143d8f 100644
--- a/src/views/task/exam/components/task-add.vue
+++ b/src/views/task/exam/components/task-add.vue
@@ -8,6 +8,9 @@
label-width="80px"
@submit.prevent=""
>
+
+
+
{
resetFields();
isUpdate.value = false;
}
+ // 设置批次为 当前时间 + 5位随机数
+ const now = new Date();
+ const pad = (n) => n.toString().padStart(2, '0');
+ const datetimeStr = [
+ now.getFullYear(),
+ pad(now.getMonth() + 1),
+ pad(now.getDate()),
+ pad(now.getHours()),
+ pad(now.getMinutes()),
+ pad(now.getSeconds())
+ ].join('');
+
+ const randomNum = Math.floor(Math.random() * 100000).toString().padStart(5, '0');
+ //taskNum 赋值 randomNum
+
+ // 把 taskNum 设置为当前时间+随机数
+ form.taskNum = `${datetimeStr}${randomNum}`;
nextTick(() => {
nextTick(() => {
formRef.value?.clearValidate?.();
@@ -212,5 +233,5 @@ const fetchSpecialtyOptions = async () => {
onMounted(() => {
fetchSpecialtyOptions();
});
-
+defineExpose({ handleOpen })
\ No newline at end of file
diff --git a/src/views/task/exam/index.vue b/src/views/task/exam/index.vue
index 195baba..40f77a8 100644
--- a/src/views/task/exam/index.vue
+++ b/src/views/task/exam/index.vue
@@ -73,6 +73,7 @@
+
@@ -240,14 +241,19 @@ const handleSelectionChange = (rows) => {
const formRef = ref();
const openForm = (type: string, id?: number) => {
showAdd.value = true
- taskAddRef.value?.open(type, id)
+
+ nextTick(() => {
+ taskAddRef.value?.open(type, id)
+ });
}
const openEdit = (type: string, row?: object) => {
showEdit.value = true
current.value = row
console.log( current.value )
- taskEditRef.value?.open(type, row)
+ nextTick(() => {
+ taskEditRef.value?.open(type, row)
+ });
}
const openBank = () => {
diff --git a/src/views/task/selftrans/ai/components/steps/step1/components/step-edit.vue b/src/views/task/selftrans/ai/components/steps/step1/components/step-edit.vue
index 993aeef..3c3857d 100644
--- a/src/views/task/selftrans/ai/components/steps/step1/components/step-edit.vue
+++ b/src/views/task/selftrans/ai/components/steps/step1/components/step-edit.vue
@@ -87,7 +87,7 @@
-
+
@@ -223,11 +223,29 @@ const open = async (type: 'create' | 'update', data?: any) => {
sort: undefined,
taskSpecialty: props.taskSpecialty
}
+ // 清除校验
+ await nextTick()
+ const allKeys = getAllTreeKeys(pointOptions.value).map(String)
+ form.value.pointName = allKeys
+ treeRef.value?.setCheckedKeys(allKeys)
}
- // 清除校验
- await nextTick()
- formRef.value?.clearValidate?.()
+
+}
+function getAllTreeKeys(tree: TreeNode[]): number[] {
+ const keys: number[] = []
+
+ const traverse = (nodes: TreeNode[]) => {
+ for (const node of nodes) {
+ keys.push(node.value)
+ if (node.children?.length) {
+ traverse(node.children)
+ }
+ }
+ }
+
+ traverse(tree)
+ return keys
}
/** --------- 拉取扁平知识点并建树 --------- **/
diff --git a/src/views/task/selftrans/ai/components/steps/step1/index.vue b/src/views/task/selftrans/ai/components/steps/step1/index.vue
index 293b16e..d21322c 100644
--- a/src/views/task/selftrans/ai/components/steps/step1/index.vue
+++ b/src/views/task/selftrans/ai/components/steps/step1/index.vue
@@ -47,14 +47,24 @@
未知
-
-
-
+
+
+
+ handleSortChange(scope.row, val)"
+ />
+
+
+
+
+ 总分:{{ totalScore }}
+
{
+ return list.value.reduce((sum, item) => {
+ // 确保字段存在且为数字
+ const score = parseFloat(item.subtotalScore) || 0;
+ return sum + score;
+ }, 0);
+});
+// 排序值修改后自动调用接口
+const handleSortChange = async (row, newValue) => {
+ if (newValue < 0) {
+ message.error('排序不能小于 0')
+ row.sort = 0
+ return
+ }
+ // 1. 获取所有 quTitle 相同的项
+ const sameTitleItems = list.value.filter(item => item.quTitle === row.quTitle)
+
+ // 2. 批量更新 sort 值
+ const updateList = sameTitleItems.map(item => ({
+ ...item,
+ sort: newValue
+ }))
+
+ try {
+ // 假设后端支持批量更新接口
+ await Promise.all(updateList.map(item => SmsChannelApi.updateScheme(item)))
+ message.success('同别名方案的排序已同步更新')
+ getList()
+ } catch (error) {
+ message.error('排序更新失败')
+ }
+}
/** 查询列表 */
const getList = async () => {
// 1. 并行拉下拉所需的选项
diff --git a/src/views/task/selftrans/ai/components/task-add.vue b/src/views/task/selftrans/ai/components/task-add.vue
index 5e42db2..e8656a2 100644
--- a/src/views/task/selftrans/ai/components/task-add.vue
+++ b/src/views/task/selftrans/ai/components/task-add.vue
@@ -8,6 +8,10 @@
label-width="80px"
@submit.prevent=""
>
+
+
+
+
{
};
/** 弹窗打开事件 */
- const handleOpen = () => {
- if (props.data) {
- assignFields(props.data);
- isUpdate.value = true;
- } else {
- resetFields();
- isUpdate.value = false;
- }
+ 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');
+ const datetimeStr = [
+ now.getFullYear(),
+ pad(now.getMonth() + 1),
+ pad(now.getDate()),
+ pad(now.getHours()),
+ pad(now.getMinutes()),
+ pad(now.getSeconds())
+ ].join('');
+
+ const randomNum = Math.floor(Math.random() * 100000).toString().padStart(5, '0');
+ //taskNum 赋值 randomNum
+
+ // 把 taskNum 设置为当前时间+随机数
+ form.taskNum = `${datetimeStr}${randomNum}`;
nextTick(() => {
nextTick(() => {
formRef.value?.clearValidate?.();
@@ -212,5 +235,5 @@ const fetchSpecialtyOptions = async () => {
onMounted(() => {
fetchSpecialtyOptions();
});
-
+defineExpose({ open })
\ No newline at end of file
diff --git a/src/views/task/selftrans/ai/index.vue b/src/views/task/selftrans/ai/index.vue
index f96105b..bfe5e1c 100644
--- a/src/views/task/selftrans/ai/index.vue
+++ b/src/views/task/selftrans/ai/index.vue
@@ -73,6 +73,7 @@
+
@@ -222,7 +223,9 @@ const handleSelectionChange = (rows) => {
const formRef = ref();
const openForm = (type: string, id?: number) => {
showAdd.value = true
- taskAddRef.value?.open(type, id)
+ nextTick(() => {
+ taskAddRef.value?.open(type, id)
+ });
}
/** 状态切换处理 */
@@ -248,7 +251,9 @@ const openEdit = (type: string, row?: object) => {
showEdit.value = true
current.value = row
console.log( current.value )
- taskEditRef.value?.open(type, row)
+ nextTick(() => {
+ taskEditRef.value?.open(type, row)
+ });
}
const openBank = () => {
diff --git a/src/views/task/selftrans/collegeexam/components/steps/step1/components/step-edit.vue b/src/views/task/selftrans/collegeexam/components/steps/step1/components/step-edit.vue
index 993aeef..fc00e83 100644
--- a/src/views/task/selftrans/collegeexam/components/steps/step1/components/step-edit.vue
+++ b/src/views/task/selftrans/collegeexam/components/steps/step1/components/step-edit.vue
@@ -87,7 +87,7 @@
-
+
@@ -223,13 +223,30 @@ const open = async (type: 'create' | 'update', data?: any) => {
sort: undefined,
taskSpecialty: props.taskSpecialty
}
+ // 清除校验
+ await nextTick()
+ const allKeys = getAllTreeKeys(pointOptions.value).map(String)
+ form.value.pointName = allKeys
+ treeRef.value?.setCheckedKeys(allKeys)
}
- // 清除校验
- await nextTick()
- formRef.value?.clearValidate?.()
-}
+}
+function getAllTreeKeys(tree: TreeNode[]): number[] {
+ const keys: number[] = []
+
+ const traverse = (nodes: TreeNode[]) => {
+ for (const node of nodes) {
+ keys.push(node.value)
+ if (node.children?.length) {
+ traverse(node.children)
+ }
+ }
+ }
+
+ traverse(tree)
+ return keys
+}
/** --------- 拉取扁平知识点并建树 --------- **/
async function loadPointTree() {
try {
diff --git a/src/views/task/selftrans/collegeexam/components/steps/step1/index.vue b/src/views/task/selftrans/collegeexam/components/steps/step1/index.vue
index 39756a1..32b08b9 100644
--- a/src/views/task/selftrans/collegeexam/components/steps/step1/index.vue
+++ b/src/views/task/selftrans/collegeexam/components/steps/step1/index.vue
@@ -36,7 +36,7 @@
-
+
@@ -47,14 +47,23 @@
未知
-
-
-
-
+
+
+
+ handleSortChange(scope.row, val)"
+ />
+
+
+
+
+ 总分:{{ totalScore }}
+
{
})
}
+const totalScore = computed(() => {
+ return list.value.reduce((sum, item) => {
+ // 确保字段存在且为数字
+ const score = parseFloat(item.subtotalScore) || 0;
+ return sum + score;
+ }, 0);
+});
+// 排序值修改后自动调用接口
+const handleSortChange = async (row, newValue) => {
+ if (newValue < 0) {
+ message.error('排序不能小于 0')
+ row.sort = 0
+ return
+ }
+ // 1. 获取所有 quTitle 相同的项
+ const sameTitleItems = list.value.filter(item => item.quTitle === row.quTitle)
+ // 2. 批量更新 sort 值
+ const updateList = sameTitleItems.map(item => ({
+ ...item,
+ sort: newValue
+ }))
+ try {
+ // 假设后端支持批量更新接口
+ await Promise.all(updateList.map(item => SmsChannelApi.updateScheme(item)))
+ message.success('同别名方案的排序已同步更新')
+ getList()
+ } catch (error) {
+ message.error('排序更新失败')
+ }
+}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
diff --git a/src/views/task/selftrans/collegeexam/components/task-add.vue b/src/views/task/selftrans/collegeexam/components/task-add.vue
index bfa3007..9223018 100644
--- a/src/views/task/selftrans/collegeexam/components/task-add.vue
+++ b/src/views/task/selftrans/collegeexam/components/task-add.vue
@@ -8,6 +8,9 @@
label-width="80px"
@submit.prevent=""
>
+
+
+
{
/** 弹窗打开事件 */
const handleOpen = () => {
- if (props.data) {
- assignFields(props.data);
- isUpdate.value = true;
- } else {
- resetFields();
- isUpdate.value = false;
- }
+ // 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');
+ const datetimeStr = [
+ now.getFullYear(),
+ pad(now.getMonth() + 1),
+ pad(now.getDate()),
+ pad(now.getHours()),
+ pad(now.getMinutes()),
+ pad(now.getSeconds())
+ ].join('');
+
+ const randomNum = Math.floor(Math.random() * 100000).toString().padStart(5, '0');
+ //taskNum 赋值 randomNum
+
+ // 把 taskNum 设置为当前时间+随机数
+ form.taskNum = `${datetimeStr}${randomNum}`;
nextTick(() => {
nextTick(() => {
formRef.value?.clearValidate?.();
@@ -212,5 +233,5 @@ const fetchSpecialtyOptions = async () => {
onMounted(() => {
fetchSpecialtyOptions();
});
-
+defineExpose({ handleOpen })
\ No newline at end of file
diff --git a/src/views/task/selftrans/collegeexam/index.vue b/src/views/task/selftrans/collegeexam/index.vue
index 55558ce..2964ccc 100644
--- a/src/views/task/selftrans/collegeexam/index.vue
+++ b/src/views/task/selftrans/collegeexam/index.vue
@@ -73,6 +73,7 @@
+
@@ -222,7 +223,11 @@ const handleSelectionChange = (rows) => {
const formRef = ref();
const openForm = (type: string, id?: number) => {
showAdd.value = true
- taskAddRef.value?.open(type, id)
+
+ nextTick(() => {
+ taskAddRef.value?.open(type, id)
+ });
+
}
/** 状态切换处理 */
@@ -248,7 +253,10 @@ const openEdit = (type: string, row?: object) => {
showEdit.value = true
current.value = row
console.log( current.value )
- taskEditRef.value?.open(type, row)
+ nextTick(() => {
+ taskEditRef.value?.open(type, row)
+ });
+
}
const openBank = () => {
diff --git a/src/views/task/selftrans/module/components/steps/step1/components/step-edit.vue b/src/views/task/selftrans/module/components/steps/step1/components/step-edit.vue
index 993aeef..7d8499d 100644
--- a/src/views/task/selftrans/module/components/steps/step1/components/step-edit.vue
+++ b/src/views/task/selftrans/module/components/steps/step1/components/step-edit.vue
@@ -87,7 +87,7 @@
-
+
@@ -223,11 +223,29 @@ const open = async (type: 'create' | 'update', data?: any) => {
sort: undefined,
taskSpecialty: props.taskSpecialty
}
+ // 清除校验
+ await nextTick()
+ const allKeys = getAllTreeKeys(pointOptions.value).map(String)
+ form.value.pointName = allKeys
+ treeRef.value?.setCheckedKeys(allKeys)
}
- // 清除校验
- await nextTick()
- formRef.value?.clearValidate?.()
+
+}
+function getAllTreeKeys(tree: TreeNode[]): number[] {
+ const keys: number[] = []
+
+ const traverse = (nodes: TreeNode[]) => {
+ for (const node of nodes) {
+ keys.push(node.value)
+ if (node.children?.length) {
+ traverse(node.children)
+ }
+ }
+ }
+
+ traverse(tree)
+ return keys
}
/** --------- 拉取扁平知识点并建树 --------- **/
diff --git a/src/views/task/selftrans/module/components/steps/step1/index.vue b/src/views/task/selftrans/module/components/steps/step1/index.vue
index 293b16e..f1b335e 100644
--- a/src/views/task/selftrans/module/components/steps/step1/index.vue
+++ b/src/views/task/selftrans/module/components/steps/step1/index.vue
@@ -36,7 +36,7 @@
-
+
@@ -47,14 +47,25 @@
未知
-
-
+
+
+
+ handleSortChange(scope.row, val)"
+ />
+
+
+
+
+ 总分:{{ totalScore }}
+
{
taskEditRef.value?.open(type, row)
})
}
+const totalScore = computed(() => {
+ return list.value.reduce((sum, item) => {
+ // 确保字段存在且为数字
+ const score = parseFloat(item.subtotalScore) || 0;
+ return sum + score;
+ }, 0);
+});
+// 排序值修改后自动调用接口
+const handleSortChange = async (row, newValue) => {
+ if (newValue < 0) {
+ message.error('排序不能小于 0')
+ row.sort = 0
+ return
+ }
+ // 1. 获取所有 quTitle 相同的项
+ const sameTitleItems = list.value.filter(item => item.quTitle === row.quTitle)
+ // 2. 批量更新 sort 值
+ const updateList = sameTitleItems.map(item => ({
+ ...item,
+ sort: newValue
+ }))
+ try {
+ // 假设后端支持批量更新接口
+ await Promise.all(updateList.map(item => SmsChannelApi.updateScheme(item)))
+ message.success('同别名方案的排序已同步更新')
+ getList()
+ } catch (error) {
+ message.error('排序更新失败')
+ }
+}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
diff --git a/src/views/task/selftrans/module/components/task-add.vue b/src/views/task/selftrans/module/components/task-add.vue
index 697f647..486dc23 100644
--- a/src/views/task/selftrans/module/components/task-add.vue
+++ b/src/views/task/selftrans/module/components/task-add.vue
@@ -8,6 +8,9 @@
label-width="80px"
@submit.prevent=""
>
+
+
+
{
/** 弹窗打开事件 */
const handleOpen = () => {
- if (props.data) {
- assignFields(props.data);
- isUpdate.value = true;
- } else {
- resetFields();
- isUpdate.value = false;
- }
+ // 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');
+ const datetimeStr = [
+ now.getFullYear(),
+ pad(now.getMonth() + 1),
+ pad(now.getDate()),
+ pad(now.getHours()),
+ pad(now.getMinutes()),
+ pad(now.getSeconds())
+ ].join('');
+
+ const randomNum = Math.floor(Math.random() * 100000).toString().padStart(5, '0');
+ //taskNum 赋值 randomNum
+
+ // 把 taskNum 设置为当前时间+随机数
+ form.taskNum = `${datetimeStr}${randomNum}`;
nextTick(() => {
nextTick(() => {
formRef.value?.clearValidate?.();
@@ -212,5 +234,5 @@ const fetchSpecialtyOptions = async () => {
onMounted(() => {
fetchSpecialtyOptions();
});
-
+defineExpose({ handleOpen })
\ No newline at end of file
diff --git a/src/views/task/selftrans/module/index.vue b/src/views/task/selftrans/module/index.vue
index 00a01a8..4c219d3 100644
--- a/src/views/task/selftrans/module/index.vue
+++ b/src/views/task/selftrans/module/index.vue
@@ -73,6 +73,7 @@
+
@@ -222,7 +223,10 @@ const handleSelectionChange = (rows) => {
const formRef = ref();
const openForm = (type: string, id?: number) => {
showAdd.value = true
- taskAddRef.value?.open(type, id)
+
+ nextTick(() => {
+ taskAddRef.value?.open(type, id)
+ });
}
/** 状态切换处理 */
@@ -248,7 +252,10 @@ const openEdit = (type: string, row?: object) => {
showEdit.value = true
current.value = row
console.log( current.value )
- taskEditRef.value?.open(type, row)
+
+ nextTick(() => {
+ taskEditRef.value?.open(type, row)
+ });
}
const openBank = () => {
diff --git a/src/views/task/selftrans/random/components/steps/step1/components/step-edit.vue b/src/views/task/selftrans/random/components/steps/step1/components/step-edit.vue
index 993aeef..17cf8eb 100644
--- a/src/views/task/selftrans/random/components/steps/step1/components/step-edit.vue
+++ b/src/views/task/selftrans/random/components/steps/step1/components/step-edit.vue
@@ -87,7 +87,7 @@
-
+
@@ -223,11 +223,27 @@ const open = async (type: 'create' | 'update', data?: any) => {
sort: undefined,
taskSpecialty: props.taskSpecialty
}
+ // 清除校验
+ await nextTick()
+ const allKeys = getAllTreeKeys(pointOptions.value).map(String)
+ form.value.pointName = allKeys
+ treeRef.value?.setCheckedKeys(allKeys)
+ }
+}
+function getAllTreeKeys(tree: TreeNode[]): number[] {
+ const keys: number[] = []
+
+ const traverse = (nodes: TreeNode[]) => {
+ for (const node of nodes) {
+ keys.push(node.value)
+ if (node.children?.length) {
+ traverse(node.children)
+ }
+ }
}
- // 清除校验
- await nextTick()
- formRef.value?.clearValidate?.()
+ traverse(tree)
+ return keys
}
/** --------- 拉取扁平知识点并建树 --------- **/
diff --git a/src/views/task/selftrans/random/components/steps/step1/index.vue b/src/views/task/selftrans/random/components/steps/step1/index.vue
index 293b16e..b60d007 100644
--- a/src/views/task/selftrans/random/components/steps/step1/index.vue
+++ b/src/views/task/selftrans/random/components/steps/step1/index.vue
@@ -36,7 +36,7 @@
-
+
@@ -47,14 +47,23 @@
未知
-
-
-
-
+
+
+
+ handleSortChange(scope.row, val)"
+ />
+
+
+
+
+ 总分:{{ totalScore }}
+
{
loading.value = false
}
}
+const totalScore = computed(() => {
+ return list.value.reduce((sum, item) => {
+ // 确保字段存在且为数字
+ const score = parseFloat(item.subtotalScore) || 0;
+ return sum + score;
+ }, 0);
+});
+// 排序值修改后自动调用接口
+const handleSortChange = async (row, newValue) => {
+ if (newValue < 0) {
+ message.error('排序不能小于 0')
+ row.sort = 0
+ return
+ }
+ // 1. 获取所有 quTitle 相同的项
+ const sameTitleItems = list.value.filter(item => item.quTitle === row.quTitle)
+ // 2. 批量更新 sort 值
+ const updateList = sameTitleItems.map(item => ({
+ ...item,
+ sort: newValue
+ }))
+
+ try {
+ // 假设后端支持批量更新接口
+ await Promise.all(updateList.map(item => SmsChannelApi.updateScheme(item)))
+ message.success('同别名方案的排序已同步更新')
+ getList()
+ } catch (error) {
+ message.error('排序更新失败')
+ }
+}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
diff --git a/src/views/task/selftrans/random/components/task-add.vue b/src/views/task/selftrans/random/components/task-add.vue
index 18ecf24..2240003 100644
--- a/src/views/task/selftrans/random/components/task-add.vue
+++ b/src/views/task/selftrans/random/components/task-add.vue
@@ -8,6 +8,9 @@
label-width="80px"
@submit.prevent=""
>
+
+
+
{
/** 弹窗打开事件 */
const handleOpen = () => {
- if (props.data) {
- assignFields(props.data);
- isUpdate.value = true;
- } else {
- resetFields();
- isUpdate.value = false;
- }
+ // 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');
+ const datetimeStr = [
+ now.getFullYear(),
+ pad(now.getMonth() + 1),
+ pad(now.getDate()),
+ pad(now.getHours()),
+ pad(now.getMinutes()),
+ pad(now.getSeconds())
+ ].join('');
+
+ const randomNum = Math.floor(Math.random() * 100000).toString().padStart(5, '0');
+ //taskNum 赋值 randomNum
+
+ // 把 taskNum 设置为当前时间+随机数
+ form.taskNum = `${datetimeStr}${randomNum}`;
nextTick(() => {
nextTick(() => {
formRef.value?.clearValidate?.();
@@ -212,5 +234,5 @@ const fetchSpecialtyOptions = async () => {
onMounted(() => {
fetchSpecialtyOptions();
});
-
+defineExpose({ handleOpen })
\ No newline at end of file
diff --git a/src/views/task/selftrans/random/index.vue b/src/views/task/selftrans/random/index.vue
index 21f70cf..edf0e81 100644
--- a/src/views/task/selftrans/random/index.vue
+++ b/src/views/task/selftrans/random/index.vue
@@ -73,6 +73,7 @@
+
@@ -223,6 +224,10 @@ const formRef = ref();
const openForm = (type: string, id?: number) => {
showAdd.value = true
taskAddRef.value?.open(type, id)
+
+ nextTick(() => {
+ taskAddRef.value?.open(type, id)
+ });
}
/** 状态切换处理 */
@@ -248,7 +253,10 @@ const openEdit = (type: string, row?: object) => {
showEdit.value = true
current.value = row
console.log( current.value )
- taskEditRef.value?.open(type, row)
+
+ nextTick(() => {
+ taskEditRef.value?.open(type, row)
+ });
}
const openBank = () => {
diff --git a/src/views/task/sprint/components/steps/step1/components/step-edit.vue b/src/views/task/sprint/components/steps/step1/components/step-edit.vue
index 993aeef..2b6246a 100644
--- a/src/views/task/sprint/components/steps/step1/components/step-edit.vue
+++ b/src/views/task/sprint/components/steps/step1/components/step-edit.vue
@@ -87,7 +87,7 @@
-
+
@@ -168,7 +168,7 @@ const form = ref<{
const rules = reactive({
spName: [{ required: true, message: '请选择题型', trigger: 'change' }],
quLevel: [{ required: true, message: '请选择难度', trigger: 'change' }],
- sort: [{ required: true, message: '请设置排序', trigger: 'change' }],
+ // sort: [{ required: true, message: '请设置排序', trigger: 'change' }],
quTitle: [{ required: true, message: '请输入别名', trigger: 'change' }],
pointName: [{ required: true, message: '请选择知识点', trigger: 'change' }],
quNumbers: [{ required: true, message: '请输入试题数量', trigger: 'blur' }],
@@ -223,11 +223,29 @@ const open = async (type: 'create' | 'update', data?: any) => {
sort: undefined,
taskSpecialty: props.taskSpecialty
}
+ // 清除校验
+ await nextTick()
+ const allKeys = getAllTreeKeys(pointOptions.value).map(String)
+ form.value.pointName = allKeys
+ treeRef.value?.setCheckedKeys(allKeys)
}
- // 清除校验
- await nextTick()
- formRef.value?.clearValidate?.()
+
+}
+function getAllTreeKeys(tree: TreeNode[]): number[] {
+ const keys: number[] = []
+
+ const traverse = (nodes: TreeNode[]) => {
+ for (const node of nodes) {
+ keys.push(node.value)
+ if (node.children?.length) {
+ traverse(node.children)
+ }
+ }
+ }
+
+ traverse(tree)
+ return keys
}
/** --------- 拉取扁平知识点并建树 --------- **/
@@ -329,7 +347,7 @@ const save = async () => {
const fn = isUpdate.value ? updateScheme : addScheme
await fn(payload)
emit('done')
- visible.value = false
+
} finally {
loading.value = false
}
diff --git a/src/views/task/sprint/components/steps/step1/index.vue b/src/views/task/sprint/components/steps/step1/index.vue
index ef7b5e5..0fc9fcb 100644
--- a/src/views/task/sprint/components/steps/step1/index.vue
+++ b/src/views/task/sprint/components/steps/step1/index.vue
@@ -36,7 +36,7 @@
-
+
@@ -47,14 +47,24 @@
未知
-
-
-
-
+
+
+
+ handleSortChange(scope.row, val)"
+ />
+
+
+
+
+
+
+ 总分:{{ totalScore }}
+
+
{
getList()
}
+const totalScore = computed(() => {
+ return list.value.reduce((sum, item) => {
+ // 确保字段存在且为数字
+ const score = parseFloat(item.subtotalScore) || 0;
+ return sum + score;
+ }, 0);
+});
+// 排序值修改后自动调用接口
+const handleSortChange = async (row, newValue) => {
+ if (newValue < 0) {
+ message.error('排序不能小于 0')
+ row.sort = 0
+ return
+ }
+
+ // 1. 获取所有 quTitle 相同的项
+ const sameTitleItems = list.value.filter(item => item.quTitle === row.quTitle)
+
+ // 2. 批量更新 sort 值
+ const updateList = sameTitleItems.map(item => ({
+ ...item,
+ sort: newValue
+ }))
+
+ try {
+ // 假设后端支持批量更新接口
+ await Promise.all(updateList.map(item => SmsChannelApi.updateScheme(item)))
+ message.success('同别名方案的排序已同步更新')
+ getList()
+ } catch (error) {
+ message.error('排序更新失败')
+ }
+}
+
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
diff --git a/src/views/task/sprint/components/steps/step2/index.vue b/src/views/task/sprint/components/steps/step2/index.vue
index 35814e0..9661a4a 100644
--- a/src/views/task/sprint/components/steps/step2/index.vue
+++ b/src/views/task/sprint/components/steps/step2/index.vue
@@ -74,7 +74,7 @@
-
+
diff --git a/src/views/task/sprint/components/steps/step4/components/step-edit.vue b/src/views/task/sprint/components/steps/step4/components/step-edit.vue
index b3fdd5d..050aba5 100644
--- a/src/views/task/sprint/components/steps/step4/components/step-edit.vue
+++ b/src/views/task/sprint/components/steps/step4/components/step-edit.vue
@@ -19,6 +19,15 @@
+
+
+
+
@@ -99,6 +109,8 @@
import { ref, reactive, nextTick } from 'vue'
import { addSession, updateSession } from '@/api/system/session'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
+import { watch } from 'vue'
+import dayjs from 'dayjs'
const emit = defineEmits(['done'])
const props = defineProps({
data: Object,
@@ -116,6 +128,7 @@ const form = ref({
taskId: props.taskId ?? '',
batch: '',
startTime: '',
+ answerTime:'',
endTime: '',
allowEntry: '',
endAllowEntry: '',
@@ -149,6 +162,7 @@ const open = async (type: 'create' | 'update', data?: any) => {
taskId: props.taskId ?? '',
batch: '',
startTime: '',
+ answerTime:'01:00:00',
endTime: '',
allowEntry: '',
endAllowEntry: '',
@@ -178,7 +192,20 @@ const open = async (type: 'create' | 'update', data?: any) => {
await nextTick()
formRef.value?.clearValidate?.()
}
-
+// 监听考试开始时间和考试时长,自动计算考试结束时间
+watch(() => [form.value.startTime, form.value.answerTime], ([startTime, answerTime]) => {
+ if (startTime && answerTime) {
+ const [hours, minutes, seconds] = answerTime.split(':').map(Number)
+ const end = dayjs(startTime)
+ .add(hours, 'hour')
+ .add(minutes, 'minute')
+ .add(seconds, 'second')
+ .format('YYYY-MM-DD HH:mm:ss')
+ form.value.endTime = end
+ } else {
+ form.value.endTime = ''
+ }
+})
// 保存按钮
const save = async () => {
await formRef.value.validate()
@@ -192,6 +219,6 @@ const save = async () => {
loading.value = false
}
}
-
defineExpose({ open })
+
diff --git a/src/views/task/sprint/components/task-add.vue b/src/views/task/sprint/components/task-add.vue
index a4e6fe2..627f58b 100644
--- a/src/views/task/sprint/components/task-add.vue
+++ b/src/views/task/sprint/components/task-add.vue
@@ -8,6 +8,9 @@
label-width="80px"
@submit.prevent=""
>
+
+
+
{
};
/** 弹窗打开事件 */
- const handleOpen = () => {
- if (props.data) {
- assignFields(props.data);
- isUpdate.value = true;
- } else {
- resetFields();
- isUpdate.value = false;
- }
+ 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');
+ const datetimeStr = [
+ now.getFullYear(),
+ pad(now.getMonth() + 1),
+ pad(now.getDate()),
+ pad(now.getHours()),
+ pad(now.getMinutes()),
+ pad(now.getSeconds())
+ ].join('');
+
+ const randomNum = Math.floor(Math.random() * 100000).toString().padStart(5, '0');
+ //taskNum 赋值 randomNum
+
+ // 把 taskNum 设置为当前时间+随机数
+ form.taskNum = `${datetimeStr}${randomNum}`;
nextTick(() => {
nextTick(() => {
formRef.value?.clearValidate?.();
@@ -212,5 +233,5 @@ const fetchSpecialtyOptions = async () => {
onMounted(() => {
fetchSpecialtyOptions();
});
-
+defineExpose({ open })
\ No newline at end of file
diff --git a/src/views/task/sprint/index.vue b/src/views/task/sprint/index.vue
index 4febd56..eb7d51b 100644
--- a/src/views/task/sprint/index.vue
+++ b/src/views/task/sprint/index.vue
@@ -73,6 +73,7 @@
+
@@ -240,14 +241,17 @@ const handleSelectionChange = (rows) => {
const formRef = ref();
const openForm = (type: string, id?: number) => {
showAdd.value = true
- taskAddRef.value?.open(type, id)
+ nextTick(() => {
+ taskAddRef.value?.open(type, id)
+ });
}
const openEdit = (type: string, row?: object) => {
showEdit.value = true
current.value = row
- console.log( current.value )
- taskEditRef.value?.open(type, row)
+ nextTick(() => {
+ taskEditRef.value?.open(type, row)
+ });
}
const openBank = () => {
diff --git a/src/views/task/trans/components/steps/step1/components/step-edit.vue b/src/views/task/trans/components/steps/step1/components/step-edit.vue
index 993aeef..d99c88b 100644
--- a/src/views/task/trans/components/steps/step1/components/step-edit.vue
+++ b/src/views/task/trans/components/steps/step1/components/step-edit.vue
@@ -87,7 +87,7 @@
-
+
@@ -223,11 +223,28 @@ const open = async (type: 'create' | 'update', data?: any) => {
sort: undefined,
taskSpecialty: props.taskSpecialty
}
+ // 清除校验
+ await nextTick()
+ const allKeys = getAllTreeKeys(pointOptions.value).map(String)
+ form.value.pointName = allKeys
+ treeRef.value?.setCheckedKeys(allKeys)
+ }
+
+}
+function getAllTreeKeys(tree: TreeNode[]): number[] {
+ const keys: number[] = []
+
+ const traverse = (nodes: TreeNode[]) => {
+ for (const node of nodes) {
+ keys.push(node.value)
+ if (node.children?.length) {
+ traverse(node.children)
+ }
+ }
}
- // 清除校验
- await nextTick()
- formRef.value?.clearValidate?.()
+ traverse(tree)
+ return keys
}
/** --------- 拉取扁平知识点并建树 --------- **/
diff --git a/src/views/task/trans/components/steps/step1/index.vue b/src/views/task/trans/components/steps/step1/index.vue
index 6f34381..16c579e 100644
--- a/src/views/task/trans/components/steps/step1/index.vue
+++ b/src/views/task/trans/components/steps/step1/index.vue
@@ -37,7 +37,7 @@
-
+
@@ -48,14 +48,24 @@
未知
-
-
-
+
+
+
+ handleSortChange(scope.row, val)"
+ />
+
+
+
+
+ 总分:{{ totalScore }}
+
{
+ return list.value.reduce((sum, item) => {
+ // 确保字段存在且为数字
+ const score = parseFloat(item.subtotalScore) || 0;
+ return sum + score;
+ }, 0);
+});
+// 排序值修改后自动调用接口
+const handleSortChange = async (row, newValue) => {
+ if (newValue < 0) {
+ message.error('排序不能小于 0')
+ row.sort = 0
+ return
+ }
+ // 1. 获取所有 quTitle 相同的项
+ const sameTitleItems = list.value.filter(item => item.quTitle === row.quTitle)
+ // 2. 批量更新 sort 值
+ const updateList = sameTitleItems.map(item => ({
+ ...item,
+ sort: newValue
+ }))
+
+ try {
+ // 假设后端支持批量更新接口
+ await Promise.all(updateList.map(item => SmsChannelApi.updateScheme(item)))
+ message.success('同别名方案的排序已同步更新')
+ getList()
+ } catch (error) {
+ message.error('排序更新失败')
+ }
+}
const loading = ref(false) // 列表的加载中
const total = ref(0) // 列表的总页数
diff --git a/src/views/task/trans/components/steps/step2/index.vue b/src/views/task/trans/components/steps/step2/index.vue
index 35814e0..9661a4a 100644
--- a/src/views/task/trans/components/steps/step2/index.vue
+++ b/src/views/task/trans/components/steps/step2/index.vue
@@ -74,7 +74,7 @@
-
+
diff --git a/src/views/task/trans/components/task-add.vue b/src/views/task/trans/components/task-add.vue
index 28d71ac..b487d3b 100644
--- a/src/views/task/trans/components/task-add.vue
+++ b/src/views/task/trans/components/task-add.vue
@@ -1,6 +1,6 @@
-