项目编辑修改

This commit is contained in:
hbzgyjh 2021-12-23 16:13:27 +08:00
parent bbd792522e
commit 531551249e
6 changed files with 91 additions and 84 deletions

View File

@ -3,23 +3,23 @@ import request from '@/utils/request'
const courseApi = {
add: '/courseManagement/course/addOrUpdate',
get: '/courseManagement/course/details',
// update: 'sys/menu/update',
// update: 'sys/menu/update',
del: 'courseManagement/course/delete',
// updateStatus: 'sys/menu/updateStatus',
// updateStatus: 'sys/menu/updateStatus',
list: '/courseManagement/course/listPage',
coursewareList:'/courseManagement/course/courseware/details',
questionList:'/courseManagement/course/questionList',
listByClass:'/courseManagement/course/list',
coursewareList: '/courseManagement/course/courseware/details',
questionList: '/courseManagement/course/questionList',
listByClass: '/courseManagement/course/list',
}
export function courseAdd (params) {
export function courseAdd(params) {
return request({
url: courseApi.add,
method: 'post',
data: params
})
}
export function listByClass (params) {
export function listByClass(params) {
return request({
url: courseApi.listByClass,
method: 'get',
@ -34,7 +34,7 @@ export function listByClass (params) {
// })
// }
export function deleteCourse (params) {
export function deleteCourse(params) {
return request({
url: courseApi.del,
method: 'delete',
@ -43,8 +43,8 @@ export function deleteCourse (params) {
}
// 查询课程列表
export function getCourseList (params) {
if(params.tag) params.tag = params.tag.toString();
export function getCourseList(params) {
if (params.tag) params.tag = params.tag.toString();
return request({
url: courseApi.list,
method: 'get',
@ -53,16 +53,16 @@ export function getCourseList (params) {
}
// 查看课程详情
export function getCourseDetails (params) {
export function getCourseDetails(params) {
return request({
url:courseApi.get,
method:'get',
params:params
url: courseApi.get,
method: 'get',
params: params
})
}
//通过课程ID获取课件列表
export function getCoursewareListByCourseId (params) {
export function getCoursewareListByCourseId(params) {
return request({
url: courseApi.coursewareList,
method: 'get',
@ -71,7 +71,7 @@ export function getCoursewareListByCourseId (params) {
}
//通过课程ID获取题目列表
export function getQuestionListByCourseId (params) {
export function getQuestionListByCourseId(params) {
return request({
url: courseApi.questionList,
method: 'get',

View File

@ -11,7 +11,7 @@
</a-steps>
<div class="content">
<!-- <keep-alive exclude="result"> -->
<step1 v-if="currentTab === 0" :projectForm="form" @nextStep="nextStep" @close="close" />
<step1 v-if="currentTab === 0" :projectForm="form" @nextStep="nextStep" @close="close" @setFormType="setFormType"/>
<step2 v-if="currentTab === 1" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" />
<step3 v-if="currentTab === 2" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" />
<step4 v-if="currentTab === 3" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" />
@ -84,13 +84,17 @@ export default {
t: this.$route.query.t,
projectType: this.$route.query.t === 'sys' ? 0 : 1,
trainWay: '1',
totalScore: '100'
totalScore: 0
},
result: true,
status: ''
}
},
methods: {
//
setFormType(type){
this.form.trainWay = type
},
//
executeSave(childValue) {
console.log('保存项目', childValue)

View File

@ -86,6 +86,7 @@ export default {
labelCol: {},
wrapperCol: {},
vertical: 'vertical',
beChange: false, //
totalCourseHours: 0, //
totalLearnHours: 0, //
totalTopicNumber: 0, //
@ -108,8 +109,8 @@ export default {
{ title: '操作', width: 200, align: 'center', scopedSlots: { customRender: 'action' } },
], //
loadData: (parameter) => {
if (this.$route.query.projectId) {
/** 编辑进来的有项目id */
if (this.$route.query.projectId && !this.beChange) {
/** 编辑进来的有项目id 并且没有被编辑过*/
return getCourseList({id:this.$route.query.projectId}).then((res) => {
this.selData = res.data;
this.calc(res.data)
@ -201,6 +202,7 @@ export default {
selectKeyDataChange(childValue) {
console.log('list page - selectKeyDataSubmit', childValue)
this.queryParam.ids = childValue
this.beChange = true
this.$refs.table.refresh(true)
}
},

View File

@ -3,13 +3,9 @@
<a-card :bordered="false" title="项目课程选择">
<a-row type="flex" justify="center" align="top">
<a-col :span="4" id="tree">
<a-menu v-model="menuKey" mode="horizontal" @click="menuChack()">
<a-menu-item key="sys">
系统课程
</a-menu-item>
<a-menu-item key="self">
自主课程
</a-menu-item>
<a-menu v-model="menuKey" mode="horizontal" @select="menuChack" >
<a-menu-item key="sys">系统课程</a-menu-item>
<a-menu-item key="self">自主课程</a-menu-item>
</a-menu>
<a-tree :treeData="treeData" @select="onSelect" :defaultExpandAll="true" :defaultExpandedKeys="defaultExpandedKeys" :replaceFields="replaceFields">
<a-icon slot="switcherIcon" type="down" />
@ -73,7 +69,7 @@ export default {
menuKey: ['sys'], //
//
queryParam: { name: '', classType: 0 },
queryParam: { name: '', classType: 0 ,type: 0},
replaceFields: { children: 'children', title: 'name', key: 'id', value: 'id' },
expandedKeys: [],
autoExpandParent: true,
@ -102,16 +98,19 @@ export default {
},
},
// data
watch: {},
watch: {
},
//
methods: {
//
menuChack(){
console.log('menuKey',this.menuKey)
let type = 0;
console.log('菜单改变',this.menuKey[0])
if(this.menuKey[0] === 'self') type = 1;
this.queryParam.type = type
this.getCourseTreeData(type);
this.$refs.table.refresh();
this.$refs.table.refresh(true);
},
//
edit(record) {
@ -189,7 +188,7 @@ export default {
//
queryCourseList() {
console.log('this.treeDataOne-------', this.treeDataOne)
listByClass({ classType: this.treeDataOne[0] || 0 }).then((res) => {
listByClass({ classType: this.treeDataOne[0] || 0 ,type: this.menuKey[0] === 'sys'?0:1}).then((res) => {
this.courseData = res.data
})
},
@ -209,7 +208,7 @@ export default {
return false
})
}
this.treeData = list2tree1(res.data, -1)
this.treeData = list2tree1(res.data, 0)
})
},
},

View File

@ -176,6 +176,7 @@ export default {
if (this.$route.query.projectId) {
getProjectDetail({ id: this.$route.query.projectId }).then(res => {
this.form = res.data
this.$emit('setFormType',this.form.trainWay)
})
}
this.fetchTemplateData()

View File

@ -1,14 +1,5 @@
<template>
<a-card :bordered="false" title="组卷策略信息">
<!-- <template slot="extra">
<a-button type="primary" size="default" @click="toPrev">上一步</a-button>
</template>
<template slot="extra">
<a-button type="primary" size="default" @click="toSave">保存</a-button>
</template>
<template slot="extra">
<a-button type="primary" size="default" @click="toIssue">发布</a-button>
</template> -->
<a-form-model :rules="rules" :model="form" v-bind="formItemLayout">
<a-row :gutter="24">
<a-col :md="10" :sm="12">
@ -134,7 +125,7 @@ export default {
},
},
],
tableData: this.projectForm.testPaperTactics || [],
tableData: [],
totalScore: 0,
}
},
@ -144,17 +135,17 @@ export default {
watch: {
tableData: function () {
let sum = 0;
this.tableData.array.forEach(element => {
sum = element.totalScore + sum;
this.tableData.forEach(element => {
if(element.totalScore){
console.log('单条总分数',element.totalScore)
sum = sum + element.totalScore;
}
});
this.form.totalScore = sum;
}
},
//
methods: {
validataScore() {
},
//
toSave() {
this.form.testPaperTactics = this.tableData;
@ -177,6 +168,16 @@ export default {
})
getQuestionNumByCourseIds({ ids: ids }).then((res) => {
this.tableData = res.data
if(this.tableData && this.form.testPaperTactics){
this.tableData.forEach(t1 => {
this.form.testPaperTactics.forEach(t2 => {
if(t1.topicType === t2.topicType){
t1.topicNum = t2.topicNum
t1.topicScore = t2.topicScore
}
})
})
}
})
}
},