시스템관리 페이지 추가
This commit is contained in:
@@ -70,6 +70,11 @@
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<button type="button" class="btn btn-outline-success" id="btnExcel">
|
||||
<i class="fa fas fa-file-excel-o"></i> 엑셀 다운로드
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -248,9 +253,10 @@
|
||||
url: '/manage/dupl_phone/getDuplPhoneList',
|
||||
type: 'GET',
|
||||
data: function (d) {
|
||||
d.srchDepth = $("#frm_srch_info [name=srchDepth]").val()
|
||||
d.srcDeptNm = $("#frm_srch_info [name=srcDeptNm]").val()
|
||||
d.srcDeptHead = $("#frm_srch_info [name=srcDeptHead]").val()
|
||||
d.cpid = $("#frm_srch_info [name=cpid]").val()
|
||||
d.s_date = $("#frm_srch_info [name=s_date]").val()
|
||||
d.e_date = $("#frm_srch_info [name=e_date]").val()
|
||||
d.phone = $("#frm_srch_info [name=phone_number]").val()
|
||||
d.useYn = $("#frm_srch_info [name=useYn]").val()
|
||||
|
||||
d.srchType = $("#frm_srch_info [name=srchType]").val()
|
||||
@@ -280,7 +286,7 @@
|
||||
{ data: 'owner' },
|
||||
{ data: 'applicant' },
|
||||
{ data: 'relation' },
|
||||
{ data: 'use_yn_nm' },
|
||||
{ data: 'use_yn_nm', "width": "50px" },
|
||||
{ data: 'memo', "width": "200px" },
|
||||
],
|
||||
// 옵션들 예시
|
||||
@@ -415,6 +421,28 @@
|
||||
});
|
||||
|
||||
|
||||
// 엑셀다운 click
|
||||
$("#btnExcel").on("click", function () {
|
||||
|
||||
$.ajax({
|
||||
url: "/manage/dupl_phone/excel",
|
||||
method: "GET",
|
||||
dataType: "json",
|
||||
data: $("#frm_srch_info").serialize(),
|
||||
beforeSend: function () {
|
||||
blockUI.blockPage({
|
||||
message: tpl
|
||||
})
|
||||
},
|
||||
complete: function () {
|
||||
blockUI.unblockPage()
|
||||
},
|
||||
success: function (result) {
|
||||
downloadExcel(result.data);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -427,5 +455,46 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 엑셀 다운로드
|
||||
function downloadExcel(data) {
|
||||
const ws = XLSX.utils.json_to_sheet(data);
|
||||
ws['!cols'] = [
|
||||
{ wpx: 80 },
|
||||
{ wpx: 80 },
|
||||
{ wpx: 80 },
|
||||
{ wpx: 80 },
|
||||
{ wpx: 80 },
|
||||
{ wpx: 80 },
|
||||
{ wpx: 80 },
|
||||
{ wpx: 130 },
|
||||
{ wpx: 80 },
|
||||
{ wpx: 200 },
|
||||
];
|
||||
|
||||
const wb = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(wb, ws, "Sheet1");
|
||||
|
||||
const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
|
||||
|
||||
const blob = new Blob([wbout], { type: 'application/octet-stream' });
|
||||
|
||||
const link = document.createElement("a");
|
||||
link.href = URL.createObjectURL(blob);
|
||||
link.download = "전화확인관리" + getDateTimeString() + ".xlsx";
|
||||
link.click();
|
||||
URL.revokeObjectURL(link.href);
|
||||
}
|
||||
|
||||
function getDateTimeString() {
|
||||
const d = new Date();
|
||||
const yyyy = d.getFullYear();
|
||||
const mm = String(d.getMonth() + 1).padStart(2, '0');
|
||||
const dd = String(d.getDate()).padStart(2, '0');
|
||||
const hh = String(d.getHours()).padStart(2, '0');
|
||||
const mi = String(d.getMinutes()).padStart(2, '0');
|
||||
const ss = String(d.getSeconds()).padStart(2, '0');
|
||||
return `${yyyy}${mm}${dd}${hh}${mi}${ss}`;
|
||||
}
|
||||
|
||||
</script>
|
||||
<?= $this->endSection() ?>
|
||||
Reference in New Issue
Block a user