OWL ITS + 탐지시스템(인터넷 진흥원)
wyu
2021-11-29 b6cb278b0282e848ea5eec279a023ffb85d94133
src/main/webapp/scripts/app/customField/customFieldAdd.controller.js
@@ -16,7 +16,7 @@
                    formCheck : formCheck,  //  폼 체크
                    addOption : addOption,   //  옵션 값 추가하기
                    removeOption : removeOption,    //  옵션 삭제
                    changeFieldType : changeFieldType   //  필드 유형 변경
                    changeFieldType : changeFieldType,   //  필드 유형 변경
                };
                $scope.vm = {
@@ -25,7 +25,12 @@
                        customFieldType : "INPUT",    //  사용자 정의 필드 유형
                        defaultValue : "",  //  기본 값
                        options : [],   //  옵션
                        optionText : ""  //  옵션 값
                        optionText : "",  //  옵션 값
                        numberType : "",
                        ipAdress : "",
                        email : "",
                        site : "",
                        tel : ""
                    }
                };
@@ -43,6 +48,7 @@
                    $scope.vm.form.defaultValue = "";
                }
                //  Select 옵션 값 추가하기
                function addOption() {
@@ -69,7 +75,8 @@
                    if (!duplication) {
                        if (!$rootScope.isDefined($scope.vm.form.optionText)) {
                            $scope.vm.form.optionText = "";
                            SweetAlert.warning($filter("translate")("customField.emptyInputValue"), $filter("translate")("customField.emptyAddValue")); //  입력 값 확인 알림, 입력한 값이 없습니다.
                            SweetAlert.warning($filter("translate")("customField.emptyInputValue"),
                                $filter("translate")("customField.emptyAddValue")); //  입력 값 확인 알림, 입력한 값이 없습니다.
                            return;
                        }
                        $scope.vm.form.options.push($scope.vm.form.optionText);
@@ -81,9 +88,59 @@
                        }, 200);
                    }
                    else {
                        SweetAlert.warning($filter("translate")("customField.duplicateInputValue"), $filter("translate")("customField.alreadyAddedValue")); // "입력 값 중복 알림", "입력한 값이 이미 추가되어 있습니다."
                        SweetAlert.warning($filter("translate")("customField.duplicateInputValue"),
                            $filter("translate")("customField.alreadyAddedValue")); // "입력 값 중복 알림", "입력한 값이 이미 추가되어 있습니다."
                    }
                }
                // function chkPhoneType(type) {
                //     var input = $scope.vm.form.tel
                //
                //     //focus out인 경우
                //     //input type을 text로 바꾸고 '-'추가
                //     if(type == 'blur'){
                //         $scope.vm.form.tel;
                //         var phone = chkItemPhone(input);
                //     }
                //
                //     //focus인 경우
                //     //input type을 number로 바꾸고 '-' 제거
                //     if(type == 'focus'){
                //         var phone = input.replace( /-/gi, '');
                //         $scope.vm.form.tel('type', 'number');
                //     }
                //
                //     $scope.vm.form.tel(phone);
                // }
                //
                // function chkItemPhone(temp) {
                //     var number = temp.replace(/[^0-9]/g, "");
                //     var phone = "";
                //
                //     if (number.length < 9) {
                //         return number;
                //     } else if (number.length < 10) {
                //         phone += number.substr(0, 2);
                //         phone += "-";
                //         phone += number.substr(2, 3);
                //         phone += "-";
                //         phone += number.substr(5);
                //     } else if (number.length < 11) {
                //         phone += number.substr(0, 3);
                //         phone += "-";
                //         phone += number.substr(3, 3);
                //         phone += "-";
                //         phone += number.substr(6);
                //     } else {
                //         phone += number.substr(0, 3);
                //         phone += "-";
                //         phone += number.substr(3, 4);
                //         phone += "-";
                //         phone += number.substr(7);
                //     }
                //
                //     return phone;
                // }
                //  폼 체크
                function formCheck(formInvalid) {
@@ -92,7 +149,7 @@
                    }
                    //  다중, 단일 선택일 경우에
                    if ($scope.vm.form.customFieldType !== "INPUT") {
                    if ($scope.vm.form.customFieldType === "MULTI_SELECT" || $scope.vm.form.customFieldType === "SINGLE_SELECT") {
                        //  옵션이 1개 이하일 경우에는 셀렉트 태그를 만들 수 없다.
                        if ($scope.vm.form.options.length < 1) {
                            return true;
@@ -108,8 +165,13 @@
                    var content = angular.copy($scope.vm.form);
                    content.name = $rootScope.preventXss(content.name);
                    content.numberType = $rootScope.preventXss(content.numberType);
                    content.ipAdress = $rootScope.preventXss(content.ipAdress);
                    content.email = $rootScope.preventXss(content.email);
                    content.site = $rootScope.preventXss(content.site);
                    content.tel = $rootScope.preventXss(content.tel);
                    if ($scope.vm.form.customFieldType !== 'INPUT') {
                    if ($scope.vm.form.customFieldType === 'MULTI_SELECT'|| $scope.vm.form.customFieldType === "SINGLE_SELECT") {
                        var convertDefaultValues = "";
                        angular.forEach(content.defaultValue.split("#"), function (value) {