DeviceProfileStep4.vue
1.57 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
<template>
  <div class="step-4">
    <BasicForm :showSubmitButton="false" @register="register" />
  </div>
</template>
<script lang="ts">
  import { defineComponent, ref } from 'vue';
  import { BasicForm, useForm } from '/@/components/Form/index';
  import { alertContactsSchemas } from '../cpns/config';
  export default defineComponent({
    components: {
      BasicForm,
    },
    emits: ['prev', 'register'],
    setup(_, { emit }) {
      const getValueData: any = ref({});
      const [register, { setProps, validate, setFieldsValue, resetFields }] = useForm({
        schemas: alertContactsSchemas,
        actionColOptions: {
          span: 24,
        },
        resetButtonOptions: {
          text: '上一步',
        },
        resetFunc: customResetFunc,
      });
      const setAlaramContactAndNoticeMethodFunc = (v) => {
        setFieldsValue(v);
      };
      const clearAlaramContactAndNoticeMethodFunc = async () => {
        await resetFields();
      };
      async function customResetFunc() {
        emit('prev');
      }
      const getAllFields = async (getV) => {
        const values = await validate();
        getValueData.value = values;
        getV = getValueData.value;
        return getV;
      };
      return {
        clearAlaramContactAndNoticeMethodFunc,
        setAlaramContactAndNoticeMethodFunc,
        customResetFunc,
        getAllFields,
        register,
        setProps,
      };
    },
  });
</script>
<style lang="less" scoped>
  .step-4 {
    :deep .ant-btn {
      position: relative;
      right: 375px;
      top: 18px;
    }
  }
</style>