管道基础大数据平台系统开发-【前端】-新系統界面
surprise
2024-05-09 e897fc3d35f8e5dfa56d5f0c80a655ccf99202cf
src/components/chart/FileFormat.vue
@@ -1,15 +1,30 @@
<template>
  <div class="file-format" ref="chart"></div>
  <div class="FileFormat" ref="chart"></div>
</template>
<script>
import * as echarts from "echarts"
import { countFileFormat } from "@/api/screen.js"
import { countFileFormat, countProjectType } from "@/api/screen.js"
export default {
  props: {
    params: {
      type: Object,
      default: () => null,
    },
  },
  data() {
    return {
      option: {},
    }
  },
  watch: {
    params : {
      deep: true,
      immediate: true,
      handler(newVal) {
        this.initChart()
      },
    },
  },
  mounted() {
    this.initChart()
@@ -58,17 +73,17 @@
          value: 20,
        },
      ]
      const res = await countFileFormat()
      const res = await countProjectType(this.params)
      if (res.code == 200) {
        data = res.result.map(item => {
          return {
            name: item.type,
            value: item.count,
            value: item.number,
          }
        })
      }
      data.sort((a, b) => b.value - a.value)
      data = data.slice(0, 10)
      data = data.slice(0, 4)
      let getArrByKey = (data, k) => {
        let key = k || "value"
        let res = []
@@ -99,8 +114,8 @@
      let option = {
        backgroundColor: "transparent",
        grid: {
          top: "2%",
          bottom: "2%",
          top: "10%",
          bottom: "10%",
          right: "5%",
          left: "10%",
          containLabel: true,
@@ -245,8 +260,8 @@
</script>
<style lang="less" scoped>
.file-format {
.FileFormat {
  width: 100%;
  height: 100%;
  height: calc(100% - 40px);
}
</style>