项目表单更新

This commit is contained in:
hbzgyjh 2021-12-16 21:26:45 +08:00
parent 0d242f5f8a
commit df4c00dac4
6 changed files with 58 additions and 42 deletions

View File

@ -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,

View File

@ -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)
})
},
//

View File

@ -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()
},

View File

@ -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() { },

View File

@ -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>

View File

@ -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,
},
})
},