From 531551249e6be536807b90461570056d668e2ca5 Mon Sep 17 00:00:00 2001 From: hbzgyjh Date: Thu, 23 Dec 2021 16:13:27 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=BC=96=E8=BE=91=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/course/course.js | 106 +++++++++--------- src/views/project/ProjectStepForm.vue | 8 +- src/views/project/form/ProjectCourseList.vue | 6 +- .../project/form/ProjectCourseSelect.vue | 23 ++-- src/views/project/form/ProjectForm.vue | 1 + .../ProjectTestPaperFormationStrategy.vue | 31 ++--- 6 files changed, 91 insertions(+), 84 deletions(-) diff --git a/src/api/course/course.js b/src/api/course/course.js index a7ce23f..0c78bf3 100644 --- a/src/api/course/course.js +++ b/src/api/course/course.js @@ -1,30 +1,30 @@ import request from '@/utils/request' const courseApi = { - add: '/courseManagement/course/addOrUpdate', - get: '/courseManagement/course/details', -// update: 'sys/menu/update', - del: 'courseManagement/course/delete', -// updateStatus: 'sys/menu/updateStatus', - list: '/courseManagement/course/listPage', - coursewareList:'/courseManagement/course/courseware/details', - questionList:'/courseManagement/course/questionList', - listByClass:'/courseManagement/course/list', + add: '/courseManagement/course/addOrUpdate', + get: '/courseManagement/course/details', + // update: 'sys/menu/update', + del: 'courseManagement/course/delete', + // updateStatus: 'sys/menu/updateStatus', + list: '/courseManagement/course/listPage', + coursewareList: '/courseManagement/course/courseware/details', + questionList: '/courseManagement/course/questionList', + listByClass: '/courseManagement/course/list', } -export function courseAdd (params) { - return request({ - url: courseApi.add, - method: 'post', - data: params - }) +export function courseAdd(params) { + return request({ + url: courseApi.add, + method: 'post', + data: params + }) } -export function listByClass (params) { - return request({ - url: courseApi.listByClass, - method: 'get', - params: params - }) +export function listByClass(params) { + return request({ + url: courseApi.listByClass, + method: 'get', + params: params + }) } // export function menuUpdate (params) { // return request({ @@ -34,47 +34,47 @@ export function listByClass (params) { // }) // } -export function deleteCourse (params) { - return request({ - url: courseApi.del, - method: 'delete', - params: params - }) +export function deleteCourse(params) { + return request({ + url: courseApi.del, + method: 'delete', + params: params + }) } // 查询课程列表 -export function getCourseList (params) { - if(params.tag) params.tag = params.tag.toString(); - return request({ - url: courseApi.list, - method: 'get', - params: params - }) +export function getCourseList(params) { + if (params.tag) params.tag = params.tag.toString(); + return request({ + url: courseApi.list, + method: 'get', + params: params + }) } // 查看课程详情 -export function getCourseDetails (params) { - return request({ - url:courseApi.get, - method:'get', - params:params - }) +export function getCourseDetails(params) { + return request({ + url: courseApi.get, + method: 'get', + params: params + }) } //通过课程ID获取课件列表 -export function getCoursewareListByCourseId (params) { - return request({ - url: courseApi.coursewareList, - method: 'get', - params: params - }) +export function getCoursewareListByCourseId(params) { + return request({ + url: courseApi.coursewareList, + method: 'get', + params: params + }) } //通过课程ID获取题目列表 -export function getQuestionListByCourseId (params) { - return request({ - url: courseApi.questionList, - method: 'get', - params: params - }) -} +export function getQuestionListByCourseId(params) { + return request({ + url: courseApi.questionList, + method: 'get', + params: params + }) +} \ No newline at end of file diff --git a/src/views/project/ProjectStepForm.vue b/src/views/project/ProjectStepForm.vue index 6c1c3f0..e5e8bc3 100644 --- a/src/views/project/ProjectStepForm.vue +++ b/src/views/project/ProjectStepForm.vue @@ -11,7 +11,7 @@
- + @@ -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) diff --git a/src/views/project/form/ProjectCourseList.vue b/src/views/project/form/ProjectCourseList.vue index 476dd32..68942be 100644 --- a/src/views/project/form/ProjectCourseList.vue +++ b/src/views/project/form/ProjectCourseList.vue @@ -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) } }, diff --git a/src/views/project/form/ProjectCourseSelect.vue b/src/views/project/form/ProjectCourseSelect.vue index 460915d..c16056f 100644 --- a/src/views/project/form/ProjectCourseSelect.vue +++ b/src/views/project/form/ProjectCourseSelect.vue @@ -3,13 +3,9 @@ - - - 系统课程 - - - 自主课程 - + + 系统课程 + 自主课程 @@ -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) }) }, }, diff --git a/src/views/project/form/ProjectForm.vue b/src/views/project/form/ProjectForm.vue index 084c33f..08661dc 100644 --- a/src/views/project/form/ProjectForm.vue +++ b/src/views/project/form/ProjectForm.vue @@ -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() diff --git a/src/views/project/form/ProjectTestPaperFormationStrategy.vue b/src/views/project/form/ProjectTestPaperFormationStrategy.vue index 7f24f58..fc0ac3e 100644 --- a/src/views/project/form/ProjectTestPaperFormationStrategy.vue +++ b/src/views/project/form/ProjectTestPaperFormationStrategy.vue @@ -1,14 +1,5 @@