管道基础大数据平台系统开发-【前端】-新系統界面
TreeWish
2023-02-28 234409bb4a612c5b69b78b1e844492f0a7122521
src/components/chart/BaseLineChart.vue
@@ -8,6 +8,10 @@
  countCountryDimension,
  countProvinceDimension,
  GetServicesVisitsCount,
  countZhPipeMapLength,
  countLargeCategories,
  countProjectType,
  countProjectDown
} from "@/api/screen.js"
export default {
  props: {
@@ -34,6 +38,18 @@
    project: {
      type: String,
      default: "全国项目",
    },
    params: {
      type: Object,
      default: () => null,
    },
    project: {
      type: String,
      default: "全国项目",
    },
    title: {
      type: String,
      default: "",
    },
  },
  data() {
@@ -66,10 +82,10 @@
        },
        grid: {
          right: "5%",
          top: '10%',
          top: "10%",
          left: "5%",
          bottom: "17%",
          containLabel: true
          containLabel: true,
        },
        xAxis: {
@@ -79,9 +95,11 @@
            lineStyle: {
              color: "#fff",
            },
            show: false,
          },
          nameRotate: 45,
          axisTick: {
            show: false,
            alignWithLabel: true,
          },
          axisLabel: {
@@ -114,7 +132,7 @@
        },
        series: [
          {
            name: "服务访问次数",
            name: this.title,
            type: "line",
            showAllSymbol: false,
            lineStyle: {
@@ -141,26 +159,35 @@
    },
    project: {
      deep: true,
      immediate: true,
      handler(newVal) {
        let requsetFn = null
        switch (newVal) {
          case "全球项目":
            requsetFn = countCountryDimension
            requsetFn = countLargeCategories
            break
          case "全国项目":
            requsetFn = countProvinceDimension
            requsetFn = countLargeCategories
            break
          case "全球管网图":
            requsetFn = countZhPipeMapLength
            break
          case "全国管网图":
            requsetFn = countZhPipeMapLength
            break
          default:
            requsetFn = GetServicesVisitsCount
            break
        }
        this.initData(requsetFn)
        requsetFn && this.initData(requsetFn)
        this.setOptions(this.option)
      },
    },
  },
  mounted() {
    this.initData()
    // this.initData()
    this.initChart()
    if (this.autoResize) {
      window.addEventListener("resize", this.resizeHandler)
@@ -178,7 +205,7 @@
  },
  methods: {
    resizeHandler() {
      this.chart.resize()
      this.chart && this.chart.resize()
    },
    initChart() {
      this.chart = echarts.init(this.$refs.chart, "", {
@@ -204,7 +231,7 @@
      this.chart && this.chart.clear()
    },
    async initData(requsetFn = GetServicesVisitsCount) {
      const res = await requsetFn()
      const res = await requsetFn(this.params)
      if (res.code == 200) {
        this.dataList = res.result
        console.log("requsetFn", res)