123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- '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.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
-
- self.appList = []
- //var colors = ["#d5e7f5", "#d2f4e0", "#feedcf", "#fcdce1", "#e0f2f2", "#eae9f7"]
- if (self.deviceType == "pad") {
- var colors = ["#d5e7f5", "#d5e7f5", "#d5e7f5", "#feedcf", "#eae9f7", "#eae9f7", "#eae9f7", "#eae9f7"]//浅色
- } else {
- var colors = ["#d5e7f5", "#d5e7f5", "#d5e7f5", "#feedcf", "#eae9f7", "#eae9f7", "#eae9f7", "#eae9f7"]//浅色
- //colors = ["#2073b3", "#2073b3", "#2073b3", "#faaf2a", "#7369f4", "#7369f4", "#7369f4", "#7369f4"]//深色
- //colors = ["#904644", "#8e651d", "#403a8c", "#1d638f", "#403a8c", "#468c63", "#2e8919", "#468c63"]//红蓝绿
- }
- self.getTop6 = function () {
- var data = {
- userid: self.userId
- }
- $http.post(apiurljs.login + "g2work/routeinfo/queryDataToDoFlowRouteCountDesktopByUseridGroup", data, postCfg)
- .success(function (obj) {
- //var res = strToJson(s4.decryptData_CBC(obj.data));
- var res = obj;
- self.ywblList = res.data;
- $.each(self.ywblList, function (index, item) {
- item.background = { "background-color": "" + colors[index % 8] + "" };
- item.news = { "background": "url(img/triangle" + (index % 8 + 1) + ".png) no-repeat center" }
- item.base = { "background": "url('img/base" + (index % 8 + 1) + ".png') no-repeat center center", "background-size": "110% 115%" };
- item.circel = { "background": "url('img/icon" + (index % 8 + 1) + ".png') no-repeat center center rgba(74,156,247,0.6)" };
- if (item.DESKTOP) {
- for (let i = 0; i < item.DESKTOP.length; i++) {
- let iitem = item.DESKTOP[i]
- if (iitem.FILEN) {
- iitem.show = true || iitem.FILEN.indexOf("shouwenbg") > -1 || iitem.FILEN.indexOf("shixiangdb") > -1 || iitem.FILEN.indexOf("xinfangbg") > -1
- }
- }
- }
- if (item.CNAME == "督查督办") {
- var data = {
- userid: self.userId
- };
- $http.post(apiurljs.login + "g2work/datazu/queryDataUserAuth", data, postCfg)
- .success(function (res) {
- res.data[0].auths.forEach(function (n) {
- if (n.ZID == "AA84" && n.AUTH == "1") {
- for (var x = 0; x < item.DESKTOP.length; x++) {
- if (item.DESKTOP[x].FLOWCODE == "FZG09" && self.deviceType == "pad") {
- item.DESKTOP.splice(x + 1, 0, { CNAME: "一张图", FLOWID: "POPUP", GROUPITEMSHOW: 1, FILEN: apiurljs.onePic + "digitalHousingUrbanRuralCommissionSzpd?token=" + localStorage.getItem("main-token") + "&name=&type=&id=" })
- break
- }
- }
- }
- })
- });
- }
- })
- self.ywblCss = {
- "width": "100%",
- "height": self.deviceType == "pad" ? "120px" : "150px",
- "overflow": "hidden"
- }
- })
- }
- self.activeBottomObj = 1;
- self.secondAfter = 0;//记录左移右移次数
- self.appDbCount = 0
- self.getTop6()
- $interval(function () {
- self.getTop6()
- }, 20000)
- self.ywblMove = function (n) {
- var marginLeft = parseInt($(".List").css("margin-left").slice(0, $(".List").css("margin-left").indexOf("px"))) + n * $(".Item").outerWidth();
- if (marginLeft > 0) {
- $(".List").css("margin-left", 0)
- } else if (marginLeft < ($(".List").outerWidth() - $(".Item").outerWidth() * 7) * -1) {
- $(".List").css("margin-left", ($(".List").outerWidth() - $(".Item").outerWidth() * 7) * -1)
- } else {
- self.secondAfter = self.secondAfter + n;
- $(".List").css("margin-left", marginLeft)
- self.activeBottomObj = self.activeBottomObj + n * -1;
- if (self.activeBottomObj < 1) {
- self.activeBottomObj = 1
- } else if (self.activeBottomObj > self.ywblList.length) {
- self.activeBottomObj = self.ywblList.length;
- }
- }
- }
- self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
- self.addTabNav = function (obj, n) {
- self.activeBottomObj = n + 1
- $(".bottomObj").removeClass($(".bottomObj").attr("class").split(" ")[2])
- if (self.secondAfter != 0) {
- $(".bottomObj").addClass("bottomObj" + (n + 1 + self.secondAfter))
- } else {
- $(".bottomObj").addClass("bottomObj" + (n + 1))
- }
- }
- self.goParams = function (obj, params) {
- if (params != "" && params != undefined && params != null) {
- if (self.deviceType == "pad") {
- window.top.jumpPageParent(obj.FLOWCODE, obj.CNAME, obj.FILEN);
- } else {
- window.top.sp.addTabNav(obj.FLOWCODE, obj.CNAME, obj.FILEN);
- }
- } else {
- if (self.deviceType == "pad") {
- window.top.jumpPageParent(obj.FLOWCODE, obj.CNAME, obj.FILEN);
- } else {
- window.top.sp.addTabNav(obj.FLOWCODE, obj.CNAME, obj.FILEN);
- }
- }
- event.stopPropagation()
- }
- self.goHref = function (obj) {
- if (obj.FLOWID.indexOf("POPUP") > -1) {
- window.open(obj.FILEN + (obj.FLOWID.indexOf("TOKEN") > -1 ? "?token=" + localStorage.getItem("main-token") : ""), "")
- return
- }
- if (self.deviceType == "pad") {
- window.top.jumpPageParent(obj.FLOWCODE, obj.CNAME, obj.FILEN);
- } else {
- window.top.sp.addTabNav(obj.FLOWCODE, obj.CNAME, obj.FILEN);
- }
- }
- self.goHref1=function(obj){
- window.open(obj.FILEN)
- }
- self.goApp = function (obj) {
- if (obj.url.indexOf("@token") > -1) {
- window.top.sp.addTabNav(obj.appCode, obj.name, obj.url.replace("@token", localStorage
- .getItem("main-token")));
- } else {
- window.top.sp.addTabNav(obj.appCode, obj.name, obj.url);
- }
- }
- self.sysappListOuter = function () {
- let postCfg_ = {
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + self.get_AccessToken
- }
- };
- var data = {
- token: localStorage.getItem("main-token"),
- userid: self.userId,
- type: 'oa',
- portalShow: 1,
- }
- $http.post(apiurljs.login + "g2app/pluginkinds/sysappListOuter",data, postCfg_)
- .success(function (obj) {
- //var res = strToJson(s4.decryptData_CBC(obj.data));
- var res = obj;
- let appList = []
- for (let i = 0; i < res.result.length; i++) {
- let item = res.result[i]
- for (let j = 0; j < item.appList.length; j++) {
- let appItem = item.appList[j]
- appList.push({
- name: appItem.appName,
- url: appItem.indexUrl,
- appCode: appItem.appCode
- })
- }
- }
- self.appList = appList
- self.appDbCount = 0
- for (let i = 0; i < self.appList.length; i++) {
- let data_ = {
- token: localStorage.getItem("main-token"),
- userid: self.userId,
- appCode: self.appList[i].appCode,
- portalShow: 1,
- }
- $http.post(apiurljs.login + "g2app/pluginkinds/behalf", data_, postCfg_)
- .success(function (objj) {
- //var ress = strToJson(s4.decryptData_CBC(objj.data));
- var res = obj;
- if (isNaN(parseFloat(ress.result)) == true) {
- self.appDbCount = 0;
- return
- }
- if (ress.result == '-1') {
- self.appList[i].dbCount = 0
- } else {
- self.appList[i].dbCount = +ress.result
- }
- self.appDbCount += self.appList[i].dbCount
- })
- }
- })
- }
- self.sysappListOuter()
- }])
- app.directive("repeatFinish", function () {
- return {
- link: function (scope) {
- if (scope.$parent.ctl.deviceType == "pad") {
- $(".Item").eq(scope.$index).css("width", $(window).width() / 7)
- if (scope.$last == true) {
- $(".List").css("width", scope.$parent.ctl.ywblList.length * $(window).width() / 7)
- }
- } else {
- $(".Item").eq(scope.$index).css("width", $(window).width() / 7)
- if (scope.$last == true) {
- $(".List").css("width", scope.$parent.ctl.ywblList.length * $(window).width() / 7)
- }
- }
- }
- };
- });
- function formate(num) {
- return num > 9 ? num : "0" + num;
- }
- function getWeek(date) {
- switch (new Date(date).getDay()) {
- case 0: return "星期日"; break;
- case 1: return "星期一"; break;
- case 2: return "星期二"; break;
- case 3: return "星期三"; break;
- case 4: return "星期四"; break;
- case 5: return "星期五"; break;
- case 6: return "星期六"; break;
- }
- }
- function getDate(str) {
- var year = str.getFullYear();
- var month = str.getMonth();
- var day = str.getDate();
- return new Date(year, month, day).getTime()
- }
|