xuqiantongji.js 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208
  1. var self;
  2. var type, level, area, title,sort=1,banerIndex;
  3. var roleLevel, userRole;
  4. var startDate = null;//近3月的开始时间
  5. var endDate = null;//近3月的结束时间
  6. var customHeight = 63;//自定义折线图、柱状图混合表中各项的高度
  7. var scroller1 = null;
  8. var old_back = mui.back;
  9. var curLeveArr = null;//当前级别需要请求的url参数集合
  10. var lowCode; //记录选中其他维度的参数
  11. var taskNum = 0;//任务量
  12. var dateData = {};//趋势图数据
  13. var isInit = true;
  14. var CITY_CODE = "350200";//默认厦门市
  15. var TD_PAGE_SIZE = 20;//所有团队数据分页条数
  16. var current_team_index = 0;//所有团队显示的索引值
  17. var team_data_list = null;//所有团队数据(签约量)
  18. var team_name_list = null;//所有团队数据(名称)
  19. var team_top_list = null;//所有团队数据(排名数据)
  20. var team_scroller = null;
  21. var lineIndexArr = {1: 42, 2: 43, 3: 44, 4: 29}; //折线图中对应的index参数值
  22. //定义年份
  23. var chooseYear;
  24. var now = new Date();
  25. if(now.getMonth() >= 6){
  26. chooseYear = now.getFullYear();
  27. }else{
  28. chooseYear = now.getFullYear() - 1;
  29. }
  30. mui.plusReady(function() {
  31. self = plus.webview.currentWebview();
  32. type = self.type;
  33. startDate = getStartDate();
  34. endDate = getEndDate();
  35. initData();//数据初始化
  36. initScroller();//scroll初始化
  37. shaixuanInit(self);
  38. bindEvents();//事件绑定
  39. });
  40. /*****************************************************************************/
  41. /***** 页面初始化处理 **********/
  42. /*****************************************************************************/
  43. var initData = function(){
  44. // userRole = plus!=null ?JSON.parse(plus.storage.getItem("userRole"))[0]:{} ;
  45. userRole = plus!=null ? JSON.parse(plus.storage.getItem("selectedRole")): {};
  46. roleLevel = userRole.code == CITY_CODE ? 4 : userRole.code.length==6 ? 3 : 2;
  47. level = roleLevel;
  48. area = userRole.code;
  49. title = userRole.name;
  50. plus.storage.setItem("userLevel",level+"");
  51. plus.storage.setItem("userArea",area);
  52. //初始默认选中的时间和类型
  53. $(".choose-label").text("(所有居民)");
  54. //搜集页面请求的参数
  55. var paramsArr = [],requestArr = [];
  56. var index = 29; //签入: 34, 签出: 35
  57. if(level==4){//市管
  58. paramsArr.push({tags:["各区","社区","团队"],curTitle:title,level:level},
  59. {reqUrl:"/statistics/getRenewPercentAndChangePercent",params:{ year: 2017,code:area,level:level, index: 29}},
  60. {reqUrl:"/statistics/interval_total",params:{level: level, area: area, startDate: startDate, endDate: endDate, interval:"1",index:29}},
  61. {reqUrl:"/statistics/lowlevel_all_sign_renew",params:{sort:1,date:endDate,level:level,index:44,area:area}},
  62. {reqUrl:"/statistics/lowlevel_all_sign_renew",params:{sort:1,date:endDate,level:level,index:43,area:area,lowLevel:2}},
  63. {reqUrl:"/statistics/lowlevel_all_sign_renew",params:{sort:1,date:endDate,level:level,index:42,area:area,lowLevel:1}});
  64. }else if(level==3){//区管
  65. paramsArr.push({tags:["社区","团队"],curTitle:title,level:level},
  66. {reqUrl:"/statistics/getRenewPercentAndChangePercent",params:{year: 2017,code:area,level:level, index: 44}},
  67. {reqUrl:"/statistics/interval_total",params:{level: level, area: area, startDate: startDate, endDate: endDate, interval:"1",index:44}},
  68. {reqUrl:"/statistics/lowlevel_all_sign_renew",params:{sort:1,date:endDate,level:level,index:43,area:area}},
  69. {reqUrl:"/statistics/lowlevel_all_sign_renew",params:{sort:1,date:endDate,level:level,index:42,area:area,lowLevel:1}});
  70. }else if(level==2){//社区管
  71. paramsArr.push({tags:["团队"],curTitle:title,level:level},
  72. {reqUrl:"/statistics/getRenewPercentAndChangePercent",params:{year: 2017,code:area,level:level, index: 43}},
  73. {reqUrl:"/statistics/interval_total",params:{level: level, area: area, startDate: startDate, endDate: endDate, interval:"1",index:43}},
  74. {reqUrl:"/statistics/lowlevel_all_sign_renew",params:{sort:1,date:endDate,level:level,index:42,area:area}});
  75. }
  76. requestArr.push(paramsArr);
  77. plus.storage.setItem("levelParamsArr",JSON.stringify(requestArr));
  78. curLeveArr = paramsArr;
  79. loadAllData(paramsArr);
  80. },
  81. loadAllData = function(arr){
  82. plus.nativeUI.showWaiting();
  83. //1-1:加载数据截止时间
  84. sendPost("/statistics/time",null,function(res){
  85. },function(res){
  86. if(res.status=="200"){
  87. var date = (res.data && res.data.substring(11,16)) || "";
  88. $(".jiezhi-time").html(date)
  89. }
  90. });
  91. //1-2: 显示title
  92. title = arr[0].curTitle;
  93. if(arr[0].level==4){
  94. title = title.substring(0,3);
  95. }
  96. $("#title").html(title);
  97. //1-3 :加载tab
  98. var tagsArr = arr[0].tags;
  99. var tagStr = "";
  100. for(var i=0;i<tagsArr.length;i++){
  101. var classz = i==0?"hit":"";
  102. var dataClick = i==0?"true":"false";//是否已点击过
  103. tagStr += '<li class="'+classz+'" data-click="'+dataClick+'"><a href="#" class="c-f16">'+tagsArr[i]+'</a></li>';
  104. }
  105. $(".c-lab-mor").html(tagStr);
  106. $(".div-data-list").hide();
  107. $(".div-data-list.div-list0").show();
  108. if($(".c-lab-mor li.hit a").html()=="团队" || tagsArr.length==1){
  109. $(".div-right-danwei").html("人");
  110. }else{
  111. $(".div-right-danwei").html("千人");
  112. }
  113. var index = lineIndexArr[level];
  114. //1-4 :加载签约率、完成率
  115. // arr[1].params.index = index;
  116. sendGet(arr[1].reqUrl, arr[1].params, null, countHandle, true);
  117. //1-5:趋势图表
  118. var interval = parseInt(arr[2].params.interval)-1 || 0;
  119. $('.div-btn-group .div-btn').removeClass("active");
  120. $('.div-btn-group .div-btn').eq(interval).addClass("active");
  121. // arr[2].params.index = index;
  122. sendPost(arr[2].reqUrl, arr[2].params, null, dateLineHandle);
  123. //1-6:加载【第一个】tab标签数据
  124. // arr[3].params.index = index - 1;
  125. sendPost(arr[3].reqUrl, arr[3].params, null, listHandle);
  126. },
  127. initScroller = function(){
  128. window.scroller1 = $("#wrapper1").initScroll(
  129. {
  130. pullDownAction: function(){
  131. current_team_index = 0;
  132. $(".pullDown").show();
  133. plus.nativeUI.showWaiting();
  134. loadAllData(curLeveArr);
  135. },pullUpAction: function() {
  136. $(".pullUp").hide();
  137. if($(".c-lab-mor li.hit a").html()=="团队"){//团队tab页才做分页
  138. if(current_team_index==(Object.keys(team_data_list).length-1)){
  139. mui.toast("没有更多数据了...");
  140. $(".pullUp").hide();
  141. plus.nativeUI.closeWaiting();
  142. return false;
  143. }
  144. $(".pullUp").show();
  145. plus.nativeUI.showWaiting();
  146. current_team_index++;
  147. loadTeamData(team_data_list[current_team_index],team_top_list[current_team_index],true);
  148. }
  149. return false;
  150. }
  151. }
  152. );
  153. },
  154. /**
  155. * 初始化筛选事件
  156. */
  157. shaixuanInit = function(main){
  158. var shaixuan = plus.webview.getWebviewById('xq-shaixuan.html');
  159. if(!shaixuan){
  160. shaixuan = mui.createWindow({
  161. id: 'xq-shaixuan.html',
  162. url: 'xq-shaixuan.html',
  163. styles: {
  164. top: 0,
  165. bottom: 0,
  166. left: '20%',
  167. width: '80%',
  168. scorllIndicator: "none"
  169. },
  170. show:{
  171. aniShow: "slide-in-right",
  172. duration: "400"
  173. },
  174. extras:{
  175. }
  176. });
  177. }
  178. window.addEventListener("hideShaiXuan",function(){
  179. console.log("hideShaiXuan");
  180. main.setStyle({mask:"none"});
  181. shaixuan.hide();
  182. }, false);
  183. window.addEventListener("showShaiXuan", function() {
  184. shaixuan.show();
  185. main.setStyle({mask:"rgba(0,0,0,0.5)"});
  186. main.addEventListener("maskClick",function(){
  187. main.setStyle({mask:"none"});
  188. shaixuan.hide();
  189. }, false);
  190. });
  191. },
  192. bindEvents = function(){
  193. //标签切换
  194. $(".c-lab-mor").on("tap","li",function(){
  195. var liIndex = $(this).index();
  196. var tabid = $(this).attr("id");
  197. var top = $(this).offset().top;
  198. $(".c-lab-mor li").removeClass("hit");
  199. $(this).addClass("hit");
  200. var tabName = $(".c-lab-mor li.hit a").html();
  201. //1-6:加载tab标签数据
  202. if($(this).attr("data-click")=="false"){//tab数据未加载
  203. plus.nativeUI.showWaiting();
  204. var index ;
  205. if(tabName == "各区"){
  206. // index = 29;
  207. // curLeveArr[3].params.index = index;
  208. sendPost(curLeveArr[3].reqUrl, curLeveArr[3].params, null, listHandle);
  209. }else if(tabName == "社区"){//社区数据
  210. // index = 43;
  211. // curLeveArr[4].params.index = index;
  212. if(curLeveArr.length == 5){
  213. sendPost(curLeveArr[3].reqUrl, curLeveArr[3].params, null, listHandle);
  214. }else{
  215. sendPost(curLeveArr[4].reqUrl, curLeveArr[4].params, null, listHandle);
  216. }
  217. }else if(tabName == "团队"){//团队数据
  218. // index = 42;
  219. // curLeveArr[5].params.index = index;
  220. if(curLeveArr.length == 6){
  221. sendPost(curLeveArr[5].reqUrl, curLeveArr[5].params, null, listHandle);
  222. }else if(curLeveArr.length == 5){
  223. sendPost(curLeveArr[4].reqUrl, curLeveArr[4].params, null, listHandle);
  224. }else{
  225. sendPost(curLeveArr[3].reqUrl, curLeveArr[3].params, null, listHandle);
  226. }
  227. }
  228. $(this).attr("data-click","true");
  229. }
  230. $(".div-data-list").hide();
  231. $(".div-list"+liIndex).show();
  232. $(".div-list1 li .div-name,.div-list1 li .div-amount,.div-list2 li .div-name,.div-list2 li .div-amount").each(function(){
  233. if($(this).height()==21){
  234. $(this).addClass("mt20")
  235. }else if($(this).height()==42){
  236. $(this).addClass("mt10")
  237. }
  238. })
  239. if($(".c-lab-mor li.hit a").html()=="团队"){
  240. $(".div-right-danwei").html("人");
  241. }else{
  242. $(".div-right-danwei").html("千人");
  243. }
  244. scroller1.refresh();
  245. window.onscroll = function () {
  246. var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
  247. if(top!=-1 && top>0){
  248. window.scrollTo(0,top);
  249. top = -1;
  250. }
  251. }
  252. });
  253. //日、周、月按钮切换
  254. $(".div-btn-group").on("click",".div-btn",function(){
  255. var dataId = $(this).attr("data-id");
  256. $(".div-btn-group .div-btn").removeClass("active");
  257. $(this).addClass("active");
  258. //1-5:趋势图表
  259. curLeveArr[2].params.interval = dataId;
  260. // curLeveArr[2].params.index = lineIndexArr[level];
  261. sendPost(curLeveArr[2].reqUrl, curLeveArr[2].params, null, dateLineHandle);
  262. });
  263. $(".scroll-wrapper").on("tap",".div-data-list .list-ul .div-name",function(event){
  264. if($(".c-lab-mor li.hit a").html()=="团队") {
  265. sendGet("/doctor/admin-teams/teams/info",{teamId:$(this).closest("li").attr("data-code")},function(res){
  266. },function(res){
  267. if(res.status==200){
  268. var team = res.data.team;
  269. var members = res.data.members;
  270. $(".span-name").html(team.name || "");
  271. $(".span-hospitalName").html(team.hospitalName || "");
  272. $(".span-leaderName").html(team.leaderName || "");
  273. $(".span-team-count").html(members.length.toString());
  274. var membersName = "";
  275. for(var i=0;i<members.length;i++){
  276. if(i==20) break;
  277. membersName+=members[i].name+"、";
  278. }
  279. if(members.length>20){
  280. membersName = membersName!=""?membersName.substring(0,membersName.length-1)+"等":membersName;
  281. }else{
  282. membersName = membersName!=""?membersName.substring(0,membersName.length-1):membersName;
  283. }
  284. $(".span-members").html(membersName);
  285. $(".modal-overlay").addClass("modal-overlay-visible");
  286. setTimeout(function(){
  287. $(".modal-content").show();
  288. },50)
  289. }else{
  290. mui.toast("暂无相关团队详情!");
  291. }
  292. });
  293. return false;
  294. }
  295. level = curLeveArr[0].level;
  296. level--;
  297. area = $(this).closest("li").attr("data-code");
  298. var name = $(this).closest("li").attr("data-name");
  299. title = name;
  300. $("#title").html(title);
  301. var paramsArr = [];
  302. var index = 29;
  303. if(!lowCode || lowCode=='0'){
  304. if(level==3 && $(".c-lab-mor li.hit a").html()=="各区"){//区管
  305. paramsArr.push({tags:["社区","团队"],curTitle:title,level:level},
  306. {reqUrl:"/statistics/getRenewPercentAndChangePercent",params:{year: 2017,code:area,level:level, index: 44}},
  307. {reqUrl:"/statistics/interval_total",params:{level: level, area: area, startDate: startDate, endDate: endDate, interval:$('.div-btn-group .div-btn.active').attr('data-id'),index: 44}},
  308. {reqUrl:"/statistics/lowlevel_all_sign_renew",params:{sort:1,date:endDate,level:level,index:43,area:area}},
  309. {reqUrl:"/statistics/lowlevel_all_sign_renew",params:{sort:1,date:endDate,level:level,index:42,area:area,lowLevel:1}});
  310. }else{//社区管
  311. paramsArr.push({tags:["团队"],curTitle:title,level:2},
  312. {reqUrl:"/statistics/getRenewPercentAndChangePercent",params:{year: 2017,code:area,level:2, index: 43}},
  313. {reqUrl:"/statistics/interval_total",params:{level: 2, area: area, startDate: startDate, endDate: endDate, interval:$('.div-btn-group .div-btn.active').attr('data-id'),index:43}},
  314. {reqUrl:"/statistics/lowlevel_all_sign_renew",params:{sort:1,date:endDate,level:2,index:42,area:area}});
  315. }
  316. }else{
  317. if(level==3 && $(".c-lab-mor li.hit a").html()=="各区"){//区管
  318. paramsArr.push({tags:["社区","团队"],curTitle:title,level:level},
  319. {reqUrl:"/statistics/getRenewPercentAndChangePercent",params:{year: 2017,code:area,level:level, index: 54, lowCode: lowCode}},
  320. {reqUrl:"/statistics/interval_total",params:{level: level, area: area, startDate: startDate, endDate: endDate, interval:$('.div-btn-group .div-btn.active').attr('data-id'),index: 54, lowCode: lowCode}},
  321. {reqUrl:"/statistics/lowlevel_all_sign_renew",params:{sort:1,date:endDate,level:level,index:53,area:area, lowCode: lowCode}},
  322. {reqUrl:"/statistics/lowlevel_all_sign_renew",params:{sort:1,date:endDate,level:level,index:52,area:area,lowLevel:1, lowCode: lowCode}});
  323. }else{//社区管
  324. paramsArr.push({tags:["团队"],curTitle:title,level:2},
  325. {reqUrl:"/statistics/getRenewPercentAndChangePercent",params:{year: 2017,code:area,level:2, index: 53, lowCode: lowCode}},
  326. {reqUrl:"/statistics/interval_total",params:{level: 2, area: area, startDate: startDate, endDate: endDate, interval:$('.div-btn-group .div-btn.active').attr('data-id'),index:53, lowCode: lowCode}},
  327. {reqUrl:"/statistics/lowlevel_all_sign_renew",params:{sort:1,date:endDate,level:2,index:52,area:area, lowCode: lowCode}});
  328. }
  329. }
  330. var existArr = JSON.parse(plus.storage.getItem("levelParamsArr"));
  331. existArr.push(paramsArr);
  332. plus.storage.setItem("levelParamsArr",JSON.stringify(existArr));
  333. curLeveArr = paramsArr;
  334. current_team_index = 0;
  335. loadAllData(paramsArr);
  336. event.preventDefault();
  337. return false;
  338. });
  339. //转签率点击了进入续签分析页面
  340. $("#zhuanqianWrap").on("tap", function(){
  341. if(!lowCode || lowCode=='0'){
  342. mui.openWindow({
  343. url: "renew-analysis.html",
  344. id: "renew-analysis.html",
  345. extras:{
  346. level:curLeveArr[0].level,
  347. code:area,
  348. title: title
  349. }
  350. });
  351. }
  352. })
  353. //说明信息相关事件
  354. $("#closeBtn").on("tap", function(){
  355. $(".information").hide();
  356. scroller1.refresh();
  357. });
  358. $(".info-icon").on("tap", function(){
  359. $(".information").show();
  360. scroller1.refresh();
  361. });
  362. //弹出遮罩
  363. $(".icon-remark").on("click", function(e) {
  364. $(".modal-overlay").addClass("modal-overlay-visible");
  365. setTimeout(function(){
  366. $(".modal-content").show();
  367. },50)
  368. });
  369. $(".div-close,.modal-overlay").on("click",function(){
  370. $(".modal-overlay").removeClass("modal-overlay-visible");
  371. $(".modal-content").hide();
  372. });
  373. //左滑筛选区域的数据
  374. $('.header-link').on("tap", function(){
  375. var self = plus.webview.currentWebview();
  376. mui.fire(self, "showShaiXuan");
  377. });
  378. //添加页面监听
  379. window.addEventListener("refresh", function(e){
  380. lowCode = e.detail.lowCode;
  381. var name = e.detail.name;
  382. $(".choose-label").text("("+name+")");
  383. level = roleLevel;
  384. area = userRole.code;
  385. title = userRole.name;
  386. var paramsArr = [];
  387. var index = 29;
  388. if(lowCode == '0'){
  389. if(level==4){//市管
  390. paramsArr.push({tags:["各区","社区","团队"],curTitle:title,level:level},
  391. {reqUrl:"/statistics/getRenewPercentAndChangePercent",params:{ year: 2017,code:area,level:level, index: 29}},
  392. {reqUrl:"/statistics/interval_total",params:{level: level, area: area, startDate: startDate, endDate: endDate, interval:"1",index:29}},
  393. {reqUrl:"/statistics/lowlevel_all_sign_renew",params:{sort:1,year:2017,level:level,index:44,area:area}},
  394. {reqUrl:"/statistics/lowlevel_all_sign_renew",params:{sort:1,year:2017,level:level,index:43,area:area,lowLevel:2}},
  395. {reqUrl:"/statistics/lowlevel_all_sign_renew",params:{sort:1,year:2017,level:level,index:42,area:area,lowLevel:1}});
  396. }else if(level==3){//区管
  397. paramsArr.push({tags:["社区","团队"],curTitle:title,level:level},
  398. {reqUrl:"/statistics/getRenewPercentAndChangePercent",params:{year: 2017,code:area,level:level, index: 44}},
  399. {reqUrl:"/statistics/interval_total",params:{level: level, area: area, startDate: startDate, endDate: endDate, interval:"1",index:44}},
  400. {reqUrl:"/statistics/lowlevel_all_sign_renew",params:{sort:1,year:2017,level:level,index:43,area:area}},
  401. {reqUrl:"/statistics/lowlevel_all_sign_renew",params:{sort:1,year:2017,level:level,index:42,area:area,lowLevel:1}});
  402. }else if(level==2){//社区管
  403. paramsArr.push({tags:["团队"],curTitle:title,level:level},
  404. {reqUrl:"/statistics/getRenewPercentAndChangePercent",params:{year: 2017,code:area,level:level, index: 43}},
  405. {reqUrl:"/statistics/interval_total",params:{level: level, area: area, startDate: startDate, endDate: endDate, interval:"1",index:43}},
  406. {reqUrl:"/statistics/lowlevel_all_sign_renew",params:{sort:1,year:2017,level:level,index:42,area:area}});
  407. }
  408. }else{
  409. var index = 51; //签入: 34, 签出: 35
  410. if(level==4){//市管
  411. paramsArr.push({tags:["各区","社区","团队"],curTitle:title,level:level},
  412. {reqUrl:"/statistics/getRenewPercentAndChangePercent",params:{ year: 2017,code:area,level:level, index: 51, lowCode: lowCode}},
  413. {reqUrl:"/statistics/interval_total",params:{level: level, area: area, startDate: startDate, endDate: endDate, interval:"1",index:51, lowCode: lowCode}},
  414. {reqUrl:"/statistics/lowlevel_all_sign_renew",params:{sort:1,year:2017,level:level,index:54,area:area, lowCode: lowCode}},
  415. {reqUrl:"/statistics/lowlevel_all_sign_renew",params:{sort:1,year:2017,level:level,index:53,area:area,lowLevel:2, lowCode: lowCode}},
  416. {reqUrl:"/statistics/lowlevel_all_sign_renew",params:{sort:1,year:2017,level:level,index:52,area:area,lowLevel:1, lowCode: lowCode}});
  417. }else if(level==3){//区管
  418. paramsArr.push({tags:["社区","团队"],curTitle:title,level:level},
  419. {reqUrl:"/statistics/getRenewPercentAndChangePercent",params:{year: 2017,code:area,level:level, index: 54, lowCode: lowCode}},
  420. {reqUrl:"/statistics/interval_total",params:{level: level, area: area, startDate: startDate, endDate: endDate, interval:"1",index:54, lowCode: lowCode}},
  421. {reqUrl:"/statistics/lowlevel_all_sign_renew",params:{sort:1,year:2017,level:level,index:53,area:area, lowCode: lowCode}},
  422. {reqUrl:"/statistics/lowlevel_all_sign_renew",params:{sort:1,year:2017,level:level,index:52,area:area,lowLevel:1, lowCode: lowCode}});
  423. }else if(level==2){//社区管
  424. paramsArr.push({tags:["团队"],curTitle:title,level:level},
  425. {reqUrl:"/statistics/getRenewPercentAndChangePercent",params:{year: 2017,code:area,level:level, index: 53, lowCode: lowCode}},
  426. {reqUrl:"/statistics/interval_total",params:{level: level, area: area, startDate: startDate, endDate: endDate, interval:"1",index:53, lowCode: lowCode}},
  427. {reqUrl:"/statistics/lowlevel_all_sign_renew",params:{sort:1,year:2017,level:level,index:52,area:area, lowCode: lowCode}});
  428. }
  429. }
  430. var existArr = JSON.parse(plus.storage.getItem("levelParamsArr"));
  431. //清空数据,然后再存储新的路径
  432. existArr.splice(0, existArr.length);
  433. existArr.push(paramsArr);
  434. plus.storage.setItem("levelParamsArr",JSON.stringify(existArr));
  435. curLeveArr = paramsArr;
  436. current_team_index = 0;
  437. loadAllData(paramsArr);
  438. });
  439. };
  440. /*****************************************************************************/
  441. /***** 数据返回处理函数 **********/
  442. /*****************************************************************************/
  443. var countHandle = function(res){
  444. if(res.status == 200) {
  445. res = res.data;
  446. //折线图目标量是去年的签约量
  447. taskNum = parseInt(res.yesterYearSign);
  448. $('#xuqianlv').waterbubble({
  449. txt: res.renewRange,
  450. data: parseFloat(res.renewRange)/100,
  451. waterColor: '#12B7F5',
  452. lineWidth:0,
  453. radius: 75,
  454. textColor: 'rgba(0, 0, 0, 0.8)',
  455. font: 'bold 25px arial'
  456. });
  457. $(".p-xuqianlv").html("<span class='c-17b3ec'>"+res.thisYearRenew+"</span>/"+res.yesterYearSign);
  458. $('#zhuanqianlv').waterbubble({
  459. txt: res.switchRange,
  460. data: parseFloat(res.switchRange)/100,
  461. waterColor: '#4ECD70',
  462. lineWidth:0,
  463. radius: 75,
  464. textColor: 'rgba(0, 0, 0, 0.8)',
  465. font: 'bold 25px arial'
  466. });
  467. $(".p-zhuanqianlv").html("<span class='c-4ECD70'>"+res.thisYearSwithch+"</span>/"+res.thisYearRenew);
  468. } else {
  469. mui.toast(res.msg);
  470. }
  471. },
  472. dateLineHandle = function(res){
  473. if(res.status==200){
  474. for(var p in res.data){
  475. taskNum = taskNum;
  476. dateData[p] = formatDateData(res.data[p].data);
  477. if(dateData[p].amountArr && dateData[p].amountArr.length>0){
  478. $('#l-jmfx').show();
  479. $(".l-zxt-con").hide();
  480. mui.later(function(){
  481. $(".l-zxt-con").show();
  482. }, 100);
  483. $("#echarts_wushuju").hide();
  484. } else{
  485. $(".l-zxt-con").hide();
  486. $("#echarts_wushuju").show();
  487. }
  488. drawChart(dateData[p]);//初始化折线图
  489. }
  490. } else {
  491. mui.toast(res.msg);
  492. }
  493. plus.nativeUI.closeWaiting();
  494. },
  495. listHandle = function(res){
  496. if(res.status == 200) {
  497. res = res.data;
  498. var isTD = false;
  499. for(var k in res){
  500. var list = res[k];
  501. var topArr = soreRank(renewArr(list));
  502. var liIndex = $(".c-lab-mor li.hit").index();
  503. if($(".c-lab-mor li.hit a").html()=="团队"){//社区看团队数据
  504. isTD = true;
  505. teamFenYeFun(list,topArr);
  506. }else{
  507. var resultStr = "";
  508. var topClass = "";
  509. var qylResultStr = "";
  510. var qylClass = "c-a0dc28";
  511. // if($(".c-lab-mor li.hit a").html()=="团队"){
  512. // qylClass = "c-17b8ec";
  513. // }
  514. for(var j in list){
  515. switch (topArr[j]){
  516. case 1:
  517. topClass="cb-EA5B3A";
  518. break;
  519. case 2:
  520. topClass="cb-FF8746";
  521. break;
  522. case 3:
  523. topClass="cb-69CA2E";
  524. break;
  525. default:
  526. topClass="cb-3DA9CE";
  527. break;
  528. }
  529. resultStr+='<li data-name="'+list[j].name+'" data-code="'+list[j].code+'">'+
  530. '<div class="div-top '+topClass+' c-f10">'+topArr[j]+'</div>'+
  531. '<div class="div-name f-fs14">'+list[j].name+'</div>'+
  532. '</li>';
  533. qylResultStr+='<li>'+'<div class="div-amount c-f10 mr10 mt20 '+qylClass+'">'+(parseFloat(list[j].signNum)/1000).toFixed(2)+'</div>'+'</li>';
  534. }
  535. $(".div-list"+liIndex).show();
  536. $(".div-list"+liIndex+" .list-ul").html(resultStr);
  537. $(".div-list"+liIndex+" .div-right-data-content .list-ul").html(qylResultStr);
  538. $(".div-list"+liIndex+" li .div-name,"+".div-list"+liIndex+" li .div-amount").each(function(){
  539. if($(this).height()==21){
  540. $(this).addClass("mt20")
  541. }else if($(this).height()==42){
  542. $(this).addClass("mt10")
  543. }
  544. })
  545. if(list.length==0){
  546. scroller1.refresh();
  547. plus.nativeUI.closeWaiting();
  548. return false;
  549. }
  550. //加载图表数据
  551. var amountArrS = amountArr(list).reverse();//签约量
  552. var nameArrs = nameArr(list).reverse();//名称
  553. $("#chart-main"+liIndex).height(list.length*customHeight+100);
  554. $(".div-list"+liIndex+" .div-right-content").show();
  555. var rateArrS = rateArr(list).reverse();//签约率
  556. var renewArrS = renewArr(list).reverse();//续签量
  557. var qylAmountArr = arr_dive_qyl(amountArrS,renewArrS);//签约量
  558. echartsCCFun("chart-main"+liIndex,qylAmountArr,renewArrS,rateArrS,nameArrs);//区进展、社区进展的图表
  559. }
  560. scroller1.refresh();
  561. plus.nativeUI.closeWaiting();
  562. }
  563. } else {
  564. mui.toast(res.msg);
  565. }
  566. },
  567. teamFenYeFun = function(recordList,topArr){
  568. if(recordList){
  569. team_top_list = _.groupBy(topArr,function(item,i){return Math.floor(i/TD_PAGE_SIZE)});
  570. team_data_list = _.groupBy(recordList,function(item,i){return Math.floor(i/TD_PAGE_SIZE)});
  571. if(team_data_list){
  572. loadTeamData(team_data_list[current_team_index],team_top_list[current_team_index],false);
  573. }
  574. }
  575. },
  576. loadTeamData = function(list,topArr,isPullUp){
  577. var resultStr = "";
  578. var topClass = "";
  579. var qylResultStr = "";
  580. var qylClass = "c-a0dc28";
  581. var liIndex = $(".c-lab-mor li.hit").index();
  582. if(isPullUp){
  583. var newLiIndex = $(".div-data-list").length;
  584. var chartMainId = "chart-main"+newLiIndex;
  585. var divListClassz = "div-list"+newLiIndex;
  586. var addDivList = '<div class="div-data-list '+divListClassz+' f-dn" style="position: relative;">'+
  587. '<div class="div-left-content" style="top: 0px;">'+
  588. '<ul class="list-ul"></ul>'+
  589. '</div>'+
  590. '<div class="div-right-data-content" style="top: 0px;">'+
  591. '<ul class="list-ul f-fr"></ul>'+
  592. '</div>'+
  593. '<div id="'+chartMainId+'" style="width: 100%; margin: 0px 0px 0px 35px;"></div>'+
  594. '</div>';
  595. $(".div-data-list:last").after(addDivList);
  596. liIndex = newLiIndex;
  597. }
  598. setTimeout(function(){
  599. var amountArrS = amountArr(list, true).reverse();//签约量
  600. var nameArrs = nameArr(list);//名称
  601. for(var j in list){
  602. switch (topArr[j]){
  603. case 1:
  604. topClass="cb-EA5B3A";
  605. break;
  606. case 2:
  607. topClass="cb-FF8746";
  608. break;
  609. case 3:
  610. topClass="cb-69CA2E";
  611. break;
  612. default:
  613. topClass="cb-3DA9CE";
  614. break;
  615. }
  616. var redClass = list[j].signNum>1500?"c-EA5B3A":"";
  617. resultStr+='<li data-name="'+list[j].name+'" data-code="'+list[j].code+'">'+
  618. '<div class="div-top '+topClass+' c-f10">'+topArr[j]+'</div>'+
  619. '<div class="div-name f-fs14 '+redClass+'">'+(list[j].name || "未知")+'</div>'+
  620. '</li>';
  621. qylResultStr+='<li>'+'<div class="div-amount mr10 mt20 '+qylClass+'">'+list[j].signNum+'</div>'+'</li>';
  622. }
  623. $(".div-list"+liIndex).show();
  624. $(".div-list"+liIndex+" .list-ul").html(resultStr);
  625. $(".div-list"+liIndex+" .div-right-data-content .list-ul").html(qylResultStr);
  626. $(".div-list"+liIndex+" li .div-name,"+".div-list"+liIndex+" li .div-amount").each(function(){
  627. if($(this).height()==21){
  628. $(this).addClass("mt20")
  629. }else if($(this).height()==42){
  630. $(this).addClass("mt10")
  631. }
  632. })
  633. if(!list){
  634. scroller1.refresh();
  635. plus.nativeUI.closeWaiting();
  636. return false;
  637. }
  638. $(".div-list"+liIndex+" .div-right-content").show();
  639. if(!list){
  640. $(".div-right-danwei").hide();
  641. $("#chart-main"+liIndex).hide();
  642. }else{
  643. $(".div-right-danwei").show();
  644. $("#chart-main"+liIndex).show();
  645. var heightM = current_team_index==0?list.length*customHeight+30:list.length*customHeight;
  646. $("#chart-main"+liIndex).height(heightM);
  647. var rateArrS = rateArr(list).reverse();//签约率
  648. var renewArrS = renewArr(list, true).reverse();//续签量
  649. var qylAmountArr = arr_dive_qyl(amountArrS,renewArrS);//签约量
  650. echartsTDFun("chart-main"+liIndex,qylAmountArr,renewArrS,rateArrS,nameArrs);//区进展、社区进展的图表
  651. }
  652. scroller1.refresh();
  653. plus.nativeUI.closeWaiting();
  654. },200)
  655. },
  656. drawChart = function(dateData){//初始化折线图
  657. $(".div-switch").show();
  658. var recordCount = 10;//一页显示几条数据
  659. var allRecordData = dateData.amountArr.reverse();
  660. var dateArr = dateData.dateArr.reverse();
  661. var resultData = _.groupBy(allRecordData,function(item,i){return Math.floor(i/recordCount)});
  662. var dateArrData = _.groupBy(dateArr,function(item,i){return Math.floor(i/recordCount)});
  663. //以下为折线图处理
  664. var gnum = Math.ceil(allRecordData.length / recordCount);
  665. var HandStartX,HandStartY,HandEndX,HandEndY,CountX,CountY,startPos,isScrolling,number=allRecordData.length,times=allRecordData.length%recordCount;
  666. var canvasStr = '<div class="div-layer"></div>';
  667. for(var x in resultData){
  668. canvasStr ='<canvas id="wcMotion'+x+'" class="canvas-wc animated" style="display:block"></canvas>'+canvasStr;
  669. }
  670. $(".l-zxt-inner").html(canvasStr);
  671. var dateType = $(".div-btn-group .div-btn.active").attr("data-id");
  672. window.setTimeout(function() {
  673. for(var x in resultData){
  674. var startDay = new Date(getDateBefore(times-1));
  675. var resultDateArr = dateArrData[x].reverse();
  676. var yAxis = taskNum;//maxData(resultData[x]);//求数据的最大值
  677. $('#wcMotion'+x).wcChart({
  678. height: 200, // width and height must be set if change
  679. yAxis:yAxis,
  680. day: startDay,
  681. points: [],
  682. dateArr:resultDateArr,
  683. dateType:dateType,
  684. data: resultData[x].reverse(),
  685. fill: {gradient: [["#17B3EC",.1], ["#17B3EC",.5]], gradientAngle: Math.PI * -45/180},
  686. animation: null // 修复bug#3298 【医生端】总体分析排版优化。(vivo手机)
  687. });
  688. if(x==0){
  689. $('#wcMotion'+x).show();
  690. }
  691. times+=recordCount;
  692. //折线图画布添加左滑和右滑效果
  693. var wcMotion = document.getElementById('wcMotion'+x);
  694. wcMotion.addEventListener('touchstart', function(event) {
  695. HandStartX=event.touches[0].clientX;
  696. HandStartY=event.touches[0].clientY;
  697. //touches数组对象获得屏幕上所有的touch,取第一个touch
  698. var touch = event.targetTouches[0];
  699. //取第一个touch的坐标值
  700. startPos = {x:touch.pageX,y:touch.pageY,time:+new Date};
  701. //这个参数判断是垂直滚动还是水平滚动
  702. isScrolling = 0;
  703. }, false);
  704. wcMotion.addEventListener('touchend', function(event) {
  705. HandEndX=event.changedTouches[0].clientX;
  706. HandEndY=event.changedTouches[0].clientY;
  707. CountX=HandEndX-HandStartX;
  708. CountY=HandEndY-HandStartY;
  709. if((Math.abs(CountX)>Math.abs(CountY))&& Math.abs(CountX)>50){
  710. var targetMotion = $(event.target);
  711. if(CountX<0){
  712. if(targetMotion.next().length>0 && !targetMotion.next().hasClass("div-layer")){
  713. targetMotion.addClass("fadeOutLeft");
  714. targetMotion.next().removeClass("fadeOutRight").removeClass("fadeOutLeft").removeClass("fadeInLeft").addClass("fadeInRight").show();
  715. }
  716. console.log("左滑");
  717. }else{
  718. if(targetMotion.prev().length>0 && !targetMotion.prev().hasClass("div-layer")){
  719. targetMotion.addClass("fadeOutRight");
  720. targetMotion.prev().removeClass("fadeOutRight").removeClass("fadeOutLeft").removeClass("fadeInRight").addClass("fadeInLeft").show();
  721. }
  722. console.log("右滑");
  723. }
  724. }
  725. }, false);
  726. wcMotion.addEventListener('touchmove', function(event) {
  727. //当屏幕有多个touch或者页面被缩放过,就不执行move操作
  728. if(event.targetTouches.length > 1 || event.scale && event.scale !== 1) return;
  729. var touch = event.targetTouches[0];
  730. endPos = {x:touch.pageX - startPos.x,y:touch.pageY - startPos.y};
  731. //isScrolling为1时,表示纵向滑动,0为横向滑动
  732. isScrolling = Math.abs(endPos.x) < Math.abs(endPos.y) ? 1:0;
  733. if(isScrolling === 0){
  734. //阻止触摸事件的默认行为,即阻止滚屏
  735. event.preventDefault();
  736. }
  737. }, false);
  738. }
  739. }, 500);
  740. },
  741. formatDateData = function(data){//折线图数据格式转化
  742. var dateArr = [];
  743. var amountArr = [];
  744. for(var k in data){
  745. dateArr.push(data[k].range.substring(5));
  746. amountArr.push(data[k].amount);
  747. }
  748. return {dateArr: dateArr, amountArr: amountArr};
  749. },
  750. soreRank = function(arr){//排名方法
  751. var temp = [];
  752. var lis = [];
  753. for(var i=0;i<arr.length;i++)
  754. lis.push(arr[i])
  755. lis = _.uniq(lis);
  756. // lis.sort();
  757. // lis.reverse();
  758. for(var i=0;i<arr.length;i++)
  759. temp[i] = lis.indexOf(arr[i])+1;
  760. return temp;
  761. },
  762. nameArr = function(list){//名称数据集合
  763. var nameArr = [];
  764. for(var k in list){
  765. nameArr.push(list[k].name || "");
  766. }
  767. return nameArr;
  768. },
  769. amountArr = function(list,isTD){//去年签约量数据集合
  770. var amountArr = [];
  771. if(isTD){//如果是团队的话,单位为人
  772. for(var k in list){
  773. amountArr.push(list[k].signNum);
  774. }
  775. }else{//其他单位为千人
  776. for(var k in list){
  777. amountArr.push(list[k].signNum/1000);
  778. }
  779. }
  780. return amountArr;
  781. },
  782. rateArr = function(list){//签约率数据
  783. var rateArr = [];
  784. for(var k in list){
  785. var rate = parseFloat(list[k].rate)?parseFloat(list[k].rate):"0.00";
  786. rateArr.push(rate);
  787. }
  788. return rateArr;
  789. },
  790. renewArr = function(list,isTD){//续签量数据
  791. var renewArr = [];
  792. for(var k in list){
  793. if(isTD){//如果是团队的话,单位为人
  794. renewArr.push(list[k].renewNum);
  795. }else{//其他单位为千人
  796. renewArr.push(list[k].renewNum/1000);
  797. }
  798. }
  799. return renewArr;
  800. },
  801. arr_dive = function(personArr,amountArr){//柱状图叠层 (人口数-签约量=人口数)
  802. var resultArr = [];
  803. for(var k in personArr){
  804. resultArr.push(personArr[k]-amountArr[k]);
  805. }
  806. return resultArr;
  807. },
  808. arr_dive_qyl = function(amountArr,renewArr){//柱状图叠层 (签约量)
  809. var resultArr = [];
  810. for(var k in renewArr){
  811. if(amountArr[k]-renewArr[k]>0){//去年签约量-续签量 (签约量>=续签量)
  812. resultArr.push(amountArr[k]-renewArr[k]);
  813. }else{
  814. resultArr.push(0);
  815. }
  816. }
  817. return resultArr;
  818. },
  819. maxData = function(data){
  820. var maxData = Math.max.apply(Math,data);
  821. var yAxis = maxData<10?10:maxData;
  822. return yAxis;
  823. },
  824. getStartDate = function(){ //年度开始的时间为7月1号
  825. return chooseYear+'-07-01';
  826. },
  827. //获取结束时间
  828. getEndDate = function(){ //如果是前一个年度的时间,那么结束的时间为6月30号,如果是当前年度的,则结束时间为现在
  829. var endDate = new Date((chooseYear+1) + '-06-30'),
  830. now = new Date();
  831. if(now < endDate){
  832. return now.getFullYear()+"-"+(now.getMonth()+1)+"-"+now.getDate();
  833. }else{
  834. return (chooseYear+1) + '-06-30';
  835. }
  836. },
  837. getDateBefore = function(days){//获取多少天前的日期
  838. var now = new Date();
  839. var date = new Date(now.getTime() - days * 24 * 3600 * 1000);
  840. var year = date.getFullYear();
  841. var month = date.getMonth() + 1;
  842. var day = date.getDate();
  843. var hour = date.getHours();
  844. var minute = date.getMinutes();
  845. var second = date.getSeconds();
  846. return year + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day);
  847. };
  848. /*****************************************************************************/
  849. /***** echarts图标处理 **********/
  850. /*****************************************************************************/
  851. var echartsFun = function(elementId,amountArrS,amountArrResult,taskArrS,rateArrS,nameArr){//区进展、社区进展的图表
  852. var myChart = echarts.init(document.getElementById(elementId));
  853. var height = amountArrS.length*customHeight;
  854. var option = {
  855. grid: {x:60,y: 30,height:height,borderWidth:0},
  856. yAxis : [
  857. {
  858. type : 'category',
  859. data : nameArr,
  860. axisLine: {show:false},
  861. axisTick: {show:false},
  862. splitArea: {show:false},
  863. splitLine: {show:false},
  864. axisLabel: {show:false}
  865. }
  866. ],
  867. xAxis : [
  868. {
  869. type : 'value',
  870. axisLine: {show:true,lineStyle:{color:'#cccccc'}},
  871. axisTick: {show:true,lineStyle:{color:'#cccccc'}},
  872. axisLabel:{formatter:'{value}%',textStyle:{color:'#cccccc'}},
  873. splitArea: {show:false},
  874. splitLine: {show:false}
  875. },
  876. {
  877. type : 'value',
  878. axisLine: {show:true,lineStyle:{color:'#cccccc'}},
  879. axisTick: {show:true,lineStyle:{color:'#cccccc'}},
  880. axisLabel:{formatter:'{value}',textStyle:{color:'#cccccc'}},
  881. splitArea: {show:false},
  882. splitLine: {show:false}
  883. }
  884. ],
  885. series : [
  886. {
  887. name:'去年签约量',
  888. type:'bar',
  889. barWidth : 20,//柱图宽度
  890. stack: '目标量',
  891. xAxisIndex:1,
  892. itemStyle: {normal: {barBorderRadius:0,color:'#a0dc28', label:{show:false, position: 'insideRight'}}},
  893. data:taskArrS,
  894. },
  895. {
  896. name:'续签量',
  897. type:'bar',
  898. barWidth : 20,//柱图宽度
  899. stack: '人数',
  900. xAxisIndex:1,
  901. itemStyle: {normal: {barBorderRadius:0,color:'#ffc149', label:{show:false, position: 'insideRight',textStyle:{color:'#fff'}}}},
  902. data:amountArrS
  903. },
  904. {
  905. name:'续签率',
  906. type:'line',
  907. itemStyle: {normal: {color:'red', label:{show:true,formatter:function(p){return p.value +"%";},textStyle:{color:'red'},position:'bottom'}}},
  908. data:rateArrS,
  909. markLine:{
  910. itemStyle:{
  911. normal:{lineStyle:{type:'solid',color:'#925cfe'},label:{show:true,formatter:function(p){return p.value +"%";},textStyle:{color:'#925cfe'},position:'bottom'}}
  912. },
  913. large:true,
  914. effect:{
  915. show: false,
  916. loop: true,
  917. period: 0,
  918. scaleSize : 2,
  919. color : null,
  920. shadowColor : null,
  921. shadowBlur : null
  922. },
  923. data:[
  924. [
  925. {name: '标线1起点', value: '15',xAxis:-1, xAxis: '15'}, // 当xAxis为类目轴时,数值1会被理解为类目轴的index,通过xAxis:-1|MAXNUMBER可以让线到达grid边缘
  926. {name: '标线1终点', yAxis: nameArr[nameArr.length-1], xAxis: '15'}, // 当xAxis为类目轴时,字符串'周三'会被理解为与类目轴的文本进行匹配
  927. ],
  928. ]
  929. }
  930. }
  931. ]
  932. };
  933. myChart.setOption(option);
  934. },
  935. echartsCCFun = function(elementId,qylAmountArr,renewArrS,rateArrS,nameArr){//区进展、社区进展的图表
  936. var myChart = echarts.init(document.getElementById(elementId));
  937. var height = nameArr.length*customHeight;
  938. var option = {
  939. grid: {x:60,y: 30,height:height,borderWidth:0},
  940. yAxis : [
  941. {
  942. type : 'category',
  943. data : nameArr,
  944. axisLine: {show:false},
  945. axisTick: {show:false},
  946. splitArea: {show:false},
  947. splitLine: {show:false},
  948. axisLabel: {show:false}
  949. }
  950. ],
  951. xAxis : [
  952. {
  953. type : 'value',
  954. axisLine: {show:true,lineStyle:{color:'#cccccc'}},
  955. axisTick: {show:true,lineStyle:{color:'#cccccc'}},
  956. axisLabel:{formatter:'{value}%',textStyle:{color:'#cccccc'}},
  957. splitArea: {show:false},
  958. splitLine: {show:false}
  959. },
  960. {
  961. type : 'value',
  962. axisLine: {show:true,lineStyle:{color:'#cccccc'}},
  963. axisTick: {show:true,lineStyle:{color:'#cccccc'}},
  964. axisLabel:{formatter:'{value}',textStyle:{color:'#cccccc'}},
  965. splitArea: {show:false},
  966. splitLine: {show:false}
  967. }
  968. ],
  969. series : [
  970. {
  971. name:'续签量',
  972. type:'bar',
  973. barWidth : 20,//柱图宽度
  974. stack: '人数',
  975. xAxisIndex:1,
  976. itemStyle: {normal: {barBorderRadius:0,color:'#ffc149', label:{show:false, position: 'insideRight',textStyle:{color:'#fff'}}}},
  977. data:renewArrS
  978. },
  979. {
  980. name:'去年签约量',
  981. type:'bar',
  982. barWidth : 20,//柱图宽度
  983. stack: '人数',
  984. xAxisIndex:1,
  985. itemStyle: {normal: {barBorderRadius:0,color:'#A0DC28', label:{show:false, position: 'insideRight'}}},
  986. data:qylAmountArr,
  987. },
  988. {
  989. name:'续签率',
  990. type:'line',
  991. itemStyle: {normal: {color:'red', label:{show:true,formatter:function(p){return p.value +"%";},textStyle:{color:'red'},position:'bottom'}}},
  992. data:rateArrS,
  993. markLine:{
  994. itemStyle:{
  995. normal:{lineStyle:{type:'solid',color:'#925cfe'},label:{show:true,formatter:function(p){return p.value +"%";},textStyle:{color:'#925cfe'},position:'bottom'}}
  996. },
  997. large:true,
  998. effect:{
  999. show: false,
  1000. loop: true,
  1001. period: 0,
  1002. scaleSize : 2,
  1003. color : null,
  1004. shadowColor : null,
  1005. shadowBlur : null
  1006. },
  1007. data:[
  1008. [
  1009. {name: '标线1起点', value: qylAmountArr,xAxis:-1, xAxis: qylAmountArr}, // 当xAxis为类目轴时,数值1会被理解为类目轴的index,通过xAxis:-1|MAXNUMBER可以让线到达grid边缘
  1010. {name: '标线1终点', yAxis: nameArr[nameArr.length-1], xAxis: qylAmountArr}, // 当xAxis为类目轴时,字符串'周三'会被理解为与类目轴的文本进行匹配
  1011. ],
  1012. ]
  1013. }
  1014. }
  1015. ]
  1016. };
  1017. myChart.setOption(option);
  1018. },
  1019. echartsTDFun = function(elementId,qylAmountArr,renewArrS,rateArrS,nameArr){//团队进展图表
  1020. var myChart = echarts.init(document.getElementById(elementId));
  1021. var height = nameArr.length*customHeight;
  1022. var gridY = current_team_index==0?30:0;
  1023. var option = {
  1024. grid: {x:60,y: gridY,height:height,borderWidth:0},
  1025. yAxis : [
  1026. {
  1027. type : 'category',
  1028. data : nameArr,
  1029. axisLine: {show:false},
  1030. axisTick: {show:false},
  1031. splitArea: {show:false},
  1032. splitLine: {show:false},
  1033. axisLabel: {show:false}
  1034. }
  1035. ],
  1036. xAxis : [
  1037. {
  1038. type : 'value',
  1039. axisLine: {show:true,lineStyle:{color:'#cccccc'}},
  1040. axisTick: {show:true,lineStyle:{color:'#cccccc'}},
  1041. axisLabel:{formatter:'{value}%',textStyle:{color:'#cccccc'}},
  1042. splitArea: {show:false},
  1043. splitLine: {show:false}
  1044. },
  1045. {
  1046. type : 'value',
  1047. axisLine: {show:true,lineStyle:{color:'#cccccc'}},
  1048. axisTick: {show:true,lineStyle:{color:'#cccccc'}},
  1049. axisLabel:{formatter:'{value}',textStyle:{color:'#cccccc'}},
  1050. splitArea: {show:false},
  1051. splitLine: {show:false}
  1052. }
  1053. ],
  1054. series : [
  1055. {
  1056. name:'续签量',
  1057. type:'bar',
  1058. barWidth : 20,//柱图宽度
  1059. stack: '人数',
  1060. xAxisIndex:1,
  1061. itemStyle: {normal: {barBorderRadius:0,color:'#ffc149', label:{show:false, position: 'insideRight',textStyle:{color:'#fff'}}}},
  1062. data:renewArrS
  1063. },
  1064. {
  1065. name:'去年签约量',
  1066. type:'bar',
  1067. barWidth : 20,//柱图宽度
  1068. stack: '人数',
  1069. xAxisIndex:1,
  1070. itemStyle: {normal: {barBorderRadius:0,color:'#A0DC28', label:{show:false, position: 'insideRight'}}},
  1071. data:qylAmountArr,
  1072. },
  1073. {
  1074. name:'续签率',
  1075. type:'line',
  1076. itemStyle: {normal: {color:'red', label:{show:true,formatter:function(p){return p.value +"%";},textStyle:{color:'red'},position:'bottom'}}},
  1077. data:rateArrS,
  1078. markLine:{
  1079. itemStyle:{
  1080. normal:{lineStyle:{type:'solid',color:'#925cfe'},label:{show:true,formatter:function(p){return p.value +"%";},textStyle:{color:'#925cfe'},position:'bottom'}}
  1081. },
  1082. large:true,
  1083. effect:{
  1084. show: false,
  1085. loop: true,
  1086. period: 0,
  1087. scaleSize : 2,
  1088. color : null,
  1089. shadowColor : null,
  1090. shadowBlur : null
  1091. },
  1092. data:[
  1093. [
  1094. {name: '标线1起点', value: qylAmountArr,xAxis:-1, xAxis: qylAmountArr}, // 当xAxis为类目轴时,数值1会被理解为类目轴的index,通过xAxis:-1|MAXNUMBER可以让线到达grid边缘
  1095. {name: '标线1终点', yAxis: nameArr[nameArr.length-1], xAxis: qylAmountArr}, // 当xAxis为类目轴时,字符串'周三'会被理解为与类目轴的文本进行匹配
  1096. ],
  1097. ]
  1098. }
  1099. }
  1100. ]
  1101. };
  1102. myChart.setOption(option);
  1103. };
  1104. /*****************************************************************************/
  1105. /***** 返回事件处理 **********/
  1106. /*****************************************************************************/
  1107. mui.back = function(){
  1108. var arr = JSON.parse(plus.storage.getItem("levelParamsArr"));
  1109. if(arr==null || arr.length==1){//返回到管理员首页,并刷新数据
  1110. plus.storage.removeItem("userLevel");
  1111. plus.storage.removeItem("userArea");
  1112. var mainPage =plus.webview.getWebviewById("admin.html");
  1113. mui.fire(mainPage, "refreshData");
  1114. plus.storage.removeItem("levelParamsArr");
  1115. //关闭筛选页面
  1116. var shaixuan = plus.webview.getWebviewById("xq-shaixuan.html");
  1117. if(shaixuan){
  1118. shaixuan.close();
  1119. }
  1120. setTimeout(function(){
  1121. self.close();
  1122. },500)
  1123. }else{ //加载当前级别数据
  1124. current_team_index = 0;
  1125. arr.pop();
  1126. curLeveArr = arr[arr.length-1];
  1127. area = curLeveArr[1].params.code;
  1128. level = curLeveArr[1].params.level;
  1129. plus.storage.setItem("levelParamsArr",arr.length==0?plus.storage.removeItem("levelParamsArr"):JSON.stringify(arr));
  1130. loadAllData(curLeveArr);
  1131. }
  1132. }
  1133. document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);