<template>
  <!-- 子订单盒子 -->
  <div :class="hoverStatus ? 'body bodyHover ' : 'body'">
    <div class="topArea">
      <div class="productName">{{ item.materialName }}</div>
      <div class="productMsg">
        <span :class="hoverStatus ? 'msgName msgNameHover' : 'msgName'"
          >产品型号</span
        >
        <span class="msgValue">{{ item.materialModel }}</span>
      </div>
      <div class="productMsg">
        <span :class="hoverStatus ? 'msgName msgNameHover' : 'msgName'"
          >生产批号</span
        >
        <span class="msgValue">{{ item.workOrderCode }}</span>
      </div>
      <div class="productMsg">
        <span :class="hoverStatus ? 'msgName msgNameHover' : 'msgName'"
          >计划编号</span
        >
        <span class="msgValue">{{ item.orderCode }}</span>
      </div>
    </div>
    <div class="bottomArea">
      <div class="bottomBox">
        <div class="boxNum">{{ parseInt(item.planNum) }}</div>
        <div :class="hoverStatus ? 'boxText boxTextHover' : 'boxText'">
          产品数量
        </div>
      </div>
      <!-- <div class="textDivider">
        <div class="dividerBox">
          <el-divider direction="vertical" style="height: 60%" />
        </div>
      </div>
      <div class="bottomBox">
        <div class="boxNum">{{ parseInt(item.planNum) }}</div>
        <div :class="hoverStatus ? 'boxText boxTextHover' : 'boxText'">
          主料齐套
        </div>
      </div> -->
    </div>
    <!-- 右下角状态盒子 -->
    <div
      class="statusBox"
      :style="`background-color:${planStyle(item.workOrderState).bgColor};`"
    >
      {{ dictS.getLableByValue("plan_work_order_state", item.workOrderState) }}
    </div>
    <div class="water-box" v-if="item?.waterVapor == '1'">水汽</div>
    <div class="dpa-box" v-if="item?.dpa == '1'">DPA</div>
  </div>
</template>

<script lang="ts" setup>
import { useDictionaryStore } from "@/store";
const dictS = useDictionaryStore();
defineProps<{
  hoverStatus?: boolean;
  item: object;
}>();
//工单右下角盒子样式动态控制
const planStyle = (val) => {
  let obj = {
    bgColor: "#0A59F7",
    color: "#FFFFFF",
  };
  switch (val) {
    case "0":
      obj.bgColor = "#00FFFF";
      break;
    case "1":
      obj.bgColor = "#FF00FF";
      break;
    case "2":
      obj.bgColor = "#FF8080";
      break;
    case "3":
      obj.bgColor = "#008040";
      break;
    case "4":
      obj.bgColor = "#FF8000";
      break;
    case "5":
      obj.bgColor = "#FF0000";
      break;
    case "6":
      obj.bgColor = "#0A59F7";
      break;
    default:
      break;
  }
  return obj;
};
</script>

<style lang="scss" scoped>
//盒子间隔在MAR-bottom
.body {
  position: relative;
  width: 100%;
  height: 244px;
  border-radius: 16px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 15px 0 15px 20px;
  background-color: #ffffff;
}

.bodyHover {
  background-color: $select-hover;
  color: white;
  animation-name: bodyHover;
  animation-duration: $animation-duration;
}

.boxTextHover {
  color: white !important;
}

.productName {
  font-size: $f24;
}

.msgName {
  font-size: $f20;
  color: $font-default-60;
}

.msgNameHover {
  color: white !important;
}

.msgValue {
  margin-left: 5px;
  font-size: $f20;
}

.bottomArea {
  height: 60px;
}

.bottomBox {
  width: 80px;
  display: inline-block;
}

.textDivider {
  display: inline-block;

  .dividerBox {
    height: 60px;
    display: flex;
  }
}

.boxNum {
  text-align: center;
  line-height: 38px;
  font-size: $f38;
}

.boxText {
  text-align: center;
  font-size: $f20;
  line-height: 20px;
  color: $font-default-60;
}

.statusBox {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 90px;
  height: 40px;
  border-radius: 10px 0 10px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: $select-hover;
  font-size: $f20;
}
.water-box {
  position: absolute;
  top: 0;
  right: 0;
  width: 60px;
  height: 30px;
  border-radius: 0 10px 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: $select-hover;
  font-size: $f14;
}
.dpa-box {
  position: absolute;
  top: 0;
  right: 65px;
  width: 60px;
  height: 30px;
  border-radius: 0 10px 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: $select-hover;
  font-size: $f14;
}
</style>
