OWL ITS + 탐지시스템(인터넷 진흥원)
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
'use strict';
 
define(['app', 'angular'],
    function (app, angular) {
 
        app.directive('treeColumnGenerator', ['$compile', '$log', '$rootScope', '$tableProvider', '$filter',
            function ($compile, $log, $rootScope, $tableProvider, $filter) {
                return {
                    restrict : "A",
                    compile : function (tElement, tAttrs) {
                        return function (scope, element, attrs) {
                            scope.data = scope[attrs["treeColumnGenerator"]];
 
                            var makeTag = "";
                            var treeStartToken = "└";
 
                            scope.tableConfigs.forEach(function (tableConfig, index) {
 
                                if (tableConfig.colSpan > 0) {
                                    return;
                                }
 
                                makeTag = '<li class="' + tableConfig.dAlign + ' ' + tableConfig.dVisible + '">';
 
                                if (tableConfig.dType === "checkbox") {
                                    //  체크 박스일때
                                    if (scope.data.defaultYn) {
                                        makeTag += '<input type="checkbox" ng-checked="data.checked == true ? true : false" disabled ng-click="$root.$tableProvider.rowChecked(tableConfigs, data, fn.getResponseData())">';
                                    }
                                    else {
                                        makeTag += '<input type="checkbox" ng-checked="data.checked == true ? true : false" ng-click="$root.$tableProvider.rowChecked(tableConfigs, data, fn.getResponseData())">';
                                    }
 
                                    tableConfig.hChecked = false;
                                }
                                else if (tableConfig.dType === "radio") {
                                    //  라디오 버튼일때
                                    makeTag += '<input type="radio" ng-checked="data.checked == true ? true : false" ng-click="$root.$tableProvider.rowChecked(tableConfigs, data, fn.getResponseData())">';
                                }
                                else if (tableConfig.dType === "date") {
                                    makeTag += $filter('date')(scope.data[tableConfig.dName], $tableProvider.getDateFormat(tableConfig.dDateFormat, scope.data[tableConfig.dName]));
                                }
                                else {
                                    if (angular.isDefined(scope.data[tableConfig.dName]) && scope.data[tableConfig.dName] != null) {
                                        makeTag += '<span>' + scope.data[tableConfig.dName] + '</span>';
                                    }
                                    else {
                                        makeTag += '<span></span>';
                                    }
                                }
 
                                makeTag += '</li>';
 
                                var linkFn = $compile(makeTag);
                                var content = linkFn(scope);
 
                                element.append(content);
 
                            });
                        }
                    }
                }
            }]);
    });