<template>
    <a-modal v-model:visible="isVisible" :modal-style="{width:'420px'}" body-class="okmodal" @ok="handleConfirm"
      @cancel="handleClose" >
      <template #title>
        提示
      </template>
       {{ title }}
    <!-- <template #footer>
      <a-button @click="handleClose"><template #icon><icon-close /></template>取消</a-button>
      <a-button type="primary" @click="handleConfirm"><template #icon><icon-check /></template>确认</a-button>
    </template> -->

    </a-modal>
</template>
<script setup>
import {toRefs, getCurrentInstance } from 'vue';
import { Message } from '@arco-design/web-vue';
const { proxy } = getCurrentInstance();
const props = defineProps({
  // 是否显示
  isVisible: {
    type: Boolean,
    default: false,
  },
  id:{
    type: String,
    default:'',
  },
   // 更新接口
   api: {
    type: Function,
  },
  title:{
    type: String,
    default:'',
  }
});
const emits = defineEmits(['closeChangeOk']);
const {isVisible,title,id,api} = toRefs(props);
// Akiraka 20230210 关闭弹窗
const handleClose = () =>  {
  emits('closeChangeOk',false);
}

// Akiraka 20230210 确认按钮 => 开始数据检查
const handleConfirm = async () => {
   const data=title.value=="确定启用吗？"?await api.value(id.value,{status:1}):await api.value(id.value);
   if(data.code==200){
       Message.success("成功");
      //proxy.$refs.modalFormRef.resetFields();
   }else{
    proxy.$notification.error(response.message);
   }
    emits('closeChangeOk',true);
  }
</script>