|
|
|
@ -52,20 +52,21 @@ |
|
|
|
|
<el-card shadow="hover" class="mgr20 m-b-20"> |
|
|
|
|
<div> |
|
|
|
|
<p class="m-b-20">课程</p> |
|
|
|
|
<div class="inline-input"> |
|
|
|
|
<el-select v-model="form.mallId" @change="initData"> |
|
|
|
|
<el-option v-for="item in curriculumList" :key="item.mallId" :label="item.curriculumName" |
|
|
|
|
:value="item.mallId"> |
|
|
|
|
|
|
|
|
|
<el-radio-group v-model="courseTab" @change="courseChange"> |
|
|
|
|
<el-radio v-for="(item, i) in courseTypes" :key="i" :label="item.id">{{ item.name |
|
|
|
|
}}</el-radio> |
|
|
|
|
</el-radio-group> |
|
|
|
|
|
|
|
|
|
<div class="inline-input m-t-10"> |
|
|
|
|
<el-select v-if="courseTab" v-model="form.curriculumId" @change="initData"> |
|
|
|
|
<el-option v-for="(item, i) in curriculumList" :key="i" :label="item.curriculumName" :value="item.cid"> |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
<el-select v-else v-model="form.curriculumId" @change="initData"> |
|
|
|
|
<el-option v-for="(item, i) in myCurs" :key="i" :label="item.curriculumName" :value="item.cid"> |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
<!-- <el-select v-model="form.curriculumId" @change="initData"> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in systemList" |
|
|
|
|
:key="item.id" |
|
|
|
|
:label="item.label" |
|
|
|
|
:value="item.id"> |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> --> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</el-card> |
|
|
|
@ -180,20 +181,31 @@ export default { |
|
|
|
|
2: "竞赛" |
|
|
|
|
}, |
|
|
|
|
isDetail: Boolean(this.$route.query.show), |
|
|
|
|
courseTab: 1, |
|
|
|
|
courseTypes: [ |
|
|
|
|
{ |
|
|
|
|
id: 1, |
|
|
|
|
name: '校本课程' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 0, |
|
|
|
|
name: '我的课程' |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
form: { |
|
|
|
|
id: this.$route.query.id ? this.$route.query.id : "", |
|
|
|
|
experimentalName: "", |
|
|
|
|
id: this.$route.query.id ? this.$route.query.id : '', |
|
|
|
|
experimentalName: '', |
|
|
|
|
type: 1, // 发布类型(1、手动发布 2、定时发布) |
|
|
|
|
experimentDuration: "0d0h0m", |
|
|
|
|
curriculumId: "", |
|
|
|
|
curriculumId: '', |
|
|
|
|
mallId: '', |
|
|
|
|
projectId: '', |
|
|
|
|
paperId: '', |
|
|
|
|
isSpecify: 1, // 考核发布(1、指定范围 0、无指定范围) |
|
|
|
|
isEnableCode: 0, //是否设置邀请码 |
|
|
|
|
invitationCode: "", |
|
|
|
|
invitationCode: '', |
|
|
|
|
status: 0, // 状态(0、待开始 1、进行中 2、已结束) |
|
|
|
|
classId: "", |
|
|
|
|
classId: '', |
|
|
|
|
stuInfo: [] |
|
|
|
|
}, |
|
|
|
|
date: "", // 实验时间 |
|
|
|
@ -206,6 +218,7 @@ export default { |
|
|
|
|
stopTime: "0000-00-00 00:00:00", //结束时间 |
|
|
|
|
expNameRepeat: false, // 考核名称是否重复 |
|
|
|
|
curriculumList: [], // 课程列表 |
|
|
|
|
myCurs: [], |
|
|
|
|
filterClassName: "", // 班级名称搜索 |
|
|
|
|
tagList: [], // 班级名称标签 |
|
|
|
|
defaultCheckedKeys: [], // 默认选中 |
|
|
|
@ -254,9 +267,8 @@ export default { |
|
|
|
|
}, |
|
|
|
|
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(); |
|
|
|
|
this.form.id ? this.getData() : this.getMallCourse() |
|
|
|
|
this.recoveryData() |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
// 监听信息是否有更改,有的话页面离开的时候要询问是否要保存 |
|
|
|
@ -294,6 +306,19 @@ export default { |
|
|
|
|
...mapActions("project", [ |
|
|
|
|
"setAss" |
|
|
|
|
]), |
|
|
|
|
async getData () { // 获取详情 |
|
|
|
|
const { data } = await this.$get(`${this.api.getDetailById}?id=${this.form.id}`) |
|
|
|
|
data.uuid = data.projectId || data.paperId |
|
|
|
|
this.form = data |
|
|
|
|
if (!data.mallId) { |
|
|
|
|
this.courseTab = 0 |
|
|
|
|
this.getMyCourse() |
|
|
|
|
} |
|
|
|
|
this.startTime = data.startTime |
|
|
|
|
this.stopTime = data.stopTime |
|
|
|
|
this.formatDuration() |
|
|
|
|
this.getMallCourse() |
|
|
|
|
}, |
|
|
|
|
handleCloseTag (tag) { // 关闭班级标签 |
|
|
|
|
this.allCheckedNodes = this.$refs.tree.getCheckedNodes().concat(this.$refs.tree.getHalfCheckedNodes()); |
|
|
|
|
let tagIndex = this.tagList.findIndex(i => i.id === tag.id); |
|
|
|
@ -367,30 +392,43 @@ export default { |
|
|
|
|
return resolve([]); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
getschoolCourse () { // 获取课程 |
|
|
|
|
this.$get(this.api.getSchoolEffectiveCourse).then(({ data }) => { |
|
|
|
|
this.curriculumList = data; |
|
|
|
|
if (this.curriculumList.length) { |
|
|
|
|
if (!this.form.mallId) this.form.mallId = data[0].mallId |
|
|
|
|
this.getProjectData() |
|
|
|
|
} |
|
|
|
|
async getMallCourse (fromChange) { // 获取校本课程 |
|
|
|
|
const { data } = await this.$get(this.api.getSchoolEffectiveCourse) |
|
|
|
|
this.curriculumList = data |
|
|
|
|
if (this.curriculumList.length) { |
|
|
|
|
if (!this.form.curriculumId || fromChange) this.form.curriculumId = data[0].cid |
|
|
|
|
this.getProjectData() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!fromChange) { |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.updateTime = 0 |
|
|
|
|
}) |
|
|
|
|
}).catch(err => { }); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 获取我的课程 |
|
|
|
|
async getMyCourse (fromChange) { |
|
|
|
|
const res = await this.$get(this.api.getchoolBuiltCoursesList) |
|
|
|
|
const data = res.schoolCourse |
|
|
|
|
this.myCurs = data |
|
|
|
|
if (fromChange) this.form.curriculumId = data[0].cid |
|
|
|
|
this.getProjectData() |
|
|
|
|
}, |
|
|
|
|
// 课程类型切换 |
|
|
|
|
courseChange (val) { |
|
|
|
|
val ? this.getMallCourse(1) : this.getMyCourse(1) |
|
|
|
|
}, |
|
|
|
|
getProjectData () { |
|
|
|
|
const curItem = this.curriculumList.find(e => e.mallId === this.form.mallId) |
|
|
|
|
let data = { |
|
|
|
|
const cur = this.courseTab ? this.curriculumList.find(e => e.cid === this.form.curriculumId) : {} |
|
|
|
|
this.$post(this.api.getProjectOrExamPaperByAssessment, { |
|
|
|
|
pageNum: this.page, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
|
cid: curItem.cid, |
|
|
|
|
cid: this.form.curriculumId, |
|
|
|
|
projectName: this.keyword, |
|
|
|
|
systemId: curItem ? curItem.systemId : 1, |
|
|
|
|
systemId: cur ? cur.systemId : '', |
|
|
|
|
permissions: 1, |
|
|
|
|
mallId: this.form.mallId |
|
|
|
|
} |
|
|
|
|
this.$post(this.api.getProjectOrExamPaperByAssessment, data).then(({ data }) => { |
|
|
|
|
mallId: cur ? cur.mallId : '' |
|
|
|
|
}).then(({ data }) => { |
|
|
|
|
const list = data.records |
|
|
|
|
list.forEach(e => { |
|
|
|
|
e.uuid = e.projectId || e.paperId // 唯一标识 |
|
|
|
@ -420,9 +458,9 @@ export default { |
|
|
|
|
let day = hour * 24; |
|
|
|
|
this.form.experimentDuration = `${Math.floor(timestamp / day)}d${Math.floor(timestamp % day / hour)}h${Math.floor(timestamp % day % hour / minute)}m`; |
|
|
|
|
} |
|
|
|
|
if (this.form.type == 1 && this.form.experimentDuration == "0d0h0m") return Util.warningMsg("请填写考核时长"); |
|
|
|
|
if (this.form.type == 2 && this.startTime == "0000-00-00 00:00:00") return Util.warningMsg("请填写考核时间"); |
|
|
|
|
if (this.form.type == 1) { |
|
|
|
|
if (form.type == 1 && this.form.experimentDuration == "0d0h0m") return Util.warningMsg("请填写考核时长"); |
|
|
|
|
if (form.type == 2 && this.startTime == "0000-00-00 00:00:00") return Util.warningMsg("请填写考核时间"); |
|
|
|
|
if (form.type == 1) { |
|
|
|
|
const { day, hour, minute } = this.duration |
|
|
|
|
if (String(day).includes('.')) return Util.warningMsg('考核天数请填写整数') |
|
|
|
|
if (day < 0) return Util.warningMsg('考核天数请勿填写负数') |
|
|
|
@ -434,31 +472,37 @@ export default { |
|
|
|
|
if (!form.uuid) return Util.warningMsg("请选择考核项目"); |
|
|
|
|
const item = this.projectData.find(e => form.uuid === e.projectId || form.uuid === e.paperId) |
|
|
|
|
if (item) form[item.projectId ? 'projectId' : 'paperId'] = form.uuid |
|
|
|
|
if (this.form.isSpecify == 0 && this.form.isEnableCode == 1) { |
|
|
|
|
if (!this.form.invitationCode) return Util.warningMsg("请设置邀请码"); |
|
|
|
|
if (!this.form.invitationCode || String(this.form.invitationCode).length < 6 || isNaN(this.form.invitationCode)) return Util.warningMsg("请输入6位纯数字邀请码"); |
|
|
|
|
if (form.isSpecify == 0 && this.form.isEnableCode == 1) { |
|
|
|
|
if (!form.invitationCode) return Util.warningMsg("请设置邀请码") |
|
|
|
|
if (!form.invitationCode || String(this.form.invitationCode).length < 6 || isNaN(this.form.invitationCode)) return Util.warningMsg("请输入6位纯数字邀请码") |
|
|
|
|
} |
|
|
|
|
this.form.startTime = this.form.type == 2 ? this.startTime : '' |
|
|
|
|
this.form.stopTime = this.form.type == 2 ? this.stopTime : '' |
|
|
|
|
let classId = []; |
|
|
|
|
let stuInfo = []; |
|
|
|
|
form.startTime = form.type == 2 ? this.startTime : '' |
|
|
|
|
form.stopTime = form.type == 2 ? this.stopTime : '' |
|
|
|
|
let classId = [] |
|
|
|
|
let stuInfo = [] |
|
|
|
|
this.allCheckedNodes.forEach(i => { |
|
|
|
|
if (i.level === 3) { |
|
|
|
|
classId.push(i.id); |
|
|
|
|
classId.push(i.id) |
|
|
|
|
} else if (i.level === 4) { |
|
|
|
|
stuInfo.push({ classId: i.parentId, stuAccountId: i.id }); |
|
|
|
|
stuInfo.push({ classId: i.parentId, stuAccountId: i.id }) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
if (this.isSpecify == 1 && !stuInfo.length) { |
|
|
|
|
Util.warningMsg("请选择学生"); |
|
|
|
|
return; |
|
|
|
|
Util.warningMsg("请选择学生") |
|
|
|
|
return |
|
|
|
|
} else { |
|
|
|
|
this.form.classId = classId.toString() |
|
|
|
|
this.form.stuInfo = stuInfo |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.courseTab) { |
|
|
|
|
const cur = this.curriculumList.find(e => e.cid === this.form.curriculumId) |
|
|
|
|
form.mallId = cur.mallId |
|
|
|
|
} else { |
|
|
|
|
this.form.classId = classId.toString(); |
|
|
|
|
this.form.stuInfo = stuInfo; |
|
|
|
|
form.mallId = '' |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const curItem = this.curriculumList.find(e => e.mallId === this.form.mallId) |
|
|
|
|
this.form.curriculumId = curItem.cid |
|
|
|
|
this.submiting = true |
|
|
|
|
if (this.form.id) { |
|
|
|
|
this.$post(this.api.modifyAssessment, this.form).then(async res => { |
|
|
|
@ -478,16 +522,6 @@ export default { |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
getData () { // 获取详情 |
|
|
|
|
this.$get(`${this.api.getDetailById}?id=${this.form.id}`).then(({ data }) => { |
|
|
|
|
this.form = data; |
|
|
|
|
this.startTime = data.startTime |
|
|
|
|
this.stopTime = data.stopTime |
|
|
|
|
this.formatDuration(); |
|
|
|
|
this.getschoolCourse(); |
|
|
|
|
}).catch(err => { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
formatDuration () { // 格式化实验时长 |
|
|
|
|
let duration = this.form.experimentDuration.replace(/\D+/g, ",").split(","); |
|
|
|
|
this.duration = { |
|
|
|
|