From 5d6ea07024b475d94b997ad5972f433cf0b5aae4 Mon Sep 17 00:00:00 2001
From: jhjang <jhjang@maprex.co.kr>
Date: 일, 12 12월 2021 18:13:38 +0900
Subject: [PATCH] - 상단 검색 기능 추가

---
 src/main/webapp/scripts/app/issue/issueList.controller.js |  212 +++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 158 insertions(+), 54 deletions(-)

diff --git a/src/main/webapp/scripts/app/issue/issueList.controller.js b/src/main/webapp/scripts/app/issue/issueList.controller.js
index 7cbdfe6..ed3d50f 100644
--- a/src/main/webapp/scripts/app/issue/issueList.controller.js
+++ b/src/main/webapp/scripts/app/issue/issueList.controller.js
@@ -8,9 +8,9 @@
         'angular'
     ],
     function (app, angular) {
-        app.controller('issueListController', ['$scope', '$rootScope', '$log', '$resourceProvider', '$tableProvider', '$state', '$uibModal', '$q',
+        app.controller('issueListController', ['$scope', '$rootScope', '$log', '$resourceProvider', '$tableProvider', '$treeProvider', '$state', '$uibModal', '$q',
             '$controller', '$injector', 'SweetAlert', 'Issue', 'IssueType', 'Priority', 'Severity', 'IssueStatus', 'CustomField', 'IssueSearch', 'IssueTableConfig', '$timeout', '$filter',
-            function ($scope, $rootScope, $log, $resourceProvider, $tableProvider, $state, $uibModal, $q, $controller, $injector, SweetAlert, Issue, IssueType, Priority, Severity, IssueStatus, CustomField,
+            function ($scope, $rootScope, $log, $resourceProvider, $tableProvider, $treeProvider, $state, $uibModal, $q, $controller, $injector, SweetAlert, Issue, IssueType, Priority, Severity, IssueStatus, CustomField,
                       IssueSearch, IssueTableConfig, $timeout, $filter) {
 
                 //  �븿�닔
@@ -20,6 +20,7 @@
                     changePageRowCount : changePageRowCount,    //  �럹�씠吏� 蹂�寃�
                     makeTableConfigs : makeTableConfigs, //  �뀒�씠釉� �꽕�젙
                     setTableColumn : setTableColumn,    //  �뀒�씠釉붿쓽 而щ읆�쓣 留뚮뱾�뼱以��떎.
+                    setTreeColumn : setTreeColumn,
                     add : add,   //  �씠�뒋 �깮�꽦
                     modify : modify,    //  �씠�뒋 �닔�젙
                     addRelationIssueForm : addRelationIssueForm,    //  �뿰愿� �씠�뒋 異붽�
@@ -39,7 +40,9 @@
                     makeSearchConditions : makeSearchConditions,    //  寃��깋 議곌굔�쓣 留뚮뱺�떎.
                     getIssueTableConfigs : getIssueTableConfigs,  //  �궗�슜�옄 �씠�뒋 紐⑸줉 �뀒�씠釉� �꽕�젙 媛믪쓣 媛��졇���꽌 �쟻�슜�븳�떎.
                     startExecute : startExecute, //  而⑦듃濡� 濡쒕뵫�떆 泥섏쓬�쑝濡� �떆�옉�릺�뒗 �븿�닔
-                    getResponseData : getResponseData //  而⑦듃濡� 濡쒕뵫�떆 泥섏쓬�쑝濡� �떆�옉�릺�뒗 �븿�닔
+                    getResponseData : getResponseData, //  而⑦듃濡� 濡쒕뵫�떆 泥섏쓬�쑝濡� �떆�옉�릺�뒗 �븿�닔
+                    onClickListMode : onClickListMode,   // 由ъ뒪�듃 紐⑤뱶 蹂�寃쎌떆 �떎�뻾�릺�뒗 �븿�닔
+                    setDefaultTableConfig : setDefaultTableConfig // 湲곕낯 �뀒�씠釉� �꽕�젙 �꽭�똿
                 };
 
                 //  蹂��닔
@@ -67,6 +70,7 @@
                         selectedPageRowCount : String(10)
                     },
                     tableConfigs : [],  //  �뀒�씠釉� �뀑�똿 �젙蹂�
+                    treeConfigs : [], // �듃由� �뀑�똿 �젙蹂�
                     responseData : {
                         data : []
                     },
@@ -84,8 +88,10 @@
                     registers : [], //  �벑濡앹옄
                     customFields : [],  //  �궗�슜�옄 �젙�쓽 �븘�뱶
                     issueTableConfigs : [],  //  �씠�뒋 �뀒�씠釉� �꽕�젙
+                    issueTreeConfigs : [],  //  �씠�뒋 �뀒�씠釉� �꽕�젙
                     parentIssueId : "",
-                    hideIssue : false
+                    hideIssue : false,
+                    listMode : 0, // 紐⑸줉 紐⑤뱶 0:湲곕낯 由ъ뒪�듃 1:�듃由ш뎄議� 由ъ뒪�듃
                 };
 
                 //  �뀒�씠釉� �씠踰ㅽ듃
@@ -107,6 +113,13 @@
 
                 $scope.$on("changedIssueListMenu", function (event, args) {
                     $scope.fn.getPageList($scope.vm.page.selectedPage - 1);
+                });
+
+                // �긽�떒 寃��깋�떆
+                $scope.$on("searchIssueList", function (event, args) {
+                    $scope.vm.search.keyWord = args.keyWord;
+                    $scope.fn.getPageList(0);
+                    $rootScope.isMainSearch = false;
                 });
 
                 //  寃��깋 議곌굔�쓣 湲곗뼲�븳�떎. - �쟻�슜 蹂대쪟
@@ -197,6 +210,7 @@
                 //  �씠�뒋 �뀒�씠釉� �꽕�젙
                 function makeTableConfigs() {
                     $scope.vm.tableConfigs = [];
+                    $scope.vm.treeConfigs = [];
 
                     $scope.vm.tableConfigs.push($tableProvider.config()
                         .setDType("checkbox")
@@ -233,8 +247,69 @@
                         if (issueTableConfig.display) {
                             //  �뀒�씠釉붿쓽 而щ읆�쓣 留뚮뱾�뼱以��떎.
                             $scope.fn.setTableColumn(issueTableConfig);
+                            $scope.fn.setTreeColumn(issueTableConfig);
                         }
                     });
+                }
+
+                //  �듃由� 而щ읆�쓣 留뚮뱾�뼱以��떎.
+                function setTreeColumn(issueTableConfig) {
+                    //  �씪諛� 而щ읆
+                    switch(issueTableConfig.key) {
+                        case "ISSUE_TITLE" :   //  �씠�뒋 �젣紐�
+                            $scope.vm.treeConfigs.push($treeProvider.config()
+                                .setDName("title"));
+                            break;
+
+                        case "PRIORITY" :   //  �슦�꽑�닚�쐞
+                            $scope.vm.treeConfigs.push($treeProvider.config()
+                                .setDName("priorityName"));
+                            break;
+                        case "SEVERITY" :   //  以묒슂�룄
+                            $scope.vm.treeConfigs.push($treeProvider.config()
+                                .setDName("severityName"));
+                            break;
+                        case "ISSUE_TYPE" : //  �씠�뒋 ���엯
+                            $scope.vm.treeConfigs.push($treeProvider.config()
+                                .setDName("issueTypeName"));
+                            break;
+                        case "ASSIGNEE_TEAM" :   //  �떞�떦遺��꽌
+                            $scope.vm.treeConfigs.push($treeProvider.config()
+                                .setDName("assigneeTeam"));
+                            break;
+                        case "REGISTER" :   //  �벑濡앹옄
+                            $scope.vm.treeConfigs.push($treeProvider.config()
+                                .setDName("register"));
+                            break;
+                        case "PERIOD" : //  湲곌컙
+                            $scope.vm.treeConfigs.push($treeProvider.config()
+                                .setDName("period"));
+                            break;
+                        case "MODIFY_DATE" : //  理쒓렐 蹂�寃쎌씪
+                            $scope.vm.treeConfigs.push($treeProvider.config()
+                                .setDName("modifyDate"));
+                            break;
+                        case "COUNT_DOWN_ISSUE" : //  �븯�쐞 �씠�뒋 媛쒖닔
+                            $scope.vm.treeConfigs.push($treeProvider.config()
+                                .setDName("countDownIssue"));
+                            break;
+                    }
+
+                    //  �궗�슜�옄 �젙�쓽 �븘�뱶 而щ읆
+                    if (issueTableConfig.key.indexOf("CUSTOM_FIELD_") !== -1) {
+                        //  留뚯빟 �씠�뒋 �뀒�씠釉� 而щ읆紐낆씠 �몴�떆�릺吏� �븡�쑝硫� �씠履쎌씠 臾몄젣
+                        for (var count in $scope.vm.customFields) {
+                            var customField = $scope.vm.customFields[count];
+
+                            if (customField.id === Number(issueTableConfig.key.substring(13))) {
+                                $scope.vm.treeConfigs.push($treeProvider.config()
+                                    .setDType("CUSTOM_FIELD")
+                                    .setDName(customField.id)
+                                    .setColumnHint(customField));
+                                break;
+                            }
+                        }
+                    }
                 }
 
                 //  �뀒�씠釉붿쓽 而щ읆�쓣 留뚮뱾�뼱以��떎.
@@ -367,6 +442,7 @@
                         beginCompleteDate : "",
                         endCompleteDate : "",
                         hideIssue : $scope.vm.hideIssue,
+                        isTree : $scope.vm.listMode === 1,
                         projectIds : (function () {
                             var projectIds = [];
 
@@ -487,8 +563,13 @@
                     return conditions;
                 }
 
+                function getTreeList() {
+
+                }
+
                 //  �씠�뒋 紐⑸줉�쓣 議고쉶�븳�떎.
                 function getPageList(selectedPage, detail = false) {
+                    $rootScope.spinner = true;  //  �봽濡쒓렇�옒�뒪 諛�
                     if (selectedPage < 0) {
                         selectedPage = 0;
                     }
@@ -507,26 +588,31 @@
                         currentPage = selectedPage;
                     }
 
-                    // 硫붾돱�뿉�꽌 �꽑�깮�맂 �씠�뒋 �쑀�삎�쓣 湲곕낯�쑝濡� 異붽�
-                    if ($rootScope.issueTypeMenu != null) {
-                        // $scope.vm.pageTitle = $rootScope.issueTypeMenu.name;
-                        $scope.vm.search.issueTypeIds = [];
-                        $scope.vm.search.issueTypeIds.push({
-                            fieldKey : $rootScope.issueTypeMenu.id,
-                            fieldValue : $rootScope.issueTypeMenu.name
-                        });
-                    }
-
-                    //  寃��깋 議곌굔�쓣 ���옣�븳�떎.
-                    //$scope.fn.makeVmSearchObject();
 
 
-                    // �쁽�옱 �꽑�깮�맂 �봽濡쒖젥�듃瑜� 寃��깋 湲곕낯�쑝濡� 異붽�
-                    if ($rootScope.workProject != null && $rootScope.workProject.id > -1) {
-                        var find = findProjectSearch($rootScope.workProject.id);
-                        if (!find) {
-                            $scope.vm.projects = [];
-                            $scope.vm.projects.push($rootScope.workProject);
+                    // 寃��깋 湲곕낯媛� �꽭�똿
+                    $scope.vm.search.issueTypeIds = [];
+                    $scope.vm.projects = [];
+                    if (!$rootScope.isMainSearch) {
+                        // 硫붾돱�뿉�꽌 �꽑�깮�맂 �씠�뒋 �쑀�삎�쓣 湲곕낯�쑝濡� 異붽�
+                        if ($rootScope.issueTypeMenu != null) {
+                            // $scope.vm.pageTitle = $rootScope.issueTypeMenu.name;
+
+                            $scope.vm.search.issueTypeIds.push({
+                                fieldKey: $rootScope.issueTypeMenu.id,
+                                fieldValue: $rootScope.issueTypeMenu.name
+                            });
+                        }
+
+                        //  寃��깋 議곌굔�쓣 ���옣�븳�떎.
+                        //$scope.fn.makeVmSearchObject();
+
+                        // �쁽�옱 �꽑�깮�맂 �봽濡쒖젥�듃瑜� 寃��깋 湲곕낯�쑝濡� 異붽�
+                        if ($rootScope.workProject != null && $rootScope.workProject.id > -1) {
+                            var find = findProjectSearch($rootScope.workProject.id);
+                            if (!find) {
+                                $scope.vm.projects.push($rootScope.workProject);
+                            }
                         }
                     }
 
@@ -556,6 +642,7 @@
                         else {
                             SweetAlert.error($filter("translate")("issue.failedIssueLookup"), result.data.message.message); // �씠�뒋 議고쉶 �떎�뙣
                         }
+                        $rootScope.spinner = false;  //  �봽濡쒓렇�옒�뒪 諛�
 
                     });
                 }
@@ -1055,6 +1142,54 @@
                     return deferred.promise;
                 }
 
+                // 由ъ뒪�듃 紐⑤뱶 蹂�寃쎌떆 �떎�뻾
+                function onClickListMode(listMode) {
+                    if ($scope.vm.listMode !== listMode) {
+                        $scope.vm.listMode = listMode;
+
+                        if ($scope.vm.listMode === 0) {
+                            $scope.fn.getPageList(0);
+                        } else {
+                            $scope.fn.getPageList(0);
+                        }
+                    }
+                }
+
+                function setDefaultTableConfig() {
+                    //  理쒖큹 �뾽臾� 怨듦컙�뿉 �뱾�뼱�솕�쓣 寃쎌슦
+                    $scope.vm.issueTableConfigs = [{
+                        name : $filter("translate")("issue.issueTitle"), // �씠�뒋 �젣紐�
+                        key : "ISSUE_TITLE",
+                        width : "width-140-p",
+                        position : 1,
+                        display : true
+                    }, {
+                        name : $filter("translate")("common.priority"), // �슦�꽑�닚�쐞
+                        key : "PRIORITY",
+                        width : "width-80-p",
+                        position : 2,
+                        display : true
+                    }, {
+                        name : $filter("translate")("common.importance"), // 以묒슂�룄
+                        key : "SEVERITY",
+                        width : "width-80-p",
+                        position : 3,
+                        display : true
+                    }, {
+                        name : $filter("translate")("issue.issueType"), // �씠�뒋 ���엯
+                        key : "ISSUE_TYPE",
+                        width : "width-140-p",
+                        position : 4,
+                        display : true
+                    }, {
+                        name : $filter("translate")("common.assigneeTeam"), // �떞�떦遺��꽌
+                        key : "ASSIGNEE_TEAM",
+                        width : "width-140-p",
+                        position : 5,
+                        display : true
+                    }];
+                }
+
                 //  理쒖큹 �떎�뻾
                 function startExecute() {
                     // �뙆�씪誘명꽣 �씫湲�
@@ -1091,38 +1226,7 @@
                                 });
                             }
                             else {
-                                //  理쒖큹 �뾽臾� 怨듦컙�뿉 �뱾�뼱�솕�쓣 寃쎌슦
-                                $scope.vm.issueTableConfigs = [{
-                                    name : $filter("translate")("issue.issueTitle"), // �씠�뒋 �젣紐�
-                                    key : "ISSUE_TITLE",
-                                    width : "width-140-p",
-                                    position : 1,
-                                    display : true
-                                }, {
-                                    name : $filter("translate")("common.priority"), // �슦�꽑�닚�쐞
-                                    key : "PRIORITY",
-                                    width : "width-80-p",
-                                    position : 2,
-                                    display : true
-                                }, {
-                                    name : $filter("translate")("common.importance"), // 以묒슂�룄
-                                    key : "SEVERITY",
-                                    width : "width-80-p",
-                                    position : 3,
-                                    display : true
-                                }, {
-                                    name : $filter("translate")("issue.issueType"), // �씠�뒋 ���엯
-                                    key : "ISSUE_TYPE",
-                                    width : "width-140-p",
-                                    position : 4,
-                                    display : true
-                                }, {
-                                    name : $filter("translate")("common.assigneeTeam"), // �떞�떦遺��꽌
-                                    key : "ASSIGNEE_TEAM",
-                                    width : "width-140-p",
-                                    position : 5,
-                                    display : true
-                                }];
+                                $scope.fn.setDefaultTableConfig();
                             }
 
                             //  �씠�뒋 �뀒�씠釉� �꽕�젙

--
Gitblit v1.8.0