123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369 |
- app.controller('requesterDashboardCtrl', [
- "$rootScope",
- "$scope",
- '$stateParams',
- '$http',
- '$state',
- '$timeout',
- '$interval',
- '$ionicPopover',
- '$ionicLoading',
- 'moment',
- 'api_bpm_domain',
- 'Restangular',
- 'api_user_data',
- 'api_sysinfo',
- 'getLoginUser',
- 'getWXJsConfig',
- 'getCount',
- function($rootScope, $scope, $stateParams, $http, $state, $timeout, $interval, $ionicPopover, $ionicLoading, moment, api_bpm_domain, Restangular, api_user_data, api_sysinfo, getLoginUser, getWXJsConfig, getCount) {
- // console.log('requesterDashboardCtrl is load');
- var sessionLogin = JSON.parse(sessionStorage.sessionLogin);
- console.log(sessionLogin);
- var loginUser = sessionLogin.user;
- $scope.serviceList1 = [{
- name: '宿舍区入网',
- url: 'http://ncc.hust.edu.cn/xsfw/ssqrw.htm'
- }, {
- name: '校园无线网',
- url: 'http://ncc.hust.edu.cn/xsfw/xywxw.htm'
- }, {
- name: '电子邮箱',
- url: 'http://ncc.hust.edu.cn/xsfw/dzyx.htm'
- }, {
- name: '自助服务网站',
- url: 'http://ncc.hust.edu.cn/xsfw/zzfwwz.htm'
- }, {
- name: '上机服务',
- url: 'http://ncc.hust.edu.cn/xsfw/sjfw.htm'
- }, {
- name: '计算机等级考试',
- url: 'http://ncc.hust.edu.cn/jsjdjks/ssqrw.htm'
- }, {
- name: '托业考试',
- url: 'http://ncc.hust.edu.cn/xsfw/tyks.htm'
- }, {
- name: '安全服务',
- url: 'http://ncc.hust.edu.cn/xsfw/aqfw.htm'
- }, {
- name: 'IPV6服务',
- url: 'http://ncc.hust.edu.cn/xsfw/IPV6fw.htm'
- }, {
- name: '联系网管',
- url: 'http://ncc.hust.edu.cn/xsfw/lxwg.htm'
- }];
- $scope.serviceList2 = [{
- name: '办公区入网',
- url: 'http://ncc.hust.edu.cn/jzgfw/bgqrw.htm'
- }, {
- name: '校园无线网',
- url: 'http://ncc.hust.edu.cn/jzgfw/xywxw.htm'
- }, {
- name: '电子邮箱',
- url: 'http://ncc.hust.edu.cn/jzgfw/dzyx.htm'
- }, {
- name: 'vpn',
- url: 'http://ncc.hust.edu.cn/jzgfw/VPN.htm'
- }, {
- name: '教学实验计划机时',
- url: 'http://ncc.hust.edu.cn/jzgfw/jxsyjhjs.htm'
- }];
- $scope.serviceList3 = [{
- name: '域名申请及变更',
- url: 'http://ncc.hust.edu.cn/bmfw/ymsqjbg.htm'
- }, {
- name: '公用邮箱',
- url: 'http://ncc.hust.edu.cn/bmfw/gyyx.htm'
- }, {
- name: '特殊设备入网',
- url: 'http://ncc.hust.edu.cn/bmfw/tssbrw.htm'
- }, {
- name: '无线网会议账号',
- url: 'http://ncc.hust.edu.cn/bmfw/wxwhyzh.htm'
- }, {
- name: '信息推送',
- url: 'http://ncc.hust.edu.cn/bmfw/xxts.htm'
- }, {
- name: '电子校务平台申请',
- url: 'http://ncc.hust.edu.cn/bmfw/dzxwptsq.htm'
- }, {
- name: '共享数据申请',
- url: 'http://ncc.hust.edu.cn/bmfw/gxsjsq.htm'
- }, {
- name: '邮件列表',
- url: 'http://ncc.hust.edu.cn/bmfw/yjlb.htm'
- }, {
- name: '地下光缆敷设与维护',
- url: 'http://ncc.hust.edu.cn/bmfw/dxglfsywh.htm'
- }, {
- name: '安全服务',
- url: 'http://ncc.hust.edu.cn/bmfw/aqfw.htm'
- }, {
- name: '楼栋接入校园网',
- url: 'http://ncc.hust.edu.cn/bmfw/ldjrxyw.htm'
- }]
- //页面刷新
- $scope.reload = function() {
- $scope.refreshListData();
- }
- //跳转到查看列表
- $scope.lookFunction = function(data) {
- $state.go('tab.myNoticeDetail', {
- 'item': JSON.stringify(data)
- });
- };
- //最近2条事件
- $scope.laterincident = {};
- $scope.myincidentData = {};
- console.log(loginUser.id);
- api_bpm_domain.weChatFetchServiceTasks("", { assignee: loginUser.id, idx: 0, sum: 1 }).then(function(response) {
- $scope.myincidentData = Restangular.stripRestangular(response);
- if ($scope.myincidentData.state == 200) {
- $scope.laterincident = $scope.myincidentData.data[0];
- // $scope.laterincident.createTime = moment($scope.laterincident.createTime).format('YYYY-MM-DD hh:mm');
- // $scope.laterincident.requester = loginUser;
- $scope.paramId = 1;
- if ($scope.laterincident.state == "未转换") {
- $scope.paramId = 1;
- } else if ($scope.laterincident.state == "已转换") {
- $scope.paramId = 2;
- } else if ($scope.laterincident.state == "处理中") {
- $scope.paramId = 3;
- } else if ($scope.laterincident.state == "待评价") {
- $scope.paramId = 4;
- } else if ($scope.laterincident.state == "已解决") {
- $scope.paramId = 5;
- }
- if ($scope.paramId > 0) {
- $scope.timeaxis = function() {
- $scope.items = [{ versionid: 1, content: '申请' }, { versionid: 2, content: '受理' }, { versionid: 3, content: '处理' }, { versionid: 4, content: '评价' }, { versionid: 5, content: '完成' }];
- };
- $scope.timeaxis();
- }
- $scope.paramidcolor = '';
- if ($scope.paramId == 1) {
- $scope.paramidcolor = "scaleX(0)";
- } else if ($scope.paramId == 2) {
- $scope.paramidcolor = "scaleX(0.25)";
- } else if ($scope.paramId == 3) {
- $scope.paramidcolor = "scaleX(0.50)";
- } else if ($scope.paramId == 4) {
- $scope.paramidcolor = "scaleX(0.75)";
- } else if ($scope.paramId == 5) {
- $scope.paramidcolor = "scaleX(1)";
- }
- }
- });
- //服务指南
- $scope.fuwuurl = "";
- api_sysinfo.fetchDataList('systemConfiguration', { idx: 0, sum: 1000 }).then(function(data) {
- var myData = Restangular.stripRestangular(data).list;
- angular.forEach(myData, function(item) {
- if (item.id == 59) {
- $scope.fuwuurl = item.valueconfig;
- }
- });
- }, function() {
- // $ionicLoading.hide();
- });
- //跳转到请求人事件列表
- $scope.toMyIncident = function(searchType) {
- $state.go('tab.myIncident');
- sessionStorage.setItem("toMyIncident", JSON.stringify({ 'searchType': searchType, 'isClick': true }));
- };
- //跳转到请求人事件列表
- $scope.toMyIncidentDetail = function(searchType) {
- $state.go('tab.myIncidentDetail', {
- 'item': JSON.stringify($scope.laterincident)
- });
- };
- //获取消息通知的数量
- // var getCountParameter = {
- // // 'assignee': loginUser.id,
- // 'account': loginUser.account,
- // // 'candidateGroups': loginUser.group[0].id,
- // // assignee: 7,
- // // candidateGroups: 1,
- // idx: 0,
- // sum: 1000
- // }
- //跳转到查看列表
- $scope.lookFunction = function(data) {
- $state.go('tab.myNoticeDetail', {
- 'item': JSON.stringify(data)
- });
- };
- // function getMessageCount() {
- // getCount.count('bpm/data/getCount', { 'account': loginUser.account, idx: 0, sum: 1000 }).then(function(response) {
- // var myData = Restangular.stripRestangular(response);
- // $scope.badge = myData;
- // // if (angular.isArray(myData.list) && myData.list.length > 0) {
- // // $scope.myData = myData.list;
- // // } else {
- // // $scope.listShow = false;
- // // }
- // //遮罩层关闭
- // // $ionicLoading.hide();
- // }, function() {
- // //遮罩层关闭
- // // $ionicLoading.hide();
- // });
- // }
- //加载最近5条公告
- $scope.refreshListData = function(filterData, loadStyle) {
- var showData = {};
- if (filterData) {
- filterData = angular.extend($scope.defaultData, filterData);
- } else {
- filterData = $scope.defaultData;
- }
- //遮罩层开启
- $ionicLoading.show({ template: 'Loading...' });
- // $scope.myData = [{ content: "测试测试公告信息测试测试公告信息测试测试公告信息测试测试公告信息测试测试公告信息测试测试公告信息测试测试公告信息测试测试公告信息测试测试公告信息测试测试公告信息", departmentName: "信息科技部", createTime: "2018-01-01" }]
- api_user_data.fetchDataList('notice', filterData).then(function(data) {
- var myData = Restangular.stripRestangular(data);
- if (angular.isArray(myData.list) && myData.list.length > 0) {
- $scope.myData = myData.list;
- } else {
- $scope.listShow = false;
- }
- //遮罩层关闭
- $ionicLoading.hide();
- }, function() {
- //遮罩层关闭
- $ionicLoading.hide();
- });
- // getMessageCount();
- };
- // $interval(function() {
- // getMessageCount();
- // }, 30000)
- if (!sessionStorage.sessionLogin) {
- var promise = getLoginUser.query();
- promise.then(function(sessionLogin) { //返回成功
- $scope.tokenType = sessionLogin.tokenType;
- var sessionLogin = JSON.parse(sessionStorage.sessionLogin);
- var loginUser = sessionLogin.user;
- $scope.sessionLogin = sessionLogin
- $rootScope.user = sessionLogin.user;
- $scope.defaultData = {
- // 'assignee': loginUser.account,
- 'idx': 0,
- 'sum': 2,
- // 'candidateGroups': loginUser.group["0"].id
- };
- $scope.filterData = {
- // 'assignee': loginUser.account,
- 'idx': 0,
- 'sum': 2
- };
- $scope.reload()
- }, function(data) { //返回失败
- });
- } else {
- var sessionLogin = JSON.parse(sessionStorage.sessionLogin);
- var loginUser = sessionLogin.user;
- $scope.sessionLogin = sessionLogin
- $rootScope.user = sessionLogin.user;
- $scope.defaultData = {
- // 'assignee': loginUser.account,
- 'idx': 0,
- 'sum': 10,
- // 'candidateGroups': loginUser.group["0"].id
- };
- $scope.filterData = {
- // 'assignee': loginUser.account,
- 'idx': 0,
- 'sum': 10
- };
- $scope.reload()
- }
- // var lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. " +
- // "Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor." +
- // "Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, " +
- // "ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor." +
- // "Lorem ipsum dolor sit amet, consectetur adipiscing elit.";
- // $scope.side = '';
- // $scope.events = [{
- // badgeClass: 'info',
- // badgeIconClass: 'glyphicon-check',
- // title: 'First heading',
- // when: '11 hours ago via Twitter',
- // content: 'Some awesome content.'
- // }, {
- // badgeClass: 'warning',
- // badgeIconClass: 'glyphicon-credit-card',
- // title: 'Second heading',
- // when: '12 hours ago via Twitter',
- // content: 'More awesome content.'
- // }, {
- // badgeClass: 'default',
- // badgeIconClass: 'glyphicon-credit-card',
- // title: 'Third heading',
- // titleContentHtml: '<img class="img-responsive" src="http://www.freeimages.com/assets/183333/1833326510/wood-weel-1444183-m.jpg">',
- // contentHtml: lorem,
- // footerContentHtml: '<a href="">Continue Reading</a>'
- // }];
- // $scope.addEvent = function() {
- // $scope.events.push({
- // badgeClass: 'info',
- // badgeIconClass: 'glyphicon-check',
- // title: 'First heading',
- // when: '3 hours ago via Twitter',
- // content: 'Some awesome content.'
- // });
- // };
- // // optional: not mandatory (uses angular-scroll-animate)
- // $scope.animateElementIn = function($el) {
- // $el.removeClass('timeline-hidden');
- // $el.addClass('bounce-in');
- // };
- // // optional: not mandatory (uses angular-scroll-animate)
- // $scope.animateElementOut = function($el) {
- // $el.addClass('timeline-hidden');
- // $el.removeClass('bounce-in');
- // };
- // $scope.leftAlign = function() {
- // $scope.side = 'left';
- // }
- // $scope.rightAlign = function() {
- // $scope.side = 'right';
- // }
- // $scope.defaultAlign = function() {
- // $scope.side = ''; // or 'alternate'
- // }
- }
- ])
- //过滤时间
- // app.filter('filterTime', function() {
- // return function(text) {
- // var time = text.split(" ");
- // return time[0];
- // }
- // });
|