<!-- eslint-disable vue/multi-word-component-names -->
<template>
  <!-- 基准的列表模块，通过不同的 type 展示不同的样式 -->
  <div class="list flex items-center" :class="`list_${type}`">
    <!-- 部分类型的列表需要加一张图片 -->
    <div :class="`list__image_${type}`"></div>
    <!-- 剩下的部分填充剩余宽度 -->
    <div class="flex-grow" :class="`list__wrapper_${type}`">
      <div v-for="(item, i) in listConfig" :key="`customlist${i}`" class="flex items-center" :class="`list-item_${type}`">
        <!-- 列表项前面的图标 -->
        <div v-if="type === 'I'" :class="`list-item__icon list-item__icon_${type}`" :style="{ backgroundImage: `url(${getIconPath(item)})` }"> </div>
        <div v-else-if="type === 'H'" :class="`list-item__icon list-item__icon_${type}`" :style="{ backgroundImage: `url(${getIconPath1(item)})` }">
        </div>
        <!-- 列表项的具体内容填充剩余宽度 -->
        <div class="flex-grow" :class="`list-item__content_${type}`">
          <div class="list-item__label" v-if="type !== 'I'">{{ item.label }}</div>
          <div class="list-item__info" :class="`list-item__info_${item.color}`">{{ item.info }}</div>
          <div class="list-item__value" :class="`list-item__value_${item.color} list-item__value_${type}`">{{ item.value }}</div>
        </div>
      </div>
    </div>
  </div>
</template>
<script lang="ts" setup>
withDefaults(
  defineProps<{
    listConfig: {
      value: string;
      color: string;
      label: string;
      info: string;
    }[];
    /** A B C D E F G */
    type: string;
  }>(),
  {
    listConfig: () => [],
    type: 'A',
  }
);
// function getIconPath(item) {
//   // 根据item.iconType返回对应图标路径
//   return require(`@/assets/images/fireNew/${item.label}.svg`);
// }
function getIconPath(item) {
  return new URL(`/src/assets/images/fireNew/${item.label}.png`, import.meta.url).href;
}
function getIconPath1(item) {
  switch (item.label) {
    case '光纤预警':
      return new URL('/src/assets/images/fireNew/9-3.png', import.meta.url).href;
    case '温度预警':
      return new URL('/src/assets/images/fireNew/9-3.png', import.meta.url).href;
    case '一氧化碳预警':
      return new URL('/src/assets/images/fireNew/9-4.png', import.meta.url).href;
    case '烟雾预警':
      return new URL('/src/assets/images/fireNew/9-5.png', import.meta.url).href;
    case '火焰预警':
      return new URL('/src/assets/images/fireNew/9-6.png', import.meta.url).href;
    default:
      return new URL('', import.meta.url).href;
  }
}
//   defineEmits(['click']);
</script>
<style lang="less" scoped>
@import '/@/design/theme.less';
@import '/@/design/theme.less';
/* Timeline 相关的样式 */

@{theme-deepblue} {
  .list {
    --image-list_bg_default: url(/@/assets/images/themify/deepblue/home-container/configurable/list_bg_default.png);
    --image-triangle_icon: url(/@/assets/images/themify/deepblue/home-container/configurable/triangle_icon.png);
    --image-list_bg_b: url(/@/assets/images/themify/deepblue/home-container/configurable/list_bg_b.png);
    --image-deco_1: url(/@/assets/images/themify/deepblue/home-container/configurable/deco_1.png);
    --image-list_bg_c: url(/@/assets/images/themify/deepblue/home-container/configurable/list_bg_c.png);
    --image-list_bg_defflip: url(/@/assets/images/themify/deepblue/home-container/configurable/list_bg_defflip.png);
    --image-list_bg_d: url(/@/assets/images/themify/deepblue/home-container/configurable/list_bg_d.png);
    --image-list_bg_e: url(/@/assets/images/themify/deepblue/home-container/configurable/list_bg_e.png);
    --image-list: url(/@/assets/images/themify/deepblue/home-container/configurable/firehome/list.png);
    --image-list_bg_h: url('/@/assets/images/fireNew/9-1.png');
    --image-list_bg_h1: url('/@/assets/images/fireNew/9-2.png');
    --image-list_bg_i: url('/@/assets/images/fireNew/10-1.png');
    --image-list_bg_i1: url('/@/assets/images/fireNew/10-2.png');
  }
}

.list {
  --image-list_bg_default: url(/@/assets/images/home-container/configurable/list_bg_default.png);
  --image-triangle_icon: url(/@/assets/images/home-container/configurable/triangle_icon.png);
  --image-list_bg_b: url(/@/assets/images/home-container/configurable/list_bg_b.png);
  --image-deco_1: url(/@/assets/images/home-container/configurable/deco_1.png);
  --image-list_bg_c: url(/@/assets/images/home-container/configurable/list_bg_c.png);
  --image-list_bg_defflip: url(/@/assets/images/home-container/configurable/list_bg_defflip.png);
  --image-list_bg_d: url(/@/assets/images/home-container/configurable/list_bg_d.png);
  --image-list_bg_e: url(/@/assets/images/home-container/configurable/list_bg_e.png);
  --image-list: url(/@/assets/images/home-container/configurable/firehome/list.png);
  --image-list_bg_h: url('/@/assets/images/fireNew/9-1.png');
  --image-list_bg_h1: url('/@/assets/images/fireNew/9-2.png');
  --image-list_bg_i: url('/@/assets/images/fireNew/10-1.png');
  --image-list_bg_i1: url('/@/assets/images/fireNew/10-2.png');
  --image-list_bg_j: url('/@/assets/images/home-container/configurable/list_bg_j.png');
  --image-linear-gradient-3: linear-gradient(to right, #39deff15, #3977e500);
  padding: 5px 20px;
  position: relative;
  background-repeat: no-repeat;
  width: 100%;
  height: 100%;
  background-size: 100% 100%;
  background-image: var(--image-list_bg_default);
}

.list_A {
  padding-left: 5px;
}
.list-item__content_A {
  background-repeat: no-repeat;
  background-image: @vent-gas-list-item-bg-img;
  // padding: 5px 10px;
  display: flex;
}
.list-item__icon_A {
  background-repeat: no-repeat;
  width: 25px;
  height: 29px;
  background-image: var(--image-triangle_icon);
}

.list-item__content_B {
  background-repeat: no-repeat;
  padding: 5px 10px 10px 10px;
  display: flex;
  background-position: left bottom;
  background-size: 100% auto;
  background-image: var(--image-list_bg_b);
}
.list__image_B {
  width: 77px;
  height: 77px;
  background-repeat: no-repeat;
  background-image: var(--image-deco_1);
  background-size: auto;
  margin-right: 20px;
}

.list_C {
  background: none;
}
.list-item__content_C {
  height: 60px;
  background-repeat: no-repeat;
  padding: 25px 50px 0 50px;
  display: flex;
  background-position: center;
  background-size: 100% 100%;
  background-image: var(--image-list_bg_c);
  margin-bottom: 10px;
  text-align: center;
}
.list-item__content_C > div {
  flex-basis: 33.3%;
}

.list_D {
  background-image: var(--image-list_bg_defflip);
}
.list__wrapper_D {
  display: flex;
  flex-wrap: wrap;
}
.list-item__icon_D {
  display: none;
}
.list-item_D {
  flex-basis: 25%;
  height: 60px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: auto 100%;
  background-image: var(--image-list_bg_d);
  text-align: center;
  margin-bottom: 10px;
}
.list-item__content_D {
  line-height: 30px;
}
.list-item__value_D {
  font-weight: bold;
}

.list_E {
  background-image: var(--image-list_bg_defflip);
}
.list__wrapper_E {
  display: flex;
  flex-wrap: wrap;
}
.list-item__icon_E {
  display: none;
}
.list-item_E {
  flex-basis: 25%;
  height: 70px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: auto 100%;
  background-image: var(--image-list_bg_e);
  text-align: center;
  margin: 5px 0px;
  padding-top: 32px;
  font-size: 12px;
}

.list_F {
  background: none;
}
.list-item__content_F {
  height: 40px;
  background-repeat: no-repeat;
  padding: 0 50px 0 50px;
  display: flex;
  background-position: center;
  background-size: 100% auto;
  background-image: var(--image-list);
  margin-top: 10px;
  text-align: center;
}
.list-item__content_F > div {
  flex-basis: 33.3%;
}

.list_G {
  background: none;
}
.list__wrapper_G {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}
.list-item_G {
  width: 130px;
  height: 80px;
  align-items: center;
  text-align: center;
  border: 1px solid rgba(25, 237, 255, 0.4);
  box-shadow: inset 0 0 10px rgba(0, 197, 255, 0.6);
  background: rgba(0, 0, 0, 0.1);
  margin: 5px 10px;
}
.list-item__content_G {
  position: relative;
  width: 100%;
  height: 100%;
}
.list-item__content_G > .list-item__label {
  width: 60px;
  height: 100%;
  left: 0;
  position: absolute;
  font-size: 20px;
  line-height: 80px;
}
.list-item__content_G > .list-item__info {
  width: 70px;
  height: 30px;
  line-height: 30px;
  right: 0;
  position: absolute;
}
.list-item__content_G > .list-item__value {
  width: 70px;
  height: 50px;
  line-height: 50px;
  top: 30px;
  right: 0;
  position: absolute;
  text-shadow: 0 0 25px #00fbfe;
  background: linear-gradient(0deg, #45d3fd, #45d3fd, #61ddb1, #61ddb1);
  font-style: normal;
  background-size: cover;
  font-family: electronicFont;
  font-size: 30px;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 18px;
  color: aliceblue;
}
.list_H {
  background: none;
  padding-bottom: 60px;
}
.list-item__icon_H {
  width: 15px;
  height: 15px;
  margin-left: 12px;
  background-size: 100% 100%;
}
.list-item_H {
  align-items: center;
  text-align: center;
  margin: 5px 10px;
  &:nth-child(2n) {
    background-repeat: no-repeat;
    background-size: 100% 100%;
    background-image: var(--image-list_bg_h);
  }
  &:nth-child(2n + 1) {
    background-repeat: no-repeat;
    background-size: 100% 100%;
    background-image: var(--image-list_bg_h1);
  }
}
.list-item__content_H {
  height: 40px;
  display: flex;
  align-items: center;
  width: 100%;
  line-height: 68px;
}
.list-item__content_H > div {
  flex-basis: 33%;
}
.list-item__content_H > .list-item__label {
  flex-basis: 33%;
}
.list-item__content_H > .list-item__info {
  flex-basis: 22%;
}
.list-item__content_H > .list-item__value {
  flex-basis: 45%;
}
.list-item__value_H {
  font-size: 16px;
  font-weight: bold;
  color: #bbffff;
}
.list_fireList {
  background: none;
}
.list__wrapper_fireList {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  margin-left: 86px;
}
.list-item_fireList {
  width: 167px;
  height: 58px;
  align-items: center;
  text-align: center;
  background-image: var(--image-list_bg_i);
  background-repeat: no-repeat;
  background-size: auto 100%;
  margin: 5px 10px;
}
.list-item__content_fireList {
  position: relative;
  width: 100%;
  height: 100%;
}
.list-item__content_fireList > .list-item__label {
  width: 60px;
  height: 100%;
  left: 0;
  position: absolute;
  font-size: 20px;
  line-height: 63px;
  color: #009bff;
}
.list-item__content_fireList > .list-item__info {
  height: 50%;
  left: 70px;
  position: absolute;
}
.list-item__content_fireList > .list-item__value {
  top: 50%;
  height: 50%;
  left: 70px;
  position: absolute;
  font-size: 18px;
}
.list_I {
  background: none;
}
.list__wrapper_I {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}
.list-item__icon_I {
  background-repeat: no-repeat;
  width: 50px;
  height: 20px;
  margin-left: 6px;
}
.list-item_I {
  width: 230px;
  height: 35px;
  align-items: center;
  text-align: center;
  margin: 15px 20px;
  /* 背景组合A（1,4,5,8） */
  &:nth-child(1),
  &:nth-child(4),
  &:nth-child(5),
  &:nth-child(8) {
    background-image: var(--image-list_bg_i1);
    background-repeat: no-repeat;
    background-size: 100% 100%;
  }

  /* 背景组合B（2,3,6,7） */
  &:nth-child(2),
  &:nth-child(3),
  &:nth-child(6),
  &:nth-child(7) {
    background-image: var(--image-list_bg_i);
    background-repeat: no-repeat;
    background-size: 100% 100%;
  }
}
.list-item__content_I {
  width: 100%;
  display: flex;
}
.list-item__content_I > .list-item__info {
  font-size: 15px;
  font-weight: bold;
  color: #ddd;
  flex-basis: 60%;
}
.list-item__content_I > .list-item__value {
  font-size: 15px;
  font-weight: bold;
  flex-basis: 30%;
}
.list_J {
  background: unset;
  padding: 0 5px 0 10px;
}
.list-item_J {
  width: 312px;
  height: 57px;
  align-items: center;
  text-align: center;
  background-image: var(--image-list_bg_j);
  background-repeat: no-repeat;
  background-size: auto 100%;
  margin: 5px 10px;
}
.list-item__content_J {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px 0 15px;
}
.list_K {
  background: unset;
  padding: 0 5px 0 10px;
}
.list__wrapper_K {
  height: 100%;
}
.list-item__content_K {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px;
  margin: 4px 0;
  background-image: var(--image-linear-gradient-3);

  .list-item__value {
    flex-basis: unset;
  }
  .list-item__label {
    flex-basis: unset;
  }
  .list-item__info {
    display: none;
  }
}

.list-item__label {
  flex-basis: 55%;
}
.list-item__info {
  flex-grow: 1;
}
.list-item__value {
  flex-basis: 30%;
}
.list-item__value_red {
  color: red;
}
.list-item__value_orange {
  color: orange;
}
.list-item__value_yellow {
  color: yellow;
}
.list-item__value_green {
  color: yellowgreen;
}
.list-item__value_blue {
  color: @vent-table-action-link;
}
.list-item__value_white {
  color: white;
}
.gallery-item__value_lightblue {
  color: @vent-configurable-home-light-border;
}
</style>
