From f2fcf329cea64d71c671f1ab17f17d1634d1464d Mon Sep 17 00:00:00 2001 From: 이민희 <mhlee@maprex.co.kr> Date: 월, 07 3월 2022 17:08:23 +0900 Subject: [PATCH] - API로 이슈 추가 시 하위이슈처리기준 항목으로 동일한 업체 정보로 이슈 생성하여 하위이슈로 넣기 - 업체 테이블에 ip_start, ip_end 컬럼 추가 --- src/main/webapp/scripts/app/companyField/companyFieldAdd.controller.js | 322 +++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 261 insertions(+), 61 deletions(-) diff --git a/src/main/webapp/scripts/app/companyField/companyFieldAdd.controller.js b/src/main/webapp/scripts/app/companyField/companyFieldAdd.controller.js index 1457b34..e2a2c5c 100644 --- a/src/main/webapp/scripts/app/companyField/companyFieldAdd.controller.js +++ b/src/main/webapp/scripts/app/companyField/companyFieldAdd.controller.js @@ -7,8 +7,8 @@ 'app' ], function (app) { - app.controller('companyFieldAddController', ['$scope', '$rootScope', '$log', '$resourceProvider', 'SweetAlert', '$uibModal', '$uibModalInstance', '$state', 'CompanyField', '$filter', '$injector','$controller', - function ($scope, $rootScope, $log, $resourceProvider, SweetAlert, $uibModal, $uibModalInstance, $state, CompanyField, $filter, $injector, $controller) { + app.controller('companyFieldAddController', ['$scope', '$rootScope', '$log', '$resourceProvider', 'SweetAlert', '$uibModal', '$uibModalInstance', '$state', 'CompanyField', 'CompanyFieldCategory', '$filter', '$injector','$controller', + function ($scope, $rootScope, $log, $resourceProvider, SweetAlert, $uibModal, $uibModalInstance, $state, CompanyField, CompanyFieldCategory, $filter, $injector, $controller) { $scope.fn = { cancel : cancel, // �뙘�뾽 李� �떕湲� @@ -16,7 +16,15 @@ formCheck : formCheck, // �뤌 泥댄겕 getIssueIspFieldListCallBack : getIssueIspFieldListCallBack, getIssueHostingFieldListCallBack : getIssueHostingFieldListCallBack, - autoHyphenPhone : autoHyphenPhone // �뿰�씫泥� �엯�젰�떆 �븯�씠�뵂 �옄�룞 �엯�젰 + getCompanyTypeListCallBack : getCompanyTypeListCallBack, + getParentSectorListCallBack : getParentSectorListCallBack, + getChildSectorListCallBack : getChildSectorListCallBack, + getRegionListCallBack : getRegionListCallBack, + getStatusListCallBack : getStatusListCallBack, + addTel : addTel, + addMail : addMail, + removeTelInput : removeTelInput, + removeMailInput : removeMailInput }; $scope.vm = { @@ -30,7 +38,30 @@ tel : "", //�쟾�솕踰덊샇 email : "", //�씠硫붿씪 url : "", // url - memo : "" //鍮꾧퀬 + ipStart : "", //ip�떆�옉二쇱냼 + ipEnd : "", //ip醫낅즺二쇱냼 + memo : "", //鍮꾧퀬 + companyTypeId : "", + companyType : "", //湲곗뾽援щ텇 + parentSectorId : "", + parentSector : "", //�뾽醫�(��遺꾨쪟) + childSectorId : "", + childSector : "", //�뾽醫�(以묐텇瑜�) + regionId : "", + region : "", //吏��뿭 + statusId : "", + status : "", //�긽�깭 + inputTels : [0], //�뿰�씫泥� + tels : {}, + inputMails : [0], //�씠硫붿씪 + emails : {} + }, + typeCategory : { + companyType : "COMPANYTYPE", + parentSector : "PARENTSECTOR", + childSector : "CHILDSECTOR", + region : "REGION", + status : "STATUS" }, autoCompletePage : { ispField : { @@ -38,6 +69,26 @@ totalPage : 0 }, hostingField : { + page : 0, + totalPage : 0 + }, + companyType : { + page : 0, + totalPage : 0 + }, + parentSector : { + page : 0, + totalPage : 0 + }, + childSector : { + page : 0, + totalPage : 0 + }, + region : { + page : 0, + totalPage : 0 + }, + status : { page : 0, totalPage : 0 } @@ -57,6 +108,40 @@ $scope.vm.autoCompletePage.hostingField.totalPage = result.data.page.totalPage; } + // 湲곗뾽援щ텇 autocomplete page �뾽�뜲�씠�듃 + function getCompanyTypeListCallBack(result) { + $scope.vm.autoCompletePage.companyType.totalPage = result.data.page.totalPage; + } + + // �뾽醫�(��遺꾨쪟) autocomplete page �뾽�뜲�씠�듃 + function getParentSectorListCallBack(result, value) { + if (value === "") { + $scope.vm.form.parentSectorId = ""; + if ($rootScope.isDefined($scope.vm.form.parentSectors) && $rootScope.isDefined($scope.vm.form.parentSectors[0])) { + $scope.vm.form.parentSectors[0].id = ""; + } + $scope.vm.form.childSectorId = ""; + $scope.vm.form.childSector = ""; + $scope.vm.form.childSectors = []; + } + $scope.vm.autoCompletePage.parentSector.totalPage = result.data.page.totalPage; + } + + // �뾽醫�(以묐텇瑜�) 移댄뀒怨좊━ autocomplete page �뾽�뜲�씠�듃 + function getChildSectorListCallBack(result) { + $scope.vm.autoCompletePage.childSector.totalPage = result.data.page.totalPage; + } + + // 吏��뿭 移댄뀒怨좊━ autocomplete page �뾽�뜲�씠�듃 + function getRegionListCallBack(result) { + $scope.vm.autoCompletePage.region.totalPage = result.data.page.totalPage; + } + + // �긽�깭 移댄뀒怨좊━ autocomplete page �뾽�뜲�씠�듃 + function getStatusListCallBack(result) { + $scope.vm.autoCompletePage.status.totalPage = result.data.page.totalPage; + } + // �뤌 泥댄겕 function formCheck(formInvalid) { if (formInvalid) { @@ -66,89 +151,156 @@ } $scope.$on("ispFieldEvent", function (event, result) { - $scope.vm.form.ispId = result[0].id; + if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) { + $scope.vm.form.ispId = result[0].id; + } }); $scope.$on("hostingFieldEvent", function (event, result) { - $scope.vm.form.hostingId = result[0].id; + if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) { + $scope.vm.form.hostingId = result[0].id; + } }); - // �뿰�씫泥� �엯�젰�떆 �븯�씠�뵂 �옄�룞 �엯�젰 - 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; + $scope.$on("companyTypeEvent", function (event, result) { + if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) { + $scope.vm.form.companyTypeId = result[0].id; } - return phone; - } + }); + $scope.$on("parentSectorEvent", function (event, result) { + if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) { + $scope.vm.form.parentSectorId = result[0].id; + } else { + $scope.vm.form.parentSectorId = ""; + if ($rootScope.isDefined($scope.vm.form.parentSectors) && $rootScope.isDefined($scope.vm.form.parentSectors[0])) { + $scope.vm.form.parentSectors[0].id = ""; + } + } + $scope.vm.form.childSectorId = ""; + $scope.vm.form.childSector = ""; + $scope.vm.form.childSectors = []; + }); + $scope.$on("childSectorEvent", function (event, result) { + if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) { + $scope.vm.form.childSectorId = result[0].id; + } + }); + $scope.$on("regionEvent", function (event, result) { + if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) { + $scope.vm.form.regionId = result[0].id; + } + }); + $scope.$on("statusEvent", function (event, result) { + if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) { + $scope.vm.form.statusId = result[0].id; + } + }); // �뤌 �쟾�넚 function formSubmit(condition) { $rootScope.spinner = true; - $scope.vm.form.tel = $scope.vm.form.tel.replace(/\-/g,''); // �쟾�솕踰덊샇瑜� 蹂대궪�븧 �븯�씠�뵂�쓣 �젣嫄고빐�꽌 DB�뿉 ���옣 var content = { name : $rootScope.preventXss($scope.vm.form.name), // �뾽泥대챸 ispId : (function () { // ISP �븘�씠�뵒 - var ispId = -1; + var ispId = null; if ($scope.vm.form.issueIspFields != null) { ispId = $scope.vm.form.ispId; } return ispId; })(), hostingId : (function () { // Hosting �븘�씠�뵒 - var hostingId = -1; + var hostingId = null; if ($scope.vm.form.issueHostingFields != null) { hostingId = $scope.vm.form.hostingId; } return hostingId; })(), manager : $scope.vm.form.manager, //�떞�떦�옄 - tel : $scope.vm.form.tel, //�쟾�솕踰덊샇 - email : $scope.vm.form.email, //�씠硫붿씪 - url : $scope.vm.form.url, // url - memo : $scope.vm.form.memo //鍮꾧퀬 + tels : (function () { + var telList = []; + if ($scope.vm.form.tels != null) { + angular.forEach($scope.vm.form.tels, function (tel) { + telList.push(tel); + }); + telList = telList.filter(function(item) { //�벐�젅湲� �뜲�씠�꽣 �븘�꽣留� + return item !== null && item !== undefined && item !== ''; + }); + telList = telList.filter(function(item, idx){ + return telList.findIndex(function(item2, idx2){ + return item === item2 + }) == idx; + }); + } + return telList; + })(), + emails : (function () { + var emailList = []; + if ($scope.vm.form.emails != null) { + angular.forEach($scope.vm.form.emails, function (email) { + emailList.push(email); + }); + emailList = emailList.filter(function(item) { //�벐�젅湲� �뜲�씠�꽣 �븘�꽣留� + return item !== null && item !== undefined && item !== ''; + }); + emailList = emailList.filter(function(item, idx){ + return emailList.findIndex(function(item2, idx2){ + return item === item2 + }) == idx; + }); + } + return emailList; + })(), + url : (function () { + // 紐⑤뱺 怨듬갚 �젣嫄� + var regex = / /gi; + let url = $scope.vm.form.url; + if ($rootScope.isDefined(url) && url.indexOf(" ") !== -1) { + url = url.replace(regex, ""); + } + return url; + })(), + ipStart : $scope.vm.form.ipStart, // ip�떆�옉二쇱냼 + ipEnd : $scope.vm.form.ipEnd, // ip醫낅즺二쇱냼 + memo : $scope.vm.form.memo, //鍮꾧퀬 + companyTypeId : (function () { + var companyTypeId = null; + if ($scope.vm.form.companyTypes != null && $scope.vm.form.companyTypes.length > 0) { + companyTypeId = $scope.vm.form.companyTypes[0].id; + } + return companyTypeId; + })(), + parentSectorId : (function () { + var parentSectorId = null; + if ($scope.vm.form.parentSectors != null && $scope.vm.form.parentSectors.length > 0) { + parentSectorId = $scope.vm.form.parentSectors[0].id; + } + return parentSectorId; + })(), + childSectorId : (function () { + var childSectorId = null; + if ($scope.vm.form.childSectors != null && $scope.vm.form.childSectors.length > 0) { + childSectorId = $scope.vm.form.childSectors[0].id; + } + return childSectorId; + })(), + regionId : (function () { + var regionId = null; + if ($scope.vm.form.regions != null && $scope.vm.form.regions.length > 0) { + regionId = $scope.vm.form.regions[0].id; + } + return regionId; + })(), + statusId : (function () { + var statusId = null; + if ($scope.vm.form.statuses != null && $scope.vm.form.statuses.length > 0) { + statusId = $scope.vm.form.statuses[0].id; + } else if ($scope.vm.form.status !== ""){ + statusId = 120; //吏곸젒�엯�젰 �씪 寃쎌슦 + } + return statusId; + })(), + statusName : $scope.vm.form.status }; CompanyField.add($resourceProvider.getContent(content, @@ -168,6 +320,54 @@ } + // �뿰�씫泥� input 李� 異붽� 踰꾪듉 + function addTel() { + var arrayFull = true; // 諛곗뿴�씠 媛��뱷 李� �엳�뒗吏� �뿬遺� + var index = 0; + $scope.vm.form.inputTels.forEach(function (tel) { + if (!$rootScope.isDefined($scope.vm.form.tels[index])) { + arrayFull = false; + } + index++; + }); + + if (arrayFull) { + $scope.vm.form.inputTels.push(index); + $scope.vm.form.tels[index] = ""; + } else { + SweetAlert.warning($filter("translate")("companyField.writeCompanyTel"), $filter("translate")("companyField.writeTel")); // 異붽�踰꾪듉 寃쎄퀬 + } + } + + // 硫붿씪 二쇱냼 input 李� 異붽� 踰꾪듉 + function addMail() { + var arrayFull = true; // 諛곗뿴�씠 媛��뱷 李� �엳�뒗吏� �뿬遺� + var index = 0; + $scope.vm.form.inputMails.forEach(function (email) { + if (!$rootScope.isDefined($scope.vm.form.emails[index])) { + arrayFull = false; + } + index++; + }); + + if (arrayFull) { + $scope.vm.form.inputMails.push(index); + $scope.vm.form.emails[index] = ""; + } else { + SweetAlert.warning($filter("translate")("issue.writeIssueMail"), $filter("translate")("issue.writeMail")); // 異붽�踰꾪듉 寃쎄퀬 + } + } + + // �뿰�씫泥� input �궘�젣 + function removeTelInput(index) { + $scope.vm.form.inputTels.splice(index, 1); + } + + // �씠硫붿씪 二쇱냼 input �궘�젣 + function removeMailInput(index) { + $scope.vm.form.inputMails.splice(index, 1); + } + // �뙘�뾽 李� �떕湲� function cancel() { $rootScope.$broadcast("closeLayer"); // �뙘�뾽�씠 �뿴由ш퀬 �굹�꽌 js-multi, js-single �벑�뿉�꽌 body �씠踰ㅽ듃媛� �궇�븘媛��뒗 �쁽�긽 �닔�젙 -- Gitblit v1.8.0