requesterDashboardCtrl.js 14 KB

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