DeviceProfileStep2.vue
2.22 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
<template>
<div class="step2">
<BasicForm :showResetButton="false" :showSubmitButton="false" @register="register" />
<div
style="
display: flex;
width: 11vw;
height: 4vh;
flex-direction: row;
justify-content: space-between;
margin-left: 8vw;
margin-top: -4vh;
"
>
<div style="display: flex; width: 4vw; height: 4vh">
<Button type="default" style="border-radius: 2px" class="mt-5" @click="customResetFunc"
>上一步</Button
>
</div>
<div style="display: flex; width: 4vw; height: 4vh">
<Button type="default" class="mt-5" @click="customSubmitFunc"> 下一步</Button>
</div>
</div>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { BasicForm, useForm } from '/@/components/Form';
import { step2Schemas } from './data';
import { Alert, Divider, Descriptions } from 'ant-design-vue';
import { Button } from '/@/components/Button';
export default defineComponent({
components: {
BasicForm,
[Alert.name]: Alert,
[Divider.name]: Divider,
[Descriptions.name]: Descriptions,
[Descriptions.Item.name]: Descriptions.Item,
Button,
},
emits: ['next', 'prev', 'register'],
setup(_, { emit }) {
const [register, { validate, setFieldsValue, resetFields }] = useForm({
labelWidth: 80,
schemas: step2Schemas,
actionColOptions: {
span: 14,
},
});
const setStepTwoFieldsValueFunc = (v) => {
setFieldsValue(v);
};
const customClearStepTwoValueFunc = () => {
resetFields();
};
async function customResetFunc() {
emit('prev');
}
async function customSubmitFunc() {
try {
const values = await validate();
emit('next', values);
} catch (error) {
console.log(error);
} finally {
}
}
return {
customResetFunc,
customSubmitFunc,
register,
setStepTwoFieldsValueFunc,
customClearStepTwoValueFunc,
};
},
});
</script>
<style lang="less" scoped>
.step2 {
width: 500px;
margin: 0 auto;
}
</style>