<!-- 搜索表单 -->
<template>
  <simple-form-modal
    title="处理反馈"
    :items="formItems"
    ref="editRef"
    :baseUrl="baseUrl"
    @success="(data) => emit('done', data)"
  ></simple-form-modal>
</template>

<script setup>
  import { reactive, ref, defineEmits, getCurrentInstance } from 'vue';
  import { useFormData } from '@/utils/use-form-data';
  import SimpleFormModal from '@/components/CommonPage/SimpleFormModal.vue';
  const { proxy } = getCurrentInstance();

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

  const formItems = reactive([
    {
      type: 'input',
      label: '联系方式',
      prop: 'mobile'
    },
    {
      type: 'textarea',
      label: '意见描述',
      prop: 'desc'
    },
    {
      type: 'imageUpload',
      label: '反馈图片',
      prop: 'image'
    }
  ]);

  //默认值
  const baseUrl = reactive({
    add: '/baseinfo/schoolInfo/save',
    update: '/baseinfo/schoolInfo/edit'
  });
  const formData = ref({});

  const editRef = ref(null);
  function handleOpen(data = {}, type) {
    formData.value = Object.assign(formData.value, data || {});
    editRef.value?.handleOpen(formData.value, type);
  }

  defineExpose({ handleOpen });
</script>
