<script setup lang="ts">
/**
 * @Name: TipDialog.vue
 * @Description: 数据错误提示弹窗
 * @Author: xinyan
 */

import { Warning } from '@element-plus/icons-vue';

const props = defineProps({
  message: Object,
  isNormal: {
    type: Boolean,
    default: false,
  },
  isROI: {
    type: Boolean,
    default: false,
  }
});

const { message ,isNormal, isROI} = props;
const openTip = defineModel({ default: false });

const emit = defineEmits(['submit', 'update']);


function submit() {
  emit('submit')
}

function update() {
  emit('update')
}

</script>

<template>
  <el-dialog
      v-model="openTip"
      align-center
      style="border-radius: 10px;"
      title="重要提示"
      width="30%"
  >
    <template #title>
      <el-button link style="font-size: 18px" type="warning">
        <el-icon size="22px">
          <warning />
        </el-icon>
        重要提示
      </el-button>
    </template>
    <div v-if="message">
      <span>您输入的 </span>
      <span style="color: #f1a055;">{{ message }}</span>
      <span> 相较于上次填入的数据偏离值超过 50% ，是否仍要提交？</span>
    </div>
    <div v-if="isNormal ||isROI" class="pt-2">
      <span>ROI < 0，请确认数据填入是否正确!</span>
    </div>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="openTip = false">返回修改</el-button>
        <el-button type="primary" @click="isROI? update() : submit()">继续提交</el-button>
      </span>
    </template>
  </el-dialog>

</template>

<style scoped>

</style>