박현정 박현정 07-25
250725 박현정 프로젝트 상세조회 및 수정 기능 추가
@e50c60b738bffa304771d50ab003c163ac352ba4
client/resources/api/asset.js
--- client/resources/api/asset.js
+++ client/resources/api/asset.js
@@ -1,21 +1,8 @@
 import apiClient from "./index";
-import axios from 'axios';
 
 // 자산(프로젝트) 목록 조회 기능
 export const findAllProjectsProc = (data) => {
     return apiClient.post('/project/findAllProjects.json', data);
-}
-
-// 자산(프로젝트) 생성 기능
-// export const saveProjectProc = (formData) => {
-//   return apiClient.post('/project/saveProject.file', formData);
-// }
-export const saveProjectProc = (formData) => {
-  return axios.post('/api/project/saveProject.file', formData, {
-    headers: {
-      'Content-Type': 'multipart/form-data'
-    }
-  });
 }
 
 // 자산(프로젝트) 복제 기능
 
client/resources/api/modeling.js (added)
+++ client/resources/api/modeling.js
@@ -0,0 +1,29 @@
+import axios from 'axios';
+import apiClient from "./index";
+
+
+// 자산(프로젝트) 생성 기능
+// export const saveProjectProc = (formData) => {
+//   return apiClient.post('/project/saveProject.file', formData);
+// }
+export const saveProjectProc = (formData) => {
+  return axios.post('/api/project/saveProject.file', formData, {
+    headers: {
+      'Content-Type': 'multipart/form-data'
+    }
+  });
+}
+
+// 자산(프로젝트) 기존 정보 조회 기능
+export const findProjectProc = (projectId, data) => {
+  return apiClient.post(`/project/${projectId}/findProject.json`, data);
+}
+
+// 자산(프로젝트) 수정 기능
+export const updateProjectProc = (projectId, formData) => {
+  return axios.post(`/api/project/${projectId}/updateProject.file`, formData, {
+    headers: {
+      'Content-Type': 'multipart/form-data'
+    }
+  });
+}
client/views/pages/subPage/Asset.vue
--- client/views/pages/subPage/Asset.vue
+++ client/views/pages/subPage/Asset.vue
@@ -16,7 +16,7 @@
     </div>
     <div class="bottom-zone">
       <!-- 새 카드 -->
-      <div class="card new-card" @click="goToModeling()">
+      <div class="card new-card" @click="goToModelingCreate()">
         <div class="new-symbol">
           <img src="../../../resources/img/content/ico_digital_asset.svg" alt="">
         </div>
@@ -25,7 +25,7 @@
       </div>
 
       <!-- v-for 카드 반복 -->
-      <div class="card" v-for="(project, index) in projects" :key="index">
+      <div class="card" v-for="(project, index) in projects" :key="index" @click="goToModelingUpdate(project)">
         <div class="thumbnail">
           <img :src="project.img" alt="" />
         </div>
@@ -96,6 +96,7 @@
                 // { name: '프로젝트D', date: '2025.05.12', img: require('../../../resources/img/content/sample1.png'),isFavorite: true },
                 // { name: '프로젝트E', date: '2025.05.12', img: require('../../../resources/img/content/sample1.png'),isFavorite: false },
             ],
+            members: [],
             openMenuIndex: null,
             dropdownDirection: 'right', // 또는 'left'
             // showPopup: false,
@@ -133,8 +134,8 @@
               const projectList = response.data.result.projects;
 
               this.projects = projectList.map(project => ({
-                projectId: project.projectId,
-                projectGroupId: project.projectGroupId,
+                id: project.projectId,
+                groupId: project.projectGroupId,
                 isMain: project.isMain,
                 name: project.projectName,
                 date: project.createdAt,
@@ -162,10 +163,14 @@
             })
             .catch(error => {console.error('자산 목록 조회 실패: ', error);})
         },
-        goToModeling() {
-          console.log('모델링 페이지로 이동');
+        goToModelingCreate() {
+          console.log('모델링 페이지로 이동-생성');
           this.$router.push('/modeling.page');
         },
+        goToModelingUpdate(project) {
+          console.log('모델링 페이지로 이동-수정');
+          this.$router.push({ name: 'Modeling', query: {projectId: project.id}});
+        },
         duplicateProject(projectId) {
           const data = {
             memberId : this.getMemId
client/views/pages/subPage/Modeling.vue
--- client/views/pages/subPage/Modeling.vue
+++ client/views/pages/subPage/Modeling.vue
@@ -26,7 +26,7 @@
                 </div>
             </div>
             <div class="btn-zone gap10 mb30">
-                <button class="btn md ico-before ico-reset">초기화</button>
+                <button class="btn md ico-before ico-reset" @click="resetImage">초기화</button>
                 <button class="btn md ico-before ico-3d">3D 변환</button>
             </div>
             <div class="direction-zone mb30">
@@ -67,7 +67,7 @@
                         >
                             <button
                                 :title="tool.title" 
-                                @click=" tool.title === '저장' ? saveProject() : toggleTool(tool)">
+                                @click=" tool.title === '저장' ? submit() : toggleTool(tool)">
                                 <img :src="tool.icon" :alt="tool.title + ' 아이콘'" style="vertical-align: middle;"/>
                             </button>
                         </li>
@@ -88,10 +88,9 @@
                                     <p class="modeling-title">{{ activeModalTool.title }}</p>
                                     <div class="modeling-content">
                                         <ul v-if="activeModalTool.title === '참여자'" class="mb10">
-                                            <li>참여자1</li>
-                                            <li>참여자1</li>
-                                            <li>참여자1</li>
-                                            <li>참여자1</li>
+                                            <li v-for="(member, index) in members" :key="member.id">
+                                                {{ member.name }} <span v-if="member.isOwner === 'Y'">(대표)</span>
+                                            </li>
                                         </ul>
                                         <div v-else-if="activeModalTool.title === '코멘트'" class="mb10">
                                             <div class="input-group mb10">
@@ -168,8 +167,8 @@
 </template>
 
 <script>
-import { saveProjectProc } from '../../../resources/api/asset';
 import { mapGetters } from 'vuex';
+import { saveProjectProc, findProjectProc, updateProjectProc } from '../../../resources/api/modeling';
 
 export default {
     data() {
@@ -353,7 +352,9 @@
             localCommentData: { // 복사본
                 summary: '',
                 comment: ''
-            }
+            },
+            projectId: null, // 프로젝트 수정 시 사용
+            isReset: null, // 이미지 초기화 시 사용
         };
     },
     methods: {
@@ -405,12 +406,22 @@
         closeModal() {
             this.activeModalTool = null;
         },
-        saveProject() {
+        submit(){
+            console.log('저장');
+            if(this.projectId) {
+                console.log('수정');
+                this.updateProject(this.projectId); // 수정
+            } else {
+                console.log('생성');
+                this.createProject(); // 생성
+            }
+        },
+        createProject() {
             console.log('프로젝트(자산) 저장');
 
             const formData = new FormData();
             const fileInput = this.$refs.fileInput; // 업로드 파일 가져오기
-            if (!fileInput || !fileInput.files.length) {
+            if (!fileInput && this.isReset == true) {
                 alert("파일을 선택해주세요.");
                 return;
             }
@@ -426,13 +437,60 @@
             })
             .catch(error => {console.error('자산 생성 실패: ', error);})
         },
+        updateProject(projectId) {
+            console.log('프로젝트(자산) 수정');
+
+            const formData = new FormData();
+            const fileInput = this.$refs.fileInput; // 업로드 파일 가져오기(없으면 기존 이미지 유지: fileInput==null)
+            if (!fileInput && this.isReset == true) {
+                alert("파일을 선택해주세요.");
+                return;
+            }
+            if (fileInput && fileInput.files && fileInput.files.length > 0) {
+                formData.append("imageFile", fileInput.files[0]);
+            }
+
+            formData.append("memberId", this.getMemId);
+            formData.append("summary", this.commentData.summary);
+            formData.append("comment", this.commentData.comment);
+            updateProjectProc(projectId, formData)
+            .then(response => {
+                console.log('프로젝트(자산) 페이지로 이동');
+                this.$router.push('/asset.page');
+            })
+            .catch(error => {console.error('자산 수정 실패: ', error);})
+        },
         saveComment() {
             this.commentData = {...this.localCommentData}; // 저장 시 반영
             console.log('요약: ', this.commentData.summary);
             console.log('주석: ', this.commentData.comment);
             this.closeModal();
-        }
-    },
+        },
+        loadProjectData(projectId) {
+            console.log('기존 프로젝트 정보 불러오기 : ' + projectId);
+            const data = {
+                memberId : this.getMemId
+            };
+            findProjectProc(projectId, data)
+                .then(response => {
+                    const projectInfo = response.data.result;
+                    this.projectId = projectId;
+                    this.localCommentData.summary =  projectInfo.projectComment.summary;
+                    this.localCommentData.comment =  projectInfo.projectComment.comment;
+                    this.saveComment();
+
+                    const memberList = projectInfo.projectMember; 
+                    this.members = memberList.map(member => ({
+                        id: member.memberId,
+                        name: member.memberName,
+                        isOwner: member.isOwner
+                    }));
+                })
+        },
+        resetImage(){
+            this.isReset = true;
+        },
+    }, 
     watch: {},
     computed: {
         getToolIcon() {
@@ -453,7 +511,12 @@
     },
     components: {},
     created() {},
-    mounted() {},
+    mounted() {
+        const projectId = this.$route.query.projectId;
+        if(projectId) {
+            this.loadProjectData(projectId);
+        }
+    },
     beforeUnmount() {},
 };
 
Add a comment
List