office_efficiency_index.js 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889
  1. //全局客户类型(1:公众;2:政企)
  2. var g_custType="1";
  3. //数据日期
  4. var g_dataDate="20191231"
  5. //全局渠道信息
  6. var g_channelInfo={};
  7. var g_channelCode="";
  8. var g_channelName="";
  9. //门店基本信息
  10. function loadChannelBaseInfo(data){
  11. //获取渠道积分数据
  12. var staffHandleInfo=data.staffHandleInfo;
  13. //获取渠道总积分
  14. var channelJfMap=staffHandleInfo.channelJfMap || {};
  15. //获取渠道总积分
  16. var channelSum=channelJfMap.channelSum || 0;
  17. //获取渠道排名
  18. var channelOrder=channelJfMap.channelOrder || 1;
  19. var channelTotal=channelJfMap.channelTotal || 1
  20. var popval=String(parseFloat(channelOrder/channelTotal));
  21. //获取台席健康度得分
  22. var channelDeviceInfo=data.channelDeviceInfo;
  23. var finalDeviceScore=channelDeviceInfo.finalDeviceScore || 0;
  24. if(finalDeviceScore<=0){
  25. $("#base-info .device-score").find("img").attr("src","../static/images/star3.png");
  26. }else if(finalDeviceScore<0.95){
  27. $("#base-info .device-score").find("img").attr("src","../static/images/star2.png");
  28. }else{
  29. $("#base-info .device-score").find("img").attr("src","../static/images/star1.png");
  30. }
  31. $("#base-info .device-score").find(".score-val").text(finalDeviceScore+"分");
  32. //设置渠道当日客流量、订单量
  33. $("#base-info").find("div[type='dingdanVal']").text(channelDeviceInfo.channelOrderNum || "--");
  34. $("#base-info").find("div[type='custNumVal']").text(channelDeviceInfo.channelCustNum || "--");
  35. //设置门店基本信息-违规行为
  36. var channelStartWeiGui=staffHandleInfo.channelStartWeiGui || 0;
  37. if(channelStartWeiGui==1){
  38. $("#base-info .weigui").find("img").attr("src","../static/images/star1.png");
  39. }else{
  40. $("#base-info .weigui").find("img").attr("src","../static/images/star3.png");
  41. }
  42. $("#base-info .weigui").find(".score-val").text(channelStartWeiGui+"分");
  43. //设置门店基本信息-营销评级
  44. var yingxiaoval=1-popval;
  45. yingxiaoval=keepTwoDecimal(yingxiaoval);
  46. if(yingxiaoval<=0){
  47. $("#base-info .yingxiao").find("img").attr("src","../static/images/star3.png");
  48. }else if(yingxiaoval<0.95){
  49. $("#base-info .yingxiao").find("img").attr("src","../static/images/star2.png");
  50. }else{
  51. $("#base-info .yingxiao").find("img").attr("src","../static/images/star1.png");
  52. }
  53. $("#base-info .yingxiao").find(".score-val").text(yingxiaoval+"分");
  54. //设置门店基本信息-受理速度
  55. var avgTimeScore=0;
  56. var timeStepAnalysis=data.timeStepAnalysis;
  57. if(timeStepAnalysis.channelTime.length>0){
  58. avgTimeScore=timeStepAnalysis.channelTime[4]/timeStepAnalysis.provinceTime[4];
  59. if(avgTimeScore>1){
  60. avgTimeScore=avgTimeScore*0.335;
  61. }
  62. }
  63. avgTimeScore=keepTwoDecimal(avgTimeScore*0.5+0.5);
  64. avgTimeScore=avgTimeScore>1?1:avgTimeScore;
  65. if(avgTimeScore<=0){
  66. $("#base-info .avgtime").find("img").attr("src","../static/images/star3.png");
  67. }else if(avgTimeScore<0.95){
  68. $("#base-info .avgtime").find("img").attr("src","../static/images/star2.png");
  69. }else{
  70. $("#base-info .avgtime").find("img").attr("src","../static/images/star1.png");
  71. }
  72. $("#base-info .avgtime").find(".score-val").text(avgTimeScore+"分");
  73. //设置门店基本信息-业务量
  74. var yewuliangVal=0;
  75. var channelHandleInfo=data.channelHandleInfo;
  76. var orderNumData=channelHandleInfo.orderNumData;
  77. if(orderNumData.length>2){
  78. var t1=orderNumData[orderNumData.length-1];
  79. var t2=orderNumData[orderNumData.length-2];
  80. if(t1!=0 && t2!=0){
  81. yewuliangVal=t1>t2?t2/t1:t1/t2;
  82. }else{
  83. yewuliangVal=0.45;
  84. }
  85. if(yewuliangVal>1){
  86. yewuliangVal=yewuliangVal*0.335;
  87. }
  88. }
  89. yewuliangVal=keepTwoDecimal(yewuliangVal*0.5+0.5);
  90. yewuliangVal=yewuliangVal>1?1:yewuliangVal;
  91. if(yewuliangVal<=0){
  92. $("#base-info .yewuliang").find("img").attr("src","../static/images/star3.png");
  93. }else if(yewuliangVal<0.95){
  94. $("#base-info .yewuliang").find("img").attr("src","../static/images/star2.png");
  95. }else{
  96. $("#base-info .yewuliang").find("img").attr("src","../static/images/star1.png");
  97. }
  98. $("#base-info .yewuliang").find(".score-val").text(yewuliangVal+"分");
  99. //设置门店基本信息-排队机耗时
  100. var channelHandleInfo=data.channelHandleInfo;
  101. var callTime=channelHandleInfo.lineUpData[channelHandleInfo.lineUpData.length-1];
  102. $("#base-info").find("div[type='lineUpVal']").text(callTime|| "无");
  103. //开始计算门店星级
  104. var channelTotalScore=parseFloat(finalDeviceScore)+parseFloat(channelStartWeiGui)+parseFloat(yingxiaoval)+parseFloat(avgTimeScore)+parseFloat(yewuliangVal);
  105. channelTotalScore=String(channelTotalScore);
  106. channelTotalScore=keepTwoDecimal(channelTotalScore);
  107. $("#base-info").find(".channel-total-score").text(channelTotalScore+"分" || "--分");
  108. $("#base-info").find(".chanenl-star").empty();
  109. var starLen=Math.floor(channelTotalScore);
  110. for(var idx=0;idx<starLen;idx++){
  111. var img='<img src="../static/images/star1.png"/>';
  112. $("#base-info").find(".chanenl-star").append(img);
  113. }
  114. $("#base-info").find(".chanenl-star").append('<div>'+channelTotalScore+'分</div>');
  115. if(starLen<channelTotalScore){
  116. var img='<img src="../static/images/star2.png" style="width:21px;height:20px;"/>';
  117. $("#base-info").find("#chanenl-star").append(img);
  118. }
  119. var unit="";
  120. if(channelSum>90000){
  121. unit="万";
  122. channelSum=keepTwoDecimal(channelSum/10000);
  123. }
  124. var maxval=channelSum-channelSum*(1-popval),currval=channelSum;
  125. //特殊处理,优化饼图数据美观
  126. if(0==channelSum ){
  127. maxval=1000;
  128. }
  129. var option = {
  130. series: [{
  131. type: 'pie',radius: ['65%', '80%'],color: '#E63F19',label: {normal: {position: 'center'}},
  132. data: [{
  133. value: currval,//当前值
  134. name: '积分',
  135. label: {normal: {formatter: currval + unit,textStyle: {fontSize: 16,color: '#FED546'}}}
  136. },{
  137. value: maxval,//比对值
  138. name: '积分',
  139. label: {normal: {formatter: function (params) {return '\n积分' },textStyle: {color: '#fff',fontSize: 13}}},
  140. itemStyle: {normal: {color: 'rgba(255,255,255,.2)'},emphasis: {color: '#fff'}},
  141. }]
  142. }]
  143. };
  144. var myChart= echarts.init(document.getElementById('integral_echart'));
  145. myChart.clear();
  146. myChart.setOption(option);
  147. $("#base-info").find(".channel-name").text(g_channelName || "XXXX");
  148. var popval2=keepTwoDecimal(popval);
  149. $("#base-info").find(".popval").text("全省前"+(popval2*100)+"%" || "全省前0%");
  150. var rePortData={};
  151. //厅办理业务平均耗时
  152. rePortData.channelAvgTime=staffHandleInfo.channelAvgTime;
  153. //厅排队机
  154. rePortData.lineUpData=channelHandleInfo.lineUpData
  155. //渠道积分排名占比
  156. rePortData.popval=popval;
  157. rePortData.custNumData=channelHandleInfo.custNumData;
  158. channelReportContent(rePortData);
  159. }
  160. //渠道报告内容建议说明
  161. function channelReportContent(rePortData){
  162. var reportContent="很抱歉,目前暂无可分析的数据";
  163. if(undefined!=rePortData.channelAvgTime && ""!=rePortData.channelAvgTime){
  164. if(rePortData.channelAvgTime>20){
  165. if(rePortData.popval<=0.3){
  166. reportContent="业绩很棒,受理偏慢,请适当加快受理";
  167. }else{
  168. reportContent="受理速度偏慢,影响客户感知,请加强受理技能培训";
  169. }
  170. }else{
  171. //判断厅是否有排队机
  172. if(rePortData.lineUpData.length>0){
  173. var callTime=rePortData.lineUpData[rePortData.lineUpData.length-1];
  174. var t1=rePortData.channelAvgTime-callTime;
  175. if(t1>=3){
  176. if(rePortData.popval<=0.3){
  177. reportContent="门店运营良好,可适当提升受理速度";
  178. }else{
  179. reportContent="门店运营良好,建议加强营销";
  180. }
  181. }else if(callTime>rePortData.channelAvgTime){
  182. reportContent="门店台席规划不合理,存在客户积压,请按业务类型分流";
  183. }else if(0<=t1 && t1<3){
  184. if(rePortData.popval<=0.3){
  185. reportContent="门店运营状态良好,台席规划合理,请继续保持";
  186. }else{
  187. reportContent="台席规划合理,建议适当加强营销";
  188. }
  189. }
  190. }else{
  191. var custNum=rePortData.custNumData[rePortData.custNumData.length-1] || 0;
  192. if(custNum<=50){
  193. if(rePortData.popval<=0.3){
  194. reportContent="营业效能规划合理,厅内客流量仍有上升空间";
  195. }else{
  196. reportContent="客流较小,请加强营销手段";
  197. }
  198. }else{
  199. if(rePortData.popval<=0.3){
  200. reportContent="厅店客流量大,营业效能规划合理,请继续保持";
  201. }else{
  202. reportContent="厅店客流量大,请把握机会加强营销";
  203. }
  204. }
  205. }
  206. }
  207. }
  208. $(".analysis-info").text(reportContent);
  209. }
  210. //门店受理详情
  211. function loadChannelHandleDetail(data){
  212. var option = {
  213. tooltip: {trigger: 'axis',axisPointer: {lineStyle: {color: '#fff'}}},
  214. legend: {
  215. icon: 'rect',
  216. itemWidth: 14,itemHeight: 5,itemGap:10,
  217. data: ['受理时长', '排队时长', '订单量','客流量'],
  218. right: '10px',top: '0px',
  219. textStyle: {fontSize: 12,color: '#fff'}
  220. },
  221. grid: {x:40,y:50,x2:45,y2:40},
  222. xAxis: [{
  223. type: 'category',boundaryGap: false,axisLine: {lineStyle: {color: '#57617B'}},axisLabel: {textStyle: {color:'#fff'}},
  224. data: data.dataDateArr
  225. }],
  226. yAxis: [{
  227. type: 'value',
  228. axisTick: {
  229. show: false
  230. },
  231. axisLine: {lineStyle: {color: '#57617B'}},
  232. axisLabel: {margin: 10,textStyle: {fontSize: 12},textStyle: {color:'#fff'},formatter:'{value}分'},
  233. splitLine: {lineStyle: {color: '#57617B'}}
  234. },{
  235. type: 'value',
  236. axisTick: {
  237. show: false
  238. },
  239. axisLine: {lineStyle: {color: '#57617B'}},
  240. axisLabel: {margin: 10,textStyle: {fontSize: 12},textStyle: {color:'#fff'},formatter:'{value}个'},
  241. splitLine: {show: false,lineStyle: {color: '#57617B'}}
  242. }],
  243. series: [{
  244. name: '受理时长',type: 'line',smooth: true,lineStyle: {normal: {width: 2}},
  245. yAxisIndex:0,
  246. areaStyle: {
  247. normal: {
  248. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  249. offset: 0,
  250. color: 'rgba(185,150,248,0.3)'
  251. }, {
  252. offset: 0.8,
  253. color: 'rgba(185,150,248,0)'
  254. }], false),
  255. shadowColor: 'rgba(0, 0, 0, 0.1)',
  256. shadowBlur: 10
  257. }
  258. },
  259. itemStyle: {normal: { color: '#B996F8'}},
  260. data: data.handleTimeData
  261. }, {
  262. name: '排队时长',type: 'line',smooth: true,lineStyle: { normal: {width: 2}},
  263. yAxisIndex:0,
  264. areaStyle: {
  265. normal: {
  266. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  267. offset: 0,
  268. color: 'rgba(3, 194, 236, 0.3)'
  269. }, {
  270. offset: 0.8,
  271. color: 'rgba(3, 194, 236, 0)'
  272. }], false),
  273. shadowColor: 'rgba(0, 0, 0, 0.1)',
  274. shadowBlur: 10
  275. }
  276. },
  277. itemStyle: {normal: {color: '#03C2EC'}},
  278. data: data.lineUpData
  279. }, {
  280. name: '订单量',type: 'line',smooth: true,lineStyle: {normal: {width: 2}},
  281. yAxisIndex:1,
  282. areaStyle: {
  283. normal: {
  284. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  285. offset: 0,
  286. color: 'rgba(218, 57, 20, 0.3)'
  287. }, {
  288. offset: 0.8,
  289. color: 'rgba(218, 57, 20, 0)'
  290. }], false),
  291. shadowColor: 'rgba(0, 0, 0, 0.1)',
  292. shadowBlur: 10
  293. }
  294. },
  295. itemStyle: {normal: {color: '#DA3914'}},
  296. data: data.orderNumData
  297. },{
  298. name: '客流量',type: 'line',smooth: true,lineStyle: {normal: {width: 2}},
  299. yAxisIndex:1,
  300. areaStyle: {
  301. normal: {
  302. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  303. offset: 0,
  304. color: 'rgba(232, 190, 49, 0.3)'
  305. }, {
  306. offset: 0.8,
  307. color: 'rgba(232, 190, 49, 0)'
  308. }], false),
  309. shadowColor: 'rgba(0, 0, 0, 0.1)',
  310. shadowBlur: 10
  311. }
  312. },
  313. itemStyle: {normal: {color: '#E8BE31'}},
  314. data:data.custNumData
  315. }]
  316. };
  317. var myChart = echarts.init(document.getElementById('channel_handle_detail'));
  318. myChart.clear();
  319. if(data.handleTimeData.length>0){
  320. myChart.setOption(option);
  321. }else{
  322. noDataTip($("#channel_handle_detail"));
  323. }
  324. }
  325. //加载营业员受理详情
  326. function loadStaffHandleDetail(data){
  327. //获取员工违规信息
  328. var staffWgInfo=data.staffWgInfo;
  329. //获取员工积分信息
  330. var channelJfMap=data.channelJfMap;
  331. var channelStaffLen=data.channelStaffLen;
  332. var staffHandleInfo=data.staffHandleInfo || [],staffHandleInfoLen=staffHandleInfo.length;
  333. var html=[],index=0;
  334. for(var key in staffHandleInfo){
  335. var itemArr=staffHandleInfo[key];
  336. index++;
  337. var indexClass=(1==index)?"first":"";
  338. var wgCount=staffWgInfo[itemArr[0].staffCode] || "0";
  339. var tr1=[
  340. '<tr class="td-avg-time">',
  341. '<td colspan="3">',
  342. '<div class="index '+indexClass+'">'+itemArr[0].index+'</div>',
  343. '<div class="staff-name">'+itemArr[0].staffName+'</div>',
  344. '<div class="avg-time-label">|&nbsp;&nbsp;厅排名</div>',
  345. '<div class="avg-time-value">'+itemArr[0].index+'/'+channelStaffLen+'</div>',
  346. '</td>',
  347. '</tr>',
  348. '<tr>',
  349. '<td> ',
  350. '<div class="staff-cust-time">',
  351. '<span style="font-size:15px;">订单耗时</span><br/><span style="color:#00A8FE;font-size:18px;font-weight:600;">'+itemArr[0].avgTime+'分</span>',
  352. '</div>',
  353. '</td>',
  354. '<td>',
  355. '<div class="staff-order-count">',
  356. '<span style="font-size:15px;">订单量</span><br/><span style="color:#00A8FE;font-size:18px;font-weight:600;">'+itemArr[0].orderNum+'笔</span>',
  357. '</div>',
  358. '</td>',
  359. '<td>',
  360. '<div class="staff-alarm">',
  361. '<span style="font-size:15px;">违规告警</span><br/><span style="color:#00A8FE;font-size:18px;font-weight:600;">'+wgCount+'次</span>',
  362. '</div>',
  363. '</td>',
  364. '</tr> ',
  365. '<tr class="td-integral"> ',
  366. '<td colspan="3"> ',
  367. '<div class="integral-label">个人积分:</div> ',
  368. '<div class="integral-value">'+(channelJfMap[itemArr[0].staffCode+'_charge'] || 0)+'分</div> ',
  369. '<div class="integral-label" style="width:60px;">|厅排名</div>',
  370. '<div class="integral-value" style="width:100px;">'+(channelJfMap[itemArr[0].staffCode+"_index"] || 0)+'/'+(channelJfMap["channelLength"] || 0)+'</div>',
  371. '</td> ',
  372. '</tr> ',
  373. ];
  374. var tr2=[];
  375. if(itemArr.length>1){
  376. index++;
  377. var indexClass=(2==index)?"second":"";
  378. var wgCount=staffWgInfo[itemArr[1].staffCode] || "0";
  379. tr2=[
  380. '<tr><td colspan="3"><div class="split-line"></div></td></tr>',
  381. '<tr class="td-avg-time"> ',
  382. '<td colspan="3"> ',
  383. '<div class="index '+indexClass+'">'+itemArr[1].index+'</div>',
  384. '<div class="staff-name">'+itemArr[1].staffName+'</div>',
  385. '<div class="avg-time-label">|&nbsp;&nbsp;厅排名</div>',
  386. '<div class="avg-time-value">'+itemArr[1].index+'|'+channelStaffLen+'</div>',
  387. '</td>',
  388. '</tr>',
  389. '<tr>',
  390. '<td> ',
  391. '<div class="staff-cust-time">',
  392. '<span style="font-size:15px;">订单耗时</span><br/><span style="color:#00A8FE;font-size:18px;font-weight:600;">'+itemArr[1].avgTime+'分</span>',
  393. '</div>',
  394. '</td>',
  395. '<td>',
  396. '<div class="staff-order-count">',
  397. '<span style="font-size:15px;">订单量</span><br/><span style="color:#00A8FE;font-size:18px;font-weight:600;">'+itemArr[1].orderNum+'笔</span>',
  398. '</div>',
  399. '</td>',
  400. '<td>',
  401. '<div class="staff-alarm">',
  402. '<span style="font-size:15px;">违规告警</span><br/><span style="color:#00A8FE;font-size:18px;font-weight:600;">'+wgCount+'次</span>',
  403. '</div>',
  404. '</td>',
  405. '</tr> ',
  406. '<tr class="td-integral"> ',
  407. '<td colspan="3"> ',
  408. '<div class="integral-label">个人积分:</div> ',
  409. '<div class="integral-value">'+(channelJfMap[itemArr[1].staffCode+'_charge'] || 0)+'分</div> ',
  410. '<div class="integral-label" style="width:60px;">|厅排名</div>',
  411. '<div class="integral-value" style="width:100px;">'+(channelJfMap[itemArr[1].staffCode+"_index"] || 0)+'/'+(channelJfMap["channelLength"] || 0)+'</div>',
  412. '</td> ',
  413. '</tr> ',
  414. ]
  415. }
  416. var staffHtml=[
  417. '<div class="swiper-slide">',
  418. '<table>',
  419. tr1.join(""),
  420. tr2.join(""),
  421. '</table>',
  422. '</div> '
  423. ];
  424. html.push(staffHtml.join(""));
  425. }
  426. $("#staff-info").html("");
  427. if(html.length>0){
  428. var dataHtml="<div class='swiper-container visual_swiper_staffInfo'><div class='swiper-wrapper'>"+html.join("")+"</div>"
  429. $("#staff-info").html(dataHtml);
  430. var mySwiper1 = new Swiper('.visual_swiper_staffInfo', {
  431. autoplay: true,//可选选项,自动滑动
  432. speed:1500,//可选选项,滑动速度
  433. autoplay: {
  434. delay: 15000,//毫秒
  435. }
  436. });
  437. }else{
  438. noDataTip($("#staff-info"));
  439. }
  440. }
  441. //加载门店台席健康度详情
  442. function loadChannelDeviceDetail(data){
  443. var html=[];
  444. //设置台席灯
  445. $(".device-alarm").eq(2).find("span[type='greenGrade']").text(data.greenGrade || "0");
  446. $(".device-alarm").eq(1).find("span[type='redGrade']").text(data.redGrade || "0");
  447. $(".device-alarm").eq(0).find("span[type='grayGrade']").text(data.grayGrade || "0");
  448. var deviceInfo=data.deviceInfo;
  449. for(var key in deviceInfo){
  450. var itemArr=deviceInfo[key];
  451. itemArr[0].up=itemArr[0].up || "--";
  452. itemArr[0].down=itemArr[0].down || "--";
  453. var gradeImg="";
  454. if(1==itemArr[0].healthGrade){
  455. gradeImg="device-green.png";
  456. }else if(2==itemArr[0].healthGrade){
  457. gradeImg="device-red.png";
  458. }else{
  459. gradeImg="device-gray.png";
  460. }
  461. var tr1=[
  462. '<tr> ',
  463. '<td rowspan="3" class="device-img">',
  464. '<img src="../static/images/'+gradeImg+'"/>',
  465. '</td> ',
  466. '<td><div class="label-name">台席分数</div></td> ',
  467. '<td rowspan="3" colspan="2" class="kuan-dai"> ',
  468. '<div class="progress-label">上行宽度速率 '+itemArr[0].up+'</div>',
  469. '<div style="width:180px;height:15px;"> ',
  470. '<div class="progress" style="float:left;height:8px;width:180px;background-color:#383E60;">',
  471. '<div class="progress-bar progress-bar-striped" style="min-width:0;width:'+itemArr[0].up.replace("Mbps","")+'%"></div>',
  472. '</div>',
  473. '</div> ',
  474. '<div class="progress-label">下行宽度速率 '+itemArr[0].down+'</div>',
  475. '<div style="width:180px;height:15px;">',
  476. '<div class="progress" style="float:left;height:8px;width:180px;background-color:#383E60;">',
  477. '<div class="progress-bar progress-bar-striped" style="min-width:0;width:'+itemArr[0].down.replace("Mbps","")+'%"></div>',
  478. '</div>',
  479. '</div>',
  480. '</td>',
  481. '</tr>',
  482. '<tr>',
  483. '<td class="label-name score">'+itemArr[0].score+'分</td>',
  484. '</tr>',
  485. '<tr>',
  486. '<td class="label-name"><div class="os-name" title="'+(itemArr[0].osName || "--")+'">'+(itemArr[0].osName || "--")+'</div></td>',
  487. '</tr>',
  488. '<tr class="device-use">',
  489. '<td></td>',
  490. '<td><div class="nei-cun-size"><span>'+(itemArr[0].memory || 0)+'</span></div></td>',
  491. '<td><div class="cpu-use"><span>'+itemArr[0].cpuUsageAvg+'</span></div></td>',
  492. '<td><div class="nei-cun-use"><span>'+itemArr[0].memUsageAvg+'</span></div></td>',
  493. '</tr>',
  494. '<tr>',
  495. '<td></td>',
  496. '<td><div class="labe-value">内存大小</div></td>',
  497. '<td><div class="labe-value">cpu占用率</div></td>',
  498. '<td><div class="labe-value">内存使用率</div></td>',
  499. '</tr>'
  500. ];
  501. var tr2=[];
  502. if(itemArr.length>1){
  503. itemArr[1].up=itemArr[1].up || "--";
  504. itemArr[1].down=itemArr[1].down || "--";
  505. var gradeImg="";
  506. if(1==itemArr[1].healthGrade){
  507. gradeImg="device-green.png";
  508. }else if(2==itemArr[1].healthGrade){
  509. gradeImg="device-red.png";
  510. }else{
  511. gradeImg="device-gray.png";
  512. }
  513. tr2=[
  514. '<tr><td colspan="4"><div class="split-line"></div></td></tr>',
  515. '<tr> ',
  516. '<td rowspan="3" class="device-img">',
  517. '<img src="../static/images/'+gradeImg+'"/>',
  518. '</td> ',
  519. '<td><div class="label-name">台席分数</div></td> ',
  520. '<td rowspan="3" colspan="2" class="kuan-dai"> ',
  521. '<div class="progress-label">上行宽度速率 '+itemArr[1].up+'</div>',
  522. '<div style="width:180px;height:15px;"> ',
  523. '<div class="progress" style="float:left;height:8px;width:180px;background-color:#383E60;">',
  524. '<div class="progress-bar progress-bar-striped" style="min-width:0;width:'+itemArr[1].up.replace("Mbps","")+'%"></div>',
  525. '</div>',
  526. '</div> ',
  527. '<div class="progress-label">下行宽度速率 '+itemArr[1].down+'</div>',
  528. '<div style="width:180px;height:15px;">',
  529. '<div class="progress" style="float:left;height:8px;width:180px;background-color:#383E60;">',
  530. '<div class="progress-bar progress-bar-striped" style="min-width:0;width:'+itemArr[1].down.replace("Mbps","")+'%"></div>',
  531. '</div>',
  532. '</div>',
  533. '</td>',
  534. '</tr>',
  535. '<tr>',
  536. '<td class="label-name score">'+itemArr[1].score+'分</td>',
  537. '</tr>',
  538. '<tr>',
  539. '<td class="label-name"><div class="os-name" title="'+(itemArr[0].osName || "--")+'">'+(itemArr[0].osName || "--")+'</div></td>',
  540. '</tr>',
  541. '<tr class="device-use">',
  542. '<td></td>',
  543. '<td><div class="nei-cun-size"><span>'+(itemArr[1].memory || 0)+'</span></div></td>',
  544. '<td><div class="cpu-use"><span>'+itemArr[1].cpuUsageAvg+'</span></div></td>',
  545. '<td><div class="nei-cun-use"><span>'+itemArr[1].memUsageAvg+'</span></div></td>',
  546. '</tr>',
  547. '<tr>',
  548. '<td></td>',
  549. '<td><div class="labe-value">内存大小</div></td>',
  550. '<td><div class="labe-value">cpu占用率</div></td>',
  551. '<td><div class="labe-value">内存使用率</div></td>',
  552. '</tr>'
  553. ]
  554. }
  555. var deviceHtml=[
  556. '<div class="swiper-slide">',
  557. '<table>',
  558. tr1.join(""),
  559. tr2.join(""),
  560. '</table>',
  561. '</div> '
  562. ];
  563. html.push(deviceHtml.join(""));
  564. }
  565. $("#device-info").html("");
  566. if(html.length>0){
  567. var dataHtml="<div class='swiper-container visual_swiper_deviceInfo'><div class='swiper-wrapper'>"+html.join("")+"</div>"
  568. $("#device-info").html(dataHtml);
  569. var mySwiper1 = new Swiper('.visual_swiper_deviceInfo', {
  570. autoplay: true,//可选选项,自动滑动
  571. speed:1500,//可选选项,滑动速度
  572. autoplay: {
  573. delay: 15000,//毫秒
  574. }
  575. });
  576. }else{
  577. noDataTip($("#device-info"));
  578. }
  579. }
  580. //加载耗时步骤详情
  581. function loadTimeStepDetail(data){
  582. var option = {
  583. tooltip: {trigger: 'axis',},
  584. grid: {left:'6%',right: '5%',bottom:'10%'},
  585. legend: {
  586. icon: 'rect',
  587. itemWidth: 14,itemHeight: 5,itemGap:10,
  588. data:data.legendArr,
  589. left: '10px',top: '0px',
  590. textStyle: {fontSize: 12,color: '#fff'}
  591. },
  592. xAxis: [
  593. {
  594. type: 'category',
  595. axisLine: {lineStyle: {color: '#57617B'}},axisLabel: {interval:0,textStyle: {color:'#fff',}},
  596. data:data.categoryArr
  597. }
  598. ],
  599. yAxis: [{
  600. type: 'value',
  601. axisTick: {
  602. show: false
  603. },
  604. axisLine: {lineStyle: {color: '#57617B'}},
  605. axisLabel: {margin: 10,textStyle: {fontSize: 12},textStyle: {color:'#fff'},formatter:'{value}秒'},
  606. splitLine: {
  607. show: true,
  608. lineStyle:{
  609. type:'dashed',
  610. color: ['#25CEF3']
  611. }
  612. }
  613. }],
  614. series: [
  615. {
  616. name:'厅耗时',
  617. type:'bar',
  618. barWidth:8,
  619. itemStyle : {
  620. normal: {
  621. barBorderRadius:[10, 10, 0, 0],
  622. color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
  623. offset: 0,
  624. color: "#009AFD"
  625. }, {
  626. offset: 0.8,
  627. color: "#33DAFF"
  628. }], false),
  629. shadowColor: 'rgba(0, 0, 0, 0.1)',
  630. }
  631. },
  632. data:data.channelTime
  633. },
  634. {
  635. name:'省耗时',
  636. type:'bar',
  637. barWidth:8,
  638. barGap:2,
  639. itemStyle : {
  640. normal: {
  641. barBorderRadius:[10, 10, 0, 0],
  642. color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
  643. offset: 0,
  644. color: "#E57230"
  645. }, {
  646. offset: 0.8,
  647. color: "#D8AE22"
  648. }], false),
  649. shadowColor: 'rgba(0, 0, 0, 0.1)',
  650. }
  651. },
  652. data:data.provinceTime
  653. }
  654. ]
  655. };
  656. var myChart = echarts.init(document.getElementById('time-step-detial'));
  657. myChart.clear();
  658. if(data.channelTime.length>0){
  659. myChart.setOption(option);
  660. }else{
  661. noDataTip($("#time-step-detial"));
  662. }
  663. }
  664. //加载业务类型耗时详情
  665. function loadBusinessTypeTimeDetail(data){
  666. var maxOrder=Math.max.apply(null,data.orderNum);
  667. var option = {
  668. title : {text:'',subtext:'',top:'3',right:'0'},
  669. tooltip: {trigger: 'axis'},
  670. grid: {left: '8%',right: '8%',bottom: '10%'},
  671. xAxis: {type: 'category',axisLine: {lineStyle: {color: '#57617B'}},axisLabel: {interval:0,textStyle: {color:'#fff',}},data: data.categoryArr},
  672. yAxis:[
  673. {
  674. type: 'value',name: '',
  675. axisLine: {lineStyle: {color: '#57617B'}},
  676. axisLabel: {margin: 10,textStyle: {fontSize: 12},textStyle: {color:'#fff'},formatter:'{value}分'},
  677. splitLine: {show: false}
  678. },
  679. {
  680. type: 'value',name: '',max:maxOrder+parseInt(maxOrder*0.2),
  681. axisLabel: {margin: 10,textStyle: {fontSize: 12},textStyle: {color:'#fff'},formatter:'{value}笔'},
  682. splitLine: {
  683. show: true,
  684. lineStyle:{
  685. type:'dashed',
  686. color: ['#25CEF3']
  687. }
  688. }
  689. }
  690. ],
  691. series: [
  692. {
  693. name:'耗时时间',
  694. type:'line',
  695. yAxisIndex:0,
  696. smooth: false,
  697. symbolSize:5,
  698. lineStyle: { normal: {width: 2}},
  699. areaStyle: {
  700. normal: {
  701. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  702. offset: 0,
  703. color: 'rgba(230, 48, 123, 0.8)'
  704. }, {
  705. offset: 0.8,
  706. color: 'rgba(230, 48, 123, 0)'
  707. }], false),
  708. shadowColor: 'rgba(0, 0, 0, 0.1)',
  709. shadowBlur: 10
  710. }
  711. },
  712. itemStyle: {normal: { color: '#DA2F78'}},
  713. data:data.avgTime
  714. },
  715. {
  716. name:'订单量',
  717. type:'bar',
  718. barWidth:12,
  719. yAxisIndex:1,
  720. itemStyle : {
  721. normal: {
  722. barBorderRadius:[10, 10, 0, 0],
  723. color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
  724. offset: 0,
  725. color: "#4033F9"
  726. }, {
  727. offset: 0.8,
  728. color: "#BA97F9"
  729. }], false),
  730. shadowColor: 'rgba(0, 0, 0, 0.1)',
  731. }
  732. },
  733. data:data.orderNum
  734. }
  735. ]
  736. };
  737. var myChart = echarts.init(document.getElementById('business-type-time-detial'));
  738. myChart.clear();
  739. if(data.orderNum.length>0){
  740. myChart.setOption(option);
  741. }else{
  742. noDataTip($("#business-type-time-detial"));
  743. }
  744. }
  745. //初始化基础信息
  746. function initBaseInfo(){
  747. //初始化日期
  748. /*$("#data-date").my97({
  749. dateFmt:'yyyyMMdd',
  750. minDate:"%y-{%M}-{%d-30}",
  751. maxDate:"%y-%M-{%d}",
  752. startDate: [{
  753. doubleCalendar: false,
  754. isShowWeek: false,
  755. isShowClear: false,
  756. readOnly: true
  757. }],
  758. onpicked:function(dp){
  759. g_dataDate=$('#data-date').val();
  760. $("#query-page-data").trigger("click");
  761. }
  762. });*/
  763. var dataDate="2019年12月31日";
  764. $("#td-data-date").text(dataDate);
  765. $(".cust-type-default").on("click",function(){
  766. $(this).addClass("active").siblings().removeClass("active");
  767. g_custType=$(this).attr("type");
  768. $("#query-page-data").trigger("click");
  769. });
  770. }
  771. //获取渠道参数
  772. function getGroupChannelParam(){
  773. var areaCode="";
  774. try{
  775. var cityId=$('#selectCity').combobox("getValue");
  776. var countyId=$('#selectCounty').combobox("getValue");
  777. if(""==areaCode && ""!=countyId){
  778. areaCode=countyId;
  779. }else if(""==areaCode && ""!=cityId){
  780. areaCode=cityId;
  781. }
  782. }catch(e){
  783. }
  784. var channelName=$.trim($("#channel_name").val());
  785. var channelParam={'areaCode':areaCode,"channelName":channelName};
  786. return channelParam;
  787. }
  788. function noDataTip($selector){
  789. var currModH=$selector.height();
  790. var top=currModH>180?"35%":"13%";
  791. var $li=[
  792. "<div class='no-data' style='width:90%;position: absolute;top:"+top+";text-align:center;color:#a59999;'>",
  793. "<img src='../static/images/no-data.png' style='width:200px;height:200px;'/>",
  794. "<div style='font-size:16px;opacity:0.7;color:#fff;'>暂无数据</div>",
  795. "</div>"
  796. ]
  797. $selector.append($li.join(""));
  798. }
  799. function keepTwoDecimal(currVal){
  800. var result = parseFloat(currVal);
  801. if (isNaN(result)) {
  802. return false;
  803. }
  804. result = Math.round(currVal *100) / 100;
  805. return result;
  806. }
  807. //初始化页面
  808. function loadPageData(){
  809. //获取渠道信息
  810. var groupChannelInfo=g_channelInfo;
  811. //第一步:优先判断url请求参数里面
  812. let param=JSON.parse(gDataGather.param);
  813. if(Object.keys(param).length>0){
  814. groupChannelInfo=param;
  815. gDataGather.param="{}";
  816. }
  817. if(Object.keys(groupChannelInfo).length==0){
  818. groupChannelInfo=window.localStorage.getItem("group-channel-info");
  819. if(undefined==groupChannelInfo || null==groupChannelInfo){
  820. groupChannelInfo={"channelCode":"11228790","groupChannelCode":"3201001965930","channelName":"中国电信南京分公司@玄武大钟亭营业厅"};
  821. }else{
  822. groupChannelInfo=JSON.parse(groupChannelInfo);
  823. }
  824. }else{
  825. window.localStorage.setItem("group-channel-info",JSON.stringify(groupChannelInfo));
  826. }
  827. //设置全局渠道编码、渠道名称
  828. g_channelCode=groupChannelInfo.channelCode;
  829. g_channelName=groupChannelInfo.channelName;
  830. //开始动画特效
  831. $('#load').show();
  832. $('#load').fadeOut(500,function(){
  833. });
  834. //引入office_efficiency_data.js缓存假数据
  835. if(data.code==0){
  836. $(".no-data").remove();
  837. //加载门店基本信息
  838. loadChannelBaseInfo(data);
  839. //加载门店历史受理详情
  840. loadChannelHandleDetail(data.channelHandleInfo);
  841. //加载营业员受理详情
  842. loadStaffHandleDetail(data.staffHandleInfo);
  843. //加载门店台席健康度详情
  844. loadChannelDeviceDetail(data.channelDeviceInfo);
  845. //加载耗时步骤分析
  846. loadTimeStepDetail(data.timeStepAnalysis);
  847. //加载业务类型耗时详情
  848. loadBusinessTypeTimeDetail(data.businessTypeAnalysis);
  849. }
  850. }
  851. $(function(){
  852. //加载基础信息
  853. initBaseInfo();
  854. //加载页面数据
  855. loadPageData();
  856. })