|
|
|
@ -200,11 +200,19 @@ |
|
|
|
|
width="24%" |
|
|
|
|
center |
|
|
|
|
:close-on-click-modal="false"> |
|
|
|
|
<el-form> |
|
|
|
|
<el-form-item> |
|
|
|
|
<!--前端不用做名称判重了:@change='projectNameExistis'--> |
|
|
|
|
<el-form label-width="70px"> |
|
|
|
|
<el-form-item label="项目名称"> |
|
|
|
|
<el-input placeholder="请输入项目名称" |
|
|
|
|
v-model="projectName"></el-input> |
|
|
|
|
v-model="copyForm.projectName"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item v-if="!curRow.projectManage.founder" |
|
|
|
|
label="系统"> |
|
|
|
|
<el-cascader v-model="copyMallId" |
|
|
|
|
:options="curs" |
|
|
|
|
:props="{ checkStrictly: true, value: 'id' }" |
|
|
|
|
popper-class="course-cas" |
|
|
|
|
@expand-change="copySystemChange" |
|
|
|
|
@change="copySystemChange"></el-cascader> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
<span slot="footer" |
|
|
|
@ -237,7 +245,8 @@ export default { |
|
|
|
|
founder: +this.$route.query.founder || 2, // 创建人角色(0:系统 1:老师 2:全部) |
|
|
|
|
state: "", // 状态(0:草稿箱 1:已发布) |
|
|
|
|
permissions: "", // 项目权限(0:练习 1:考核 2:竞赛) |
|
|
|
|
cid: '' |
|
|
|
|
cid: '', |
|
|
|
|
mallId: '' |
|
|
|
|
}, |
|
|
|
|
keyword: "", |
|
|
|
|
status: "", |
|
|
|
@ -299,8 +308,14 @@ export default { |
|
|
|
|
pageSize: 10, |
|
|
|
|
multipleSelection: [], |
|
|
|
|
copyVisible: false, |
|
|
|
|
projectName: "", |
|
|
|
|
currentRow: {}, // 复制之后,提交到后台的数据 |
|
|
|
|
copyForm: { |
|
|
|
|
projectName: '', |
|
|
|
|
mallId: [] |
|
|
|
|
}, |
|
|
|
|
copyMallId: [], |
|
|
|
|
curRow: { |
|
|
|
|
projectManage: {} |
|
|
|
|
}, // 复制之后,提交到后台的数据 |
|
|
|
|
listDataAll: [], |
|
|
|
|
isFirst: true |
|
|
|
|
}; |
|
|
|
@ -351,7 +366,7 @@ export default { |
|
|
|
|
projectName: this.keyword, |
|
|
|
|
pageNum: this.page, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
|
systemId: this.systemId |
|
|
|
|
systemId: this.systemId, |
|
|
|
|
}; |
|
|
|
|
this.$post(this.api.queryProjectManage, data).then(res => { |
|
|
|
|
this.isFirst = false |
|
|
|
@ -371,12 +386,12 @@ export default { |
|
|
|
|
getschoolCourse () { |
|
|
|
|
this.$get(this.api.getSchoolEffectiveCourse).then(({ data }) => { |
|
|
|
|
this.curriculumList = data |
|
|
|
|
const { cid } = this.queryData |
|
|
|
|
const { mallId } = this.queryData |
|
|
|
|
if (data.length) { |
|
|
|
|
this.cid = [cid || data[0].cid] |
|
|
|
|
this.cid = [mallId || data[0].mallId] |
|
|
|
|
const all = this.systemListAll |
|
|
|
|
data.map(e => { |
|
|
|
|
e.id = e.cid |
|
|
|
|
e.id = e.mallId |
|
|
|
|
e.label = e.curriculumName |
|
|
|
|
e.children = all.filter(n => e.systemId.split(',').includes(n.id + '')) // 筛选出该课程下的系统 |
|
|
|
|
}) |
|
|
|
@ -387,12 +402,13 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 课程选择回调 |
|
|
|
|
curChange (val) { |
|
|
|
|
const cid = val[0] |
|
|
|
|
const mallId = val[0] |
|
|
|
|
if (val.length === 1) { |
|
|
|
|
// 如果选择的是课程,则默认选中下面第一个系统 |
|
|
|
|
this.cid = [cid, this.curs.find(e => e.id === cid).children[0].id] |
|
|
|
|
this.cid = [mallId, this.curs.find(e => e.id === mallId).children[0].id] |
|
|
|
|
} |
|
|
|
|
this.queryData.cid = cid |
|
|
|
|
this.queryData.mallId = mallId |
|
|
|
|
this.queryData.cid = this.curs.find(e => e.id === mallId).cid |
|
|
|
|
this.systemId = this.cid[1] |
|
|
|
|
this.initData() |
|
|
|
|
}, |
|
|
|
@ -481,48 +497,44 @@ export default { |
|
|
|
|
console.log(err); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
projectNameExistis () { // 项目管理名称判重 |
|
|
|
|
if (this.projectName) { |
|
|
|
|
this.$post(this.api.queryNameIsExist, { projectName: this.projectName }).then(res => { |
|
|
|
|
if (res.status === 200) { |
|
|
|
|
this.projectNameRepeat = false; |
|
|
|
|
} |
|
|
|
|
}).catch(err => { |
|
|
|
|
this.projectNameRepeat = true; |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
this.projectNameRepeat = false; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
copyData (projectId) { // 复制,根据项目id查询详情 |
|
|
|
|
this.copyVisible = true; |
|
|
|
|
this.$get(`${this.api.getProjectDetail}?projectId=${projectId}`).then(res => { |
|
|
|
|
this.projectName = res.projectManage.projectName; |
|
|
|
|
this.currentRow = { |
|
|
|
|
projectManage: res.projectManage, |
|
|
|
|
projectJudgmentList: res.projectJudgmentVos |
|
|
|
|
this.copyMallId = [] |
|
|
|
|
this.copyForm.projectName = res.projectManage.projectName; |
|
|
|
|
this.curRow = { |
|
|
|
|
projectManage: JSON.parse(JSON.stringify(res.projectManage)), |
|
|
|
|
projectJudgmentList: JSON.parse(JSON.stringify(res.projectJudgmentVos)) |
|
|
|
|
}; |
|
|
|
|
}).catch(err => { |
|
|
|
|
console.log(err); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
// 复制项目系统选择回调 |
|
|
|
|
copySystemChange (val) { |
|
|
|
|
this.copyForm.mallId = val[0] |
|
|
|
|
}, |
|
|
|
|
copySubmit () { |
|
|
|
|
if (!this.projectName) { |
|
|
|
|
const form = this.copyForm |
|
|
|
|
const row = this.curRow |
|
|
|
|
const fromSystem = !row.projectManage.founder |
|
|
|
|
if (!form.projectName) { |
|
|
|
|
util.warningMsg("请输入项目名称"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
; |
|
|
|
|
if (this.projectNameRepeat) { |
|
|
|
|
util.warningMsg("该项目名称已存在"); |
|
|
|
|
// 系统创建的才需要选择系统 |
|
|
|
|
if (fromSystem && !form.mallId) { |
|
|
|
|
util.warningMsg("请选择系统"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
this.currentRow.projectManage.projectName = this.projectName; |
|
|
|
|
this.currentRow.projectManage.projectId = ""; |
|
|
|
|
this.currentRow.projectManage.founder = 1 |
|
|
|
|
this.currentRow.projectJudgmentList.forEach(i => { |
|
|
|
|
row.projectManage.projectName = form.projectName |
|
|
|
|
if (fromSystem) row.projectManage.mallId = form.mallId |
|
|
|
|
row.projectManage.projectId = ""; |
|
|
|
|
row.projectManage.founder = 1 |
|
|
|
|
row.projectJudgmentList.forEach(i => { |
|
|
|
|
i.projectId = ""; |
|
|
|
|
}); |
|
|
|
|
this.$post(`${this.api.copyProjectManage}`, this.currentRow).then(res => { |
|
|
|
|
this.$post(`${this.api.copyProjectManage}`, row).then(res => { |
|
|
|
|
this.initData(); |
|
|
|
|
util.successMsg("复制实验项目成功"); |
|
|
|
|
this.copyVisible = false; |
|
|
|
|