'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 } }; var base64 = new Base64(); //声明base解码和编码类 self.getDP = function () { var data = { userid: self.userId } $http.post(apiurljs.login + "g2app/richang/queryDpInfo", data, postCfg) .success(function (obj) { //var res = strToJson(s4.decryptData_CBC(obj.data)); var res = obj; self.userDpName = res.data.length == 0 ? "" : res.data[0].SECTION; self.getTZGG(); }) } self.getTZGG = function () { var data = { tablename: "SX_TZGG", colums: "ID,GGBT,FBSJ,FBFW", order: "ID desc", sqlwhere: { FBZT: 1, GGBK: "C01" }, sqlorwhere: "", sqlinwhere: "", sqllikewhere: "" } $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", data, postCfg) .success(function (obj) { //var res = strToJson(s4.decryptData_CBC(obj.data)) var res = obj; $.each(res.data, function (index, item) { if (item.FBFW == "全部" || item.FBFW.indexOf(self.userDpName) > -1 || item.FBFW.indexOf(self.userChineseName) > -1) { self.TZGG = item; return false } }) if (self.TZGG.FJSC && self.TZGG.FJSC != "") { self.arrayFile = JSON.parse(self.TZGG.FJSC); } $timeout(function () { var height = 0; $(".content").siblings().each(function () { height = height + $(this).outerHeight(true); }) $(".content").css("height", 300 - height) $(".content").html(base64.decode(self.TZGG.GGNR)); },1) }) } self.getDP() }])