项目管理Form表单更新

This commit is contained in:
Yuanjianghong 2021-11-22 20:31:57 +08:00
parent ce69b05ee5
commit 9b8f1a3ee8
2 changed files with 147 additions and 14 deletions

View File

@ -16,7 +16,13 @@
<step2 v-if="currentTab === 1" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" /> <step2 v-if="currentTab === 1" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" />
<step3 v-if="currentTab === 2" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" /> <step3 v-if="currentTab === 2" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" />
<step4 v-if="currentTab === 3" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" /> <step4 v-if="currentTab === 3" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" />
<step5 v-if="currentTab === 4" :projectForm="form" @prevStep="prevStep" @executeSave="executeSave" @executeIssue="executeIssue" /> <step5
v-if="currentTab === 4"
:projectForm="form"
@prevStep="prevStep"
@executeSave="executeSave"
@executeIssue="executeIssue"
/>
<result v-if="currentTab === 5" :projectForm="form" @prevStep="prevStep" :projectSaveStatus="status" /> <result v-if="currentTab === 5" :projectForm="form" @prevStep="prevStep" :projectSaveStatus="status" />
<!-- </keep-alive> --> <!-- </keep-alive> -->
</div> </div>
@ -64,7 +70,8 @@ export default {
confirmLoading: false, confirmLoading: false,
type: '', type: '',
form: { form: {
trainWay: '1', trainWay: '2',
totalScore: '100',
}, },
result: true, result: true,
status: '', status: '',
@ -108,7 +115,9 @@ export default {
nextStep(childValue) { nextStep(childValue) {
console.log('进入下一步', childValue) console.log('进入下一步', childValue)
if (this.currentTab < 5) { if (this.currentTab < 5) {
if (childValue) {
this.form = childValue this.form = childValue
}
this.currentTab += 1 this.currentTab += 1
} }
console.log('ProjectStepForm表单数据', this.form) console.log('ProjectStepForm表单数据', this.form)
@ -117,7 +126,9 @@ export default {
prevStep(childValue) { prevStep(childValue) {
console.log('返回上一步', childValue) console.log('返回上一步', childValue)
if (this.currentTab > 0) { if (this.currentTab > 0) {
if (childValue) {
this.form = childValue this.form = childValue
}
this.currentTab -= 1 this.currentTab -= 1
} }
console.log('ProjectStepForm表单数据', this.form) console.log('ProjectStepForm表单数据', this.form)

View File

@ -1,12 +1,52 @@
<template> <template>
<div> <div>
<a-card :bordered="false"> <a-form-model :model="form" v-bind="formItemLayout">
<p>hahahahhahahahahhahahah</p> <a-card :bordered="false" title="组卷策略信息">
<a-row :gutter="24">
<a-col :md="10" :sm="12">
<a-form-model-item label="总分">
<a-input-number v-model="form.totalScore" :disabled="true" />
</a-form-model-item>
</a-col>
<a-col :md="14" :sm="12">
<a-form-model-item label="及格分">
<a-input-number v-model="form.passScore" :min="1" :max="100" />
</a-form-model-item>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :md="10" :sm="12">
<a-form-model-item label="考试时长">
<a-input-number v-model="form.examTime" />
</a-form-model-item>
</a-col>
<a-col :md="14" :sm="12">
<a-form-model-item label="默认组卷题量">
<a-input-number v-model="form.topicNumber" />
</a-form-model-item>
</a-col>
</a-row>
<a-row :gutter="24">
<h4>考试开启条件</h4>
<a-col :md="10" :sm="12">
<a-form-model-item label="学时时长">
<a-input-number v-model="form.examOpenCondition" />
</a-form-model-item>
</a-col>
</a-row>
</a-card> </a-card>
<a-card :bordered="false"> <a-card :bordered="false" title="组卷策略详情">
<p>ppppppsdapppsdapppp</p> <a-table :columns="columns" :data-source="tableData" bordered>
<template slot="topicNum" slot-scope="text, record">
<a-input-number style="margin: -5px 0" v-model="record.topicNum" />
</template>
<template slot="topicScore" slot-scope="text, record">
<a-input-number style="margin: -5px 0" v-model="record.topicScore" />
</template>
</a-table>
</a-card> </a-card>
</a-form-model>
<a-button type="primary" @click="toSave"> </a-button> <a-button type="primary" @click="toSave"> </a-button>
<a-button type="primary" @click="toIssue"> </a-button> <a-button type="primary" @click="toIssue"> </a-button>
<a-button type="primary" @click="toPrev">上一步</a-button> <a-button type="primary" @click="toPrev">上一步</a-button>
@ -16,6 +56,16 @@
<script> <script>
// jsjsjson // jsjsjson
// import from '' // import from ''
const renderContent = (value, row, index) => {
const obj = {
children: value,
attrs: {},
}
if (index === 4) {
obj.attrs.colSpan = 0
}
return obj
}
export default { export default {
// import使 // import使
@ -23,12 +73,75 @@ export default {
props: { props: {
projectForm: { projectForm: {
type: Object, type: Object,
} },
}, },
data() { data() {
// //
return { return {
form: this.projectForm, form: this.projectForm,
formItemLayout: { labelCol: { span: 4 }, wrapperCol: { span: 14 } },
columns: [
{ title: '序号', key: 'i', dataIndex: 'i', width: 70, scopedSlots: { customRender: 'serial' } },
{
title: '题目类型',
dataIndex: 'topicType',
key: 'topicType',
customRender: (text, record, index) => {
if (text == 1) return '单选题'
if (text == 2) return '多选题'
if (text == 3) return '判断题'
},
},
{ title: '总题量', dataIndex: 'totalNum', key: 'totalNum' },
{
title: '考试题量',
dataIndex: 'topicNum',
width: 100,
key: 'topicNum',
scopedSlots: { customRender: 'topicNum' },
},
{
title: '单题分值',
dataIndex: 'topicScore',
width: 100,
key: 'topicScore',
scopedSlots: { customRender: 'topicScore' },
},
{
title: '总分',
dataIndex: 'totalScore',
customRender: (value,row,index) => {
return { children: value, attrs: { rowSpan: index == 0 ? 3 : 0 }}
},
},
],
tableData: this.projectForm.testPaperTactics ||
[
{
i : 1,
topicType: 1,
totalNum: 20,
topicNum: 0,
topicScore: 0,
totalScore: 100,
},
{
i : 2,
topicType: 2,
totalNum: 20,
topicNum: 0,
topicScore: 0,
totalScore: 100,
},
{
i : 3,
topicType: 3,
totalNum: 20,
topicNum: 0,
topicScore: 0,
totalScore: 100,
},
],
} }
}, },
// data // data
@ -38,11 +151,20 @@ export default {
// //
methods: { methods: {
// //
toSave() { this.$emit('executeSave'), this.form }, toSave() {
this.form.testPaperTactics = this.tableData
this.$emit('executeSave', this.form)
},
// //
toIssue(){ this.$emit("executeIssue"), this.form }, toIssue() {
this.form.testPaperTactics = this.tableData
this.$emit('executeIssue', this.form)
},
// //
toPrev() { this.$emit('prevStep'), this.form }, toPrev() {
this.form.testPaperTactics = this.tableData
this.$emit('prevStep', this.form)
},
}, },
// - 访this // - 访this
created() {}, created() {},