(SKT AI Surveylink) 가상번호 파일 다운로드 API 적용
This commit is contained in:
@@ -41,7 +41,7 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="content-wrapper">
|
||||
<div class="content-wrapper" style="margin-left: 100px; margin-right: 100px; margin-top: 100px;">
|
||||
<div class="content-header">
|
||||
<h1>CATI Surveylink <20><><EFBFBD>߽<EFBFBD></h1>
|
||||
</div>
|
||||
@@ -52,16 +52,14 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<form name="xform" method="post" onsubmit="return handleFormSubmit();">
|
||||
<table class="table table-sm table-bordered table-head tr-colors" style="width:1000px;">
|
||||
<table class="table table-sm table-bordered table-head tr-colors">
|
||||
<tr>
|
||||
<td colspan="4" align="center">
|
||||
<td colspan="5" align="center">
|
||||
<span><3E≯<EFBFBD> : </span>
|
||||
<input type="text" name="user_name" value="<%= Request.Form("user_name") %>" style="width:100px; margin-right:15px;">
|
||||
|
||||
<span><3E>ֹε<D6B9><CEB5>Ϲ<EFBFBD>ȣ : </span>
|
||||
<input type="text" name="trans_number" value="<%= Request.Form("trans_number") %>" style="width:130px; text-align:right;" onchange="getNumber(this);" onkeyup="getNumber(this);">
|
||||
|
||||
<input type="submit" name="xbtn" value="<22>˻<EFBFBD>" style="width:130px; cursor:pointer;">
|
||||
<input type="text" name="trans_number" value="<%= Request.Form("trans_number") %>" style="width:130px; margin-right:10px;" onchange="getNumber(this);" onkeyup="getNumber(this);">
|
||||
<input type="submit" name="xbtn" value="<22>˻<EFBFBD>" style="width:200px; cursor:pointer;">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -70,6 +68,7 @@
|
||||
<th style="text-align:center;">Surveylink<br><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD>ڵ<EFBFBD></th>
|
||||
<th style="text-align:center;"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD></th>
|
||||
<th style="text-align:center;"><3E><><EFBFBD>߽<EFBFBD></th>
|
||||
<th style="text-align:center;"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȣ<br><3E><><EFBFBD><EFBFBD> <20>ٿ<EFBFBD><D9BF>ε<EFBFBD></th>
|
||||
</tr>
|
||||
|
||||
<%
|
||||
@@ -110,17 +109,22 @@
|
||||
%>
|
||||
|
||||
<tr>
|
||||
<td class="text-left">
|
||||
<td class="text-left" style="width:1500px;">
|
||||
<span><%=adoRs("prj_name")%></span>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<input type="text" name="prjCd" style="width:100px; text-align:center; margin-top:5px;">
|
||||
<td class="text-center" style="width:200px;">
|
||||
<input type="text" name="prjCd" style="width:180px; text-align:center; margin-top:5px;">
|
||||
</td>
|
||||
<td class="text-center result-cell" style="width:200px;">
|
||||
<td class="text-center result-cell" style="width:300px;">
|
||||
<span class="result-text">-</span>
|
||||
</td>
|
||||
<td class="text-center" style="width:100px;">
|
||||
<button type="button" class="btn btn-sm btn-warning" data-prj="<%=adoRs("prj_code")%>" onclick="surveylinkApiCall(this);"><3E><><EFBFBD>߽<EFBFBD></button>
|
||||
<td class="text-center" style="width:200px;">
|
||||
<button type="button" class="btn btn-sm btn-warning" style="color: #000;" data-prj="<%=adoRs("prj_code")%>" onclick="surveylinkApiCall(this);"><3E><><EFBFBD>߽<EFBFBD> <20><><EFBFBD><EFBFBD></button>
|
||||
</td>
|
||||
<td class="text-center" style="width:250px;">
|
||||
<button type="button" class="btn btn-sm" style="background-color:#28a745; color:#fff;" data-prj="<%=adoRs("prj_code")%>" onclick="surveylinkGetCallDataApiCall(this);">
|
||||
<20><><EFBFBD><EFBFBD> <20>ٿ<EFBFBD><D9BF>ε<EFBFBD>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<%
|
||||
@@ -152,7 +156,8 @@
|
||||
type: "POST",
|
||||
data: {
|
||||
prjCd: prjCdFromInput,
|
||||
prjCode: prjCode
|
||||
prjCode: prjCode,
|
||||
apiType: "callData"
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(res) {
|
||||
@@ -179,6 +184,68 @@
|
||||
prjSearch();
|
||||
return false;
|
||||
}
|
||||
|
||||
function surveylinkGetCallDataApiCall(btn) {
|
||||
const $btn = $(btn);
|
||||
const $row = $btn.closest('tr');
|
||||
const prjCdFromInput = $row.find('input[name="prjCd"]').val().trim(); //SKT Surveylink<6E><6B><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <20>ڵ<EFBFBD>
|
||||
const prjCode = $btn.data('prj'); //CATI <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <20>ڵ<EFBFBD>
|
||||
|
||||
$.ajax({
|
||||
url: "cati_surveylink_api_ajax.asp",
|
||||
type: "POST",
|
||||
data: {
|
||||
prjCd: prjCdFromInput,
|
||||
prjCode: prjCode,
|
||||
apiType: "getCallData"
|
||||
},
|
||||
dataType: "text",
|
||||
success: function(res) {
|
||||
let message = '';
|
||||
|
||||
try {
|
||||
// JSON<4F><4E><EFBFBD><EFBFBD> <20>Ľ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>õ<EFBFBD> (<28><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>)
|
||||
const json = JSON.parse(res);
|
||||
|
||||
// JSON <20>Ľ<EFBFBD><C4BD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>߰<EFBFBD> code<64><65> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ? <20><><EFBFBD><EFBFBD> ó<><C3B3>
|
||||
if (json.code) {
|
||||
message = `<60><><EFBFBD><EFBFBD> (${json.code}) : ${json.message}`;
|
||||
$row.find('.result-text').text(message);
|
||||
return; // CSV <20>ٿ<EFBFBD><D9BF>ε<EFBFBD><CEB5><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
}
|
||||
} catch (e) {
|
||||
// JSON <20>Ľ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><> CSV<53><56><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
}
|
||||
|
||||
// code<64><65> <20><><EFBFBD><EFBFBD> CSV <20><><EFBFBD>¸<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ٿ<EFBFBD><D9BF>ε<EFBFBD> ó<><C3B3>
|
||||
if (typeof res === "string" && res.includes(",")) {
|
||||
const fileName = `${prjCdFromInput}.csv`;
|
||||
|
||||
// CSV <20>ٿ<EFBFBD><D9BF>ε<EFBFBD>
|
||||
const blob = new Blob([res], { type: "text/csv;charset=utf-8;" });
|
||||
const link = document.createElement("a");
|
||||
link.href = URL.createObjectURL(blob);
|
||||
link.download = fileName;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
|
||||
message = `${fileName}<br><3E>ٿ<EFBFBD><D9BF>ε<EFBFBD> <20>Ϸ<EFBFBD>`;
|
||||
$row.find('.result-text').html(message); // <br> <20>ٹٲ<D9B9> <20><><EFBFBD><EFBFBD>
|
||||
} else {
|
||||
message = 'CSV <20><><EFBFBD><EFBFBD><EFBFBD>Ͱ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.';
|
||||
$row.find('.result-text').text(message);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, err) {
|
||||
console.error("AJAX Error:", status, err);
|
||||
console.error("Status Code:", xhr.status);
|
||||
console.error("Response Text:", xhr.responseText);
|
||||
|
||||
$row.find('.result-text').text(`<60><><EFBFBD><EFBFBD> <20><EFBFBD> (<28>ڵ<EFBFBD>: ${xhr.responseText}, CSV <20>ٿ<EFBFBD><D9BF>ε<EFBFBD><CEB5><EFBFBD>)`);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user