'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.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.appList = [] self.deptList = [] //var colors = ["#f24c40", "#73f2a7", "#f59f07", "#f8c66e", "#4bf2f2", "#685ef2"] if (self.deviceType == "pad") { var colors = ["#d5e7f5", "#d2f4e0", "#fcdce1", "#feedcf", "#fcdce1", "#e0f2f2", "#eae9f7", "#e0f2f2"]//浅色 } else { var colors = ["#d5e7f5", "#d2f4e0", "#fcdce1", "#feedcf", "#fcdce1", "#e0f2f2", "#eae9f7", "#e0f2f2"]//浅色 //var 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 = 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.getSecond = function (n) { $(".bottomObj").removeClass($(".bottomObj").attr("class").split(" ")[2]) $(".bottomObj").addClass("bottomObj" + (n + 1 > 7 ? 7 : n + 1)) self.activeBottomObj = n + 1 > 7 ? 7 : n + 1 } 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.deptAppList = [] self.nowDeptName = "" 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)) } if (self.activeBottomObj != 3) { window.parent[1].frameElement.height = '220px' //let iboxContent = document.getElementById("sjtsgzt") // iboxContent.style.height="100px" //console.log(iboxContent) } else { window.parent[1].frameElement.height = '229px' } } 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.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.goDeptApp = function (obj) { //sp.layerhide() if (obj.indexUrl.indexOf("?") > -1) { // window.top.sp.addTabNav(obj.appCode, obj.appName, obj.indexUrl + '&token=' + localStorage // .getItem("main-token")); window.open(obj.indexUrl + '&token=' + localStorage.getItem("main-token")); } else { // window.top.sp.addTabNav(obj.appCode, obj.appName, obj.indexUrl + '?token=' + localStorage // .getItem("main-token")); window.open(obj.indexUrl + '?token=' + localStorage.getItem("main-token")); } } self.deptAppList = [] self.nowDeptName = "" self.goDeptAppList = function (obj) { window.parent[1].frameElement.height = '290px' //window.parent.parent.deptClick_FJSKECMADWDSCBNHX(obj.deptId,obj.deptName) self.deptAppList = [] self.nowDeptName = obj.deptName //sp.layer("#dept-app-list") var dptCfg = { headers: { 'Content-Type': 'application/json', 'Access-Token': localStorage.getItem("main-token"), } }; $http.get( apiurljs.dpt + "auth/system/app-list-divisions?deptId=" + obj.deptId, dptCfg ).success(function (obj) { self.deptAppList = obj.result }) } self.deptClick = function (deptId) { //console.log(self.parent) //window.top.sp.deptClick_FJSKECMADWDSCBNHX('123'); //sp.layer("#dept-app-list") //window.deptClick_FJSKECMADWDSCBNHX(deptId) } // 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 (ress.result == '-1') { // self.appList[i].dbCount = 0 // } else { // self.appList[i].dbCount = +ress.result // } // self.appDbCount += self.appList[i].dbCount // }) // } // }) // } // self.sysappListOuter() self.sysappListOuter = function () { // appList.push({ // name:'房地产市场', // url:'http://10.149.1.56:8077/realEstate/newHouseTransactions?topTitle=房地产市场分析&muemType=1&token=@token&u=1171164793054724096', // appCode:'F0104', // }) // appList.push({ // name:'政务办件统计', // url:'http://10.149.1.76:31693/manager/server/b1105/index?u=1171164793054724097', // appCode:'F0108', // }) // self.appList = appList $http.post( apiurljs.login + "UserPower/PermissionsByMenuID", { userid: self.userId, menuid: 'F04' }, postCfg ).success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); //var res = obj; let appList = [] res.data.rows.forEach(function (row) { row.C_H_I_L_D.forEach(function (item) { appList.push({ name: item.CNAME, url: item.FILEN, appCode: item.PKID, }) }) }) self.appList = appList }) } self.deptJc = [ { jx: "政务服务处", qc: "政务服务处" }, { jx: "投资计划处", qc: "投资计划处" }, { jx: "建筑市场处", qc: "建筑市场管理处" }, { jx: "标准设计处", qc: "标准设计处" }, { jx: "工程质量管理处", qc: "" }, { jx: "安全和应急处", qc: "工程安全和应急管理处" }, { jx: "房屋管理处", qc: "房屋管理处" }, { jx: "物业管理处", qc: "物业管理处" }, { jx: "房地产市场管理处", qc: "房地产市场管理处" }, { jx: "住房保障处", qc: "住房保障处" }, { jx: "住房改革处", qc: "住房改革发展处" }, { jx: "城市更新处", qc: "城市更新处" }, { jx: "村镇管理处", qc: "村镇建设处" }, { jx: "节能和绿色发展处", qc: "建筑节能和绿色发展促进处" }, { jx: "科技教育处", qc: "科技教育处" }, { jx: "消防验收处", qc: "建设工程消防验收处" }, { jx: "网信办", qc: "网络安全和信息化办公室" }, { jx: "执法总队", qc: "天津市住房和城乡建设综合行政执法总队" }, { jx: "建筑市场中心", qc: "天津市建筑市场服务中心" }, { jx: "住保中心", qc: "" }, { jx: "房管中心", qc: "" }, ] self.getDeptList = function () { self.deptList = [] var dptCfg = { headers: { 'Content-Type': 'application/json', 'Access-Token': localStorage.getItem("main-token"), } }; $http.get( apiurljs.dpt + "auth/permit/lead-offices", dptCfg ).success(function (obj) { //self.deptList.push({deptNameJx:"统计分析",deptName:"统计分析",deptId:"tjfx"}) for (let i = 0; i < self.deptJc.length; i++) { let localDept = self.deptJc[i] for (let j = 0; j < obj.result.length; j++) { if (obj.result[j].deptName == localDept.qc || obj.result[j].deptName == localDept.jx) { obj.result[j].deptNameJx = localDept.jx self.deptList.push(obj.result[j]) break; } } } //self.deptList = obj.result // deptId "8a502c8e863ab2d9018678028b6004fa" // deptName "天津市住房保障服务中心" }) } self.sysappListOuter() self.getDeptList() }]) 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 showBtnLR() { if (localStorage.getItem("tjJxtGoldenlinkWork-deviceType") != "pad") { $('.moveLeft').show(); $('.moveRight').show() } } function hideBtnLR() { if (localStorage.getItem("tjJxtGoldenlinkWork-deviceType") != "pad") { $('.moveLeft').hide(); $('.moveRight').hide() } } 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() }