leftcard.vue 6.11 KB
<!--
 * @Description  :工作台左侧
 * @Autor        : miaofang
 * @LastEditTime : 2023-05-17 15:23:32
-->
<template>
  <div class="leftcard">
    <div class="card">
      <div class="cardhead">区县接入</div>
      <div class="cardcontent">
        <ul class="cardcontent-left d-center">
          <div class="rjjrlList">
            <p v-for="(item, index) in qxjrlList" class="d-center qxjr" :key="index">
              {{ item }}
            </p>
          </div>
          <li>总量</li>
        </ul>
        <div class="cardcontent-right d-center">
          <p>
            <span>失败</span>
            <span class="bad">{{ qxerrer }}</span>
          </p>
          <p>
            <span>成功率</span>
            <span class="cg">{{ qxcgl }}</span>
          </p>
        </div>
      </div>
    </div>
    <div class="carda mt-15">
      <div class="cardhead">省厅汇交</div>
      <div class="cardcontent">
        <ul class="cardcontent-left d-center">
          <div class="rjjrlList">
            <p v-for="(item, index) in stjrlList" class="d-center sthj" :key="index">
              {{ item }}
            </p>
          </div>
          <li>总量</li>
        </ul>
        <div class="cardcontent-right d-center">
          <p>
            <span>失败</span>
            <span class="bad">{{ sterrer }}</span>
          </p>
          <p>
            <span>成功率</span>
            <span class="cg">{{ stcgl }}</span>
          </p>
        </div>
      </div>
    </div>
    <div class="card1 mt-15">
      <div class="cardhead">各区县数据上报统计</div>
      <columnar />
    </div>
  </div>
</template>

<script>

  import columnar from "@/components/Echart/Columnar";
  import work from "@/api/work";
  export default {
    data () {
      return {
        // 日均接入量
        qxerrer: "",
        qxsuccess: "",
        sterrer: "",
        stsuccess: "",
        qxjrl: "",
        stjrl: "",
        qxcgl: "",
        stcgl: ""
      };
    },
    mounted () {
      this.getsthjqxjrtotal();
    },
    components: { columnar },
    computed: {
      qxjrlList: function () {
        return this.qxjrl && this.qxjrl.toString().split("");
      },
      stjrlList: function () {
        return this.stjrl && this.stjrl.toString().split("");
      },
    },
    methods: {
      getsthjqxjrtotal () {
        return new Promise(async (resolve) => {
          try {
            let p = {
              DJLX: "",
              QLLX: "",
              XZQDM: "",
            };
            let res = await work.getsthjqxjrtotal(p);
            this.stjrl = res.result.stsum
            this.qxjrl = res.result.qxsum
            this.qxerrer = Number(res.result.qxjrerrer)
            this.sterrer = Number(res.result.sthjerrer)
            if (res.result.sum == "0") {
              this.qxcgl = "100%"
              this.stcgl = "100%"
            } else {
              let qxcglnum = Number(res.result.qxjrsuccess) / this.qxjrl * 100
              let stcgl = Number(res.result.sthjsuccess) / this.qxjrl * 100
              this.qxcgl = qxcglnum.toFixed(2) + "%";
              this.stcgl = stcgl.toFixed(2) + "%";

            }
          } catch (error) {
            this.$refs.msg.messageShow();
          }
        });
      },
    },
  };
</script>

<style lang="scss" scoped>
  .leftcard {
    width: 30%;
    display: flex;
    height: calc(100vh - 114px);
    flex-direction: column;

    .card {
      height: 22%;
      background: url("~@/image/qxjr.png") no-repeat;
      background-size: 100% 100%;
      position: relative;
      text-align: center;
      width: 100%;
    }

    .carda {
      height: 22%;
      background: url("~@/image/sthj.png") no-repeat;
      background-size: 100% 100%;
      position: relative;
      text-align: center;
      width: 100%;
    }

    .card1 {
      background: url("~@/image/sbtj.png") no-repeat;
      background-size: 100% 100%;
      position: relative;
      box-sizing: border-box;
      flex: 1;
    }

    .cardhead {
      color: #02d9fd;
      line-height: 0.125rem;
      letter-spacing: 0.0104rem;
      position: absolute;
      font-size: 0.1042rem;
      left: 0;
      right: 0;
      margin: auto;
      text-align: center;
      top: 8px;
      font-weight: 700;
    }

    .rjjrlList {
      display: flex;
      margin-top: 0.01781rem;

      .qxjr {
        background: url("~@/image/jrl3.png");
        background-size: 100% 100%;
        width: 29px;
        height: 46px;
      }

      .sthj {
        background: url("~@/image/jh.png");
        background-size: 100% 100%;
        width: 29px;
        height: 46px;
      }

      p {
        margin: 0 0.0156rem 0.0521rem 0.0156rem;
        font-weight: 700;
        font-size: 30px;
      }
    }

    .cardcontent {
      width: 100%;
      height: 100%;
      display: flex;
      // padding: 35px 20px 20px 20px;
      box-sizing: border-box;
      color: #e3f1ff;
      margin-top: 0.1263rem;

      .cardcontent-left {
        width: 60%;
        flex-direction: column;
        position: relative;
        flex: 1;
        height: 100%;

        li {
          font-size: 0.1042rem;
        }
      }

      .cardcontent-left::before {
        position: absolute;
        right: 0;
        top: 0.24rem;
        content: "";
        width: 0.0052rem;
        height: 0.4688rem;
        background: linear-gradient(
          180deg,
          #091b4c 0%,
          #47b5e0 56%,
          #091b4c 100%
        );
      }

      .cardcontent-right {
        flex: 1;
        width: 100%;
        height: 100%;
        flex-direction: column;
        font-size: 0.09977rem;

        .bad {
          color: #c97168;
        }

        .cg {
          color: #5fba7d;
        }

        p {
          width: 1.25rem;
          margin-bottom: 0.0417rem;

          span:nth-child(1) {
            text-align: right;
            display: inline-block;

            width: 45%;
            margin-right: 0.0781rem;
          }

          span:nth-child(2) {
            text-align: left;
            display: inline-block;
            width: 45%;
            font-size: 20px;
            font-weight: 900;
          }
        }
      }
    }
  }
</style>