requesterDashboardCtrl.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. app.controller('requesterDashboardCtrl', [
  2. "$rootScope",
  3. "$scope",
  4. '$stateParams',
  5. '$http',
  6. '$state',
  7. '$timeout',
  8. '$interval',
  9. '$ionicPopover',
  10. '$ionicLoading',
  11. 'moment',
  12. 'api_bpm_domain',
  13. 'Restangular',
  14. 'api_user_data',
  15. 'api_sysinfo',
  16. 'getLoginUser',
  17. 'getWXJsConfig',
  18. 'getCount',
  19. function($rootScope, $scope, $stateParams, $http, $state, $timeout, $interval, $ionicPopover, $ionicLoading, moment, api_bpm_domain, Restangular, api_user_data, api_sysinfo, getLoginUser, getWXJsConfig, getCount) {
  20. // console.log('requesterDashboardCtrl is load');
  21. var sessionLogin = JSON.parse(sessionStorage.sessionLogin);
  22. var loginUser = sessionLogin.user;
  23. $scope.serviceList1 = [{
  24. name: '宿舍区入网',
  25. url: 'http://ncc.hust.edu.cn/xsfw/ssqrw.htm'
  26. }, {
  27. name: '校园无线网',
  28. url: 'http://ncc.hust.edu.cn/xsfw/xywxw.htm'
  29. }, {
  30. name: '电子邮箱',
  31. url: 'http://ncc.hust.edu.cn/xsfw/dzyx.htm'
  32. }, {
  33. name: '自助服务网站',
  34. url: 'http://ncc.hust.edu.cn/xsfw/zzfwwz.htm'
  35. }, {
  36. name: '上机服务',
  37. url: 'http://ncc.hust.edu.cn/xsfw/sjfw.htm'
  38. }, {
  39. name: '计算机等级考试',
  40. url: 'http://ncc.hust.edu.cn/jsjdjks/ssqrw.htm'
  41. }, {
  42. name: '托业考试',
  43. url: 'http://ncc.hust.edu.cn/xsfw/tyks.htm'
  44. }, {
  45. name: '安全服务',
  46. url: 'http://ncc.hust.edu.cn/xsfw/aqfw.htm'
  47. }, {
  48. name: 'IPV6服务',
  49. url: 'http://ncc.hust.edu.cn/xsfw/IPV6fw.htm'
  50. }, {
  51. name: '联系网管',
  52. url: 'http://ncc.hust.edu.cn/xsfw/lxwg.htm'
  53. }];
  54. $scope.serviceList2 = [{
  55. name: '办公区入网',
  56. url: 'http://ncc.hust.edu.cn/jzgfw/bgqrw.htm'
  57. }, {
  58. name: '校园无线网',
  59. url: 'http://ncc.hust.edu.cn/jzgfw/xywxw.htm'
  60. }, {
  61. name: '电子邮箱',
  62. url: 'http://ncc.hust.edu.cn/jzgfw/dzyx.htm'
  63. }, {
  64. name: 'vpn',
  65. url: 'http://ncc.hust.edu.cn/jzgfw/VPN.htm'
  66. }, {
  67. name: '教学实验计划机时',
  68. url: 'http://ncc.hust.edu.cn/jzgfw/jxsyjhjs.htm'
  69. }];
  70. $scope.serviceList3 = [{
  71. name: '域名申请及变更',
  72. url: 'http://ncc.hust.edu.cn/bmfw/ymsqjbg.htm'
  73. }, {
  74. name: '公用邮箱',
  75. url: 'http://ncc.hust.edu.cn/bmfw/gyyx.htm'
  76. }, {
  77. name: '特殊设备入网',
  78. url: 'http://ncc.hust.edu.cn/bmfw/tssbrw.htm'
  79. }, {
  80. name: '无线网会议账号',
  81. url: 'http://ncc.hust.edu.cn/bmfw/wxwhyzh.htm'
  82. }, {
  83. name: '信息推送',
  84. url: 'http://ncc.hust.edu.cn/bmfw/xxts.htm'
  85. }, {
  86. name: '电子校务平台申请',
  87. url: 'http://ncc.hust.edu.cn/bmfw/dzxwptsq.htm'
  88. }, {
  89. name: '共享数据申请',
  90. url: 'http://ncc.hust.edu.cn/bmfw/gxsjsq.htm'
  91. }, {
  92. name: '邮件列表',
  93. url: 'http://ncc.hust.edu.cn/bmfw/yjlb.htm'
  94. }, {
  95. name: '地下光缆敷设与维护',
  96. url: 'http://ncc.hust.edu.cn/bmfw/dxglfsywh.htm'
  97. }, {
  98. name: '安全服务',
  99. url: 'http://ncc.hust.edu.cn/bmfw/aqfw.htm'
  100. }, {
  101. name: '楼栋接入校园网',
  102. url: 'http://ncc.hust.edu.cn/bmfw/ldjrxyw.htm'
  103. }]
  104. //页面刷新
  105. $scope.reload = function() {
  106. $scope.refreshListData();
  107. }
  108. //跳转到查看列表
  109. $scope.lookFunction = function(data) {
  110. $state.go('tab.myNoticeDetail', {
  111. 'item': JSON.stringify(data)
  112. });
  113. };
  114. $scope.operationTime=5;
  115. $scope.showOperationTime=true;
  116. $scope.showYizhixiao=false;
  117. if(sessionStorage.getItem("isHasRepair")=="yes"){
  118. $scope.showOperationBox=true;
  119. }else{
  120. $scope.showOperationBox=false;
  121. }
  122. $scope.closeOperationBox=function(){
  123. if($scope.showYizhixiao==true){
  124. $scope.showOperationBox=false;
  125. sessionStorage.setItem("isHasRepair","no")
  126. }
  127. }
  128. $scope.daojishi=$interval(function(){
  129. $scope.operationTime--;
  130. if($scope.operationTime<=0){
  131. $scope.showOperationTime=false;
  132. $scope.showYizhixiao=true
  133. }
  134. },1000);
  135. $scope.$on('$destroy',function(){
  136. $interval.cancel($scope.daojishi);
  137. })
  138. //最近2条事件
  139. $scope.laterincident = {};
  140. $scope.myincidentData = {};
  141. api_bpm_domain.weChatFetchServiceTasks("bpm_incident", { assignee: loginUser.account, idx: 0, sum: 1 }).then(function(response) {
  142. $scope.myincidentData = Restangular.stripRestangular(response);
  143. if ($scope.myincidentData.state == 200) {
  144. $scope.laterincident = $scope.myincidentData.data[0];
  145. $scope.laterincident.createTime = moment($scope.laterincident.createTime).format('YYYY-MM-DD hh:mm');
  146. $scope.laterincident.requester = loginUser;
  147. $scope.paramId = 1;
  148. if ($scope.laterincident.state == "未转换") {
  149. $scope.paramId = 1;
  150. } else if ($scope.laterincident.state == "已转换") {
  151. $scope.paramId = 2;
  152. } else if ($scope.laterincident.state == "处理中") {
  153. $scope.paramId = 3;
  154. } else if ($scope.laterincident.state == "待评价") {
  155. $scope.paramId = 4;
  156. } else if ($scope.laterincident.state == "已解决") {
  157. $scope.paramId = 5;
  158. }
  159. if ($scope.paramId > 0) {
  160. $scope.timeaxis = function() {
  161. $scope.items = [{ versionid: 1, content: '申请' }, { versionid: 2, content: '受理' }, { versionid: 3, content: '处理' }, { versionid: 4, content: '评价' }, { versionid: 5, content: '完成' }];
  162. };
  163. $scope.timeaxis();
  164. }
  165. $scope.paramidcolor = '';
  166. if ($scope.paramId == 1) {
  167. $scope.paramidcolor = "scaleX(0)";
  168. } else if ($scope.paramId == 2) {
  169. $scope.paramidcolor = "scaleX(0.25)";
  170. } else if ($scope.paramId == 3) {
  171. $scope.paramidcolor = "scaleX(0.50)";
  172. } else if ($scope.paramId == 4) {
  173. $scope.paramidcolor = "scaleX(0.75)";
  174. } else if ($scope.paramId == 5) {
  175. $scope.paramidcolor = "scaleX(1)";
  176. }
  177. }
  178. });
  179. //服务指南
  180. $scope.fuwuurl = "";
  181. api_sysinfo.fetchDataList('systemConfiguration', { idx: 0, sum: 1000 }).then(function(data) {
  182. var myData = Restangular.stripRestangular(data).list;
  183. angular.forEach(myData, function(item) {
  184. if (item.id == 60) {
  185. $scope.fuwuurl = item.valueconfig;
  186. }
  187. });
  188. }, function() {
  189. // $ionicLoading.hide();
  190. });
  191. //跳转到请求人事件列表
  192. $scope.toMyIncident = function(searchType) {
  193. $state.go('tab.myIncident');
  194. sessionStorage.setItem("toMyIncident", JSON.stringify({ 'searchType': searchType, 'isClick': true }));
  195. };
  196. //跳转到请求人事件列表
  197. $scope.toMyIncidentDetail = function(searchType) {
  198. $state.go('tab.myIncidentDetail', {
  199. 'item': JSON.stringify($scope.laterincident)
  200. });
  201. };
  202. //获取消息通知的数量
  203. // var getCountParameter = {
  204. // // 'assignee': loginUser.id,
  205. // 'account': loginUser.account,
  206. // // 'candidateGroups': loginUser.group[0].id,
  207. // // assignee: 7,
  208. // // candidateGroups: 1,
  209. // idx: 0,
  210. // sum: 1000
  211. // }
  212. //跳转到查看列表
  213. $scope.lookFunction = function(data) {
  214. $state.go('tab.myNoticeDetail', {
  215. 'item': JSON.stringify(data)
  216. });
  217. };
  218. function getMessageCount() {
  219. getCount.count('bpm/data/getCount', { 'account': loginUser.account, idx: 0, sum: 1000 }).then(function(response) {
  220. var myData = Restangular.stripRestangular(response);
  221. $scope.badge = myData;
  222. // if (angular.isArray(myData.list) && myData.list.length > 0) {
  223. // $scope.myData = myData.list;
  224. // } else {
  225. // $scope.listShow = false;
  226. // }
  227. //遮罩层关闭
  228. // $ionicLoading.hide();
  229. }, function() {
  230. //遮罩层关闭
  231. // $ionicLoading.hide();
  232. });
  233. }
  234. //加载最近5条公告
  235. // $scope.myData=[];
  236. $scope.refreshListData = function(filterData, loadStyle) {
  237. var showData = {};
  238. if (filterData) {
  239. filterData = angular.extend($scope.defaultData, filterData);
  240. } else {
  241. filterData = $scope.defaultData;
  242. }
  243. //遮罩层开启
  244. $ionicLoading.show({ template: 'Loading...' });
  245. // $scope.myData = [{ content: "测试测试公告信息测试测试公告信息测试测试公告信息测试测试公告信息测试测试公告信息测试测试公告信息测试测试公告信息测试测试公告信息测试测试公告信息测试测试公告信息", departmentName: "信息科技部", createTime: "2018-01-01" }]
  246. api_user_data.fetchDataList('notice', filterData).then(function(data) {
  247. var myData = Restangular.stripRestangular(data);
  248. if (angular.isArray(myData.list) && myData.list.length > 0) {
  249. $scope.myData = myData.list;
  250. } else {
  251. $scope.listShow = false;
  252. }
  253. //遮罩层关闭
  254. $ionicLoading.hide();
  255. }, function() {
  256. //遮罩层关闭
  257. $ionicLoading.hide();
  258. });
  259. getMessageCount();
  260. };
  261. $interval(function() {
  262. getMessageCount();
  263. }, 30000)
  264. if (!sessionStorage.sessionLogin) {
  265. var promise = getLoginUser.query();
  266. promise.then(function(sessionLogin) { //返回成功
  267. $scope.tokenType = sessionLogin.tokenType;
  268. var sessionLogin = JSON.parse(sessionStorage.sessionLogin);
  269. var loginUser = sessionLogin.user;
  270. $scope.sessionLogin = sessionLogin
  271. $rootScope.user = sessionLogin.user;
  272. $scope.defaultData = {
  273. // 'assignee': loginUser.account,
  274. 'idx': 0,
  275. 'sum': 2,
  276. // 'candidateGroups': loginUser.group["0"].id
  277. };
  278. $scope.filterData = {
  279. // 'assignee': loginUser.account,
  280. 'idx': 0,
  281. 'sum': 2
  282. };
  283. $scope.reload()
  284. }, function(data) { //返回失败
  285. });
  286. } else {
  287. var sessionLogin = JSON.parse(sessionStorage.sessionLogin);
  288. var loginUser = sessionLogin.user;
  289. $scope.sessionLogin = sessionLogin
  290. $rootScope.user = sessionLogin.user;
  291. $scope.defaultData = {
  292. // 'assignee': loginUser.account,
  293. 'idx': 0,
  294. 'sum': 10,
  295. // 'candidateGroups': loginUser.group["0"].id
  296. };
  297. $scope.filterData = {
  298. // 'assignee': loginUser.account,
  299. 'idx': 0,
  300. 'sum': 10
  301. };
  302. $scope.reload()
  303. }
  304. // var lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. " +
  305. // "Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor." +
  306. // "Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, " +
  307. // "ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor." +
  308. // "Lorem ipsum dolor sit amet, consectetur adipiscing elit.";
  309. // $scope.side = '';
  310. // $scope.events = [{
  311. // badgeClass: 'info',
  312. // badgeIconClass: 'glyphicon-check',
  313. // title: 'First heading',
  314. // when: '11 hours ago via Twitter',
  315. // content: 'Some awesome content.'
  316. // }, {
  317. // badgeClass: 'warning',
  318. // badgeIconClass: 'glyphicon-credit-card',
  319. // title: 'Second heading',
  320. // when: '12 hours ago via Twitter',
  321. // content: 'More awesome content.'
  322. // }, {
  323. // badgeClass: 'default',
  324. // badgeIconClass: 'glyphicon-credit-card',
  325. // title: 'Third heading',
  326. // titleContentHtml: '<img class="img-responsive" src="http://www.freeimages.com/assets/183333/1833326510/wood-weel-1444183-m.jpg">',
  327. // contentHtml: lorem,
  328. // footerContentHtml: '<a href="">Continue Reading</a>'
  329. // }];
  330. // $scope.addEvent = function() {
  331. // $scope.events.push({
  332. // badgeClass: 'info',
  333. // badgeIconClass: 'glyphicon-check',
  334. // title: 'First heading',
  335. // when: '3 hours ago via Twitter',
  336. // content: 'Some awesome content.'
  337. // });
  338. // };
  339. // // optional: not mandatory (uses angular-scroll-animate)
  340. // $scope.animateElementIn = function($el) {
  341. // $el.removeClass('timeline-hidden');
  342. // $el.addClass('bounce-in');
  343. // };
  344. // // optional: not mandatory (uses angular-scroll-animate)
  345. // $scope.animateElementOut = function($el) {
  346. // $el.addClass('timeline-hidden');
  347. // $el.removeClass('bounce-in');
  348. // };
  349. // $scope.leftAlign = function() {
  350. // $scope.side = 'left';
  351. // }
  352. // $scope.rightAlign = function() {
  353. // $scope.side = 'right';
  354. // }
  355. // $scope.defaultAlign = function() {
  356. // $scope.side = ''; // or 'alternate'
  357. // }
  358. }
  359. ])
  360. //过滤时间
  361. // app.filter('filterTime', function() {
  362. // return function(text) {
  363. // var time = text.split(" ");
  364. // return time[0];
  365. // }
  366. // });