From d71d945fd2d4d8faa4b293054accb09283432043 Mon Sep 17 00:00:00 2001
From: wyu <kknd09321@nate.com>
Date: 화, 07 12월 2021 19:43:02 +0900
Subject: [PATCH] 하위 이슈 초기화면 목록 안뜨는 오류 수정

---
 src/main/webapp/scripts/app/issue/issueDetail.controller.js |  209 ++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 163 insertions(+), 46 deletions(-)

diff --git a/src/main/webapp/scripts/app/issue/issueDetail.controller.js b/src/main/webapp/scripts/app/issue/issueDetail.controller.js
index 42f532e..cba9d5e 100644
--- a/src/main/webapp/scripts/app/issue/issueDetail.controller.js
+++ b/src/main/webapp/scripts/app/issue/issueDetail.controller.js
@@ -28,13 +28,20 @@
                 $scope.fn.updateActiveHistory = updateActiveHistory;    //  �솢�룞 �궡�뿭�뿉�꽌 �쟾泥� 蹂닿린 �꺆�쓣 �닃���쓣 �븣 �뙎湲�, 湲곕줉 �젙蹂대�� �뾽�뜲�씠�듃 �븳�떎.
                 $scope.fn.getChangeIssueStatusList = getChangeIssueStatusList;    //  �씠�뒋�쓽 �쁽�옱 �긽�깭�뿉�꽌 蹂�寃� 媛��뒫�븳 �씠�뒋 �깄�깭 紐⑸줉 媛��졇�삤湲�
                 $scope.fn.modifyIssueStatus = modifyIssueStatus;    //  �씠�뒋 �긽�깭 蹂�寃�
+                $scope.fn.modifyDownIssueStatus = modifyDownIssueStatus;    //�븯�쐞 �씠�뒋 �긽�깭 蹂�寃�
                 $scope.fn.modifyIssueUser = modifyIssueUser;    //  �씠�뒋 �떞�떦�옄 蹂�寃�
                 $scope.fn.modifyIssueDepartment = modifyIssueDepartment;    //  �씠�뒋 �떞�떦遺��꽌 蹂�寃�
                 $scope.fn.initReload = initReload;  //  珥덇린�솕 �빐�빞�븷 �븷紐⑹쓣 吏��젙�븯�뿬 �떎瑜� �씠�뒋瑜� �겢由��븷 �븣 珥덇린�솕�빐以��떎.
-                $scope.fn.sendMail = sendMail;  //  �듅�젙 �궗�슜�옄�뿉寃� �씠�뒋 �젙蹂대�� 硫붿씪濡� 諛쒖넚
+                $scope.fn.sendMail = sendMail;
+                $scope.fn.sendMailAll = sendMailAll;
+                $scope.fn.sendMailVo = sendMailVo;
+                $scope.fn.getParameters = getParameters;
+                $scope.fn.getParametersAll = getParametersAll;
+                //  �듅�젙 �궗�슜�옄�뿉寃� �씠�뒋 �젙蹂대�� 硫붿씪濡� 諛쒖넚
                 $scope.fn.versionView = versionView;    //  踰꾩쟾 �젙蹂대�� �몴�떆�븳�떎.
                 $scope.fn.reservation = reservation;    //  �삁�빟 �젙蹂대�� �솗�씤 諛� 蹂�寃� �븳�떎.
                 $scope.fn.getIssueListCallBack = getIssueListCallBack;
+                $scope.fn.getDownIssueListCallBack = getDownIssueListCallBack;
                 $scope.fn.addRelationIssue = addRelationIssue;      // �뿰愿� �씠�뒋 異붽�
                 $scope.fn.addDownIssue = addDownIssue;      // �븯�쐞 �씠�뒋 異붽�
                 $scope.fn.addRelationIssueTableConfig = addRelationIssueTableConfig;      // �뿰愿� �씠�뒋 紐⑸줉 �뀒�씠釉� �꽕�젙
@@ -42,6 +49,7 @@
                 $scope.fn.getRelTableConfigs = getRelTableConfigs;
                 $scope.fn.getDownTableConfigs = getDownTableConfigs;
                 $scope.fn.containsPartner = containsPartner;
+                $scope.fn.onActivate = onActivate;
 
                 //  �씠�뒋 紐⑸줉 而⑦듃濡ㅻ윭 vm, fn �긽�냽 以�
                 $scope.vm.viewer = {};
@@ -71,7 +79,10 @@
 
                 $scope.vm.form = {
                     issues : [], //�뿰愿� �씪媛�
-                    issuesDown : []  // �븯�쐞 �씪媛�
+                    issuesDown : [],  // �븯�쐞 �씪媛�
+                    issueCompanyVos : [],
+                    issueIspVos : [],
+                    issueHostingVos : []
                 };
 
 
@@ -85,6 +96,7 @@
 
                 $scope.vm.issueName = "";       // �꽑�깮�맂 �뿰愿� �씪媛� �씠由�
                 $scope.vm.issueId = "";       //
+                $scope.vm.issueTypeId = "";
                 $scope.vm.autoCompletePage = {
                     issue : {
                         page : 0,
@@ -110,11 +122,23 @@
 
                 function changeDetailView(issue) {
                     //  �씠�뒋 踰덊샇瑜� ���옣�븳 �썑 �씠�뒋 紐⑸줉�쑝濡� �씠�룞�븳�떎.
-                    // $rootScope.$broadcast("makeIssueSearch", issue);
+                    //$rootScope.$broadcast("makeIssueSearch",issue);
                     $scope.$parent.tableEvent.changeDetailView(issue.id);
+                    $scope.fn.onActivate();
+                }
+
+                function onActivate() {
+                    window.scroll(0,240);
                 }
 
                 angular.extend(this, $controller('autoCompleteController', {$scope : $scope, $injector : $injector}));
+
+                 // �씠�뒋 紐⑸줉 �뜲�씠�꽣 媛깆떊
+                $scope.$on("getIssueList", function () {
+                    $scope.fn.getIssueDetail();
+                });
+
+
 
                 // �븯�쐞 �씠�뒋 �궘�젣
                 function removeDownIssue(id) {
@@ -205,6 +229,10 @@
                     $scope.vm.autoCompletePage.issue.totalPage = result.data.page.totalPage;
                 }
 
+                function getDownIssueListCallBack(result) {
+                    $scope.vm.autoCompletePage.issue.totalPage = result.data.page.totalPage;
+                }
+
                 //  �뀒�씠釉붿쓽 �뿰愿� �씠�뒋 而щ읆�쓣 留뚮뱾�뼱以��떎.
                 function setRelTableColumn(Rel_issueTableConfig) {
 
@@ -279,14 +307,6 @@
                                 .setDAlign("text-center")
                                 .setDName("modifyDate"));
                             break;
-                        // default :"ISSUE_RELATION_DELETE" //  �뿰愿� �궘�젣
-                        //     $scope.vm.relTableConfigs.push($tableProvider.config()
-                        //         .setHName("issue.downIssueTitle")
-                        //         .setDType("renderer")
-                        //         .setHWidth("bold" + issueTableConfig.width)
-                        //         .setHSort(false)
-                        //         .setDRenderer("ISSUE_RELATION_DELETE"));
-                        //     break;
                     }
 
                     //  �궗�슜�옄 �젙�쓽 �븘�뱶 而щ읆
@@ -325,6 +345,16 @@
                                 .setDAlign("text-center")
                                 .setDRenderer("ISSUE_DOWN_MOVE"));
                             break;
+
+                        case "ISSUE_DOWN_STATUS_TYPE" : //  �씠�뒋 �긽�깭
+                            $scope.vm.downTableConfigs.push($tableProvider.config()
+                                .setHName("issue.issueStatus")
+                                .setDType("renderer")
+                                .setHWidth("bold " + Down_issueTableConfig.width)
+                                .setDAlign("text-center")
+                                .setDRenderer("ISSUE_DOWN_STATUS_TYPE"));
+                            break;
+
                         case "PRIORITY" :   // �븯�쐞 �씠�뒋 �슦�꽑�닚�쐞
                             $scope.vm.downTableConfigs.push($tableProvider.config()
                                 .setHName("common.priority")
@@ -581,9 +611,6 @@
                     });
                 }
 
-
-
-
                 // �뿰愿� �씠�뒋 異붽�
                 function addRelationIssue() {
                     if ($scope.vm.issueName.length == 0 || $scope.vm.form.issues.length == 0
@@ -640,25 +667,40 @@
                 }
 
                 //  �씠�뒋紐낆쓣 �겢由��븯硫� �씠�뒋 �긽�꽭 �젙蹂대�� 議고쉶�븳�떎.
-                $rootScope.$on("getIssueDetail", function (event, args) {
-                    $scope.vm.viewer.id = args["id"];
-                    $scope.fn.getIssueDetail();
-                });
+                //  $rootScope.$on("getIssueDetail", function (event, args) {
+                //      $scope.vm.viewer.id = args["id"];
+                //      $scope.fn.getIssueDetail();
+                //  });
+                
+                // �씠硫붿씪 蹂대궦�썑 �긽�꽭�솕硫� 媛깆떊
+                 $rootScope.$on("getIssueDetail", function (event, args) {
+                     $scope.fn.getIssueDetail();
+                 });
 
                 //  �씠�뒋紐낆쓣 �겢由��븯硫� �씠�뒋 �긽�꽭 �젙蹂대�� 議고쉶�븳�떎.
-                $scope.$on("getIssueDetail", function (event, args) {
-                    $scope.vm.viewer.id = args["id"];
-                    $scope.fn.getIssueDetail();
-                });
+                // $scope.$on("getIssueDetail", function (event, args) {
+                //     $scope.vm.viewer.id = args["id"];
+                //     $scope.fn.getIssueDetail();
+                // });
+
+                $scope.$watch(function() {
+                    return $rootScope.currentDetailIssueId;
+                }, function() {
+                    if ($rootScope.currentDetailIssueId != null) {
+                        $scope.vm.viewer.id = $rootScope.currentDetailIssueId;
+                        $scope.fn.getIssueDetail();
+                    }
+                }, true);
 
                 //  珥덇린�솕 �빐�빞�븷 �븷紐⑹쓣 吏��젙�븯�뿬 �떎瑜� �씠�뒋瑜� �겢由��븷 �븣 珥덇린�솕�빐以��떎.
                 function initReload() {
                     $scope.vm.editor.issueStatus = false;
                     $scope.vm.issueForm.issueStatusList = [];
                     $scope.vm.issueForm.issueStatusId = "";
-                    /*if ($scope.$root.$$phase !== '$apply' && $scope.$root.$$phase !== '$digest') {
-                        $scope.$apply();
-                    }*/
+                    $scope.vm.issueTypeId = $rootScope.getCurrentIssueTypeId();
+                    // if ($scope.$root.$$phase !== '$apply' && $scope.$root.$$phase !== '$digest') {
+                    //     $scope.$apply();
+                    // }
                 }
 
                 //  �씠�뒋 �긽�깭 蹂�寃�
@@ -672,6 +714,25 @@
                             parameter : function () {
                                 return {
                                     issueIds : [$scope.vm.viewer.id],
+                                    projectId : $scope.vm.viewer.projectVo.id
+                                };
+                            }
+                        }
+                    });
+                }
+
+                function modifyDownIssueStatus() {
+                    $uibModal.open({
+                        templateUrl : 'views/issue/downIssueModifyStatus.html',
+                        size : "md",
+                        controller : 'downIssueModifyStatusController',
+                        backdrop : 'static',
+                        resolve : {
+                            parameter : function () {
+                                return {
+                                    issueTypeId : $scope.vm.viewer.issueTypeVo.id,
+                                    issueIds : [$scope.vm.viewer.id],
+                                    downIssues : $scope.vm.viewer.issueDownVos,
                                     projectId : $scope.vm.viewer.projectVo.id
                                 };
                             }
@@ -737,6 +798,7 @@
                     });
                 }
 
+
                 //  �븯�쐞 �씠�뒋 紐⑸줉 �뀒�씠釉� �꽕�젙
                 function addDownIssueTableConfig() {
                     $uibModal.open({
@@ -749,6 +811,7 @@
                                 return {
                                     issueTypeId : $scope.vm.viewer.issueTypeVo.id
                                 };
+
                             }
                         }
                     });
@@ -786,8 +849,8 @@
                 function containsPartner(name) {
                     var result = false;
 
-                    if ($scope.vm.viewer.usePartnerVo != null) {
-                        $scope.vm.viewer.usePartnerVo.forEach(function (partnerVo) {
+                    if ($scope.vm.viewer.usePartnerVos != null) {
+                        $scope.vm.viewer.usePartnerVos.forEach(function (partnerVo) {
                             if (name === partnerVo.name) {
                                 result = true;
                             }
@@ -833,18 +896,32 @@
                                 $scope.vm.form.issuesDown.push(result.data.data);
 
                                 // �뿰愿� �씠�뒋 諛섎났臾�
-                                angular.forEach(result.data.data.issueRelationVos, function (issueRelationVo){
-                                    issueRelationVo.relationIssueTypeName = $scope.vm.relationIssueTypes[issueRelationVo.relationIssueType].name;
-                                    $scope.vm.form.issues.push(issueRelationVo.issueRelation);
-                                });
+                                if (result.data.data.issueRelationVos !== null) {
+                                    angular.forEach(result.data.data.issueRelationVos, function (issueRelationVo){
+                                        issueRelationVo.relationIssueTypeName = $scope.vm.relationIssueTypes[issueRelationVo.relationIssueType].name;
+                                        $scope.vm.form.issues.push(issueRelationVo.issueRelation);
+                                    });
+                                }
 
                                 // �븯�쐞 �씠�뒋 諛섎ぉ臾�
-                                angular.forEach(result.data.data.issueDownVos, function (issueDownVo){
-                                    $scope.vm.form.issuesDown.push(issueDownVo.issue);
-                                });
-
+                                if (result.data.data.issueDownVos !== null){
+                                    angular.forEach(result.data.data.issueDownVos, function (issueDownVo){
+                                        //$scope.vm.form.issuesDown.push(issueDownVo.issueDown);
+                                        $scope.vm.form.issuesDown.push(issueDownVo);
+                                        // 媛꾪뿉�쟻�씤 �븯�쐞 �씠�뒋 媛깆떊 �삤瑜� 諛⑹�
+                                        // $scope.$on("getIssueDetail", function (event, args) {
+                                        //      $scope.fn.getIssueDetail();
+                                        //  });
+                                        
+                                    });
+                                }
                                 $scope.vm.viewer.issueRelationVos = result.data.data.issueRelationVos;
                                 $scope.vm.viewer.issueDownVos = result.data.data.issueDownVos;
+
+
+                                if ($rootScope.workProject.id > -1 && result.data.data.projectVo !== null) {
+                                    $rootScope.changeLastProject(result.data.data.projectVo.id);
+                                }
                             }
                         }
                         else {
@@ -852,8 +929,6 @@
                         }
                     });
                 }
-
-                // ===================================================================================
 
                 //  �씠�뒋 �씠誘몄� 誘몃━ 蹂닿린 留뚮뱾湲�
                 function makePreviewImages(attachedFileVos) {
@@ -881,6 +956,12 @@
                         switch (issueTypeCustomField.customFieldVo.customFieldType) {
                             case "INPUT" :
                             case "SINGLE_SELECT" :
+                            case "NUMBER" :
+                            case "DATETIME" :
+                            case "IP_ADDRESS" :
+                            case "EMAIL" :
+                            case "SITE" :
+                            case "TEL" :
                                 issueTypeCustomField.useValues = "";
                                 break;
 
@@ -1031,22 +1112,59 @@
                     });
                 }
 
+                function sendMailVo(partnerVos) {
+                    $scope.fn.sendMail($scope.fn.getParametersAll(), $scope.fn.getParameters(null, partnerVos));
+                }
+
+                function sendMailAll() {
+                    var param = $scope.fn.getParametersAll();
+                    $scope.fn.sendMail(param, param);
+                }
+
                 //  �듅�젙 �궗�슜�옄�뿉寃� �씠�뒋瑜� 硫붿씪濡� 諛쒖넚
-                function sendMail(issueId, projectId) {
+                function sendMail(partnersAll, partners) {
                     $uibModal.open({
-                        templateUrl : 'views/issue/issueSendMail.html',
+                        templateUrl : 'views/issue/issueSendMailPartners.html',
                         size : "md",
-                        controller : 'issueSendMailController',
+                        controller : 'issueSendMailPartnersController',
                         backdrop : 'static',
                         resolve : {
-                            parameter : function () {
-                                return {
-                                    issueId : issueId,
-                                    projectId : projectId
-                                };
+                            parameter : {
+                                partnersAll : partnersAll,
+                                partners : partners,
+                                issueId : $scope.vm.viewer.id,
+                                projectId : $scope.vm.viewer.projectVo.id,
                             }
                         }
                     });
+                }
+
+                function getParametersAll() {
+                    var params = $scope.fn.getParameters(null, $scope.vm.viewer.issueCompanyVos);
+                    params = $scope.fn.getParameters(params, $scope.vm.viewer.issueIspVos);
+                    params = $scope.fn.getParameters(params, $scope.vm.viewer.issueHostingVos);
+
+                    if (params != null && params.length > 0) {
+                        for (let i = 0; i < params.length; i++) {
+                            params[i].id = i;
+                        }
+                    }
+                    return params;
+                }
+
+                function getParameters(sourceArr, partnerVos) {
+                    var excludeVos = sourceArr != null ? sourceArr.slice() : [];
+
+                    angular.forEach(partnerVos, function (vo) {
+                        var account = {
+                            account : vo.email
+                        }
+                        Object.assign(vo, account)
+
+                        excludeVos.push(vo);
+                    });
+
+                    return excludeVos;
                 }
 
                 //  蹂�寃� �젙蹂대�� �솗�씤�븳�떎.
@@ -1082,7 +1200,6 @@
                         }
                     });
                 }
-
             }
         ]);
     }

--
Gitblit v1.8.0