/** * Created by wisestone on 2018-01-04. */ 'use strict'; define(['app'], function (app) { app.factory("Issue", ['$http', '$log', '$upload', '$rootScope', function ($http, $log, $upload, $rootScope) { // 파일 업로드 진행율을 표시해준다. function fileUploadProgress(evt) { if (evt.config.file.length > 0) { var progress = parseInt(100.0 * evt.loaded / evt.total); var body = { display : progress < 100, // 표시 여부 clientFileCount : evt.config.file.length, // 클라이언트 업로드 파일 개수 clientProgress: progress + "%", // 진행률 serverFileName : null, // 서버 업로드 파일 명 serverProgress : null, totalFileCount : null, // 전체 업로드 개수 uploadFileCount : null // 진행중인 업로드 파일 개수 }; $rootScope.$broadcast("displayFileUpload", body); } } return { find : function (conditions) { return $http.post("issue/find", conditions).then(function (response) { $log.debug("이슈 목록 데이터 : ", response); return response; }); }, findPartners : function (conditions) { return $http.post("issue/findPartner", conditions).then(function (response) { $log.debug("사용하는 파트너 목록 데이터 : ", response); return response; }); }, findReadyDepartments : function (conditions) { return $http.post("issue/findReadyDepartments", conditions).then(function (response) { $log.debug("워크플로우의 생성 상태의 담당부서 목록 데이터 : ", response); return response; }); }, add : function (conditions) { conditions.url = "issue/add"; return $upload.upload(conditions).progress(function (evt) { // 파일 업로드 진행율을 표시해준다. fileUploadProgress(evt); }).then(function (response) { $log.debug("이슈 생성 결과 : ", response); return response; }); }, relAdd : function (conditions) { conditions.url = "issue/relIssueAdd"; return $upload.upload(conditions).progress(function (evt) { // 파일 업로드 진행율을 표시해준다. fileUploadProgress(evt); }).then(function (response) { $log.debug("이슈 생성 결과 : ", response); return response; }); }, downAdd : function (conditions) { conditions.url = "issue/downIssueAdd"; return $upload.upload(conditions).progress(function (evt) { // 파일 업로드 진행율을 표시해준다. fileUploadProgress(evt); }).then(function (response) { $log.debug("이슈 생성 결과 : ", response); return response; }); }, modifyParentIssue : function (conditions) { return $http.post("issue/modifyParentIssue", conditions).then(function (response) { $log.debug("상위 일감 수정 결과 : ", response); return response; }); }, modify : function (conditions) { conditions.url = "issue/modify"; return $upload.upload(conditions).progress(function (evt) { // 파일 업로드 진행율을 표시해준다. fileUploadProgress(evt); }).then(function (response) { $log.debug("이슈 수정 결과 : ", response); return response; }); }, detail : function (conditions) { return $http.post("issue/detail", conditions).then(function (response) { $log.debug("이슈 상세 데이터 : ", response); return response; }); }, remove : function (conditions) { return $http.post("issue/remove", conditions).then(function (response) { $log.debug("이슈 삭제 결과 : ", response); return response; }); }, removeAllIssues : function (conditions) { return $http.post("issue/removeAll", conditions).then(function (response) { $log.debug("하위이슈 삭제 결과 : ", response); return response; }); }, /*removeDownIssues : function (conditions) { return $http.post("issue/removeDown", conditions).then(function (response) { $log.debug("하위이슈 삭제 결과 : ", response); return response; }); },*/ importExcel : function (conditions) { conditions.url = "issue/importExcel"; return $upload.upload(conditions).then(function (response) { $log.debug("이슈 Import 결과 : ", response); return response; }); }, modifyMultiIssueStatus : function (conditions) { return $http.post("issue/modifyMultiIssueStatus", conditions).then(function (response) { $log.debug("다중 이슈 상태 변경 결과 : ", response); return response; }); }, sendEmail : function (conditions) { return $http.post("issue/sendEmail", conditions).then(function (response) { $log.debug("이슈 이메일 발송 결과 : ", response); return response; }); }, sendEmailPartners : function (conditions) { return $http.post("issue/sendEmailPartners", conditions).then(function (response) { $log.debug("이슈 이메일 발송 결과 : ", response); return response; }); }, sendCommonEmail : function (conditions) { return $http.post("issue/sendCommonEmail", conditions).then(function (response) { $log.debug("이슈 이메일 발송 결과 : ", response); return response; }); } } } ]) });