<template>
  <div class="step-container">
    <div class="step-base">
      <img src="@/assets/imgs/img_data-complete.png" />
      <p class="tips" v-if="props.state">{{ ["新增", "编辑", "复制"][props.finishType] }}成功</p>
      <p class="tips" v-else>{{ ["新增", "编辑", "复制"][props.finishType] }}失败</p>
      <div class="apaas_button btns" v-if="props.state">
        <el-button type="default" @click="goToList"> 返回列表 </el-button>
        <el-button type="primary" @click="goStepOne"> {{ props.finishType == 1 ? "重新提交" : "继续新增" }} </el-button>
      </div>
    </div>
  </div>
</template>

<script setup>
import { reactive, ref, onBeforeMount, toRefs } from "vue";
import { useRouter, useRoute } from "vue-router";
import { ElMessage } from "element-plus";
const router = useRouter();
const route = useRoute();

const props = defineProps({
  state: {
    type: Boolean,
    default: true,
  },
  finishType: {
    type: Number,
    default: 0,
  },
});

const emit = defineEmits(["clear"]);

const goToList = () => {
  router.push("/auto-maintenance/task-manage");
};

const goStepOne = () => {
  emit("clear");
};
</script>

<style scoped>
.step-container {
  position: relative;
  height: 100%;
}
.step-base {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
}
.tips {
  margin: 60px 0;
  text-align: center;
  font-size: 18px;
  color: #202531;
  font-weight: 600;
}
.btns {
  width: 208px;
  margin: 0 auto;
  display: flex;
  justify-content: space-around;
}
</style>
