schangxiang@126.com
2025-09-29 682eba0aaf922e69dfafe05fb6c1bbdbf3a0e04a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
(function () {
    'use strict';
    angular
        .module('core.controller',[])
        .controller("BodyCtrl",BodyCtrl)
    ;
 
    function BodyCtrl($scope, $state, $document, $timeout, $rootScope, Utils,$window, CurdHelper) {
 
        $scope.includes = includes;
 
        $rootScope.screen = {
            width: $document.innerWidth(),
            height:$document.innerHeight()
        };
 
        $scope.btns = [];
 
        $rootScope.setStyle = setStyle;
 
        $scope.init = init;
        $scope.isSpread = true;
        $rootScope.divSpread = false;
 
        function _closeList() {
            $rootScope.divSpread = false;
        }
 
        $scope.closeList = function (event) {
            event.stopPropagation();
            _closeList();
        };
 
 
        $scope.toggle = function toggle(event) {
            event.stopImmediatePropagation();
            if ($rootScope.divSpread) { _closeList(); } else { $rootScope.divSpread = true; }
        };
 
        $scope.auth = [];
 
        function init() {
    
            $scope.btns = [{
                name: "库位预览",
                img: "btnCrane.png",
                href: "task.preview-place",
                includes: "task.preview-place",
                icon: "glyphicon glyphicon-th-large",
                hasPermission:true,
                p: { tag: null }
            },
            {
                name: "输送机",
                img: "btnCuttingMachines.png",
                href: "task.conveyor-monitor",
                includes: "task.conveyor-monitor",
                icon: "glyphicon glyphicon-road",
                hasPermission: true,
                p: { tag: null }
            },
            {
                name: "堆垛机",
                img: "btnCrane.png",
                href: "task.stacker-monitor",
                includes: "task.stacker-monitor",
                icon: "glyphicon glyphicon-sound-dolby",
                hasPermission: true,
                p: { tag: null }
            }];
            
            CurdHelper.query("./Auth/GetAuth", function (data) {
 
                if (Utils.isBlank(data.Message)) {
                    $scope.auth = data.Result;
                    for (var i = 0; i < $scope.btns.length; i++) {
                        for (var j = 0; j < $scope.auth.length; j++) {
                            if ($scope.btns[i].href == $scope.auth[j].ContentCode) {
                                $scope.btns[i].hasPermission = true;
                           
                                break;
 
                            }
                        }
                    }
                    resize();
 
                }
            });
 
        }
 
        function resize() {
            if ($window.innerWidth < 1900 && $scope.auth.length>7) {
                $scope.isSpread = false;
            }
            //$timeout(resize, 100);
        }
 
        function setStyle(style) {
 
            if (!Utils.isBlank(style.background)) {
                style.background = "url(./modules/core/images/" + style.background + ") no-repeat";
            }
            return style;
        }
 
        function includes(btn)
        {
            return $state.includes(btn.includes, btn.p);
        }
 
    }
})();