| | |
| | | |
| | | getList() { |
| | | this.loading = true; |
| | | // 查询今日登记 |
| | | |
| | | // 修改API调用的错误处理 |
| | | getCustomer().then((response) => { |
| | | this.Customer = response |
| | | this.loading = false; |
| | | this.Customer = response || 0; // 添加默认值 |
| | | }).catch(error => { |
| | | console.error('获取今日登记数据失败:', error); |
| | | this.Customer = 0; |
| | | }); |
| | | // 查询今日已检 |
| | | |
| | | getOrder().then((response) => { |
| | | this.Order = response |
| | | this.loading = false; |
| | | this.Order = response || 0; |
| | | }).catch(error => { |
| | | console.error('获取今日已检数据失败:', error); |
| | | this.Order = 0; |
| | | }); |
| | | // 查询今日报告 |
| | | |
| | | getReportToday().then((response) => { |
| | | this.ReportToday = response |
| | | this.loading = false; |
| | | this.ReportToday = response || 0; |
| | | }).catch(error => { |
| | | console.error('获取今日报告数据失败:', error); |
| | | this.ReportToday = 0; |
| | | }); |
| | | // 查询今日待检 |
| | | |
| | | getTobeToday().then((response) => { |
| | | this.TobeToday = response |
| | | this.loading = false; |
| | | this.TobeToday = response || 0; |
| | | }).catch(error => { |
| | | console.error('获取今日待检数据失败:', error); |
| | | this.TobeToday = 0; |
| | | }); |
| | | // 折线图 |
| | | |
| | | // 修改折线图数据处理 |
| | | 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); |
| | | 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')); |
| | | |
| | | }); |
| | | let myChart = this.$echarts.init(document.getElementById('main')); |
| | | |
| | | myChart.setOption({ |
| | | tooltip: { |
| | | trigger: 'axis' |
| | | }, |
| | | legend: { |
| | | data: ['每日体检登记数', '每日团体登记数', '每日发布报告数'] |
| | | }, |
| | | grid: { |
| | | left: '3%', |
| | | right: '4%', |
| | | bottom: '3%', |
| | | containLabel: true |
| | | }, |
| | | toolbox: { |
| | | feature: { |
| | | saveAsImage: {} |
| | | } |
| | | }, |
| | | xAxis: { |
| | | type: 'category', |
| | | boundaryGap: false, |
| | | axisLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | color: "blue", |
| | | size: 12, |
| | | width: 0, |
| | | tyle: "solid" |
| | | myChart.setOption({ |
| | | tooltip: { |
| | | trigger: 'axis' |
| | | }, |
| | | legend: { |
| | | data: ['每日体检登记数', '每日团体登记数', '每日发布报告数'] |
| | | }, |
| | | grid: { |
| | | left: '3%', |
| | | right: '4%', |
| | | bottom: '3%', |
| | | containLabel: true |
| | | }, |
| | | toolbox: { |
| | | feature: { |
| | | saveAsImage: {} |
| | | } |
| | | }, |
| | | data: this.LineChart |
| | | }, |
| | | yAxis: { |
| | | type: 'value', |
| | | min: 0, |
| | | max: 100, |
| | | interval: 5 |
| | | }, |
| | | series: [ |
| | | { |
| | | name: '每日体检登记数', |
| | | type: 'line', |
| | | stack: 'Total', |
| | | data: this.personYYNum |
| | | xAxis: { |
| | | type: 'category', |
| | | boundaryGap: false, |
| | | axisLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | color: "blue", |
| | | size: 12, |
| | | width: 0, |
| | | tyle: "solid" |
| | | } |
| | | }, |
| | | data: this.LineChart |
| | | }, |
| | | { |
| | | name: '每日团体登记数', |
| | | type: 'line', |
| | | stack: 'Total', |
| | | data: this.reportNum |
| | | yAxis: { |
| | | type: 'value', |
| | | min: 0, |
| | | max: 100, |
| | | interval: 5 |
| | | }, |
| | | { |
| | | name: '每日发布报告数', |
| | | type: 'line', |
| | | stack: 'Total', |
| | | data: this.teamYYNum |
| | | }, |
| | | ] |
| | | series: [ |
| | | { |
| | | name: '每日体检登记数', |
| | | type: 'line', |
| | | stack: 'Total', |
| | | data: this.personYYNum |
| | | }, |
| | | { |
| | | name: '每日团体登记数', |
| | | type: 'line', |
| | | stack: 'Total', |
| | | data: this.reportNum |
| | | }, |
| | | { |
| | | name: '每日发布报告数', |
| | | type: 'line', |
| | | stack: 'Total', |
| | | data: this.teamYYNum |
| | | }, |
| | | ] |
| | | |
| | | }) |
| | | let sizeFun = ()=> { |
| | | myChart.resize() |
| | | }) |
| | | let sizeFun = ()=> { |
| | | myChart.resize() |
| | | } |
| | | window.addEventListener("resize", sizeFun) |
| | | |
| | | this.loading = false; |
| | | } |
| | | window.addEventListener("resize", sizeFun) |
| | | |
| | | this.loading = false; |
| | | }).catch(error => { |
| | | console.error('获取图表数据失败:', error); |
| | | }); |
| | | |
| | | // 饼状图 |