<template>
  <div>
    <el-breadcrumb separator="/" class="bread_crumb1">
      <el-breadcrumb-item :to="{ path: '/data_analysis' }">{{
        $t("lang.dataAnalysis")
      }}</el-breadcrumb-item>
      <el-breadcrumb-item>{{
        $t("lang.myServiceDataAnalysis")
      }}</el-breadcrumb-item>
    </el-breadcrumb>
    <el-row class="in_analysis">
      <!-- 可横向铺满 -->
      <el-col :span="6" class="in_left">
        <el-row>
          <el-col :span="24" class="in_block">
            <block-radius
              :show_header="true"
              title="服务总体概况"
              class="block"
            >
              <div class="left_1">
                <div ref="left_1_l" class="left_1_l">
                  <img :src="require('@/assets/imgs/data_img_service.gif')" class="left_1_img" />
                  <div class="left_1_title">服务总数</div>
                  <div class="left_1_num">2222</div>
                </div>
                <dashboard ref="left_1_r" :data="das_data" :is_word="true" class="left_1_r"></dashboard>
              </div>
            </block-radius>
          </el-col>
          <el-col :span="24" class="in_block">
            <block-radius class="block"></block-radius>
          </el-col>
          <el-col :span="24" class="in_block">
            <block-radius
              :show_header="true"
              title="服务类型分析"
              :buttons_arr="['发布的服务', '调用的服务']"
              @changeButton="changeServiceTypeBtn"
              class="block"
            >
              <multiple-circle :data="mult_data" :text="text"></multiple-circle>
            </block-radius>
          </el-col>
          <el-col :span="24" class="in_block">
            <block-radius
              :show_header="true"
              title="服务应用领域统计"
              :buttons_arr="['发布的服务', '调用的服务']"
              @changeButton="changeApplicationFieldBtn"
              class="block"
            >
              <BarChart :data="bar_data" />
            </block-radius>
          </el-col>
        </el-row>
      </el-col>
      <el-col :span="12" class="in_center">
        <el-row>
          <el-col :span="24" class="in_block height_2x">
            <block-radius class="block"></block-radius>
          </el-col>
          <el-col :span="24" class="in_block">
            <block-radius class="block"></block-radius>
          </el-col>
          <el-col :span="24" class="in_block">
            <block-radius class="block">
              <line-chart :data="line_data"></line-chart>
            </block-radius>
          </el-col>
        </el-row>
      </el-col>
      <el-col :span="6" class="in_right">
        <el-row>
          <el-col :span="24" class="in_block">
            <block-radius
              :show_header="true"
              title="服务调用排名分析"
              :buttons_arr="['被调用次数', '被调用次数']"
              @changeButton="changeServeiceApplyCountBtn"
              class="block"
            >
              <toplist
                class="block-radius-content"
                :options="toplistData"
              ></toplist>
            </block-radius>
          </el-col>
          <el-col :span="24" class="in_block">
            <block-radius class="block"></block-radius>
          </el-col>
          <el-col :span="24" class="in_block">
            <block-radius class="block">
              <single-circle :data="single_data"></single-circle>
            </block-radius>
          </el-col>
          <el-col :span="24" class="in_block">
            <block-radius
              :show_header="true"
              title="服务评价及评分"
              :buttons_arr="['服务评价', '服务评分']"
              @changeButton="changeServeiceInfoBtn"
              class="block"
            >
              <commentlist
                v-if="serveiceInfoBtnIndex == 0"
                class="block-radius-content"
                :data="commentlistData"
              ></commentlist>
              <starlist
                v-else
                class="block-radius-content"
                :options="starlistData"
              ></starlist>
            </block-radius>
          </el-col>
        </el-row>
      </el-col>
      <!-- 不可横向铺满，一般为最后一行 -->
      <el-col :span="6" class="in_block">
        <block-radius :show_header="true" title="服务来源机构分析" class="block">
          <BarChart :data="bar_data_org" :colors="['#e56600', '#e56600']" />
        </block-radius>
      </el-col>
      <el-col :span="18" class="in_block default">
        <block-radius class="block">
          <img
            :src="require('@/assets/imgs/data_img_default.gif')"
            class="default_img"
          />
        </block-radius>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import BlockRadius from "@/components/general/block-radius";
import Dashboard from "@/components/e-charts/dashboard";
import multipleCircle from "@/components/e-charts/multiple_circle";
import singleCircle from "@/components/e-charts/single_circle";
import lineChart from "@/components/e-charts/line_chart";
import Toplist from "@/components/e-charts/toplist";
import Starlist from "@/components/e-charts/starlist";
import commentlist from "@/components/e-charts/commentlist";
import BarChart from "@/components/e-charts/bar-chart";
export default {
  components: {
    BlockRadius,
    Dashboard,
    multipleCircle,
    singleCircle,
    Toplist,
    commentlist,
    Starlist,
    lineChart,
    BarChart,
  },
  data: () => ({
    navList: [],
    mult_data: [
      { name: "基础工具", value: 40 },
      { name: "通用应用", value: 0 },
      { name: "业务应用", value: 2 },
    ],
    text: "应用总数",
    single_data: {
      num: 12,
      color: "#515fe7",
      text: "共享",
    },
    line_data: {
      xaxis: [
        "01-01",
        "01-02",
        "01-03",
        "01-04",
        "01-05",
        "01-06",
        "01-07",
        "01-08",
      ],
      data: [
        {
          name: "开发者应用",
          arr: [100, 120, 130, 150, 160, 120, 110, 100],
        },
        {
          name: "平台应用",
          arr: [120, 130, 140, 130, 140, 120, 100, 90],
        },
        {
          name: "未上架",
          arr: [80, 90, 100, 110, 100, 70, 80, 90],
        },
      ],
    },
    das_data: {
      data: 40,
      text: "健康占比"
    },
    bar_data: {
      xaxis: [
        "01-01",
        "01-02",
        "01-03",
        "01-04",
        "01-05",
        "01-06",
        "01-07",
        "01-08",
      ],
      data: [100, 120, 130, 150, 160, 120, 110, 100]
    },
    bar_data_org: {
      xaxis: [
        "01-01",
        "01-02",
        "01-03",
        "01-04",
        "01-05",
        "01-06",
        "01-07",
        "01-08"
      ],
      data: [100, 120, 130, 150, 160, 120, 110, 100]
    },
    toplistData: [
      {
        name: "报警服务",
        value: 2031,
        logo:
          "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
        unit: "次",
      },
      {
        name: "数据服务",
        value: 2201,
        logo:
          "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
        unit: "次",
      },
      {
        name: "消息队列服务",
        value: 1901,
        logo:
          "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
        unit: "次",
      },
      {
        name: "档案中心服务",
        value: 1400,
        logo:
          "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
        unit: "次",
      },
      {
        name: "哈哈服务",
        value: 1280,
        logo:
          "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
        unit: "次",
      },
    ], // 服务调用排名分析
    serveiceInfoBtnIndex: 0,
    commentlistData: [
      {
        add_time: "2020-07-14T16:35:40Z",
        content: "1111111111111111",
        id: 36,
        picture_path:
          "/apaas/static/docs/image/image/blob_cb30e7a3-3184-42dd-9e2f-7e6b69accb0c.blob",
        score: 5,
        service_id: 128,
        user_name: "普通用户lxy",
      },
      {
        add_time: "2020-07-14T16:35:40Z",
        content: "1111111111111111",
        id: 36,
        picture_path:
          "/apaas/static/docs/image/image/blob_cb30e7a3-3184-42dd-9e2f-7e6b69accb0c.blob",
        score: 4,
        service_id: 128,
        user_name: "普通用户lxy",
      },
      {
        add_time: "2020-07-14T16:35:40Z",
        content: "1111111111111111",
        id: 36,
        picture_path:
          "/apaas/static/docs/image/image/blob_cb30e7a3-3184-42dd-9e2f-7e6b69accb0c.blob",
        score: 3,
        service_id: 128,
        user_name: "普通用户lxy",
      },
      {
        add_time: "2020-07-14T16:35:40Z",
        content: "1111111111111111",
        id: 36,
        picture_path:
          "/apaas/static/docs/image/image/blob_cb30e7a3-3184-42dd-9e2f-7e6b69accb0c.blob",
        score: 2,
        service_id: 128,
        user_name: "普通用户lxy",
      },
    ], // 服务评价
    starlistData: [
      {
        star: 5,
        count: 5,
        unit: "个",
      },
      {
        star: 4,
        count: 4,
        unit: "个",
      },
      {
        star: 3,
        count: 3,
        unit: "个",
      },
      {
        star: 2,
        count: 10002,
        unit: "个",
      },
      {
        star: 1,
        count: 1,
        unit: "个",
      },
    ], // 服务评分
  }),
  mounted() {},
  methods: {
    changeServiceTypeBtn(index) {
      console.log(index);
    },
    changeApplicationFieldBtn(index) {
      console.log(index);
    },
    changeServeiceApplyCountBtn(index) {
      console.log(index);
    }, // 服务调用排名分析
    changeServeiceInfoBtn(index) {
      this.serveiceInfoBtnIndex = index;

      console.log(index);
    }, // 服务评价及评分
  },
};
</script>
<style scoped>
.in_analysis {
  padding: 0 10px 10px;
  height: 100%;
  width: 100%;
  min-width: 1700px;
}
.in_l {
}
.in_r {
}
.in_c {
}
.in_block {
  height: 280px;
  padding: 10px;
}
.height_2x {
  height: 560px;
}
.block {
  width: 100%;
  height: 100%;
}
.left_1 {
  height: 100%;
  display: flex;
  justify-content: space-between;
}
.left_1_l {
  width: 40%;
  height: 100%;
  display: inline-block;
  padding: 20px 0 0 0;
}
.left_1_title {
  width: 100%;
  text-align: center;
}
.left_1_num {
  font-size: 32px;
  color: #515fe7;
  width: 100%;
  text-align: center;
}
.left_1_img {
  width: 120px;
  display: block;
  margin: 0 auto;
}
.left_1_r {
  width: 50%;
  height: 100%;
  display: inline-block;
}
.default {
  text-align: center;
}
.default_img {
  width: 330px;
  height: 230px;
}
.block-radius-content {
  height: calc(100% - 36px);
  margin-top: 15px;
}
</style>
