<!-- 搜索表单 -->
<template>
    <simple-form-modal
        title="新增提醒地区"
        :items="formItems"
        ref="editRef"
        :baseUrl="baseUrl"
        @success="(data) => emit('success', data)"
    />
</template>

<script setup>
    import { reactive, ref, defineEmits } from 'vue';
    import SimpleFormModal from '@/components/CommonPage/SimpleFormModal.vue';

    //获取省市
    const emit = defineEmits(['success']);

    const formItems = computed(() => {
        return [
            {
                type: 'input',
                label: '提醒地区',
                prop: 'areaInfo',
                required: true
            },
            {
                type: 'dictRadio',
                label: '状态',
                prop: 'useStatus',
                props: { code: 'use_status' },
                required: true
            }
        ];
    });
    //默认值
    const baseUrl = reactive({
        add: '/book/checkWarn/addCheckWarnArea',
        update: ''
    });
    const formData = ref({ useStatus: '1' });
    const editRef = ref(null);

    function handleOpen(row = {}) {
        let data = { ...row, ...formData.value };
        editRef.value?.handleOpen(data);
    }

    defineExpose({ handleOpen });
</script>
