<template>
  <div class="OneContent">
    <cart-item title="要素效益">
      <title-card7  :icon="require('@/assets/images/bj/icon-2.png')" title="宏观经济" color="#299DF6" style="margin-top: 5px"/>
      <div class="main-box">
        <div class="item" :class="{selected:currentActive=='czhl'}">
          <div class="item-top">GDP</div>
          <div class="item-bottom">
            <span>{{ 2467.9 }}</span>亿
          </div>
        </div>
        <div class="item" :class="{selected:currentActive=='gdpzs'}">
          <div class="item-top">GDP增速</div>
          <div class="item-bottom">
            <span>{{ 8.0 }}</span>%
          </div>
        </div>
        <div class="item" :class="{selected:currentActive=='gdzctzzs'}">
          <div class="item-top">固定资产投资增速</div>
          <div class="item-bottom">
            <span>{{ 5 }}</span>%
          </div>
        </div>
        <div class="item" :class="{selected:currentActive=='gmysgyzjzzs'}">
          <div class="item-top">规上工业增加值增速</div>
          <div class="item-bottom">
            <span>{{ 7 }}</span>%
          </div>
        </div>
        <div class="item" :class="{selected:currentActive=='zzyzz'}">
          <div class="item-top">制造业投资增长</div>
          <div class="item-bottom">
            <span>{{7.4}}</span>%
          </div>
        </div>
        <div class="item" :class="{selected:currentActive=='gxjscy'}">
          <div class="item-top">高新技术产业投资增长</div>
          <div class="item-bottom">
            <span>{{ 17.6 }}</span>%
          </div>
        </div>
      </div>
      <title-card7  :icon="require('@/assets/images/bj/icon-1.png')" title="行业效益" color="#299DF6"  style="margin-top: 10px"/>
      <div class="main-box-1">
        <div class="hy-top">
          <div class="hy-item">
            <div class="title-box">
              第一产业
            </div>
            <div class="content-box">
              <span class="val">0.5</span>亿元
            </div>
          </div>
          <div class="hy-item">
            <div class="title-box">
              第二产业
            </div>
            <div class="content-box">
              <span class="val">849</span>亿元
            </div>
          </div>
          <div class="hy-item">
            <div class="title-box">
              第三产业
            </div>
            <div class="content-box">
              <span class="val">1335.3</span>亿元
            </div>
          </div>
        </div>
      </div>
      <title-card7  :icon="require('@/assets/images/bj/icon-2.png')" title="园区效益" color="#299DF6"  style="margin-top: 10px"/>
      <div class="main-box-2">
        <div class="item" @click="yqxq()">
          <div class="item-left">
            <div class="left">
              <div class="title">国家级园区</div>
            </div>
            <div class="right">
              <div class="num" >
                1
              </div>
              <div class="unit">个</div>
            </div>
          </div>
          <div class="item-right">
            <div class="name">税收</div>
            <div class="num">231.56</div>
            <div class="unit">亿元</div>
          </div>
        </div>
      </div>
      <title-card7  :icon="require('@/assets/images/bj/icon-1.png')" title="小镇效益" color="#299DF6"  style="margin-top: 10px"/>
      <div class="main-box-3">
        <div class="item" @click="showLayer()">
          <div class="item-left">
            <div class="left">
              <div class="title">小镇数量</div>
            </div>
            <div class="right">
              <div class="num">5</div>
              <div class="unit">个</div>
              <div class="unit"></div>
            </div>
          </div>
          <div class="item-right">
            <div class="name">税收</div>
            <div class="num">492</div>
            <div class="unit">亿元</div>
          </div>
        </div>
        <transition  enter-active-class="rollIn" leave-active-class="rollOut">
          <div v-show="xzShow">
            <div class="lineBox" v-for="(item, idx) in xzs" :key="idx+'xz'" @click="xzLocation(item)">
              <div class="line-top">
                <span class="icon"></span>
                <span class="title">{{ item.name }}</span>
                <span class="unit" @click.stop="showDetail(item)">详情</span>
              </div>
            </div>
          </div>
        </transition>
        <div class="item" @click="showLayer()">
          <div class="item-left">
            <div class="left">
              <div class="title">小镇面积</div>
            </div>
            <div class="right">
              <div class="num" v-for="(item, idx) in '2.8'.toString()" :key="'mj'+idx">{{ item }}</div>
              <div class="unit">万亩</div>
            </div>
          </div>
          <div class="item-right">
            <div class="name">亩均税收</div>
            <div class="num">176 <span>万元/亩</span> </div>
          </div>
        </div>
      </div>
    </cart-item>
  </div>
</template>

<script>
import CartItem from "@/views/components/CartItem.vue";
import {mapState, mapGetters} from "vuex";
import ItemCardBox from "@/views/components/ItemCardBox";
import TitleCard7 from "@/views/components/TitleCard7.vue";

export default {
  name: "RightContent",
  components: {CartItem,ItemCardBox,TitleCard7},
  data(){
    return{
      gdpzs:0,
      czhl:0,
      gdzctzzs:0,
      gmysgyzjzzs:0,
      zzyzz:0,
      gxjscy:0,
      currentActive:'',
      gjNum:0,
      gjSs:0,
      sjNum:0,
      sjSs:0,
      xzs: [],
      xzShow: false
    }
  },
  computed: {
    ...mapState({
      xzqName: state => state.BaseData.xzqState
    }),
    ...mapGetters({
      xzqdm: "BaseData/xzqCodeGetter",
      currentYear: "BaseData/yearGetter",
    })
  },
  watch: {
    currentYear(val) {
    }
  },
  mounted() {
    this.initData()
  },
  methods:{
    initData(){
      this.queryJjxyTotal()
    },
    queryJjxyTotal(){
      const urlApi = `/api/ybz/getJjxyTotal`;
      this.$ajax.post(urlApi, null, this, false).then(result=>{
        const {gdpzs,czhl,gdzctzzs,gmysgyzjzzs,zzyzz,gxjscy} = result.data
        this.gdpzs =gdpzs
        this.czhl =czhl
        this.gdzctzzs =gdzctzzs
        this.gmysgyzjzzs =gmysgyzjzzs
        this.zzyzz =zzyzz
        this.gxjscy =gxjscy
      })


    },
    yqxq() {
      this.$parent.yqShow = true
      this.$parent.yqData = {"fid":"93","kfqsp":"2","gljx":100,"kfqs_1":"国务院","kfqgl":"杭州高新技术产业开发区管委会","tdlyzk":70.47,"kfqg_1":"杭州市滨江区江南大道100号","kfqsz":"江北区块：东至莫干山路，南至天目山路，西至古翠路、丰潭路，北至余杭塘河。下沙区块：东至杭州绕城高速，南至12号大街南，西至5号大街，北至8号大街。江南区块：东至江虹路，南至浙赣铁路，西至东信大道，北至江南大道。","kfqyf":1212,"tdkfl":99.93,"gyydjzxs":39.44,"xzqmc":"杭州市","ydjgzk":42.29,"jzmd":28.04,"kfqpj_1":"工业主导型","zhydxy":0,"tdgyl":96.5,"kfqsl":"199103","kfqmc":"杭州国家高新技术产业开发区管委会(滨江区)","kfqpj":1211.63,"cyydtrccxy":90.05,"rkmd":0,"tdlyjgxy":100,"tddjl":0,"gyydl":37.14,"tdxzl":0,"sort":1,"kfqdm":"G332019","xzqdm":"3301","zhrjl":1.25,"gyydgdzctrqd":10181.46,"tdjcl":96.49,"kfqzd":"信息技术、生命健康、节能环保","jyd":76.95,"ydxy":90.05,"tdlyqd":71.57,"gyyddjss":2182.84,"tdlycd":97.32,"gyydzhrjl":1.59,"kfqjb":"国家级","tbmj":12116320.08,"pm":"18","objectid":"94"}
    },
    showLayer() {
      this.xzShow = !this.xzShow
      if (!this.xzs.length) {
        const urlApi = `/api/ybz-bj/tsxzBJ`;
        this.$ajax.get(urlApi, {}, this, false).then(resp => {
          let { data, success } = resp
          this.xzs = data
        })
      }
      this.$vm.$emit("setGdDetailType", 25);
      this.$vm.$emit("setVisibleLayerIdEvent", 'bj-xz')
      setTimeout(()=>{
        this.$vm.$emit("switchLayerShow", true);
      },100)
    },
    xzLocation(item) {
      this.$vm.$emit("setGdDetailType", 25);
      this.$vm.$emit("location-feature-where", { layerId: 'bj-xz', where: `name = '${item.name}'`, setting: {outFields: 'town_code,sde.sde.特色小镇.area,name,sqs,qx,sssr,cylx,describe'} })
    },
    showDetail(item) {
      this.$parent.townShow = true
      this.$parent.townData = item
    }
  }
}
</script>

<style scoped lang="scss">
.OneContent {
  height: 100%;
  position: relative;
  .main-box {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    .item{
      width: 49.5%;
      min-height: 90px;
      margin-bottom: 1%;
      background: rgba(22,56,123,0.3);
      border: 1px solid #356DD1;
      cursor: pointer;
      &:nth-child(odd) {
        margin-right: 1%;
      }
      &:hover{
        background: linear-gradient(90deg,#0e66bf,#0c2b68);
      }
      &.selected{
        background: linear-gradient(90deg,#0e66bf,#0c2b68);
      }
      .item-top{
        height: 50%;
        text-align: center;
        font-size: 20px;
        font-family: AlibabaPuHuiTiR;
        font-weight: bold;
        color: #4ADEFF;
        padding-top: 5px;
      }
      .item-bottom{
        height: 50%;
        text-align: center;
        font-size: 18px;
        font-family: AlibabaPuHuiTiR;
        font-weight: 400;
        color: #FFFFFF;
        span{
          font-size: 20px;
          font-family: AlibabaPuHuiTiR;
          font-weight: bold;
          margin-right: 2px;
        }
      }

      &:nth-child(3){
        .item-top{
          color: #FFE383;
        }
      }
      &:nth-child(4){
        .item-top{
          color: #FFE383;
        }
      }
      &:nth-child(5){
        .item-top{
          color: #36FFB6;
        }
      }
      &:nth-child(6){
        .item-top{
          color: #36FFB6;
        }
      }

    }
  }
  .main-box-1 {
    .hy-top{
      height: 100px;
      display: flex;
      // padding-right: 4px;

      .hy-item{
        height: 100%;
        flex: 1;
        background: rgba(22,56,123,0.3);
        border: 1px solid #3269CC;
        display: flex;
        flex-direction: column;
        align-items: center;
        cursor: pointer;
        &:not(:last-child) {
          margin-right: 5px;
        }
        &:nth-child(3){
          margin-right: 0;
        }

        &:hover{
          background: linear-gradient(90deg, #2470DF 0%, #143B89 100%);
          .title-box{
            color: #4AFDFF;
          }
        }

        &.selected{
          background: linear-gradient(90deg, #2470DF 0%, #143B89 100%);
          .title-box{
            color: #4AFDFF;
          }
        }

        .title-box{
          flex: 1;
          align-items: center;
          display: flex;
          font-family: AlibabaPuHuiTIR;
          font-weight: bold;
          color: #BDDCFF;
          font-size: 18px;
        }

        .content-box{
          flex: 1;
          align-items: center;
          display: flex;
          font-size: 16px;
          font-family: AlibabaPuHuiTIR;
          font-weight: 400;
          color: #FFFFFF;
          .val{
            font-size: 20px;
            font-weight: 700;
            margin-right: 5px;
          }
        }


      }
    }

    .hy-content{
      margin-top: 10px;
      height: calc(100% - 80px);
      overflow-y: auto;

      .hy-box{
        height: 68px;
        margin-bottom: 10px;
        background: rgba(22,56,123,0.3);
        border: 1px solid #3269CC;
        display: flex;
        padding-top: 6px;
        cursor: pointer;

        &:hover{
          background: linear-gradient(90deg, #2470DF 0%, #143B89 100%);
        }

        &.selected{
          background: linear-gradient(90deg, #2470DF 0%, #143B89 100%);
        }

        .circle{
          width: 35px;
          text-align: center;
          i{
            display: inline-block;
            width: 12px;
            height: 12px;
            border-radius: 50%;
            vertical-align: middle;
          }
        }

        .title{
          width: 200px;
          font-size: 16px;
          font-family: AlibabaPuHuiTIR;
          font-weight: 700;
        }

        .text{
          flex: 1;
          .text-top{
            font-size: 16px;
            font-family: AlibabaPuHuiTIR;
            font-weight: 500;
            color: #8CC2FF;
            text-align: center;
          }
          .text-bottom{
            font-size: 16px;
            font-family: Alibaba PuHuiTi;
            font-weight: 500;
            color: #FFFFFF;
            text-align: center;
            padding-top: 6px;
            .val{
              font-size: 18px;
              margin-right: 4px;
            }
          }
        }

        .percent{
          flex: 1;
        }

      }

    }

  }
  .main-box-2 {
    display: flex;
    flex-direction: column;

    .item {
      width: 100%;
      height: 60px;
      // margin-bottom: 2%;
      background: #16387B;
      display: flex;
      justify-content: space-between;
      cursor: pointer;

      &:hover {
        background: linear-gradient(90deg, #0e66bf, #0c2b68);
      }

      .item-left {
        flex: 2;
        display: flex;
        align-items: center;
        justify-content: space-between;

        .left {
          .title {
            font-size: 20px;
            font-family: AlibabaPuHuiTiR;
            font-weight: bold;
            color: #4ADEFF;
            margin-left: 15px;
            margin-right: 10px;
          }
        }

        .right {
          display: flex;
          align-items: center;

          .num {
            width: 30px;
            height: 34px;
            line-height: 34px;
            text-align: center;
            background: rgba(114, 248, 252, 0);
            border: 1px solid #4ADEFF;
            border-radius: 4px;
            font-size: 22px;
            font-family: AlibabaPuHuiTiR;
            font-weight: bold;
            color: #4ADEFF;
            margin-right: 5px;
          }

          .unit {
            font-size: 18px;
            font-family: AlibabaPuHuiTiR;
            font-weight: 400;
            color: #4ADEFF;
            margin-right: 20px;
          }
        }


      }

      .item-right {
        flex: 1.5;
        display: flex;
        align-items: center;

        .name {
          font-size: 20px;
          font-family: AlibabaPuHuiTiR;
          font-weight: bold;
          color: #FFFFFF;
          margin-right: 10px;
        }

        .num {
          font-size: 22px;
          font-family: AlibabaPuHuiTiR;
          font-weight: bold;
          color: #4ADEFF;
          margin-right: 10px;
        }

        .unit {
          font-size: 18px;
          font-family: AlibabaPuHuiTiR;
          font-weight: 400;
          color: #4ADEFF;
          margin-right: 10px;
        }
      }
    }


    .item:nth-child(2) {
      .item-left {
        .title {
          color: #FFE383;
        }

        .num {
          border: 1px solid #FFE383;
          color: #FFE383;
        }

        .unit {
          color: #FFE383;
        }
      }

      .item-right {
        .num {
          color: #FFE383;
        }

        .unit {
          color: #FFE383;
        }
      }
    }

    .item:nth-child(3) {
      .item-left {
        .title {
          color: #36FFB6;
        }

        .num {
          border: 1px solid #36FFB6;
          color: #36FFB6;
        }

        .unit {
          color: #36FFB6;
        }
      }

      .item-right {
        .num {
          color: #36FFB6;
        }

        .unit {
          color: #36FFB6;
        }
      }
    }

  }
  .main-box-3 {
    display: flex;
    flex-direction: column;

    .item {
      width: 100%;
      height: 60px;
      background: #16387B;
      display: flex;
      justify-content: space-between;
      cursor: pointer;
      margin-bottom: 10px;

      &:hover {
        background: linear-gradient(90deg, #0e66bf, #0c2b68);
      }

      .item-left {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: space-between;

        .left {
          .title {
            font-size: 20px;
            font-family: AlibabaPuHuiTiR;
            font-weight: bold;
            color: #4ADEFF;
            margin-left: 15px;
            // margin-right: 5px;
          }
        }

        .right {
          display: flex;
          align-items: center;

          .num {
            width: 30px;
            height: 34px;
            line-height: 34px;
            text-align: center;
            background: rgba(114, 248, 252, 0);
            border: 1px solid #4ADEFF;
            border-radius: 4px;
            font-size: 22px;
            font-family: AlibabaPuHuiTiR;
            font-weight: bold;
            color: #4ADEFF;
            margin-right: 5px;
          }

          .unit {
            font-size: 18px;
            font-family: AlibabaPuHuiTiR;
            font-weight: 400;
            color: #4ADEFF;
            margin-right: 5px;
          }
        }


      }

      .item-right {
        width: 200px;
        display: flex;
        align-items: center;

        .name {
          font-size: 20px;
          font-family: AlibabaPuHuiTiR;
          font-weight: bold;
          color: #FFFFFF;
          margin-right: 2px;
        }

        .num {
          font-size: 22px;
          font-family: AlibabaPuHuiTiR;
          font-weight: bold;
          color: #4ADEFF;
          margin-right: 10px;
          span {
            font-weight: normal;
            font-size: 18px;
          }
        }

        .unit {
          font-size: 18px;
          font-family: AlibabaPuHuiTiR;
          font-weight: 400;
          color: #4ADEFF;
          margin-right: 10px;
        }
      }
    }
    .item:last-child {
      .item-left {
        .title {
          color: #FFE383;
        }

        .num {
          border: 1px solid #FFE383;
          color: #FFE383;
        }

        .unit {
          color: #FFE383;
        }
      }

      .item-right {
        .num {
          color: #FFE383;
        }

        .unit {
          color: #FFE383;
        }
      }
    }
    .lineBox {
      height: 35px;
      margin-bottom: 10px;
      padding-left: 30px;
      cursor: pointer;
      &:hover {
        background: linear-gradient(90deg, #0e66bf, #0c2b68);
      }

      .line-top {
        height: 30px;
        line-height: 30px;

        .icon {
          display: inline-block;
          width: 4px;
          height: 18px;
          background: #03FFEB;
          border-radius: 2px;
          margin-right: 10px;
          transform: translateY(2px);
        }

        .title {
          font-size: 18px;
          font-family: AlibabaPuHuiTiR;
          font-weight: bold;
          color: #FFFFFF;
        }

        .val {
          font-size: 24px;
          font-family: Alibaba PuHuiTi;
          font-weight: bold;
          color: #03FFEB;
          float: right;
          margin-right: 5px;
        }

        .unit {
          font-size: 16px;
          font-family: Alibaba PuHuiTi;
          font-weight: 500;
          color: #03FFEB;
          float: right;
          margin-right: 5px;
        }

      }

      &:nth-child(4) {
        .icon {
          background: #49DEFF;
        }

        .val {
          color: #49DEFF;
        }

        .unit {
          color: #49DEFF;
        }

        .process{
          .bgColor {
            background: linear-gradient(90deg, #b7ebf6 0%, #49DEFF 100%);
          }

          .line {
            background: #49DEFF;
          }
        }

      }

    }
      @keyframes rollIn {
        0% {
          opacity: 0;
          height: 0;
          transform: translateY(-100%);
        }
        100% {
          opacity: 1;
          height: 128px;
          transform: translateY(0);
        }
      }
      @keyframes rollOut {
        0% {
          height: 128px;
          opacity: 1;
          transform: translateY(0);
        }
        100% {
          opacity: 0;
          height: 0;
          transform: translateY(-100%);
        }
      }
      /*滚入——从上侧*/
      .rollIn {
        animation: rollIn 0.3s;
      }
      /*滚出——从上侧*/
      .rollOut {
        animation: rollOut 0.3s;
      }
  }
}
</style>
