OWL ITS + 탐지시스템(인터넷 진흥원)
jhjang
2021-10-14 3052936fed9166521b0557a36df83eb11a5e51ee
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
/**
 * Created by wisestone on 2018-09-05.
 */
'use strict';
 
define(['app', 'angular'],
    function (app, angular) {
        app.directive('issueSearchFieldKeyViewElement', ["$log", "$compile",
            function ($log, $compile) {
                return {
                    restrict: 'AE',
                    scope: {
                        lists : "=",
                        keys : "="
                    },
                    link: function ($scope, $element, $attrs) {
 
                        $scope.fn = {
                            makeSearchElements : makeSearchElements, //  선택한 검색 대상 값을 화면에 표시한다.
                            remove : remove //  선택한 대상 값을 초기화한다.
                        };
 
                        $scope.$watch("keys", function () {
                            $element.empty();
                            $scope.fn.makeSearchElements();
                        }, true);
 
                        function remove(fieldKey) {
                            var tempKeys = [];
 
                            angular.forEach($scope.keys, function (key) {
                                if (key.fieldKey != fieldKey) {
                                    tempKeys.push(key);
                                }
                            });
 
                            $scope.keys = angular.copy(tempKeys);
                        }
 
                        function makeSearchElements() {
                            var makeTag = "";
 
                            angular.forEach($scope.keys, function (key) {
                                makeTag += "<p>";
 
                                for (var count in $scope.lists) {
                                    var target = $scope.lists[count];
 
                                    if (target.fieldKey == key.fieldKey) {
                                        makeTag += target.fieldValue;
                                        break;
                                    }
                                }
 
                                makeTag += "<span ng-click='fn.remove(" + key.fieldKey + ")'>×</span>";
                                makeTag += "</p>";
                            });
 
                            var linkFn = $compile(makeTag);
                            var content = linkFn($scope);
                            $element.append(content);
                        }
 
                    }
                };
            }])
    });