[FrontEnd][Vue-PJ] ๊ฐœ๋ฐœ์ž ์ปค๋ฎค๋‹ˆํ‹ฐ ์„œ๋น„์Šค - ๊ฒŒ์‹œํŒ ๋งŒ๋“ค๊ธฐ : ๋“ฑ๋ก /์ˆ˜์ •

2022. 3. 19. 18:25ใ†Programming Project ์ž‘์—…์‹ค/๋‚ด์šฉ ์ •๋ฆฌ

728x90
๋ฐ˜์‘ํ˜•

 

 

 

๐Ÿง‘๐Ÿป‍๐Ÿ’ป Git Hub ์ฃผ์†Œ

 

 

 

๐Ÿ—‚ ๋ชฉ์ฐจ

โ— [FrontEnd][Vue-PJ] ๊ฐœ๋ฐœ์ž ์ปค๋ฎค๋‹ˆํ‹ฐ ์„œ๋น„์Šค - Home / Main

โ— [FrontEnd][Vue-PJ] ๊ฐœ๋ฐœ์ž ์ปค๋ฎค๋‹ˆํ‹ฐ ์„œ๋น„์Šค - ๊ฒŒ์‹œํŒ ๋งŒ๋“ค๊ธฐ : ๋ชฉ๋ก ์กฐํšŒ

โ— [FrontEnd][Vue-PJ] ๊ฐœ๋ฐœ์ž ์ปค๋ฎค๋‹ˆํ‹ฐ ์„œ๋น„์Šค - ๊ฒŒ์‹œํŒ ๋งŒ๋“ค๊ธฐ : ์ƒ์„ธ ์กฐํšŒ

โ— [FrontEnd][Vue-PJ] ๊ฐœ๋ฐœ์ž ์ปค๋ฎค๋‹ˆํ‹ฐ ์„œ๋น„์Šค - ๊ฒŒ์‹œํŒ ๋งŒ๋“ค๊ธฐ : ๋“ฑ๋ก / ์ˆ˜์ •

โ— [FrontEnd][Vue-PJ] ๊ฐœ๋ฐœ์ž ์ปค๋ฎค๋‹ˆํ‹ฐ ์„œ๋น„์Šค - ๊ฒŒ์‹œํŒ ๋งŒ๋“ค๊ธฐ : ์‚ญ์ œ

โ— [FrontEnd][Vue-PJ] ๊ฐœ๋ฐœ์ž ์ปค๋ฎค๋‹ˆํ‹ฐ ์„œ๋น„์Šค - ๊ฒŒ์‹œํŒ ๋งŒ๋“ค๊ธฐ : ๋‹ต๋ณ€ ๋“ฑ๋ก / ์ˆ˜์ •

โ— [FrontEnd][Vue-PJ] ๊ฐœ๋ฐœ์ž ์ปค๋ฎค๋‹ˆํ‹ฐ ์„œ๋น„์Šค - ๊ฒŒ์‹œํŒ ๋งŒ๋“ค๊ธฐ : ๋‹ต๋ณ€ ์‚ญ์ œ

 

๐Ÿ‘จ‍๐Ÿ‘ฉ‍๐Ÿ‘ง‍๐Ÿ‘ฆ ํšŒ์› ๊ด€๋ จ

โ— [FrontEnd][Vue-PJ] ๊ฐœ๋ฐœ์ž ์ปค๋ฎค๋‹ˆํ‹ฐ ์„œ๋น„์Šค - ํšŒ์› ๊ด€๋ จ : ํšŒ์› ๊ฐ€์ž…



 

- ๋ถ€ ๋ก -

[Vue.js] axios ์„ค์น˜

[FrontEnd] html Tag ์ •๋ฆฌ

[CSS] CSS ์ •๋ฆฌ

[FrontEnd][Vue-PJ] ๊ฐœ๋ฐœ์ž ์ปค๋ฎค๋‹ˆํ‹ฐ ์„œ๋น„์Šค - Paging ์ฒ˜๋ฆฌ

[Vue.js] ๊ธฐ์ดˆ ๊ฐœ๋… ์ •๋ฆฌ - Vue Router

 

 

 

 

 

 

 

๐Ÿš€ ๊ฒŒ์‹œํŒ ๋งŒ๋“ค๊ธฐ - ๋“ฑ๋ก / ์ˆ˜์ •

    ๐Ÿ”ฝ  ํ™”๋ฉด - ๋“ฑ๋ก

 

 

 

    ๐Ÿ”ฝ  ํ™”๋ฉด - ์ˆ˜์ •

 

 

 

 

 

    ๐Ÿ”ฝ  Source Code

<template>
    <!-- ์ปจํ…์ธ  ์˜์—ญ -->
    <div id="contentWrap">

        <div id="topVisualWrap">
            
            <div class="topVisual">
                <p class="tit01">[JUNY COMPANY] ๊ฐœ๋ฐœ์ž ์—…๋ฌด ํ˜‘์—… ์„œ๋น„์Šค ์œ„ํ•œ</p>

                <p class="tit02">์ธ๊ณต์ง€๋Šฅ ํด๋ผ์šฐ๋“œ ์ฃผ๋‹ˆํ•˜๋ž‘ ํ”Œ๋žซํผ <span></span></p>
            </div>  <!-- div class="topVisual" ๋ -->

        </div>  <!-- div id="topVisualWrap" ๋ -->

        <!-- ์ปจํ…์ธ  ์˜์—ญ -->
        <div id="Content">
            <h2>
                <span>๊ฐœ๋ฐœ ์ง€์›</span>

                <span @click="goList()"><b>Q&A</b></span>
            </h2>

            <div class="ListTbWrap mt-20">
                
                <div class="margin-left:5px;margin-bottom:5px;">
                    <input type="checkbox" name="" id="result01" :checked="devInquryData.secretAt === false" v-model="devInquryData.secretAt" value=false>
                    <label for="result01">
                        <span></span>๋น„๋ฐ€๊ธ€
                    </label>
                </div> <!-- div class="margin-left:5px;margin-bottom:5px;" ๋ -->

                <table class="tList">
                    <caption>Q&A ์ˆ˜์ •</caption>

                    <colgroup>
                        <col style="width:15%">
                        <col>
                    </colgroup>

                    <tbody>
                        <tr>
                            <td class="PalignL">์ œ๋ชฉ
                                <span class="t_red">*</span>
                            </td>

                            <td class="PalignL">
                                <input id="" type="text" class="w100p" placeholder="์ œ๋ชฉ์„ ์ž…๋ ฅ ํ•ด ์ฃผ์„ธ์š”!" v-model="devInquryData.inqrySj" ref="inqrySj">
                            </td>
                        </tr>

                        <tr>
                            <td class="PalignL">๋‚ด์šฉ
                                <span class="t_red">*</span>
                            </td>

                            <td class="PalignL">
                                <textarea class="w100p" rows="15" placeholder="๋‚ด์šฉ์„ ์ž…๋ ฅ ํ•ด ์ฃผ์„ธ์š”!" v-model="devInquryData.inqryCn" ref="inqryCn"></textarea>
                            </td>
                        </tr>

                        <tr>
                            <td class="PalignL">์ฒจ๋ถ€ ํŒŒ์ผ</td>

                            <td class="PalignL">
                                <template v-if="devInquryData.isNew === 'C'">
                                    <input type="file" name="" @change="doFileChange">
                                </template>

                                <template v-else>
                                    <input type="file" name="" @change="doFileChange">

                                    <a href="#" class="attatch_file ml-10">{{ devInquryData.fileNm }}</a>

                                    <button type="button" class="btnFileDel" :hidden="isNew">์‚ญ์ œ</button>
                                </template>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>  <!-- div class="ListTbWrap mt-20" ๋ -->

            <div class="btn_wrap">
                <a href="#" class="btn04" @click="doRegist()">{{ this.isNewText }}</a>

                <a href="#" class="btn03" @click="goList()">์ทจ ์†Œ</a>
            </div>  <!-- div class="btn_wrap" ๋ -->
        </div>  <!-- div id="Content" ๋ -->

    </div>  <!-- div id="contentWrap" ๋ -->

    <!-- Pop up -->
    <div class="card3_popup" style="display: block; top:160px;" v-show="this.finishPopupShow">

        <div class="popup_body">

            <!-- Message -->
            <div class="card_mody mt-20">
                <p class="c_tit">๊ฒŒ์‹œ๊ธ€ ์ˆ˜์ •์ด ์™„๋ฃŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค!</p>
            </div>  <!-- div class="card_mody mt-20" ๋ -->

            <div class="btn_wrap_pop">
                <button class="btn_m01 blue">ํ™• ์ธ</button>
            </div>  <!-- div class="btn_wrap_pop" ๋ -->

            <div class="popup_close" @click="this.finishPopupShow = false">๋‹ซ๊ธฐ</div>

        </div>  <!-- div class="popup_body" ๋ -->

        <!-- Pop up ๋ -->

    <!-- Pop up -->
    <div class="card3_popup" style="display: block; top:160px;" v-show="this.validationPopupShow">

        <div class="popup_body">

            <div class="card_mody mt-20">
                <p class="c_tit">ํ•„์ˆ˜ ํ•ญ๋ชฉ์€ ๊ผญ ์ž…๋ ฅ ํ•ด ์ฃผ์„ธ์š”!</p>
            </div> <!-- div class="card_mody mt-20" ๋ -->

        </div>  <!-- div class="popup_body" ๋ -->

        <div class="btn_wrap_pop">
            <button class="btn_m01 blue" @click="this.validationPopupShow = false">ํ™•์ธ</button>

            <div class="popup_close" @click="this.validationPopupShow = false">๋‹ซ๊ธฐ</div>
        </div>  <!-- div class="btn_wrap_pop" ๋ -->

    </div> <!-- div class="card3_popup" ๋ -->        
 
    </div>  <!-- div class="card3_popup" style="display: block; top:160px;" v-show="this.finishPopupShow" ๋ -->
    <!-- Pop up ๋ -->
</template>

<script>
import { devInquryRegist, devInquryDetail } from "@/api/devInquryApi";

export default {
    data() {
        return {
            finishPopupShow : false,
            validationPopupShow : false,
            isNew : false,
            isNewText : '๋“ฑ ๋ก',
            devInquryData : {secretAt : false},
        }
    }, // data() ๋

    created() {
        // ๊ธ€ ๋“ฑ๋ก์„ ๋“ค์–ด๊ฐ€๊ธฐ ์œ„ํ•œ ์กฐ๊ฑด์ ˆ (status๊ฐ€ C์ด๋ฉด ๋“ฑ๋ก์œผ๋กœ ์ฒ˜๋ฆฌ)
        if(this.$route.query.status !== 'C') {
            this.isNew = false;
            this.isNewText = '์ˆ˜ ์ •';
            this.getDetailView();
        } else {
            this.isNew = true;
            this.isNewText = '๋“ฑ ๋ก';
        } // if(this.$route.query.status != 'C') ๋
    }, // created() ๋

    methods : {
        goList() {
            this.$router.push({
                path : "/support/devInquryList",
            });
        }, // goList() ๋

        goDetailView(inqurySn) {
            this.$router.push({
                path : "/support/devInquryDetailView",
                query : {
                    inqurySn
                } // query ๋
            });
        },

        getDetailView() {
          devInquryDetail({
              inqrySn : this.$route.query.inqrySn
            }).then(response => {
                console.log("์‘๋‹ต์œผ๋กœ ๋“ค์–ด์˜จ ์ƒ์„ธ ์กฐํšŒ ์ •๋ณด : " + response.data);
                
                this.devInquryData = response.data.devInquryVO;

                console.log("ํ˜„์žฌ DevInquryRegist.vue์˜ this.devInquryData ๊ฐ’ :" + this.devInquryData);
            }).catch(error => {
                console.log("๊ฒŒ์‹œ๋ฌผ / ์ˆ˜์ • ๊ณผ์ •์„ ์œ„ํ•œ ๊ธ€ ์ƒ์„ธ ์กฐํšŒ์—์„œ ๋ฌธ์ œ๊ฐ€ ์ƒ๊ฒจ Catch๋ฌธ์ด ๋™์ž‘ํ•˜์˜€์Šต๋‹ˆ๋‹ค!" + error + "๋ฌธ์ œ ๋ฐœ์ƒ์œผ๋กœ ๋ชฉ๋ก ์กฐํšŒ๋กœ ์ด๋™ ๋ฉ๋‹ˆ๋‹ค.");
                this.goList();
            });
        }, // getView() ๋

        doRegist() {
            console.log("๊ธ€ ๋“ฑ๋ก(doRegist\(\)) Method๊ฐ€ ๋™์ž‘ํ•˜์˜€์Šต๋‹ˆ๋‹ค! DevInquryRegist.vue์˜ Member ๋ณ€์ˆ˜ inqurySj ๊ฐ’ : " + this.devInquryData.inqrySj);
            // ํ•„์ˆ˜ ์ž…๋ ฅ ํ•ญ๋ชฉ ๊ฒ€์‚ฌ๋ฅผ ์œ„ํ•œ Validation ๋ถ„๊ธฐ์ ˆ (์ œ๋ชฉ)
            if(this.devInquryData.inqrySj === undefined || this.devInquryData.inqrySj === '') {
                this.validationPopupShow = true;
                this.$ref.inqrySj.focus();

                return false;
            }   // if(this.devInquryData.inqurySj == undefined || this.devInquryData.inqurySj == '') ๋

            // ํ•„์ˆ˜ ์ž…๋ ฅ ํ•ญ๋ชฉ ๊ฒ€์‚ฌ๋ฅผ ์œ„ํ•œ Validation ๋ถ„๊ธฐ์ ˆ (๋‚ด์šฉ)
            if(this.devInquryData.inqryCn == undefined || this.devInquryData.inqryCn == '') {
                this.validationPopupShow = true;
                this.$ref.inquryCn.focus();

                return false;
            } // if(this.devInquryData.inqryCn == undefined || this.devInquryData.inqryCn == '' ๋

            // ๊ธ€ ๋“ฑ๋ก์„ ์œ„ํ•ด API๋ฅผ ํ˜ธ์ถœํ•ด์„œ Backend์— ๋‚ด์šฉ ์ „๋‹ฌ
            devInquryRegist(this.devInquryData).then(response => {
                console.log("๊ธ€ ๋“ฑ๋ก์„ ์œ„ํ•ด Back End์—๊ฒŒ ๋‚ด์šฉ์„ ์š”์ฒญํ•˜๊ณ , ์‘๋‹ต ๋ฐ›์€ ๊ฐ’ : " + response.data);
                alert("๊ฒŒ์‹œ๊ธ€ " + (this.isNew === true ? "๋“ฑ๋ก" : "์ˆ˜์ •") + "์ด ์™„๋ฃŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค!");

                // ์ž‘์„ฑ๋œ ๊ฒŒ์‹œ๊ธ€ ์ƒ์„ธ ์กฐํšŒ๋กœ ์ด๋™ ์‹œํ‚ค๊ธฐ ์œ„ํ•ด ํ•ด๋‹น Method ํ˜ธ์ถœ
                this.goDetailView(response.data.resultSn);
            }).catch(error => {
                console.log("๊ธ€ ๋“ฑ๋ก์„ ์ฒ˜๋ฆฌํ•˜๋Š” ์ค‘์— ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜์—ฌ catch๋ฌธ์ด ๋™์ž‘ ํ•˜์˜€์Šต๋‹ˆ๋‹ค!");
                alert("๊ฒŒ์‹œ๊ธ€ " + (this.isNew === true ? "๋“ฑ๋ก์„" : "์ˆ˜์ •์„" + " ์‹คํŒจํ•˜์˜€์Šต๋‹ˆ๋‹ค! \r\n ๊ด€๋ฆฌ์ž์—๊ฒŒ ๋ฌธ์˜ ๋ฐ”๋ž๋‹ˆ๋‹ค!"));

                // ๋ชฉ๋ก ์กฐํšŒ๋กœ ์ด๋™ ์‹œํ‚ค๊ธฐ ์œ„ํ•ด ํ•ด๋‹น Method ํ˜ธ์ถœ
                this.goList();
            });
        }, //doRegist() ๋

        doFileChange(e) {},
    }, // methods ๋
}   // export default ๋
</script>

 

 

    ๐Ÿ”ฝ  Code ๋ถ„์„ - ๋“ฑ๋ก

 

๊ธ€ ๋“ฑ๋ก๊ณผ ์ˆ˜์ •์€ ํ•œ Component์—์„œ ๋ชจ๋‘ ์ฒ˜๋ฆฌ๋ฅผ ํ•˜๊ณ  ์žˆ๋Š” ๊ฒƒ์ด์—์š”.
๊ทธ๋ ‡๊ธฐ ๋•Œ๋ฌธ์— ์ด ๊ณณ์— ๋“ฑ๋ก๊ณผ ์ˆ˜์ •์„ ๋ชจ๋‘ ๋ถ„์„ํ•ด์„œ ์ •๋ฆฌ ํ•ด ๋ณด๋„๋ก ํ•  ๊ฒƒ์ด์—์š”.

 

 

DevInquryRegist.vue - 23 ~ 32๋ฒˆ์งธ ์ค„

 

๋จผ์ € ๋น„๋ฐ€๊ธ€์„ Checkํ•˜์—ฌ ๋น„๋ฐ€๊ธ€์ธ์ง€ ์•„๋‹Œ์ง€๋ฅผ ์ •ํ•ด์ค„ ์ˆ˜ ์žˆ๋Š” ๋ถ€๋ถ„์ธ ๊ฒƒ์ด์—์š”.

์‚ฌ์‹ค ์ฃผ๋‹ˆํ•˜๋ž‘์€ ์ด ๋ถ€๋ถ„์—์„œ ๊ฝค๋‚˜ ๊ณ ์ƒ์„ ํ–ˆ๋˜ ๊ฒƒ์ด์—์š”.

๋ฐ”๋กœ ๋น„๋ฐ€๊ธ€ CheckBox์— ๊ธฐ๋ณธ๊ฐ’์ด ์ดˆ๊ธฐํ™” ๋˜์ง€ ์•Š์•„ NPE๊ฐ€ ๋ฐœ์ƒํ•˜๋Š” ๋ฌธ์ œ์ธ ๊ฒƒ์ด์—์š”.
์ด ๋ฌธ์ œ๋Š” '์ด ๊ณณ'์— ์ •๋ฆฌํ•˜์—ฌ ์ค€๋น„ํ•ด ๋‘” ๊ฒƒ์ด์—์š”.

 

27๋ฒˆ์งธ ์ค„์„ ๋ณด๋ฉด `:checked`๋ฅผ ํ†ตํ•ด ๊ธฐ๋ณธ์ ์œผ๋กœ ์–ด๋–ค ๊ฒƒ์ด ์„ ํƒ๋˜๊ฒŒ ํ•  ๊ฒƒ์ธ์ง€ ์„ค์ •์„ ํ•ด ์ค€๊ฒƒ์ด์—์š”.
์œ„์—์„œ ๋ฐœ์ƒํ–ˆ๋‹ค๋Š” ๋ฌธ์ œ๋ฅผ ์‚ดํŽด๋ณด๋ฉด ์‚ฌ์‹ค ์ด ์ค„์€ ์—†์–ด๋„ ๋˜๋Š” ๊ฒƒ์ด์—์š”.

๊ทธ๋Ÿฐ ๋’ค Data Bindding์„ ์œ„ํ•ด v-model ์†์„ฑ์„ ์ด์šฉํ•˜์—ฌ secretAt์— ๊ฐ’์„ Bindding ํ•ด ์ค€ ๊ฒƒ์ด์—์š”.

๊ทธ๋ฆฌ๊ณ , ํ•˜๋„ Error๊ฐ€ ๋‚˜์„œ HTML ์†์„ฑ value๋ฅผ ํ†ตํ•ด `false`๋ฅผ ๋„ฃ์–ด์คฌ๋Š”๋ฐ, ์‚ฌ์‹ค ์ด ๋ถ€๋ถ„๋„ ์ง€์›Œ๋„ ์ƒ๊ด€ ์—†๋Š” ๋ถ€๋ถ„์ธ ๊ฒƒ์ด์—์š”.

 

<tbody>
    <tr>
        <td class="PalignL">์ œ๋ชฉ
            <span class="t_red">*</span>
        </td>

        <td class="PalignL">
            <input id="" type="text" class="w100p" placeholder="์ œ๋ชฉ์„ ์ž…๋ ฅ ํ•ด ์ฃผ์„ธ์š”!" v-model="devInquryData.inqrySj" ref="inqrySj">
        </td>
    </tr>

    <tr>
        <td class="PalignL">๋‚ด์šฉ
            <span class="t_red">*</span>
        </td>

        <td class="PalignL">
            <textarea class="w100p" rows="15" placeholder="๋‚ด์šฉ์„ ์ž…๋ ฅ ํ•ด ์ฃผ์„ธ์š”!" v-model="devInquryData.inqryCn" ref="inqryCn"></textarea>
        </td>
    </tr>

    <tr>
        <td class="PalignL">์ฒจ๋ถ€ ํŒŒ์ผ</td>

        <td class="PalignL">
            <template v-if="devInquryData.isNew === 'C'">
                <input type="file" name="" @change="doFileChange">
            </template>

            <template v-else>
                <input type="file" name="" @change="doFileChange">

                <a href="#" class="attatch_file ml-10">{{ devInquryData.fileNm }}</a>

                <button type="button" class="btnFileDel" :hidden="isNew">์‚ญ์ œ</button>
            </template>
        </td>
    </tr>
</tbody>
๋ฐ˜์‘ํ˜•

 

์‹ค์ œ๋กœ ๊ธ€ ๋“ฑ๋ก / ์ˆ˜์ •์— ๋Œ€ํ•œ Data๋ฅผ ์ž…๋ ฅ ๋ฐ›๊ณ , ์ „๋‹ฌํ•˜๋Š” ๋ถ€๋ถ„์ด ๋ชจ๋‘ ์ด ๊ณณ์— ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์ด ๊ณณ์„ ๋ถ„์„ํ•ด ๋ณด๋ ค๋Š” ๊ฒƒ์ด์—์š”.

์ œ๋ชฉ์„ ์ž…๋ ฅ ๋ฐ›๋Š” ๊ณณ์„ ๋ณด๋ฉด Data๋ฅผ Bindding ํ•ด ์ฃผ๋Š”๋ฐ, devInquryData์•ˆ์— ๊ฒŒ์‹œ๊ธ€ ์ œ๋ชฉ(inqurySj)๋กœ Bindding์„ ํ•ด ์ฃผ๋Š” ๊ฒƒ์ด์—์š”. ๊ทธ๋ ‡๊ฒŒ ๋˜๋ฉด 

 

DevInquryRegist.vue - 140 ~ 148๋ฒˆ์งธ ์ค„

 

์ด ๊ณณ 146๋ฒˆ์งธ ์ค„ devInquryData ๊ฐ์ฒด(Object)์— inqurySj๋ผ๋Š” ๊ฐ์ฒด ์ด๋ฆ„๊ณผ ํ•จ๊ป˜ ์ œ๋ชฉ์—์„œ ์ž…๋ ฅ ๋ฐ›์€ ๊ฐ’์ด ๋“ค์–ด๊ฐ€๊ฒŒ ๋  ๊ฒƒ์ด์—์š”.

๊ทธ ๋‹ค์Œ ์ œ๋ชฉ ๋ฐ›๋Š” ๋ถ€๋ถ„์— `ref=inqrySj`๋ผ๋Š” ๋ถ€๋ถ„์ด ์žˆ๋Š”๋ฐ, ์ด๊ฒƒ์€ Templat refs๋ผ๊ณ  ๋ถˆ๋ฆฌ๋Š” ๊ฒƒ์ด์—์š”.

 

 

์œ„์™€ ๊ฐ™์ด 198๋ฒˆ์งธ ์ค„์„ ์ž‘์„ฑํ•ด ์ฃผ๋ฉด doRegist()๊ฐ€ ํ˜ธ์ถœ์ด ๋˜๊ณ , ์ œ๋ชฉ์ด ์—†์„ ๋•Œ ํ•ด๋‹น ์ œ๋ชฉ์ด ๋น„์—ˆ๋‹ค๋Š” ๊ฒƒ์„ ํ‘œ์‹œํ•˜๊ธฐ ์œ„ํ•ด focus()๋ฅผ ํ˜ธ์ถœํ•˜๊ธฐ ์œ„ํ•ด ์ด์šฉํ•˜๋Š” ๊ฒƒ์ด์—์š”.

 

๋‚ด์šฉ๋„ ์œ„์™€ ๊ฐ™์€ Logic์œผ๋กœ ๋งŒ๋“ค์–ด ์ค€ ๊ฒƒ์ด์—์š”.

 

DevInquryRegist.vue - 64 ~ 77๋ฒˆ์งธ ์ค„

 

์ด๋ฒˆ์—๋Š” ์ฒจ๋ถ€ ํŒŒ์ผ์— ๋Œ€ํ•ด ์•Œ์•„ ๋ณผ ๊ฒƒ์ด์—์š”.

์ตœ์ดˆ 67๋ฒˆ์งธ ์ค„์„ ๋ณด๋ฉด v-if์„ ํ†ตํ•ด isNew๋ผ๋Š” ๊ฐ์ฒด ๊ฐ’์ด 'C'์ธ์ง€๋ฅผ ํ™•์ธํ•˜๋Š” ๊ฒƒ์ด์—์š”. ์ด ๊ฐ’์ด 'C'์ด๋ฉด ๋“ฑ๋ก Logic์„ ์ˆ˜ํ–‰ํ•˜๊ณ , 'U'์ด๋ฉด ์ˆ˜์ • Logic์„ ์ฒ˜๋ฆฌํ•˜๊ฒŒ ํ•˜๊ธฐ ์œ„ํ•ด ๊ทธ๋ ‡๋‹ต๋‹ˆ๋‹ค.

๋“ฑ๋ก Logic ์ˆ˜ํ–‰์ด ๋งž๋‹ค๋ฉด 68๋ฒˆ์งธ ์ค„์ด ์ˆ˜ํ–‰ ๋˜๋Š”๋ฐ, <input> Tag๋กœ ์†์„ฑ file์„ ๋„ฃ์–ด File์„ Uploadํ•  ์ˆ˜ ์žˆ๋Š” ํ™˜๊ฒฝ์„ ๋งŒ๋“ค๊ณ , Event๊ฐ€ ๋ฐœ์ƒํ•˜๊ฒŒ ๋˜๋ฉด doFileChange๋ผ๋Š” Method๋ฅผ ํ˜ธ์ถœํ•˜๊ฒŒ ๋˜๋Š” ๊ฒƒ์ด์—์š”. ๊ฒฐ๊ตญ ์ด์šฉ์ž๊ฐ€ ์–ด๋–ค File์„ ์„ ํƒํ•˜๊ฒŒ ๋˜๋ฉด ํ•ด๋‹น Method๊ฐ€ ํ˜ธ์ถœ๋˜๋Š” ๊ฒƒ์ด์—์š”.

 

 

์ด ๋ถ€๋ถ„์€ ์•„์ง ๊ตฌํ˜„์ด ์•ˆ ๋˜์—ˆ๊ธฐ ๋•Œ๋ฌธ์— ๊ตฌํ˜„์ด ์™„๋ฃŒ๋˜๋ฉด ๋‹ค์‹œ ์ˆ˜์ • ํ•˜๋„๋ก ํ•  ๊ฒƒ์ด์—์š”.

 

๋‹ค์‹œ ๋Œ์•„์˜ค๋ฉด 71๋ฒˆ์งธ ์ค„์—๋Š” isNew๊ฐ€ 'C'๊ฐ€ ์•„๋‹ˆ๋ผ๋ฉด?์„ ์ฒ˜๋ฆฌํ•˜๋Š”๋ฐ, ์ด๋Š” ์ˆ˜์ •์ด ๋  ๊ฒƒ์ด๊ณ , ๊ฐ™์€ Logic์„ ์ฒ˜๋ฆฌํ•˜๋Š” ๊ฒƒ์ด์—์š”.

๊ทธ๋ฆฌ๊ณ , 74๋ฒˆ์งธ ์ค„์ฒ˜๋Ÿผ ํŒŒ์ผ ์ด๋ฆ„(fileNm)์„ ์ถœ๋ ฅํ•˜๊ฒŒ ํ•ด ๋‘” ๊ฒƒ์ด์—์š”.

 

๊ทธ๋Ÿฐ๋ฐ, ์—…๋กœ๋“œํ•œ ํŒŒ์ผ์„ ์ทจ์†Œํ•˜๊ณ  ์‹ถ์„ ์ˆ˜๋„ ์žˆ๋Š” ๊ฒƒ์ด์—์š”. ์ด๋ฅผ ์œ„ํ•ด 76๋ฒˆ์งธ ์ค„์— button์„ ๋งŒ๋“ค์–ด ์ค€ ๊ฒƒ์ด๊ณ , isNew๋ฅผ ์ด์šฉ์ž์—๊ฒŒ ๋ณด์ด์ง€ ์•Š๊ฒŒ ์ฒ˜๋ฆฌ ํ•ด ๋ฒ„๋ฆฌ๋Š” ๊ฒƒ์ด์—์š”. :hidden์€ HTML์—์„œ `type=hidden`๊ณผ ๊ฐ™์€ ์†์„ฑ์ด๊ณ , ์ˆจ๊ฒจ์ง„ ์ž…๋ ฅ ํ•„๋“œ๋Š” Rendering์ด ๋๋‚œ ์›น ํŽ˜์ด์ง€์—์„œ๋Š” ์ „ํ˜€ ๋ณด์ด์ง€ ์•Š์œผ๋ฉฐ, ํŽ˜์ด์ง€ ์ฝ˜ํ…์ธ  ๋‚ด์—์„œ ๊ทธ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ๊ฒŒ ๋งŒ๋‹ค๋Š” ๋ฐฉ๋ฒ•๋„ ์—†๊ฒŒ ๋งŒ๋“ค์–ด ๋ฒ„๋ฆฌ๋Š” ๊ฒƒ์ด์—์š”.

 

 

 

์ด ๋ฒˆ์—๋Š” ์ด Button์— ๋Œ€ํ•ด ์•Œ์•„ ๋ณผ ๊ฒƒ์ด์—์š”.

 

DevInquryRegist.vue - 84 ~ 88๋ฒˆ์งธ ์ค„

 

85๋ฒˆ์งธ ์ค„์„ ๋ณด๋ฉด Click Event๊ฐ€ ๋ฐœ์ƒํ–ˆ์„ ๋•Œ, doRegist()๊ฐ€ ํ˜ธ์ถœ ๋˜๋Š” ๊ฒƒ์ด์—์š”.

DevInquryRegist.vue - doRegist()

 

์ด Method๊ฐ€ ํ˜ธ์ถœ๋˜๋ฉด ํ•ด๋‹น Method๊ฐ€ ๋™์ž‘ํ–ˆ๋‹ค๋Š” ๊ฒƒ์„ ์•Œ๋ ค์ฃผ๊ธฐ ์œ„ํ•œ console ์ถœ๋ ฅ์ด ๋ฐœ์ƒํ•˜๊ณ , ๊ฒŒ์‹œ๊ธ€ ์ œ๋ชฉ(inqrySj)๊ฐ€ ๋น„์–ด์žˆ๊ฑฐ๋‚˜, null์ธ์ง€๋ฅผ ํŒ๋‹จํ•ด์„œ ๊ทธ๊ฒŒ ๋งž๋‹ค๋ฉด `validationPopupShow`๋ฅผ true ๊ฐ’์œผ๋กœ ๋ฐ”๊ฟ” ์ฃผ๋Š” ๊ฒƒ์ด์—์š”. 

 

 

DevInquryRegist.vue - 114 ~ 122๋ฒˆ์งธ ์ค„

 

`validationPopupShow`๊ฐ€ true๊ฐ€ ๋˜๋ฒ„๋ฆฌ๋ฉด ์œ„์— Popup์ฐฝ์ด ๋œจ๊ฒŒ ๋˜๊ณ , 'ํ•„์ˆ˜ ํ•ญ๋ชฉ์€ ๊ผญ ์ž…๋ ฅ ํ•ด ์ฃผ์„ธ์š”!'๋ผ๋Š” Message๋ฅผ ๋‹ด์€ Pop up์ด ๋œจ๊ฒŒ ๋˜๋Š” ๊ฒƒ์ด์—์š”.

 

 

DevInquryRegist.vue - 125 ~ 127๋ฒˆ์งธ ์ค„

 

ํ•ด๋‹น Popup ์ฐฝ์—๋Š” ๋‘ ๊ฐœ์˜ Button์ด ์žˆ๋Š”๋ฐ, ํ•˜๋‚˜๋Š” `ํ™•์ธ`๊ณผ ๋˜ ๋‹ค๋ฅธ ํ•˜๋‚˜๋Š”`๋‹ซ๊ธฐ`์ธ ๊ฒƒ์ด์—์š”. ๋‘ Button์€ ๊ธฐ๋Šฅ์ด ๋˜‘๊ฐ™์€๋ฐ, Click Event๊ฐ€ ๋ฐœ์ƒ๋˜๋ฉด `validationPopupShow` ๋ณ€์ˆ˜์— ๊ฐ’์„ `false`๋กœ ๋ฐ”๊ฟ” ํ•ด๋‹น Popup ์ฐฝ์ด ์—†์–ด์ง€๋Š” ํšจ๊ณผ๋ฅผ ๋งŒ๋“ค์–ด ์ฃผ๋Š” ๊ฒƒ์ด์—์š”.

 

 

 

 

 

    ๐Ÿ”ฝ  Code ๋ถ„์„ - ์ˆ˜์ •

๋จผ์ € '๊ธ€ ์ˆ˜์ •'์€ ์ƒ์„ธ ๋ณด๊ธฐ Page์—์„œ ๊ฐ€๋Šฅํ•œ ๊ฒƒ์ด์—์š”.

 

์œ„์™€ ๊ฐ™์ด '์ƒ์„ธ ๋ณด๊ธฐ' Page์—์„œ `์ˆ˜์ •` Button์„ Clickํ•˜๋ฉด '์ˆ˜์ •'ํ•  ์ˆ˜ ์žˆ๋Š” Page๋กœ ์žˆ๋Š”๋ฐ, '๊ธ€ ๋“ฑ๋ก'๊ณผ ๋™์ผํ•œ Component๊ฐ€ Rendering๋˜์–ด '์ˆ˜์ •' Logic์„ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด ์ฃผ์—ˆ๋‹ต๋‹ˆ๋‹ค!

 

DevInquryDetailView.vue - 115 ~ 117

 

์œ„์™€ ๊ฐ™์ด DetailView Component์˜ Button์ด ์„ ์–ธ ๋˜์–ด ์žˆ๋Š” ๊ฒƒ์ด์—์š”.

์ € Button์€ ๋‹ต๊ธ€์ด ์—†์–ด์•ผ์ง€ ๋ณด์—ฌ์ง€๊ฒŒ ๋˜๋Š”๋ฐ, ๊ทธ ์ด์œ ๋Š” 115๋ฒˆ์งธ ์ค„์—์„œ template Tag์•ˆ์— v-if๋ฅผ ํ†ตํ•ด ๋‹ต๋ณ€ ์—ฌ๋ถ€(answerAt)์ด 'Y'๊ฐ€ ์•„๋‹ˆ๋ผ๋ฉด ์ฆ‰, 'N'์ด๋ผ๋ฉด Rendering ํ•ด๋ผ! ๋ผ๊ณ  ํ•ด์ค€ ๊ฒƒ์ด์—์š”.

๊ทธ๋ฆฌ๊ณ , <a> Tag๋ฅผ ํด๋ฆญํ•˜๊ฒŒ ๋˜๋ฉด Click Event๋กœ ์ธํ•ด `goRegist()`๊ฐ€ ํ˜ธ์ถœ๋˜๋Š”๋ฐ, ์ด ๋•Œ, ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ๊ฒŒ์‹œ๊ธ€ ์ผ๋ จ๋ฒˆํ˜ธ(inqrySn)์„ ๊ฐ€์ง€๊ณ  ๊ฐ€๋Š” ๊ฒƒ์ด์—์š”.

 

DevInquryList.vue - 210 ~ 271

 

์œ„์—๋Š” '๊ธ€ ๋“ฑ๋ก' Logic์„ ์ฒ˜๋ฆฌํ•˜๊ธฐ ์œ„ํ•œ Method์ธ๋ฐ, ๋งค๊ฐœ ๋ณ€์ˆ˜๊ฐ€ ์—†๋Š” ํ˜•ํƒœ๋กœ ํ˜ธ์ถœ์ด ๋˜๊ฒŒ ์ƒ์„ฑ์ด ๋˜์–ด ์žˆ๊ณ , ํ•ด๋‹น Method๊ฐ€ ํ˜ธ์ถœ์ด ๋˜๋ฉด DevInquryRegist Component๋ฅผ Re Renderingํ•˜๊ฒŒ ๋˜์–ด ์žˆ๋Š”๋ฐ, query๋ฅผ ์ด์šฉํ•˜์—ฌ status๋ฅผ 'C'๋กœ ์ฃผ์–ด '๋“ฑ๋ก'์ด๋ผ๋Š” Logic์ด ์ฒ˜๋ฆฌ๋˜๊ฒŒ ํ•ด ์ฃผ๋Š” ๊ฒƒ์ด์—์š”.
 

 

 

DevInquryDetailView.vue - 200 ~ 208

 

์ด๋ฒˆ์—๋Š” '์ˆ˜์ •' Logic์„ ์ˆ˜ํ–‰ํ•˜๊ธฐ ์œ„ํ•œ `goRegist` Method ์—์š”. '์ˆ˜์ •'์ด๋ผ๋Š” Logic์€ ์–ด๋–ค ๊ฒŒ์‹œ๊ธ€ ์ƒ์„ธ ๋ณด๊ธฐ์—์„œ ์ด๋ค„์ ธ์•ผ ํ•˜๋Š” ๊ฒƒ์ด์—์š”. ๊ทธ๋ ‡๊ธฐ ๋•Œ๋ฌธ์— ์ด ์นœ๊ตฌ๋Š” ๋งค๊ฐœ๋ณ€์ˆ˜๊ฐ€ ๋“ค์–ด์™€์•ผ ๋™์ž‘์„ํ•˜๊ณ , ๊ทธ ๋งค๊ฐœ๋ณ€์ˆ˜๋Š” ๊ฒŒ์‹œ๊ธ€ ์ผ๋ จ๋ฒˆํ˜ธ์ธ ๊ฒƒ์ด์—์š”.

์ด ์นœ๊ตฌ๊ฐ€ ํ˜ธ์ถœ๋˜๊ฒŒ ๋˜๋ฉด ๋จผ์ € Router๋ฅผ ํ†ตํ•ด DevInquryRegist Component๋ฅผ Re Renderingํ•˜๊ฒŒ ๋˜๊ณ , '๋“ฑ๋ก'๊ณผ๋Š” ๋‹ค๋ฅด๊ฒŒ status์— ๊ฐ’์„ 'U'๋กœ ์ฃผ์–ด ๊ธ€ ์ˆ˜์ • Logic์ด ์ˆ˜ํ–‰๋˜๋„๋ก ๋งŒ๋“ค์–ด ์ค€ ๊ฒƒ์ด์—์š”.

๊ทธ๋Ÿผ ๊ธ€ ๋“ฑ๋ก๊ณผ ๋™์ผํ•œ Component๊ฐ€ Renderinge ๋˜๋Š” ๊ฒƒ์ธ๋ฐ, ์–ด๋–ป๊ฒŒ ๊ธฐ์กด์— ์ž…๋ ฅ๋˜์–ด ์žˆ๋˜ ๋‚ด์šฉ์„ ๊ฐ€์ ธ์˜ค๋ฉด์„œ '์ˆ˜์ •'์ด๋ผ๋Š” Action์„ ์ทจํ•˜๊ฒŒ ํ•ด ์ฃผ๋Š” ๊ฒƒ์ผ๊นŒ์š”? ๐Ÿค”

์ •๋‹ต์€ ๋ฐ”๋กœ ์•„๋ž˜ ๊ทธ๋ฆผ์— ์žˆ๋Š” ๊ฒƒ์ด์—์š”.

 

DevInquryRegist.vue - created()

 

์—ฌ๊ธฐ created()๋ฅผ ๋ณด๊ฒŒ ๋˜๋ฉด ํ•ด๋‹น Component๊ฐ€ Rendering๋  ๋•Œ, ์ด Method๊ฐ€ ๋™์ž‘ํ•˜๊ฒŒ ๋˜๋Š”๋ฐ, ์ตœ์ดˆ router์—์„œ ์ „๋‹ฌ๋œ query๋ผ๋Š” ๊ฐ์ฒด ์•ˆ์— status์˜ ๊ฐ’์„ ํ™•์ธ ํ•˜๋Š” ๊ฒƒ์ด์—์š”.

152๋ฒˆ์งธ ์ค„์— ๋ณด๋ฉด 'C'๊ฐ€ ์•„๋‹ˆ๋ผ๋ฉด? ์ด๋ผ๊ณ  ์ ํ˜€ ์žˆ๊ณ , '์ˆ˜์ •' Logic์„ ์ˆ˜ํ–‰ํ•˜๊ฒŒ ๋˜๋Š”๋ฐ, ์ตœ์ดˆ `isNew`๋ฅผ `false`๋ฅผ ์„ค์ •ํ•˜์—ฌ ์ƒˆ๋กœ ๋งŒ๋“ค์–ด ์ง€๋Š” ๊ฒŒ์‹œ๊ธ€์ด ์•„๋‹ˆ๋ผ๊ณ  ์„ค์ •์„ ํ•ด์ฃผ๊ณ , `isNewText`์—๋Š” ์ž๋ž‘์Šค๋Ÿฐ ์šฐ๋ฆฌ๋‚˜๋ผ ํ•œ๊ธ€๋กœ '์ˆ˜ ์ •'!์„ ๋”ฑ ์ž…๋ ฅ ํ•ด ์ค€ ๊ฒƒ์ด์—์š”.

๊ทธ๋Ÿฐ ๋’ค ๋งˆ์ง€๋ง‰์œผ๋กœ, `getDetailView()`๋ฅผ ํ˜ธ์ถœํ•จ์œผ๋กœ, ๋ณธ๊ฒฉ์ ์œผ๋กœ '์ˆ˜์ •' ์ด๋ผ๋Š” Logic์ด ์ˆ˜ํ–‰๋  ์ˆ˜ ์žˆ๋„๋ก ํ•ด ์ค€ ๊ฒƒ์ด์—์š”.

 

๊ทธ๋Ÿผ `getDetailView()`๋ฅผ ๋งŒ๋‚˜๋Ÿฌ ๊ฐ€๋ด์•ผ ๊ฒ ์–ด์š”! ๐Ÿƒ

 

DevInquryRegist.vue - getDetailView()

 

์ตœ์ดˆ ์ด Method๊ฐ€ ํ˜ธ์ถœ๋˜๋ฉด devInquryDetail์„ ํ˜ธ์ถœํ•˜๋Š”๋ฐ, ์ด Method๋Š” API๋กœ Axios๋ฅผ ํ†ตํ•ด Back End์™€ ํ†ต์‹ ์„ ์œ„ํ•ด ์ •์˜ํ•œ Method์ธ ๊ฒƒ์ด์—์š”. devInquryDetail์„ ํ˜ธ์ถœ ํ•  ๋•Œ, 212๋ฒˆ์งธ ์ค„์„ ๋ณด๋ฉด ๊ฒŒ์‹œ๊ธ€ ์ผ๋ จ๋ฒˆํ˜ธ๋ฅผ ์ƒ์„ธ ์กฐํšŒ ๋•Œ ๊ฐ€์ง€๊ณ  ์žˆ๋˜ ๊ฒƒ์„ ๋„˜๊ฒจ ์ฃผ๋Š” ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ๋Š” ๊ฒƒ์ด์—์š”.

 

devInquryApi.js - devInquryRegist()

 

์ด Method๊ฐ€ ํ˜ธ์ถœ๋˜๋ฉด Axios๋ฅผ ํ†ตํ•ด Back End์—์„œ ์ง€์ •ํ•œ Controller์˜ URI '/api/support/devInqury'๋กœ HTTP Method๋ฅผ 'post'๋กœ ํ•œ ์ƒํƒœ์—์„œ ๋งค๊ฐœ ๋ณ€์ˆ˜๋กœ ๋“ค์–ด์˜จ ๊ฒŒ์‹œ๊ธ€ ๋ฒˆํ˜ธ๋ฅผ ์ „๋‹ฌ ํ•ด ์ฃผ๋Š” ๊ฒƒ์ด์—์š”.

 

    /**
     * ๊ฒŒ์‹œ๊ธ€ ๋“ฑ๋ก / ์ˆ˜์ • ์„œ๋น„์Šค
     * @param devInquryVO - ํšŒ์› ๊ฐ€์ž…์„ ์œ„ํ•œ ์ด์šฉ์ž ์ž…๋ ฅ๊ฐ’์„ ๋‹ด์€ DTO
     * @return Object - ์„œ๋ฒ„ ์ฒ˜๋ฆฌ ์—ฌ๋ถ€์— ํ•ด๋‹นํ•˜๋Š” Status Code ๋ฐ Data ๋ฐ˜ํ™˜์„ ์œ„ํ•œ ๊ฐ์ฒด
     * @see ""
     */

    // TODO - Controller์— ์žˆ๋Š” ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง ServiceImpl๋กœ ์˜ฎ๊ฒจ์•ผ ํ•˜๋ฉฐ, ๋“ฑ๋ก / ์ˆ˜์ • ๋ถ„๋ฆฌ ์ž‘์—… ํ•„์š”

    @ResponseBody @PostMapping("/devInqury")
    public Object devInquryRegist(@RequestBody DevInquryVO devInquryVO, HttpServletRequest request) throws Exception {

        log.info("devInquryRegist(@RequestBody DevInquryVO devInquryVO, HttpServletRequest request)๊ฐ€ ํ˜ธ์ถœ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค!");
        log.info("Client์—์„œ ๋„˜์–ด์˜จ Data Value๋ฅผ ๋จผ์ € ํ™•์ธ ํ•˜๊ธฐ ์œ„ํ•ด ๋ฐฐ์—ด ๋ณ€์ˆ˜์— ๊ฐ’์„ ๋„ฃ๊ฒ ์Šต๋‹ˆ๋‹ค!");

        Field[] fields = devInquryVO.getClass().getDeclaredFields();

        log.info("๋ฐ˜๋ณต๋ฌธ์„ ํ†ตํ•ด ๋ฐฐ์—ด์— ๋“ค์–ด ๊ฐ„ Data๋ฅผ ํ•˜๋‚˜์”ฉ ๊บผ๋‚ด ํ™•์ธ ํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค!");
        for (Field field : fields) {

            /** ์ฐธ๊ณ  ์ž๋ฃŒ
             * @see "https://tyboss.tistory.com/entry/Java-%EC%9E%90%EB%B0%94-%EB%A6%AC%ED%94%8C%EB%A0%89%EC%85%98-reflection-setAccessible"
             */

            log.info("Java ๋ฆฌํ”Œ๋ ‰์…˜ ๊ธฐ๋ฒ• ์ค‘ setAccessible(true) ํ†ตํ•ด Field ๊ฐ์ฒด ์ž๋ฃŒํ˜• Type field์˜ ์ ‘๊ทผ์ œ์–ด ์ง€์‹œ์ž์— ์˜ํ•œ ์ œ์–ด๋ฅผ ๋ณ€๊ฒฝ ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค!");
            field.setAccessible(true);

            System.err.println(field.getName() + " : " + field.get(devInquryVO));

        } // for (Field field : fields) ๋

        Map<String, Object> result = new HashMap<>();

        log.info("devInquryVO ๊ฐ’ : " + devInquryVO.toString());

        try {

            log.info("๋“ฑ๋กํ•  ๊ธ€์ด ๋น„๋ฐ€๊ธ€์ธ์ง€ ํ™•์ธ ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค!");
            if (devInquryVO.getSecretAt().equals("false")) {

                log.info("๋“ฑ๋กํ•  ๊ธ€์ด ๋น„๋ฐ€๊ธ€์ด ์•„๋‹™๋‹ˆ๋‹ค! ๊ณต๊ฐœ๊ธ€๋กœ ๋“ฑ๋ก ํ•ฉ๋‹ˆ๋‹ค!");
                devInquryVO.setSecretAt("N");

            } else {

                log.info("๋“ฑ๋กํ•  ๊ธ€์ด ๋น„๋ฐ€๊ธ€ ์ž…๋‹ˆ๋‹ค! ๋น„๋ฐ€๊ธ€๋กœ ๋“ฑ๋ก ํ•ฉ๋‹ˆ๋‹ค!");
                devInquryVO.setSecretAt("Y");

            } // if (devInquryVO.getSecretAt().equals("false")) - else ๋

            log.info("๋“ฑ๋ก / ์ˆ˜์ • ํŒ๋ณ„์„ ์œ„ํ•ด ๋“ฑ๋ก ์š”์ฒญ์— ๊ฒŒ์‹œ๊ธ€ ์ผ๋ จ๋ฒˆํ˜ธ๊ฐ€ ์žˆ๋Š”์ง€ ํ™•์ธ ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค!");
            // TODO : ๋“ฑ๋ก / ์ˆ˜์ • Logic ๋ถ„๋ฆฌ ํ•„์š”
            if (CustomStringUtil.getString(devInquryVO.getInqrySn()) == "" || devInquryVO.getInqrySn() == 0) {

                log.info("๋“ฑ๋ก ์š”์ฒญ ๊ฒŒ์‹œ๊ธ€ ์ผ๋ จ๋ฒˆํ˜ธ๊ฐ€ ๋น„์–ด์žˆ์Šต๋‹ˆ๋‹ค! ๊ฒŒ์‹œ๊ธ€ ๋“ฑ๋ก์„ ์ˆ˜ํ–‰ ํ•ฉ๋‹ˆ๋‹ค!");
                // TODO - ํšŒ์›๊ฐ€์ž… ๋ฐ ๋กœ๊ทธ์ธ ๋กœ์ง ๊ตฌํ˜„ ๋’ค ์•„๋ž˜ ํ•˜๋“œ์ฝ”๋”ฉ ์ˆ˜์ • ํ•„์š”
                devInquryVO.setInqryUserSn(4);

                log.info("devInquryService.devInquryInsertUpdate(devInquryVO)์„ ํ˜ธ์ถœ ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค!");
                devInquryService.devInquryInsert(devInquryVO);

                log.info("Map result์— ๊ฒŒ์‹œ๊ธ€ ์ผ๋ จ ๋ฒˆํ˜ธ๋ฅผ ๋„ฃ๊ฒ ์Šต๋‹ˆ๋‹ค!");
                result.put("resultSn", devInquryVO.getInqrySn());

            } else {

                log.info("๋“ฑ๋ก ์š”์ฒญ ๊ฒŒ์‹œ๊ธ€ ์ผ๋ จ๋ฒˆํ˜ธ๊ฐ€ ์กด์žฌ ํ•ฉ๋‹ˆ๋‹ค! ๊ฒŒ์‹œ๊ธ€ ์ˆ˜์ •์„ ์ˆ˜ํ–‰ ํ•ฉ๋‹ˆ๋‹ค!");
                log.info("devInquryService.devInquryInsertUpdate(devInquryVO)์„ ํ˜ธ์ถœ ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค!");
                devInquryService.devInquryUpdate(devInquryVO);

                log.info("Map result์— ๊ฒŒ์‹œ๊ธ€ ์ผ๋ จ ๋ฒˆํ˜ธ๋ฅผ ๋„ฃ๊ฒ ์Šต๋‹ˆ๋‹ค!");
                result.put("resultSn", devInquryVO.getInqrySn());

            } // if (CustomStringUtil.getString(devInquryVO.getInqrySn() == "" || devInquryVO.getInqrySn() == 0)) - else ๋

            log.info("Logic์ด ์™„๋ฃŒ ๋˜์—ˆ์œผ๋ฏ€๋กœ, 200 Code๋ฅผ Map result์— ๋„ฃ๊ฒ ์Šต๋‹ˆ๋‹ค!");
            result.put("code", 200);
        } catch (Exception e) {

            log.info("๊ฒŒ์‹œ๊ธ€ ๋“ฑ๋ก / ์ˆ˜์ •์— ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒ(๊ถŒํ•œ ๋ฌธ์ œ)ํ•˜์—ฌ catch๋ฌธ์ด ์‹คํ–‰ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค!");

            e.printStackTrace();

            log.warn(e.getMessage());

            log.info("Logic์ด Error๋กœ 401 Code๋ฅผ Map result์— ๋„ฃ๊ฒ ์Šต๋‹ˆ๋‹ค!");
            result.put("code", 401);

            return result;

        } // try - catch ๋

        return result;

    } // devInquryRegist(@RequestBody DevInquryVO devInquryVO, HttpServletRequest request) ๋

 

๊ทธ๋Ÿผ ์œ„์™€ ๊ฐ™์ด ํ•ด๋‹น Controller์˜ API๊ฐ€ ํ˜ธ์ถœ์ด ๋˜๊ณ , Logic์„ ์ฒ˜๋ฆฌํ•ด ์ฃผ๋Š” ๊ฒƒ์ด๋ž๋‹ˆ๋‹ค.

 

๋‹ค์‹œ `DevInquryRegist.vue - getDetailView()`๋กœ ๋Œ์•„์™€ ๋ณด๋ฉด BackEnd์™€์˜ ํ†ต์‹ ์„ ๋ ๋งˆ์น˜๊ณ , BackEnd๋Š” ๊ฒŒ์‹œ๊ธ€ ์ผ๋ จ๋ฒˆํ˜ธ๋กœ ์กฐํšŒ๋ฅผ ์š”์ฒญํ–ˆ๋˜ ๊ฒŒ์‹œ๊ธ€ ์ •๋ณด๋ฅผ ์ „๋‹ฌ์„ ํ•ด ์ค€๊ฒƒ์ด์—์š”. ๊ทธ ๋‚ด์šฉ์ด 173๋ฒˆ์งธ ์ค„ response์— ๋‹ด๊ธฐ๊ฒŒ ๋˜๊ณ , 176๋ฒˆ์งธ ์ค„์— BackEnd๊ฐ€ ์ „๋‹ฌํ•ด ์ค€ ๊ฒŒ์‹œ๊ธ€์— ๋ชจ๋“  ์ •๋ณด๋ฅผ `devInquryData`๋ผ๋Š” ๊ฐ์ฒด(Object)์— ์ €์žฅ์„ ํ•ด ์ค€ ๊ฒƒ์ด์—์š”.

 

๊ทธ๋Ÿผ ์œ„์— HTML Code๋ฅผ ํ†ตํ•ด ํ•ด๋‹น ๊ฒŒ์‹œ๊ธ€ Data๋“ค์„ ์ด์šฉํ•ด์„œ '์ˆ˜์ •'์— ํ•ด๋‹นํ•˜๋Š” DevInquryRegist Coponent๊ฐ€ Rendering ๋˜๋ฉด์„œ '์ˆ˜์ •'์ด๋ผ๋Š” Logic์„ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ฃผ๋Š” ๊ฒƒ์ด๋ž๋‹ˆ๋‹ค!  

 

๋งŒ์•ฝ ์œ„ ๊ทธ๋ฆผ `DevInquryRegist.vue - getDetailView()`์—์„œ ๋ฌธ์ œ๊ฐ€ ์ƒ๊ฒจ catch ๋ฌธ์œผ๋กœ ์ง„์ž…ํ•˜๊ฒŒ ๋˜๋ฉด ์–ด๋–ป๊ฒŒ ๋ ๊นŒ์š”?

โ€‹DevInquryRegist.vue - getDetailView(), catch ๋ฌธ

์ตœ์ดˆ Console์— ๋ฌธ์ œ ๋‚ด์šฉ์„ ์ถœ๋ ฅํ•˜๊ณ , ๋ชฉ๋ก์— ํ•ด๋‹นํ•˜๋Š” Component๊ฐ€ Re Rendering ๋˜๋„๋ก `goList()`๋ฅผ ํ˜ธ์ถœํ•ด ์ฃผ๋Š” ๊ฒƒ์ด๋ž๋‹ˆ๋‹ค!

 

 

 

 

 

 

 

 

728x90
๋ฐ˜์‘ํ˜•