<template>
    <!-- <div class="user-wrap"> -->
    <div class="content admin-style">
        <div class="page-title mb30">
            <h2  class="page-sub-title">기업회원 관리</h2>
        </div>
        <div class="selectlist-zone mb30">
            <div class="mb25">
                <h3 class="page-sub-title">기업정보</h3>
            </div>
            <div class="border pd30" v-if="entInfo.entNm">
                <div class="mb15">
                    <div class="flex justify-start align-center mb10">
                        <p class="content-title2">{{ entInfo.entNm }}</p>
                        <p class="pl5 pr5">&#183;</p>
                        <p class="detail-text">{{ $hyphenBrno(entInfo.brno) }}</p>
                        <span class="application-success inline-block pd5 ml15">
                            {{ $getCommonCodeValue(requestCode, entInfo.aprvAplySttsCd) }}
                        </span>
                    </div>
                    <div class="line-introduce">
                        <p class="detail-text">{{ entInfo.entIntrdSmryCn }}</p>
                    </div>
                </div>
                <div class="keword-zone flex align-center justify-start mb25" v-if="entKeywordList.length > 0">
                    <div class="mr5 mb5" v-for="(itm, indx) in entKeywordList" :key="indx">
                        <div class="keyword text-ct">{{ itm }}</div>
                    </div>
                </div>
                <div class="keword-zone flex align-center justify-start mb25" v-else>
                    <div class="mr5">
                        <div class="keyword text-ct">없음</div>
                    </div>
                </div>

                <div class="conpany-info pt15 pb15 mb25">
                    <div class="flex justify-start align-center">
                        <div class="gd-12 mb10">
                                <span class="detail-bold mr15">기업 출원 정보</span>
                                <span class="detail-text" v-if="entInfo.entSeNm === 'applPrnmnt'">출원예정사[{{ entInfo.mainApplEntYn === 'Y' ? '주 출원사' : '보조 출원사' }}] </span>
                                <span class="detail-text" v-else-if="entInfo.entSeNm === 'itrst'">단순 관심</span>
                                <span class="detail-text" v-else>기타</span>
                            </div>
                        <div class="gd-12">
                            <span class="detail-bold mr15">주소</span>
                            <span class="detail-text">[{{ entInfo.zip }}]{{ entInfo.entAddr }} {{ entInfo.entDaddr }}</span>
                        </div>
                        <div class="gd-4">
                            <span class="detail-bold mr15">홈페이지</span>
                            <a class="detail-text" :href="normalizeUrl(entInfo.hmpUrl)"
                                target="_blank">{{ entInfo.hmpUrl }}</a>
                        </div>
                        <div class="gd-4">
                            <span class="detail-bold mr15">대표전화</span>
                            <span class="detail-text">{{ hyphenMinus(entInfo.entTelno) }}</span>
                        </div>
                    </div>
                </div>
                <div class="download-zone" v-if="entFileList.length > 0 && pageAuth.fileDwnldAuthrtYn == 'Y'">
                    <div class="company-profile mb25" v-if="entFileList[0]">
                        <div class="mb10">
                            <h4 class="content-title2">사업자증명원 첨부파일</h4>
                        </div>
                        <div class="download-item border flex justify-between align-center pd10">
                            <p class="ellipsis gd-10">{{ entFileList[0].fileNm }}.{{ entFileList[0].extnNm }}</p>
                            <div class="flex align-center justify-end gd-2">
                                <button v-show="entFileList[0].extnNm == 'pdf'" class="icon-btn detail-text" title="미리보기" @click="$openPdfViewrWindwow(entFileList[0].fileId, pageAuth)"> <svg-icon type="mdi" :path="pdfPath"></svg-icon></button>
                            </div>                           
                        </div>
                    </div>
                    <!-- <div class="company-profile mb25"  v-if="entFileList[1]">
                          <div class="mb10">
                              <p class="content-title2">승인신청 서류</p>
                          </div>
                          <div class="flex justify-between align-center pd10 border">
                              <p class="detail-text">{{entFileList[1].fileNm}}.{{entFileList[1].extnNm}}</p>
                              <div @click="openPdfViewr(entFileList[1])" class="cursor">
                                  <span class="mr10 detail-text">파일확인</span>
                                  <button class="icon-btn" ><img src="../../../../resources/img/download.png" alt=""></button>
                              </div>
                          </div>
                      </div> -->
                </div>
                <div class="conpany-info pt15 pb15 mb25" v-if="entInfo.aprvAplySttsCd == 'reject'">
                    <div class="flex justify-start align-center">
                        <div class="gd-12">
                            <span class="detail-bold mr15">반려사유</span>
                            <span class="detail-text">{{ entInfo.rjctCn }}</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="selectlist-zone mb40" v-if="entManager && myInfo.aprv_yn == 'Y'">
            <div class="mb25">
                <h3 class="page-sub-title">기업 관리자</h3>
            </div>
            <div class="border pd30">
                <div class="mb15">
                    <div class="flex justify-start align-center mb10">
                        <p class="content-title2">{{ $name_format_WithMasking(entManager.mbrEncptFlnm) }}
                            <span v-show="entManager.mbrJbgdNm">({{ entManager.mbrJbgdNm }})</span>
                        </p>
                        <p class="pl5 pr5">&#183;</p>
                        <p class="detail-text">{{ $email_format_WithMasking(entManager.lgnId) }} </p>
                    </div>
                </div>
                <div class="conpany-info pt15 pb15 mb25">
                    <div class="flex justify-start align-center">
                        <div class="gd-4">
                            <span class="detail-bold mr15">전화번호</span>
                            <span class="detail-text">{{ $number_format_WithMasking(entManager.mbrEncptTelno) }}</span>
                        </div>
                        <div class="gd-4">
                            <span class="detail-bold mr15">이메일</span>
                            <span class="detail-text">{{ $email_format_WithMasking(entManager.mbrEncptEmad) }}</span>
                        </div>
                    </div>
                </div>
                <div class="download-zone">
                    <div class="company-profile mb25" v-if="myInfo.lgn_id === entManager.lgnId">
                        <div class="mb10">
                            <p class="content-title2">재직증명서 첨부파일</p>
                        </div>
                        <div class="flex justify-between align-center pd10 download-item border">
                            <p class="ellipsis gd-10">{{ entManager.fileNm }}.{{ entManager.extnNm }}</p>
                            <div class="flex align-center justify-end gd-2">
                                <button v-show="entManager.extnNm == 'pdf'" class="icon-btn detail-text" title="미리보기" @click="$openPdfViewrWindwow(entManager.fileId, pageAuth)">  <svg-icon type="mdi" :path="pdfPath"></svg-icon></button>
                            </div>      
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="selectlist-zone mb40" v-if="myInfo.aprv_yn == 'Y'">
            <div class="mb25">
                <h3 class="page-sub-title">기업회원 리스트</h3>
            </div>
            <div class="table-zone">
                <table class="list-table mb10 company-user-table">
                    <colgroup>
                        <col width="5%">
                        <col width="20%">
                        <col width="20%">
                        <col width="20%">
                        <col width="15%">
                        <col width="20%">
                    </colgroup>
                    <thead>
                        <tr>
                            <th>no</th>
                            <th>이름</th>
                            <th>직급</th>
                            <th>이메일</th>
                            <th>권한</th>
                            <th>승인여부</th>
                        </tr>
                    </thead>
                    <tbody v-if="entMemberList.length > 0">
                        <tr class="cursor" v-for="(itm, indx) in entMemberList" :key="indx"
                            @click="userDatailModalOpen(itm)" v-if="pageAuth.mdfcnAuthrtYn == 'Y'">
                            <td class="text-ct">{{ indx + 1 }}</td>
                            <td class="text-ct">{{ $name_format_WithMasking(itm.mbrEncptFlnm) }}</td>
                            <td class="text-ct">{{ itm.mbrJbgdNm }}</td>
                            <td class="text-lf">{{ $email_format_WithMasking(itm.mbrEncptEmad) }}</td>
                            <td class="text-ct" v-if="itm.rprsYn == 'Y'">관리자</td>
                            <td class="text-ct" v-else>기업회원</td>
                            <td class="text-ct" v-if="itm.aprvYn == 'Y'"><span class="sucssece pd10">승인</span></td>
                            <td class="text-ct" v-else><span class="ing pd10">미승인</span></td>
                        </tr>
                        <tr v-for="(itm, indx) in entMemberList" :key="indx" v-if="pageAuth.mdfcnAuthrtYn != 'Y'">
                            <td class="text-ct">{{ indx + 1 }}</td>
                            <td class="text-ct">{{ $name_format_WithMasking(itm.mbrEncptFlnm) }}</td>
                            <td class="text-ct">{{ itm.mbrJbgdNm }}</td>
                            <td class="text-ct">{{ $email_format_WithMasking(itm.mbrEncptEmad) }}</td>
                            <td class="text-ct" v-if="itm.rprsYn == 'Y'">관리자</td>
                            <td class="text-ct" v-else>기업회원</td>
                            <td class="text-ct" v-if="itm.aprvYn == 'Y'">승인</td>
                            <td class="text-ct" v-else>미승인</td>
                        </tr>
                    </tbody>
                    <tbody v-else>
                        <tr>
                            <td class="text-ct data-none" colspan="6">검색된 데이터가 없습니다.</td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <!-- 신청존 -->
        <div class="selectlist-zone mb40" v-else>
            <div class="mb25">
                <p class="page-sub-title">나의 신청정보</p>
            </div>
            <div class="table-zone">
                <table class="list-table  application-info-table">
                    <colgroup>
                        <col width="20%">
                        <col width="20%">
                        <col width="15%">
                        <col width="15%" v-if="myInfo.aprv_aply_stts_cd == 'reject'">
                        <col width="10%">
                        <col width="20%" v-if="myInfo.aprv_aply_stts_cd == 'reject'">
                    </colgroup>
                    <thead>
                        <tr>
                            <th>기업명</th>
                            <th>신청내용</th>
                            <th>신청일자</th>
                            <th v-if="myInfo.aprv_aply_stts_cd == 'reject'">반려일자</th>
                            <th>상태</th>
                            <th v-if="myInfo.aprv_aply_stts_cd == 'reject'">반려내용</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td class="text-ct" v-if="myInfo.aprv_aply_stts_cd == 'request'">{{ myInfo.ent_nm }}</td>
                            <td class="text-ct" v-if="myInfo.aprv_aply_stts_cd == 'reject'">{{ myInfo.last_ent }}</td>
                            <td class="text-ct">{{ myInfo.aply_authrt }} 신청</td>
                            <td class="text-ct">
                                <p v-if="myInfo.aprv_aply_stts_cd == 'request'">{{ $filters.dateTime(myInfo.request_dt)
                                    }}</p>
                                <p v-else>-</p>
                            </td>
                            <td class="text-ct" v-if="myInfo.aprv_aply_stts_cd == 'reject'">
                                <p v-if="myInfo.aprv_aply_stts_cd == 'reject'">{{ $filters.dateTime(myInfo.reject_dt)
                                    }}</p>
                                <p v-else>-</p>
                            </td>
                            <td class="text-ct">
                                <p> {{ $getCommonCodeValue(requestCode, myInfo.aprv_aply_stts_cd) }}</p>
                            </td>
                            <td class="text-ct" v-if="myInfo.aprv_aply_stts_cd == 'reject'">
                                <p v-if="myInfo.aprv_aply_stts_cd == 'reject'">{{ myInfo.rjct_cn }}</p>
                                <p v-else>-</p>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <div class="flex justify-end align-center ">
            <div class="gd-1 pr0" v-if="entInfo.aprvAplySttsCd == 'accept'">
                <button class="large-btn darkg-border-btn"  title="수정"  @click="updateEntInfo()" v-if="myInfo.rprs_yn == 'Y'">기업정보
                    수정</button>
            </div>
            <div class="gd-1 pr0" v-else>
                <button class="large-btn darkg-border-btn"  title="재신청"  @click="updateEntInfo()"
                    v-if="myInfo.rprs_yn == 'Y'">재신청</button>
            </div>
            <div class="gd-1">
                <button class="large-btn red-border-btn ml0"  title="관계해지"  @click="entWithdraw()"
                    v-if="pageAuth.delAuthrtYn == 'Y'">관계해지</button>
            </div>
        </div>
    </div>
    <!-- </div> -->



    <div v-show="userDatailOpen" class="modal-wrapper" v-if="selectEntMember.mbrId" role="dialog" 
    aria-modal="true">
        <div class="modal-container">
            <div class="modal-title">
                <div class="flex justify-between align-center">
                    <h2 class="page-sub-title">기업 일반회원 상세정보</h2>
                    <button class="icon-btn black" @click="userDatailModalClose"  title="닫기" >
                        <svg-icon type="mdi" :path="closePath"></svg-icon>
                    </button>
                </div>
            </div>
            <div class="modal-content-monthly">
                <div class="form-table-style">
                    <table class="form-table">
                        <colgroup>
                            <col width="50%" />
                            <col width="50%" />
                        </colgroup>
                        <tbody>
                            <tr>
                                <td class="text-lf">
                                    <div class="gd-12 pl0 pr0">
                                        <label for="" class="form-title mb16">아이디</label>
                                        <input type="text" class="full-input" :value="$email_format_WithMasking(selectEntMember.lgnId)" disabled />
                                    </div>
                                </td>
                                <!-- <td class="text-lf">
                                  <div class="gd-12 pr0">
                                      <label for="" class="form-title mb16">비밀번호</label>
                                      <div class="gd-6 pl0 pr0">
                                          <button class="large-btn blue-border-btn">비밀번호 초기화</button>
                                      </div>
                                  </div>
                              </td> -->
                            </tr>
                            <tr>
                                <td class="text-lf">
                                    <div class="gd-12 pl0 pr0">
                                        <label for="" class="form-title mb16">이름</label>
                                        <input type="text" class="full-input" :value="$name_format_WithMasking(selectEntMember.mbrEncptFlnm)"
                                            disabled />
                                    </div>
                                </td>
                                <td class="text-lf">
                                    <div class="gd-12 pr0">
                                        <p class="form-title mb16">직위(직급)</p>
                                        <input type="text" class="full-input" :value="selectEntMember.mbrJbgdNm"
                                            disabled />
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" class="text-lf">
                                    <div class="gd-12 pl0 pr0">
                                        <label for="" class="form-title mb16">전화번호</label>
                                        <div class="flex justify-start no-gutters">
                                            <div class="gd-3 pl0 pr0">
                                                <input type="text" class="full-input"
                                                    :value="number_format(selectEntMember.mbrEncptTelno, 0)" disabled />
                                            </div>
                                            <div class="pd10">-</div>
                                            <div class="gd-3 pl0 pr0">
                                                <input type="text" class="full-input" :value="'****'" disabled />
                                            </div>
                                            <div class="pd10">-</div>
                                            <div class="gd-3 pl0 pr0">
                                                <input type="text" class="full-input"
                                                    :value="number_format(selectEntMember.mbrEncptTelno, 2)" disabled />
                                            </div>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td class="text-lf">
                                    <div class="gd-12 pl0 pr0">
                                        <label for="" class="form-title mb16">이메일</label>
                                        <!-- <div class="flex justify-start no-gutters"> -->
                                        <div class="gd12 pl0 pr0">
                                            <input type="text" class="full-input"
                                                :value="$email_format_WithMasking(selectEntMember.mbrEncptEmad)"
                                                disabled />
                                        </div>
                                        <!-- <div class="pd10">@</div> -->
                                        <!-- <div class="gd-3 pl0 pr0">
                                              <input type="text" class="full-input" :value="mail_format(selectEntMember.mbrEncptEmad,1)" disabled />
                                          </div> -->
                                        <!-- </div> -->
                                    </div>
                                </td>
                            </tr>
                            <tr v-if="selectEntMember.aprvYn == 'N'">
                                <td class="text-lf" colspan="2">
                                    <div class="gd-12 pl0 pr0">
                                        <label for="" class="form-title mb16">반려 사유</label>
                                        <input type="text" class="full-input"
                                            v-model="selectEntMember.entMbrHsty.rjctCn" />
                                    </div>
                                </td>
                            </tr>
                            <!-- <tr>
                              <td colspan="3" class="text-lf">
                                  <div class="gd-12 pl0 pr0">
                                      <label for="" class="form-title mb16">재직증명서 첨부파일</label>
                                      <div class="flex justify-between align-center pd10 border">
                                          <p class="detail-text">{{selectEntMember.fileNm }}.{{selectEntMember.extnNm }}</p>
                                          <div @click="openPdfViewr(selectEntMember)" class="cursor">
                                              <span class="mr10 detail-text">파일확인</span>
                                              <button class="icon-btn" >
                                                  <img src="../../../../resources/img/download.png" alt=""></button>
                                          </div>
                                      </div>
                                  </div>
                              </td>
                          </tr> -->
                        </tbody>
                    </table>

                </div>
            </div>
            <div class="modal-end flex justify-end align-center">
                <div class="gd-2 pl0" v-if="selectEntMember.aprvYn == 'N'">
                    <button class="large-btn red-btn ml0"  title="반려"  @click="userReject(selectEntMember)"
                        v-if="myInfo.rprs_yn == 'Y'">반려</button>
                </div>
                <div class="gd-2 pl0" v-if="selectEntMember.aprvYn == 'N'">
                    <button class="large-btn blue-btn ml0"  title="승인"  @click="userAccept(selectEntMember)"
                        v-if="myInfo.rprs_yn == 'Y'">승인</button>
                </div>
                <!-- <div class="gd-2 pl0"  v-if="selectEntMember.aprvYn == 'Y'">
                  <button class="large-btn blue-btn ml0" @click="entMemberRoleManager(selectEntMember)" v-if="selectEntMember.rprsYn = 'N' && pageAuth.mdfcnAuthrtYn == 'Y'" >관리자 지정</button>
              </div> -->
                <div class="gd-2 pl0" v-if="selectEntMember.aprvYn == 'Y'">
                    <button class="large-btn red-border-btn ml0"  title="관계해지"  @click="entWithdrawUser(selectEntMember)"
                        v-if="myInfo.rprs_yn == 'Y'">관계해지</button>
                </div>
                <div class="gd-2 pl0 pr0">
                    <button @click="userDatailModalClose"  title="닫기"  class="large-btn darkg-border-btn ml0">닫기</button>
                </div>
            </div>
        </div>
    </div>
</template>

<script>

import PageNavigationBar from '../../../component/pagenavigationbar/PageNavigationBar.vue';
import { useRoute } from 'vue-router';
import axios from "axios";
import { useStore } from "vuex";
import _ from "lodash";
import COMMON_UTIL from '../../../../resources/js/commonUtil';
import { mdiWindowClose, mdiFileSearchOutline } from '@mdi/js';

// api
import { myEntInfo, entReject, entAccept, entMbrReject, entMbrAccept, entMbrAuthManagerUpdate, entMbrDelete, entInfoDelete } from "../../../../resources/api/entInfo";
import { insertProc } from "../../../../resources/api/prvcInqHstry";
export default {
    data() {
        return {
            // 페이지 권한 객체
            pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth,
            // 신청 공통코드
            requestCode: [],
            pageId: "",
            pdfurl: null,
            mbrId: this.$store.state.mbrId,
            certificateConfirm: false,
            companyReject: false,
            managerReject: false,
            memberReject: false,
            userDatailOpen: false,
            route: useRoute(),
            closePath: mdiWindowClose,
            pdfModal: false,
            pdfPath:mdiFileSearchOutline ,
            // 기업정보 
            entInfo: {},
            // 기업 파일 리스트 
            entFileList: [],
            // 기업 관리자 
            entManager: {},
            // 기업 키워드 리스트
            entKeywordList: [],
            // 기업 멤버 리스트
            entMemberList: [],
            // 일반회원 상세 
            selectEntMember: {},
            // 내정보
            myInfo: {},
        };
    },
    methods: {
        userDatailModalOpen: function (member) {

            this.selectEntMember = _.cloneDeep(member);

            //개인정보 조회이력 등록
            this.prvcInqInsert()

            this.userDatailOpen = true
        },

        //개인정보 조회이력 등록
        async prvcInqInsert(){
            let data = { 'contsId' : 'CONTS_0000000052', 'inqTyNm' : 'read'}
            await insertProc(data); 
        },

        userDatailModalClose: function () {
            this.userDatailOpen = false
            this.certificateConfirm = false;
        },

        // 수정페이지 이동 
        updateEntInfo: function () {
            this.$emit("setPage", 3);
        },
        // 초기정보 호출 
        init: async function () {
            const vm = this;
            // 실행
            try {
                this.$setLoading(true);
                this.requestCode = await this.$getCommonCode('aprvAplySttsCd');
                const response = await myEntInfo();             
                vm.entInfo = response.data.data.entInfo;
                // 기업 파일 리스트 
                vm.entFileList = response.data.data.entFileList;
                // 기업 관리자 
                vm.entManager = response.data.data.entManager;
                // 기업 키워드 리스트
                vm.entKeywordList = response.data.data.entKeywordList;
                // 기업 멤버 리스트
                vm.entMemberList = response.data.data.entMemberList;
                // 내정보 
                vm.myInfo = response.data.data.myInfo;

            } catch (error) {
                console.log(error)
                const errorData = error.response.data;
                if (errorData.message != null && errorData.message != "") {
                    alert(error.response.data.message);
                } else {
                    // alert("에러가 발생했습니다.\n관리자에게 문의해주세요.");
                    alert(vm.$getCmmnMessage('err005'));
                }
            } finally {
                vm.$setLoading(false);
            }
        },
        // 유저 반려 
        userReject: async function (tempuser) {
            let vm = this;
            if (tempuser.entMbrHsty.rjctCn == null || tempuser.entMbrHsty.rjctCn.trim() == '') {
                alert('반려사유를 입력해 주세요.')
                return;
            }
            if (confirm(this.$getCmmnMessage('cnf006'))) {
                try {
                    this.$setLoading(true);
                    const response = await entMbrReject(tempuser);
                    alert(response.data.message)

                    // 기업 관리자 
                    vm.entManager = response.data.data.entManager;
                    // 기업 멤버 리스트
                    vm.entMemberList = response.data.data.entMemberList;
                    vm.userDatailModalClose();

                } catch (error) {
                    console.log(error)
                    const errorData = error.response.data;
                    if (errorData.message != null && errorData.message != "") {
                        alert(error.response.data.message);
                    } else {
                        alert(vm.$getCmmnMessage('err005'));
                    }
                } finally {
                    this.$setLoading(false);
                }
            }
        },
        // 유저 승인
        userAccept: async function (tempuser) {
            let vm = this;

            if (confirm(this.$getCmmnMessage('cnf005'))) {
                try {
                    this.$setLoading(true);
                    const response = await entMbrAccept(tempuser);
                    alert(response.data.message)
                    vm.entManager = response.data.data.entManager;
                    vm.entMemberList = response.data.data.entMemberList;
                    vm.certificateConfirm = false;
                    vm.userDatailModalClose();
                } catch (error) {
                    console.log(error)
                    const errorData = error.response.data;
                    if (errorData.message != null && errorData.message != "") {
                        alert(error.response.data.message);
                    } else {
                        alert(vm.$getCmmnMessage('err005'));
                    }
                } finally {
                    this.$setLoading(false);
                }
            }
        },
        // 사용자 회원 탈퇴
        entWithdrawUser: async function (user) {
            let vm = this;

            const requestData = {
                entId: this.entInfo.entId,
                mbrId: user.mbrId
            }

            if (confirm(this.$getCmmnMessage("cnf021"))) {
                try {
                    this.$setLoading(true);
                    const response = await entMbrDelete(requestData);
                    alert(response.data.message)
                    vm.entManager = response.data.data.entManager;
                    vm.entMemberList = response.data.data.entMemberList;
                    vm.certificateConfirm = false;
                    vm.userDatailModalClose();
                } catch (error) {
                    const errorData = error.response.data;
                    if (errorData.message != null && errorData.message != "") {
                        alert(error.response.data.message);
                    } else {
                        alert(vm.$getCmmnMessage('err005'));
                    }
                }finally {
                    this.$setLoading(false);
                }
            }
        },
        // 기업회원 탈퇴 
        entWithdraw: async function () {
            let vm = this;

            const requestData = {
                entId: this.entInfo.entId,
                mbrId: this.mbrId
            }

            if (confirm(this.$getCmmnMessage("cnf020"))) {
                try {
                    this.$setLoading(true);
                    const response = await entMbrDelete(requestData);
                    alert(response.data.message)
                    vm.$router.push({ path: '/' });
                } catch (error) {
                    const errorData = error.response.data;
                    if (errorData.message != null && errorData.message != "") {
                        alert(error.response.data.message);
                    } else {
                        alert(vm.$getCmmnMessage('err005'));
                    }
                }finally {
                    this.$setLoading(false);
                }
            }
        },
        // 전화번호 처리 
        number_format: function (number, num) {
            if (number != null && number != '') {
                let phone = COMMON_UTIL.getMask(number);
                if (phone.split('-').length > num) {
                    return phone.split('-')[num];
                } else {
                    return "";
                }

            } else {
                return "";
            }
        },
        // 이메일 처리 
        mail_format: function (mail, num) {

            if (mail != null && mail != '') {
                if (mail.split('@').length > num) {
                    return mail.split('@')[num];
                } else {
                    return "";
                }
            } else {
                return "";
            }
        },
        hyphenMinus: function (telno) {
            return COMMON_UTIL.HyphenMinus(telno);
        },
        normalizeUrl(url) {
            // URL에 https://가 포함되어 있는지 확인하고 없으면 추가
            if (!url.startsWith('http://') && !url.startsWith('https://')) {
                url = 'http://' + url;
            }
            return url;
        },
    },
    watch: {

    },
    computed: {

    },
    components: {
        'PageNavigationBar': PageNavigationBar,
    },
    mounted() {
        this.init();
    }
}
</script>

<style scoped>
a {
    color: blue;
    text-decoration: underline;
  }
</style>