'use strict'; var app = angular.module('app', [ 'angularUtils.directives.dirPagination', ]); app.controller("indexCtrl", ["$scope", "$http", "$interval", "$timeout", "$sce", function ($scope, $http, $interval, $timeout, $sce) { 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.getDP = function () { var data = { userid: self.userId } $http.post(apiurljs.login + "g2app/richang/queryDpInfo", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.userDpName = res.data.length == 0 ? "" : res.data[0].SECTION; self.userDpCode = res.data.length == 0 ? "" : res.data[0].CODE; self.getParentDP(); }) } self.getParentDP = function () { self.userPDpName = ""; var data = { code: "AA" } $http.post(apiurljs.login + "g2work/sect/querySect", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); res.data[0].C_H_I_L_D.forEach(function (item) { item.C_H_I_L_D.forEach(function (item1) { if (item1.CODE == self.userDpCode) { self.userPDpName = item.SECTION } }) }) self.getData(); }) } self.today = sp.format(sp.getLocalDate()); self.getData = function () { var data = { tablename: "SX_TZGG", pagesize: 8, pageno: 1, colums: "ID,GGBT,FBSJ,FBFW", order: "FBSJ", sqlwhere: "and FBZT=1 and GGBK='C01' and (FBFWMANUSERID like '%" + self.userId + "%' or FBFWMANUSERID='全部')" }; $http.post(apiurljs.login + "g2app/dataabase/queryDataByColWithPage3", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.dataList = res.data; self.list = res.data; //self.dataList.forEach(function (item) { // if (item.FBFW == "" || item.FBFW == "全部") { // self.list.push(item) // } else { // item.FBFW.split(",").forEach(function (item1) { // if (item1 == self.userDpName) { // self.list.push(item) // } else if (item1 == self.userPDpName) { // self.list.push(item) // } if (item1 == self.userChineseName) { // self.list.push(item) // } // }) // } //}) }) } self.getDP() self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType"); self.openTab = function (id) { if (self.deviceType == "pad") { sp.openNewWindow("../../tpl/tongzhibg/TZGG/detail.html?id=" + id, "通知公告") } else { sp.openNewWindow("../../tpl/tongzhibg/TZGG/detail.html?id=" + id, "通知公告") } } }])