StepForm.vue
2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<template>
<j-modal
:title="title"
:width="1000"
:visible="visible"
switchFullscreen
@ok="handleOk"
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
@cancel="handleCancel"
cancelText="关闭">
<a-steps class="steps" :current="currentTab">
<a-step title="第1页"/>
<a-step title="第2页"/>
<a-step title="第3页"/>
</a-steps>
<a-input v-model="snCode" type="text" hidden="hidden" placeholder="请输入sn编码" ></a-input>
<div class="content">
<step1 v-if="currentTab === 0" @nextStep="nextStep" @setSnData="setSnData"/>
<step2 v-if="currentTab === 1" @nextStep="nextStep" @prevStep="prevStep" :sn-code="snCode"/>
<step3 v-if="currentTab === 2" @prevStep="prevStep" @finish="finish" :sn-code="snCode"/>
</div>
</j-modal>
</template>
<script>
import Step1 from './CheckStepThreeForm'
import Step2 from './CheckStepThreeDataForm'
import Step3 from './CheckStepThreeData2Form'
export default {
name: "StepForm",
components: {
Step1,
Step2,
Step3
},
data() {
return {
title:'',
width:800,
snCode:'',
visible: false,
disableSubmit: false,
description: '将一个冗长或用户不熟悉的表单任务分成多个步骤,指导用户完成。',
currentTab: 0,
// form
form: null,
}
},
methods: {
edit(record){
this.visible=true
},
// handler
nextStep() {
if (this.currentTab < 2) {
// 在切换到 step2 时传递 snCode
this.currentTab += 1
}
},
prevStep() {
if (this.currentTab > 0) {
this.currentTab -= 1
}
},
finish() {
this.$emit('close');
this.visible = false;
this.currentTab = 0
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
// this.$refs.realForm.submitForm();
this.currentTab=0;
},
submitCallback(){
this.$emit('ok');
this.visible = false;
this.currentTab=0;
},
handleCancel () {
this.close()
this.currentTab=0;
},
setSnData(sncode){
this.snCode=sncode;
}
}
}
</script>
<style lang="less" scoped>
.steps {
max-width: 750px;
margin: 16px auto;
}
</style>