<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 />
    </Transition>
  </div>
</template>
<script name="Abnormal" lang="ts" setup>
import { computed, ref } 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?.secretNumber || ""} - ${name}`;
});
</script>
<style lang="less" scoped>
.abnormal {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  :deep(.ant-alert-warning) {
    padding-left: 30px;
  }
  .collapse-btn {
    position: absolute;
    left: 5px;
    top: 8px;
    z-index: 1;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fffbe6;
    color: #faad14;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border: 1px solid #faad14;
    transition: all 0.5s;
    &.rotate {
      transform: rotate(180deg);
    }
  }
}
</style>
