diff --git a/resources/views/admin/home.blade.php b/resources/views/admin/home.blade.php index ab8e000..09c26d9 100644 --- a/resources/views/admin/home.blade.php +++ b/resources/views/admin/home.blade.php @@ -212,6 +212,18 @@ .card1-body:has(#bar-chart) { height: calc(100% - 39px); } + .content:has(.type-switch .type-switch__item input:nth-child(1):checked) #bar-chart { + display: block !important; + } + .content:has(.type-switch .type-switch__item input:nth-child(1):checked) #bar-chart1 { + display: none !important; + } + .content:has(.type-switch .type-switch__item input:nth-child(2):checked) #bar-chart { + display: none !important; + } + .content:has(.type-switch .type-switch__item input:nth-child(2):checked) #bar-chart1 { + display: block !important; + } .hospital-select { padding: 0 6px; @@ -325,6 +337,7 @@
+
@@ -412,6 +425,34 @@ title: { text: '销售额趋势' }, + tooltip: {}, + legend: { + data: ['销量'] + }, + xAxis: { + data: saleList.map(function (item) { + return item.month + }) + }, + yAxis: {}, + series: [ + { + name: '销量', + type: 'bar', + data: saleList.map(function (item) { + return item.total + }) + } + ] + } + barChart.setOption(option) + + + var barChart1 = echarts.init(document.querySelector("#bar-chart1")); + var option1 = { + title: { + text: '订单量趋势' + }, // grid: { // top: "10%", // left: "15%", @@ -420,21 +461,25 @@ // }, tooltip: {}, legend: { - data: ['销量'] + data: ['订单'] }, xAxis: { - data: ['10月', '11月', '12月', '01月', '02月', '03月'] + data: orderList.map(function (item) { + return item.month + }) }, yAxis: {}, series: [ { - name: '销量', + name: '订单', type: 'bar', - data: [5, 20, 36, 10, 10, 20] + data: orderList.map(function (item) { + return item.total + }) } ] } - barChart.setOption(option) + barChart1.setOption(option1) } (function () { initPieChart()