ZZDianXin_UI - 郑州电信 演示

jthusuan.html 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  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. <link rel="stylesheet" href="js/select2/css/select2.min.css" />
  7. <script src="Script/Common/huayi.load.js"></script>
  8. <script src="Script/Common/huayi.config.js"></script>
  9. <title>接通率和呼损率统计</title>
  10. <!--[if lt IE 9]>
  11. <meta http-equiv="refresh" content="0;ie.html" />
  12. <![endif]-->
  13. <link rel="stylesheet" href="./js/layui/css/layui.css" />
  14. <link rel="stylesheet" href="./css/init.css" />
  15. <style>
  16. .husun {
  17. font-size: 12px;
  18. }
  19. .th-top {
  20. background: #f3f3f4;
  21. height: 60px;
  22. padding: 10px 20px;
  23. }
  24. .topCon {
  25. float: right;
  26. margin-right: 45px;
  27. }
  28. .th-content h2 {
  29. font-size: 18px;
  30. margin-bottom: 20px;
  31. }
  32. .th-content {
  33. width: 90%;
  34. margin: 20px auto 0 auto;
  35. }
  36. .th-table {
  37. display: none;
  38. }
  39. </style>
  40. </head>
  41. <body class="gray-bg" style="background: #fefefe;">
  42. <div class="husun">
  43. <div class="daoHang clearfix">
  44. <div class="dhLeft">
  45. <sapn><i class="syIcon"></i>位置:
  46. <a id="ReIndex" href="javaScript:;">首页</a>&gt;
  47. <a href="javaScript:;">报表分析</a>&gt;
  48. <a href="javaScript:;">话务运营分析</a>&gt;
  49. <a href="" style="color: #000;">接通呼损统计</a>
  50. </sapn>
  51. </div>
  52. <div class="dhRight">
  53. <a href="#" title="刷新"><i class="fa fa-refresh"></i></a>
  54. </div>
  55. </div>
  56. <div class="th-top clearfix">
  57. <div class="topCon">
  58. <div class="form-inline th-bar clearfix">
  59. <div class="time-box form-group">
  60. <i class="tub fa fa-calendar"></i>
  61. <input class="form-control" type="text" id="startTime" placeholder="请选择起止时间" style="width: 228px;">
  62. </div>
  63. <!--<div class="time-box form-group">
  64. 部门:
  65. <select id="bumen">
  66. <option value="">请选择</option>
  67. </select>
  68. </div>-->
  69. <div class="form-group tool_bars pull-right">
  70. <button class="btns sear">搜索</button>
  71. <a class="btns export">导出</a>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. <ul class="nav nav-tabs th-tab">
  77. <li role="presentation" class="active">
  78. <a href="javascript:;">图形</a>
  79. </li>
  80. <li role="presentation">
  81. <a href="javascript:;">表格</a>
  82. </li>
  83. </ul>
  84. <div class="th-content">
  85. <div class="th-tu">
  86. <h2 style="text-align: center;">服务热线-接通率和呼损率统计</h2>
  87. <div id="tabtu" style="width: 100%; height: 600px;"></div>
  88. </div>
  89. <div class="th-table">
  90. <h2 style="text-align: center;">服务热线-接通率和呼损率统计</h2>
  91. <table class="layui-hide" id="t_callTotal"></table>
  92. </div>
  93. </div>
  94. </div>
  95. <script src="./js/layui/layui.js"></script>
  96. <script src="./js/select2/js/select2.min.js"></script>
  97. <script src="./js/echarts.common.min.js"></script>
  98. <script>
  99. var token = $.cookie("token");
  100. var myChartp;
  101. var stime = ''; //开始时间
  102. var endtime = ''; //结束时间
  103. var tabIndex = 0;
  104. $(function() {
  105. layui.use('laydate', function() {
  106. var laydate = layui.laydate;
  107. //日期
  108. laydate.render({
  109. elem: '#startTime',
  110. range: '~',
  111. theme: '#1ab394',
  112. calendar: 'true'
  113. });
  114. });
  115. //helper.getDropList.getDept($('#bumen'));//获取部门
  116. //tab切换
  117. $('.th-tab li').click(function() {
  118. $(this).addClass('active')
  119. .siblings().removeClass('active');
  120. tabIndex = $(this).index();
  121. $('.th-content >div').eq(tabIndex).show()
  122. .siblings().hide();
  123. if(tabIndex == 1) {
  124. $('#search_dept').css('display', 'none');
  125. } else {
  126. $('#search_dept').css('display', 'inline-block');
  127. }
  128. loadDatas();
  129. });
  130. //搜索事件
  131. $(".sear").click(function() {
  132. stime = $('#startTime').val() && $('#startTime').val().split(' ~ ')[0];
  133. endtime = $('#startTime').val() && $('#startTime').val().split(' ~ ')[1];
  134. loadDatas();
  135. });
  136. //按enter搜索
  137. document.onkeydown = function (e) { // 回车提交表单
  138. var theEvent = window.event || e;
  139. var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
  140. if (code == 13) {
  141. stime = $('#startTime').val() && $('#startTime').val().split(' ~ ')[0];
  142. endtime = $('#startTime').val() && $('#startTime').val().split(' ~ ')[1];
  143. loadDatas();
  144. }
  145. }
  146. //导出功能
  147. $('.export').click(function() {
  148. stime = $('#startTime').val() && $('#startTime').val().split(' ~ ')[0];
  149. endtime = $('#startTime').val() && $('#startTime').val().split(' ~ ')[1];
  150. dcexcel(this);
  151. });
  152. myChartp = echarts.init(document.getElementById('tabtu'));
  153. myChartp.clear();
  154. myChartp.showLoading();
  155. option = {
  156. tooltip: {
  157. trigger: 'axis',
  158. },
  159. legend: {
  160. data: ['接通次数', '呼损次数', '接通率', '呼损率'],
  161. bottom: 60
  162. },
  163. grid: {
  164. bottom: 180
  165. },
  166. dataZoom: [{ // 这个dataZoom组件,默认控制x轴。
  167. type: 'slider', // 这个 dataZoom 组件是 slider 型 dataZoom 组件
  168. xAxisIndex: 0,
  169. start: 0, // 左边在 0% 的位置。
  170. end: 100, // 右边在 100% 的位置。
  171. bottom: 100,
  172. },
  173. ],
  174. xAxis: [{
  175. type: 'category',
  176. data: [],
  177. axisPointer: {
  178. type: ''
  179. },
  180. axisLabel: {
  181. rotate: 30,
  182. interval: 0
  183. }
  184. }],
  185. yAxis: [{
  186. type: 'value',
  187. name: '通话次数(次)',
  188. nameLocation: 'end',
  189. nameGap: 40,
  190. // min: 0,
  191. // max:300,
  192. interval: 50,
  193. axisLabel: {
  194. formatter: '{value} '
  195. }
  196. },
  197. {
  198. type: 'value',
  199. name: '百分比(%)',
  200. nameLocation: 'end',
  201. nameGap: 35,
  202. min: 0,
  203. max: 100,
  204. interval: 10,
  205. axisLabel: {
  206. formatter: '{value} '
  207. }
  208. }
  209. ],
  210. series: [{
  211. type: 'bar',
  212. name: '接通次数',
  213. data: []
  214. },
  215. {
  216. type: 'bar',
  217. name: '呼损次数',
  218. data: []
  219. },
  220. {
  221. type: 'line',
  222. name: '接通率',
  223. data: [],
  224. yAxisIndex: 1,
  225. },
  226. {
  227. type: 'line',
  228. name: '呼损率',
  229. data: [],
  230. yAxisIndex: 1,
  231. }
  232. ],
  233. color: ['#1ab394', '#fbbe5b', '#88ebc4', '#fa957f']
  234. }
  235. // 使用刚指定的配置项和数据显示图表。
  236. myChartp.setOption(option);
  237. loadDatas();
  238. });
  239. //加载表格
  240. function getTableDataList() {
  241. var loadindex = layer.load();
  242. layui.use('table', function() {
  243. var table = layui.table;
  244. //方法级渲染
  245. table.render({
  246. elem: '#t_callTotal',
  247. url: huayi.config.callcenter_url + "SwitchedlossCall/GetDataList",
  248. method: 'get', //如果无需自定义HTTP类型,可不加该参数
  249. skin: 'row', //line (行边框风格) row (列边框风格) nob (无边框风格)
  250. even: true, //开启隔行背景
  251. size: 'lg', //sm,lg尺寸的表格
  252. where: {
  253. stime: stime,
  254. endtime: endtime,
  255. //dpt: $('#bumen').val(),
  256. token: token
  257. }, //如果无需传递额外参数,可不加该参数
  258. //request: {}, //如果无需自定义请求参数,可不加该参数
  259. response: {
  260. statusName: 'state', //数据状态的字段名称,默认:code
  261. statusCode: 'success', //成功的状态码,默认:0
  262. msgName: 'message', //状态信息的字段名称,默认:msg
  263. //countName: 'total', //数据总数的字段名称,默认:count
  264. //dataName: 'rows', //数据列表的字段名称,默认:data
  265. }, //如果无需自定义数据响应名称,可不加该参数
  266. cols: [
  267. [{
  268. field: '日期',
  269. title: '日期',
  270. align: 'center',
  271. fixed: true,
  272. sort: true,
  273. width: 150,
  274. }, {
  275. field: '接通次数',
  276. title: '接通次数',
  277. align: 'center',
  278. width: '',
  279. },
  280. {
  281. field: '呼损次数',
  282. title: '呼损次数',
  283. align: 'center',
  284. width: '',
  285. },
  286. {
  287. field: '接通率',
  288. title: '接通率(%)',
  289. align: 'center',
  290. width: '',
  291. },
  292. {
  293. field: '呼损率',
  294. title: '呼损率(%)',
  295. align: 'center',
  296. width: '',
  297. },
  298. ]
  299. ],
  300. height: 'full-230',
  301. done:function(){
  302. layer.close(loadindex);
  303. }
  304. });
  305. });
  306. }
  307. //获取数据
  308. function getDataLists() {
  309. $.ajax({
  310. type: "get",
  311. url: huayi.config.callcenter_url + "SwitchedlossCall/GetDataList",
  312. async: true,
  313. dataType: 'json',
  314. data: {
  315. stime: stime,
  316. endtime: endtime,
  317. //dpt: $('#bumen').val(),
  318. token: token,
  319. },
  320. success: function(data) {
  321. }
  322. })
  323. .then(function(data) {
  324. myChartp.hideLoading();
  325. if(data.state.toLowerCase() == "success") {
  326. var tbodyCon = data.data;
  327. //排序
  328. tbodyCon.sort(compare("日期"));
  329. // 填入数据
  330. if(tbodyCon) {
  331. myChartp.setOption({
  332. xAxis: {
  333. data: (function() {
  334. var res = [];
  335. for(var i = 0; i < tbodyCon.length; i++) {
  336. res.push(tbodyCon[i].日期);
  337. }
  338. return res;
  339. })(),
  340. },
  341. series: (function() {
  342. var sres = [],
  343. sres1 = [],
  344. sres2 = [],
  345. sres3 = [];
  346. var sobj = [{
  347. data: sres,
  348. },
  349. {
  350. data: sres1,
  351. },
  352. {
  353. data: sres2,
  354. },
  355. {
  356. data: sres3,
  357. },
  358. ];
  359. for(var i = 0; i < tbodyCon.length; i++) {
  360. sres.push(tbodyCon[i].接通次数);
  361. sres1.push(tbodyCon[i].呼损次数);
  362. sres2.push(tbodyCon[i].接通率);
  363. sres3.push(tbodyCon[i].呼损率);
  364. }
  365. return sobj;
  366. })(),
  367. });
  368. } else {
  369. $('#tabtu').html('<p class="text-center">暂无数据</p>');
  370. }
  371. } else {
  372. $('#tabtu').html('<p class="text-center">暂无数据</p>');
  373. }
  374. });
  375. }
  376. //导出
  377. function dcexcel(obj) {
  378. var url = huayi.config.callcenter_url + "SwitchedlossCall/ExptList?token=" + token;
  379. url += "&stime=" + stime + "&endtime=" + endtime; //+ "&dpt=" + $('#bumen').val();
  380. obj.href = url;
  381. }
  382. //定义一个比较器
  383. function compare(propertyName) {
  384. return function(object1, object2) {
  385. var value1 = object1[propertyName];
  386. var value2 = object2[propertyName];
  387. if(value2 < value1) {
  388. return 1;
  389. } else if(value2 > value1) {
  390. return -1;
  391. } else {
  392. return 0;
  393. }
  394. }
  395. }
  396. function loadDatas() {
  397. if(tabIndex == 0) {
  398. getDataLists(); //加载图形
  399. } else if(tabIndex == 1) {
  400. getTableDataList(); //加载表格
  401. }
  402. }
  403. </script>
  404. </body>
  405. </html>