index.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>后台首页</title>
  7. <link rel="shortcut icon" href="favicon.ico">
  8. <link href="https://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
  9. <link href="https://cdn.staticfile.org/font-awesome/4.4.0/css/font-awesome.css?v=4.4.0" rel="stylesheet">
  10. <link href="https://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
  11. <link href="__CSS__/style.min.css?v=4.1.0" rel="stylesheet">
  12. <link href="__JS__/layui/css/myLayui.css" rel="stylesheet">
  13. </head>
  14. <body class="gray-bg">
  15. <div class="wrapper wrapper-content">
  16. <div class="row">
  17. </div>
  18. <div class="row">
  19. <div style="display: flex; justify-content: end;">
  20. <!--搜索框开始-->
  21. <form id='commentForm' role="form" method="post" class="form-inline pull-right" style="margin-right: 30px;">
  22. <div class="content clearfix m-b">
  23. <div class="form-group">
  24. <label>时间区间:</label>
  25. <div class="layui-input-inline">
  26. <input style="width: 180px;height: 30px;" type="text" class="layui-input" name="daterang" id="daterang" value={$defaultTime} placeholder="时间段"
  27. readonly="">
  28. </div>
  29. </div>
  30. <div class="form-group">
  31. <button class="btn btn-primary btn-sm" type="button" id="search">搜索
  32. </button>
  33. </div>
  34. </div>
  35. </form>
  36. </div>
  37. <div>
  38. <div class="col-sm-2">
  39. <div class="ibox float-e-margins">
  40. <div class="ibox-title" style="display: flex; justify-content: center;">
  41. <!--<span class="label label-primary pull-right">今天</span>-->
  42. <h3>总会话量</h3>
  43. </div>
  44. <div class="ibox-content" style="text-align: center">
  45. <h1 class="no-margins"><span>{$allChat}</span></h1>
  46. <small></small>
  47. </div>
  48. <div class="ibox-content" style="font-size: 12px; padding: 5px 20px 5px; height: 45px; line-height: 3;">
  49. <div style="justify-content: center; display: flex">
  50. <div style="text-align: right;">转接量</div>
  51. <div style="margin-left: 20px; text-align: right;">{$transfer}</div>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. <div class="col-sm-2">
  57. <div class="ibox float-e-margins">
  58. <div class="ibox-title" style="display: flex; justify-content: center;">
  59. <!--<span class="label label-primary pull-right">今天</span>-->
  60. <h3>总消息量</h3>
  61. </div>
  62. <div class="ibox-content" style="text-align: center">
  63. <h1 class="no-margins"><span>{$allService}</span></h1>
  64. <small></small>
  65. </div>
  66. <div class="ibox-content" style="font-size: 12px; padding: 5px 20px 5px; height: 45px; line-height: 3;">
  67. <div style="justify-content: center; display: flex">
  68. <div style="text-align: right;">答问比</div>
  69. <div style="margin-left: 20px; text-align: right;">{$reply}%</div>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. <div class="col-sm-2">
  75. <div class="ibox float-e-margins">
  76. <div class="ibox-title" style="display: flex; justify-content: center;">
  77. <!--<span class="label label-primary pull-right">今天</span>-->
  78. <h3>排队量</h3>
  79. </div>
  80. <div class="ibox-content" style="text-align: center">
  81. <h1 class="no-margins"><span>{$allQueue}</span></h1>
  82. <small></small>
  83. </div>
  84. <div class="ibox-content" style="font-size: 12px; padding: 5px 20px 5px; height: 45px; line-height: 3;">
  85. <div style="justify-content: center; display: flex">
  86. <div style="text-align: right;">平均排队时长</div>
  87. <div style="margin-left: 20px; text-align: right;">{$waitTime}</div>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. <div class="col-sm-2">
  93. <div class="ibox float-e-margins">
  94. <div class="ibox-title" style="display: flex; justify-content: center;">
  95. <!--<span class="label label-primary pull-right">今天</span>-->
  96. <h3>平均会话时长</h3>
  97. </div>
  98. <div class="ibox-content" style="text-align: center">
  99. <h1 class="no-margins"><span>{$serviceTime}</span><span style="font-size: 14px; margin-left: 10px">秒</span></h1>
  100. <small></small>
  101. </div>
  102. <div class="ibox-content" style="font-size: 12px; padding: 5px 20px 5px; height: 45px; line-height: 3;">
  103. <div style="justify-content: center; display: flex">
  104. <div style="text-align: right;">平均响应时长</div>
  105. <div style="margin-left: 20px; text-align: right;">{$cpdTime}</div>
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. <div class="col-sm-2">
  111. <div class="ibox float-e-margins">
  112. <div class="ibox-title" style="display: flex; justify-content: center;">
  113. <!--<span class="label label-primary pull-right">今天</span>-->
  114. <h3>相对满意度</h3>
  115. </div>
  116. <div class="ibox-content" style="text-align: center">
  117. <h1 class="no-margins"><span>{$evaluateGood}<span style="font-size: 14px; margin-left: 10px">%</span></span></h1>
  118. <small></small>
  119. </div>
  120. <div class="ibox-content" style="font-size: 12px; padding: 5px 20px 5px; height: 45px; line-height: 3;">
  121. <div style="justify-content: center; display: flex">
  122. <div style="text-align: right;">参评率</div>
  123. <div style="margin-left: 20px; text-align: right;">{$evaluateGet}%</div>
  124. </div>
  125. </div>
  126. </div>
  127. </div>
  128. </div>
  129. <div class="col-sm-12">
  130. <div class="ibox float-e-margins">
  131. <div class="ibox-title">
  132. <h5>会话总览</h5>
  133. </div>
  134. <div class="ibox-content">
  135. <!--搜索框开始-->
  136. <!--<form id='commentForm' role="form" method="post" class="form-inline pull-right">
  137. <div class="content clearfix m-b">
  138. <div class="form-group">
  139. <label>时间区间:</label>
  140. <div class="layui-input-inline">
  141. <input style="width: 180px;" type="text" class="layui-input" name="daterang" id="daterang" value={$defaultTime} placeholder="时间段"
  142. readonly="">
  143. </div>
  144. </div>
  145. <div class="form-group">
  146. <button class="btn btn-primary" type="button" style="margin-top:5px" id="search"><strong>搜 索</strong>
  147. </button>
  148. </div>
  149. </div>
  150. </form>-->
  151. <div style="height: 350px" id="bar">
  152. </div>
  153. </div>
  154. </div>
  155. </div>
  156. </div>
  157. </div>
  158. <div class="wrapper wrapper-content">
  159. <div class="row">
  160. </div>
  161. <div class="row">
  162. <div class="col-sm-12">
  163. <div class="ibox float-e-margins">
  164. <div style="display: flex;">
  165. <div style="width: 50%;">
  166. <div class="ibox-title">
  167. <h5>满意度</h5>
  168. </div>
  169. <div class="ibox-content" style="height: 350px" id="pie_evaluate">
  170. </div>
  171. </div>
  172. <div style="width: 50%; border-left: 1px solid #e7eaec;">
  173. <div class="ibox-title">
  174. <h5>访问来源</h5>
  175. </div>
  176. <div id="system_data" style="text-align: center; width: 100%; font-size: 16px; background: #fff; height: 350px;">
  177. <div class="ibox-content" style="height: 350px" id="pie_system">
  178. </div>
  179. </div>
  180. </div>
  181. </div>
  182. </div>
  183. </div>
  184. </div>
  185. </div>
  186. <script src="https://cdn.staticfile.org/jquery/2.1.4/jquery.min.js"></script>
  187. <script src="https://cdn.bootcss.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
  188. <script src="/static/admin/js/plugins/echarts/echarts.min.js"></script>
  189. <script src="__JS__/layui/layui.all.js"></script>
  190. <script type="text/javascript">
  191. var xData = {$xData};
  192. var chatData = {$chatData};
  193. var serviceData = {$serviceData};
  194. var queueData = {$queueData};
  195. var evaluate = {$evaluate};
  196. var systemCount = {$systemCount}.length ? {$systemCount} : '';
  197. var xWidth = (168/xData.length);
  198. // 基于准备好的dom,初始化echarts实例
  199. var myChart_bar = echarts.init(document.getElementById('bar'));
  200. var pie_evaluate = echarts.init(document.getElementById('pie_evaluate'));
  201. var pie_system = echarts.init(document.getElementById('pie_system'));
  202. // 指定图表的配置项和数据
  203. var option_bar = {
  204. color: ['#1da1f2', '#fa7070', '#fcbb07', '#90dd75', '#8fa6ec', '#157efb'],
  205. tooltip: {
  206. trigger: 'axis',
  207. axisPointer: {
  208. type: 'shadow'
  209. }
  210. },
  211. legend: {
  212. itemWidth: 20, //图例的宽度
  213. itemHeight: 8, //图例的高度
  214. itemGap: 40,
  215. left: '55',
  216. top: 'top',
  217. icon: 'rect',
  218. //selectedMode: false, //取消图例上的点击事件
  219. data: ['会话量', '消息量','排队量'],
  220. },
  221. grid: {
  222. left: '30',
  223. right: '30',
  224. bottom: '20',
  225. containLabel: true
  226. },
  227. toolbox: {
  228. show: true,
  229. orient: 'vertical',
  230. left: 'right',
  231. top: 'center',
  232. },
  233. calculable: true,
  234. xAxis: [{
  235. splitLine: {
  236. show: false
  237. }, //去除网格线
  238. splitArea: {
  239. show: false
  240. }, //保留网格区域
  241. axisLine: {
  242. show: true,
  243. lineStyle: { //轴上的线样式
  244. color: '#979797',
  245. width: 0.6, //这里是为了突出显示加上的
  246. },
  247. },
  248. axisTick: {
  249. show: false
  250. },
  251. axisLabel: { //轴上的数据样式
  252. color: '#393C40',
  253. },
  254. data: xData,
  255. }],
  256. yAxis: [{
  257. // type: 'value',
  258. splitLine: {
  259. show: false
  260. }, //去除网格线
  261. splitArea: {
  262. show: false
  263. }, //保留网格区域
  264. axisLine: {
  265. show: true,
  266. lineStyle: { //轴上的线样式
  267. color: '#979797',
  268. width: 0.6, //这里是为了突出显示加上的
  269. },
  270. },
  271. axisTick: {
  272. show: false
  273. },
  274. axisLabel: { //轴上的数据样式
  275. color: '#393C40',
  276. }
  277. }],
  278. series: [
  279. {
  280. name: '会话量',
  281. type: 'bar',
  282. barWidth: xWidth,// 柱形的宽度
  283. barGap: 0,
  284. data: serviceData
  285. },
  286. {
  287. name: '消息量',
  288. type: 'bar',
  289. barWidth: xWidth,// 柱形的宽度
  290. barGap: 0,
  291. data: chatData
  292. },
  293. {
  294. name: '排队量',
  295. type: 'bar',
  296. barWidth: xWidth,// 柱形的宽度
  297. barGap: 0,
  298. data: queueData
  299. }
  300. ]
  301. };
  302. // 使用刚指定的配置项和数据显示图表。
  303. myChart_bar.setOption(option_bar);
  304. // 指定图表的配置项和数据
  305. var option_PE = {
  306. backgroundColor: '#fff',
  307. tooltip: {
  308. trigger: 'item',
  309. formatter: "{b} : {c} ({d}%)"
  310. },
  311. visualMap: {
  312. show: false,
  313. min: 500,
  314. max: 600,
  315. inRange: {
  316. //colorLightness: [0, 1]
  317. }
  318. },
  319. series: [{
  320. name: '满意度',
  321. type: 'pie',
  322. radius: '50%',
  323. center: ['50%', '50%'],
  324. color: ['rgb(131,249,103)', '#FBFE27', '#FE5050', '#1DB7E5'], //'#FBFE27','rgb(11,228,96)','#FE5050'
  325. data: [
  326. {
  327. value: evaluate['evaluateGood'],
  328. name: '满意'
  329. }, {
  330. value: evaluate['evaluateSecondary'],
  331. name: '一般'
  332. }, {
  333. value: evaluate['evaluateBad'],
  334. name: '不满意'
  335. }, {
  336. value: evaluate['evaluateNo'],
  337. name: '未评价'
  338. }
  339. ].sort(function(a, b) {
  340. return a.value - b.value
  341. }),
  342. roseType: 'radius',
  343. label: {
  344. normal: {
  345. formatter: ['{c|{c}次}', '{b|{b}}'].join('\n'),
  346. rich: {
  347. c: {
  348. color: 'rgb(241,246,104)',
  349. fontSize: 20,
  350. fontWeight:'bold',
  351. lineHeight: 5
  352. },
  353. b: {
  354. color: 'rgb(98,137,169)',
  355. fontSize: 15,
  356. height: 40
  357. },
  358. },
  359. }
  360. },
  361. labelLine: {
  362. normal: {
  363. lineStyle: {
  364. color: 'rgb(98,137,169)',
  365. },
  366. smooth: 0.2,
  367. length: 10,
  368. length2: 20,
  369. }
  370. },
  371. itemStyle: {
  372. normal: {
  373. shadowColor: 'rgba(0, 0, 0, 0.3)',
  374. shadowBlur: 50,
  375. }
  376. }
  377. }]
  378. };
  379. // 使用刚指定的配置项和数据显示图表。
  380. pie_evaluate.setOption(option_PE);
  381. if (systemCount) {
  382. var option_PS = {
  383. backgroundColor: '#fff',
  384. tooltip: {
  385. trigger: 'item',
  386. formatter: "{b} : {c} ({d}%)"
  387. },
  388. visualMap: {
  389. show: false,
  390. min: 500,
  391. max: 600,
  392. inRange: {
  393. //colorLightness: [0, 1]
  394. }
  395. },
  396. series: [{
  397. name: '满意度',
  398. type: 'pie',
  399. radius: '50%',
  400. center: ['50%', '50%'],
  401. color: ['rgb(131,249,103)', '#FBFE27', '#FE5050', '#1DB7E5'], //'#FBFE27','rgb(11,228,96)','#FE5050'
  402. data: systemCount.sort(function(a, b) {
  403. return a.value - b.value
  404. }),
  405. roseType: 'radius',
  406. label: {
  407. normal: {
  408. formatter: ['{c|{c}次}', '{b|{b}}'].join('\n'),
  409. rich: {
  410. c: {
  411. color: 'rgb(241,246,104)',
  412. fontSize: 20,
  413. fontWeight:'bold',
  414. lineHeight: 5
  415. },
  416. b: {
  417. color: 'rgb(98,137,169)',
  418. fontSize: 15,
  419. height: 40
  420. },
  421. },
  422. }
  423. },
  424. labelLine: {
  425. normal: {
  426. lineStyle: {
  427. color: 'rgb(98,137,169)',
  428. },
  429. smooth: 0.2,
  430. length: 10,
  431. length2: 20,
  432. }
  433. },
  434. itemStyle: {
  435. normal: {
  436. shadowColor: 'rgba(0, 0, 0, 0.3)',
  437. shadowBlur: 50,
  438. }
  439. }
  440. }]
  441. };
  442. pie_system.setOption(option_PS);
  443. } else {
  444. let pie_system_html = "<div style='line-height: 20; border-top: 1px solid #e7eaec;'>暂无数据</div>";
  445. $("#system_data").html(pie_system_html);
  446. }
  447. function search() {
  448. let daterang = $("#daterang").val();
  449. let data = daterang.split(",");
  450. let start = data[0];
  451. let end = data[1];
  452. window.location.href = '/admin/report/index?start='+start+'&end='+end;
  453. }
  454. $(document).ready(function () {
  455. //当点击查询按钮的时候执行
  456. $("#search").bind("click", search);
  457. });
  458. layui.use('laydate', function () {
  459. var laydate = layui.laydate;
  460. laydate.render({
  461. elem: '#daterang'
  462. , range: ','
  463. });
  464. });
  465. </script>
  466. </body>
  467. </html>