项目编辑修改

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

View File

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

View File

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

View File

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

View File

@ -1,14 +1,5 @@
<template> <template>
<a-card :bordered="false" title="组卷策略信息"> <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-form-model :rules="rules" :model="form" v-bind="formItemLayout">
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :md="10" :sm="12"> <a-col :md="10" :sm="12">
@ -134,7 +125,7 @@ export default {
}, },
}, },
], ],
tableData: this.projectForm.testPaperTactics || [], tableData: [],
totalScore: 0, totalScore: 0,
} }
}, },
@ -144,17 +135,17 @@ export default {
watch: { watch: {
tableData: function () { tableData: function () {
let sum = 0; let sum = 0;
this.tableData.array.forEach(element => { this.tableData.forEach(element => {
sum = element.totalScore + sum; if(element.totalScore){
console.log('单条总分数',element.totalScore)
sum = sum + element.totalScore;
}
}); });
this.form.totalScore = sum; this.form.totalScore = sum;
} }
}, },
// //
methods: { methods: {
validataScore() {
},
// //
toSave() { toSave() {
this.form.testPaperTactics = this.tableData; this.form.testPaperTactics = this.tableData;
@ -177,6 +168,16 @@ export default {
}) })
getQuestionNumByCourseIds({ ids: ids }).then((res) => { getQuestionNumByCourseIds({ ids: ids }).then((res) => {
this.tableData = res.data 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
}
})
})
}
}) })
} }
}, },