批量删除
@@ -165,6 +165,11 @@ export default {
}).catch(res => {})
}
},
+ initData() {
+ this.$refs.table.clearSelection();
+ this.page = 1;
+ this.getData();
+ },
// 分页
handlePage(){
const list = this.listDataAll
diff --git a/src/pages/assessment/add/index.vue b/src/pages/assessment/add/index.vue
index 07eb2b6..8f85195 100644
--- a/src/pages/assessment/add/index.vue
+++ b/src/pages/assessment/add/index.vue
@@ -5,7 +5,7 @@
- {{ form.id ? "更新" : "创建" }}
+ {{ form.id ? "更新" : "创建" }}
@@ -264,15 +264,29 @@ export default {
"assFields"
])
},
+ // 离开的时候判断是否有保存更改的信息,没有则拦截并提示
+ beforeRouteLeave(to, from, next) {
+ if(!this.isToProject && this.updateTime){
+ this.$confirm(`您所更改的内容未更新,是否更新?`, '提示', {
+ type: 'warning'
+ }).then(() => {
+ this.save(next)
+ }).catch(() => {
+ next()
+ })
+ }else{
+ next()
+ }
+ },
+ beforeDestroy() {
+ if (!this.isToProject) this.setAss({});
+ },
mounted() {
this.date = [util.formatDate("yyyy-MM-dd hh:mm:ss", new Date(new Date().getTime() + 300000)), util.formatDate("yyyy-MM-dd hh:mm:ss", new Date(new Date().getTime() + 300000))];
this.form.id && this.getData();
this.recoveryData();
this.getschoolCourse();
},
- beforeDestroy() {
- if (!this.isToProject) this.setAss({});
- },
watch: {
// 监听信息是否有更改,有的话页面离开的时候要询问是否要保存
form: {
@@ -285,11 +299,13 @@ export default {
if (val[0] != "0000-00-00 00:00:00") {
this.startTime = util.formatDate("yyyy-MM-dd hh:mm:ss", new Date(val[0]));
this.stopTime = util.formatDate("yyyy-MM-dd hh:mm:ss", new Date(val[1]));
+ this.updateTime++
}
},
duration: {
handler(n, o) {
this.form.experimentDuration = `${n.day ? n.day : 0}d${n.hour ? n.hour : 0}h${n.minute ? n.minute : 0}m`;
+ this.updateTime++
},
deep: true
},
@@ -398,6 +414,9 @@ export default {
this.getProjectData();
}
}
+ this.$nextTick(() => {
+ this.updateTime = 0
+ })
}).catch(err => {
console.log(err);
});
@@ -409,7 +428,8 @@ export default {
pageSize:this.pageSize,
cid:this.form.curriculumId,
projectName:this.keyword,
- systemId: curItem ? curItem.systemId : 1
+ systemId: curItem ? curItem.systemId : 1,
+ permissions: 1
}
this.$post(this.api.projectListByCourseId,data).then(res => {
let { status, data } = res;
@@ -428,7 +448,7 @@ export default {
this.page = 1;
this.getProjectData();
},
- submit() { // 提交
+ save(cb) { // 提交
if (this.submiting) return false
if (!this.form.experimentalName) return util.warningMsg("请填写考核名称");
if (this.expNameRepeat) return util.warningMsg("考核名称重复,请重新输入");
@@ -479,15 +499,17 @@ export default {
this.submiting = true
if (this.form.id) {
this.$post(this.api.modifyAssessment, this.form).then(res => {
+ this.updateTime = 0
util.successMsg("修改成功");
- this.$router.back();
+ cb ? cb() : this.$router.back()
}).catch(err => {
this.submiting = false
});
} else {
this.$post(this.api.saveAssessment, this.form).then(res => {
+ this.updateTime = 0
util.successMsg("创建成功");
- this.$router.back();
+ cb ? cb() : this.$router.back()
}).catch(err => {
this.submiting = false
});
@@ -509,6 +531,9 @@ export default {
minute: duration[2]
};
this.date = [this.startTime, this.stopTime];
+ this.$nextTick(() => {
+ this.updateTime = 0
+ })
},
recoveryData() { // 恢复数据
if (JSON.stringify(this.assFields) != "{}") {
@@ -542,7 +567,7 @@ export default {
},
toProject() {
this.handleCacheData();
- this.$router.push("/project/list/?show=1");
+ this.$router.push("/project/list?show=1");
},
showProject(row) {
this.handleCacheData();
@@ -564,18 +589,18 @@ export default {
this.$router.back()
},
goBack() {
- const { id } = this.form
- const updateTime = this.updateTime
// 更改了信息才需要提示
- if (updateTime > 1) {
+ if (this.updateTime) {
this.$confirm(`编辑的内容未保存,是否保存?`, '提示', {
type: 'warning'
}).then(() => {
- this.submit()
+ this.save()
}).catch(() => {
+ this.updateTime = 0
this.backPage()
})
} else {
+ this.updateTime = 0
this.backPage()
}
}
diff --git a/src/pages/course/add/index.vue b/src/pages/course/add/index.vue
index 09ee47c..9586fb3 100644
--- a/src/pages/course/add/index.vue
+++ b/src/pages/course/add/index.vue
@@ -73,7 +73,7 @@
- {{ form.id ? "更新" : "创建" }}
+ {{ form.id ? "更新" : "创建" }}
@@ -218,6 +218,20 @@ export default {
deep:true
}
},
+ // 离开的时候判断是否有保存更改的信息,没有则拦截并提示
+ beforeRouteLeave(to, from, next) {
+ if(this.updateTime){
+ this.$confirm(`您所更改的内容未更新,是否更新?`, '提示', {
+ type: 'warning'
+ }).then(() => {
+ this.save(next)
+ }).catch(() => {
+ next()
+ })
+ }else{
+ next()
+ }
+ },
mounted() {
this.getClassification()
this.form.id && this.getData()
@@ -259,7 +273,9 @@ export default {
}
this.visibleChange(data.visibleRange)
this.form = data
-
+ this.$nextTick(() => {
+ this.updateTime = 0
+ })
this.uploadList.push({
name: "cover.jpg",
url: data.coverUrl
@@ -304,7 +320,7 @@ export default {
this.form.coverUrl = ''
}).catch(res => {});
},
- save() {
+ save(cb) {
this.$refs.form.validate((valid) => {
if (valid) {
if (this.nameRepeat) return util.errorMsg('当前课程名已存在!')
@@ -315,15 +331,17 @@ export default {
form.courseId = form.id
form.platformSource = Setting.platformSource
this.$post(this.api.updateTheoreticalCourse, form).then(res => {
+ this.updateTime = 0
this.submiting = false;
util.successMsg("修改成功");
- this.$router.back();
+ cb ? cb() : this.$router.back()
}).catch(err => {
this.submiting = false;
});
} else {
this.$post(this.api.saveTheoreticalCourse, form).then(({ courseId }) => {
this.submiting = false;
+ this.updateTime = 0
this.$confirm("课程创建成功,是否马上进行课程内容设置?", "提示", {
type: "success",
confirmButtonText: "马上设置",
@@ -331,7 +349,7 @@ export default {
}).then(() => {
this.$router.replace(`/course/contentSettings?id=${courseId}`);
}).catch(() => {
- this.$router.back();
+ cb ? cb() : this.$router.back()
});
}).catch(err => {
this.submiting = false;
@@ -345,18 +363,19 @@ export default {
this.$router.back()
},
back() {
- const { id } = this.form
const updateTime = this.updateTime
// 更改了信息才需要提示
- if ((id && updateTime > 2) || (!id && updateTime)) {
+ if (updateTime) {
this.$confirm(`编辑的内容未保存,是否保存?`, '提示', {
type: 'warning'
}).then(() => {
this.save()
}).catch(() => {
+ this.updateTime = 0
this.backPage()
})
} else {
+ this.updateTime = 0
this.backPage()
}
}
diff --git a/src/pages/evaluation/list/index.vue b/src/pages/evaluation/list/index.vue
index bed76e5..de4b569 100644
--- a/src/pages/evaluation/list/index.vue
+++ b/src/pages/evaluation/list/index.vue
@@ -372,7 +372,7 @@ export default {
this.$get(`${this.api.questionsDetail}`, { id }).then(res => {
this.topicForm = res.questions;
this.topicForm.id = id;
- this.topicForm.questionType = res.questions.questionTypeName;
+ this.$set(this.topicForm, 'questionType', res.questions.questionTypeName)
this.NewTopics = true;
}).catch(err => {
console.log(err);
@@ -454,6 +454,7 @@ export default {
});
},
questionTypeChange() {
+ console.log(11, this.topicForm.questionType)
for (let i in this.topicForm) {
if (i.includes("isTrue")) this.topicForm[i] = false;
}
diff --git a/src/pages/information/addarticle/index.vue b/src/pages/information/addarticle/index.vue
index b0a6f30..9eaee62 100644
--- a/src/pages/information/addarticle/index.vue
+++ b/src/pages/information/addarticle/index.vue
@@ -2,7 +2,7 @@
-
+
@@ -45,7 +45,7 @@
- 确定
+ 确定
@@ -61,6 +61,7 @@ export default {
name: "addarticle",
data() {
return {
+ id: this.$route.query.id,
headers: {
token: util.local.get(Setting.tokenKey)
},
@@ -95,7 +96,8 @@ export default {
uploadList: [],
uploadDataList: [],
submiting: false,
- uploading: false
+ uploading: false,
+ updateTime: 0,
};
},
computed: {
@@ -106,50 +108,41 @@ export default {
components: {
quill
},
+ watch: {
+ // 监听信息是否有更改,有的话页面离开的时候要询问是否要保存
+ form: {
+ handler(val){
+ this.updateTime++
+ },
+ deep:true
+ }
+ },
+ // 离开的时候判断是否有保存更改的信息,没有则拦截并提示
+ beforeRouteLeave(to, from, next) {
+ if(this.updateTime){
+ this.$confirm(`您所更改的内容未更新,是否更新?`, '提示', {
+ type: 'warning'
+ }).then(() => {
+ this.save(next)
+ }).catch(() => {
+ next()
+ })
+ }else{
+ next()
+ }
+ },
mounted() {
- this.id = this.$route.query.id;
this.id && this.getData();
},
methods: {
- // 返回
- goBack() {
- this.$router.back();
- },
getData() {
this.$get(`${this.api.getArticle}?articleId=${this.id}`).then(({ article }) => {
this.form = article
+ this.$nextTick(() => {
+ this.updateTime = 0
+ })
}).catch(err => {})
},
- saveData() {
- this.$refs.form.validate((valid) => {
- if (valid) {
- if (this.submiting) return false
- const { form } = this
- if (this.uploading) return util.warningMsg("图片正在上传中,请稍等");
- this.submiting = true
- if (form.id) {
- this.$put(this.api.editArticle, form).then(res => {
- this.submiting = false;
- util.successMsg("修改成功");
- this.back();
- })
- .catch(err => {
- this.submiting = false;
- });
- } else {
- this.createUser = this.customerName || this.userName
- this.$post(this.api.addArticle, form).then(res => {
- this.submiting = false;
- util.successMsg("创建成功");
- this.back();
- })
- .catch(err => {
- this.submiting = false;
- });
- }
- }
- })
- },
handleCurrentChange(val) {
this.currPage = val;
},
@@ -188,19 +181,6 @@ export default {
this.keyword = "";
this.getData();
},
- back() {
- this.$router.back();
- },
- goback() {
- this.$confirm("确定返回?未更新的信息将不会保存。", "提示", {
- type: "warning"
- })
- .then(() => {
- this.back();
- })
- .catch(() => {
- });
- },
addSponsor() {
this.sponsorList.push("");
},
@@ -212,6 +192,54 @@ export default {
},
delOrganizer(index) {
this.organzinerList.splice(index, 1);
+ },
+ save(cb) {
+ this.$refs.form.validate((valid) => {
+ if (valid) {
+ if (this.submiting) return false
+ const { form } = this
+ if (this.uploading) return util.warningMsg("图片正在上传中,请稍等");
+ this.submiting = true
+ if (form.id) {
+ this.$put(this.api.editArticle, form).then(res => {
+ this.submiting = false;
+ util.successMsg("修改成功");
+ this.updateTime = 0
+ cb ? cb() : this.$router.back()
+ })
+ .catch(err => {
+ this.submiting = false;
+ });
+ } else {
+ this.createUser = this.customerName || this.userName
+ this.$post(this.api.addArticle, form).then(res => {
+ this.submiting = false;
+ util.successMsg("创建成功");
+ this.updateTime = 0
+ cb ? cb() : this.$router.back()
+ })
+ .catch(err => {
+ this.submiting = false;
+ });
+ }
+ }
+ })
+ },
+ back() {
+ // 更改了信息才需要提示
+ if (this.updateTime) {
+ this.$confirm(`编辑的内容未保存,是否保存?`, '提示', {
+ type: 'warning'
+ }).then(() => {
+ this.save()
+ }).catch(() => {
+ this.updateTime = 0
+ this.$router.back()
+ })
+ } else {
+ this.updateTime = 0
+ this.$router.back()
+ }
}
}
};
diff --git a/src/pages/match/add/index.vue b/src/pages/match/add/index.vue
index ef8db35..f9e3f12 100644
--- a/src/pages/match/add/index.vue
+++ b/src/pages/match/add/index.vue
@@ -88,7 +88,7 @@ export default {
}
],
publishStatus: 0,
- competitionId: '',
+ competitionId: this.$route.query.id || '',
step: 1,
submiting: false,
updateTime: 0,
diff --git a/src/pages/match/add/set.vue b/src/pages/match/add/set.vue
index 74216a9..83f9308 100644
--- a/src/pages/match/add/set.vue
+++ b/src/pages/match/add/set.vue
@@ -71,10 +71,9 @@
{{ permissionsKeys[scope.row.permissions] }}
-
- {{ scope.row.createUser }}
+ {{ scope.row.founder ? '老师创建' : '系统内置' }}
@@ -154,9 +153,8 @@ export default {
},
// 课程选择回调
courseChange(val) {
- const { sysId, sysName } = this.curriculumList.find(e => e.cid == this.form.cid)
- this.form.sysName = sysName
- this.sysId = sysId
+ const { systemId } = this.curriculumList.find(e => e.cid == this.form.cid)
+ this.sysId = systemId
if (val) this.loadIns = Loading.service()
this.getProject()
},
@@ -187,9 +185,11 @@ export default {
},
// 自定义项目
toProject() {
+ const { form, curStep } = this.$parent
+ form[curStep] = this.form
this.$store.commit('match/setCache', {
- form: this.form,
- curStep: this.$parent.curStep
+ form,
+ curStep
})
this.$router.push(`/project/list?show=1`)
},
@@ -226,11 +226,10 @@ export default {
if (new Date(form.time[0]) < new Date(playStartTime) || new Date(form.time[1]) > new Date(playEndTime)) return util.warningMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。')
if (!form.cid) return util.warningMsg('请选择课程')
if (!form.projectId) return util.warningMsg('请选择项目')
- const cur = this.curriculumList.find(e => e.cid == form.cid)
- if (cur) form.systemName = cur.sysName
- const { systemId, projectName } = this.projects.find(e => e.projectId == form.projectId)
+ const { systemId, systemName, projectName } = this.projects.find(e => e.projectId == form.projectId)
if (systemId) form.systemId = systemId
if (projectName) form.projectName = projectName
+ if (systemName) form.systemName = systemName
form.startTime = form.time[0]
form.endTime = form.time[1]
this.$emit('hideSet', this.form)
diff --git a/src/pages/match/add/step2.vue b/src/pages/match/add/step2.vue
index ce90f7e..aa0511a 100644
--- a/src/pages/match/add/step2.vue
+++ b/src/pages/match/add/step2.vue
@@ -28,7 +28,7 @@
)
-
+
各阶段成绩加权求和
各阶段成绩直接求和
各阶段成绩取平均值
@@ -280,13 +280,19 @@ export default {
},
// 阶段数量选择回调
stageChange(val) {
- const list = []
- for (let i = 1; i <= val; i++) {
- const form = JSON.parse(JSON.stringify(this.ruleForm))
- form.number = i
- list.push(form)
+ const stages = this.form.competitionStageList
+ const { ruleId } = this.form
+ if (stages.length < val) {
+ const list = []
+ for (let i = 1; i <= val - stages.length; i++) {
+ const form = JSON.parse(JSON.stringify(this.ruleForm))
+ form.number = stages.length + i
+ if (ruleId) form.ruleId = ruleId
+ this.form.competitionStageList.push(form)
+ }
+ } else {
+ this.form.competitionStageList = stages.slice(0, val)
}
- this.form.competitionStageList = list
},
// 提交
save(status, next = 0) {
@@ -300,6 +306,7 @@ export default {
const stages = form.competitionStageList
if (form.rule === 2) { // 单项赛只需要输入成绩公布时间
const e = stages[0]
+ e.stageName = step1.name
if (!e.resultsDetails) {
if (e.resultAnnouncementTime === '') {
return util.errorMsg('请填写成绩公布时间')
diff --git a/src/pages/match/add/step3.vue b/src/pages/match/add/step3.vue
index c47a3c1..7d6824b 100644
--- a/src/pages/match/add/step3.vue
+++ b/src/pages/match/add/step3.vue
@@ -134,7 +134,7 @@ export default {
resumeData() {
if (this.cache) {
this.curStep = this.cache.curStep
- if (this.cache.form) this.form[this.curStep] = this.cache.form
+ if (this.cache.form) this.form = this.cache.form
this.setVisible = true
this.$store.commit('match/setCache', null)
}
@@ -278,7 +278,7 @@ export default {
}).then(res => {
this.$parent.hideLoad()
// 新增赛事,并且点的是发布按钮,则发布该赛事
- !form[0].contentId && status && this.publish(status)
+ status && this.publish(status)
util.successMsg((status ? '发布' : '保存') + '成功')
this.$emit('next', next)
}).catch(err => {
diff --git a/src/pages/match/manage/matchArchList.vue b/src/pages/match/manage/matchArchList.vue
index 37b01ad..1355dd1 100644
--- a/src/pages/match/manage/matchArchList.vue
+++ b/src/pages/match/manage/matchArchList.vue
@@ -93,6 +93,7 @@
:data="{
competitionId: this.id,
stageId: this.stageId,
+ systemId: 0
}"
>
上传文件
@@ -133,7 +134,7 @@ export default {
uploadFaild: false,
exportCode: '',
headers: {
- token: sessionStorage.getItem("token")
+ token: util.local.get(Setting.tokenKey)
},
statData: {}
};
@@ -173,7 +174,7 @@ export default {
},
// 查看成绩报告
show(row) {
- this.$router.push(`/matchReport?reportId=${row.reportId}`)
+ this.$router.push(`/match/report?reportId=${row.reportId}`)
},
// 导出(有勾选:就导勾选中的;没有勾选:就导全部)
exportData() {
@@ -183,6 +184,7 @@ export default {
url += `&ids=${ids.toString()}`
}
axios.post(this.api.exportExperimentalResultsInBatch, this.list, {
+ headers: this.headers,
responseType: 'blob'
}).then((res) => {
util.downloadFileDirect(`赛事成绩.xls`,new Blob([res.data]))
diff --git a/src/pages/match/manage/matchInfo.vue b/src/pages/match/manage/matchInfo.vue
index fed3991..a881b34 100644
--- a/src/pages/match/manage/matchInfo.vue
+++ b/src/pages/match/manage/matchInfo.vue
@@ -25,18 +25,20 @@