home.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. new Vue({
  2. el: '#main',
  3. data: {
  4. roles: [],
  5. selectedRole: "",
  6. isopen: true,
  7. signAnalysis: [{
  8. photo: '../../../images/qianyujingzhan_icon.png',
  9. label: '签约进展',
  10. url: 'sign-progress.html',
  11. allowArea:"",
  12. }, {
  13. photo: '../../../images/xuqianjingzhan_icon.png',
  14. label: '续签进展',
  15. url: 'renew-progress.html',
  16. allowArea:"",
  17. }, {
  18. photo: '../../../images/jumingfenxi_icon.png',
  19. label: '居民分析',
  20. url: 'resident-analysis.html',
  21. allowArea:"",
  22. }, {
  23. photo: '../../../images/jiankangguanli_icon.png',
  24. label: '健康管理',
  25. url: 'health-management-analysis.html',
  26. allowArea:"",
  27. },{
  28. photo: '../../../images/tuigaiqian_icon.png',
  29. label: '退改签',
  30. url: 'change-back.html',
  31. allowArea:"",
  32. }, {
  33. photo: '../../../images/lianglvfenxi_icon.png',
  34. label: '两率分析',
  35. url: 'two-rate-analysis.html',
  36. allowArea:"",
  37. }],
  38. serviceAnalysis: [{
  39. photo: '../../../images/zongtifenxi_icon.png',
  40. label: '总体分析',
  41. url: 'comprehensive-analysis.html',
  42. allowArea:"",
  43. }, {
  44. photo: '../../../images/zixunfenxi_icon.png',
  45. label: '咨询分析',
  46. url: 'consulting-analysis.html',
  47. allowArea:"",
  48. }, {
  49. photo: '../../../images/pijianfenxi_icon.png',
  50. label: '评价分析',
  51. url: 'estimate-analysis.html',
  52. allowArea:"",
  53. }, {
  54. photo: '../../../images/changcufangfenxi_icon.png',
  55. label: '长处方分析',
  56. url: 'prescription-analysis.html',
  57. allowArea:"",
  58. },{
  59. photo: '../../../images/zhufufenxi_icon_pc.png',
  60. label: '祝福分析',
  61. url: 'blessing-analysis.html',
  62. allowArea:"",
  63. },
  64. {
  65. photo: '../../../images/shangmenfuwu_icon.png',
  66. label: '上门服务',
  67. url: 'smfw-analysis.html',
  68. allowArea:"",
  69. },
  70. {
  71. photo: '../../../images/shaichafenxin_icon.png',
  72. label: '筛查分析',
  73. url: 'jbsc-analysis.html',
  74. allowArea:"",
  75. },
  76. {
  77. photo: '../../../images/zhuanbingfenxi_icon.png',
  78. label: '专病分析',
  79. url: 'special-analysis.html',
  80. allowArea:"",
  81. },
  82. ],
  83. signRateData: {
  84. signTask: {
  85. text: '',
  86. rate: '0.00',
  87. sign: 0,
  88. people: 0
  89. },
  90. sign: {
  91. text: '',
  92. rate: '0.00',
  93. sign: 0,
  94. people: 0
  95. },
  96. renew: {
  97. text: '',
  98. rate: '0.00',
  99. sign: 0,
  100. people: 0
  101. }
  102. },
  103. dataQuery: [{
  104. photo: '../../../images/shujudaochu_icon.png',
  105. label: '数据查询',
  106. url: 'comprehensive-query.html',
  107. allowArea:"",
  108. },{
  109. photo: '../../../images/weijishihuifu_icon.png',
  110. label: '咨询未及时回复',
  111. url: 'consult-not-reply.html',
  112. allowArea:"",
  113. },
  114. {
  115. photo: '../../../images/icon-baobiao.png',
  116. label: '年度考核报表',
  117. url: 'annual-appraisal-report.html',
  118. allowArea:"",
  119. },
  120. ],
  121. paramValue:'',
  122. paramType:'',
  123. },
  124. methods: {
  125. open: function() {
  126. EventBus.$emit('open-click', {});
  127. },
  128. showDetail: function(url) {
  129. window.location.href = url;
  130. },
  131. goToPage: function(val){
  132. var url = "sign-progress.html";
  133. if(val == 2){
  134. url = "renew-progress.html";
  135. }else if(val == 3){
  136. url = "comprehensive-query.html";
  137. }
  138. window.location.href = url;
  139. },
  140. userRoleData:function(v) {
  141. var vm = this
  142. var roles = window.sessionStorage.getItem("userRole");
  143. //如果没有缓存userRole,则说明是第一次进入统计页面,需要重新请求患者信息
  144. // if(!roles){
  145. var vm = this;
  146. httpRequest.getDoctorInfo().then(function(res){
  147. var docInfo = res.data,
  148. userRole = docInfo.userRole;
  149. _.each(userRole,function(item,index){
  150. if(item.areas!="350200"){
  151. item.roleType='2'
  152. }
  153. })
  154. if(docInfo.specialistRole&&docInfo.specialistRole.length){ //如果有专科权限
  155. _.each(docInfo.specialistRole,function(item,index){
  156. var hasIndex = _.findIndex(userRole,{areas:item.areas})
  157. if(hasIndex == -1){ //去重
  158. item.roleType='1'
  159. userRole.push(item)
  160. }
  161. })
  162. }
  163. if(userRole.length>0){
  164. window.sessionStorage.setItem("userRole", JSON.stringify(userRole));
  165. window.sessionStorage.setItem("docInfo", JSON.stringify(docInfo));
  166. vm.roles = userRole;
  167. vm.selectedRole = userRole[0].code;
  168. var selected = userRole[0];
  169. window.sessionStorage.setItem("selectedRole", JSON.stringify(selected));
  170. $("#main").removeClass("c-hide")
  171. }
  172. if(userRole.length==0&&docInfo.specialistRole&&docInfo.specialistRole.length==0){
  173. top.toastr.warning("您没有权限查看该页面");
  174. }
  175. })
  176. // }else{
  177. // this.roles = JSON.parse(roles);
  178. // if(this.roles.length>0){
  179. // var selected = window.sessionStorage.getItem("selectedRole");
  180. // if(selected && selected!= "undefined") {
  181. // this.selectedRole = JSON.parse(selected).code;
  182. // } else {
  183. // this.selectedRole = this.roles[0].code;
  184. // var selected = this.roles[0];
  185. // window.sessionStorage.setItem("selectedRole", JSON.stringify(selected));
  186. // }
  187. // $("#main").removeClass("c-hide")
  188. // }else{
  189. // top.toastr.warning("您没有权限查看该页面");
  190. // }
  191. // }
  192. },
  193. paramClick:function(v) {
  194. if(v == 'ztfx') {
  195. this.showDetail(this.serviceAnalysis[0].url)
  196. }else if(v == 'zxfx') {
  197. this.showDetail(this.serviceAnalysis[1].url)
  198. }else if(v == 'pjfx') {
  199. this.showDetail(this.serviceAnalysis[2].url)
  200. }else if(v == 'ccffx') {
  201. this.showDetail(this.serviceAnalysis[3].url)
  202. }else if(v == 'zffx') {
  203. this.showDetail(this.serviceAnalysis[4].url)
  204. }else if(v == 'smfw') {
  205. this.showDetail(this.serviceAnalysis[5].url)
  206. }else if(v == 'scfx') {
  207. this.showDetail(this.serviceAnalysis[6].url)
  208. }else if(v == 'zbfx') {
  209. if(this.paramType) {
  210. this.showDetail('special-analysis.html?type='+this.paramType)
  211. }else{
  212. this.showDetail(this.serviceAnalysis[7].url)
  213. }
  214. }else if(v == 'sjcx') {
  215. this.showDetail(this.dataQuery[0].url)
  216. }else if(v=='jkmzf'){
  217. this.showDetail('comprehensive-query.html?iSearch=1')
  218. }
  219. else if(v == 'ndkhbb') {
  220. this.showDetail(this.dataQuery[2].url)
  221. }else if(v == 'jmfx') {
  222. this.showDetail(this.signAnalysis[2].url)
  223. }else if(v == 'jkgl') {
  224. this.showDetail(this.signAnalysis[3].url)
  225. }else if(v == 'tgq') {
  226. this.showDetail(this.signAnalysis[4].url)
  227. }
  228. },
  229. },
  230. mounted: function() {
  231. //获取缓存里面的userRole
  232. this.userRoleData()
  233. //TODO 发布删除这个
  234. // window.location.href = 'comprehensive-query.html'
  235. // 获取URL地址
  236. var url = window.location.href;
  237. // 获取参数部分
  238. var params = url.split('?')[1];
  239. // 将参数部分转换为对象
  240. var paramsObj = {};
  241. if (params) {
  242. var paramsArr = params.split('&');
  243. for (var i = 0; i < paramsArr.length; i++) {
  244. var param = paramsArr[i].split('=');
  245. paramsObj[param[0]] = param[1];
  246. }
  247. }
  248. // 获取指定参数的值
  249. this.paramValue = paramsObj['name'];
  250. this.paramType = paramsObj['type'];
  251. },
  252. watch: {
  253. selectedRole: function(val) {
  254. var vm = this
  255. var selected = _.findWhere(this.roles, {
  256. code: val
  257. });
  258. window.sessionStorage.setItem("selectedRole", JSON.stringify(selected));
  259. getSignData(this);
  260. console.log(this.selectedRole)
  261. if(vm.selectedRole) {
  262. vm.paramClick(vm.paramValue)
  263. }
  264. },
  265. // "paramValue":{
  266. // handler:function(v) {
  267. // this.paramClick(v)
  268. // },
  269. // },
  270. }
  271. })
  272. function getSignData(vm){
  273. var code = vm.selectedRole,
  274. now = new Date(),
  275. params = {
  276. area: code,
  277. level: code == '350200' ? 4 : code.length == 6 ? 3 : 2,
  278. endDate: now.format("yyyy-MM-dd")
  279. };
  280. statisticAPI.getSignInfo(params).then(function(res){
  281. if(res.status == 200){
  282. var data = res.data;
  283. vm.signRateData = {
  284. signTask: {
  285. text: formatRate(data.signTaskRate.rate),
  286. rate: '0.00',
  287. sign: data.signTaskRate.sign,
  288. people: data.signTaskRate.people
  289. },
  290. sign: {
  291. text: formatRate(data.signRate.rate),
  292. rate: '0.00',
  293. sign: data.signRate.sign,
  294. people: data.signRate.people
  295. },
  296. renew: {
  297. text: data.renewRange,
  298. rate: '0.00',
  299. sign: data.renew.split("/")[0],
  300. people: data.renew.split("/")[1]
  301. }
  302. }
  303. var val1 = data.signRate.people - data.signRate.sign,
  304. val2 = data.signTaskRate.people - data.signTaskRate.sign;
  305. var signArr = [
  306. {name: "签约数", value: data.signRate.sign},
  307. {name: "未签约数", value: val1 >0 ? val1 : 0},
  308. ],
  309. signTaskArr = [
  310. {name: "签约数", value: data.signTaskRate.sign},
  311. {name: "未达标数", value: val2 >0 ? val2 : 0 }
  312. ],
  313. val = data.renew.split("/")[1] - data.renew.split("/")[0],
  314. renewArr = [
  315. {name: "续签数", value: data.renew.split("/")[0]},
  316. {name: "未达标数", value: val<0 ? 0 : val}
  317. ],
  318. color = ['#12b7f5', '#EBEBF5'];
  319. var signChart = drawPieChart("signMain", signArr, color, true);
  320. var completeChart = drawPieChart("completeMain", signTaskArr, color, true);
  321. var renewChart = drawPieChart("renewMain", renewArr, color, true);
  322. window.onresize = function() {
  323. signChart.resize();
  324. completeChart.resize();
  325. renewChart.resize();
  326. }
  327. }else{
  328. console.log(res.msg);
  329. }
  330. })
  331. }
  332. function formatRate(str){
  333. var val = parseFloat(str);
  334. return val.toFixed(2)+"%";
  335. }