/** * Created by maprex on 2021-03-25. */ 'use strict'; define(['app'], function (app) { app.factory("Gantt", ['$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("gantt/find", conditions).then(function (response) { $log.debug("이슈 목록 데이터 : ", response); return response; }); }, findProject : function (conditions) { return $http.post("gantt/findProject", conditions).then(function (response) { $log.debug("프로젝트 이슈 목록 데이터 : ", response); return response; }); }, add : function (conditions) { conditions.url = "gantt/add"; return $upload.upload(conditions).progress(function (evt) { // 파일 업로드 진행율을 표시해준다. fileUploadProgress(evt); }).then(function (response) { $log.debug("이슈 생성 결과 : ", response); return response; }); }, modify : function (conditions) { conditions.url = "gantt/modify"; return $upload.upload(conditions).progress(function (evt) { // 파일 업로드 진행율을 표시해준다. fileUploadProgress(evt); }).then(function (response) { $log.debug("이슈 수정 결과 : ", response); return response; }); }, detail : function (conditions) { return $http.post("gantt/detail", conditions).then(function (response) { $log.debug("이슈 상세 데이터 : ", response); return response; }); }, remove : function (conditions) { return $http.post("gantt/remove", conditions).then(function (response) { $log.debug("이슈 삭제 결과 : ", response); return response; }); }, } } ]) });