newdash.js 93 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893
  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. "incident": {
  1054. "source": {value: "im"},
  1055. "state": {
  1056. "id": 1765
  1057. }
  1058. }
  1059. };
  1060. api_bpm_data.fetchDataList("incident", filterData).then(function(data) {
  1061. if (data.status == 200) {
  1062. $scope.wxWebList = data.list;
  1063. }
  1064. })
  1065. };
  1066. // 最新五条通话记录
  1067. $scope.calllogList = [];
  1068. $scope.getCalllog = function() {
  1069. var filterData = {
  1070. "idx": 0,
  1071. "sum": 5,
  1072. callrecord: {
  1073. todayTime: moment().format('YYYY-MM-DD') + ' 00:00:00',
  1074. todayTimeEnd: moment().format('YYYY-MM-DD') + ' 23:59:59'
  1075. }
  1076. };
  1077. api_bpm_data.fetchDataList("callrecord", filterData).then(function(data) {
  1078. if (data.status == 200) {
  1079. $scope.calllogList = data.list;
  1080. }
  1081. })
  1082. };
  1083. //录音
  1084. $scope.recordcall = function(data) {
  1085. var modalInstance = $modal.open({
  1086. backdrop: "static",
  1087. templateUrl: 'assets/views/incident/tpl/audio.html',
  1088. controller: function($rootScope, $scope, $modalInstance, $sce, $http, api_playservice) {
  1089. $scope.audioUrl=$sce.trustAsResourceUrl(callIp+data.recordingFileName);
  1090. $scope.cancel = function() {
  1091. $modalInstance.dismiss('cancel');
  1092. };
  1093. $modalInstance.close();
  1094. }
  1095. });
  1096. modalInstance.result.then(function(result) {
  1097. // $rootScope.setidle();
  1098. }, function(reason) {
  1099. $rootScope.setidle();
  1100. });
  1101. };
  1102. // 近15天建单数(当前用户建单数
  1103. $scope.getInfo5 = function(){
  1104. // 近15天建单数(当前用户建单数)start
  1105. var domfault = document.getElementById("fault");
  1106. var myChartfault = echarts.init(domfault);
  1107. myChartfault.showLoading({  
  1108. text: '数据加载中...',
  1109. color: '#c23531',
  1110. textColor: '#fff',
  1111. maskColor: 'rgba(255,255,255,0)',
  1112. zlevel: 0
  1113. });
  1114. myChartfault.hideLoading();
  1115. var optionfault = {
  1116. tooltip: {
  1117. trigger: "axis",
  1118. axisPointer: {
  1119. // 坐标轴指示器,坐标轴触发有效
  1120. // type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  1121. lineStyle: {
  1122. color: "#49A9EE",
  1123. type: "dotted",
  1124. },
  1125. },
  1126. },
  1127. legend: {
  1128. // data: ["响应平均时长"],
  1129. align: "left",
  1130. // itemWidth:10,
  1131. // itemHeight:10,
  1132. bottom: 0,
  1133. },
  1134. grid: {
  1135. left: "1%",
  1136. right: "0%",
  1137. bottom: "15%",
  1138. containLabel: true,
  1139. },
  1140. xAxis: [
  1141. {
  1142. type: "category",
  1143. // axisTick: {
  1144. // alignWithLabel: true
  1145. // },
  1146. axisLabel: {
  1147. interval:0,
  1148. textStyle: {
  1149. color: "#7B7B7B",
  1150. // fontSize: '14',
  1151. },
  1152. },
  1153. axisLine: {
  1154. show: true,
  1155. lineStyle: {
  1156. color: "#7B7B7B",
  1157. // type: 'dotted'
  1158. },
  1159. },
  1160. data: [],
  1161. },
  1162. ],
  1163. yAxis: [
  1164. {
  1165. type: "value",
  1166. scale: true,
  1167. name: "单数",
  1168. min: 0,
  1169. boundaryGap: [0.2, 0.2],
  1170. minInterval: 1,
  1171. // axisLabel: {
  1172. // formatter: '{value}'
  1173. // }
  1174. axisLabel: {
  1175. textStyle: {
  1176. color: "#7B7B7B",
  1177. // fontSize: '14',
  1178. },
  1179. },
  1180. axisLine: {
  1181. show: true,
  1182. lineStyle: {
  1183. color: "#7B7B7B",
  1184. // type: 'dotted'
  1185. },
  1186. },
  1187. },
  1188. ],
  1189. series: [
  1190. {
  1191. name: "单数",
  1192. type: "line",
  1193. itemStyle: {
  1194. normal: {
  1195. color: "#49A9EE",
  1196. },
  1197. },
  1198. lineStyle: {
  1199. normal: {
  1200. color: "#49A9EE",
  1201. },
  1202. },
  1203. data: [],
  1204. }
  1205. ],
  1206. };
  1207. function getinternettop5(data) {
  1208. api_bpm_data.createIncidentCount(data).then(function(data) {
  1209. if (data.status == 200) {
  1210. optionfault.xAxis[0].data = data.data.map(v => v[0]);
  1211. optionfault.series[0].data = data.data.map(v => v[1]);
  1212. myChartfault.setOption(optionfault, true);
  1213. myChartfault.hideLoading();
  1214. }
  1215. })
  1216. }
  1217. 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 });
  1218. // 近15天建单数(当前用户建单数)end
  1219. }
  1220. //知识库撰写量
  1221. $scope.getInfo6 = function(){
  1222. //知识库撰写量
  1223. var domknowlege = document.getElementById("knowlege");
  1224. var myChartknowlege = echarts.init(domknowlege);
  1225. var app = {};
  1226. var optionknowlege = null;
  1227. app.title = '知识库撰写量';
  1228. myChartknowlege.showLoading({  
  1229. text: '数据加载中...',
  1230. color: '#c23531',
  1231. textColor: '#fff',
  1232. maskColor: 'rgba(255,255,255,0)',
  1233. zlevel: 0
  1234. });
  1235. myChartknowlege.hideLoading();
  1236. optionknowlege = {
  1237. title: {
  1238. "text": 0,
  1239. subtext: '知识库总数',
  1240. itemGap: 3,
  1241. "x": '48%',
  1242. "y": '35%',
  1243. textAlign: "center",
  1244. "textStyle": {
  1245. "fontWeight": 'normal',
  1246. "fontSize": 18,
  1247. "color": '#005395',
  1248. },
  1249. "subtextStyle": {
  1250. "fontWeight": 'normal',
  1251. "fontSize": 12,
  1252. "color": '#333',
  1253. "lineHeight": 14
  1254. },
  1255. },
  1256. tooltip: {
  1257. // show: false,
  1258. trigger: 'item',
  1259. formatter: function(a) {
  1260. // console.log(a)
  1261. return (
  1262. a['data']['name'] + ":" + a['data']['value']
  1263. )
  1264. },
  1265. position: ['50%', '30%']
  1266. },
  1267. grid: {
  1268. left: 10,
  1269. top: 0,
  1270. bottom: 0,
  1271. right: 10,
  1272. containLabel: true
  1273. },
  1274. legend: {
  1275. show: true,
  1276. orient: 'vertical',
  1277. x: 'center',
  1278. // y: 'bottom',
  1279. bottom: 40,
  1280. itemWidth: 14,
  1281. itemHeight: 14,
  1282. // shadowOffsetX: 20,
  1283. textStyle: {
  1284. fontSize: '14',
  1285. fontWeight: 'normal',
  1286. color: '#666',
  1287. },
  1288. data: ['我撰写', '其他人撰写'],
  1289. formatter: function(name) {
  1290. var oa = optionknowlege.series[0].data;
  1291. var num = parseInt(oa[0].value) + parseInt(oa[1].value) + parseInt(oa[2].value);
  1292. for (var i = 0; i < optionknowlege.series[0].data.length; i++) {
  1293. if (name == oa[i].name) {
  1294. return ' ' + name + ' ' + oa[i].value + ' ' + oa[i].percent + '%';
  1295. }
  1296. }
  1297. }
  1298. },
  1299. "color": ["#005395", "#79a3c4", "transparent", "transparent"],
  1300. "startAngle": 180,
  1301. series: [{
  1302. name: '',
  1303. type: 'pie',
  1304. radius: ['60%', '80%'],
  1305. avoidLabelOverlap: false,
  1306. startAngle: 180,
  1307. center: ["50%", "50%"],
  1308. label: {
  1309. normal: {
  1310. show: false,
  1311. position: 'inner',
  1312. textStyle: {
  1313. color: '#fff',
  1314. fontSize: 12
  1315. },
  1316. // formatter: function(params) {
  1317. // if (params.value > 0) {
  1318. // return params.percent + '%'
  1319. // } else {
  1320. // return ''
  1321. // }
  1322. // }
  1323. },
  1324. emphasis: {
  1325. show: false,
  1326. textStyle: {
  1327. fontSize: '12',
  1328. fontWeight: 'bold'
  1329. }
  1330. }
  1331. },
  1332. labelLine: {
  1333. normal: {
  1334. show: false
  1335. }
  1336. },
  1337. data: [{ value: 50, name: '我撰写' }, { value: 50, name: '其他人撰写' }, { value: 50, name: '', tooltip: { formatter: function(a) { return "" } } }, { value: 50, name: '', tooltip: { formatter: function(a) { return "" } } }]
  1338. }]
  1339. };
  1340. function getinternetknow(data) {
  1341. api_newreport.fetchDataList('getSolutionCountByMyself', data).then(function(data) {
  1342. if (data.status == "200") {
  1343. optionknowlege.series[0].data[0].value = data.data[0] ? data.data[0].num : 0;
  1344. optionknowlege.series[0].data[0].percent = data.data[0] ? data.data[0].percent : 0
  1345. if (data.data == 0) {
  1346. optionknowlege.series[0].data[1].percent = 0
  1347. } else {
  1348. optionknowlege.series[0].data[1].percent = data.otherPercent ? data.otherPercent : 0
  1349. }
  1350. optionknowlege.series[0].data[1].value = data.total - (data.data[0] ? data.data[0].num : 0);
  1351. optionknowlege.series[0].data[2].value = data.total / 2;
  1352. optionknowlege.series[0].data[3].value = data.total / 2;
  1353. optionknowlege.title.text = data.total;
  1354. myChartknowlege.setOption(optionknowlege, true);
  1355. myChartknowlege.hideLoading();
  1356. } else {
  1357. }
  1358. })
  1359. }
  1360. getinternetknow({ "user": $rootScope.user.id });
  1361. }
  1362. //科室基础信息展示
  1363. $scope.dutyOrderCountList = [];
  1364. $scope.dutyOrderCount = function(){
  1365. var postData = {}
  1366. // 根据权限查询
  1367. if($rootScope.user.duty){
  1368. // 当前的所属责任科室
  1369. postData.dutyId = $rootScope.user.duty.id;
  1370. }else if($rootScope.user.branch){
  1371. // 当前的所属院区
  1372. postData.branchId = $rootScope.user.branch.id;
  1373. }
  1374. api_newreport.fetchDataListIndex('dutyOrderCount', postData).then(function(data) {
  1375. if (data.status == 200) {
  1376. let result = data.data || [];
  1377. $scope.dutyOrderCountList = _.chunk(result, 2);
  1378. }
  1379. })
  1380. }
  1381. //今日各人员工作情况
  1382. $scope.filterDataTodayUserOrderCount = {
  1383. "idx": 0,
  1384. "sum": 5
  1385. }
  1386. $scope.filterDataTodayUserOrderCountTotalPage = 1;
  1387. $scope.gaoliangleftTodayUserOrderCount = true;
  1388. $scope.gaoliangrightTodayUserOrderCount= true;
  1389. $scope.todayUserOrderCountList = [];
  1390. $scope.todayUserOrderCount = function(){
  1391. if(!$scope.parameters.duty1){
  1392. $scope.filterDataTodayUserOrderCountTotalPage = 1;
  1393. $scope.gaoliangleftTodayUserOrderCount = true;
  1394. $scope.gaoliangrightTodayUserOrderCount= true;
  1395. $scope.todayUserOrderCountList = [];
  1396. return;
  1397. }
  1398. $scope.filterDataTodayUserOrderCount.dutyId = $scope.parameters.duty1.id;
  1399. api_newreport.fetchDataListIndex('todayUserOrderCount', $scope.filterDataTodayUserOrderCount).then(function(data) {
  1400. if (data.status == 200) {
  1401. $scope.filterDataTodayUserOrderCountTotalPage = Math.ceil(data.totalNum / 5) || 1;
  1402. $scope.gaoliangrightTodayUserOrderCount = $scope.filterDataTodayUserOrderCount.idx >= $scope.filterDataTodayUserOrderCountTotalPage - 1;
  1403. $scope.gaoliangleftTodayUserOrderCount = $scope.filterDataTodayUserOrderCount.idx <= 0;
  1404. $scope.todayUserOrderCountList = data.data || [];
  1405. }
  1406. })
  1407. }
  1408. //今日各人员工作情况-翻页
  1409. $scope.parselistTodayUserOrderCount = function() {
  1410. if ($scope.gaoliangleftTodayUserOrderCount == false) {
  1411. $scope.todayUserOrderCountList = [];
  1412. $scope.filterDataTodayUserOrderCount.idx = $scope.filterDataTodayUserOrderCount.idx - 1;
  1413. if ($scope.filterDataTodayUserOrderCount.idx <= 0) {
  1414. $scope.gaoliangleftTodayUserOrderCount = true;
  1415. }
  1416. $scope.gaoliangrightTodayUserOrderCount = false;
  1417. $scope.todayUserOrderCount();
  1418. }
  1419. }
  1420. $scope.nextlistTodayUserOrderCount = function() {
  1421. if ($scope.gaoliangrightTodayUserOrderCount == false) {
  1422. $scope.todayUserOrderCountList = [];
  1423. $scope.filterDataTodayUserOrderCount.idx = $scope.filterDataTodayUserOrderCount.idx + 1;
  1424. if ($scope.filterDataTodayUserOrderCount.idx >= $scope.filterDataTodayUserOrderCountTotalPage - 1) {
  1425. $scope.gaoliangrightTodayUserOrderCount = true;
  1426. }
  1427. $scope.gaoliangleftTodayUserOrderCount = false;
  1428. $scope.todayUserOrderCount();
  1429. }
  1430. }
  1431. // 今日各人员工作情况-切换责任科室
  1432. $scope.changeDuty1 = function(){
  1433. $scope.filterDataTodayUserOrderCount.idx = 0;
  1434. $scope.todayUserOrderCount();
  1435. }
  1436. //建单数量排行
  1437. $scope.secondCategoryGraphEcharts = function(){
  1438. // 建单数量排行start
  1439. var domfault = document.getElementById("secondCategoryGraph");
  1440. $scope.myChartfaultSecondCategoryGraph = echarts.init(domfault);
  1441. $scope.secondCategoryGraph();
  1442. // 建单数量排行end
  1443. }
  1444. $scope.secondCategoryGraph = function(){
  1445. if(!$scope.parameters.duty2){
  1446. return;
  1447. }
  1448. api_newreport.fetchDataListIndex('secondCategoryGraph', {dutyId: $scope.parameters.duty2.id}).then(function(data) {
  1449. if (data.status == 200) {
  1450. data.data = data.data || [];
  1451. var optionfault = {
  1452. title: {
  1453. x: '10',
  1454. y: '0',
  1455. textStyle: {
  1456. fontWeight: 'normal',
  1457. fontSize: 12,
  1458. color: "#56c9ff",
  1459. }
  1460. },
  1461. xAxis: {
  1462. axisTick: {
  1463. show: false
  1464. },
  1465. splitLine: {
  1466. show: false,
  1467. },
  1468. splitArea: {
  1469. show: false
  1470. },
  1471. data: [],
  1472. axisLine: {
  1473. lineStyle: {
  1474. color: '#ddd'
  1475. }
  1476. },
  1477. axisLabel: {
  1478. textStyle: {
  1479. color: '#999999',
  1480. fontSize: 12,
  1481. }
  1482. },
  1483. },
  1484. yAxis: {
  1485. minInterval: 1,
  1486. axisTick: {
  1487. show: false
  1488. },
  1489. splitLine: {
  1490. show: true,
  1491. lineStyle: {
  1492. type: 'dashed',
  1493. color: '#eee'
  1494. }
  1495. },
  1496. splitArea: {
  1497. show: false
  1498. },
  1499. axisLabel: {
  1500. show: true,
  1501. textStyle: {
  1502. color: '#999999',
  1503. fontSize: 12,
  1504. }
  1505. },
  1506. axisLine: {
  1507. show: false,
  1508. lineStyle: {
  1509. color: '#4d4d4d'
  1510. }
  1511. }
  1512. },
  1513. grid: {
  1514. left: 10,
  1515. top: 25,
  1516. bottom: 0,
  1517. right: 10,
  1518. containLabel: true
  1519. },
  1520. "tooltip": {
  1521. "trigger": "item",
  1522. "textStyle": {
  1523. "fontSize": 12
  1524. },
  1525. "formatter": "{b0}:{c0}"
  1526. },
  1527. series: {
  1528. type: "bar",
  1529. itemStyle: {
  1530. normal: {
  1531. color: function(params) {
  1532. var colorList = [
  1533. '#204266', '#1b3651', '#00437a', '#005395', '#79a3c4'
  1534. ];
  1535. return colorList[params.dataIndex]
  1536. },
  1537. }
  1538. },
  1539. label: {
  1540. normal: {
  1541. show: true,
  1542. position: 'top',
  1543. textStyle: {}
  1544. }
  1545. },
  1546. barWidth: 18,
  1547. data: []
  1548. }
  1549. };
  1550. var result = _.zip.apply(null, data.data);
  1551. optionfault.xAxis.data = result[0] || [];
  1552. optionfault.series.data = result[1] || [];
  1553. $scope.myChartfaultSecondCategoryGraph.setOption(optionfault, true);
  1554. }
  1555. })
  1556. }
  1557. // 建单数量排行-切换责任科室
  1558. $scope.changeDuty2 = function(){
  1559. $scope.secondCategoryGraph();
  1560. }
  1561. //超时工单
  1562. $scope.filterDataOvertimeOrderCount = {
  1563. "idx": 0,
  1564. "sum": 5
  1565. }
  1566. $scope.filterDataOvertimeOrderCountTotalPage = 1;
  1567. $scope.gaoliangleftOvertimeOrderCount = true;
  1568. $scope.gaoliangrightOvertimeOrderCount= true;
  1569. $scope.overtimeOrderCountList = [];
  1570. $scope.overtimeOrderCount = function(){
  1571. if(!$scope.parameters.duty3){
  1572. $scope.filterDataOvertimeOrderCountTotalPage = 1;
  1573. $scope.gaoliangleftOvertimeOrderCount = true;
  1574. $scope.gaoliangrightOvertimeOrderCount= true;
  1575. $scope.overtimeOrderCountList = [];
  1576. return;
  1577. }
  1578. $scope.filterDataOvertimeOrderCount.dutyId = $scope.parameters.duty3.id;
  1579. api_newreport.fetchDataListIndex('overtimeOrderCount', $scope.filterDataOvertimeOrderCount).then(function(data) {
  1580. if (data.status == 200) {
  1581. $scope.filterDataOvertimeOrderCountTotalPage = Math.ceil(data.totalNum / 5) || 1;
  1582. $scope.gaoliangrightOvertimeOrderCount = $scope.filterDataOvertimeOrderCount.idx >= $scope.filterDataOvertimeOrderCountTotalPage - 1;
  1583. $scope.gaoliangleftOvertimeOrderCount = $scope.filterDataOvertimeOrderCount.idx <= 0;
  1584. $scope.overtimeOrderCountList = data.data || [];
  1585. }
  1586. })
  1587. }
  1588. //超时工单-翻页
  1589. $scope.parselistOvertimeOrderCount = function() {
  1590. if ($scope.gaoliangleftOvertimeOrderCount == false) {
  1591. $scope.overtimeOrderCountList = [];
  1592. $scope.filterDataOvertimeOrderCount.idx = $scope.filterDataOvertimeOrderCount.idx - 1;
  1593. if ($scope.filterDataOvertimeOrderCount.idx <= 0) {
  1594. $scope.gaoliangleftOvertimeOrderCount = true;
  1595. }
  1596. $scope.gaoliangrightOvertimeOrderCount = false;
  1597. $scope.overtimeOrderCount();
  1598. }
  1599. }
  1600. $scope.nextlistOvertimeOrderCount = function() {
  1601. if ($scope.gaoliangrightOvertimeOrderCount == false) {
  1602. $scope.overtimeOrderCountList = [];
  1603. $scope.filterDataOvertimeOrderCount.idx = $scope.filterDataOvertimeOrderCount.idx + 1;
  1604. if ($scope.filterDataOvertimeOrderCount.idx >= $scope.filterDataOvertimeOrderCountTotalPage - 1) {
  1605. $scope.gaoliangrightOvertimeOrderCount = true;
  1606. }
  1607. $scope.gaoliangleftOvertimeOrderCount = false;
  1608. $scope.overtimeOrderCount();
  1609. }
  1610. }
  1611. // 超时工单-切换责任科室
  1612. $scope.changeDuty3 = function(){
  1613. $scope.filterDataOvertimeOrderCount.idx = 0;
  1614. $scope.overtimeOrderCount();
  1615. }
  1616. // 近15天各部门的建单数
  1617. $scope.dutyOrderGraphEcharts = function(){
  1618. var domfault = document.getElementById("fault");
  1619. $scope.myChartfaultDutyOrderGraph = echarts.init(domfault);
  1620. $scope.dutyOrderGraph();
  1621. }
  1622. $scope.dutyOrderGraph = function(){
  1623. // 近15天各部门的建单数start
  1624. var postData = {}
  1625. // 根据权限查询
  1626. if($rootScope.user.duty){
  1627. // 当前的所属责任科室
  1628. postData.dutyId = $rootScope.user.duty.id;
  1629. }else if($rootScope.user.branch){
  1630. // 当前的所属院区
  1631. postData.branchId = $rootScope.user.branch.id;
  1632. }
  1633. api_newreport.fetchDataListIndex('dutyOrderGraph', postData).then(function(data) {
  1634. if (data.status == 200) {
  1635. data.dataList = data.dataList || [];
  1636. data.timeList = data.timeList || [];
  1637. data.nameList = data.nameList || [];
  1638. var optionfault = {
  1639. tooltip: {
  1640. trigger: "axis",
  1641. axisPointer: {
  1642. lineStyle: {
  1643. color: "#49A9EE",
  1644. type: "dotted",
  1645. },
  1646. },
  1647. },
  1648. legend: {
  1649. data: data.nameList
  1650. },
  1651. grid: {
  1652. left: "1%",
  1653. right: "0%",
  1654. bottom: "5%",
  1655. containLabel: true,
  1656. },
  1657. xAxis: [
  1658. {
  1659. type: "category",
  1660. axisLabel: {
  1661. interval:0,
  1662. textStyle: {
  1663. color: "#7B7B7B",
  1664. },
  1665. },
  1666. axisLine: {
  1667. show: true,
  1668. lineStyle: {
  1669. color: "#7B7B7B",
  1670. },
  1671. },
  1672. data: [],
  1673. },
  1674. ],
  1675. yAxis: [
  1676. {
  1677. type: "value",
  1678. scale: true,
  1679. name: "单数",
  1680. min: 0,
  1681. boundaryGap: [0.2, 0.2],
  1682. minInterval: 1,
  1683. axisLabel: {
  1684. textStyle: {
  1685. color: "#7B7B7B",
  1686. },
  1687. },
  1688. axisLine: {
  1689. show: true,
  1690. lineStyle: {
  1691. color: "#7B7B7B",
  1692. },
  1693. },
  1694. },
  1695. ],
  1696. series: [],
  1697. };
  1698. optionfault.xAxis[0].data = data.timeList;
  1699. data.dataList.forEach(function(v, i){
  1700. optionfault.series.push({
  1701. name: data.nameList[i],
  1702. type: "line",
  1703. data: v
  1704. })
  1705. })
  1706. $scope.myChartfaultDutyOrderGraph.setOption(optionfault, true);
  1707. }
  1708. })
  1709. // 近15天各部门的建单数end
  1710. }
  1711. // 获取责任科室
  1712. $scope.parameters = {};
  1713. $scope.dutys = [];
  1714. $scope.getOwnDuty = function(isFirst = false){
  1715. api_category.getOwnDuty({}).then(function (response) {
  1716. if (response) {
  1717. if ((response.status = 200)) {
  1718. $scope.dutys = response.data;
  1719. if(isFirst && $scope.dutys[0]){
  1720. $scope.parameters.duty1 = $scope.dutys[0];
  1721. $scope.parameters.duty2 = $scope.dutys[0];
  1722. $scope.parameters.duty3 = $scope.dutys[0];
  1723. $scope.todayUserOrderCount();
  1724. $timeout($scope.secondCategoryGraphEcharts, 0);
  1725. $scope.overtimeOrderCount();
  1726. }
  1727. }
  1728. }
  1729. });
  1730. }
  1731. // 判断是否是事件经理,显示不同页面
  1732. if($scope.isEventManager){
  1733. $scope.getOwnDuty(true);
  1734. $scope.dutyOrderCount();
  1735. $timeout($scope.dutyOrderGraphEcharts, 0);
  1736. }else{
  1737. $scope.getInfo5();
  1738. $scope.getInfo6();
  1739. $scope.getCalllog();
  1740. $scope.getWxWeb();
  1741. $scope.message_yes();
  1742. }
  1743. }
  1744. // setInterval(function() {
  1745. // getinternetknow({ "user": 23 });
  1746. // }, 10000);
  1747. // 当前登录用户
  1748. console.log($rootScope.user);
  1749. var loginUser = $rootScope.user;
  1750. if(loginUser){
  1751. $scope.allFlag = false;//全部事件
  1752. for (var i = 0; i < loginUser.menu.length; i++) {
  1753. if (loginUser.menu[i].link == "shijianliebiao_all") {
  1754. $scope.allFlag = true
  1755. }
  1756. }
  1757. }
  1758. // 判断首页统计页面是否显示
  1759. // if($rootScope.user.role.length){
  1760. // $scope.isShowTj = $rootScope.user.role.some(function(v){
  1761. // return v.rolecode === "incident-category-manager" || v.rolecode === "incident manager";
  1762. // })
  1763. // }else{
  1764. // $scope.isShowTj = false;
  1765. // }
  1766. // 首页统计数据(新)
  1767. $scope.managerIndexInfo = {};
  1768. $scope.getDataIndex = function(){
  1769. // 获取今日上下班情况
  1770. api_bpm_data.getManagerIndexInfo({}).then(function(result) {
  1771. $scope.managerIndexInfo = result.data;
  1772. });
  1773. // 当日工单情况
  1774. // api_event_form.fetchZhtjList({
  1775. // "startTime": moment(new Date()).format('YYYY-MM-DD'),
  1776. // "endTime": moment(new Date()).format('YYYY-MM-DD'),
  1777. // "sortData": 'total',
  1778. // "sortType": 'desc'
  1779. // }).then(function(result) {
  1780. // $scope.fetchZhtjList = result.title;
  1781. // });
  1782. // 当日请求微信web
  1783. api_event_form.fetchWebList({
  1784. "startTime": moment(new Date()).format('YYYY-MM-DD'),
  1785. "endTime": moment(new Date()).format('YYYY-MM-DD'),
  1786. "sortData": 'total',
  1787. "sortType": 'desc'
  1788. }).then(function(result) {
  1789. $scope.fetchWebList = result.title;
  1790. });
  1791. // 当日请求电话
  1792. api_event_form.fetchDhtjList({
  1793. "startTime": moment(new Date()).format('YYYY-MM-DD'),
  1794. "endTime": moment(new Date()).format('YYYY-MM-DD'),
  1795. "sortData": 'total',
  1796. "sortType": 'desc'
  1797. }).then(function(result) {
  1798. $scope.fetchDhtjList = result.title;
  1799. });
  1800. }
  1801. // 获取首页统计数据
  1802. $scope.serviceUserIndexInfo = [];
  1803. $scope.getServiceCount = function(){
  1804. api_bpm_data.serviceCount({userId: $rootScope.user.id}).then(function(data) {
  1805. if (data.status == 200) {
  1806. $scope.serviceUserIndexInfo = Array.isArray(data.data) ? (Array.isArray(data.data[0]) ? data.data[0] : []) : [];
  1807. }
  1808. })
  1809. }
  1810. // 判断首页统计页面是否显示
  1811. $scope.ifShowTj = false;
  1812. $scope.ifShowTjFunc = function(){
  1813. // api_sysinfo.fetchDataList('systemConfiguration',{
  1814. // "idx": 0,
  1815. // "sum": 1,
  1816. // systemConfiguration: {
  1817. // keyconfig: "ifWorking"
  1818. // }
  1819. // }).then(function(result) {
  1820. // $scope.ifShowTj = result.list[0].valueconfig == 1;
  1821. // if($scope.allFlag){
  1822. // $scope.getDataIndex();
  1823. // }
  1824. // });
  1825. var loginUser = $rootScope.user;
  1826. if(loginUser){
  1827. $scope.ifShowTj = loginUser.role.some( v => v.rolecode == 'call center');
  1828. if($scope.ifShowTj){
  1829. $scope.getServiceCount();
  1830. }
  1831. }
  1832. }
  1833. !$scope.isEventManager && $scope.ifShowTjFunc();
  1834. // 跳转
  1835. $scope.goTo = function(url,data){
  1836. state.go(url,data);
  1837. }
  1838. }
  1839. ]);