console.html 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <!DOCTYPE html>
  2. <head>
  3. <meta charset="utf-8">
  4. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="keywords" content="">
  7. <meta name="description" content="">
  8. <title text="登录"></title>
  9. <link rel="stylesheet" href="../../component/pear/css/pear.css">
  10. <link rel="stylesheet" href="../../admin/css/other/console1.css"/>
  11. </head>
  12. <body class="pear-container">
  13. <div>
  14. <div class="layui-row layui-col-space10 ">
  15. <div class="layui-col-xs6 layui-col-md3" style="width: 33.3%!important;">
  16. <div class="layui-card top-panel">
  17. <div class="layui-card-header">区县数量</div>
  18. <div class="layui-card-body">
  19. <div class="layui-row layui-col-space5">
  20. <div class="layui-col-xs8 layui-col-md8 top-panel-number" style="color: #28333E;" id="value1">
  21. 0
  22. </div>
  23. <div class="layui-col-xs4 layui-col-md4 top-panel-tips">
  24. <i class="layui-icon layui-icon-cols"></i>
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. </div>
  30. <div class="layui-col-xs6 layui-col-md3" style="width: 33.3%!important;">
  31. <div class="layui-card top-panel">
  32. <div class="layui-card-header">中介机构</div>
  33. <div class="layui-card-body">
  34. <div class="layui-row layui-col-space5">
  35. <div class="layui-col-xs8 layui-col-md8 top-panel-number" style="color: #28333E;" id="value2">
  36. 0
  37. </div>
  38. <div class="layui-col-xs4 layui-col-md4 top-panel-tips">
  39. <i class="layui-icon layui-icon-user"></i>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. <div class="layui-col-xs6 layui-col-md3" style="width: 33.3%!important;">
  46. <div class="layui-card top-panel">
  47. <div class="layui-card-header">上报条数</div>
  48. <div class="layui-card-body">
  49. <div class="layui-row layui-col-space5">
  50. <div class="layui-col-xs8 layui-col-md8 top-panel-number" style="color: #28333E;" id="value3">
  51. 0
  52. </div>
  53. <div class="layui-col-xs4 layui-col-md4 top-panel-tips">
  54. <i class="layui-icon layui-icon-slider"></i>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. <div class="layui-row layui-col-space10">
  62. <div class="layui-card">
  63. <div class="layui-card-body">
  64. <div class="layui-tab custom-tab layui-tab-brief" lay-filter="docDemoTabBrief">
  65. <div id="echarts-records" style="background-color:#ffffff;min-height:400px;padding: 10px"></div>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. <script src="../../component/layui/layui.js"></script>
  72. <script src="../../component/pear/pear.js"></script>
  73. <script src="../../component/js/jquery.min.js"></script>
  74. <script>
  75. layui.use(['request','layer', 'echarts', 'element', 'count', 'topBar','popup'], function () {
  76. let count = layui.count,
  77. request = layui.request,
  78. popup = layui.popup,
  79. echarts = layui.echarts;
  80. layer.ready(function () {
  81. var loading = layer.load(2, { shade: [0.3, '#333'] });
  82. request.httpGet("/business/data/v1/count", function (res) {
  83. layer.close(loading);
  84. if (res.success) {
  85. count.up("value1", {
  86. time: 4000,
  87. num: 11,
  88. bit: 0,
  89. regulator: 50
  90. })
  91. count.up("value2", {
  92. time: 4000,
  93. num: res.data.saleNumber,
  94. bit: 0,
  95. regulator: 50
  96. })
  97. count.up("value3", {
  98. time: 4000,
  99. num: res.data.otherSaleNumber,
  100. bit: 0,
  101. regulator: 50
  102. })
  103. const districts = ["张店区", "博山区", "淄川区", "周村区", "临淄区", "桓台县", "高青县", "沂源县", "高新区", "经开区", "文昌湖区"];
  104. // 创建一个映射表,将区名映射到对应的销售数量
  105. const saleMap = res.data.dataCountList.reduce((map, item) => {
  106. map[item.districtName] = item.saleNumber;
  107. return map;
  108. }, {});
  109. // 生成新的数组,包含每个区县的销售数量,没有的区县填0
  110. const result = districts.map(district => {
  111. return saleMap[district] || 0;
  112. });
  113. // 初始化 ECharts 实例
  114. var echartsRecords = echarts.init(document.getElementById('echarts-records'), 'walden');
  115. // 设置图表的配置项和数据
  116. var option = {
  117. title: {
  118. text: '各区县上报数量统计',
  119. left: 'center',
  120. textStyle: {
  121. fontSize: 18,
  122. color: '#333'
  123. }
  124. },
  125. tooltip: {
  126. trigger: 'axis',
  127. axisPointer: {
  128. type: 'shadow'
  129. }
  130. },
  131. legend: {
  132. data: ['上报数量'],
  133. right: '10%',
  134. top: '10',
  135. textStyle: {
  136. color: '#666'
  137. }
  138. },
  139. grid: {
  140. left: '3%',
  141. right: '4%',
  142. bottom: '3%',
  143. containLabel: true
  144. },
  145. xAxis: [{
  146. type: 'category',
  147. data: districts,
  148. axisLine: {
  149. lineStyle: {
  150. color: '#999'
  151. }
  152. },
  153. axisLabel: {
  154. color: '#666',
  155. interval: 0,
  156. rotate: 0
  157. },
  158. axisTick: {
  159. show: false
  160. }
  161. }],
  162. yAxis: [{
  163. type: 'value',
  164. splitNumber: 4,
  165. splitLine: {
  166. lineStyle: {
  167. type: 'dashed',
  168. color: '#DDD'
  169. }
  170. },
  171. axisLine: {
  172. show: false,
  173. lineStyle: {
  174. color: '#333'
  175. }
  176. },
  177. nameTextStyle: {
  178. color: '#999'
  179. },
  180. splitArea: {
  181. show: false
  182. },
  183. axisLabel: {
  184. color: '#666'
  185. }
  186. }],
  187. series: [{
  188. name: '上报数量',
  189. type: 'bar',
  190. data: result,
  191. barWidth: '60%',
  192. itemStyle: {
  193. color: new echarts.graphic.LinearGradient(
  194. 0, 0, 0, 1,
  195. [
  196. { offset: 0, color: '#8bc9f8' }, // 0% 处的颜色
  197. { offset: 1, color: '#457fea' } // 100% 处的颜色
  198. ]
  199. )
  200. }
  201. }]
  202. };
  203. // 使用刚指定的配置项和数据显示图表
  204. echartsRecords.setOption(option);
  205. // 监听窗口大小变化,自动调整图表大小
  206. window.onresize = function () {
  207. echartsRecords.resize();
  208. };
  209. } else {
  210. popup.failure(res.msg);
  211. }
  212. });
  213. });
  214. });
  215. </script>
  216. </body>
  217. </html>