he wei
2025-05-14 c8593971decbd850bcd5b7014d5595e80035a3fc
src/views/home/components/SubwayView.vue
@@ -23,6 +23,7 @@
  },
  data() {
    return {
      selected: {},
      jsonData: {},
    }
  },
@@ -62,8 +63,10 @@
      const { l } = this.jsonData;
      let stationList = this.lineList;
      const subwayList = l.filter((item) => {
        return stationList.includes(item.ln);
        return stationList.includes(item.ln) && this.selected[item.ln] !== false;
      });
      // console.log('subwayList', subwayList, '=============');
      // 站点状态
      let statusList = this.status;
@@ -95,6 +98,7 @@
      for (let i = 0; i < subwayList.length; i++) {
        const { cl, st, ln, x } = subwayList[i];
        let lineNum = x;
        const categoryIdx = this.lineList.indexOf(ln);
        for (let k = 0; k < st.length; k++) {
          const { n, p, lg } = st[k];
          const point = p.split(" ");
@@ -104,7 +108,6 @@
          list.y.push(y);
          if (!list.names.includes(n)) {
            list.names.push(n);
            const names = n.split("");
            let p = "";
            let offset = [0, 0];
            if (position[lg] === "topLeft") {
@@ -126,7 +129,7 @@
            let status = stations.length ? stations[0].note == 1 : false;
            list.nodes.push({
              category: i,
              category: categoryIdx,
              name: n,
              x,
              status,
@@ -158,10 +161,13 @@
        min: Math.min(...list.y),
        max: Math.max(...list.y),
      };
      // console.log('list', list, '=============');
      return list;
    },
    async updateMap() {
      let metroData = await this.getSubwayJson();
      const { l } = this.jsonData;
      
      const option = {
@@ -228,6 +234,10 @@
    this.updateMap();
    myChart.on('legendselectchanged', (param) => {
      // console.log('param', param.selected, '=============');
      this.selected = param.selected;
      this.updateMap();
      this.$emit('legend-change', param.selected);
    });
  },