项目表单更新
This commit is contained in:
parent
0d242f5f8a
commit
df4c00dac4
|
@ -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,
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</template> -->
|
||||
<a-space direction="vertical" style="width: 100%">
|
||||
<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-button type="primary" icon="search" @click="$refs.table.refresh(true)">查询</a-button>
|
||||
|
@ -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)
|
||||
})
|
||||
},
|
||||
//下一步
|
||||
|
|
|
@ -7,14 +7,7 @@
|
|||
<template slot="extra">
|
||||
<a-button type="primary" size="default" @click="close">退出</a-button>
|
||||
</template> -->
|
||||
<a-form-model
|
||||
ref="form"
|
||||
:rules="rules"
|
||||
:model="form"
|
||||
:label-col="labelCol"
|
||||
:wrapper-col="wrapperCol"
|
||||
layout="horizontal"
|
||||
>
|
||||
<a-form-model ref="form" :rules="rules" :model="form" :label-col="labelCol" :wrapper-col="wrapperCol" layout="horizontal">
|
||||
<a-row :gutter="24">
|
||||
<a-col :md="24" :sm="24">
|
||||
<a-form-model-item label="项目名称" prop="projectName">
|
||||
|
@ -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()
|
||||
},
|
||||
|
|
|
@ -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() { },
|
||||
|
|
|
@ -46,16 +46,16 @@
|
|||
<a-card :bordered="false" title="组卷策略详情">
|
||||
<a-table :columns="columns" :data-source="tableData" bordered :position="{ disabled: false }" :pagination="false">
|
||||
<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 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 slot="totalScore" slot-scope="text, record">
|
||||
<p>{{record.topicScore}}</p>
|
||||
</template>
|
||||
<template slot="footer" :style="{ float:left }">
|
||||
<p>总分数:{{form.totalScore}} 分</p>
|
||||
<template slot="footer" :style="{ float:'left' }">
|
||||
<p class="right">总分数:{{form.totalScore}} 分</p>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
|
@ -135,12 +135,21 @@ export default {
|
|||
},
|
||||
],
|
||||
tableData: this.projectForm.testPaperTactics || [],
|
||||
totalScore: 0,
|
||||
}
|
||||
},
|
||||
// 计算属性 类似于data概念
|
||||
computed: {},
|
||||
// 监控data中的数据变化
|
||||
watch: {},
|
||||
watch: {
|
||||
tableData: function () {
|
||||
let sum = 0;
|
||||
this.tableData.array.forEach(element => {
|
||||
sum = element.totalScore + sum;
|
||||
});
|
||||
this.form.totalScore = sum;
|
||||
}
|
||||
},
|
||||
// 方法集合
|
||||
methods: {
|
||||
validataScore() {
|
||||
|
@ -148,23 +157,21 @@ export default {
|
|||
},
|
||||
//保存
|
||||
toSave() {
|
||||
this.form.testPaperTactics = this.tableData
|
||||
this.form.testPaperTactics = this.tableData;
|
||||
this.form.projectStatus = 1
|
||||
this.$emit('executeSave', this.form)
|
||||
},
|
||||
//发布
|
||||
toIssue() {
|
||||
this.form.testPaperTactics = this.tableData
|
||||
this.form.testPaperTactics = this.tableData;
|
||||
this.form.projectStatus = 2
|
||||
this.$emit('executeIssue', this.form)
|
||||
},
|
||||
//上一步
|
||||
toPrev() {
|
||||
this.form.testPaperTactics = this.tableData
|
||||
this.$emit('prevStep', this.form)
|
||||
},
|
||||
},
|
||||
// 生命周期 - 创建完成(可以访问当前this实例)
|
||||
created() {
|
||||
if (this.tableData.length == 0) {
|
||||
initTable() {
|
||||
let ids = this.form.lessonIds.map((t) => {
|
||||
return parseInt(t.ids);
|
||||
})
|
||||
|
@ -173,6 +180,10 @@ export default {
|
|||
})
|
||||
}
|
||||
},
|
||||
// 生命周期 - 创建完成(可以访问当前this实例)
|
||||
created() {
|
||||
this.initTable();
|
||||
},
|
||||
// 生命周期 - 挂载完成(可以访问DOM元素)
|
||||
mounted() { },
|
||||
// 生命周期 - 创建之前
|
||||
|
@ -192,4 +203,9 @@ export default {
|
|||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
</style>ß
|
||||
.right {
|
||||
/* 右对齐 */
|
||||
text-align: right;
|
||||
font-size: 16px;
|
||||
}
|
||||
</style>
|
|
@ -44,11 +44,10 @@ export default {
|
|||
},
|
||||
toProjectList() {
|
||||
this.$router.push({
|
||||
path: '/project/list'+this.$route.query.t,
|
||||
path: '/project/list/'+this.$route.query.t,
|
||||
query: {
|
||||
t: this.$route.query.t,
|
||||
projectPageNum: 1 ,
|
||||
queryParam: this.$route.query.projectQueryParam,
|
||||
},
|
||||
})
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue