'use strict'; var app = angular.module('app', [ 'angularUtils.directives.dirPagination', ]); app.controller("indexCtrl", ["$scope", "$http", "$interval", "$timeout", function ($scope, $http, $interval, $timeout) { var self = this; self.userId = $.cookie("GlWorkPlatform-userid"); self.userName = $.cookie("GlWorkPlatform-username"); self.userChineseName = $.cookie("GlWorkPlatform-chineseName") self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken"); var postCfg = { headers: { 'Content-Type': 'application/json', 'Authorization': "Bearer " + self.get_AccessToken } }; self.list1 = [ { FLOWID: "AA18|AA16|AA02|AA17", FLOWCODE: "FZB01", CNAME: "收文办理", FILEN: "tpl/shouwenbg/list.html", sortid: 1 }, { FLOWID: "AA19", FLOWCODE: "FZB02", CNAME: "督办公文延期", FILEN: "tpl/shouwenys/list.html", sortid: 2 }, { FLOWID: "AA20|AA03|AA10|AA57|AA08|AA23|AA77|AA06|AA63|AA80", FLOWCODE: "FZC01", CNAME: "行政发文", FILEN: "tpl/fawenbg/list.html", sortid: 3 }, { FLOWID: "AA88|AA89|AA46|AA22|AA54|AA58", FLOWCODE: "FZC02", CNAME: "党委发文", FILEN: "tpl/fawendw/list.html", sortid: 4 }, { FLOWID: "AA73|AA82", FLOWCODE: "FZD01", CNAME: "事项督办", FILEN: "tpl/shixiangdb/list.html", sortid: 5 }, { FLOWID: "AA52", FLOWCODE: "FZD02", CNAME: "事项督办延时", FILEN: "tpl/shixiangys/list.html", sortid: 6 }, { FLOWID: "AA50|AA84", FLOWCODE: "FZE01", CNAME: "文件发布", FILEN: "tpl/wenjianbg/list.html", sortid: 7 }, { FLOWID: "AA53", FLOWCODE: "FZF01", CNAME: "市政府转办", FILEN: "tpl/gongkaishi/list.html", sortid: 8 }, { FLOWID: "AA51", FLOWCODE: "FZF02", CNAME: "住建委申请", FILEN: "tpl/gongkaizhu/list.html", sortid: 9 }, { FLOWID: "AA25", FLOWCODE: "FZG01", CNAME: "网站信息发布", FILEN: "tpl/wangzhaninfo/list.html", sortid: 10 }, { FLOWID: "AA26", FLOWCODE: "FZG02", CNAME: "住建工作动态", FILEN: "tpl/gongzuodt/list.html", sortid: 11 }, { FLOWID: "AA01", FLOWCODE: "FZI01", CNAME: "政民零距离", FILEN: "tpl/xinfangzm/list.html", sortid: 12 }, { FLOWID: "AA12", FLOWCODE: "FZI02", CNAME: "信访办理", FILEN: "tpl/xinfangbg/list.html", sortid: 13 }, { FLOWID: "AA13|AA14|AA15", FLOWCODE: "FZJ02", CNAME: "车辆派遣", FILEN: "tpl/cheliangbg/list.html", sortid: 14 }, { FLOWID: "AA81", FLOWCODE: "FZJ04", CNAME: "办公用品", FILEN: "tpl/bangongbg/list.html", sortid: 15 }, { FLOWID: "AA27|AA71|AA72", FLOWCODE: "FZJ07", CNAME: "会议室申请", FILEN: "tpl/huiyishibg/list.html", sortid: 16 }, { FLOWID: "AA91", FLOWCODE: "FZJ22", CNAME: "会议反馈", FILEN: "tpl/huiyishibg/list1.html", sortid: 17 }, { FLOWID: "AA66|AA67|AA83", FLOWCODE: "FZJ08", CNAME: "值班管理", FILEN: "tpl/zhibanmgr/list.html", sortid: 18 }, { FLOWID: "AA28|AA29|AA30|AA31|AA32|AA33|AA34|AA35", FLOWCODE: "FZJ09", CNAME: "请假管理", FILEN: "tpl/qingjiamgr/list.html", sortid: 19 }, { FLOWID: "AA36|AA37|AA38|AA39", FLOWCODE: "FZJ10", CNAME: "销假管理", FILEN: "tpl/xiaojiamgr/list.html", sortid: 20 }, { FLOWID: "AA74", FLOWCODE: "FZJ11", CNAME: "OA变更管理", FILEN: "tpl/oabgmgr/list.html", sortid: 21 }, { FLOWID: "AA64", FLOWCODE: "FZJ13", CNAME: "用章管理", FILEN: "tpl/yzhangmgr/list.html", sortid: 22 }, { FLOWID: "AA68", FLOWCODE: "FZJ15", CNAME: "领导日程", FILEN: "tpl/lingdaobg/list.html", sortid: 23 }, { FLOWID: "AA85", FLOWCODE: "FZJ16", CNAME: "通知公告", FILEN: "tpl/tongzhibg/list.html", sortid: 24 }, { FLOWID: "AA47", FLOWCODE: "FZJ21", CNAME: "自定义工作", FILEN: "tpl/custom/list.html", sortid: 25 } ] self.list2 = []; self.list3 = []; self.getTop6 = function () { var data = { userid: self.userId } $http.post(apiurljs.login + "UserPower/Permissions", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); console.log(res.data) res.data.rows.forEach(function (item) { item.C_H_I_L_D.forEach(function (item1) { self.list1.forEach(function (item2) { if (item2.FLOWCODE == item1.PKID) { if (self.list2.indexOf(item2) == -1) { self.list2.push(item2) } } }) }) }) if (self.list2.length < 6) { var n = 6 - self.list2.length; self.list1.forEach(function (item) { if (self.list2.length < 6) { if (self.list2.indexOf(item) == -1) { self.list2.push(item) } } }) } self.getNum(0) }) } self.getTop6() self.getNum = function (n) { var data = { "flowid": self.list2[n].FLOWID, "userid": self.userId, "pageno": 0, "pagesize": 0 } $http.post(apiurljs.login + "g2work/routeinfo/queryDataTodoWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.list2[n].NUM = res.meta.totalCount; if (n + 1 < self.list2.length) { self.getNum(n + 1) } else { self.list2 = self.list2.sort(function (a, b) { if (a.NUM < b.NUM) { return 1; } if (a.NUM > b.NUM) { return -1; } return 0; }) for (var i = 0; i < 6; i++) { self.list2[i].background = { "background-image": "url(img/img" + (i + 1) + ".png)" } self.list3.push(self.list2[i]) } } }) } self.addTabNav = function (obj) { window.top.sp.addTabNav(obj.FLOWCODE, obj.CNAME, obj.FILEN); } }])