From 72e59de8454d90035adc1bf270fe01adf2cf9f59 Mon Sep 17 00:00:00 2001 From: Yuanjianghong Date: Sun, 28 Nov 2021 23:51:14 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/course/course.js | 18 +- src/views/project/form/ProjectCourseList.vue | 53 +-- .../project/form/ProjectCourseSelect.vue | 338 +++++++++--------- src/views/project/form/ProjectUnitSelect.vue | 163 +++++---- 4 files changed, 292 insertions(+), 280 deletions(-) diff --git a/src/api/course/course.js b/src/api/course/course.js index 9433ed2..9b4c2fa 100644 --- a/src/api/course/course.js +++ b/src/api/course/course.js @@ -8,8 +8,8 @@ const courseApi = { // updateStatus: 'sys/menu/updateStatus', list: '/courseManagement/course/listPage', coursewareList:'/courseManagement/course/courseware/details', - questionList:'/courseManagement/course/questionList' - + questionList:'/courseManagement/course/questionList', + listByClass:'/courseManagement/course/list', } export function courseAdd (params) { @@ -19,13 +19,13 @@ export function courseAdd (params) { data: params }) } -// export function menuGet (params) { -// return request({ -// url: menuApi.get, -// method: 'post', -// data: params -// }) -// } +export function listByClass (params) { + return request({ + url: courseApi.listByClass, + method: 'get', + params: params + }) +} // export function menuUpdate (params) { // return request({ // url: menuApi.update, diff --git a/src/views/project/form/ProjectCourseList.vue b/src/views/project/form/ProjectCourseList.vue index 3d8047e..3a16030 100644 --- a/src/views/project/form/ProjectCourseList.vue +++ b/src/views/project/form/ProjectCourseList.vue @@ -8,7 +8,7 @@ - 总课时:{{ totalHours }}, 总学时要求:{{ totalLearnHours }}, 总题目数量:{{ totalTopicNum }} + 总课时:{{ totalHours }}H , 总学时要求:{{ totalLearnHours }}H , 总题目数量:{{ totalTopicNum }} 课程名: 查询 @@ -46,8 +46,8 @@ - + @@ -86,8 +86,8 @@ export default { { title: '序号', key: 'id', dataIndex: 'id', width: 60, scopedSlots: { customRender: 'serial' } }, { title: '课程编号', dataIndex: 'courseNo', key: 'courseNo' }, { title: '课程名称', dataIndex: 'courseName', key: 'courseName' }, - { title: '课时', dataIndex: 'courseHours', key: 'courseHours', customRender: (text) => text + '分' }, - { title: '学时要求', dataIndex: 'learnHours', key: 'learnHours', customRender: (text) => text + '分' }, + { title: '课时', dataIndex: 'courseHours', key: 'courseHours', customRender: (text) => text + 'H' }, + { title: '学时要求', dataIndex: 'learnHours', key: 'learnHours', customRender: (text) => text + 'H' }, { title: '题量', dataIndex: 'topicNumber', key: 'topicNumber' }, // { title: '项目名称', dataIndex: 'projectName', key: 'projectName' }, { title: '操作', width: 200, align: 'center', scopedSlots: { customRender: 'action' } }, @@ -96,11 +96,13 @@ export default { if (this.$route.query.projectId) { /** 编辑进来的有项目id */ return getCourseList(this.$route.query.projectId).then((res) => { + this.calc(res.data) return res.data }) } else { /** 新建的没有项目id,传当前的所选的课程id */ return getCourseListByCourseIds(Object.assign(parameter, this.queryParam)).then((res) => { + this.calc(res.data) return res.data }) } @@ -113,6 +115,17 @@ export default { watch: {}, //方法集合 methods: { + //计算总学时,总分数,总课时 + calc(data){ + this.totalHours = 0 + this.totalLearnHours = 0 + this.totalTopicNum = 0 + data.forEach((item)=>{ + this.totalHours = this.totalHours + parseInt(item.courseHours) + this.totalLearnHours = this.totalLearnHours + parseInt(item.learnHours) + this.totalTopicNum = this.totalTopicNum + parseInt(item.topicNumber) + }) + }, //下一步 toNext() { this.form.lessonIds = [] @@ -138,33 +151,21 @@ export default { }, //初始化ids initIds() { - let str = this.projectForm.lessonIds.join(',') + console.log('this.projectForm.lessonIds',this.projectForm.lessonIds) + let str = ''; + if(this.projectForm.lessonIds) str = this.projectForm.lessonIds.join(',') + // let str = this.projectForm.lessonIds.join(',') || [] console.log('initIds', str) if (str) { this.queryParam.ids = str } }, - /**查询了列表数据 */ - getProjectCourseList() { - // if (this.$route.query.projectId) { - // /** 编辑景来的有项目id */ - // getCourseList(this.$route.query.projectId).then((res) => { - // if (res.code == 200) { - // // this.data1 = res.data - // return res - // } - // }) - // } else { - // /** 新建的没有项目id,传当前的所选的课程id */ - // getCourseListByCourseIds(this.queryParam.ids.join(',')).then((res)=>{ - // if (res.code == 200) { - // // this.data1 = res.data - // // console.log(this.data1) - // return res - // } - // }) - // } - }, + //选择课程完毕,提交到list页面 + selectKeyDataChange(childValue){ + console.log('list page - selectKeyDataSubmit',childValue) + this.queryParam.ids = childValue + this.$refs.table.refresh(true) + } }, //生命周期 - 创建完成(可以访问当前this实例) diff --git a/src/views/project/form/ProjectCourseSelect.vue b/src/views/project/form/ProjectCourseSelect.vue index 52b7d3b..dc190b9 100644 --- a/src/views/project/form/ProjectCourseSelect.vue +++ b/src/views/project/form/ProjectCourseSelect.vue @@ -3,161 +3,188 @@ id="modal" :title="modalTitle" :width="1500" - :height="750" + height="auto" :visible="visible" - :confirmLoading="confirmLoading" - :destroyOnClose="true" @ok="handleSubmit" @cancel="handleCancel" > - - - - 系统课程 - 自制课程 - - - - - -
- + + + + - - -
-
-
+ + {{ index + 1 }} + + + + +

点击列表项取消选择或【清空所有

+ + + {{ item.courseName + '(' + item.courseCode + ')' }} + + +
+ + + \ No newline at end of file diff --git a/src/views/project/form/ProjectUnitSelect.vue b/src/views/project/form/ProjectUnitSelect.vue index 2f2fbec..98d0eb2 100644 --- a/src/views/project/form/ProjectUnitSelect.vue +++ b/src/views/project/form/ProjectUnitSelect.vue @@ -14,19 +14,17 @@ -