친구톡 발송 > 주소록 불러오기 완료
This commit is contained in:
parent
51cf1fe0d9
commit
eb3f3876f1
@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
<script type="text/javascript" src="<c:out value='/js/MJUtill.js' />"></script>
|
<script type="text/javascript" src="<c:out value='/js/MJUtill.js' />"></script>
|
||||||
<script type="text/javascript" src="<c:out value='/js/kakao/ft/ftPriceClclt.js' />"></script>
|
<script type="text/javascript" src="<c:out value='/js/kakao/ft/ftPriceClclt.js' />"></script>
|
||||||
<script type="text/javascript" src="<c:out value='/js/kakao/ft/ftTabulator.js' />"></script>
|
<script type="text/javascript" src="<c:out value='/js/kakao/ft/ftTabulator.js?v=20240328' />"></script>
|
||||||
<script type="text/javascript" src="<c:out value='/js/txtSpecialReplace.js' />"></script>
|
<script type="text/javascript" src="<c:out value='/js/txtSpecialReplace.js' />"></script>
|
||||||
<script type="text/javascript" src="<c:out value='/js/kakao/at/addr.js' />"></script>
|
<script type="text/javascript" src="<c:out value='/js/kakao/ft/addr.js' />"></script>
|
||||||
<script type="text/javascript" src="<c:out value='/js/common/popup.js' />"></script>
|
<script type="text/javascript" src="<c:out value='/js/common/popup.js' />"></script>
|
||||||
<script type="text/javascript" src="<c:out value='/js/kakao/ft/friendstalkExcel.js' />"></script>
|
<script type="text/javascript" src="<c:out value='/js/kakao/ft/friendstalkExcel.js' />"></script>
|
||||||
<!-- 주소록 유효성 체크 공통유틸로 인해 추가 -->
|
<!-- 주소록 유효성 체크 공통유틸로 인해 추가 -->
|
||||||
@ -2112,62 +2112,86 @@ function updateButtons(){
|
|||||||
|
|
||||||
<!-- 주소록 불러오기 -->
|
<!-- 주소록 불러오기 -->
|
||||||
<div class="tooltip-wrap">
|
<div class="tooltip-wrap">
|
||||||
<div class="popup-com import_layer popup06" tabindex="0" data-tooltip-con="popup06" data-focus="popup06" data-focus-prev="popup06-close" style="width: 1000px">
|
<div class="popup-com import_layer popup06 adr_call_popup" tabindex="0"
|
||||||
|
data-tooltip-con="popup06" data-focus="popup06"
|
||||||
|
data-focus-prev="popup06-close" style="width: 1000px">
|
||||||
<div class="popup_heading">
|
<div class="popup_heading">
|
||||||
<p><span>주소록 불러오기</p>
|
<p>
|
||||||
|
<span>주소록 불러오기
|
||||||
|
</p>
|
||||||
<button type="button" onClick="javascript:addrClose(); return false;">
|
<button type="button" onClick="javascript:addrClose(); return false;">
|
||||||
<img src="/publish/images/content/layerPopup_close.png" alt="팝업 닫기"></button>
|
<img src="/publish/images/content/layerPopup_close.png" alt="팝업 닫기">
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="layer_in">
|
<div class="layer_in">
|
||||||
<div class="titBox titBox_pad">
|
<div class="titBox titBox_pad">
|
||||||
<p>- 주소록 수정 및 변경은 <span>[주소록 관리]</span>에서만 가능합니다.</p>
|
<p>
|
||||||
<button type="button" class="adr_admin" onClick="location.href='/web/mjon/addr/selectAddrList.do'">주소록 관리</button>
|
- 주소록 수정 및 변경은 <span>[주소록 관리]</span>에서만 가능합니다.
|
||||||
|
</p>
|
||||||
|
<button type="button" class="adr_admin"
|
||||||
|
onClick="location.href='/web/mjon/addr/selectAddrList.do'">주소록
|
||||||
|
관리</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="adr_wrap">
|
<div class="adr_wrap">
|
||||||
<form id="searchAddrGrpForm" name="searchAddrGrpForm" method="post" style="display: flex; justify-content: space-between;">
|
<form id="searchAddrGrpForm" name="searchAddrGrpForm" method="post"
|
||||||
<input type="hidden" id="searchAddrGrpId" name="searchAddrGrpId" value=""/>
|
style="display: flex; justify-content: space-between;">
|
||||||
<input type="hidden" id="type" name="type" value="all"/>
|
<input type="hidden" id="searchAddrGrpId" name="searchAddrGrpId"
|
||||||
<input type="hidden" id="searchKeyword" name="searchKeyword" value=""/>
|
value="" /> <input type="hidden" id="type" name="type" value="all" />
|
||||||
<input type="hidden" name="searchCondition" id="searchCondition" value="0" />
|
<input type="hidden" id="searchKeyword" name="searchKeyword"
|
||||||
|
value="" /> <input type="hidden" name="searchCondition"
|
||||||
|
id="searchCondition" value="0" />
|
||||||
<div class="adr_pop_left">
|
<div class="adr_pop_left">
|
||||||
<div class="adr_left_search">
|
<div class="adr_left_search">
|
||||||
<label for="searchGrpKeyword" class="label">그룹명 검색</label>
|
<label for="searchKeyword" class="label">그룹명 검색</label> <input
|
||||||
<input type="text" name="searchGrpKeyword" id="searchGrpKeyword" placeholder="그룹명 검색" onfocus="this.placeholder=''" onblur="this.placeholder='그룹명 검색'" class="inputLight">
|
type="text" name="searchGrpKeyword" id="searchGrpKeyword"
|
||||||
<button type="button" onClick="javascrit:fnAddrGrpSearch(); return false;"><img src="/publish/images/popup/search.png" alt="검색"></button>
|
placeholder="그룹명 검색" onfocus="this.placeholder=''"
|
||||||
|
onblur="this.placeholder='그룹명 검색'" class="inputLight">
|
||||||
|
<button type="button"
|
||||||
|
onClick="javascrit:fnAddrGrpSearch(); return false;">
|
||||||
|
<img src="/publish/images/popup/search.png" alt="검색">
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="adr_pop_box">
|
<div class="adr_pop_box">
|
||||||
<div id="addrGroupLoad">
|
<div id="addrGroupLoad"></div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="popup_btn">
|
<!-- <div class="popup_btn">
|
||||||
<button type="button" class="btnType" onClick="javascript:fnSelectAddrGrpList(); return false;">선택 그룹 추가</button>
|
<button type="button" class="btnType" onClick="javascript:fnSelectAddrGrpList(); return false;">선택 그룹 추가</button>
|
||||||
</div> -->
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="adr_pop_right">
|
<div class="adr_pop_right">
|
||||||
<div class="clearfix">
|
<div class="clearfix">
|
||||||
<div class="btnWrap_last">
|
<div class="btnWrap_last">
|
||||||
<label for="searchAddrCondition" class="label">카테고리 선택</label>
|
<label for="searchAddrCondition" class="label">카테고리 선택</label> <select
|
||||||
<select id="searchAddrCondition" name="searchAddrCondition" class="selType2">
|
id="searchAddrCondition" name="searchAddrCondition"
|
||||||
|
class="selType2">
|
||||||
<option value='0'>전체</option>
|
<option value='0'>전체</option>
|
||||||
<option value='1'>그룹명</option>
|
<option value='1'>그룹명</option>
|
||||||
<option value='2'>이름</option>
|
<option value='2'>이름</option>
|
||||||
<option value='3'>핸드폰번호</option>
|
<option value='3'>핸드폰번호</option>
|
||||||
</select>
|
</select> <label for="searchAddrKeyword" class="label">검색어 입력</label> <input
|
||||||
<label for="searchAddrKeyword" class="label">검색어 입력</label>
|
type="text" id="searchAddrKeyword" name="searchAddrKeyword"
|
||||||
<input type="text" id="searchAddrKeyword" name="searchAddrKeyword" placeholder="검색어를 입력하세요" onfocus="this.placeholder=''" onblur="this.placeholder='검색어를 입력하세요'" >
|
placeholder="검색어를 입력하세요" onfocus="this.placeholder=''"
|
||||||
<button type="button" class="btnType btnType17" onClick="javascrit:fnAddrSearch(); return false;">검색</button>
|
onblur="this.placeholder='검색어를 입력하세요'">
|
||||||
|
<button type="button" class="btnType btnType17"
|
||||||
|
onClick="javascrit:fnAddrSearch(); return false;">검색</button>
|
||||||
</div>
|
</div>
|
||||||
<!-- table -->
|
<!-- table -->
|
||||||
<div class="adr_excel adr_pop_list2 callAddr_box">
|
<div class="adr_excel adr_pop_list2 callAddr_box"
|
||||||
</div>
|
style="max-width: 722px"></div>
|
||||||
<!--// table -->
|
<!--// table -->
|
||||||
</div>
|
</div>
|
||||||
<div class="popup_btn_wrap2">
|
<div class="popup_btn_wrap2">
|
||||||
<button type="button" onClick="javascript:addrToList(); return false;">추가</button>
|
<!-- <button type="button" onClick="javascript:addrToList(); return false;">추가</button> -->
|
||||||
<button type="button" onClick="javascript:addrClose(); return false;">닫기</button>
|
<button type="button"
|
||||||
|
onClick="javascript:addrToList_advc('all'); return false;">전체추가</button>
|
||||||
|
<button type="button"
|
||||||
|
onClick="javascript:addrToList_advc('select'); return false;">선택추가</button>
|
||||||
|
<button type="button"
|
||||||
|
onClick="javascript:addrClose(); return false;">닫기</button>
|
||||||
</div>
|
</div>
|
||||||
<%-- 주소록 레이어 팝업 닫기 실행 코드 --%>
|
<%-- 주소록 레이어 팝업 닫기 실행 코드 --%>
|
||||||
<input type="hidden" name="btnAddrClose" id="btnAddrClose" class="tooltip-close closeAddr" data-focus="popup06-close" />
|
<input type="hidden" name="btnAddrClose" id="btnAddrClose"
|
||||||
|
class="tooltip-close closeAddr" data-focus="popup06-close" />
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -202,55 +202,63 @@ function addrToList_advc(type){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function loadAddrList(){
|
function loadAddrList(){
|
||||||
console.log(' loadAddrList() ');
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
serialize 를 사용할때는 processData, contentType 옵션 제가할것
|
serialize 를 사용할때는 processDa ta, contentType 옵션 제가할것
|
||||||
*/
|
*/
|
||||||
var data = $("#searchAddrGrpForm").serialize();
|
var data = $("#searchAddrGrpForm").serialize();
|
||||||
|
|
||||||
// var url = "/web/mjon/msgdata/selectMsgAddrListAjax.do";
|
|
||||||
var url = "/web/mjon/msgdata/selectMsgAddrListAjax_advc.do";
|
var url = "/web/mjon/msgdata/selectMsgAddrListAjax_advc.do";
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: url,
|
url: url,
|
||||||
data: data,
|
data: data,
|
||||||
dataType:'json',
|
dataType:'json',
|
||||||
async: false,
|
async: true,
|
||||||
cache: false,
|
cache: false,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
console.log('data : ', data);
|
console.log('data : ', data);
|
||||||
if(data.status == "OK"){ // status 확인 필요한가. 석세스 안뜨면 에러 가지 않나
|
if(data.status == "OK"){ // status 확인 필요한가. 석세스 안뜨면 에러 가지 않나
|
||||||
|
|
||||||
var addrList = data.object;
|
|
||||||
|
|
||||||
if(addrList.length == 0){
|
var addrList = data.object;
|
||||||
|
|
||||||
alert("주소록 정보가 없습니다.");
|
if(addrList.length == 0){
|
||||||
// tableAddr.setData([]);
|
|
||||||
return false;
|
alert("주소록 정보가 없습니다.");
|
||||||
}
|
// tableAddr.setData([]);
|
||||||
tableAddr.setData(addrList);
|
return false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
// console.log('data : ', data);
|
||||||
alert("주소록 불러오기에 실패하였습니다. !!");
|
tableAddr.setData(addrList);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
alert("주소록 불러오기에 실패하였습니다. !!");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error: function (e) {
|
error: function (jqXHR, textStatus, errorThrown) {
|
||||||
alert("주소록 불러오기에 실패하였습니다."); console.log("ERROR : ", e);
|
alert("주소록 불러오기에 실패하였습니다.");
|
||||||
}
|
console.error("Error:", jqXHR.status, textStatus, errorThrown);
|
||||||
, beforeSend : function(xmlHttpRequest) {
|
console.error("Response Text:", jqXHR.responseText);
|
||||||
//로딩창 show
|
try {
|
||||||
|
let json = JSON.parse(jqXHR.responseText);
|
||||||
|
console.log("Parsed JSON Response:", json);
|
||||||
|
} catch (e) {
|
||||||
|
console.error("JSON Parse Error:", e);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeSend : function(xmlHttpRequest) {
|
||||||
|
//로딩창 show
|
||||||
$('.loading_layer').addClass('active');
|
$('.loading_layer').addClass('active');
|
||||||
}
|
},
|
||||||
, complete : function(xhr, textStatus) {
|
complete : function(xhr, textStatus) {
|
||||||
//로딩창 hide
|
//로딩창 hide
|
||||||
$('.loading_layer').removeClass('active');
|
$('.loading_layer').removeClass('active');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function fnAddrSearch(){
|
function fnAddrSearch(){
|
||||||
|
|||||||
536
src/main/webapp/js/kakao/ft/addr.js
Normal file
536
src/main/webapp/js/kakao/ft/addr.js
Normal file
@ -0,0 +1,536 @@
|
|||||||
|
$(document).on('click', '.addressregi_btn', function() {
|
||||||
|
var tableData = tableL.getRows();
|
||||||
|
var dataLen = tableL.getRows().length;
|
||||||
|
if(dataLen == 0){
|
||||||
|
alert("연락처 정보를 등록해 주세요.");
|
||||||
|
return false;
|
||||||
|
}else{
|
||||||
|
$('.addressregi_layer').css({'width':'680px','display':'block','left':'50%','top':'50%','transform':'translate(-50%,-50%)'});
|
||||||
|
setTimeout(function(){
|
||||||
|
$('.addressregi_layer').css({'opacity':'1'});
|
||||||
|
},150);
|
||||||
|
$('.mask').addClass('on');
|
||||||
|
getAddrGroupList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('click', '.addressregi_layer .tooltip-close', function() {
|
||||||
|
$('.addressregi_layer').attr('style','');
|
||||||
|
$("#addrGrpNm").val("");
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('change', '#addrGrpIdInfo', function() {
|
||||||
|
if ($("#addrGrpIdInfo option:selected").val() != "NEW") {
|
||||||
|
$("#addrGrpNm").val(""); // 새그룹명 Clear;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//주소록 그룹정보 불러오기
|
||||||
|
function getAddrGroupList() {
|
||||||
|
$.ajax({
|
||||||
|
type : "POST",
|
||||||
|
async : false,
|
||||||
|
url : "/web/mjon/addr/addrGroupListAjax.do",
|
||||||
|
data : {},
|
||||||
|
dataType:'json',
|
||||||
|
success : function(data) {
|
||||||
|
//alert(JSON.stringify(data.addrGroupList));
|
||||||
|
|
||||||
|
// Show Html
|
||||||
|
getAddrGroupListShow(data.addrGroupList);
|
||||||
|
},
|
||||||
|
error : function(xhr, status, error) {
|
||||||
|
alert(error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//Show Html
|
||||||
|
function getAddrGroupListShow(jsonList) {
|
||||||
|
var sHtml = "";
|
||||||
|
sHtml += "<option value='NEW'>그룹추가</option>";
|
||||||
|
sHtml += "<option value='0'>그룹미지정</option>";
|
||||||
|
sHtml += "<option value='bookmark'>자주보내는 번호</option>";
|
||||||
|
for (var j = 0; j < jsonList.length; j++) {
|
||||||
|
sHtml += " <option value='" + $.trim(jsonList[j].addrGrpId) + "' />" + $.trim(jsonList[j].addrGrpNm) + "</option>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#addrGrpIdInfo").html(sHtml);
|
||||||
|
}
|
||||||
|
|
||||||
|
//주소록 그룹 중복체크
|
||||||
|
function getAddrGroupDuplCheckAjax(addrGrpNm) {
|
||||||
|
console.log('addrGrpNm : ', addrGrpNm)
|
||||||
|
console.log('getAddrGroupDuplCheckAjax()')
|
||||||
|
var isReturn = true;
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url : "<c:url value='/web/addr/getAddrGroupDuplCheckAjax.do' />",
|
||||||
|
type : 'POST',
|
||||||
|
data : {"addrGrpNm" : addrGrpNm},
|
||||||
|
dataType:'json',
|
||||||
|
async: false, // 동기
|
||||||
|
success : function(data, status){
|
||||||
|
if(data.isSuccess == true) {
|
||||||
|
if(data.isDupl == true) {
|
||||||
|
//alert("중복된 그룹명입니다.");
|
||||||
|
isReturn = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//alert("Message : " + msg);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (e) {
|
||||||
|
//alert("주소록 중복체크에 실패했습니다.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return isReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
//주소록 팝업 닫기 기능
|
||||||
|
function addrClose(){
|
||||||
|
|
||||||
|
$(".closeAddr").trigger("click");
|
||||||
|
|
||||||
|
//주소록 레이어 팝업의 Tabulator 데이터 지워주기
|
||||||
|
tableAddr.clearData();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//주소록 불러오기에서 수신자 리스트 추가해 주기
|
||||||
|
/*
|
||||||
|
function addrToList(){
|
||||||
|
|
||||||
|
var selectedData = tableAddr.getSelectedRows();
|
||||||
|
var tableData = [];
|
||||||
|
|
||||||
|
if(selectedData == "" || selectedData == null){
|
||||||
|
|
||||||
|
alert("주소록을 선택해 주세요.");
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}else{ // 선택한 Row 데이터 저장해주기
|
||||||
|
|
||||||
|
// 선택한 Row 데이터 저장해주기
|
||||||
|
// if(selectedData.length > 500){
|
||||||
|
// alert("최대 발송 건수는 500 입니다.");
|
||||||
|
// return false;
|
||||||
|
// }else{
|
||||||
|
for(var i=0; i < selectedData.length; i++){
|
||||||
|
|
||||||
|
//좌측 받는사람 리스트를 담아둔 배열에 데이터를 추가해 준다.
|
||||||
|
tableData.push({
|
||||||
|
phone: removeDash(selectedData[i].getData().addrPhone)
|
||||||
|
, name: selectedData[i].getData().addrName
|
||||||
|
// , rep1: selectedData[i].getData().addrRep1
|
||||||
|
// , rep2: selectedData[i].getData().addrRep2
|
||||||
|
// , rep3: selectedData[i].getData().addrRep3
|
||||||
|
// , rep4: selectedData[i].getData().addrRep4
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
//선택한 데이터 받는사람 리스트에 추가해 주기
|
||||||
|
addPhoneInfo(tableData);
|
||||||
|
$(".closeAddr").trigger("click");
|
||||||
|
|
||||||
|
//주소록 레이어 팝업의 Tabulator 데이터 지워주기
|
||||||
|
tableAddr.clearData();
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
//주소록 불러오기에서 수신자 리스트 추가해 주기
|
||||||
|
function addrToList_advc(type){
|
||||||
|
|
||||||
|
|
||||||
|
// 선택된 데이터 또는 전체 데이터 변수 초기화
|
||||||
|
let selectedData = type === 'select' ? tableAddr.getSelectedRows() : tableAddr.getData();
|
||||||
|
|
||||||
|
// 데이터가 비어있으면 경고 후 종료
|
||||||
|
if (!selectedData || selectedData.length < 1) {
|
||||||
|
|
||||||
|
if(tableAddr.getDataCount() < 1){
|
||||||
|
alert("주소록을 선택해 주세요.");
|
||||||
|
}else{
|
||||||
|
alert("전화번호를 선택해 주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 데이터 변환 로직
|
||||||
|
const addrData = selectedData.map(row => {
|
||||||
|
const rowData = type === 'select' ? row.getData() : row; // 'select'는 행 객체에서 데이터 추출
|
||||||
|
return {
|
||||||
|
name: rowData.name,
|
||||||
|
phone: removeDash(rowData.phone),
|
||||||
|
rep1: rowData.rep1,
|
||||||
|
rep2: rowData.rep2,
|
||||||
|
rep3: rowData.rep3,
|
||||||
|
rep4: rowData.rep4
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.filter(row => checkHpNum(row.phone)); // 유효한 번호만 필터링;
|
||||||
|
|
||||||
|
|
||||||
|
// 기존 tableL의 데이터를 가져옵니다.
|
||||||
|
var existingData = tableL.getData();
|
||||||
|
// 기존 데이터와 새로운 데이터를 합칩니다.
|
||||||
|
var combinedData = existingData.concat(addrData);
|
||||||
|
|
||||||
|
// @ phone을 기준으로 중복 제거 및 갯수 계산
|
||||||
|
const result = removeDuplicatesAndCount(combinedData, 'phone');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 총 30만건이 넘으면 false
|
||||||
|
if (!validateRowLimit(result.uniqueCount)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
setAllCntData(result);
|
||||||
|
|
||||||
|
|
||||||
|
// 미리보기 버튼 활성화
|
||||||
|
|
||||||
|
|
||||||
|
$(".closeAddr").trigger("click");
|
||||||
|
//주소록 레이어 팝업의 Tabulator 데이터 지워주기
|
||||||
|
tableAddr.clearData();
|
||||||
|
fn_priceClclt(result.uniqueCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadAddrList(){
|
||||||
|
|
||||||
|
/*
|
||||||
|
serialize 를 사용할때는 processDa ta, contentType 옵션 제가할것
|
||||||
|
*/
|
||||||
|
var data = $("#searchAddrGrpForm").serialize();
|
||||||
|
|
||||||
|
var url = "/web/mjon/msgdata/selectMsgAddrListAjax_advc.do";
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: url,
|
||||||
|
data: data,
|
||||||
|
dataType:'json',
|
||||||
|
async: true,
|
||||||
|
cache: false,
|
||||||
|
success: function (data) {
|
||||||
|
console.log('data : ', data);
|
||||||
|
if(data.status == "OK"){ // status 확인 필요한가. 석세스 안뜨면 에러 가지 않나
|
||||||
|
|
||||||
|
var addrList = data.object;
|
||||||
|
|
||||||
|
if(addrList.length == 0){
|
||||||
|
|
||||||
|
alert("주소록 정보가 없습니다.");
|
||||||
|
// tableAddr.setData([]);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// console.log('data : ', data);
|
||||||
|
tableAddr.setData(addrList);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
alert("주소록 불러오기에 실패하였습니다. !!");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (jqXHR, textStatus, errorThrown) {
|
||||||
|
alert("주소록 불러오기에 실패하였습니다.");
|
||||||
|
console.error("Error:", jqXHR.status, textStatus, errorThrown);
|
||||||
|
console.error("Response Text:", jqXHR.responseText);
|
||||||
|
try {
|
||||||
|
let json = JSON.parse(jqXHR.responseText);
|
||||||
|
console.log("Parsed JSON Response:", json);
|
||||||
|
} catch (e) {
|
||||||
|
console.error("JSON Parse Error:", e);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeSend : function(xmlHttpRequest) {
|
||||||
|
//로딩창 show
|
||||||
|
$('.loading_layer').addClass('active');
|
||||||
|
},
|
||||||
|
complete : function(xhr, textStatus) {
|
||||||
|
//로딩창 hide
|
||||||
|
$('.loading_layer').removeClass('active');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function fnAddrSearch(){
|
||||||
|
|
||||||
|
var form = document.searchAddrGrpForm;
|
||||||
|
form.searchKeyword.value = form.searchAddrKeyword.value;
|
||||||
|
form.searchCondition.value = form.searchAddrCondition.value;
|
||||||
|
|
||||||
|
loadAddrList();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//주소록 불러오기 팝업의 그룹 선택시 우측에 주소록 불러오기
|
||||||
|
function fnSelectAddrList(type,addrGrpId,item){
|
||||||
|
|
||||||
|
// 주소록 그룹 열림, 닫힘 폴더이미지 초기화
|
||||||
|
$(".adr_pop_list div p").each(function (index, item) {
|
||||||
|
$(item).find("img").attr("src", "/publish/images/content/close_folder2.png");
|
||||||
|
$(item).find("img").attr("alt", "폴더 닫힘");
|
||||||
|
});
|
||||||
|
|
||||||
|
var form = document.searchAddrGrpForm;
|
||||||
|
form.type.value = type;
|
||||||
|
form.searchAddrGrpId.value = addrGrpId;
|
||||||
|
form.searchKeyword.value = "";
|
||||||
|
form.searchCondition.value = form.searchAddrCondition.value;
|
||||||
|
|
||||||
|
//왼쪽 그룹리스트의 그룸명을 선택시 검색어를 초기화해준다.
|
||||||
|
form.searchAddrKeyword.value="";
|
||||||
|
|
||||||
|
/*
|
||||||
|
$(item).toggleClass("open");
|
||||||
|
if ($(item).hasClass("open") === true) {
|
||||||
|
$(item).find("img").attr("src", "/publish/images/content/open_folder2.png");
|
||||||
|
$(item).find("img").attr("alt", "폴더 열림");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$(item).find("img").attr("src", "/publish/images/content/close_folder2.png");
|
||||||
|
$(item).find("img").attr("alt", "폴더 닫힘");
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
$(item).find("img").attr("src", "/publish/images/content/open_folder2.png");
|
||||||
|
$(item).find("img").attr("alt", "폴더 열림");
|
||||||
|
|
||||||
|
loadAddrList();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//주소록 불러오기 그룹명 검색 기능처리
|
||||||
|
function fnAddrGrpSearch(){
|
||||||
|
|
||||||
|
var form = document.searchAddrGrpForm;
|
||||||
|
form.searchKeyword.value = form.searchGrpKeyword.value;
|
||||||
|
form.searchCondition.value = "";
|
||||||
|
|
||||||
|
var sendData = $(document.searchAddrGrpForm).serializeArray();
|
||||||
|
|
||||||
|
$("#addrGroupLoad").load("/web/mjon/msgdata/selectAddrGroupListAjax.do", sendData ,function(response, status, xhr){
|
||||||
|
//리스트 스크롤 처리해주기
|
||||||
|
$(".adr_pop_list").mCustomScrollbar({
|
||||||
|
axis: 'y',
|
||||||
|
scrollbarPosition: "outside",
|
||||||
|
theme: "dark",
|
||||||
|
autoHideScrollbar: false
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
//문자발송 받는사람 목록 주소록에 등록하기 기능 처리
|
||||||
|
$('.registAddr').click(function(){
|
||||||
|
|
||||||
|
var tableData = tableL.getRows();
|
||||||
|
var dataLen = tableL.getRows().length;
|
||||||
|
|
||||||
|
var nameList = []; //치환문자 이름
|
||||||
|
var phoneNum = []; //받는사람
|
||||||
|
var rep1List = []; //치환문자1
|
||||||
|
var rep2List = []; //치환문자2
|
||||||
|
var rep3List = []; //치환문자3
|
||||||
|
var rep4List = []; //치환문자4
|
||||||
|
|
||||||
|
if(dataLen > 0){
|
||||||
|
|
||||||
|
for(var i=0; i < dataLen; i++){
|
||||||
|
|
||||||
|
var name = tableData[i].getData().name;
|
||||||
|
var phone = removeDash(tableData[i].getData().phone);
|
||||||
|
var rep1 = tableData[i].getData().rep1;
|
||||||
|
var rep2 = tableData[i].getData().rep2;
|
||||||
|
var rep3 = tableData[i].getData().rep3;
|
||||||
|
var rep4 = tableData[i].getData().rep4;
|
||||||
|
|
||||||
|
if(phone == "" || phone == null){
|
||||||
|
|
||||||
|
alert("수신 목록에 핸드폰 번호가 없는 항목이 있습니다.");
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}else if(!checkHpNum(phone)){
|
||||||
|
|
||||||
|
alert("수신 목록에 잘 못된 핸드폰 번호가 있습니다. 핸드폰 번호 : " + phone + " 입니다.");
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
nameList[i] = name;
|
||||||
|
phoneNum[i] = phone;
|
||||||
|
|
||||||
|
if(rep1 == "" || rep1 == null){
|
||||||
|
rep1List[i] = "-";
|
||||||
|
}else{
|
||||||
|
rep1List[i] = rep1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(rep2 == "" || rep2 == null){
|
||||||
|
rep2List[i] = "-";
|
||||||
|
}else{
|
||||||
|
rep2List[i] = rep2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(rep3 == "" || rep3 == null){
|
||||||
|
rep3List[i] = "-";
|
||||||
|
}else{
|
||||||
|
rep3List[i] = rep3;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(rep4 == "" || rep4 == null){
|
||||||
|
rep4List[i] = "-";
|
||||||
|
}else{
|
||||||
|
rep4List[i] = rep4;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(name == "" || name == null){
|
||||||
|
|
||||||
|
alert("수신 목록에 이름이 없는 항목이 있습니다. 이름을 입력해 주세요");
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
nameList[i] = name;
|
||||||
|
phoneNum[i] = phone;
|
||||||
|
|
||||||
|
if(rep1 == "" || rep1 == null){
|
||||||
|
rep1List[i] = "-";
|
||||||
|
}else{
|
||||||
|
rep1List[i] = rep1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(rep2 == "" || rep2 == null){
|
||||||
|
rep2List[i] = "-";
|
||||||
|
}else{
|
||||||
|
rep2List[i] = rep2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(rep3 == "" || rep3 == null){
|
||||||
|
rep3List[i] = "-";
|
||||||
|
}else{
|
||||||
|
rep3List[i] = rep3;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(rep4 == "" || rep4 == null){
|
||||||
|
rep4List[i] = "-";
|
||||||
|
}else{
|
||||||
|
rep4List[i] = rep4;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//주소록 정보를 Form에 넣어준다.
|
||||||
|
|
||||||
|
var form = document.msgForm;
|
||||||
|
form.callToList.value = phoneNum;
|
||||||
|
form.nameList.value = nameList;
|
||||||
|
form.rep1List.value = rep1List;
|
||||||
|
form.rep2List.value = rep2List;
|
||||||
|
form.rep3List.value = rep3List;
|
||||||
|
form.rep4List.value = rep4List;
|
||||||
|
form.addrGrpId.value = $("#addrGrpIdInfo").val();
|
||||||
|
form.addrGrpNm.value = $("#addrGrpNm").val();
|
||||||
|
|
||||||
|
if ($("#addrGrpIdInfo option:selected").val() == "NEW" && ($("#addrGrpNm").val() == "" || $("#addrGrpNm").val() == null || $("#addrGrpNm").val() == undefined)) {
|
||||||
|
alert("저장할 그룹을 선택하거나 새 그룹명을 입력해주세요.");
|
||||||
|
return false;
|
||||||
|
}else if ($("#addrGrpIdInfo option:selected").val() == "NEW" && $("#addrGrpNm").val() != "") {
|
||||||
|
//주소록 중복체크
|
||||||
|
if (getAddrGroupDuplCheckAjax() == false) {
|
||||||
|
alert("중복된 그룹명입니다. 새 그룹명을 입력해주세요.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(confirm("연락처 정보를 주소록에 등록 하시겠습니까?")){
|
||||||
|
|
||||||
|
var data = new FormData(form);
|
||||||
|
var url = "/web/mjon/msgdata/insertMsgAddrListAjax.do";
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
enctype: 'multipart/form-data',
|
||||||
|
url: url,
|
||||||
|
data: data,
|
||||||
|
dataType:'json',
|
||||||
|
async: true,
|
||||||
|
processData: false,
|
||||||
|
contentType: false,
|
||||||
|
cache: false,
|
||||||
|
//timeout: 600000,
|
||||||
|
success: function (returnData, status) {
|
||||||
|
if(status == 'success'){ // status 확인 필요한가. 석세스 안뜨면 에러 가지 않나
|
||||||
|
|
||||||
|
if(returnData.result == "success"){
|
||||||
|
var alertMsg = "총 " + returnData.resultCnt + "건의 " +returnData.message;
|
||||||
|
|
||||||
|
if(returnData.dupliCnt > 0) {
|
||||||
|
alertMsg += "\n"+numberWithCommas(returnData.dupliCnt) + "건은 이미 등록되어있는 번호입니다.";
|
||||||
|
}
|
||||||
|
|
||||||
|
alert(alertMsg);
|
||||||
|
$("#addrGrpNm").val("");
|
||||||
|
$('.addressregi_layer').attr('style','');
|
||||||
|
$('.mask').removeClass('on');
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}else if(returnData.result == "allDupl") {
|
||||||
|
alert("요청하신 "+returnData.dupliCnt+"건의 번호가 주소록에 이미 등록되어있습니다.");
|
||||||
|
$("#addrGrpNm").val("");
|
||||||
|
$('.addressregi_layer').attr('style','');
|
||||||
|
$('.mask').removeClass('on');
|
||||||
|
return false;
|
||||||
|
}else{
|
||||||
|
alert(returnData.message);
|
||||||
|
$("#addrGrpNm").val("");
|
||||||
|
$('.addressregi_layer').attr('style','');
|
||||||
|
$('.mask').removeClass('on');
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if(status== 'fail'){
|
||||||
|
alert("주소록 등록에 실패하였습니다. !!");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (e) {
|
||||||
|
alert("주소록 등록에 실패하였습니다.");
|
||||||
|
console.log("ERROR : ", e);
|
||||||
|
},
|
||||||
|
beforeSend : function(xmlHttpRequest) {
|
||||||
|
//로딩창 show
|
||||||
|
$('.loading_layer').addClass('active');
|
||||||
|
},
|
||||||
|
complete : function(xhr, textStatus) {
|
||||||
|
//로딩창 hide
|
||||||
|
$('.loading_layer').removeClass('active');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
alert("연락처 정보를 등록해 주세요.");
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
*/
|
||||||
@ -13,6 +13,18 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//카카오 mms sms 단가 셋팅
|
||||||
|
var KAKAO_FT_PRICE = '';
|
||||||
|
var SHORT_PRICE = '';
|
||||||
|
var LONG_PRICE = '';
|
||||||
|
$('document').ready(function(){
|
||||||
|
|
||||||
|
KAKAO_FT_PRICE = Number($('#kakaoFtPrice').val());
|
||||||
|
SHORT_PRICE = Number($('#shortPrice').val());
|
||||||
|
LONG_PRICE = Number($('#longPrice').val());
|
||||||
|
console.log('SHORT_PRICE: ', SHORT_PRICE);
|
||||||
|
console.log('LONG_PRICE: ', LONG_PRICE);
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -89,13 +101,6 @@ function totalFtPriceSum(totRows){
|
|||||||
*
|
*
|
||||||
* */
|
* */
|
||||||
|
|
||||||
//카카오 mms sms 단가 셋팅
|
|
||||||
var KAKAO_FT_PRICE = '';
|
|
||||||
var SHORT_PRICE = '';
|
|
||||||
var LONG_PRICE = '';
|
|
||||||
KAKAO_FT_PRICE = $('#kakaoFtPrice').val();
|
|
||||||
SHORT_PRICE = $('#shortPrice').val();
|
|
||||||
LONG_PRICE = $('#longPrice').val();
|
|
||||||
|
|
||||||
/*$(document).ready(function(){
|
/*$(document).ready(function(){
|
||||||
|
|
||||||
@ -157,6 +162,7 @@ LONG_PRICE = $('#longPrice').val();
|
|||||||
* @description 금액 계산 function
|
* @description 금액 계산 function
|
||||||
*/
|
*/
|
||||||
function fn_priceClclt(phoneSu = 0){
|
function fn_priceClclt(phoneSu = 0){
|
||||||
|
console.log('fn_priceClclt : ', phoneSu);
|
||||||
|
|
||||||
// 미리보기 텍스트
|
// 미리보기 텍스트
|
||||||
var templateHtml = $('#smsTxtArea').val();
|
var templateHtml = $('#smsTxtArea').val();
|
||||||
|
|||||||
@ -94,7 +94,7 @@ $(document).ready(function (){
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
//주소록 불러오기 팝업 내용
|
//주소록 불러오기 팝업 내용
|
||||||
//Tabulator AJAX Data Loading
|
//Tabulator AJAX Data Loading
|
||||||
tableAddr = new Tabulator(".callAddr_box", {
|
tableAddr = new Tabulator(".callAddr_box", {
|
||||||
@ -132,7 +132,61 @@ $(document).ready(function (){
|
|||||||
return value % parameters.addrPhone;
|
return value % parameters.addrPhone;
|
||||||
},
|
},
|
||||||
|
|
||||||
});
|
});*/
|
||||||
|
|
||||||
|
|
||||||
|
// Tabulator 초기화
|
||||||
|
tableAddr = new Tabulator(".callAddr_box", {
|
||||||
|
height: "255px",
|
||||||
|
layout: "fitData",
|
||||||
|
headerHozAlign: "center",
|
||||||
|
validationMode: "highlight",
|
||||||
|
resizableColumns: true,
|
||||||
|
progressiveLoad:"scroll",
|
||||||
|
progressiveRender: true, // 렌더링 최적화 활성화
|
||||||
|
progressiveRenderSize: 100, // 한 번에 렌더링할 행 수를 줄임
|
||||||
|
placeholder: "주소록 그룹을 선택해 주세요.",
|
||||||
|
columns: [
|
||||||
|
// {formatter: "rowSelection", clipboard: false, hozAlign: "center", headerSort: false},
|
||||||
|
{formatter: "rowSelection", titleFormatter: "rowSelection", hozAlign: "center", headerSort: false,
|
||||||
|
cellClick: function(e, cell) {
|
||||||
|
fn_loadAddActive(); // 로딩 활성화
|
||||||
|
setTimeout(() => {
|
||||||
|
tableAddr.blockRedraw(); // 렌더링 차단
|
||||||
|
cell.getRow().toggleSelect(); // 선택 상태 토글
|
||||||
|
tableAddr.restoreRedraw(); // 렌더링 재개
|
||||||
|
fn_loadRemoveActive(); // 로딩 비활성화
|
||||||
|
}, 0); // 비동기적으로 실행
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{title: "No", hozAlign: "center", formatter: "rownum", align: "center", headerHozAlign: "center", width: 60},
|
||||||
|
{title: "그룹명", hozAlign: "center", field: "addrGroupNm", editor: false, width: 100},
|
||||||
|
{title: "이름", hozAlign: "center", field: "name", editor: false, width: 100},
|
||||||
|
{title: "휴대폰번호", hozAlign: "center", field: "phone", editor: false, width: 100},
|
||||||
|
{title: "[*1*]", hozAlign: "center", field: "rep1", editor: false, width: 84},
|
||||||
|
{title: "[*2*]", hozAlign: "center", field: "rep2", editor: false, width: 84},
|
||||||
|
{title: "[*3*]", hozAlign: "center", field: "rep3", editor: false, width: 84},
|
||||||
|
{title: "[*4*]", hozAlign: "center", field: "rep4", editor: false, width: 84},
|
||||||
|
],
|
||||||
|
validationFailed: function(cell, value, parameters) {
|
||||||
|
var valid = cell.isValid();
|
||||||
|
var fieldNm = cell.getField();
|
||||||
|
if (!valid) {
|
||||||
|
if (fieldNm == "addrName") {
|
||||||
|
alert("받는사람 이름은 최대 12글자까지만 입력 가능합니다.");
|
||||||
|
} else if (fieldNm == "addrPhone") {
|
||||||
|
alert("휴대폰번호는 하이픈(-)을 제외한 숫자만 정확히 입력해 주세요.");
|
||||||
|
} else if (fieldNm == "addrGroupNm") {
|
||||||
|
alert("그룹명을 정확히 입력해 주세요. 2 ~ 40글자 이내로 입력 가능합니다.");
|
||||||
|
} else {
|
||||||
|
alert("치환문자를 정확히 입력해 주세요. 100글자 이내로 입력 가능합니다.");
|
||||||
|
}
|
||||||
|
cell.setValue("");
|
||||||
|
}
|
||||||
|
console.log('parameters : ', parameters);
|
||||||
|
return value % parameters.addrPhone;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
//받는사람 번호 버튼 클릭시 Tabulator에 데이터 넣어주기
|
//받는사람 번호 버튼 클릭시 Tabulator에 데이터 넣어주기
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user