1
huanghongfeng
2 天以前 a34059e688e947a2ea079a0646872f1a21089940
ÏîÄ¿´úÂë/DP/src/views/indexs/station-one.vue
@@ -27,8 +27,8 @@
export default {
  data() {
    return {
      statusTypes: ['有货', '空货位', '有货禁用', '锁定'], // è¡¨å¤´çŠ¶æ€ç±»åž‹
      statusCounts: [0, 0, 0,0] // å¯¹åº”状态的数量
      statusTypes: ['有货', '空货位'], // è¡¨å¤´çŠ¶æ€ç±»åž‹
      statusCounts: [0, 0] // å¯¹åº”状态的数量
    };
  },
  created() {
@@ -36,15 +36,16 @@
  },
  methods: {
    fetchData() {
      axios.post("http://127.0.0.1:5000/api/LocationInfo/LocationStatus", null)
      axios.post("http://172.21.1.139:5000/api/LocationInfo/LocationStatuskt", null)
        .then((response) => {
          // å‡è®¾API返回的数据格式为:[{status: '有货', count: 9}, {status: '空货位', count: 2}, ...]
          const newCounts = [0, 0, 0,0];
          const newCounts = [0, 0];
          console.log(response.data)
          newCounts[0] = response.data.data[0].count;
          newCounts[1] = response.data.data[1].count;
          newCounts[2] = response.data.data[2].count;
          newCounts[3] = response.data.data[3].count;
          newCounts[1] = response.data.data[1].count+response.data.data[2].count+response.data.data[3].count;
          // newCounts[2] = response.data.data[2].count;
          // newCounts[3] = response.data.data[3].count;
          this.statusCounts = newCounts;
        })