qianyuetongji2.js 46 KB

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