<template>
  <div v-if="store.currentTask?.collationLabelCode" class="abnormal">
    <div class="collapse-btn" :class="{ rotate: !show }" @click="show = !show">
      <UpOutlined style="font-size: 12px" />
    </div>
    <Transition
      enterActiveClass="animate__animated animate__slideInDown"
      leaveActiveClass="animate__animated animate__slideOutUp"
    >
      <!-- <a-alert v-if="show" :message="result" banner /> -->
      <div v-if="show" class="text-box">{{ result }}</div>
    </Transition>
  </div>
</template>
<script name="Abnormal" lang="ts" setup>
import { computed, ref, watch } from "vue";
import { store } from "@/store/store";

import { UpOutlined } from "@ant-design/icons-vue";
const show = ref(true);
const result = computed(() => {
  let collationLabelList = store.setting?.collationLabelList || [];
  let name =
    collationLabelList.find(
      (item: any) => item.code == store.currentTask?.collationLabelCode
    )?.name || "";
  return `试卷整理异常信息：${
    store.currentTask?.collationLabelCode || ""
  } - ${name}`;
});
watch(
  () => store.currentTask,
  () => {
    show.value = true;
  }
);
</script>
<style lang="less" scoped>
.abnormal {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  width: 50%;
  // :deep(.ant-alert-warning) {
  //   padding-left: 30px;
  // }
  .text-box {
    padding-left: 30px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    line-height: 1.4;
    height: 30vh;
    font-size: 20px;
    overflow: auto;
  }
  .collapse-btn {
    position: absolute;
    left: 5px;
    top: 4px;
    z-index: 1;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    color: var(--app-primary-button-bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border: 1px solid var(--app-primary-button-bg-color);
    transition: all 0.5s;
    &.rotate {
      transform: rotate(180deg);
    }
  }
}
</style>
