home.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <!DOCTYPE html>
  2. <html style="height: 100%;">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>首页</title>
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  8. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  9. <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
  10. <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
  11. <style>
  12. .topPart{
  13. display: flex;
  14. justify-content: space-between;
  15. flex-direction: row;
  16. flex-wrap: wrap;
  17. padding: 0 20px;
  18. background: #ffffff;
  19. }
  20. .dayAmount{
  21. width: 31%;
  22. margin: 10px 0;
  23. padding: 20px 0 20px 10px;
  24. background: #ff6600;
  25. }
  26. .monthAmount{
  27. width: 31%;
  28. margin: 10px 0;
  29. padding: 20px 0 20px 10px;
  30. background: #1abc9b;
  31. }
  32. .yearAmount{
  33. width: 31%;
  34. padding: 20px 0 20px 10px;
  35. margin: 10px 0;
  36. background: #1e9eb3;
  37. }
  38. .dayCount{
  39. width: 31%;
  40. padding: 20px 0 20px 10px;
  41. margin: 10px 0;
  42. background: #ee7c5c;
  43. }
  44. .monthCount{
  45. width: 31%;
  46. padding: 20px 0 20px 10px;
  47. margin: 10px 0;
  48. background: #ff9900;
  49. }
  50. .yearCount{
  51. width: 31%;
  52. padding: 20px 0 20px 10px;
  53. margin: 10px 0;
  54. background: #2ec7c9;
  55. }
  56. h4{
  57. margin-top: 5px;
  58. color: #ffffff;
  59. }
  60. cite{
  61. color: #ffffff;
  62. font-size: 30px;
  63. }
  64. .layui-card-header{
  65. padding-left: 20px;
  66. color: #000;
  67. font-size: 18px;
  68. }
  69. </style>
  70. </head>
  71. <body>
  72. <div class="layui-fluid">
  73. <div class="layui-row layui-col-space15">
  74. <div class="layui-col-md12">
  75. <div class="layui-row layui-col-space15">
  76. <!-- 统计数据 -->
  77. <div class="layui-col-md12">
  78. <div class="layui-card">
  79. <div class="layui-card-header">数据概览</div>
  80. <ul class="layui-col-md12 topPart">
  81. <li class="dayAmount">
  82. <p><cite id="today_report">10</cite></p>
  83. <h4>今日新增报备</h4>
  84. </li>
  85. <li class="monthAmount">
  86. <p><cite id="mouth_report">10</cite></p>
  87. <h4>本月新增报备</h4>
  88. </li>
  89. <li class="yearAmount">
  90. <p><cite id="general_report">10</cite></p>
  91. <h4>总报备</h4>
  92. </li>
  93. </ul>
  94. </div>
  95. </div>
  96. <!-- 统计图表 -->
  97. <div class="layui-col-md8">
  98. <div style="padding-top: 20px" class="layui-card">
  99. <div id="chart1" style="height:400px;"></div>
  100. </div>
  101. </div>
  102. <div class="layui-col-md4">
  103. <div style="padding-top: 20px" class="layui-card">
  104. <div id="chart2" style="height:400px"></div>
  105. </div>
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. <script src="../../layuiadmin/layui/layui.js?t=1"></script>
  112. <script>
  113. layui.config({
  114. base: '../../layuiadmin/' //静态资源所在路径
  115. }).extend({
  116. index: 'lib/index', //主入口模块
  117. }).use(['index', 'home','echarts'], function() {
  118. var $ = layui.$
  119. ,admin = layui.admin
  120. ,echarts = layui.echarts
  121. ,xData = [];
  122. var chart1 = echarts.init($('#chart1')[0]);
  123. var chart2 = echarts.init($('#chart2')[0]);
  124. //echarts容器自适应大小
  125. var setContain = () => {
  126. var chartDom1 = document.getElementById("chart1");
  127. var chartDom2 = document.getElementById("chart2");
  128. var md8Dom = $(".layui-col-md8");
  129. var md4Dom = $(".layui-col-md4");
  130. chartDom1.style.width = md8Dom.clientWidth + 'px';
  131. chartDom1.style.height = md8Dom.clientHeight + 'px';
  132. chartDom2.style.width = md4Dom.clientWidth + 'px';
  133. chartDom2.style.height = md4Dom.clientHeight + 'px';
  134. };
  135. // 设置echarts的容器大小
  136. setContain();
  137. admin.req({
  138. url: '/account/statistics/'
  139. ,type: 'get'
  140. , done: function (res) {
  141. $('#today_report').html(res.data.today_report);
  142. $('#mouth_report').html(res.data.mouth_report);
  143. $('#general_report').html(res.data.general_report);
  144. }
  145. });
  146. //设置饼图数据
  147. // admin.req({
  148. // url: '/tenant/repair_order/statistics/repair_type/'
  149. // ,type: 'get'
  150. // , done: function (res) {
  151. // if(res.data && res.data.length > 0){
  152. // res.data.forEach(item=>{
  153. // xData.push(item.name)
  154. // })
  155. // }
  156. // var option2 = {
  157. // title: {
  158. // text: '报修类型占比',
  159. // x: 'center' //标题居中
  160. // },
  161. // tooltip: {
  162. // // trigger: 'item' //悬浮显示对比
  163. // },
  164. // legend: {
  165. // orient: 'vertical', //类型垂直,默认水平
  166. // x:'left', //可设定图例在左、右、居中
  167. // y:'top', //可设定图例在上、下、居中
  168. // padding:[5,0,0,20],
  169. // data: xData
  170. // },
  171. // series: [{
  172. // type: 'pie', //饼状
  173. // radius: '60%', //圆的大小
  174. // center: ['50%', '50%'], //居中
  175. // data: res.data
  176. // }]
  177. // };
  178. // chart2.setOption(option2);
  179. // }
  180. // });
  181. // 柱状图和折线图
  182. // admin.req({
  183. // url: "/tenant/repair_order/statistics/repair_order/"
  184. // ,type: 'get'
  185. // , done: function (res) {
  186. // var option1 = {
  187. // title: {
  188. // text: '报修趋势统计',
  189. // x: 'center',
  190. // itemGap:20
  191. // },
  192. // tooltip: {
  193. // trigger: 'axis',
  194. // axisPointer: {
  195. // type: 'cross',
  196. // crossStyle: {
  197. // color: '#999'
  198. // }
  199. // }
  200. // },
  201. // toolbox: {
  202. // feature: {
  203. // dataView: {show: true, readOnly: false},
  204. // magicType: {show: true, type: ['line', 'bar']},
  205. // restore: {show: true},
  206. // saveAsImage: {show: true}
  207. // }
  208. // },
  209. // legend: {
  210. // data:['报修量','完工量'],
  211. // padding:[30,0,0,0]
  212. // },
  213. // xAxis: [
  214. // {
  215. // type: 'category',
  216. // data: res.data.order_mouth,
  217. // axisPointer: {
  218. // type: 'shadow'
  219. // },
  220. // axisLine: {
  221. // lineStyle: {
  222. // color: '#009688', // 颜色
  223. // }
  224. // }
  225. // }
  226. // ],
  227. // yAxis: [
  228. // {
  229. // type: 'value',
  230. // name: '报修量',
  231. // min: 0,
  232. // axisLabel: {
  233. // formatter: '{value} '
  234. // },
  235. // axisLine: {
  236. // lineStyle: {
  237. // color: '#009688', // 颜色
  238. // }
  239. // }
  240. // },
  241. // {
  242. // type: 'value',
  243. // name: '完工量',
  244. // min: 0,
  245. // axisLabel: {
  246. // formatter: '{value} '
  247. // },
  248. // axisLine: {
  249. // lineStyle: {
  250. // color: '#009688', // 颜色
  251. // }
  252. // }
  253. // }
  254. // ],
  255. // series: [
  256. // {
  257. // name:'报修量',
  258. // type:'bar',
  259. // itemStyle: {
  260. // normal: {
  261. // color: "#FFB800",
  262. // lineStyle: {
  263. // color: "#FFB800"
  264. // }
  265. // }
  266. // },
  267. // data: res.data.repair_counts
  268. // },
  269. // {
  270. // name:'完工量',
  271. // type:'line',
  272. // yAxisIndex: 1,
  273. // itemStyle: {
  274. // normal: {
  275. // color: "#1E9FFF",
  276. // lineStyle: {
  277. // color: "#1E9FFF"
  278. // }
  279. // }
  280. // },
  281. // data:res.data.finish_counts
  282. // }
  283. // ]
  284. // };
  285. // chart1.setOption(option1);
  286. // }
  287. // });
  288. // window.onresize = function () {//用于使chart自适应高度和宽度
  289. // setContain();//重置容器高宽
  290. // chart1.resize();
  291. // chart2.resize();
  292. // };
  293. })
  294. </script>
  295. </body>
  296. </html>