'use strict'; var app = angular.module('app', [ 'angularUtils.directives.dirPagination' ]); app.controller("listCtrl", ["$scope", "$http", "$timeout", "$interval", function ($scope, $http, $timeout, $interval) { var self = this; var s4 = new SM4Util(); self.userId = $.cookie("GlWorkPlatform-userid"); self.userName = $.cookie("GlWorkPlatform-chineseName"); self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken"); var postCfg = { headers: { 'Content-Type': 'application/json', 'Authorization': "Bearer " + self.get_AccessToken } } self.thead = []; 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.SECTCODE = res.data.length == 0 ? "" : res.data[0].CODE; self.getDpList(); }) } self.getDP() self.getDpList = function () { var data = { unitid: "AA" } $http.post(apiurljs.login + "g2app/dataabase/querySectByCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.dpList = []; res.data.forEach(function (item) { if (item.CHILD_DATA.length == 0) { self.dpList.push(item) } else { item.CHILD_DATA.forEach(function (item1) { if (item1.CHILD_DATA.length == 0) { self.dpList.push(item1) } else { item1.CHILD_DATA.forEach(function (item2) { if (item2.CHILD_DATA.length == 0) { self.dpList.push(item2) } }) } }) } }) self.dpList.forEach(function (item) { item.checked = false; }) self.getData() }) } self.getData = function () { self.list = []; var data = { userid: "", sectcode: self.SECTCODE } $http.post(apiurljs.login + "g2work/func/queryDataUserAuthList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.loading = false; if (res.data == null || res.data == undefined || res.data == "") { self.noDataTip = 0; } else { self.noDataTip = 1; var arr = []; for (var i in res.data[0]) { if (i.indexOf("FUNCTION") > -1) { self.thead.push(res.data[0][i]) } } res.data.forEach(function (item) { var obj = { USHOWNAME: item.USHOWNAME, SECTION: item.SECTION, DUTYNAME: item.DUTYNAME, STATION: item.STATION } obj.line = Math.ceil(item.DUTYNAME.length / 6);//0; self.thead.forEach(function (x, y) { obj[x.PKID] = x.AUTHLIST.map(function (a) { return a.ZUM + "【" + a.VALUE + "】" }) if (obj.line < x.AUTHLIST.length) { obj.line = x.AUTHLIST.length; } }) obj.style = { "height": obj.line * 20 + 15 }//{ "width": "84px", "line-height": obj.line * 20 + "px", "overflow": "hidden", "white-space": "nowrap", "text-overflow": "ellipsis" } self.list.push(obj) }) } }) } self.checkDpItem = function (obj) { self.SECTCODE = obj.CODE; sp.layerhide() self.getData() } //头部下滚冻结 $(function () { //页面高度撑满 setTimeout(function () { if ($(".ibox-content").height() < $(window).height() - 31) { $(".ibox-content").css("height", $(window).height() - 31) } $(".table-body-left").css("height", $(".ibox-content").height() - 51) $(".table-body-right").css("height", $(".ibox-content").height() - 37) }, 1) }) }]) function scrollTableL() { $(".table-body-right").scrollTop($(".table-body-left").scrollTop()) } function scrollTableR() { $(".table-head-right").scrollLeft($(".table-body-right").scrollLeft()) $(".table-body-left").scrollTop($(".table-body-right").scrollTop()) }