123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- '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 colors = ["#d5e7f5", "#d2f4e0", "#feedcf", "#fcdce1", "#e0f2f2", "#eae9f7"]
- self.getTop6 = function () {
- var data = {
- userid: self.userId,
- ntops:0//6
- }
- $http.post(apiurljs.login + "g2work/routeinfo/queryDataToDoFlowRouteCountDesktopByUserid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.ywblList = res.data;
- $.each(self.ywblList, function (index, item) {
- item.background = { "background-color": "" + colors[index % 6] + "" };
- item.news = { "background": "url(img/triangle" + (index % 6 + 1) + ".png) no-repeat center" }
- item.base = { "background": "url('img/base" + (index % 6 + 1) + ".png') no-repeat center center", "background-size": "110% 115%" };
- item.circel = { "background": "url('img/icon" + (index % 6 + 1) + ".png') no-repeat center center rgba(74,156,247,0.6)" };
- item.show = item.FILEN.indexOf("shouwenbg") > -1 || item.FILEN.indexOf("shixiangdb") > -1 || item.FILEN.indexOf("xinfangbg") > -1
- //self.getData(item, index + 1)
- })
- self.ywblCss = {
- "width": self.ywblList.length > 6 ? self.deviceType == "pad" ? "calc(100% - 60px)" : "calc(100% - 100px)" : "100%",
- "height": "150px",
- "overflow": "hidden"
- }
- console.log(self.ywblList);
- })
- }
- self.getTop6()
- $interval(function () {
- //self.getTop6()
- }, 5000)
- self.ywblMove = function (n) {
- var marginLeft = parseInt($(".sp-page").css("margin-left").slice(0, $(".sp-page").css("margin-left").indexOf("px"))) + n * $(".Item").outerWidth();
- if (marginLeft > 0) {
- marginLeft = 0
- } else if (marginLeft < ($(".sp-page").outerWidth() - $(".Item").outerWidth() * 6) * -1) {
- marginLeft = ($(".sp-page").outerWidth() - $(".Item").outerWidth() * 6) * -1
- }
- $(".sp-page").css("margin-left", marginLeft)
- }
-
- self.getData = function (obj, n) {
- $timeout(function () {
- var chart = new Highcharts.Chart({
- chart: {
- spacing: [40, 0, 40, 0],
- renderTo: "chart" + n,
- backgroundColor: 'rgba(0,0,0,0)',
- type: 'pie',
- style: {
- position: 'relative',
- left: '-8px'
- }
- },
- title: {
- floating: true,
- text: '', //图表的标题
- useHTML: true,
- formatter: function () {
- return '<img src="img/img1.png" width=60px>'
- }
- },
- tooltip: {
- enabled: false,
- },
- colors: ['#FFFF00', '#32CD32', '#FF0000'],
- legend: {
- enabled: false,
- },
- plotOptions: {
- pie: {
- cursor: 'pointer',
- size: 75,
- dataLabels: {
- enabled: false,
- }
- }
- },
- series: [{
- data: [{ name: "紫灯", y: 1, num: obj.BLACKCOUNT }, { name: "红灯", y: 1, num: obj.REDCOUNT }, { name: "黄灯", y: 1, num: obj.YELLOWCOUNT }, { name: "绿灯", y: 1, num: obj.GREENCOUNT }]
- }],
- credits: {
- enabled: false//隐藏右下角网址
- },
- exporting: {
- enabled: false//隐藏右上角打印
- }
- })
- chart.setSize(100, 98)
- },0)
- }
- self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
- self.addTabNav = function (obj) {
- 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.goParams = function (obj, params) {
- if (params != "") {
- if (self.deviceType == "pad") {
- window.top.jumpPageParent(obj.FLOWCODE, obj.CNAME, obj.FILEN + (obj.FILEN.indexOf("?") == -1 ? "?params=" + params : "¶ms=" + params));
- } else {
- window.top.sp.addTabNav(obj.FLOWCODE, obj.CNAME, obj.FILEN + (obj.FILEN.indexOf("?") == -1 ? "?params=" + params : "¶ms=" + params));
- }
- }
- event.stopPropagation()
- }
- }])
- app.directive("repeatFinish", function () {
- return {
- link: function (scope) {
- if (scope.$parent.ctl.ywblList.length > 6) {
- if (scope.$parent.ctl.deviceType == "pad") {
- $(".Item").eq(scope.$index).css("width", ($(window).width() - 60) / 6)
- if (scope.$last == true) {
- $(".sp-page").css("width", scope.$parent.ctl.ywblList.length * ($(window).width() - 60) / 6)
- }
- } else {
- $(".Item").eq(scope.$index).css("width", ($(window).width() - 100) / 6)
- if (scope.$last == true) {
- $(".sp-page").css("width", scope.$parent.ctl.ywblList.length * ($(window).width() - 100) / 6)
- }
- }
- } else {
- $(".Item").eq(scope.$index).css("width", $(window).width() / 6)
- if (scope.$last == true) {
- $(".sp-page").css("width", scope.$parent.ctl.ywblList.length * $(window).width() / 6)
- }
- }
- }
- };
- });
|