Files
hubez-admin/frontend/src/modules/custMgt/components/AdminNmPop.vue

222 lines
5.9 KiB
Vue

<template>
<div>
<div class="dimmed modal26" @click="ModalClose();"></div>
<div class="popup-wrap modal26">
<div class="popup modal26">
<div class="pop-head">
<h3 class="pop-tit">관리자명 조회</h3>
</div>
<div class="pop-cont-detail input_box">
<!-- <div class="pop-cont-detail">-->
<label>ID</label>
<div class="input_search">
<input class="search-box" type="text" placeholder="아이디 입력" v-model.trim="madangId" ref="madangId">
<button type="button" class="button grey" @click="searchMadangId()">조회</button>
</div>
</div>
<div class="pop-btn2">
<button class="btn-pcolor">확인</button>
<button class="btn-default" @click="ModalClose();">취소</button>
</div>
</div>
<search-id-popup ref="searchIdPopModal"> </search-id-popup>
<common-modal ref="commmonModal"></common-modal>
</div>
</div>
</template>
<script>
import api from '@/service/api';
import custMgtApi from "../service/custMgtApi.js";
import SearchIdPopup from '../components/SearchIdPopup.vue';
import commonModal from "@/components/modal/commonModal";
export default {
name: "adminNmPop",
data(){
return{
row: {},
authType: [],
insertType:0,
madangId:'',
name:'',
mdn:'',
email:'',
auth:'',
stat: '',
userNm:"",
userPwd1:"",
userPwd2:"",
code:"",
agencyNm:"",
idCheck: false,
props: {},
serviceId: '',
parentDiv: '',
serviceSeq:'',
}
},
components: {
SearchIdPopup,
commonModal,
},
model: {
//prop: 'sendData',
//event: 'event-data'
},
//props: ['sendData'],
created(){
this.setAuthData();
this.formReset();
},
methods : {
// 마당ID 조회
async searchMadangId(){
if(!this.madangId){
this.row.title = '청약고객관리';
this.row.msg1 = '마당ID를 입력해주세요.';
this.$refs.commmonModal.alertModalOpen(this.row);
this.$refs.madangId.focus();
return false;
}
var params = {
"adminId": this.madangId
}
console.log(this.madangId);
try {
const response = await custMgtApi.selectSearchMadangId(params);
const result = response.data;
console.log(result);
if (result != null && result.retCode == "0000") {
this.madangId = result.data.adminId;
this.userNm = result.data.adminNm;
this.code = result.data.adminCd;
this.agencyNm = result.data.agencyNm;
// 마당ID조회 성공 팝업노출
this.searchIdPop();
//console.log(this.userNm);
this.idCheck = true;
//this.$refs._pwd1.focus();
}else if(result.retCode == '1004'){
//alert('마당ID 정보가 없습니다.');
this.searchIdFailPop();
this.idCheck = false;
this.$refs.madangId.focus();
return false;
}else {
//alert('마당ID 조회에 실패하였습니다.');
this.searchIdFailPop();
this.idCheck = false;
this.$refs.madangId.focus();
return false;
}
} catch(err) {
//alert("실패 하였습니다.");
this.searchIdFailPop();
this.idCheck = false;
this.$refs.madangId.focus();
return false;
}
},
searchIdPop(){
//alert('마당ID 조회 성공 팝업이동 ->');
var params = {
"madangId": this.madangId,
"userNm": this.userNm,
"code": this.code,
"agencyNm": this.agencyNm
}
this.$refs.searchIdPopModal.searchIdPop(params);
},
searchIdFailPop(){
//alert('마당ID 조회 실패 팝업이동 ->');
this.$refs.searchIdPopModal.searchIdFailPop();
},
resetRegPop(){
this.formReset();
this.$refs.madangId.focus();
},
async adminIdNmChangeOk(){
// 관리자명 수정 api 호출
var params = {
"adminId": this.madangId,
"adminNm": this.userNm,
"serviceId": this.serviceId
}
console.log(params);
try {
const response = await custMgtApi.updateAdminInfo(params);
const result = response.data;
console.log(result);
if (result != null && result.retCode == "0000") {
console.log('adminNm modal close');
//alert('관리자정보 수정에 성공하였습니다.');
// adminNm modal close
var dimmed = document.getElementsByClassName('modal26');
for(var i = 0; i < dimmed.length; i++){
dimmed[i].style.display = 'none';
}
if(this.parentDiv === 'subsDetail'){
this.$parent.subsDetail(this.serviceId);
} else if(this.parentDiv === 'channelDetail'){
this.$parent.channelDetail(this.serviceSeq);
}
}else {
//alert('관리자정보 수정에 실패하였습니다.');
this.formReset();
this.$refs.madangId.focus();
}
} catch(err) {
//alert("실패 하였습니다.");
this.formReset();
this.$refs.madangId.focus();
}
},
setAuthData() {
// 권한 옵션.
api.commAuth().then(response => {
this.authType = response.data.data.list;
});
},
formReset(){
Object.assign(this.$data, this.$options.data());
},
// 모달 띄우기
ModalOpen(target){
console.log(target);
this.formReset();
var dimmed = document.getElementsByClassName('modal26');
for(var i = 0; i < dimmed.length; i++){
dimmed[i].style.display = 'block';
}
this.serviceId = target.serviceId;
this.serviceSeq = target.serviceSeq;
this.parentDiv = target.parentDiv;
},
// 모달 끄기
ModalClose(){
console.log('adminNm modal close');
var dimmed = document.getElementsByClassName('modal26');
for(var i = 0; i < dimmed.length; i++){
dimmed[i].style.display = 'none';
}
},
}
}
</script>