项目表单更新
This commit is contained in:
parent
0d242f5f8a
commit
df4c00dac4
|
@ -58,11 +58,6 @@ export default {
|
||||||
//生命周期 - 创建完成(可以访问当前this实例)
|
//生命周期 - 创建完成(可以访问当前this实例)
|
||||||
created() {
|
created() {
|
||||||
console.log('分步表单创建完成', this.$route)
|
console.log('分步表单创建完成', this.$route)
|
||||||
if (this.$route.query.projectId) {
|
|
||||||
getProjectDetail({ id: this.$route.query.projectId }).then(res => {
|
|
||||||
this.form = res.data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
destroyed() {
|
destroyed() {
|
||||||
console.log('分步表单销毁了。。。。。')
|
console.log('分步表单销毁了。。。。。')
|
||||||
|
@ -88,7 +83,7 @@ export default {
|
||||||
form: {
|
form: {
|
||||||
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: '2',
|
trainWay: '1',
|
||||||
totalScore: '100'
|
totalScore: '100'
|
||||||
},
|
},
|
||||||
result: true,
|
result: true,
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
</template> -->
|
</template> -->
|
||||||
<a-space direction="vertical" style="width: 100%">
|
<a-space direction="vertical" style="width: 100%">
|
||||||
<a-space direction="horizontal">
|
<a-space direction="horizontal">
|
||||||
<span>总课时:{{ totalHours }}H , 总学时要求:{{ totalLearnHours }}H , 总题目数量:{{ totalTopicNum }} </span>
|
<span>总课时:{{ form.totalCourseHours }}H , 总学时要求:{{ form.totalLearnHours }}H , 总题目数量:{{ form.totalTopicNumber }} </span>
|
||||||
课程名:
|
课程名:
|
||||||
<a-input v-model="queryParam.courseName" style="width: 100%" />
|
<a-input v-model="queryParam.courseName" style="width: 100%" />
|
||||||
<a-button type="primary" icon="search" @click="$refs.table.refresh(true)">查询</a-button>
|
<a-button type="primary" icon="search" @click="$refs.table.refresh(true)">查询</a-button>
|
||||||
|
@ -92,9 +92,9 @@ export default {
|
||||||
labelCol: {},
|
labelCol: {},
|
||||||
wrapperCol: {},
|
wrapperCol: {},
|
||||||
vertical: 'vertical',
|
vertical: 'vertical',
|
||||||
totalHours: 0, //总课时
|
totalCourseHours: 0, //总课时
|
||||||
totalLearnHours: 0, //总学时
|
totalLearnHours: 0, //总学时
|
||||||
totalTopicNum: 0, //题目数量
|
totalTopicNumber: 0, //题目数量
|
||||||
selectCourseId: '', //课程id
|
selectCourseId: '', //课程id
|
||||||
|
|
||||||
courseVisible: false, //课程预览页面显示控制
|
courseVisible: false, //课程预览页面显示控制
|
||||||
|
@ -117,8 +117,9 @@ export default {
|
||||||
loadData: (parameter) => {
|
loadData: (parameter) => {
|
||||||
if (this.$route.query.projectId) {
|
if (this.$route.query.projectId) {
|
||||||
/** 编辑进来的有项目id */
|
/** 编辑进来的有项目id */
|
||||||
return getCourseList(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)
|
||||||
return res.data
|
return res.data
|
||||||
})
|
})
|
||||||
|
@ -156,13 +157,13 @@ export default {
|
||||||
},
|
},
|
||||||
//计算总学时,总分数,总课时
|
//计算总学时,总分数,总课时
|
||||||
calc(data) {
|
calc(data) {
|
||||||
this.totalHours = 0
|
this.form.totalCourseHours = 0
|
||||||
this.totalLearnHours = 0
|
this.form.totalLearnHours = 0
|
||||||
this.totalTopicNum = 0
|
this.form.totalTopicNumber = 0
|
||||||
data.forEach((item) => {
|
data.forEach((item) => {
|
||||||
this.totalHours = this.totalHours + parseInt(item.courseHours)
|
this.form.totalCourseHours = this.form.totalCourseHours + parseInt(item.courseHours)
|
||||||
this.totalLearnHours = this.totalLearnHours + parseInt(item.learnHours)
|
this.form.totalLearnHours = this.form.totalLearnHours + parseInt(item.learnHours)
|
||||||
this.totalTopicNum = this.totalTopicNum + parseInt(item.topicNumber)
|
this.form.totalTopicNumber = this.form.totalTopicNumber + parseInt(item.topicNumber)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
//下一步
|
//下一步
|
||||||
|
|
|
@ -7,14 +7,7 @@
|
||||||
<template slot="extra">
|
<template slot="extra">
|
||||||
<a-button type="primary" size="default" @click="close">退出</a-button>
|
<a-button type="primary" size="default" @click="close">退出</a-button>
|
||||||
</template> -->
|
</template> -->
|
||||||
<a-form-model
|
<a-form-model ref="form" :rules="rules" :model="form" :label-col="labelCol" :wrapper-col="wrapperCol" layout="horizontal">
|
||||||
ref="form"
|
|
||||||
:rules="rules"
|
|
||||||
:model="form"
|
|
||||||
:label-col="labelCol"
|
|
||||||
:wrapper-col="wrapperCol"
|
|
||||||
layout="horizontal"
|
|
||||||
>
|
|
||||||
<a-row :gutter="24">
|
<a-row :gutter="24">
|
||||||
<a-col :md="24" :sm="24">
|
<a-col :md="24" :sm="24">
|
||||||
<a-form-model-item label="项目名称" prop="projectName">
|
<a-form-model-item label="项目名称" prop="projectName">
|
||||||
|
@ -138,6 +131,7 @@
|
||||||
import { dictGet } from '@/api/project/project'
|
import { dictGet } from '@/api/project/project'
|
||||||
import ClassList from '../classAdd/ClassList.vue'
|
import ClassList from '../classAdd/ClassList.vue'
|
||||||
import { classList } from '@/api/project/class'
|
import { classList } from '@/api/project/class'
|
||||||
|
import { projectAdd, getProjectDetail } from '@/api/project/project'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
|
@ -179,6 +173,11 @@ export default {
|
||||||
},
|
},
|
||||||
created(ClassList) {
|
created(ClassList) {
|
||||||
console.log('第一个表单创建了')
|
console.log('第一个表单创建了')
|
||||||
|
if (this.$route.query.projectId) {
|
||||||
|
getProjectDetail({ id: this.$route.query.projectId }).then(res => {
|
||||||
|
this.form = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
this.fetchTemplateData()
|
this.fetchTemplateData()
|
||||||
this.getTrainClass()
|
this.getTrainClass()
|
||||||
},
|
},
|
||||||
|
|
|
@ -88,7 +88,7 @@ export default {
|
||||||
expandedKeys: [],
|
expandedKeys: [],
|
||||||
autoExpandParent: true,
|
autoExpandParent: true,
|
||||||
defaultExpandedKeys: [],
|
defaultExpandedKeys: [],
|
||||||
selectedRowKeys: this.projectForm.personIds || [],
|
selectedRowKeys: [],
|
||||||
selectedRows: this.projectForm.projectPersonLists || [],
|
selectedRows: this.projectForm.projectPersonLists || [],
|
||||||
orgTree: [],
|
orgTree: [],
|
||||||
orgId: '',
|
orgId: '',
|
||||||
|
@ -186,7 +186,12 @@ export default {
|
||||||
|
|
||||||
//编辑时初始化人员列表初始化
|
//编辑时初始化人员列表初始化
|
||||||
initPersonList() {
|
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实例)
|
// 生命周期 - 创建完成(可以访问当前this实例)
|
||||||
created() {
|
created() {
|
||||||
this.getOrgTree()
|
this.getOrgTree()
|
||||||
|
this.initPersonList()
|
||||||
},
|
},
|
||||||
// 生命周期 - 挂载完成(可以访问DOM元素)
|
// 生命周期 - 挂载完成(可以访问DOM元素)
|
||||||
mounted() { },
|
mounted() { },
|
||||||
|
|
|
@ -46,16 +46,16 @@
|
||||||
<a-card :bordered="false" title="组卷策略详情">
|
<a-card :bordered="false" title="组卷策略详情">
|
||||||
<a-table :columns="columns" :data-source="tableData" bordered :position="{ disabled: false }" :pagination="false">
|
<a-table :columns="columns" :data-source="tableData" bordered :position="{ disabled: false }" :pagination="false">
|
||||||
<template slot="topicNum" slot-scope="text, record">
|
<template slot="topicNum" slot-scope="text, record">
|
||||||
<a-input-number style="margin: -5px 0" v-model="record.topicNum" min="0" :max="record.totalNum" />
|
<a-input-number style="margin: -5px 0" v-model="record.topicNum" :min="0" :max="record.totalNum" />
|
||||||
</template>
|
</template>
|
||||||
<template slot="topicScore" slot-scope="text, record">
|
<template slot="topicScore" slot-scope="text, record">
|
||||||
<a-input-number style="margin: -5px 0" v-model="record.topicScore" min="0" />
|
<a-input-number style="margin: -5px 0" v-model="record.topicScore" :min="0" />
|
||||||
</template>
|
</template>
|
||||||
<template slot="totalScore" slot-scope="text, record">
|
<template slot="totalScore" slot-scope="text, record">
|
||||||
<p>{{record.topicScore}}</p>
|
<p>{{record.topicScore}}</p>
|
||||||
</template>
|
</template>
|
||||||
<template slot="footer" :style="{ float:left }">
|
<template slot="footer" :style="{ float:'left' }">
|
||||||
<p>总分数:{{form.totalScore}} 分</p>
|
<p class="right">总分数:{{form.totalScore}} 分</p>
|
||||||
</template>
|
</template>
|
||||||
</a-table>
|
</a-table>
|
||||||
</a-card>
|
</a-card>
|
||||||
|
@ -135,12 +135,21 @@ export default {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
tableData: this.projectForm.testPaperTactics || [],
|
tableData: this.projectForm.testPaperTactics || [],
|
||||||
|
totalScore: 0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 计算属性 类似于data概念
|
// 计算属性 类似于data概念
|
||||||
computed: {},
|
computed: {},
|
||||||
// 监控data中的数据变化
|
// 监控data中的数据变化
|
||||||
watch: {},
|
watch: {
|
||||||
|
tableData: function () {
|
||||||
|
let sum = 0;
|
||||||
|
this.tableData.array.forEach(element => {
|
||||||
|
sum = element.totalScore + sum;
|
||||||
|
});
|
||||||
|
this.form.totalScore = sum;
|
||||||
|
}
|
||||||
|
},
|
||||||
// 方法集合
|
// 方法集合
|
||||||
methods: {
|
methods: {
|
||||||
validataScore() {
|
validataScore() {
|
||||||
|
@ -148,23 +157,21 @@ export default {
|
||||||
},
|
},
|
||||||
//保存
|
//保存
|
||||||
toSave() {
|
toSave() {
|
||||||
this.form.testPaperTactics = this.tableData
|
this.form.testPaperTactics = this.tableData;
|
||||||
|
this.form.projectStatus = 1
|
||||||
this.$emit('executeSave', this.form)
|
this.$emit('executeSave', this.form)
|
||||||
},
|
},
|
||||||
//发布
|
//发布
|
||||||
toIssue() {
|
toIssue() {
|
||||||
this.form.testPaperTactics = this.tableData
|
this.form.testPaperTactics = this.tableData;
|
||||||
|
this.form.projectStatus = 2
|
||||||
this.$emit('executeIssue', this.form)
|
this.$emit('executeIssue', this.form)
|
||||||
},
|
},
|
||||||
//上一步
|
//上一步
|
||||||
toPrev() {
|
toPrev() {
|
||||||
this.form.testPaperTactics = this.tableData
|
|
||||||
this.$emit('prevStep', this.form)
|
this.$emit('prevStep', this.form)
|
||||||
},
|
},
|
||||||
},
|
initTable() {
|
||||||
// 生命周期 - 创建完成(可以访问当前this实例)
|
|
||||||
created() {
|
|
||||||
if (this.tableData.length == 0) {
|
|
||||||
let ids = this.form.lessonIds.map((t) => {
|
let ids = this.form.lessonIds.map((t) => {
|
||||||
return parseInt(t.ids);
|
return parseInt(t.ids);
|
||||||
})
|
})
|
||||||
|
@ -173,6 +180,10 @@ export default {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 生命周期 - 创建完成(可以访问当前this实例)
|
||||||
|
created() {
|
||||||
|
this.initTable();
|
||||||
|
},
|
||||||
// 生命周期 - 挂载完成(可以访问DOM元素)
|
// 生命周期 - 挂载完成(可以访问DOM元素)
|
||||||
mounted() { },
|
mounted() { },
|
||||||
// 生命周期 - 创建之前
|
// 生命周期 - 创建之前
|
||||||
|
@ -192,4 +203,9 @@ export default {
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
</style>ß
|
.right {
|
||||||
|
/* 右对齐 */
|
||||||
|
text-align: right;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -44,11 +44,10 @@ export default {
|
||||||
},
|
},
|
||||||
toProjectList() {
|
toProjectList() {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: '/project/list'+this.$route.query.t,
|
path: '/project/list/'+this.$route.query.t,
|
||||||
query: {
|
query: {
|
||||||
t: this.$route.query.t,
|
t: this.$route.query.t,
|
||||||
projectPageNum: 1 ,
|
projectPageNum: 1 ,
|
||||||
queryParam: this.$route.query.projectQueryParam,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue