From df4c00dac4c51a890d85ef29ccaff8718b02937c Mon Sep 17 00:00:00 2001 From: hbzgyjh Date: Thu, 16 Dec 2021 21:26:45 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=A1=A8=E5=8D=95=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/project/ProjectStepForm.vue | 7 +--- src/views/project/form/ProjectCourseList.vue | 21 +++++----- src/views/project/form/ProjectForm.vue | 17 ++++---- src/views/project/form/ProjectPersonForm.vue | 10 ++++- .../ProjectTestPaperFormationStrategy.vue | 42 +++++++++++++------ src/views/project/form/Result.vue | 3 +- 6 files changed, 58 insertions(+), 42 deletions(-) diff --git a/src/views/project/ProjectStepForm.vue b/src/views/project/ProjectStepForm.vue index a985210..6c1c3f0 100644 --- a/src/views/project/ProjectStepForm.vue +++ b/src/views/project/ProjectStepForm.vue @@ -58,11 +58,6 @@ export default { //生命周期 - 创建完成(可以访问当前this实例) created() { console.log('分步表单创建完成', this.$route) - if (this.$route.query.projectId) { - getProjectDetail({ id: this.$route.query.projectId }).then(res => { - this.form = res.data - }) - } }, destroyed() { console.log('分步表单销毁了。。。。。') @@ -88,7 +83,7 @@ export default { form: { t: this.$route.query.t, projectType: this.$route.query.t === 'sys' ? 0 : 1, - trainWay: '2', + trainWay: '1', totalScore: '100' }, result: true, diff --git a/src/views/project/form/ProjectCourseList.vue b/src/views/project/form/ProjectCourseList.vue index b74f746..6a5744f 100644 --- a/src/views/project/form/ProjectCourseList.vue +++ b/src/views/project/form/ProjectCourseList.vue @@ -8,7 +8,7 @@ --> - 总课时:{{ totalHours }}H , 总学时要求:{{ totalLearnHours }}H , 总题目数量:{{ totalTopicNum }} + 总课时:{{ form.totalCourseHours }}H , 总学时要求:{{ form.totalLearnHours }}H , 总题目数量:{{ form.totalTopicNumber }} 课程名: 查询 @@ -92,9 +92,9 @@ export default { labelCol: {}, wrapperCol: {}, vertical: 'vertical', - totalHours: 0, //总课时 + totalCourseHours: 0, //总课时 totalLearnHours: 0, //总学时 - totalTopicNum: 0, //题目数量 + totalTopicNumber: 0, //题目数量 selectCourseId: '', //课程id courseVisible: false, //课程预览页面显示控制 @@ -117,8 +117,9 @@ export default { loadData: (parameter) => { if (this.$route.query.projectId) { /** 编辑进来的有项目id */ - return getCourseList(this.$route.query.projectId).then((res) => { + return getCourseList({id:this.$route.query.projectId}).then((res) => { this.selData = res.data; + this.calc(res.data) return res.data }) @@ -156,13 +157,13 @@ export default { }, //计算总学时,总分数,总课时 calc(data) { - this.totalHours = 0 - this.totalLearnHours = 0 - this.totalTopicNum = 0 + this.form.totalCourseHours = 0 + this.form.totalLearnHours = 0 + this.form.totalTopicNumber = 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) + this.form.totalCourseHours = this.form.totalCourseHours + parseInt(item.courseHours) + this.form.totalLearnHours = this.form.totalLearnHours + parseInt(item.learnHours) + this.form.totalTopicNumber = this.form.totalTopicNumber + parseInt(item.topicNumber) }) }, //下一步 diff --git a/src/views/project/form/ProjectForm.vue b/src/views/project/form/ProjectForm.vue index 951d388..084c33f 100644 --- a/src/views/project/form/ProjectForm.vue +++ b/src/views/project/form/ProjectForm.vue @@ -7,14 +7,7 @@ --> - + @@ -25,7 +18,7 @@ - + {{ entity.name }} @@ -138,6 +131,7 @@ import { dictGet } from '@/api/project/project' import ClassList from '../classAdd/ClassList.vue' import { classList } from '@/api/project/class' +import { projectAdd, getProjectDetail } from '@/api/project/project' export default { props: { @@ -179,6 +173,11 @@ export default { }, created(ClassList) { console.log('第一个表单创建了') + if (this.$route.query.projectId) { + getProjectDetail({ id: this.$route.query.projectId }).then(res => { + this.form = res.data + }) + } this.fetchTemplateData() this.getTrainClass() }, diff --git a/src/views/project/form/ProjectPersonForm.vue b/src/views/project/form/ProjectPersonForm.vue index 715fa65..0511479 100644 --- a/src/views/project/form/ProjectPersonForm.vue +++ b/src/views/project/form/ProjectPersonForm.vue @@ -88,7 +88,7 @@ export default { expandedKeys: [], autoExpandParent: true, defaultExpandedKeys: [], - selectedRowKeys: this.projectForm.personIds || [], + selectedRowKeys: [], selectedRows: this.projectForm.projectPersonLists || [], orgTree: [], orgId: '', @@ -186,7 +186,12 @@ export default { //编辑时初始化人员列表初始化 initPersonList() { - if (this.form.personIds) { + if (this.form.projectPersonLists) { + this.selectedRowKeys = [], + this.form.projectPersonLists.forEach(element => { + this.selectedRowKeys.push(element.id) + }); + console.log('初始化的值',this.selectedRowKeys) } }, @@ -213,6 +218,7 @@ export default { // 生命周期 - 创建完成(可以访问当前this实例) created() { this.getOrgTree() + this.initPersonList() }, // 生命周期 - 挂载完成(可以访问DOM元素) mounted() { }, diff --git a/src/views/project/form/ProjectTestPaperFormationStrategy.vue b/src/views/project/form/ProjectTestPaperFormationStrategy.vue index 5de0e47..7f24f58 100644 --- a/src/views/project/form/ProjectTestPaperFormationStrategy.vue +++ b/src/views/project/form/ProjectTestPaperFormationStrategy.vue @@ -46,16 +46,16 @@ -