<!--
 * @Author: daidai
 * @Date: 2022-03-01 15:27:58
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-05-07 11:24:14
 * @FilePath: \web-pc\src\pages\big-screen\view\indexs\right-center.vue
-->
<template>
  <div v-if="pageflag" class="right_center_wrap beautify-scroll-def" :class="{ 'overflow-y-auto': !sbtxSwiperFlag }">
    <component :is="components" :data="list" :class-option="defaultOption">
      <ul class="right_center ">
        <li class="right_center_item" v-for="(item, i) in list" :key="i">
          <div class="inner_right">
            <div class="dibu"></div>
			<span class="orderNum">{{ i + 1 }}</span>
            <div class="info">
              <span class="zhuyao"> {{ item.gatewayno }}</span>
            </div>
            <div class="info">
              <span class="ciyao"> {{ item.sbInfo }}</span>
            </div>
            <div class="info">
              <span class="warning" v-if="curTab==1"> {{ item.alertvalue1 | montionFilter }}</span>
			  <span class="warning" v-if="curTab==2"> {{ item.alertvalue | montionFilter }}</span>
            </div>
          </div>
        </li>
      </ul>
    </component>
  </div>
  <Reacquire v-else @onclick="getData" style="line-height:200px" />

</template>

<script>
import { currentGET } from 'api/modules'
import vueSeamlessScroll from 'vue-seamless-scroll'  // vue2引入方式
import Kong from '../../components/kong.vue'
export default {
  components: { vueSeamlessScroll, Kong },
  props: {
  	curTab: {
  		type: Number,
  		default: 1
  	},
  },
  data() {
    return {
      list: [],
      pageflag: true,
      defaultOption: {
        ...this.$store.state.setting.defaultOption,
        limitMoveNum: 3, 
        singleHeight: 390, 
        step:0,
		waitTime: 10000
      },
    };
  },
  computed: {
    sbtxSwiperFlag() {
      let ssyjSwiper = this.$store.state.setting.ssyjSwiper
      if (ssyjSwiper) {
        this.components = vueSeamlessScroll
      } else {
        this.components = Kong
      }
      return ssyjSwiper
    }
  },
  created() {
    this.getData()
  },
  watch: {
  	curTab(newValue, oldValue) {
		this.pageflag = false
  		this.getData()
  	}
  },
  mounted() { },
  methods: {
    getData() {
      this.pageflag = true
      currentGET('big9', { limitNum: 50 }).then(res => {
        if (res.success) {
          this.list = res.data.list
          let timer = setTimeout(() => {
              clearTimeout(timer)
              this.defaultOption.step=this.$store.state.setting.defaultOption.step
          }, this.$store.state.setting.defaultOption.waitTime);
        } else {
          this.pageflag = false
          this.$Message.warning(res.msg)
        }
      })
    },

  },
};
</script>
<style lang='scss' scoped>
.right_center {
  width: 100%;
  height: 100%;

  .right_center_item {
    padding: 13px 0;
    font-size: 14px;
    color: #fff;
	
    .inner_right {
	  display: flex;
	  align-items: center;
      position: relative;
      height: 100%;
      width: 100%;
      flex-shrink: 0;
      line-height: 1.5;
	  .orderNum {
	  	width: 10%;
	  	text-align: center;
		color: #fff;
	  }
      .dibu {
        position: absolute;
        height: 2px;
        width: 104%;
        background-image: url("../../assets/img/zuo_xuxian.png");
        bottom: -12px;
        left: 0;
        background-size: cover;
      }
    }

    .info {
	  width: 30%;
	  text-align: center;
      .zhuyao {
        color: #a6e0ff;
        font-size: 15px;
      }
      .ciyao {
        color: rgba(255, 255, 255, 0.8);
      }
      .warning {
        color: #E6A23C;
        font-size: 15px;
      }
    }

  }
}

.right_center_wrap {
  overflow: hidden;
  width: 100%;
  height: 390px;
}

.overflow-y-auto {
  overflow-y: auto;
}
</style>