index.html 17 KB

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