<template>
  <div>
    <!-- 관리자ID 조회 -->
    <div class="popup popup_form modal44 popup_inside">
      <div class="pop-head">
        <h3 class="pop-tit">관리자ID 조회</h3>
      </div>
      <div class="pop-cont-detail input_box">
        <label>ID</label>
        <div class="input_search">
          <input class="search-box" type="text" value="" v-model="searchText1" maxlength="100">
          <button type="button" class="button btn-p2color" @click="adminList">조회</button>
        </div>
      </div>
        <table class="table-c">
          <thead>
            <tr>
              <th>ID</th>
              <th>사업자등록번호</th>
            </tr>
            </thead>
            <tbody>
            <tr v-for="(item, idx) in list">
              <td>{{ item.adminId }}</td>
              <td><a href="javascript:void(0)" @click="setAdminInfo(item)">{{ item.bregNo }}</a></td>
            </tr>
          </tbody>
        </table>
      <div class="popup-btn2">
        <button class="btn-default" @click="adminNmPopClose();">닫기</button>
      </div>
    </div>

  </div>
</template>
<script>
import sendNumMgtApi from "@/modules/sendNumMgt/service/sendNumMgtApi";

export default {
  name: "adminNmPop",
  data(){
      return {
        row: {},
        searchText1: '',
        list:[],
      }
  },
  components: {
  },
  props: ['sendData'],
  created(){
  },
  mounted() {

  },
  methods : {
    search: function(isKeep) {


    },
    setAdminInfo: function(props){
      this.$emit('event-data', props)
      this.adminNmPopClose();
    },
    // 모달 띄우기
    adminNmPopOpen(){
      this.formReset();
      var dimmed = document.getElementsByClassName('modal44');
      for(var i = 0; i < dimmed.length; i++){
        dimmed[i].style.display = 'block';
      }
    },
    // 모달 끄기
    adminNmPopClose(){
      var dimmed = document.getElementsByClassName('modal44');
      for(var i = 0; i < dimmed.length; i++){
        dimmed[i].style.display = 'none';
      }
    },

    async adminList(){
      try {
        this.row.searchText1 = this.searchText1
        if(this.row.searchText1 == ''){
          return false;
        }
        const response = await sendNumMgtApi.adminList(this.row);
        const result = response.data;
        if (result != null && result.retCode == "0000") {
          this.list = result.data.list
        }
      } catch (error) { 
        
      }
    },
    formReset(){
      Object.assign(this.$data, this.$options.data());
    },
  }
}
</script>
