<template>
  <div class="main-data car-warning-dialog-area" @click.stop="preventDefault" @mouseleave="leaveFun">
    <div class="dialog-title">
      <img
        src="@/assets/images/main/cont_title_bg.png"
      />
      <div class="title">成本管理</div>
    </div>
    <div class="dialog-cont">
      <div class="dialog-left">
        <div class="dialog-list">
          <div class="dialog-item wid100" style="margin: 10px 0">
            <div class="content-title" style="width: 100%;">
              <span class="title" style="transform: translate(0,-4px);">成本概况</span>
            </div>
            <div style="display: flex;justify-content: space-between;color: #00fdeb;width: 100%">
              <div>
                <div style="display: flex;align-items: center;justify-content: center;font-size: 12px">
                  <img src="../../../assets/zhang/car_cost.png" width="45">公务车总成本
                </div>
                <div style="font-size: 40px;font-family: 'electronicFont';text-align: center">
                  56
                  <span style="font-size: 10px;">万元</span>
                </div>
              </div>
              <div>
                <div style="display: flex;align-items: center;justify-content: center;font-size: 12px">
                  <img src="../../../assets/zhang/car_cost.png" width="45">单车平均成本
                </div>
                <div style="font-size: 40px;font-family: 'electronicFont';text-align: center">
                  56
                  <span style="font-size: 10px;">万元</span>
                </div>
              </div>
              <div>
                <div style="display: flex;align-items: center;justify-content: center;font-size: 12px">
                  <img src="../../../assets/zhang/car_cost.png" width="45">单车最高成本
                </div>
                <div style="font-size: 40px;font-family: 'electronicFont';text-align: center">
                  56
                  <span style="font-size: 10px;">万元</span>
                </div>
              </div>
              <div>
                <div style="display: flex;align-items: center;justify-content: center;font-size: 12px">
                  <img src="../../../assets/zhang/car_cost.png" width="45">单车最低成本
                </div>
                <div style="font-size: 40px;font-family: 'electronicFont';text-align: center">
                  56
                  <span style="font-size: 10px;">万元</span>
                </div>
              </div>
            </div>
          </div>


          <div class="dialog-item wid100" style="margin: 40px 0">
            <div class="content-title" style="width: 100%;">
              <span class="title" style="transform: translate(0,-4px);">车辆总成本费用分布</span>
            </div>
            <div style="display: flex;width: 100%;align-items: center;justify-content: center">
              <pie-chart
                :chart-data="pieData"
                :legend="pieLegend"
                :title="pieTitle"
                width="220px"
                height="180px"
              />
            </div>
          </div>
          <div class="dialog-item wid100" style="margin: 10px 0">
            <div class="content-title" style="width: 100%;">
              <span class="title" style="transform: translate(0,-4px);">单位成本分布情况</span>
            </div>
          </div>

          <div style="overflow: auto;width: 100%;display: flex;">
            <div class="flex-container">
              <div class="header">
                <div class="flex-column">配置使用单位</div>
                <div class="flex-column">总车辆数</div>
                <div class="flex-column">总成本</div>
                <div class="flex-column">单车平均成本</div>
                <div class="flex-column">超出平均成本车辆</div>
                <div class="flex-column">油费</div>
                <div class="flex-column">单车最高成本</div>
                <div class="flex-column">充电费</div>
                <div class="flex-column">保险费</div>
                <div class="flex-column">年检费</div>
                <div class="flex-column">过路过桥费</div>
                <div class="flex-column">维修保养费</div>
                <div class="flex-column">车装车饰费</div>
                <div class="flex-column">其他费用</div>
              </div>
              <div class="flex-row" v-for="(item,index) in dataList" :key="index" @click="choose()">
                <div class="flex-column">{{item.a}}</div>
                <div class="flex-column">{{item.b}}</div>
                <div class="flex-column">{{item.c}}</div>
                <div class="flex-column">{{item.d}}</div>
                <div class="flex-column">{{item.e}}</div>
                <div class="flex-column">{{item.f}}</div>
                <div class="flex-column">{{item.g}}</div>
                <div class="flex-column">{{item.h}}</div>
                <div class="flex-column">{{item.i}}</div>
                <div class="flex-column">{{item.j}}</div>
                <div class="flex-column">{{item.k}}</div>
                <div class="flex-column">{{item.l}}</div>
                <div class="flex-column">{{item.m}}</div>
                <div class="flex-column">{{item.n}}</div>
              </div>
            </div>

          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import LineChart from "@/components/Echarts/LineChart";
import PieChart from "@/components/Echarts/PieChart";
import BarChart from "@/components/Echarts/BarChart.vue";
import echarts from "echarts";

export default {
  name: "BuildingSaveDialog",
  components: {
    BarChart,
    PieChart,
    LineChart,
  },
  props: {},
  data() {
    return {
      // 公务用车资源情况
      dataList: [
        {
          a: "国网山西省公司",
          b: 56,
          c: 46,
          d: 11,
          e: 56,
          f: 46,
          g: 11,
          h: 56,
          i: 46,
          j: 11,
          k: 56,
          l: 46,
          m: 11,
          n: 55
        },
        {
          a: "国网山西省公司",
          b: 56,
          c: 46,
          d: 11,
          e: 56,
          f: 46,
          g: 11,
          h: 56,
          i: 46,
          j: 11,
          k: 56,
          l: 46,
          m: 11,
          n: 55
        },
        {
          a: "国网山西省公司",
          b: 56,
          c: 46,
          d: 11,
          e: 56,
          f: 46,
          g: 11,
          h: 56,
          i: 46,
          j: 11,
          k: 56,
          l: 46,
          m: 11,
          n: 55
        },
        {
          a: "国网山西省公司",
          b: 56,
          c: 46,
          d: 11,
          e: 56,
          f: 46,
          g: 11,
          h: 56,
          i: 46,
          j: 11,
          k: 56,
          l: 46,
          m: 11,
          n: 55
        },
        {
          a: "国网山西省公司",
          b: 56,
          c: 46,
          d: 11,
          e: 56,
          f: 46,
          g: 11,
          h: 56,
          i: 46,
          j: 11,
          k: 56,
          l: 46,
          m: 11,
          n: 55
        },
        {
          a: "国网山西省公司",
          b: 56,
          c: 46,
          d: 11,
          e: 56,
          f: 46,
          g: 11,
          h: 56,
          i: 46,
          j: 11,
          k: 56,
          l: 46,
          m: 11,
          n: 55
        },
        {
          a: "国网山西省公司",
          b: 56,
          c: 46,
          d: 11,
          e: 56,
          f: 46,
          g: 11,
          h: 56,
          i: 46,
          j: 11,
          k: 56,
          l: 46,
          m: 11,
          n: 55
        },
      ],
      pieData: [
        { value: 110, name: "燃油费" },
        { value: 120, name: "年检费" },
        { value: 130, name: "清洗费" },
        { value: 140, name: "保险费" },
        { value: 150, name: "修理费" },
        { value: 150, name: "过路过桥费" },
      ],
      pieLegend: {
        top: 8,
        orient: "vertical",
        right: 0,
        itemWidth: 8, // 设置图例标记的宽度
        itemHeight: 8, // 设置图例标记的高度
        textStyle: {
          color: "#FFF",
        },
      },
      pieTitle: {},
      //各类车型
      totalPieData: [
        { value: 110, name: "商务车" },
        { value: 120, name: "越野车" },
        { value: 130, name: "小型客车" },
        { value: 140, name: "大型客车" },
        { value: 150, name: "小轿车" },
      ],
      totalCenter: ["30%", "50%"],
      totalPieLegend: {
        top: 20,
        right: 10,
        itemWidth: 8,
        itemHeight: 8,
        orient: "vertical",
        textStyle: {
          color: "#FFF",
        },
      },
      //车辆类型
      catePieData: [
        { value: 40, name: "新能源汽车" },
        { value: 20, name: "燃油汽车" },
      ],
      catePieLegend: {
        orient: "vertical",
        top: 60,
        right: 23,
        itemWidth: 8, // 设置图例标记的宽度
        itemHeight: 8, // 设置图例标记的高度
        textStyle: {
          color: "#FFF",
        },
      },
      catePieCenter: ["27%", "50%"],
      carTypeBarData: [
        {
          name: "",
          type: "bar",
          itemStyle: {
            color: "#D9821D",
          },
          barWidth: 20,
          data: [110, 120, 130, 140, 150],
        },
      ],
      carTypeBarAxis: {
        type: "category",
        data: ["商务车", "越野车", "小型客车", "大型客车", "小轿车"],
        axisLabel: {
          color: "white", // 设置横坐标轴字体颜色为红色
          rotate: 25,
          interval: 0
        },
        axisTick: {
          show: false,
        },
        axisLine: {
          lineStyle: {
            color: "#FFF",
          },
        },
        splitArea: false,
      },
      carTypeBarYAxis: {
        type: "value",
        boundaryGap: [0, 0.01],
        name: "辆",
        nameTextStyle: {
          color: "#fff",
          padding: [0,30,0,0],
          fontSize: 14,
        },
        axisLine: {
          show: false,
        },
        axisLabel: {
          color: "white", // 设置横坐标轴字体颜色为红色
        },
        splitLine: {
          show: false,
        },
        axisTick: {
          show: false,
        },
        splitArea: false,
      },
      carTypeBarLegend: {
        show: false,
      },
      carTotalData: [
        {
          name: "",
          type: "bar",
          itemStyle: {
            color: "#43DCDB"
          },
          barWidth: 40,
          data: [110, 120, 58, 200],
        },
      ],
      carTotalAxis: {
        type: "category",
        data: ["本部 ", "直属单位", "市公司", "县公司"],
        axisLabel: {
          color: "white" // 设置横坐标轴字体颜色为红色
        },
        axisLine: {
          lineStyle: {
            color: "#FFF",
          },
        },
        axisTick: {
          show: false,
        },
        splitArea: false,
      },
      carTotalYAxis: {
        type: "value",
        boundaryGap: [0, 0.01],
        name: "数量(辆)",
        nameTextStyle: {
          color: "#fff",
          padding: [0,5,0,0],
          fontSize: 14,
        },
        axisLine: {
          lineStyle: {
            color: "#465A64",
          },
        },
        axisLabel: {
          color: "white", // 设置横坐标轴字体颜色为红色
        },
        splitLine: {
          show: false,
        },
        axisTick: {
          show: false,
        },
        splitArea: false,
      },
      carTotalLegend: {
        show: false,
      },
      barGrid: {
        top: 30,
        left: "2%",
        right: "2%",
        containLabel: true,
        bottom: 0,
      },
    };
  },
  created() {},
  destroyed() {},
  beforeDestroy() {},
  mounted() {},
  methods: {

    choose(){
      this.$emit('choose')
    },

     //鼠标移出
     leaveFun(){
      setTimeout(()=>{
        this.$emit("closeDialog")
      },200)
    },

    preventDefault() {
      console.log(11);
    },
  },
};
</script>

<style lang="scss" scoped>
.row{
  flex: 1;  /* 每一列均分可用空间 */
  text-align: left;  /* 左对齐文本 */
}

.flex-container {
  width: 700px;
}

.header{
  display: flex;  /* 每行使用 flexbox 布局 */
  position: relative;
  background-color: rgba(21, 105, 107, 0.5);
}

.flex-row {
  display: flex;  /* 每行使用 flexbox 布局 */
  position: relative;
}

.flex-row::before{
  content: "";
  height: 15px;
  border-left: 2px #00FFFF solid;
  position: absolute;
  left: 0;
  top: 10px
}

.flex-column {
  white-space: nowrap;
  flex: 1;  /* 每列均分可用空间 */
  padding: 8px 12px;
  text-align: left;  /* 左对齐文本 */
  color: white;
}

.header .flex-column {
  color: #00ffff;
}

.car-warning-dialog-area {
  overflow: hidden;
  width: 580px;
  height:920px;
  background: url("../../../assets/images/main/main_bg.png") no-repeat;
  background-size: cover;
  padding: 19px 15px 11px 15px;

  .dialog-title {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 10px;
    img {
      width: 284px;
      height: 32px;
    }
    .title {
      font-size: 20px;
      font-weight: 900;
      font-family: "PingFangSC";
      width: 100%;
      position: absolute;
      display: flex;
      align-items: center;
      justify-content: center;
      top: -5px;
      color: #fff;
    }
  }

  .dialog-cont {
    width:100%;
    height: 850px;
    padding: 15px;
    overflow-y: scroll;
    background: url("../../../assets/images/main/components_long_bg.png") no-repeat;
    background-size: cover;

    .dialog-left {
      width: 520px;
      float: left;
    }
    .dialog-right {
      width: 520px;
      float: right;
    }
  }

  .dialog-list {
    width: 100%;
    display: flex;
    justify-content: space-between !important;
    margin-bottom: 20px;
    display: block;

    .dialog-item {
      width: 100%;
    }

    .dialog-item-cont {
      display: flex;
      justify-content: center;
      align-items: center;
      margin-top: 40px;
    }

    .wid100 {
      width: 100%;

      .content-title {
        width: 100%;
        background: url("../../../assets/images/main/title_pro_long.png") no-repeat;
      }
    }
  }

  .content-title {
    width: 100%;
    height: 26px;
    background: url("../../../assets/images/main/title_pro.png") no-repeat;
    background-size: 100% 100%;
    font-family: "PingFangSC";
    font-size: 16px;
    font-weight: bold;
    color: #00ffff;
    padding-left: 25px;
    .title {
      display: block;
      position: relative;
      top:-5px;
    }
  }

  .content {
    margin-top: 20px;
    .rate-area {
      position: relative;
      img {
        width: 198px;
        height: 114px;
      }
      .rate {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 100%;
        position: absolute;
        top: 0;
        left: 0;
        color: #fff;
        .rate-data {
          display: flex;
          flex-direction: row;
          align-items: baseline;
          color: #ffba44;
          .data {
            font-family: "electronicFont";
            font-size: 30px;
          }
          .unit {
            font-size: 12px;
          }
        }
        .desc {
          font-size: 12px;
          width: 58px;
          text-align: center;
        }
      }
    }
  }

  .content-title {
    width: 230px;
    height: 26px;
    background: url("../../../assets/images/service_new/title_pro.png")
      no-repeat;
    background-size: 100% 100%;
    font-family: "PingFangSC";
    font-size: 16px;
    font-weight: bold;
    color: #00ffff;
    padding-left: 25px;
    .title {
      display: block;
      position: relative;
      top: -3px;
    }
  }
  .content-title.long {
    width: 100%;
    height: 26px;
    background: url("../../../assets/images/service_new/title_pro_long.png")
      no-repeat;
    background-size: 100% 100%;
    font-family: "PingFangSC";
    font-size: 16px;
    font-weight: bold;
    color: #00ffff;
    padding-left: 25px;
    .title {
      display: block;
      position: relative;
      top: -3px;
    }
  }

  .title-format {
    display: flex;
    flex-direction: row;
    align-items: center;
    img {
      width: 6px !important;
      height: 24px !important;
      margin-right: 6px;
    }
    .title-info {
      display: flex;
      flex-direction: column;
      font-size: 14px;
      color: #ffffff;
      .title-en {
        font-size: 8px;
        color: #ffffff;
        opacity: 0.4;
      }
    }
  }

  .content {
    margin-top: 20px;

    .total-data {
      display: flex;
      align-items: baseline;
      color: #19fcde;
      margin-top: 4px;
      .total {
        font-size: 35px;
        font-family: "electronicFont";
      }
      .unit {
        font-size: 12px;
      }
    }

    .rate-area {
      position: relative;
      margin-left: 35px;
      margin-top: 25px;
      img {
        width: 168px;
        height: 97px;
      }
      .rate {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 100%;
        position: absolute;
        top: 0;
        left: -10px;
        color: #fff;
        .rate-data {
          display: flex;
          flex-direction: row;
          align-items: baseline;
          color: #ffba44;
          .data {
            font-size: 30px;
            font-family: "electronicFont";
          }
          .unit {
            font-size: 12px;
          }
        }
        .desc {
          font-size: 12px;
          text-align: center;
        }
      }
    }
    .chart-area {
      margin-top: 50px;
    }
  }

  .other-cont {
    display: flex;

    .icon {
      display: block;
      width: 70px;
      height: auto;
    }
    .other-info {
      padding-left: 2px;

      .desc {
        font-size: 12px;
        color: #ffffff;
        font-weight: bold;
      }
      .num-info {
        width: 100%;
        padding-top: 2px;
        display: flex;
        align-items: center;

        .num {
          font-size: 30px;
          color: #19fcde;
          font-weight: bold;
          font-family: "electronicFont";
        }
        .unit {
          font-size: 12px;
          color: #00ffff;
          font-weight: 500;
          position: relative;
          top: 4px;
        }
        .mar {
          margin-left: 20px;
        }
      }
    }
  }

  .data-list {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 20px 0 20px;
    .data-item {
      display: flex;
      flex-direction: column;
      justify-content: center;
      flex: 1;
      // border-right: 1px solid rgba(25, 252, 222, 0.2);
      .data-detail {
        display: flex;
        flex-direction: row;
        align-items: baseline;
        color: #00ffff;
        margin-top: 11px;
        font-size: 12px;
        .data {
          font-size: 30px;
          font-family: "electronicFont";
        }
      }
    }
    .data-item:last-child {
      border-right: none;
    }
  }

  .mar {
    margin-bottom: 15px;
  }
  .data-left {
    width: auto;

    .data-item {
      width: auto;
      margin-bottom: 23px;

      .data-fir {
        display: flex;
        align-items: center;

        .icon {
          width: 15px;
          height: 15px;
          margin-right: 6px;
        }
        .name {
          font-size: 14px;
          color: #ffffff;
        }
      }
      .data-snd {
        display: flex;
        align-items: center;
        padding-top: 2px;

        .num {
          font-size: 32px;
          color: #00ffff;
          font-family: "electronicFont";
        }
        .unit {
          font-size: 12px;
          color: #00ffff;
          font-weight: 500;
          position: relative;
          top: 5px;
          left: 2px;
        }
      }
    }
  }
  .data-right {
    padding-top: 3px;

    .circle {
      width: 100px;
      height: 100px;
      background: url("../../../assets/images/service_new/circle.png") no-repeat;
      background-size: 100% 100%;
      display: flex;
      justify-content: center;
      align-items: flex-start;

      .value {
        display: flex;
        align-items: center;
        font-size: 32px;
        color: #00ffff;
        font-family: "electronicFont";
        position: relative;
        top: 15px;
      }
      .unit {
        font-size: 12px;
        color: #00ffff;
        font-weight: 500;
        position: relative;
        top: 5px;
        left: 2px;
      }
    }
  }

  .choose-area {
    margin: 20px 0;
    .choose-item {
      width: 104px;
      height: 30px;
      line-height: 30px;
      background: url("../../../assets/images/main/choose_bg.png") no-repeat;
      background-size: 100% 100%;
      margin-right: 16px;
      padding-left: 12px;
      color: #00ffff;
      cursor: pointer;
    }
  }

  .table-cont {
    width: 100%;

    .table-top {
      width: 100%;
      height: 26px;
      background: url("../../../assets/images/building_guarantee/img_11.png")
        no-repeat;
      background-size: 100% 100%;
      padding: 0 25px 0 10px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 12px;
      color: #00ffff;
    }
    .table-bot {
      width: 100%;

      .table-list {
        width: 100%;
        height: 38px;
        padding: 0 25px 0 10px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 12px;
        color: #ffffff;
        font-weight: 500;
      }
    }
  }
  .list-area {
    display: flex;
    flex-direction: column;
    padding: 0px 15px 0;
    .list-item {
      display: flex;
      flex-direction: row;
      align-items: center;
      font-size: 12px;
      color: #ffffff;
      margin-bottom: 10px;
      flex: 1;
      .item-1 {
        width: 8%;
      }
      .item-2 {
        width: 18%;
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
      }
      .item-3 {
        width: 15%;
      }
      .item-4,
      .item-5 {
        width: 13%;
      }
      .item-6,
      .item-7 {
        width: 22%;
      }
    }
    .list-title {
      color: #00ffff !important;
      padding: 4px 0;
      background: url("../../../assets/images/main/title_line.png") no-repeat;
      background-size: 100% 100%;
      margin-bottom: 10px !important;
    }
  }
  .lift-seat{
    width: 244px;
    height: 104px;
    display: flex;
    justify-content: center; /* 水平居中 */
   }
  .car-rite{
    margin-top: 10px;
    margin-left: 10px;
    width: 58px;
    height: 56px;
    img{
      width: 58px;
      height: 56px;
    }

  }
  .content-tenter {
    width: 100%;
    height: 26px;
    background: url("../../../assets/images/main/title_pro.png") no-repeat;
    background-size: 100% 100%;
    font-family: "PingFangSC";
    font-size: 16px;
    font-weight: bold;
    color: #00ffff;
    padding-left: 25px;
    .title {
      display: block;
      position: relative;
      top:-5px;
    }
  }
  .sdient{

    display: flex; /* 使用 Flexbox */
    align-items: center; /* 垂直居中 */
  }
  .num{
    padding-top: 5px;
    font-size: 32px;
    color:#00FFFF;
    font-family: 'electronicFont';
    .nim{
      font-size: 10px;
    }
  }
  .asjdjfkaf{
    width: 100%;
  }
  .table-bot{
    width:100%;

    .table-list{
      width:100%;
      height:30px;
      margin-top: 3px;
      padding:5px 25px 0 10px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size:14px;
      color:#FFFFFF;
      font-weight: 500;
    }
    .table-list:hover{
      cursor: pointer;
    }
  }
  .said{
    width: 1px;
    height: 13px;
    background-color: #00FFFF;
  }
  .table-list{
    width:100%;
    height:30px;
    margin-top: 3px;
    padding:5px 25px 0 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size:14px;
    color:#FFFFFF;
    font-weight: 500;
  }
  .data-left {
    width: auto;

    .data-item {
      width: auto;
      margin-bottom: 23px;

      .data-fir {
        display: flex;
        align-items: center;

        .icon {
          width: 15px;
          height: 15px;
          margin-right: 6px;
        }
        .name {
          font-size: 14px;
          color: #ffffff;
        }
      }
      .data-snd {
        display: flex;
        align-items: center;
        padding-top: 2px;

        .num {
          font-size: 32px;
          color: #00ffff;
          font-family: "electronicFont";
        }
        .unit {
          font-size: 12px;
          color: #00ffff;
          font-weight: 500;
          position: relative;
          top: 5px;
          left: 2px;
        }
      }
    }
  }
  .data-chart {
    margin-top: 12px !important;
    margin-bottom: 10px !important;
  }

  ::-webkit-scrollbar {
    display: none;
    width: 3px;
    height: 3px;
  }

  ::-webkit-scrollbar-thumb {
    //滑块部分
    // border-radius: 5px;
    background-color: #58cbbb;
  }

  ::-webkit-scrollbar-track {
    //轨道部分
    // box-shadow: inset 0 0 5px #ddd;
    background: #ddd;
    // border-radius: 5px;
  }
}
</style>

