newdash.js 93 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900
  1. 'use strict';
  2. /**
  3. * controllers used for the dashboard
  4. */
  5. var appFormly = angular.module('formlyDashboard', [
  6. 'formly', 'formlyBootstrap', 'ui.bootstrap',
  7. 'ngSanitize', 'ui.select', 'ui.grid'
  8. ]);
  9. app.requires.push('formlyDashboard');
  10. // var appFormly = angular.module('formlyExample', [
  11. // 'formly', 'formlyBootstrap','ui.bootstrap',
  12. // 'ngSanitize','ui.select','ui.grid'],
  13. appFormly.config(
  14. function config(formlyConfigProvider) {
  15. //格式转换方法 XXX-XXX转驼峰命名
  16. });
  17. appFormly.controller('newDashCtrl', ['$rootScope', '$auth', '$scope', '$parse', '$injector', '$http', '$q', '$state', '$modal', '$timeout', '$interval', 'SweetAlert', 'i18nService', '$window', "ngTableParams", 'Restangular', 'UserRestangular', 'BpmRestangular', 'api_configure_form', 'api_bpm_domain', 'api_bpm_data','api_event_form', 'api_user_data', 'api_report', 'api_msg', 'api_bpm_schedule', 'api_newreport', 'api_statistic', "calendarConfig", "api_login","api_sysinfo","api_category",
  18. function($rootScope, $auth, $scope, $parse, $injector, $http, $q, $state, $modal, $timeout, $interval, SweetAlert, i18nService, $window, ngTableParams, Restangular, UserRestangular, BpmRestangular, api_configure_form, api_bpm_domain, api_bpm_data,api_event_form, api_user_data, api_report, api_msg, api_bpm_schedule, api_newreport, api_statistic, calendarConfig, api_login,api_sysinfo,api_category) {
  19. $scope.incidentlist = {};
  20. $scope.bodyheight = {};
  21. // $scope.tableParams = {};
  22. $scope.sumline = '';
  23. $scope.gaoliangleft = true;
  24. $scope.gaoliangright = false;
  25. $scope.userlist = [];
  26. $scope.totalPage = "";
  27. $scope.thisuserrole = "admin";
  28. $rootScope.app.layout.isNavbarFixed = false;
  29. $rootScope.app.layout.isSidebarFixed = false;
  30. $scope.thisalldata = moment(new Date()).format('YYYY-MM-DD hh:mm:ss');
  31. $scope.thissomedata = moment(new Date()).format('YYYY-MM');
  32. $scope.thisdatatop5 = moment(new Date()).format('YYYY年MM月');
  33. $scope.thismonthtop5 = (new Date()).getMonth() + 1;
  34. $scope.thisyertop5 = (new Date()).getFullYear();
  35. $scope.thismonthjiejue = (new Date()).getMonth() + 1;
  36. $scope.thisyerjiejue = (new Date()).getFullYear();
  37. $scope.thisdatajiejue = moment(new Date()).format('YYYY年MM月');
  38. $scope.maxtoptime = true;
  39. $scope.maxjiejuetime = true;
  40. $scope.paiming = '(暂无)';
  41. $scope.loginBtn = {
  42. closeEl: '.close',
  43. modal: {
  44. templateUrl: 'assets/views/loginform.html',
  45. postion: 'center'
  46. }
  47. };
  48. // 判断是否是事件经理
  49. $scope.isEventManager = $rootScope.user.role.some(v => v.rolecode == 'incident manager');
  50. var getMenus = function() {
  51. function convertListToTree(data, treeMap) {
  52. var idToNodeMap = {}; //Keeps track of nodes using id as key, for fast lookup
  53. var root = null; //Initially set our loop to null
  54. var parentNode = null;
  55. //loop over data
  56. for (var i = 0; i < data.length; i++) {
  57. // data[i].id = Number(data[i].id);
  58. var datum = data[i];
  59. //each node will have children, so let's give it a "children" poperty
  60. datum.children = [];
  61. //add an entry for this node to the map so that any future children can
  62. //lookup the parent
  63. idToNodeMap[datum.id] = datum;
  64. //Does this node have a parent?
  65. if (typeof datum.parentid === "undefined" || datum.parentid == null) {
  66. //Doesn't look like it, so this node is the root of the tree
  67. root = datum;
  68. treeMap[datum.id] = root;
  69. } else {
  70. //This node has a parent, so let's look it up using the id
  71. parentNode = idToNodeMap[datum.parentid];
  72. //We don't need this property, so let's delete it.
  73. //delete datum.parentid;
  74. //Let's add the current node as a child of the parent node.
  75. parentNode.children.push(datum);
  76. }
  77. }
  78. return root;
  79. }
  80. function convertParentToChildList(data) {
  81. var treeMap = {};
  82. var list = [];
  83. convertListToTree(data, treeMap);
  84. angular.forEach(treeMap, function(item) {
  85. list.push(item);
  86. });
  87. list = window._.sortBy(list, function(o) {
  88. return o.orders;
  89. });
  90. return list;
  91. }
  92. //if(userMenus.length==0){
  93. var userMenus = [];
  94. var idMapMenu = {};
  95. if ($rootScope.user) {
  96. if ($rootScope.user.menu) {
  97. userMenus = convertParentToChildList($rootScope.user.menu);
  98. }
  99. }
  100. //}
  101. $rootScope.userMenus = userMenus;
  102. if ($rootScope.userMenus.length > 0) {
  103. // getpending();
  104. // setInterval(getpending, 30000);
  105. }
  106. return userMenus;
  107. }
  108. var url = location.hash; //获取url中"?"符后的字串 var index=obj.lastIndexOf("\-");
  109. var theRequest = {};
  110. var index = url.substring(index + 1, url.length).lastIndexOf("\?");
  111. if (url.indexOf("?") != -1 && url.indexOf("dashboard")) {
  112. var str = url.substr(index + 1);
  113. var strs = str.split("&");
  114. for (var i = 0; i < strs.length; i++) {
  115. theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
  116. }
  117. $rootScope.statuscall = 1;
  118. $scope.loginForm = {
  119. username: theRequest.username,
  120. password: theRequest.password
  121. }
  122. $auth.submitLogin($scope.loginForm)
  123. .then(function(resp) {
  124. localStorage.setItem("jry_user", JSON.stringify(resp));
  125. $rootScope.user = JSON.parse(localStorage.getItem("jry_user"));
  126. $rootScope.userMenus = JSON.parse(localStorage.getItem("jry_user")).menu;
  127. var loginUser = $rootScope.user;
  128. $scope.allFlag = false;//全部事件
  129. for (var i = 0; i < loginUser.menu.length; i++) {
  130. if (loginUser.menu[i].link == "shijianliebiao_all") {
  131. $scope.allFlag = true
  132. }
  133. }
  134. getMenus();
  135. if (resp.error != 500) {
  136. $rootScope.app.isLoginFixed = false;
  137. var filterDataone = {
  138. "assignee": $rootScope.user.id,
  139. "searchType": "todo",
  140. "idx": 0,
  141. "sum": 5
  142. }
  143. var filterDatatwo = {
  144. "alarmIncident": { "state": "未处理" },
  145. "idx": 0,
  146. "sum": 5
  147. }
  148. $scope.filterData = {
  149. "assignee": $rootScope.user.id,
  150. "searchType": "todo",
  151. "idx": 0,
  152. "sum": 5
  153. }
  154. $scope.nian = [(new Date()).getFullYear(), (new Date()).getFullYear() - 1, (new Date()).getFullYear() - 2, (new Date()).getFullYear() - 3, (new Date()).getFullYear() - 4, (new Date()).getFullYear() - 5, (new Date()).getFullYear() - 6, (new Date()).getFullYear() - 7, (new Date()).getFullYear() - 8, (new Date()).getFullYear() - 9, (new Date()).getFullYear() - 10, (new Date()).getFullYear() - 11, (new Date()).getFullYear() - 12, (new Date()).getFullYear() - 13, (new Date()).getFullYear() - 14, (new Date()).getFullYear() - 15, (new Date()).getFullYear() - 16, (new Date()).getFullYear() - 17, (new Date()).getFullYear() - 18, (new Date()).getFullYear() - 19];
  155. $scope.yue = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
  156. changeDivHeight();         
  157. window.onresize = function() {  changeDivHeight(); }              
  158. function  changeDivHeight() {                               
  159. var  h  =  document.documentElement.clientHeight; //获取页面可见高度  
  160. $scope.bodyheight = { "height": h + "px" };  
  161. $scope.sumline = (h - 60) * 0.45 / 34;
  162. }
  163. //角色判断
  164. for (var i = 0; i < $rootScope.user.role.length; i++) {
  165. if ($rootScope.user.role[i].rolecode == "call center") {
  166. $scope.thisuserrole = "center";
  167. break;
  168. } else if ($rootScope.user.role[i].rolecode == "admin general") {
  169. $scope.thisuserrole = "admin";
  170. break;
  171. } else if ($rootScope.user.role[i].rolecode == "3164d1ab-b733-4cb0-98bc-7d1593df3ebc") {
  172. $scope.thisuserrole = "yunwei";
  173. break;
  174. }
  175. }
  176. $scope.gowechart = function() {
  177. $state.go('app.desk.chart');
  178. }
  179. $scope.gobaojin = function() {
  180. $state.go('app.desk.jry_emergency');
  181. }
  182. $scope.goWxWeb = function() {
  183. $state.go('app.desk.chart');
  184. }
  185. $scope.goCalllog = function() {
  186. $state.go('app.desk.calllog');
  187. }
  188. $scope.goliuyan = function() {
  189. $state.go('app.desk.record');
  190. }
  191. $scope.gotonghua = function() {
  192. $state.go('app.desk.calllog');
  193. }
  194. $scope.gonewincident = function() {
  195. $state.go('app.incident.editor');
  196. }
  197. $scope.goyuqi = function() {
  198. var fildata = { searchType: "overDate" }
  199. $state.go('app.incident.list', { model: JSON.stringify(fildata) });
  200. }
  201. $scope.goknowledge = function() {
  202. $state.go('app.knowledge.manager');
  203. }
  204. $scope.gohuifang = function() {
  205. $state.go('app.incident.list');
  206. }
  207. $scope.gopaiban = function() {
  208. $state.go('app.scheduling.myscheduling');
  209. }
  210. //新建问题
  211. $scope.gonewproblem = function() {
  212. $state.go('app.problem.editor');
  213. }
  214. //新建变更
  215. $scope.gonewchange = function() {
  216. $state.go('app.change.editor');
  217. }
  218. //cmdb
  219. $scope.gocmdb = function() {
  220. $state.go('app.means.listd');
  221. }
  222. $scope.jingjiinform = function(row) {
  223. if (row.alarm.alarmExtension) {
  224. row.alarm.alarmExtension = row.alarm.alarmExtension.replace('{', "");
  225. row.alarm.alarmExtension = row.alarm.alarmExtension.replace('}', "");
  226. row.alarm.alarmExtension = row.alarm.alarmExtension.replace(/,/g, '\n');
  227. }
  228. event.stopPropagation();
  229. var modelfile = { model: row };
  230. $state.go('app.desk.form_editor', { formKey: 'desk_emergency', service: 'api_user_data', model: JSON.stringify(modelfile) });
  231. };
  232. // $scope.goschedule = function(time) {
  233. // }
  234. //我的排班
  235. $scope.scheevents = [];
  236. $scope.getschedule = function(time) {
  237. api_bpm_schedule.fetchSchedule($rootScope.user.id, time.startTime, time.endTime).then(function(response) {
  238. if (response.status == 200) {
  239. $scope.scheevents = [];
  240. var myData = response.list;
  241. angular.forEach(myData, function(item) {
  242. var eventTemp = {};
  243. eventTemp.title = item.description;
  244. // eventTemp.title = item.name;
  245. eventTemp.type = item.scheduleClass.code;
  246. eventTemp.startsAt = moment(item['scheduleOrder'].startTime).toDate();
  247. eventTemp.endsAtTime = moment(item['scheduleOrder'].endTime).toDate();
  248. eventTemp.startTime = moment(item['scheduleOrder'].startTime).format('YYYY-MM-DD hh:mm')
  249. eventTemp.endTime = moment(item['scheduleOrder'].endTime).format('YYYY-MM-DD hh:mm')
  250. eventTemp.id = item.id;
  251. eventTemp.deletable = false;
  252. eventTemp.user = item.user;
  253. $scope.scheevents.push(eventTemp);
  254. })
  255. $scope.scheevents = $scope.scheevents.slice(0, 5)
  256. }
  257. });
  258. }
  259. $scope.getschedule({ 'time': { 'startTime': "2018-09-01 00:00:00", 'endTime': "2018-09-30 23:59:59" } });
  260. //去处理
  261. $scope.gotuclose = function(data) {
  262. if (data.type == 1) {
  263. $state.go('app.incident.editor', { taskId: data.taskId, processInstanceId: data.procInstId });
  264. } else if (data.type == 2) {
  265. $state.go('app.change.editor', { taskId: data.taskId, processInstanceId: data.procInstId });
  266. } else if (data.type == 3) {
  267. $state.go('app.problem.editor', { taskId: data.taskId, processInstanceId: data.procInstId });
  268. } else if (data.type == 4) {
  269. $state.go('app.means.applyediter', { taskId: data.taskId, processInstanceId: data.procInstId });
  270. }
  271. }
  272. //消息通知
  273. // api_user_data.fetchDataList('user', { "idx": 0, "sum": 10 }).then(function(response) {
  274. // if (response) {
  275. // if (response.status = 200) {
  276. // $scope.userlist = response.list;
  277. // }
  278. // }
  279. // })
  280. $scope.message_yes = function(type) { //已读0
  281. var fildata = { "idx": 0, "sum": 5, "messageStation": { "readStatus": 1, "userId": $rootScope.user.id } };
  282. api_msg.msgDataList(fildata).then(function(data) {
  283. if (data.status == 200) {
  284. api_user_data.fetchDataList('user', { "idx": 0, "sum": 1000, user: {engineer: 1,} }).then(function(response) {
  285. if (response) {
  286. $scope.xiaoxilist = data.list;
  287. angular.forEach(data.list, function(item, index) {
  288. angular.forEach(response.list, function(itemone) {
  289. if (item.userId == itemone.id) {
  290. $scope.xiaoxilist[index].user = itemone;
  291. }
  292. })
  293. })
  294. }
  295. })
  296. } else {}
  297. })
  298. };
  299. $scope.message_yes();
  300. //代办事项
  301. function getincidentlist(fildata) {
  302. api_statistic.getTask($rootScope.user.id, $scope.filterData.idx, 5).then(function(data) {
  303. if (data) {
  304. // var myData = Restangular.stripRestangular(data);
  305. // var list = [];
  306. $scope.totalPage = Math.ceil(data.sum / 5);
  307. // $scope.myData = myData.data;
  308. // for (var i = 0; i < $scope.myData.length; i++) {
  309. // $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum
  310. // }
  311. if ($scope.totalPage <= 1) {
  312. $scope.gaoliangright = true;
  313. }
  314. $scope.incidentlist = data.task;
  315. angular.forEach($scope.incidentlist, function(item) {
  316. if (item.type == 1) {
  317. item.tolabelname = "事件工单"
  318. } else if (item.type == 2) {
  319. item.tolabelname = "变更工单"
  320. } else if (item.type == 3) {
  321. item.tolabelname = "问题工单"
  322. } else if (item.type == 4) {
  323. item.tolabelname = "资产审核"
  324. }
  325. })
  326. // $scope.tableParams = new ngTableParams({
  327. // page: 1, // show first page
  328. // count: 5 // count per page
  329. // }, {
  330. // total: $scope.incidentlist.length, // length of data
  331. // getData: function($defer, params) {
  332. // $defer.resolve($scope.incidentlist.slice((params.page() - 1) * params.count(), params.page() * params.count()));
  333. // }
  334. // });
  335. } else {
  336. SweetAlert.swal({
  337. title: "系统错误",
  338. text: "请稍后再试!",
  339. type: "error"
  340. });
  341. }
  342. }, function() {});
  343. }
  344. getincidentlist(filterDataone, )
  345. //翻页
  346. $scope.parselist = function() {
  347. if ($scope.gaoliangleft == false) {
  348. $scope.incidentlist = [];
  349. $scope.filterData.idx = $scope.filterData.idx - 1;
  350. if ($scope.filterData.idx == 0) {
  351. $scope.gaoliangleft = true;
  352. }
  353. $scope.gaoliangright = false;
  354. getincidentlist($scope.filterData)
  355. }
  356. }
  357. $scope.nextlist = function() {
  358. if ($scope.gaoliangright == false) {
  359. $scope.incidentlist = [];
  360. $scope.filterData.idx = $scope.filterData.idx + 1;
  361. if ($scope.filterData.idx == $scope.totalPage - 1) {
  362. $scope.gaoliangright = true;
  363. }
  364. $scope.gaoliangleft = false;
  365. getincidentlist($scope.filterData)
  366. }
  367. }
  368. //告警列表
  369. api_bpm_data.fetchDataList("alarmIncident", filterDatatwo, 'alarmIncident').then(function(data) {
  370. $scope.myDataalarmincident = data.list;
  371. }, function() {
  372. });
  373. //start事件月统计图
  374. var domfault = document.getElementById("fault");
  375. var myChartfault = echarts.init(domfault);
  376. var app = {};
  377. var optionfault = null;
  378. app.title = '当月事件工单处理TOP5';
  379. var XData = [];
  380. var yData = [];
  381. // XData.map(function() {
  382. // yData.push((Math.random() * 1000 + 100).toFixed(0))
  383. // })
  384. // var dataMin=parseInt(Math.min.apply(null, yData)/2);
  385. myChartfault.showLoading({  
  386. text: '数据加载中...',
  387. color: '#c23531',
  388. textColor: '#fff',
  389. maskColor: 'rgba(255,255,255,0)',
  390. zlevel: 0
  391. });
  392. myChartfault.hideLoading();
  393. optionfault = {
  394. title: {
  395. // text: '(件)故障数量',
  396. x: '10',
  397. y: '0',
  398. textStyle: {
  399. fontWeight: 'normal',
  400. fontSize: 12,
  401. color: "#56c9ff",
  402. }
  403. },
  404. xAxis: {
  405. axisTick: {
  406. show: false
  407. },
  408. splitLine: {
  409. show: false,
  410. },
  411. splitArea: {
  412. show: false
  413. },
  414. // data: XData,
  415. data: ['', '', '', '', ''],
  416. axisLine: {
  417. lineStyle: {
  418. color: '#ddd'
  419. }
  420. },
  421. axisLabel: {
  422. textStyle: {
  423. color: '#999999',
  424. fontSize: 12,
  425. }
  426. },
  427. },
  428. yAxis: {
  429. axisTick: {
  430. show: false
  431. },
  432. splitLine: {
  433. show: true,
  434. lineStyle: {
  435. type: 'dashed',
  436. color: '#eee'
  437. }
  438. },
  439. splitArea: {
  440. show: false
  441. },
  442. axisLabel: {
  443. show: true,
  444. textStyle: {
  445. color: '#999999',
  446. fontSize: 12,
  447. }
  448. },
  449. axisLine: {
  450. show: false,
  451. lineStyle: {
  452. color: '#4d4d4d'
  453. }
  454. }
  455. },
  456. grid: {
  457. left: 10,
  458. top: 25,
  459. bottom: 0,
  460. right: 10,
  461. containLabel: true
  462. },
  463. "tooltip": {
  464. "trigger": "item",
  465. "textStyle": {
  466. "fontSize": 12
  467. },
  468. "formatter": "{b0}:{c0}"
  469. },
  470. series: {
  471. type: "bar",
  472. itemStyle: {
  473. normal: {
  474. color: function(params) {
  475. // type = 'linear';
  476. var colorList = [
  477. '#204266', '#1b3651', '#00437a', '#005395', '#79a3c4'
  478. ];
  479. return colorList[params.dataIndex]
  480. },
  481. }
  482. },
  483. label: {
  484. normal: {
  485. show: true,
  486. position: 'top',
  487. textStyle: {
  488. // color: '#56c9ff'
  489. }
  490. }
  491. },
  492. barWidth: 18,
  493. // barWidth: '30%',
  494. // data: yData
  495. data: [0, 0, 0, 0, 0]
  496. }
  497. };
  498. // if (optionfault && typeof optionfault === "object") {
  499. // myChartfault.setOption(optionfault, true);
  500. // }
  501. function getinternettop5(data) {
  502. api_newreport.fetchDataList('handlePersonResolve', data).then(function(data) {
  503. if (data.status == 200) {
  504. var xaxisdata = [];
  505. if (data.data.length > 0) {
  506. for (var i = 0; i < 5 && i < data.data.length; i++) {
  507. xaxisdata.push(data.data[i].name);
  508. }
  509. for (var i = 0; i < data.data.length; i++) {
  510. if (data.data[i].name == $rootScope.user.name) {
  511. $scope.paiming = i + 1;
  512. break
  513. } else {
  514. $scope.paiming = "(暂无)";
  515. }
  516. }
  517. } else {
  518. $scope.paiming = "(暂无)";
  519. }
  520. // angular.forEach(data.data, function(item, index) {
  521. // if (item.name == $rootScope.user.name) {
  522. // $scope.paiming = I
  523. // }
  524. // })
  525. optionfault.xAxis.data = xaxisdata;
  526. optionfault.series.data[0] = parseInt(data.data[0] ? data.data[0].num : 0);
  527. optionfault.series.data[1] = parseInt(data.data[1] ? data.data[1].num : 0);
  528. optionfault.series.data[2] = parseInt(data.data[2] ? data.data[2].num : 0);
  529. optionfault.series.data[3] = parseInt(data.data[3] ? data.data[3].num : 0);
  530. optionfault.series.data[4] = parseInt(data.data[4] ? data.data[4].num : 0);
  531. myChartfault.setOption(optionfault, true);
  532. myChartfault.hideLoading();
  533. }
  534. })
  535. }
  536. $scope.maxtoptime = true;
  537. getinternettop5({ "paramDateFrom": moment(new Date()).startOf('month').format('YYYY-MM-DD 00:00:00'), "paramDateTo": moment(new Date()).endOf('month').format('YYYY-MM-DD 23:59:59') });
  538. var loginUser = $rootScope.user;
  539. var date = new Date();
  540. var d = date.getDate();
  541. var m = date.getMonth();
  542. var y = date.getFullYear();
  543. $scope.scheduleClass = {};
  544. $scope.odr = 2;
  545. $scope.searchstate = 2;
  546. $scope.events = [];
  547. $scope.calendarView = 'month';
  548. $scope.calendarDate = moment().startOf('month').toDate();
  549. $scope.calendarDatejiejue = moment().startOf('month').toDate();
  550. $scope.calendarTitle;
  551. $scope.timeLabel = "时间";
  552. $scope.eventLabel = "描述";
  553. $scope.moment = function(string) {
  554. return moment(string);
  555. }
  556. $scope.eventClicked = function(event) {
  557. // console.log("event="+JSON.stringify(event))
  558. showModal('Clicked', event);
  559. };
  560. $scope.eventEdited = function(event) {
  561. showModal('Edited', event);
  562. };
  563. var updateViews = function(newvalue, oldvalue) {
  564. // if (newvalue.getMonth() > (new Date()).getMonth()) {
  565. // $scope.maxtoptime = true;
  566. // $scope.calendarDate = oldvalue;
  567. // } else {
  568. if (oldvalue == newvalue) return;
  569. $scope.maxtoptime = false;
  570. var timeStart, timeEnd, timeStartSpan, timeEndSpan;
  571. timeStart = moment(newvalue).startOf('month');
  572. timeEnd = moment(newvalue).endOf('month');
  573. timeStartSpan = timeStart.format('YYYY-MM-DD 00:00:00');
  574. timeEndSpan = timeEnd.format('YYYY-MM-DD 23:59:59');
  575. $scope.thisdatatop5 = moment(newvalue).startOf('month').format('YYYY年MM月');
  576. $scope.thismonthtop5 = newvalue.getMonth() + 1;
  577. $scope.thisyertop5 = newvalue.getFullYear();
  578. // if (newvalue.getMonth() == (new Date()).getMonth()) {
  579. // $scope.maxtoptime = true;
  580. // } else {
  581. // $scope.maxtoptime = false;
  582. // }
  583. getinternettop5({ "paramDateFrom": timeStartSpan, "paramDateTo": timeEndSpan });
  584. // }
  585. }
  586. $scope.$watch('calendarDate', updateViews);
  587. $scope.changeyear = function(yeardata) {
  588. $scope.calendarDate = new Date((new Date($scope.calendarDate)).setYear(yeardata));
  589. }
  590. $scope.changemonth = function(monthdata) {
  591. $scope.calendarDate = new Date((new Date($scope.calendarDate)).setMonth(monthdata - 1));
  592. }
  593. $scope.next = function() {
  594. $scope.getmonth = 'nextmonth';
  595. $scope.calendarControl.next();
  596. }
  597. $scope.prev = function() {
  598. $scope.calendarControl.prev();
  599. }
  600. $scope.setCalendarToToday = function() {
  601. $scope.calendarDay = new Date();
  602. };
  603. $scope.toggle = function($event, field, event) {
  604. $event.preventDefault();
  605. $event.stopPropagation();
  606. event[field] = !event[field];
  607. };
  608. // $scope.nexttop5 = function() {
  609. // $state.go('app.desk.chart');
  610. // }
  611. // setInterval(function() {
  612. // getinternettop5({ "paramDateFrom": "2018-09-01 00:00:00", "paramDateTo": "2018-09-30 23:59:59" });
  613. // }, 10000);
  614. //end事件月统计图
  615. //当月工单解决率
  616. var domfinish = document.getElementById("finish");
  617. var myChartfinish = echarts.init(domfinish);
  618. var app = {};
  619. var optionfinish = null;
  620. app.title = '当月工单解决率';
  621. myChartfinish.showLoading({  
  622. text: '数据加载中...',
  623. color: '#c23531',
  624. textColor: '#fff',
  625. maskColor: 'rgba(255,255,255,0)',
  626. zlevel: 0
  627. });
  628. myChartfinish.hideLoading();
  629. optionfinish = {
  630. title: {
  631. "text": 0,
  632. subtext: '事件总数',
  633. itemGap: 3,
  634. "x": '48%',
  635. "y": '35%',
  636. textAlign: "center",
  637. "textStyle": {
  638. "fontWeight": 'normal',
  639. "fontSize": 18,
  640. "color": '#005395',
  641. },
  642. "subtextStyle": {
  643. "fontWeight": 'normal',
  644. "fontSize": 12,
  645. "color": '#333',
  646. "lineHeight": 14
  647. },
  648. },
  649. tooltip: {
  650. // show: false,
  651. trigger: 'item',
  652. formatter: function(a) {
  653. // console.log(a)
  654. return (
  655. a['data']['name'] + ":" + a['data']['value']
  656. )
  657. },
  658. position: ['50%', '30%']
  659. },
  660. grid: {
  661. left: 10,
  662. top: 0,
  663. bottom: 0,
  664. right: 10,
  665. containLabel: true
  666. },
  667. legend: {
  668. show: true,
  669. orient: 'vertical',
  670. x: 'center',
  671. // y: 'bottom',
  672. bottom: 40,
  673. itemWidth: 14,
  674. itemHeight: 14,
  675. // shadowOffsetX: 20,
  676. textStyle: {
  677. fontSize: '14',
  678. fontWeight: 'normal',
  679. color: '#666',
  680. },
  681. data: ['按时解决', '逾期解决'],
  682. formatter: function(name) {
  683. var oa = optionfinish.series[0].data;
  684. var num = oa[0].value + oa[1].value + oa[2].value;
  685. for (var i = 0; i < optionfinish.series[0].data.length; i++) {
  686. if (name == oa[i].name) {
  687. return ' ' + name + ' ' + oa[i].value + ' ' + oa[i].percent + '%';
  688. }
  689. }
  690. }
  691. },
  692. "color": ["#79a3c4", "#005395", "transparent", "transparent"],
  693. "startAngle": 180,
  694. series: [{
  695. name: '',
  696. type: 'pie',
  697. radius: ['60%', '80%'],
  698. avoidLabelOverlap: false,
  699. startAngle: 180,
  700. center: ["50%", "50%"],
  701. //stillShowZeroSum:0,
  702. label: {
  703. normal: {
  704. show: false,
  705. position: 'inner',
  706. textStyle: {
  707. color: '#fff',
  708. fontSize: 12
  709. }
  710. },
  711. emphasis: {
  712. show: false,
  713. textStyle: {
  714. fontSize: '12',
  715. fontWeight: 'bold'
  716. }
  717. }
  718. },
  719. labelLine: {
  720. normal: {
  721. show: false
  722. }
  723. },
  724. data: [{ value: 50, name: '按时解决' }, { value: 50, name: '逾期解决' }, { value: 50, name: '', tooltip: { formatter: function(a) { return "" } } }, { value: 50, name: '', tooltip: { formatter: function(a) { return "" } } }]
  725. }]
  726. };
  727. // if (optionfinish && typeof optionfinish === "object") {
  728. // myChartfinish.setOption(optionfinish, true);
  729. // }
  730. function getinternetAlarm(data) {
  731. api_newreport.fetchDataList('getIncidentSolveRatio', data).then(function(data) {
  732. if (data.code == 200) {
  733. optionfinish.series[0].data[0].value = data.noOverdue;
  734. optionfinish.series[0].data[0].percent = data.noOverdueRatio;
  735. optionfinish.series[0].data[1].value = data.overdue;
  736. optionfinish.series[0].data[1].percent = data.overdueRatio;
  737. optionfinish.series[0].data[2].value = data.sum / 2;
  738. optionfinish.series[0].data[3].value = data.sum / 2;
  739. optionfinish.title.text = data.sum;
  740. myChartfinish.setOption(optionfinish, true);
  741. myChartfinish.hideLoading();
  742. } else {
  743. // optionfinish.series[0].data[0].value = 0;
  744. // optionfinish.series[0].data[1].value = 0;
  745. // optionfinish.series[0].data[2].value = 0;
  746. // myChartfinish.setOption(optionfinish);
  747. // myChartfinish.hideLoading();
  748. }
  749. })
  750. }
  751. getinternetAlarm({ "date": $scope.thissomedata });
  752. var updateViewsalarm = function(newvalue, oldvalue) {
  753. if (oldvalue == newvalue) return;
  754. var timeStart, timeEnd, timeStartSpan, timeEndSpan;
  755. timeStart = moment(newvalue).startOf('month');
  756. timeEnd = moment(newvalue).endOf('month');
  757. timeStartSpan = timeStart.format('YYYY-MM-DD 00:00:00');
  758. timeEndSpan = timeEnd.format('YYYY-MM-DD 23:59:59');
  759. $scope.thisdatajiejue = moment(newvalue).startOf('month').format('YYYY年MM月');
  760. $scope.thismonthjiejue = newvalue.getMonth() + 1;
  761. $scope.thisyerjiejue = newvalue.getFullYear();
  762. getinternetAlarm({ "date": timeStart.format('YYYY-MM') });
  763. }
  764. $scope.$watch('calendarDatejiejue', updateViewsalarm)
  765. $scope.jiejueyear = function(yeardata) {
  766. $scope.calendarDatejiejue = new Date((new Date($scope.calendarDatejiejue)).setYear(yeardata));
  767. }
  768. $scope.jiejuemonth = function(monthdata) {
  769. $scope.calendarDatejiejue = new Date((new Date($scope.calendarDatejiejue)).setMonth(monthdata - 1));
  770. }
  771. //知识库撰写量
  772. var domknowlege = document.getElementById("knowlege");
  773. var myChartknowlege = echarts.init(domknowlege);
  774. var app = {};
  775. var optionknowlege = null;
  776. app.title = '知识库撰写量';
  777. myChartknowlege.showLoading({  
  778. text: '数据加载中...',
  779. color: '#c23531',
  780. textColor: '#fff',
  781. maskColor: 'rgba(255,255,255,0)',
  782. zlevel: 0
  783. });
  784. myChartknowlege.hideLoading();
  785. optionknowlege = {
  786. title: {
  787. "text": 0,
  788. subtext: '知识库总数',
  789. itemGap: 3,
  790. "x": '48%',
  791. "y": '35%',
  792. textAlign: "center",
  793. "textStyle": {
  794. "fontWeight": 'normal',
  795. "fontSize": 18,
  796. "color": '#005395',
  797. },
  798. "subtextStyle": {
  799. "fontWeight": 'normal',
  800. "fontSize": 12,
  801. "color": '#333',
  802. "lineHeight": 14
  803. },
  804. },
  805. tooltip: {
  806. // show: false,
  807. trigger: 'item',
  808. formatter: function(a) {
  809. // console.log(a)
  810. return (
  811. a['data']['name'] + ":" + a['data']['value']
  812. )
  813. },
  814. position: ['50%', '30%']
  815. },
  816. grid: {
  817. left: 10,
  818. top: 0,
  819. bottom: 0,
  820. right: 10,
  821. containLabel: true
  822. },
  823. legend: {
  824. show: true,
  825. orient: 'vertical',
  826. x: 'center',
  827. // y: 'bottom',
  828. bottom: 40,
  829. itemWidth: 14,
  830. itemHeight: 14,
  831. // shadowOffsetX: 20,
  832. textStyle: {
  833. fontSize: '14',
  834. fontWeight: 'normal',
  835. color: '#666',
  836. },
  837. data: ['我撰写', '其他人撰写'],
  838. formatter: function(name) {
  839. var oa = optionknowlege.series[0].data;
  840. var num = parseInt(oa[0].value) + parseInt(oa[1].value) + parseInt(oa[2].value);
  841. for (var i = 0; i < optionknowlege.series[0].data.length; i++) {
  842. if (name == oa[i].name) {
  843. return ' ' + name + ' ' + oa[i].value + ' ' + oa[i].percent + '%';
  844. }
  845. }
  846. }
  847. },
  848. "color": ["#005395", "#79a3c4", "transparent", "transparent"],
  849. "startAngle": 180,
  850. series: [{
  851. name: '',
  852. type: 'pie',
  853. radius: ['60%', '80%'],
  854. avoidLabelOverlap: false,
  855. startAngle: 180,
  856. center: ["50%", "50%"],
  857. label: {
  858. normal: {
  859. show: false,
  860. position: 'inner',
  861. textStyle: {
  862. color: '#fff',
  863. fontSize: 12
  864. },
  865. // formatter: function(params) {
  866. // if (params.value > 0) {
  867. // return params.percent + '%'
  868. // } else {
  869. // return ''
  870. // }
  871. // }
  872. },
  873. emphasis: {
  874. show: false,
  875. textStyle: {
  876. fontSize: '12',
  877. fontWeight: 'bold'
  878. }
  879. }
  880. },
  881. labelLine: {
  882. normal: {
  883. show: false
  884. }
  885. },
  886. data: [{ value: 50, name: '我撰写' }, { value: 50, name: '其他人撰写' }, { value: 50, name: '', tooltip: { formatter: function(a) { return "" } } }, { value: 50, name: '', tooltip: { formatter: function(a) { return "" } } }]
  887. }]
  888. };
  889. // if (optionknowlege && typeof optionknowlege === "object") {
  890. // myChartknowlege.setOption(optionknowlege, true);
  891. // }
  892. function getinternetknow(data) {
  893. api_newreport.fetchDataList('getSolutionCountByMyself', data).then(function(data) {
  894. if (data.status == "200") {
  895. optionknowlege.series[0].data[0].value = data.data[0] ? data.data[0].num : 0;
  896. optionknowlege.series[0].data[0].percent = data.data[0] ? data.data[0].percent : 0
  897. if (data.data == 0) {
  898. optionknowlege.series[0].data[1].percent = 0
  899. } else {
  900. optionknowlege.series[0].data[1].percent = data.otherPercent ? data.otherPercent : 0
  901. }
  902. optionknowlege.series[0].data[1].value = data.total - (data.data[0] ? data.data[0].num : 0);
  903. optionknowlege.series[0].data[2].value = data.total / 2;
  904. optionknowlege.series[0].data[3].value = data.total / 2;
  905. optionknowlege.title.text = data.total;
  906. myChartknowlege.setOption(optionknowlege, true);
  907. myChartknowlege.hideLoading();
  908. } else {
  909. }
  910. })
  911. }
  912. getinternetknow({ "user": $rootScope.user.id });
  913. } else {
  914. SweetAlert.swal("用户名或者密码验证失败,请重试!", "error");
  915. }
  916. })
  917. // $scope.login_signquick(theRequest)
  918. } else {
  919. var filterDataone = {
  920. "assignee": $rootScope.user.id,
  921. "searchType": "todo",
  922. "idx": 0,
  923. "sum": 5
  924. }
  925. var filterDatatwo = {
  926. "alarmIncident": { "state": "未处理" },
  927. "idx": 0,
  928. "sum": 5
  929. }
  930. $scope.filterData = {
  931. "assignee": $rootScope.user.id,
  932. "searchType": "todo",
  933. "idx": 0,
  934. "sum": 5
  935. }
  936. $scope.nian = [(new Date()).getFullYear(), (new Date()).getFullYear() - 1, (new Date()).getFullYear() - 2, (new Date()).getFullYear() - 3, (new Date()).getFullYear() - 4, (new Date()).getFullYear() - 5, (new Date()).getFullYear() - 6, (new Date()).getFullYear() - 7, (new Date()).getFullYear() - 8, (new Date()).getFullYear() - 9, (new Date()).getFullYear() - 10, (new Date()).getFullYear() - 11, (new Date()).getFullYear() - 12, (new Date()).getFullYear() - 13, (new Date()).getFullYear() - 14, (new Date()).getFullYear() - 15, (new Date()).getFullYear() - 16, (new Date()).getFullYear() - 17, (new Date()).getFullYear() - 18, (new Date()).getFullYear() - 19];
  937. $scope.yue = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
  938. changeDivHeight();
  939. window.onresize = function() { changeDivHeight(); }
  940. function changeDivHeight() {
  941. var h = document.documentElement.clientHeight; //获取页面可见高度  
  942. $scope.bodyheight = { "height": h + "px" };
  943. $scope.sumline = (h - 60) * 0.45 / 34;
  944. }
  945. //角色判断
  946. for (var i = 0; i < $rootScope.user.role.length; i++) {
  947. if ($rootScope.user.role[i].rolecode == "call center") {
  948. $scope.thisuserrole = "center";
  949. break;
  950. } else if ($rootScope.user.role[i].rolecode == "admin general") {
  951. $scope.thisuserrole = "admin";
  952. break;
  953. } else if ($rootScope.user.role[i].rolecode == "3164d1ab-b733-4cb0-98bc-7d1593df3ebc") {
  954. $scope.thisuserrole = "yunwei";
  955. break;
  956. }
  957. }
  958. $scope.gowechart = function() {
  959. $state.go('app.desk.chart');
  960. }
  961. $scope.gobaojin = function() {
  962. $state.go('app.desk.jry_emergency');
  963. }
  964. $scope.goWxWeb = function() {
  965. $state.go('app.desk.chart');
  966. }
  967. $scope.goCalllog = function() {
  968. $state.go('app.desk.calllog');
  969. }
  970. $scope.goliuyan = function() {
  971. $state.go('app.desk.record');
  972. }
  973. $scope.gotonghua = function() {
  974. $state.go('app.desk.calllog');
  975. }
  976. $scope.gonewincident = function() {
  977. $state.go('app.incident.editor');
  978. }
  979. $scope.goyuqi = function() {
  980. var fildata = { searchType: "all" }
  981. $state.go('app.incident.list', { model: JSON.stringify(fildata) });
  982. window.sessionStorage.setItem('isGoyuqi','yes');
  983. }
  984. $scope.goknowledge = function() {
  985. $state.go('app.knowledge.manager');
  986. }
  987. $scope.gohuifang = function() {
  988. $state.go('app.incident.list');
  989. }
  990. $scope.gopaiban = function() {
  991. $state.go('app.scheduling.myscheduling');
  992. }
  993. //新建问题
  994. $scope.gonewproblem = function() {
  995. $state.go('app.problem.editor');
  996. }
  997. //新建变更
  998. $scope.gonewchange = function() {
  999. $state.go('app.change.editor');
  1000. }
  1001. //cmdb
  1002. $scope.gocmdb = function() {
  1003. $state.go('app.means.listd');
  1004. }
  1005. $scope.jingjiinform = function(row) {
  1006. if (row.alarm.alarmExtension) {
  1007. row.alarm.alarmExtension = row.alarm.alarmExtension.replace('{', "");
  1008. row.alarm.alarmExtension = row.alarm.alarmExtension.replace('}', "");
  1009. row.alarm.alarmExtension = row.alarm.alarmExtension.replace(/,/g, '\n');
  1010. }
  1011. event.stopPropagation();
  1012. var modelfile = { model: row };
  1013. $state.go('app.desk.form_editor', { formKey: 'desk_emergency', service: 'api_user_data', model: JSON.stringify(modelfile) });
  1014. };
  1015. //去处理
  1016. $scope.gotuclose = function(data) {
  1017. if (data.type == 1) {
  1018. $state.go('app.incident.editor', { taskId: data.taskId, processInstanceId: data.procInstId,dataId: data.id });
  1019. } else if (data.type == 2) {
  1020. $state.go('app.change.editor', { taskId: data.taskId, processInstanceId: data.procInstId });
  1021. } else if (data.type == 3) {
  1022. $state.go('app.problem.editor', { taskId: data.taskId, processInstanceId: data.procInstId });
  1023. } else if (data.type == 4) {
  1024. $state.go('app.means.applyediter', { taskId: data.taskId, processInstanceId: data.procInstId });
  1025. }
  1026. }
  1027. // 消息通知
  1028. $scope.message_yes = function(type) {
  1029. var fildata = { "idx": 0, "sum": 5, "messageStation": { "readStatus": 0, "userId": $rootScope.user.id } };
  1030. api_msg.msgDataList(fildata).then(function(data) {
  1031. if (data.status == 200) {
  1032. api_user_data.fetchDataList('user', { "idx": 0, "sum": 1000,user: {engineer: 1,} }).then(function(response) {
  1033. if (response) {
  1034. $scope.xiaoxilist = data.list;
  1035. angular.forEach(data.list, function(item, index) {
  1036. angular.forEach(response.list, function(itemone) {
  1037. if (item.userId == itemone.id) {
  1038. $scope.xiaoxilist[index].user = itemone;
  1039. }
  1040. })
  1041. })
  1042. }
  1043. })
  1044. } else {}
  1045. })
  1046. };
  1047. // 最新五条微信WEB工单(未受理)
  1048. $scope.wxWebList = [];
  1049. $scope.getWxWeb = function() {
  1050. var filterData = {
  1051. "idx": 0,
  1052. "sum": 5,
  1053. "wxincident": {
  1054. "serviceState": {
  1055. "id": 1650
  1056. }
  1057. }
  1058. };
  1059. // 根据权限查询
  1060. if($rootScope.user.duty){
  1061. // 当前的所属责任科室
  1062. filterData.wxincident.duty = $rootScope.user.duty;
  1063. }else if($rootScope.user.branch){
  1064. // 当前的所属院区
  1065. filterData.wxincident.branch = $rootScope.user.branch.id;
  1066. }
  1067. api_bpm_data.fetchDataList("wxincident", filterData).then(function(data) {
  1068. if (data.status == 200) {
  1069. $scope.wxWebList = data.list;
  1070. }
  1071. })
  1072. };
  1073. // 最新五条通话记录
  1074. $scope.calllogList = [];
  1075. $scope.getCalllog = function() {
  1076. var filterData = {
  1077. "idx": 0,
  1078. "sum": 5,
  1079. callrecord: {
  1080. todayTime: moment().format('YYYY-MM-DD') + ' 00:00:00',
  1081. todayTimeEnd: moment().format('YYYY-MM-DD') + ' 23:59:59'
  1082. }
  1083. };
  1084. api_bpm_data.fetchDataList("callrecord", filterData).then(function(data) {
  1085. if (data.status == 200) {
  1086. $scope.calllogList = data.list;
  1087. }
  1088. })
  1089. };
  1090. //录音
  1091. $scope.recordcall = function(data) {
  1092. var modalInstance = $modal.open({
  1093. backdrop: "static",
  1094. templateUrl: 'assets/views/incident/tpl/audio.html',
  1095. controller: function($rootScope, $scope, $modalInstance, $sce, $http, api_playservice) {
  1096. $scope.audioUrl=$sce.trustAsResourceUrl(callIp+data.recordingFileName);
  1097. $scope.cancel = function() {
  1098. $modalInstance.dismiss('cancel');
  1099. };
  1100. $modalInstance.close();
  1101. }
  1102. });
  1103. modalInstance.result.then(function(result) {
  1104. // $rootScope.setidle();
  1105. }, function(reason) {
  1106. $rootScope.setidle();
  1107. });
  1108. };
  1109. // 近15天建单数(当前用户建单数
  1110. $scope.getInfo5 = function(){
  1111. // 近15天建单数(当前用户建单数)start
  1112. var domfault = document.getElementById("fault");
  1113. var myChartfault = echarts.init(domfault);
  1114. myChartfault.showLoading({  
  1115. text: '数据加载中...',
  1116. color: '#c23531',
  1117. textColor: '#fff',
  1118. maskColor: 'rgba(255,255,255,0)',
  1119. zlevel: 0
  1120. });
  1121. myChartfault.hideLoading();
  1122. var optionfault = {
  1123. tooltip: {
  1124. trigger: "axis",
  1125. axisPointer: {
  1126. // 坐标轴指示器,坐标轴触发有效
  1127. // type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  1128. lineStyle: {
  1129. color: "#49A9EE",
  1130. type: "dotted",
  1131. },
  1132. },
  1133. },
  1134. legend: {
  1135. // data: ["响应平均时长"],
  1136. align: "left",
  1137. // itemWidth:10,
  1138. // itemHeight:10,
  1139. bottom: 0,
  1140. },
  1141. grid: {
  1142. left: "1%",
  1143. right: "0%",
  1144. bottom: "15%",
  1145. containLabel: true,
  1146. },
  1147. xAxis: [
  1148. {
  1149. type: "category",
  1150. // axisTick: {
  1151. // alignWithLabel: true
  1152. // },
  1153. axisLabel: {
  1154. interval:0,
  1155. textStyle: {
  1156. color: "#7B7B7B",
  1157. // fontSize: '14',
  1158. },
  1159. },
  1160. axisLine: {
  1161. show: true,
  1162. lineStyle: {
  1163. color: "#7B7B7B",
  1164. // type: 'dotted'
  1165. },
  1166. },
  1167. data: [],
  1168. },
  1169. ],
  1170. yAxis: [
  1171. {
  1172. type: "value",
  1173. scale: true,
  1174. name: "单数",
  1175. min: 0,
  1176. boundaryGap: [0.2, 0.2],
  1177. minInterval: 1,
  1178. // axisLabel: {
  1179. // formatter: '{value}'
  1180. // }
  1181. axisLabel: {
  1182. textStyle: {
  1183. color: "#7B7B7B",
  1184. // fontSize: '14',
  1185. },
  1186. },
  1187. axisLine: {
  1188. show: true,
  1189. lineStyle: {
  1190. color: "#7B7B7B",
  1191. // type: 'dotted'
  1192. },
  1193. },
  1194. },
  1195. ],
  1196. series: [
  1197. {
  1198. name: "单数",
  1199. type: "line",
  1200. itemStyle: {
  1201. normal: {
  1202. color: "#49A9EE",
  1203. },
  1204. },
  1205. lineStyle: {
  1206. normal: {
  1207. color: "#49A9EE",
  1208. },
  1209. },
  1210. data: [],
  1211. }
  1212. ],
  1213. };
  1214. function getinternettop5(data) {
  1215. api_bpm_data.createIncidentCount(data).then(function(data) {
  1216. if (data.status == 200) {
  1217. optionfault.xAxis[0].data = data.data.map(v => v[0]);
  1218. optionfault.series[0].data = data.data.map(v => v[1]);
  1219. myChartfault.setOption(optionfault, true);
  1220. myChartfault.hideLoading();
  1221. }
  1222. })
  1223. }
  1224. getinternettop5({ "startTime": moment().day(moment().day() - 14).format('YYYY-MM-DD 00:00:00'), "endTime": moment().format('YYYY-MM-DD 23:59:59'), userId: $rootScope.user.id });
  1225. // 近15天建单数(当前用户建单数)end
  1226. }
  1227. //知识库撰写量
  1228. $scope.getInfo6 = function(){
  1229. //知识库撰写量
  1230. var domknowlege = document.getElementById("knowlege");
  1231. var myChartknowlege = echarts.init(domknowlege);
  1232. var app = {};
  1233. var optionknowlege = null;
  1234. app.title = '知识库撰写量';
  1235. myChartknowlege.showLoading({  
  1236. text: '数据加载中...',
  1237. color: '#c23531',
  1238. textColor: '#fff',
  1239. maskColor: 'rgba(255,255,255,0)',
  1240. zlevel: 0
  1241. });
  1242. myChartknowlege.hideLoading();
  1243. optionknowlege = {
  1244. title: {
  1245. "text": 0,
  1246. subtext: '知识库总数',
  1247. itemGap: 3,
  1248. "x": '48%',
  1249. "y": '35%',
  1250. textAlign: "center",
  1251. "textStyle": {
  1252. "fontWeight": 'normal',
  1253. "fontSize": 18,
  1254. "color": '#005395',
  1255. },
  1256. "subtextStyle": {
  1257. "fontWeight": 'normal',
  1258. "fontSize": 12,
  1259. "color": '#333',
  1260. "lineHeight": 14
  1261. },
  1262. },
  1263. tooltip: {
  1264. // show: false,
  1265. trigger: 'item',
  1266. formatter: function(a) {
  1267. // console.log(a)
  1268. return (
  1269. a['data']['name'] + ":" + a['data']['value']
  1270. )
  1271. },
  1272. position: ['50%', '30%']
  1273. },
  1274. grid: {
  1275. left: 10,
  1276. top: 0,
  1277. bottom: 0,
  1278. right: 10,
  1279. containLabel: true
  1280. },
  1281. legend: {
  1282. show: true,
  1283. orient: 'vertical',
  1284. x: 'center',
  1285. // y: 'bottom',
  1286. bottom: 40,
  1287. itemWidth: 14,
  1288. itemHeight: 14,
  1289. // shadowOffsetX: 20,
  1290. textStyle: {
  1291. fontSize: '14',
  1292. fontWeight: 'normal',
  1293. color: '#666',
  1294. },
  1295. data: ['我撰写', '其他人撰写'],
  1296. formatter: function(name) {
  1297. var oa = optionknowlege.series[0].data;
  1298. var num = parseInt(oa[0].value) + parseInt(oa[1].value) + parseInt(oa[2].value);
  1299. for (var i = 0; i < optionknowlege.series[0].data.length; i++) {
  1300. if (name == oa[i].name) {
  1301. return ' ' + name + ' ' + oa[i].value + ' ' + oa[i].percent + '%';
  1302. }
  1303. }
  1304. }
  1305. },
  1306. "color": ["#005395", "#79a3c4", "transparent", "transparent"],
  1307. "startAngle": 180,
  1308. series: [{
  1309. name: '',
  1310. type: 'pie',
  1311. radius: ['60%', '80%'],
  1312. avoidLabelOverlap: false,
  1313. startAngle: 180,
  1314. center: ["50%", "50%"],
  1315. label: {
  1316. normal: {
  1317. show: false,
  1318. position: 'inner',
  1319. textStyle: {
  1320. color: '#fff',
  1321. fontSize: 12
  1322. },
  1323. // formatter: function(params) {
  1324. // if (params.value > 0) {
  1325. // return params.percent + '%'
  1326. // } else {
  1327. // return ''
  1328. // }
  1329. // }
  1330. },
  1331. emphasis: {
  1332. show: false,
  1333. textStyle: {
  1334. fontSize: '12',
  1335. fontWeight: 'bold'
  1336. }
  1337. }
  1338. },
  1339. labelLine: {
  1340. normal: {
  1341. show: false
  1342. }
  1343. },
  1344. data: [{ value: 50, name: '我撰写' }, { value: 50, name: '其他人撰写' }, { value: 50, name: '', tooltip: { formatter: function(a) { return "" } } }, { value: 50, name: '', tooltip: { formatter: function(a) { return "" } } }]
  1345. }]
  1346. };
  1347. function getinternetknow(data) {
  1348. api_newreport.fetchDataList('getSolutionCountByMyself', data).then(function(data) {
  1349. if (data.status == "200") {
  1350. optionknowlege.series[0].data[0].value = data.data[0] ? data.data[0].num : 0;
  1351. optionknowlege.series[0].data[0].percent = data.data[0] ? data.data[0].percent : 0
  1352. if (data.data == 0) {
  1353. optionknowlege.series[0].data[1].percent = 0
  1354. } else {
  1355. optionknowlege.series[0].data[1].percent = data.otherPercent ? data.otherPercent : 0
  1356. }
  1357. optionknowlege.series[0].data[1].value = data.total - (data.data[0] ? data.data[0].num : 0);
  1358. optionknowlege.series[0].data[2].value = data.total / 2;
  1359. optionknowlege.series[0].data[3].value = data.total / 2;
  1360. optionknowlege.title.text = data.total;
  1361. myChartknowlege.setOption(optionknowlege, true);
  1362. myChartknowlege.hideLoading();
  1363. } else {
  1364. }
  1365. })
  1366. }
  1367. getinternetknow({ "user": $rootScope.user.id });
  1368. }
  1369. //科室基础信息展示
  1370. $scope.dutyOrderCountList = [];
  1371. $scope.dutyOrderCount = function(){
  1372. var postData = {}
  1373. // 根据权限查询
  1374. if($rootScope.user.duty){
  1375. // 当前的所属责任科室
  1376. postData.dutyId = $rootScope.user.duty.id;
  1377. }else if($rootScope.user.branch){
  1378. // 当前的所属院区
  1379. postData.branchId = $rootScope.user.branch.id;
  1380. }
  1381. api_newreport.fetchDataListIndex('dutyOrderCount', postData).then(function(data) {
  1382. if (data.status == 200) {
  1383. let result = data.data || [];
  1384. $scope.dutyOrderCountList = _.chunk(result, 2);
  1385. }
  1386. })
  1387. }
  1388. //今日各人员工作情况
  1389. $scope.filterDataTodayUserOrderCount = {
  1390. "idx": 0,
  1391. "sum": 5
  1392. }
  1393. $scope.filterDataTodayUserOrderCountTotalPage = 1;
  1394. $scope.gaoliangleftTodayUserOrderCount = true;
  1395. $scope.gaoliangrightTodayUserOrderCount= true;
  1396. $scope.todayUserOrderCountList = [];
  1397. $scope.todayUserOrderCount = function(){
  1398. if(!$scope.parameters.duty1){
  1399. $scope.filterDataTodayUserOrderCountTotalPage = 1;
  1400. $scope.gaoliangleftTodayUserOrderCount = true;
  1401. $scope.gaoliangrightTodayUserOrderCount= true;
  1402. $scope.todayUserOrderCountList = [];
  1403. return;
  1404. }
  1405. $scope.filterDataTodayUserOrderCount.dutyId = $scope.parameters.duty1.id;
  1406. api_newreport.fetchDataListIndex('todayUserOrderCount', $scope.filterDataTodayUserOrderCount).then(function(data) {
  1407. if (data.status == 200) {
  1408. $scope.filterDataTodayUserOrderCountTotalPage = Math.ceil(data.totalNum / 5) || 1;
  1409. $scope.gaoliangrightTodayUserOrderCount = $scope.filterDataTodayUserOrderCount.idx >= $scope.filterDataTodayUserOrderCountTotalPage - 1;
  1410. $scope.gaoliangleftTodayUserOrderCount = $scope.filterDataTodayUserOrderCount.idx <= 0;
  1411. $scope.todayUserOrderCountList = data.data || [];
  1412. }
  1413. })
  1414. }
  1415. //今日各人员工作情况-翻页
  1416. $scope.parselistTodayUserOrderCount = function() {
  1417. if ($scope.gaoliangleftTodayUserOrderCount == false) {
  1418. $scope.todayUserOrderCountList = [];
  1419. $scope.filterDataTodayUserOrderCount.idx = $scope.filterDataTodayUserOrderCount.idx - 1;
  1420. if ($scope.filterDataTodayUserOrderCount.idx <= 0) {
  1421. $scope.gaoliangleftTodayUserOrderCount = true;
  1422. }
  1423. $scope.gaoliangrightTodayUserOrderCount = false;
  1424. $scope.todayUserOrderCount();
  1425. }
  1426. }
  1427. $scope.nextlistTodayUserOrderCount = function() {
  1428. if ($scope.gaoliangrightTodayUserOrderCount == false) {
  1429. $scope.todayUserOrderCountList = [];
  1430. $scope.filterDataTodayUserOrderCount.idx = $scope.filterDataTodayUserOrderCount.idx + 1;
  1431. if ($scope.filterDataTodayUserOrderCount.idx >= $scope.filterDataTodayUserOrderCountTotalPage - 1) {
  1432. $scope.gaoliangrightTodayUserOrderCount = true;
  1433. }
  1434. $scope.gaoliangleftTodayUserOrderCount = false;
  1435. $scope.todayUserOrderCount();
  1436. }
  1437. }
  1438. // 今日各人员工作情况-切换责任科室
  1439. $scope.changeDuty1 = function(){
  1440. $scope.filterDataTodayUserOrderCount.idx = 0;
  1441. $scope.todayUserOrderCount();
  1442. }
  1443. //建单数量排行
  1444. $scope.secondCategoryGraphEcharts = function(){
  1445. // 建单数量排行start
  1446. var domfault = document.getElementById("secondCategoryGraph");
  1447. $scope.myChartfaultSecondCategoryGraph = echarts.init(domfault);
  1448. $scope.secondCategoryGraph();
  1449. // 建单数量排行end
  1450. }
  1451. $scope.secondCategoryGraph = function(){
  1452. if(!$scope.parameters.duty2){
  1453. return;
  1454. }
  1455. api_newreport.fetchDataListIndex('secondCategoryGraph', {dutyId: $scope.parameters.duty2.id}).then(function(data) {
  1456. if (data.status == 200) {
  1457. data.data = data.data || [];
  1458. var optionfault = {
  1459. title: {
  1460. x: '10',
  1461. y: '0',
  1462. textStyle: {
  1463. fontWeight: 'normal',
  1464. fontSize: 12,
  1465. color: "#56c9ff",
  1466. }
  1467. },
  1468. xAxis: {
  1469. axisTick: {
  1470. show: false
  1471. },
  1472. splitLine: {
  1473. show: false,
  1474. },
  1475. splitArea: {
  1476. show: false
  1477. },
  1478. data: [],
  1479. axisLine: {
  1480. lineStyle: {
  1481. color: '#ddd'
  1482. }
  1483. },
  1484. axisLabel: {
  1485. textStyle: {
  1486. color: '#999999',
  1487. fontSize: 12,
  1488. }
  1489. },
  1490. },
  1491. yAxis: {
  1492. minInterval: 1,
  1493. axisTick: {
  1494. show: false
  1495. },
  1496. splitLine: {
  1497. show: true,
  1498. lineStyle: {
  1499. type: 'dashed',
  1500. color: '#eee'
  1501. }
  1502. },
  1503. splitArea: {
  1504. show: false
  1505. },
  1506. axisLabel: {
  1507. show: true,
  1508. textStyle: {
  1509. color: '#999999',
  1510. fontSize: 12,
  1511. }
  1512. },
  1513. axisLine: {
  1514. show: false,
  1515. lineStyle: {
  1516. color: '#4d4d4d'
  1517. }
  1518. }
  1519. },
  1520. grid: {
  1521. left: 10,
  1522. top: 25,
  1523. bottom: 0,
  1524. right: 10,
  1525. containLabel: true
  1526. },
  1527. "tooltip": {
  1528. "trigger": "item",
  1529. "textStyle": {
  1530. "fontSize": 12
  1531. },
  1532. "formatter": "{b0}:{c0}"
  1533. },
  1534. series: {
  1535. type: "bar",
  1536. itemStyle: {
  1537. normal: {
  1538. color: function(params) {
  1539. var colorList = [
  1540. '#204266', '#1b3651', '#00437a', '#005395', '#79a3c4'
  1541. ];
  1542. return colorList[params.dataIndex]
  1543. },
  1544. }
  1545. },
  1546. label: {
  1547. normal: {
  1548. show: true,
  1549. position: 'top',
  1550. textStyle: {}
  1551. }
  1552. },
  1553. barWidth: 18,
  1554. data: []
  1555. }
  1556. };
  1557. var result = _.zip.apply(null, data.data);
  1558. optionfault.xAxis.data = result[0] || [];
  1559. optionfault.series.data = result[1] || [];
  1560. $scope.myChartfaultSecondCategoryGraph.setOption(optionfault, true);
  1561. }
  1562. })
  1563. }
  1564. // 建单数量排行-切换责任科室
  1565. $scope.changeDuty2 = function(){
  1566. $scope.secondCategoryGraph();
  1567. }
  1568. //超时工单
  1569. $scope.filterDataOvertimeOrderCount = {
  1570. "idx": 0,
  1571. "sum": 5
  1572. }
  1573. $scope.filterDataOvertimeOrderCountTotalPage = 1;
  1574. $scope.gaoliangleftOvertimeOrderCount = true;
  1575. $scope.gaoliangrightOvertimeOrderCount= true;
  1576. $scope.overtimeOrderCountList = [];
  1577. $scope.overtimeOrderCount = function(){
  1578. if(!$scope.parameters.duty3){
  1579. $scope.filterDataOvertimeOrderCountTotalPage = 1;
  1580. $scope.gaoliangleftOvertimeOrderCount = true;
  1581. $scope.gaoliangrightOvertimeOrderCount= true;
  1582. $scope.overtimeOrderCountList = [];
  1583. return;
  1584. }
  1585. $scope.filterDataOvertimeOrderCount.dutyId = $scope.parameters.duty3.id;
  1586. api_newreport.fetchDataListIndex('overtimeOrderCount', $scope.filterDataOvertimeOrderCount).then(function(data) {
  1587. if (data.status == 200) {
  1588. $scope.filterDataOvertimeOrderCountTotalPage = Math.ceil(data.totalNum / 5) || 1;
  1589. $scope.gaoliangrightOvertimeOrderCount = $scope.filterDataOvertimeOrderCount.idx >= $scope.filterDataOvertimeOrderCountTotalPage - 1;
  1590. $scope.gaoliangleftOvertimeOrderCount = $scope.filterDataOvertimeOrderCount.idx <= 0;
  1591. $scope.overtimeOrderCountList = data.data || [];
  1592. }
  1593. })
  1594. }
  1595. //超时工单-翻页
  1596. $scope.parselistOvertimeOrderCount = function() {
  1597. if ($scope.gaoliangleftOvertimeOrderCount == false) {
  1598. $scope.overtimeOrderCountList = [];
  1599. $scope.filterDataOvertimeOrderCount.idx = $scope.filterDataOvertimeOrderCount.idx - 1;
  1600. if ($scope.filterDataOvertimeOrderCount.idx <= 0) {
  1601. $scope.gaoliangleftOvertimeOrderCount = true;
  1602. }
  1603. $scope.gaoliangrightOvertimeOrderCount = false;
  1604. $scope.overtimeOrderCount();
  1605. }
  1606. }
  1607. $scope.nextlistOvertimeOrderCount = function() {
  1608. if ($scope.gaoliangrightOvertimeOrderCount == false) {
  1609. $scope.overtimeOrderCountList = [];
  1610. $scope.filterDataOvertimeOrderCount.idx = $scope.filterDataOvertimeOrderCount.idx + 1;
  1611. if ($scope.filterDataOvertimeOrderCount.idx >= $scope.filterDataOvertimeOrderCountTotalPage - 1) {
  1612. $scope.gaoliangrightOvertimeOrderCount = true;
  1613. }
  1614. $scope.gaoliangleftOvertimeOrderCount = false;
  1615. $scope.overtimeOrderCount();
  1616. }
  1617. }
  1618. // 超时工单-切换责任科室
  1619. $scope.changeDuty3 = function(){
  1620. $scope.filterDataOvertimeOrderCount.idx = 0;
  1621. $scope.overtimeOrderCount();
  1622. }
  1623. // 近15天各部门的建单数
  1624. $scope.dutyOrderGraphEcharts = function(){
  1625. var domfault = document.getElementById("fault");
  1626. $scope.myChartfaultDutyOrderGraph = echarts.init(domfault);
  1627. $scope.dutyOrderGraph();
  1628. }
  1629. $scope.dutyOrderGraph = function(){
  1630. // 近15天各部门的建单数start
  1631. var postData = {}
  1632. // 根据权限查询
  1633. if($rootScope.user.duty){
  1634. // 当前的所属责任科室
  1635. postData.dutyId = $rootScope.user.duty.id;
  1636. }else if($rootScope.user.branch){
  1637. // 当前的所属院区
  1638. postData.branchId = $rootScope.user.branch.id;
  1639. }
  1640. api_newreport.fetchDataListIndex('dutyOrderGraph', postData).then(function(data) {
  1641. if (data.status == 200) {
  1642. data.dataList = data.dataList || [];
  1643. data.timeList = data.timeList || [];
  1644. data.nameList = data.nameList || [];
  1645. var optionfault = {
  1646. tooltip: {
  1647. trigger: "axis",
  1648. axisPointer: {
  1649. lineStyle: {
  1650. color: "#49A9EE",
  1651. type: "dotted",
  1652. },
  1653. },
  1654. },
  1655. legend: {
  1656. data: data.nameList
  1657. },
  1658. grid: {
  1659. left: "1%",
  1660. right: "0%",
  1661. bottom: "5%",
  1662. containLabel: true,
  1663. },
  1664. xAxis: [
  1665. {
  1666. type: "category",
  1667. axisLabel: {
  1668. interval:0,
  1669. textStyle: {
  1670. color: "#7B7B7B",
  1671. },
  1672. },
  1673. axisLine: {
  1674. show: true,
  1675. lineStyle: {
  1676. color: "#7B7B7B",
  1677. },
  1678. },
  1679. data: [],
  1680. },
  1681. ],
  1682. yAxis: [
  1683. {
  1684. type: "value",
  1685. scale: true,
  1686. name: "单数",
  1687. min: 0,
  1688. boundaryGap: [0.2, 0.2],
  1689. minInterval: 1,
  1690. axisLabel: {
  1691. textStyle: {
  1692. color: "#7B7B7B",
  1693. },
  1694. },
  1695. axisLine: {
  1696. show: true,
  1697. lineStyle: {
  1698. color: "#7B7B7B",
  1699. },
  1700. },
  1701. },
  1702. ],
  1703. series: [],
  1704. };
  1705. optionfault.xAxis[0].data = data.timeList;
  1706. data.dataList.forEach(function(v, i){
  1707. optionfault.series.push({
  1708. name: data.nameList[i],
  1709. type: "line",
  1710. data: v
  1711. })
  1712. })
  1713. $scope.myChartfaultDutyOrderGraph.setOption(optionfault, true);
  1714. }
  1715. })
  1716. // 近15天各部门的建单数end
  1717. }
  1718. // 获取责任科室
  1719. $scope.parameters = {};
  1720. $scope.dutys = [];
  1721. $scope.getOwnDuty = function(isFirst = false){
  1722. api_category.getOwnDuty({}).then(function (response) {
  1723. if (response) {
  1724. if ((response.status = 200)) {
  1725. $scope.dutys = response.data;
  1726. if(isFirst && $scope.dutys[0]){
  1727. $scope.parameters.duty1 = $scope.dutys[0];
  1728. $scope.parameters.duty2 = $scope.dutys[0];
  1729. $scope.parameters.duty3 = $scope.dutys[0];
  1730. $scope.todayUserOrderCount();
  1731. $timeout($scope.secondCategoryGraphEcharts, 0);
  1732. $scope.overtimeOrderCount();
  1733. }
  1734. }
  1735. }
  1736. });
  1737. }
  1738. // 判断是否是事件经理,显示不同页面
  1739. if($scope.isEventManager){
  1740. $scope.getOwnDuty(true);
  1741. $scope.dutyOrderCount();
  1742. $timeout($scope.dutyOrderGraphEcharts, 0);
  1743. }else{
  1744. $scope.getInfo5();
  1745. $scope.getInfo6();
  1746. $scope.getCalllog();
  1747. $scope.getWxWeb();
  1748. $scope.message_yes();
  1749. }
  1750. }
  1751. // setInterval(function() {
  1752. // getinternetknow({ "user": 23 });
  1753. // }, 10000);
  1754. // 当前登录用户
  1755. console.log($rootScope.user);
  1756. var loginUser = $rootScope.user;
  1757. if(loginUser){
  1758. $scope.allFlag = false;//全部事件
  1759. for (var i = 0; i < loginUser.menu.length; i++) {
  1760. if (loginUser.menu[i].link == "shijianliebiao_all") {
  1761. $scope.allFlag = true
  1762. }
  1763. }
  1764. }
  1765. // 判断首页统计页面是否显示
  1766. // if($rootScope.user.role.length){
  1767. // $scope.isShowTj = $rootScope.user.role.some(function(v){
  1768. // return v.rolecode === "incident-category-manager" || v.rolecode === "incident manager";
  1769. // })
  1770. // }else{
  1771. // $scope.isShowTj = false;
  1772. // }
  1773. // 首页统计数据(新)
  1774. $scope.managerIndexInfo = {};
  1775. $scope.getDataIndex = function(){
  1776. // 获取今日上下班情况
  1777. api_bpm_data.getManagerIndexInfo({}).then(function(result) {
  1778. $scope.managerIndexInfo = result.data;
  1779. });
  1780. // 当日工单情况
  1781. // api_event_form.fetchZhtjList({
  1782. // "startTime": moment(new Date()).format('YYYY-MM-DD'),
  1783. // "endTime": moment(new Date()).format('YYYY-MM-DD'),
  1784. // "sortData": 'total',
  1785. // "sortType": 'desc'
  1786. // }).then(function(result) {
  1787. // $scope.fetchZhtjList = result.title;
  1788. // });
  1789. // 当日请求微信web
  1790. api_event_form.fetchWebList({
  1791. "startTime": moment(new Date()).format('YYYY-MM-DD'),
  1792. "endTime": moment(new Date()).format('YYYY-MM-DD'),
  1793. "sortData": 'total',
  1794. "sortType": 'desc'
  1795. }).then(function(result) {
  1796. $scope.fetchWebList = result.title;
  1797. });
  1798. // 当日请求电话
  1799. api_event_form.fetchDhtjList({
  1800. "startTime": moment(new Date()).format('YYYY-MM-DD'),
  1801. "endTime": moment(new Date()).format('YYYY-MM-DD'),
  1802. "sortData": 'total',
  1803. "sortType": 'desc'
  1804. }).then(function(result) {
  1805. $scope.fetchDhtjList = result.title;
  1806. });
  1807. }
  1808. // 获取首页统计数据
  1809. $scope.serviceUserIndexInfo = [];
  1810. $scope.getServiceCount = function(){
  1811. api_bpm_data.serviceCount({userId: $rootScope.user.id}).then(function(data) {
  1812. if (data.status == 200) {
  1813. $scope.serviceUserIndexInfo = Array.isArray(data.data) ? (Array.isArray(data.data[0]) ? data.data[0] : []) : [];
  1814. }
  1815. })
  1816. }
  1817. // 判断首页统计页面是否显示
  1818. $scope.ifShowTj = false;
  1819. $scope.ifShowTjFunc = function(){
  1820. // api_sysinfo.fetchDataList('systemConfiguration',{
  1821. // "idx": 0,
  1822. // "sum": 1,
  1823. // systemConfiguration: {
  1824. // keyconfig: "ifWorking"
  1825. // }
  1826. // }).then(function(result) {
  1827. // $scope.ifShowTj = result.list[0].valueconfig == 1;
  1828. // if($scope.allFlag){
  1829. // $scope.getDataIndex();
  1830. // }
  1831. // });
  1832. var loginUser = $rootScope.user;
  1833. if(loginUser){
  1834. $scope.ifShowTj = loginUser.role.some( v => v.rolecode == 'call center');
  1835. if($scope.ifShowTj){
  1836. $scope.getServiceCount();
  1837. }
  1838. }
  1839. }
  1840. !$scope.isEventManager && $scope.ifShowTjFunc();
  1841. // 跳转
  1842. $scope.goTo = function(url,data){
  1843. state.go(url,data);
  1844. }
  1845. }
  1846. ]);