wwl
2025-02-15 5b4e348267b5541d54fffcc75c7b307ad514a692
src/views/index.vue
@@ -92,34 +92,49 @@
 
    getList() {
      this.loading = true;
      // 查询今日登记
      getCustomer().then((response) => {
        this.Customer = response
        this.loading = false;
      });
      // 查询今日已检
      getOrder().then((response) => {
        this.Order = response
        this.loading = false;
      });
      // 查询今日报告
      getReportToday().then((response) => {
        this.ReportToday = response
        this.loading = false;
      });
      // 查询今日待检
      getTobeToday().then((response) => {
        this.TobeToday = response
        this.loading = false;
      });
      // 折线图
      getChart().then((response) => {
        response.data.forEach(item => {
          this.LineChart.push(item.date)
          this.reportNum.push(item.tdcoun);
          this.personYYNum.push(item.grcoun);
          this.teamYYNum.push(item.bgcoun);
      // 修改API调用的错误处理
      getCustomer().then((response) => {
        this.Customer = response || 0;  // 添加默认值
      }).catch(error => {
        console.error('获取今日登记数据失败:', error);
        this.Customer = 0;
      });
      getOrder().then((response) => {
        this.Order = response || 0;
      }).catch(error => {
        console.error('获取今日已检数据失败:', error);
        this.Order = 0;
      });
      getReportToday().then((response) => {
        this.ReportToday = response || 0;
      }).catch(error => {
        console.error('获取今日报告数据失败:', error);
        this.ReportToday = 0;
      });
      getTobeToday().then((response) => {
        this.TobeToday = response || 0;
      }).catch(error => {
        console.error('获取今日待检数据失败:', error);
        this.TobeToday = 0;
      });
      // 修改折线图数据处理
      getChart().then((response) => {
        if (response && response.data) {
          this.LineChart = [];
          this.reportNum = [];
          this.personYYNum = [];
          this.teamYYNum = [];
          response.data.forEach(item => {
            this.LineChart.push(item.date);
            this.reportNum.push(item.tdcoun || 0);
            this.personYYNum.push(item.grcoun || 0);
            this.teamYYNum.push(item.bgcoun || 0);
        });
        let myChart = this.$echarts.init(document.getElementById('main'));
@@ -189,6 +204,9 @@
        window.addEventListener("resize", sizeFun)
        this.loading = false;
        }
      }).catch(error => {
        console.error('获取图表数据失败:', error);
      });
      // 饼状图