OWL ITS + 탐지시스템(인터넷 진흥원)
jhjang
2021-12-08 7b4b71ee33c7a42383d3e6a69885d521fd7b6688
src/main/webapp/scripts/app/issue/issueAdd.controller.js
@@ -9,9 +9,9 @@
    ],
    function (app, angular) {
        app.controller('issueAddController', ['$scope', '$rootScope', '$log', '$resourceProvider', '$uibModalInstance', '$uibModal', '$injector',
            '$controller', '$tableProvider', 'SweetAlert', '$timeout', '$stateParams', '$q', 'Issue', 'User', 'AttachedFile', 'IssueType', 'HostingField', 'Priority', 'Severity', 'IssueTypeCustomField', '$filter', '$state',
            '$controller', '$tableProvider', 'SweetAlert', '$timeout', '$stateParams', '$q', 'Issue', 'User', 'AttachedFile', 'IssueType', 'Priority', 'Severity', 'IssueTypeCustomField', '$filter', '$state',
            function ($scope, $rootScope, $log, $resourceProvider, $uibModalInstance, $uibModal,  $injector, $controller, $tableProvider, SweetAlert, $timeout,
                      $stateParams, $q, Issue, User, AttachedFile, IssueType, HostingField, Priority, Severity, IssueTypeCustomField, $filter, $state) {
                      $stateParams, $q, Issue, User, AttachedFile, IssueType, Priority, Severity, IssueTypeCustomField, $filter, $state) {
                $scope.fn = {
                    cancel : cancel,    //  팝업 창 닫기
@@ -37,7 +37,7 @@
                    setIssueTypeTemplate : setIssueTypeTemplate,    //  이슈 유형 템플릿 적용하기
                    startExecute : startExecute, //  컨트롤 로딩시 처음으로 시작되는 함수
                    containsPartner : containsPartner,
                    getPartners : getPartners,
                    getPartners : getPartners
                };
                $scope.vm = {
@@ -69,6 +69,7 @@
                    companyManager : "",   // 업체 담당자
                    companyTel : "",  // 업체 전화번호
                    companyEmail : "",  // 업체 이메일
                    companyUrl : "",  // 업체 url
                    companyMemo : "",  // 업체 비고
                    ispId : -1, // ISP ID
                    ispName : "", // ISP 명
@@ -76,12 +77,14 @@
                    ispManager : "", // ISP 담당자
                    ispTel : "", // ISP 전화번호
                    ispEmail : "", // ISP 이메일
                    ispUrl : "",  // url
                    ispMemo : "", // ISP 비고
                    hostingId : -1, // 호스팅 ID
                    hostingName : "", // 호스팅명 검색
                    hostingManager : "", // 호스팅 담당자
                    hostingTel : "", // 호스팅 전화번호
                    hostingEmail : "", // 호스팅 이메일
                    hostingUrl : "",  // url
                    hostingMemo :"", // 호스팅 비고
                    autoCompletePage : {
@@ -120,6 +123,18 @@
                    fileTableConfigs : [],   //  파일 업로드 정보 테이블
                };
                // 연관 일감 관련
                $scope.vm.relationIssueTypes =
                    [
                        { id: 0, name: $filter("translate")("issue.relationIssueType1") },
                        { id: 1, name: $filter("translate")("issue.relationIssueType2") },
                        { id: 2, name: $filter("translate")("issue.relationIssueType3") },
                        { id: 3, name: $filter("translate")("issue.relationIssueType4") },
                        { id: 4, name: $filter("translate")("issue.relationIssueType5") },
                        { id: 5, name: $filter("translate")("issue.relationIssueType6") }
                    ];
                $scope.vm.relationIssueType = $scope.vm.relationIssueTypes[0];
                angular.extend(this, $controller('autoCompleteController', {$scope : $scope, $injector : $injector}));
                function getStartProjectListCallback(result){
@@ -132,13 +147,15 @@
                //  프로젝트가 변경되면 담당자 초기화
                $scope.$watch("vm.form.projects", function (newValue, oldValue) {
                    if (angular.isDefined(newValue)) {
                        if (newValue.length < 1) {
                            $scope.vm.form.users = [];
                        } else {
                            //  이슈 유형에 연결된 사용자 정의 필드 가져오기
                            $scope.fn.getIssueTypeCustomFields();
                        }
                        //  이슈 유형에 연결된 사용자 정의 필드 가져오기
                        $scope.fn.getIssueTypeCustomFields();
                    }
                });
@@ -320,8 +337,8 @@
                function containsPartner(name) {
                    var result = false;
                    if ($scope.vm.viewer.usePartnerVo != null) {
                        $scope.vm.viewer.usePartnerVo.forEach(function (partnerVo) {
                    if ($scope.vm.partnerVos != null) {
                        $scope.vm.partnerVos.forEach(function (partnerVo) {
                            if (name === partnerVo.name) {
                                result = true;
                            }
@@ -376,6 +393,7 @@
                    $scope.vm.companyManager = result[0].manager;
                    $scope.vm.companyTel = result[0].tel;
                    $scope.vm.companyEmail = result[0].email;
                    $scope.vm.companyUrl = result[0].url;
                    $scope.vm.companyMemo = result[0].memo;
                });
@@ -388,6 +406,7 @@
                    $scope.vm.ispManager = result[0].manager;
                    $scope.vm.ispTel = result[0].tel;
                    $scope.vm.ispEmail = result[0].email;
                    $scope.vm.ispUrl = result[0].url;
                    $scope.vm.ispMemo = result[0].memo;
                });
@@ -399,6 +418,7 @@
                    $scope.vm.hostingManager = result[0].manager;
                    $scope.vm.hostingTel = result[0].tel;
                    $scope.vm.hostingEmail = result[0].email;
                    $scope.vm.hostingUrl = result[0].url;
                    $scope.vm.hostingMemo = result[0].memo;
                });
@@ -492,6 +512,7 @@
                                    manager : $scope.vm.companyManager,
                                    tel : $scope.vm.companyTel,
                                    email :$scope.vm.companyEmail,
                                    url :$scope.vm.companyUrl,
                                    memo : $scope.vm.companyMemo
                                });
                            }
@@ -512,6 +533,7 @@
                                    manager : $scope.vm.ispManager,
                                    tel : $scope.vm.ispTel,
                                    email :$scope.vm.ispEmail,
                                    url :$scope.vm.ispUrl,
                                    memo : $scope.vm.ispMemo
                                };
@@ -534,6 +556,7 @@
                                    manager : $scope.vm.hostingManager,
                                    tel : $scope.vm.hostingTel,
                                    email :$scope.vm.hostingEmail,
                                    url :$scope.vm.hostingUrl,
                                    memo : $scope.vm.hostingMemo
                                };
                            }
@@ -578,27 +601,27 @@
                        },
                        fileFormDataName : "file"
                    }).then(function (result) {
                            if (result.data.message.status === "success") {
                                //  연속 등록 체크시 이동하지 않음.
                                if ($scope.vm.infiniteAdd) {
                                    $scope.fn.infiniteAddForm();
                                }
                                else {
                                    $scope.fn.cancel();
                                    if ($state.current.name !== "issues.list" || $state.current.name === "issues.list") {
                                        $state.go("issues.list");
                                    }
                                }
                                $rootScope.$broadcast("getIssueList", {});
                        if (result.data.message.status === "success") {
                            //  연속 등록 체크시 이동하지 않음.
                            if ($scope.vm.infiniteAdd) {
                                $scope.fn.infiniteAddForm();
                            }
                            else {
                                SweetAlert.error($filter("translate")("issue.failedIssueRegistration"), result.data.message.message); // 이슈 등록 실패
                                $scope.fn.cancel();
                                if ($state.current.name !== "issues.list" || $state.current.name === "issues.list") {
                                    $state.go("issues.list");
                                }
                            }
                            $rootScope.spinner = false;
                        });
                            $rootScope.$broadcast("getIssueList", {});
                        }
                        else {
                            SweetAlert.error($filter("translate")("issue.failedIssueRegistration"), result.data.message.message); // 이슈 등록 실패
                        }
                        $rootScope.spinner = false;
                    });
                }
                //  팝업 창 닫기
@@ -649,22 +672,6 @@
                    return deferred.promise;
                }
                // 업체/ISP/호스팅 이름이 포함 여부 확인
                function containsPartner(name) {
                    var result = false;
                    if ($scope.vm.partnerVos != null) {
                        $scope.vm.partnerVos.forEach(function (partnerVo) {
                            if (name === partnerVo.name) {
                                result = true;
                            }
                        });
                    }
                    return result;
                }
                //  중요도 목록
                function getSeverities() {
                    var deferred = $q.defer();
@@ -702,9 +709,16 @@
                        if (result.data.message.status === "success") {
                            $scope.vm.form.issueCustomFields = [];
                            angular.forEach(result.data.data, function (issueTypeCustomField) {
                                switch (issueTypeCustomField.customFieldVo.customFieldType) {
                                    case "INPUT" :
                                    case "NUMBER" :
                                    case "DATETIME" :
                                    case "IP_ADDRESS" :
                                    case "EMAIL" :
                                    case "SITE" :
                                    case "TEL" :
                                        issueTypeCustomField.useValues = issueTypeCustomField.customFieldVo.defaultValue;
                                        break;
                                    case "SINGLE_SELECT" :
@@ -723,7 +737,6 @@
                                        });
                                        break;
                                }
                                $scope.vm.form.issueCustomFields.push(issueTypeCustomField);
                            });
                        }
@@ -777,10 +790,12 @@
                    }
                }
                function getPartners() {
                    if($scope.vm.form.issueTypeId === ""){
                        $scope.vm.form.issueTypeId = $rootScope.issueTypeMenu.id
                    }
                    var content = {
                        issueTypeId : $scope.vm.form.issueTypeId
                        issueTypeId : $scope.vm.form.issueTypeId,
                    };
                    Issue.findPartners($resourceProvider.getContent(
                        content,
@@ -805,15 +820,18 @@
                        // 현재 프로젝트 설정
                        if ($rootScope.workProject != null && $rootScope.workProject.id > -1) {
                            $scope.vm.projectName = $rootScope.workProject.name;
                            $scope.fn.projects = [];
                            $scope.fn.projects.push($rootScope.workProject);
                            $scope.fn.getProjectList($scope.vm.projectName, $scope.vm.form.projects, $scope.vm.autoCompletePage.project.page, getStartProjectListCallback);
                            $scope.vm.form.projects = [];
                            $scope.vm.form.projects.push($rootScope.workProject);
                        }
                        // 현재 이슈타입 유형 설정
                        var id = $rootScope.getCurrentIssueTypeId();
                        if (id != null) {
                            $scope.vm.form.issueTypeId = id.toString();
                        }
                        $log.debug("promises 결과 ", results);
                    });
                }
                $scope.fn.startExecute();
            }]);
    });
    });