| | |
| | | getIssueTypes : getIssueTypes, // 이슈 타입 목록 가져오기 |
| | | makeSearchConditions : makeSearchConditions, // 선택한 조건을 json 으로 만든다. |
| | | onFileSelect : onFileSelect, // 파일 업로드 |
| | | getIssueListCallBack : getIssueListCallBack // 이슈 autocomplete page 업데이트 |
| | | getIssueListCallBack : getIssueListCallBack, // 이슈 autocomplete page 업데이트 |
| | | startExecute : startExecute, // 컨트롤 로딩시 처음으로 시작되는 함수 |
| | | }; |
| | | |
| | | $scope.vm = { |
| | |
| | | }, |
| | | projectName : "", |
| | | autoCompletePage : { |
| | | issue : { |
| | | page : 0, |
| | | totalPage : 0 |
| | | }, |
| | | project : { |
| | | page : 0, |
| | | totalPage : 0 |
| | |
| | | |
| | | $scope.$on("projectListEvent", function (event, result) { |
| | | $scope.vm.form.projects = result; |
| | | $scope.vm.form.issues = ""; |
| | | $scope.fn.getIssueTypes(); |
| | | }); |
| | | |
| | |
| | | |
| | | if (result.data.message.status === "success") { |
| | | $scope.vm.issueTypes = result.data.data; |
| | | |
| | | // 현재 이슈타입 유형 설정 |
| | | let currentIssueTypeId = $rootScope.getCurrentIssueTypeId(); |
| | | if (currentIssueTypeId != null) { |
| | | $scope.vm.form.issueTypeId = currentIssueTypeId.toString(); |
| | | } |
| | | |
| | | // option 빈값 방지 |
| | | if ($rootScope.isDefined($scope.vm.issueTypes) && $scope.vm.issueTypes.length > 0) { |
| | | let chk = 0; |
| | | angular.forEach($scope.vm.issueTypes, function (issueType) { |
| | | if (issueType.id.toString() === $scope.vm.form.issueTypeId.toString()) { |
| | | chk ++; |
| | | } |
| | | }); |
| | | if (chk === 0) { |
| | | $scope.vm.form.issueTypeId = null; |
| | | } |
| | | } |
| | | } |
| | | else { |
| | | SweetAlert.error($filter("translate")("issue.failedToIssueTypeListLookup"), result.data.message.message); // "이슈 타입 목록 조회 실패" |
| | |
| | | function formSubmit() { |
| | | $rootScope.spinner = true; |
| | | |
| | | Issue.importExcel({ |
| | | method : "POST", |
| | | file : $scope.vm.form.file, |
| | | // data 속성으로 별도의 데이터 전송 |
| | | fields : { |
| | | content : { |
| | | projectId : $scope.vm.form.projects[0].id, |
| | | issueTypeId : $scope.vm.form.issueTypeId, |
| | | parentIssueId : (function () { |
| | | var id = -1; |
| | | if ($scope.vm.form.issues != null) { |
| | | id = $scope.vm.form.issues[0].id |
| | | } |
| | | return id; |
| | | })() |
| | | } |
| | | }, |
| | | fileFormDataName : "file" |
| | | }) |
| | | .then(function (result) { |
| | | if (result.data.message.status === "success") { |
| | | let inheritYn = false; |
| | | // 하위이슈 등록 & 파트너 정보 상속 일 경우 알림 창 |
| | | if ($rootScope.isDefined($scope.vm.form.issues) && $rootScope.isDefined($scope.vm.form.issues[0]) |
| | | && $scope.vm.form.issues[0].inheritPartners != null && $scope.vm.form.issues[0].inheritPartners === true) { |
| | | |
| | | SweetAlert.swal({ |
| | | title : $filter("translate")("issue.addDownIssue"), // 하위 이슈 추가 |
| | | text : $filter("translate")("issue.wantToInheritPartnersOfParentIssue"), // 상위이슈의 파트너 정보(업체/ISP/호스팅)를 적용시키겠습니까? |
| | | type : "warning", |
| | | showCancelButton : true, |
| | | confirmButtonColor : "#DD6B55", |
| | | confirmButtonText : $filter("translate")("common.ok"), // 네 |
| | | cancelButtonText : $filter("translate")("common.no"), // 아니오 |
| | | closeOnConfirm : false, |
| | | closeOnCancel : false |
| | | }, |
| | | function (isConfirm) { |
| | | if (isConfirm) { |
| | | inheritYn = true; |
| | | } |
| | | SweetAlert.close(); |
| | | |
| | | Issue.importExcel({ |
| | | method : "POST", |
| | | file : $scope.vm.form.file, |
| | | // data 속성으로 별도의 데이터 전송 |
| | | fields : { |
| | | content : { |
| | | projectId : $scope.vm.form.projects[0].id, |
| | | issueTypeId : $scope.vm.form.issueTypeId, |
| | | parentIssueId : (function () { |
| | | let id = -1; |
| | | if ($rootScope.isDefined($scope.vm.form.issues)) { |
| | | if ($rootScope.isDefined($scope.vm.form.issues[0])) { |
| | | id = $scope.vm.form.issues[0].id; |
| | | } |
| | | } |
| | | return id; |
| | | })(), |
| | | inheritYn : inheritYn |
| | | } |
| | | }, |
| | | fileFormDataName : "file", |
| | | }).then(function (result) { |
| | | if (result.data.message.status === "success") { |
| | | $timeout(function () { |
| | | SweetAlert.success($filter("translate")("issue.succeededIssueRegistration"), result.data.message.message); // 이슈 등록 성공 |
| | | $scope.fn.cancel(); |
| | | $rootScope.$broadcast("getIssueList"); |
| | | $rootScope.spinner = false; |
| | | }, 1000); |
| | | } |
| | | else { |
| | | SweetAlert.error($filter("translate")("issue.failedIssueRegistration"), result.data.message.message); // 이슈 등록 실패 |
| | | $rootScope.spinner = false; |
| | | } |
| | | }); |
| | | }); |
| | | } else { |
| | | Issue.importExcel({ |
| | | method : "POST", |
| | | file : $scope.vm.form.file, |
| | | // data 속성으로 별도의 데이터 전송 |
| | | fields : { |
| | | content : { |
| | | projectId : $scope.vm.form.projects[0].id, |
| | | issueTypeId : $scope.vm.form.issueTypeId, |
| | | parentIssueId : (function () { |
| | | let id = -1; |
| | | if ($rootScope.isDefined($scope.vm.form.issues)) { |
| | | if ($rootScope.isDefined($scope.vm.form.issues[0])) { |
| | | id = $scope.vm.form.issues[0].id; |
| | | } |
| | | } |
| | | return id; |
| | | })(), |
| | | inheritYn : inheritYn |
| | | } |
| | | }, |
| | | fileFormDataName : "file", |
| | | }).then(function (result) { |
| | | if (result.data.message.status === "success") { |
| | | $timeout(function () { |
| | | SweetAlert.success($filter("translate")("issue.succeededIssueRegistration"), result.data.message.message); // 이슈 등록 성공 |
| | | $scope.fn.cancel(); |
| | | $rootScope.$broadcast("getIssueList"); |
| | | $rootScope.spinner = false; |
| | | }, 1000); |
| | | } |
| | | else { |
| | | SweetAlert.error($filter("translate")("issue.failedIssueRegistration"), result.data.message.message); // 이슈 등록 실패 |
| | | $rootScope.spinner = false; |
| | | } |
| | | |
| | | $rootScope.spinner = false; |
| | | }); |
| | | } |
| | | |
| | | } |
| | | |
| | | function cancel() { |
| | |
| | | $uibModalInstance.dismiss('cancel'); |
| | | } |
| | | |
| | | // 이슈 유형 조회 |
| | | $scope.fn.getIssueTypes(); |
| | | // 최초 실행 |
| | | function startExecute() { |
| | | // 현재 프로젝트 설정 |
| | | if ($rootScope.workProject != null && $rootScope.workProject.id > -1) { |
| | | $scope.vm.projectName = $rootScope.workProject.name; |
| | | $scope.vm.form.projects = []; |
| | | $scope.vm.form.projects.push($rootScope.workProject); |
| | | } |
| | | $scope.fn.getIssueTypes(); |
| | | } |
| | | |
| | | $scope.fn.startExecute(); |
| | | }]); |
| | | }); |