OWL ITS + 탐지시스템(인터넷 진흥원)
wyu
2022-01-07 b201e6603d0c26c113b2f845a897d6acce498ef1
src/main/webapp/scripts/app/companyField/companyFieldModify.controller.js
@@ -17,7 +17,8 @@
                    formSubmit : formSubmit,    //  폼 전송
                    formCheck : formCheck,  //  폼 체크
                    getIssueIspFieldListCallBack : getIssueIspFieldListCallBack,
                    getIssueHostingFieldListCallBack : getIssueHostingFieldListCallBack
                    getIssueHostingFieldListCallBack : getIssueHostingFieldListCallBack,
                    autoHyphenPhone : autoHyphenPhone // 연락처 입력시 하이픈 자동 입력
                };
                $scope.vm = {
@@ -59,6 +60,57 @@
                    $scope.vm.autoCompletePage.hostingField.totalPage = result.data.page.totalPage;
                }
                //  연락처 입력시 - 자동 입력
                function autoHyphenPhone() {
                    let phone = $scope.vm.form.tel
                    let seoul = $scope.vm.form.tel
                    // 핸드폰 및 지방 지역번호 조건
                    phone.replace(/^[0-9]/g, '');
                    // 서울 지역번호 조건
                    seoul.replace(/^[0-9]/g, '');
                    var tmp = '';
                    if (phone.length < 4) {
                        return phone;
                    } else if (phone.length < 7) {
                        tmp += phone.substr(0, 3);
                        tmp += '-';
                        tmp += phone.substr(3);
                        $scope.vm.form.tel = tmp;
                    } else if (seoul.substring(0, 2) == "02" && seoul.length == 9) {    // 서울 지역번호 조건
                        tmp += seoul.substring(0, 2);
                        tmp += '-';
                        tmp += seoul.substring(2, 5);
                        tmp += '-';
                        tmp += seoul.substr(5);
                        $scope.vm.form.tel = tmp;
                    } else if (seoul.substring(0, 2) == "02" && seoul.length == 10) {   // 서울 지역번호 조건
                        tmp += seoul.substring(0, 2);
                        tmp += '-';
                        tmp += seoul.substring(2, 6);
                        tmp += '-';
                        tmp += seoul.substr(6);
                        $scope.vm.form.tel = tmp;
                    } else if (phone.length < 11) {     // 핸드폰 및 지방 지역번호 조건
                        tmp += phone.substr(0, 3);
                        tmp += '-';
                        tmp += phone.substr(3, 3);
                        tmp += '-';
                        tmp += phone.substr(6);
                        $scope.vm.form.tel = tmp;
                    } else {                           // 핸드폰 및 지방 지역번호 조건
                        tmp += phone.substr(0, 3);
                        tmp += '-';
                        tmp += phone.substr(3, 4);
                        tmp += '-';
                        tmp += phone.substr(7);
                        $scope.vm.form.tel = tmp;
                    }
                    return phone;
                }
                // 폼 체크
                function formCheck(formInvalid) {
                    if (formInvalid) {
                        return true;
@@ -78,20 +130,21 @@
                //  폼 전송
                function formSubmit() {
                    $rootScope.spinner = true;
                    $scope.vm.form.tel = $scope.vm.form.tel.replace(/\-/g,'');  // 전화번호를 보낼땐 하이픈을 제거해서 DB에 저장
                    var content = {
                        id : parameter.id,
                        name : $rootScope.preventXss($scope.vm.form.name),
                        ispId : (function () {  // ISP 아이디
                            var ispId = -1;
                            if ($scope.vm.form.issueIspFields.length > 0) {
                            if ($scope.vm.form.issueIspFields != null && $scope.vm.form.issueIspFields.length > 0) {
                                ispId = $scope.vm.form.ispId;
                            }
                            return ispId;
                        })(),
                        hostingId : (function () {  // Hosting 아이디
                            var hostingId = -1;
                            if ($scope.vm.form.issueHostingFields.length > 0) {
                            if ($scope.vm.form.issueHostingFields != null && $scope.vm.form.issueHostingFields.length > 0) {
                                hostingId = $scope.vm.form.hostingId;
                            }
                            return hostingId;
@@ -146,11 +199,20 @@
                                $scope.vm.form.name = result.data.content.name;
                                $scope.vm.form.manager = result.data.content.manager;
                                $scope.vm.form.email = result.data.content.email;
                                // 전화번호 하이픈 추가하여 조회
                                let hyphen = result.data.content.tel.trim();
                                let phone = hyphen.replace(/(^02.{0}|^01.{1}|[0-9]{3})([0-9]+)([0-9]{4})/,"$1-$2-$3");
                                result.data.content.tel = phone;
                                $scope.vm.form.tel = result.data.content.tel;
                                $scope.vm.form.url = result.data.content.url;
                                $scope.vm.form.memo = result.data.content.memo;
                                $scope.vm.form.ispName = result.data.content.ispFieldVo.name;
                                $scope.vm.form.hostingName = result.data.content.hostingFieldVo.name;
                                if (result.data.content.ispFieldVo != null) {
                                    $scope.vm.form.ispName = result.data.content.ispFieldVo.name;
                                }
                                if (result.data.content.hostingFieldVo != null) {
                                    $scope.vm.form.hostingName = result.data.content.hostingFieldVo.name;
                                }
                            }
                        }
                        else {