From b0e5ceb44f3111033dd79d91802a5ac60dd6f113 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=BE=89?= <814457906@qq.com>
Date: Fri, 11 Jul 2025 09:27:36 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/layout/components/TagsView/index.vue | 8 +-
src/views/exam/exam/form.vue | 233 ++++++-----------------
2 files changed, 65 insertions(+), 176 deletions(-)
diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue
index 7739468..eea9359 100644
--- a/src/layout/components/TagsView/index.vue
+++ b/src/layout/components/TagsView/index.vue
@@ -17,10 +17,10 @@
diff --git a/src/views/exam/exam/form.vue b/src/views/exam/exam/form.vue
index 822313c..1364c29 100644
--- a/src/views/exam/exam/form.vue
+++ b/src/views/exam/exam/form.vue
@@ -1,202 +1,113 @@
-
组卷信息
-
试卷总分:{{ postForm.totalScore }}分
-
-
添加题库
-
-
-
+
+
-
-
-
-
+
- / {{ scope.row.totalRadio }}
+ / {{ scope.row.totalRadio }}
-
-
-
+
-
-
-
+
- / {{ scope.row.totalMulti }}
+ / {{ scope.row.totalMulti }}
-
-
-
+
-
-
-
+
- / {{ scope.row.totalJudge }}
+ / {{ scope.row.totalJudge }}
-
-
-
+
-
-
+
-
-
-
-
考试配置
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
权限配置
-
完全公开
部门开放
-
-
-
-
@@ -210,7 +121,6 @@ export default {
components: { RepoSelect },
data() {
return {
-
treeData: [],
defaultProps: {
label: 'deptName'
@@ -218,6 +128,7 @@ export default {
filterText: '',
treeLoading: false,
dateValues: [],
+ timeValues: undefined,
// 题库
repoList: [],
// 已选择的题库
@@ -230,33 +141,35 @@ export default {
// 开放类型
openType: 1,
// 考试班级列表
- departIds: []
+ departIds: [],
+ startDate: '',
+ endDate: '',
+ startTime: '',
+ endTime: '',
+ examFee: undefined,
},
rules: {
title: [
{ required: true, message: '考试名称不能为空!' }
],
-
+ examFee: [
+ { required: true, message: '考试费用不能为空!' }
+ ],
content: [
{ required: true, message: '考试名称不能为空!' }
],
-
open: [
{ required: true, message: '考试权限不能为空!' }
],
-
totalScore: [
{ required: true, message: '考试分数不能为空!' }
],
-
qualifyScore: [
{ required: true, message: '及格分不能为空!' }
],
-
totalTime: [
{ required: true, message: '考试时间不能为空!' }
],
-
ruleId: [
{ required: true, message: '考试规则不能为空' }
],
@@ -266,43 +179,40 @@ export default {
}
}
},
-
watch: {
-
filterText(val) {
this.$refs.tree.filter(val)
},
-
dateValues: {
-
handler() {
- this.postForm.startTime = this.dateValues[0]
- this.postForm.endTime = this.dateValues[1]
+ this.postForm.startDate = this.dateValues[0]
+ this.postForm.endDate = this.dateValues[1]
+ }
+ },
+ timeValues: {
+ handler() {
+ this.postForm.startTime = this.timeValues[0]
+ this.postForm.endTime = this.timeValues[1]
}
},
-
// 题库变换
repoList: {
-
handler(val) {
let totalScore = 0
this.excludes = []
- for (let i = 0; i 0 && item.radioScore>0) {
+ if (item.radioCount > 0 && item.radioScore > 0) {
totalScore += item.radioCount * item.radioScore
}
-
- if (item.multiCount>0 && item.multiScore>0) {
+ if (item.multiCount > 0 && item.multiScore > 0) {
totalScore += item.multiCount * item.multiScore
}
-
- if (item.judgeCount>0 && item.judgeScore>0) {
+ if (item.judgeCount > 0 && item.judgeScore > 0) {
totalScore += item.judgeCount * item.judgeScore
}
this.excludes.push(item.id)
}
-
// 赋值
this.postForm.totalScore = totalScore
this.postForm.repoList = val
@@ -310,26 +220,22 @@ export default {
},
deep: true
}
-
},
created() {
const id = this.$route.params.id
if (typeof id !== undefined) {
this.fetchData(id)
}
-
fetchTree({}).then(response => {
this.treeData = response.data
})
},
methods: {
-
handleSave() {
this.$refs.postForm.validate((valid) => {
if (!valid) {
return
}
-
if (this.postForm.totalScore === 0) {
this.$notify({
title: '提示信息',
@@ -337,10 +243,8 @@ export default {
type: 'warning',
duration: 2000
})
-
return
}
-
for (let i = 0; i < this.postForm.repoList.length; i++) {
const repo = this.postForm.repoList[i]
if (!repo.repoId) {
@@ -352,7 +256,6 @@ export default {
})
return
}
-
if ((repo.radioCount > 0 && repo.radioScore === 0) || (repo.radioCount === 0 && repo.radioScore > 0)) {
this.$notify({
title: '提示信息',
@@ -360,10 +263,8 @@ export default {
type: 'warning',
duration: 2000
})
-
return
}
-
if ((repo.multiCount > 0 && repo.multiScore === 0) || (repo.multiCount === 0 && repo.multiScore > 0)) {
this.$notify({
title: '提示信息',
@@ -371,10 +272,8 @@ export default {
type: 'warning',
duration: 2000
})
-
return
}
-
if ((repo.judgeCount > 0 && repo.judgeScore === 0) || (repo.judgeCount === 0 && repo.judgeScore > 0)) {
this.$notify({
title: '提示信息',
@@ -385,7 +284,6 @@ export default {
return
}
}
-
this.$confirm('确实要提交保存吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
@@ -395,7 +293,6 @@ export default {
})
})
},
-
handleCheckChange() {
const that = this
// 置空
@@ -405,32 +302,30 @@ export default {
that.postForm.departIds.push(item.id)
})
},
-
// 添加子项
handleAdd() {
this.repoList.push({ id: '', rowId: new Date().getTime(), radioCount: 0, radioScore: 0, multiCount: 0, multiScore: 0, judgeCount: 0, judgeScore: 0, saqCount: 0, saqScore: 0 })
},
-
removeItem(index) {
this.repoList.splice(index, 1)
},
-
fetchData(id) {
fetchDetail(id).then(response => {
this.postForm = response.data
-
+ if (this.postForm.startDate && this.postForm.endDate) {
+ this.dateValues[0] = this.postForm.startDate
+ this.dateValues[1] = this.postForm.endDate
+ }
if (this.postForm.startTime && this.postForm.endTime) {
- this.dateValues[0] = this.postForm.startTime
- this.dateValues[1] = this.postForm.endTime
+ this.timeValues[0] = this.postForm.startTime
+ this.timeValues[1] = this.postForm.endTime
}
this.repoList = this.postForm.repoList
})
},
-
submitForm() {
// 校验和处理数据
this.postForm.repoList = this.repoList
-
saveData(this.postForm).then(() => {
this.$notify({
title: '成功',
@@ -438,20 +333,16 @@ export default {
type: 'success',
duration: 2000
})
-
this.$router.push({ name: 'ListExam' })
})
},
-
filterNode(value, data) {
if (!value) return true
return data.deptName.indexOf(value) !== -1
},
-
repoChange(e, row) {
// 赋值ID
row.id = e.id
-
if (e != null) {
row.totalRadio = e.radioCount
row.totalMulti = e.multiCount
@@ -462,8 +353,6 @@ export default {
row.totalJudge = 0
}
}
-
}
}
-