<template>
  <div>
    <el-dialog
      id="custom-dialog"
      v-model="visible"
      :title="null"
      close-icon="null"
    >
      <div class="top-title">{{ boxDetail.vehicleName }}</div>
      <div class="desc-title">{{ boxDetail.vehicleCode }}</div>
      <div class="center-content">
        <el-scrollbar>
          <div
            v-for="(item, index) in boxDetail?.processMaterialList ?? []"
            :key="index"
            class="item-container"
          >
            <div>
              <div class="item-header">{{ item?.materialName }}</div>
              <div class="item-describe">{{ item?.spec }}</div>
            </div>
            <div>
              <span class="item-count">{{ item?.num }}</span>
              <span class="item-unit">{{ item?.unitLabel }}</span>
            </div>
          </div>
        </el-scrollbar>
      </div>
    </el-dialog>
  </div>
</template>

<script lang="ts" setup>
const visible = ref(false);

const boxDetail = ref<any>({});

const showDetails = (boxObj: any) => {
  visible.value = true;
  boxDetail.value = boxObj;
};

defineExpose({
  showDetails,
});
</script>

<style lang="scss" scoped>
:deep(.el-dialog) {
  background: #f1f3f5;
  box-shadow: 0px 0px 80px 10px rgba(0, 0, 0, 0.25);
  border-radius: 16px;
}

#custom-dialog {
  background: #f1f3f5;
  box-shadow: 0px 0px 80px 10px rgba(0, 0, 0, 0.25);
  border-radius: 16px 16px 16px 16px;
  width: 924px;
  max-height: 80vh;

  .top-title {
    width: 100%;

    font-weight: 500;
    font-size: 38px;
    color: rgba(0, 0, 0, 0.9);
    text-align: center;
  }

  .desc-title {
    font-weight: 400;
    font-size: 20px;
    color: rgba(0, 0, 0, 0.6);
    text-align: center;
  }

  .center-content {
    margin-top: 24px;
    width: 100%;
    height: 500px;

    font-size: 24px;
    overflow-y: auto;
    color: rgba(0, 0, 0, 0.9);
    border-radius: 16px 16px 16px 16px;
    border: 1px solid rgba(0, 0, 0, 0.2);
  }

  .bottom-btns {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    margin-bottom: 20px;

    .button {
      margin-right: 20px;
    }

    .cancelBtn {
      width: 292px;
      height: 80px;
      background: rgba(0, 0, 0, 0.06);
      border-radius: 76px 76px 76px 76px;
    }

    .sureBtn {
      width: 292px;
      height: 80px;
      background: #0a59f7;
      border-radius: 76px 76px 76px 76px;
    }
  }
}

.item-container {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-left: 30px;
  padding-right: 20px;
  height: 80px;
}

.item-header {
  font-weight: 500;
  font-size: 24px;
  color: rgba(0, 0, 0, 0.9);
  text-align: left;
}

.item-describe {
  font-weight: 400;
  font-size: 20px;
  color: rgba(0, 0, 0, 0.6);
  text-align: left;
}

.item-count {
  font-weight: bold;
  font-size: 38px;
  color: rgba(0, 0, 0, 0.9);

  text-align: right;
}

.item-unit {
  font-weight: 500;
  font-size: 20px;
  color: rgba(0, 0, 0, 0.6);

  text-align: right;
}
</style>
