시스템관리 페이지 추가
This commit is contained in:
@@ -32,19 +32,25 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$nRow = 1;
|
||||
foreach ($statistics['reserve'] as $row):
|
||||
?>
|
||||
<?php if (empty($statistics['reserve'])): ?>
|
||||
<tr>
|
||||
<th scope="row"> <?= substr($row['rcpt_tm'], 0, 10) ?></th>
|
||||
<td class="text-center"><?= substr($row['rsrv_date'], 0, 10) ?></td>
|
||||
<td class="text-center"><?= $row['rsrv_tm_ap'] ?></td>
|
||||
<td class="text-center" colspan="3">데이터가 없습니다.</td>
|
||||
</tr>
|
||||
<?php else: ?>
|
||||
<?php
|
||||
$nRow++;
|
||||
endforeach;
|
||||
?>
|
||||
$nRow = 1;
|
||||
foreach ($statistics['reserve'] as $row):
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row"> <?= substr($row['rcpt_tm'], 0, 10) ?></th>
|
||||
<td class="text-center"><?= substr($row['rsrv_date'], 0, 10) ?></td>
|
||||
<td class="text-center"><?= $row['rsrv_tm_ap'] ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$nRow++;
|
||||
endforeach;
|
||||
?>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -60,8 +66,8 @@
|
||||
<table class="mb-0 table">
|
||||
<colgroup>
|
||||
<col width="10%" />
|
||||
<col width="60%" />
|
||||
<col width="30%" />
|
||||
<col width="70%" />
|
||||
<col width="20%" />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -71,13 +77,19 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($notice as $key => $n): ?>
|
||||
<tr onclick="location.href='board/notice/detail/<?= $n['bbs_sq'] ?>'">
|
||||
<th scope="row"><?= ($key + 1) ?></th>
|
||||
<td><?= $n["subject"] ?></td>
|
||||
<td class="text-center"><?= $n["update_tm"] ?></td>
|
||||
<?php if (empty($notice)): ?>
|
||||
<tr>
|
||||
<td class="text-center" colspan="3">데이터가 없습니다.</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
<?php foreach ($notice as $key => $n): ?>
|
||||
<tr onclick="location.href='board/notice/detail/<?= $n['bbs_sq'] ?>'">
|
||||
<th scope="row"><?= ($key + 1) ?></th>
|
||||
<td><?= $n["subject"] ?></td>
|
||||
<td class="text-center"><?= $n["update_tm"] ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -99,19 +111,25 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$nRow = 1;
|
||||
foreach ($statistics['status2'] as $row):
|
||||
?>
|
||||
<?php if (empty($statistics['status2'])): ?>
|
||||
<tr>
|
||||
<th scope="row"> <?= substr($row['rcpt_tm'], 0, 10) ?></th>
|
||||
<td class="text-center"><?= substr($row['photo_save_dt'], 0, 10) ?></td>
|
||||
<td class="text-center"><?= $row['elapsed_dt'] ?></td>
|
||||
<td class="text-center" colspan="3">데이터가 없습니다.</td>
|
||||
</tr>
|
||||
<?php else: ?>
|
||||
<?php
|
||||
$nRow++;
|
||||
endforeach;
|
||||
?>
|
||||
$nRow = 1;
|
||||
foreach ($statistics['status2'] as $row):
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row"> <?= substr($row['rcpt_tm'], 0, 10) ?></th>
|
||||
<td class="text-center"><?= substr($row['photo_save_dt'], 0, 10) ?></td>
|
||||
<td class="text-center"><?= $row['elapsed_dt'] ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$nRow++;
|
||||
endforeach;
|
||||
?>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -134,19 +152,25 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$nRow = 1;
|
||||
foreach ($statistics['status3'] as $row):
|
||||
?>
|
||||
<?php if (empty($statistics['status3'])): ?>
|
||||
<tr>
|
||||
<th scope="row"> <?= substr($row['rcpt_tm'], 0, 10) ?></th>
|
||||
<td class="text-center"><?= substr($row['photo_save_dt'], 0, 10) ?></td>
|
||||
<td class="text-center"><?= $row['elapsed_dt'] ?></td>
|
||||
<td class="text-center" colspan="3">데이터가 없습니다.</td>
|
||||
</tr>
|
||||
<?php else: ?>
|
||||
<?php
|
||||
$nRow++;
|
||||
endforeach;
|
||||
?>
|
||||
$nRow = 1;
|
||||
foreach ($statistics['status3'] as $row):
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row"> <?= substr($row['rcpt_tm'], 0, 10) ?></th>
|
||||
<td class="text-center"><?= substr($row['photo_save_dt'], 0, 10) ?></td>
|
||||
<td class="text-center"><?= $row['elapsed_dt'] ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$nRow++;
|
||||
endforeach;
|
||||
?>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
728
app/Views/pages/manage/areas/lists.php
Normal file
728
app/Views/pages/manage/areas/lists.php
Normal file
@@ -0,0 +1,728 @@
|
||||
<?= $this->extend('layouts/main') ?>
|
||||
|
||||
<?= $this->section('content') ?>
|
||||
<style>
|
||||
th {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
#svcList tbody tr {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.blockUI {
|
||||
z-index: 1500 !important;
|
||||
}
|
||||
|
||||
.swal2-cancel {
|
||||
background-color: #ff0000 !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h1>지역 관리</h1>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-xl-12">
|
||||
<div class="main-card mb-3 card">
|
||||
<div class="card-body">
|
||||
<form class="row align-items-end" id="frm_srch_info" onsubmit="return false;">
|
||||
|
||||
<div class="col-md-4">
|
||||
<label class="form-label mb-1">지역검색</label>
|
||||
<div class="row g-2">
|
||||
<div class="col-4">
|
||||
<select class="form-control" name="srcSido" id="srcSido">
|
||||
<option value="">시/도</option>
|
||||
<?php foreach ($sido as $s): ?>
|
||||
<option value="<?= $s['region_cd'] ?>"><?= $s['region_nm'] ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<select class="form-control" name="srcGugun" id="srcGugun">
|
||||
<option value="">시/군/구</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<select class="form-control" name="srcDong" id="srcDong">
|
||||
<option value="">읍/면/동</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<label class="form-label mb-1">소속팀</label>
|
||||
<div class="row g-2">
|
||||
<div class="col-6">
|
||||
<select class="form-control" name="srcUserbonbu" id="srcUserbonbu">
|
||||
<option value="">선택</option>
|
||||
<?php foreach ($bonbu as $d): ?>
|
||||
<option value="<?= $d['dept_sq'] ?>"><?= $d['dept_nm'] ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<select class="form-control" name="srcUserteam" id="srcUserteam">
|
||||
<option value="">선택</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1">
|
||||
<label class="form-label mb-1">지정 유무</label>
|
||||
<select class="form-control" name="positionYn">
|
||||
<option value="">선택</option>
|
||||
<option value="Y">지정</option>
|
||||
<option value="N">미지정</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- 검색 버튼 -->
|
||||
<div class="col-md-1 d-grid">
|
||||
<button type="button" class="btn btn-primary" id="btnSearch">
|
||||
검색
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-12 col-xl-12">
|
||||
<div class="main-card mb-3 card">
|
||||
<div class="card-header">조직 관리</div>
|
||||
<div class="card-body">
|
||||
<table id="svcList" class="table table-hover table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>지역코드</th>
|
||||
<th>지역</th>
|
||||
<th>관할조직</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- 여기는 비워둠: AJAX로 채움 -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer d-flex gap-2">
|
||||
<button type="button" class="btn btn-light" id="btnAllSave">
|
||||
일괄저장
|
||||
</button>
|
||||
|
||||
<button type="button" class="btn btn-primary" id="btnSave">
|
||||
저장
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?= $this->section('modals') ?>
|
||||
<div class="modal fade" id="regionModal" tabindex="-1" aria-labelledby="regionModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5" id="regionModalLabel">관할조직 일괄저장</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="frm_region_info" class="needs-validation" onsubmit="return false;" novalidate>
|
||||
<input type="hidden" name="type" value="create">
|
||||
<!-- 1 row -->
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">소속본부</label>
|
||||
<select id="mBonbu" class="form-select" required>
|
||||
<option value="">본부 선택</option>
|
||||
<?php foreach ($bonbu as $d): ?>
|
||||
<option value="<?= $d['dept_sq'] ?>"><?= $d['dept_nm'] ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">소속팀</label>
|
||||
<select id="mTeam" class="form-select" required>
|
||||
<option value="">팀 선택</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">담당자</label>
|
||||
<select id="mUser" class="form-select" required>
|
||||
<option value="">담당자 선택</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div><small>현재 그리드의 데이터를 일괄 저장합니다.</small></div>
|
||||
</div>
|
||||
<div class="modal-footer d-flex gap-2">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
|
||||
<button type="button" class="btn btn-primary" id="allSave">저장</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css" />
|
||||
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
|
||||
<script defer src="/architectui/assets/js/datatable.kor.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
const tpl = document.querySelector('.my-loader-template');
|
||||
|
||||
const bonbuArr = <?= json_encode($bonbu, JSON_UNESCAPED_UNICODE); ?>;
|
||||
const teamArr = <?= json_encode($team, JSON_UNESCAPED_UNICODE); ?>;
|
||||
const userArr = <?= json_encode($user, JSON_UNESCAPED_UNICODE); ?>;
|
||||
|
||||
$(function () {
|
||||
|
||||
$("#srcSido, #srcGugun").on("change", function (e) {
|
||||
|
||||
const targetId = this.id;
|
||||
|
||||
$.ajax({
|
||||
url: "/manage/areas/getAreaList",
|
||||
method: "POST",
|
||||
dataType: "json",
|
||||
data: {
|
||||
'srcSido': $("#frm_srch_info [name=srcSido]").val(),
|
||||
'srcGugun': $("#frm_srch_info [name=srcGugun]").val(),
|
||||
},
|
||||
beforeSend: function () {
|
||||
blockUI.blockPage({
|
||||
message: tpl
|
||||
})
|
||||
},
|
||||
complete: function () {
|
||||
blockUI.unblockPage()
|
||||
},
|
||||
success: function (result) {
|
||||
|
||||
switch (targetId) {
|
||||
case "srcSido":
|
||||
console.log(result)
|
||||
$("#srcGugun").empty()
|
||||
var str = "";
|
||||
str += "<option value=''>시/군/구</option>";
|
||||
|
||||
if (result.length > 0) {
|
||||
for (var i = 0; i < result.length; i++) {
|
||||
str += "<option value='" + result[i]['region_cd'] + "'>" + result[i].region_nm + "</option>";
|
||||
}
|
||||
}
|
||||
|
||||
$("#srcGugun").append(str);
|
||||
break;
|
||||
|
||||
case "srcGugun":
|
||||
$("#srcDong").empty()
|
||||
var str = "";
|
||||
str += "<option value=''>읍/면/동</option>";
|
||||
|
||||
if (result.length > 0) {
|
||||
for (var i = 0; i < result.length; i++) {
|
||||
str += "<option value='" + result[i]['region_cd'] + "'>" + result[i].region_nm + "</option>";
|
||||
}
|
||||
}
|
||||
|
||||
$("#srcDong").append(str);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#mBonbu, #mTeam").on("change", function (e) {
|
||||
const targetId = this.id;
|
||||
|
||||
var str = "";
|
||||
if (targetId === "mBonbu") {
|
||||
const dept_sq = $("#mBonbu").val();
|
||||
|
||||
str += `<option value="">팀 선택</option>`;
|
||||
if (teamArr.length > 0) {
|
||||
for (var i = 0; i < teamArr.length; i++) {
|
||||
|
||||
// 이 팀이 현재 본부에 속한 팀인지 체크
|
||||
if (String(teamArr[i].pdept_sq) === String(dept_sq)) {
|
||||
str += `
|
||||
<option value="${teamArr[i].dept_sq}">${teamArr[i].dept_nm}</option>
|
||||
`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$("#mTeam").html(str);
|
||||
|
||||
} else if (targetId === "mTeam") {
|
||||
const dept_sq = $("#mTeam").val();
|
||||
|
||||
str += `<option value="">담당자 선택</option>`;
|
||||
if (userArr.length > 0) {
|
||||
for (var i = 0; i < userArr.length; i++) {
|
||||
|
||||
// 이 팀이 현재 본부에 속한 팀인지 체크
|
||||
if (String(userArr[i].dept_sq) === String(dept_sq)) {
|
||||
str += `
|
||||
<option value="${userArr[i].usr_sq}">${userArr[i].usr_nm}</option>
|
||||
`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$("#mUser").html(str);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
$("#srcUserbonbu").on("change", function (e) {
|
||||
|
||||
const value = e.target.value
|
||||
|
||||
$("#srcUserteam").empty()
|
||||
|
||||
var str = "<option value=''>선택</option>"
|
||||
if (teamArr != null) {
|
||||
|
||||
for (var i = 0; i < teamArr.length; i++) {
|
||||
if (value === teamArr[i].pdept_sq) {
|
||||
str += "<option value='" + teamArr[i].dept_sq + "'>" + teamArr[i].dept_nm + "</option>"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$("#srcUserteam").append(str)
|
||||
|
||||
});
|
||||
|
||||
|
||||
let table = $('#svcList').DataTable({
|
||||
language: lang_kor,
|
||||
processing: true,
|
||||
serverSide: false,
|
||||
ajax: {
|
||||
url: '/manage/areas/getSvcArea',
|
||||
type: 'GET',
|
||||
data: function (d) {
|
||||
d.srcSido = $("#frm_srch_info [name=srcSido]").val()
|
||||
d.srcGugun = $("#frm_srch_info [name=srcGugun]").val()
|
||||
d.srcDong = $("#frm_srch_info [name=srcDong]").val()
|
||||
d.srcUserbonbu = $("#frm_srch_info [name=srcUserbonbu]").val()
|
||||
d.srcUserteam = $("#frm_srch_info [name=srcUserteam]").val()
|
||||
d.positionYn = $("#frm_srch_info [name=positionYn]").val()
|
||||
|
||||
d.start = d.start || 0
|
||||
d.length = d.length || 10
|
||||
}
|
||||
},
|
||||
"columnDefs": [
|
||||
{ 'targets': '_all', "defaultContent": "" },
|
||||
// { 'className': 'text-center', 'targets': [0, 2, 3, 4] },
|
||||
],
|
||||
columns: [
|
||||
{
|
||||
"data": null,
|
||||
"width": "50px",
|
||||
"render": function (data, type, row, meta) {
|
||||
return meta.row + meta.settings._iDisplayStart + 1;
|
||||
}
|
||||
},
|
||||
{ data: 'region_cd', "width": "150px" },
|
||||
{ data: 'region_nm' },
|
||||
{ data: null, "render": fn_region_render },
|
||||
],
|
||||
// 옵션들 예시
|
||||
paging: true,
|
||||
searching: false,
|
||||
ordering: false,
|
||||
serverSide: true,
|
||||
});
|
||||
|
||||
|
||||
$('#svcList tbody').on('click', 'tr', function () {
|
||||
const row = table.row(this).data()
|
||||
if (!row) return
|
||||
|
||||
// const modalEl = document.getElementById('regionModal');
|
||||
// const myModal = new bootstrap.Modal(modalEl);
|
||||
// myModal.show();
|
||||
|
||||
});
|
||||
|
||||
// [검색] 버튼 눌렀을 때 다시 조회
|
||||
$('#btnSearch').on('click', function () {
|
||||
table.ajax.reload()
|
||||
});
|
||||
|
||||
// 본부선택 onchage
|
||||
$('#svcList').on('change', '.bonbu', function () {
|
||||
const bonbu = $(this).val();
|
||||
const rowIdx = $(this).data('index')
|
||||
|
||||
if (!bonbu) return;
|
||||
|
||||
fn_team_render(bonbu, rowIdx)
|
||||
|
||||
});
|
||||
|
||||
// 팀선택 onchage
|
||||
$('#svcList').on('change', '.team', function () {
|
||||
const team = $(this).val();
|
||||
const rowIdx = $(this).data('index')
|
||||
|
||||
if (!team) return;
|
||||
|
||||
fn_user_render(team, rowIdx)
|
||||
|
||||
});
|
||||
|
||||
// 지역관리 일괄저장 modal
|
||||
$("#btnAllSave").on("click", function () {
|
||||
|
||||
const modalEl = document.getElementById('regionModal');
|
||||
const myModal = new bootstrap.Modal(modalEl);
|
||||
myModal.show();
|
||||
|
||||
|
||||
});
|
||||
|
||||
// 지역관리정보저장
|
||||
$("#btnSave").on("click", function () {
|
||||
let rows = table.rows().data().toArray();
|
||||
|
||||
if (rows.length == 0) return;
|
||||
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
|
||||
var bonbu = $("#bonbu-" + i).val();
|
||||
var team = $("#team-" + i).val();
|
||||
var user = $("#user-" + i).val();
|
||||
|
||||
if (bonbu == "") {
|
||||
Swal.fire({
|
||||
title: (i + 1) + "행 본부 데이터 누락",
|
||||
icon: "error"
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (team == "") {
|
||||
Swal.fire({
|
||||
title: (i + 1) + "행 팀 데이터 누락",
|
||||
icon: "error"
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (user == "") {
|
||||
Swal.fire({
|
||||
title: (i + 1) + "행 담당자 데이터 누락",
|
||||
icon: "error"
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
rows[i].bonbu = $("#bonbu-" + i).val();
|
||||
rows[i].team = $("#team-" + i).val();
|
||||
rows[i].user = $("#user-" + i).val();
|
||||
|
||||
}
|
||||
|
||||
swal.fire({
|
||||
text: "저장 하시겠습니까?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonText: "예",
|
||||
cancelButtonText: "아니오",
|
||||
confirmButtonColor: "#3085d6",
|
||||
cancelButtonColor: "#ff0000",
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: '/manage/areas/saveRegion',
|
||||
contentType: 'application/json; charset=UTF-8',
|
||||
method: 'POST',
|
||||
data: JSON.stringify(rows),
|
||||
beforeSend: function () {
|
||||
blockUI.blockPage({
|
||||
message: tpl
|
||||
})
|
||||
},
|
||||
complete: function () {
|
||||
blockUI.unblockPage()
|
||||
},
|
||||
error: function (xhr, error, thrown) {
|
||||
blockUI.unblockPage()
|
||||
var msg = "";
|
||||
if (xhr.responseText != null) {
|
||||
msg = xhr.responseText
|
||||
} else {
|
||||
msg = "잠시후 다시 시도해 주세요."
|
||||
}
|
||||
|
||||
Swal.fire({
|
||||
title: msg,
|
||||
icon: "error"
|
||||
})
|
||||
},
|
||||
success: function (result) {
|
||||
|
||||
if (result.code == '0') {
|
||||
$("#btnSearch").trigger('click')
|
||||
Swal.fire({
|
||||
title: '정상 처리되었습니다.',
|
||||
icon: "success"
|
||||
|
||||
})
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: result.msg,
|
||||
icon: "error"
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// 지역관리 일괄저장
|
||||
$("#allSave").on("click", function () {
|
||||
|
||||
let rows = table.rows().data().toArray();
|
||||
|
||||
if (rows.length == 0) return;
|
||||
|
||||
var bonbu = $("#mBonbu").val();
|
||||
var team = $("#mTeam").val();
|
||||
var user = $("#mUser").val();
|
||||
|
||||
if (bonbu == "") {
|
||||
Swal.fire({
|
||||
title: "본부 데이터 누락",
|
||||
icon: "error"
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (team == "") {
|
||||
Swal.fire({
|
||||
title: "팀 데이터 누락",
|
||||
icon: "error"
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (user == "") {
|
||||
Swal.fire({
|
||||
title: "담당자 데이터 누락",
|
||||
icon: "error"
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
|
||||
rows[i].bonbu = bonbu;
|
||||
rows[i].team = team;
|
||||
rows[i].user = user;
|
||||
|
||||
}
|
||||
|
||||
swal.fire({
|
||||
text: "저장 하시겠습니까?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonText: "예",
|
||||
cancelButtonText: "아니오",
|
||||
confirmButtonColor: "#3085d6",
|
||||
cancelButtonColor: "#ff0000",
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: '/manage/areas/saveAllRegion',
|
||||
contentType: 'application/json; charset=UTF-8',
|
||||
method: 'POST',
|
||||
data: JSON.stringify(rows),
|
||||
beforeSend: function () {
|
||||
blockUI.blockPage({
|
||||
message: tpl
|
||||
})
|
||||
},
|
||||
complete: function () {
|
||||
blockUI.unblockPage()
|
||||
},
|
||||
error: function (xhr, error, thrown) {
|
||||
blockUI.unblockPage()
|
||||
var msg = "";
|
||||
if (xhr.responseText != null) {
|
||||
msg = xhr.responseText
|
||||
} else {
|
||||
msg = "잠시후 다시 시도해 주세요."
|
||||
}
|
||||
|
||||
Swal.fire({
|
||||
title: msg,
|
||||
icon: "error"
|
||||
})
|
||||
},
|
||||
success: function (result) {
|
||||
|
||||
if (result.code == '0') {
|
||||
regionModalHide()
|
||||
$("#btnSearch").trigger('click')
|
||||
Swal.fire({
|
||||
title: '정상 처리되었습니다.',
|
||||
icon: "success"
|
||||
|
||||
})
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: result.msg,
|
||||
icon: "error"
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
// 관할조직 render
|
||||
function fn_region_render(data, type, row, meta) {
|
||||
|
||||
var str = ""
|
||||
|
||||
str += `
|
||||
<div class="d-flex gap-1">
|
||||
<div class="flex-fill">
|
||||
`;
|
||||
|
||||
str += `<select class="form-control bonbu" id="bonbu-${meta.row}" data-index="${meta.row}">`;
|
||||
str += `<option value="">본부 선택</option>`;
|
||||
if (bonbuArr.length > 0) {
|
||||
for (var i = 0; i < bonbuArr.length; i++) {
|
||||
var selected = ""
|
||||
if (bonbuArr[i].dept_sq === row.pdept_sq) selected = "selected"
|
||||
|
||||
str += `
|
||||
<option value="${bonbuArr[i].dept_sq}" ${selected}>${bonbuArr[i].dept_nm}</option>
|
||||
`;
|
||||
}
|
||||
}
|
||||
str += `</select></div>`;
|
||||
|
||||
str += `<div class="flex-fill">`;
|
||||
str += `<select class="form-control team" id="team-${meta.row}" data-index="${meta.row}">`;
|
||||
str += `<option value="">팀 선택</option>`;
|
||||
const currentBonbuSq = row.pdept_sq; // 현재 행에서 선택된 본부 sq
|
||||
|
||||
if (teamArr.length > 0) {
|
||||
for (var i = 0; i < teamArr.length; i++) {
|
||||
|
||||
// 이 팀이 현재 본부에 속한 팀인지 체크
|
||||
if (String(teamArr[i].pdept_sq) === String(currentBonbuSq)) {
|
||||
|
||||
var selected = "";
|
||||
if (teamArr[i].dept_sq === row.dept_sq) selected = "selected";
|
||||
|
||||
str += `
|
||||
<option value="${teamArr[i].dept_sq}" ${selected}>${teamArr[i].dept_nm}</option>
|
||||
`;
|
||||
}
|
||||
}
|
||||
}
|
||||
str += `</select></div>`;
|
||||
|
||||
|
||||
str += `<div class="flex-fill">`;
|
||||
str += `<select class="form-control team-user" id="user-${meta.row}">`;
|
||||
str += `<option value="">담당자 선택</option>`;
|
||||
if (userArr.length > 0) {
|
||||
for (var i = 0; i < userArr.length; i++) {
|
||||
if (userArr[i].dept_sq == row.dept_sq) {
|
||||
var selected = ""
|
||||
if (userArr[i].usr_sq === row.usr_sq) selected = "selected"
|
||||
|
||||
str += `
|
||||
<option value="${userArr[i].usr_sq}" ${selected}>${userArr[i].usr_nm}</option>
|
||||
`;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
str += `</select></div>`;
|
||||
|
||||
|
||||
|
||||
|
||||
str += `</div></div>`;
|
||||
|
||||
return str
|
||||
}
|
||||
|
||||
// 팀 render
|
||||
function fn_team_render(dept_sq, idx) {
|
||||
str = `<option value="">팀 선택`;
|
||||
if (teamArr.length > 0) {
|
||||
for (var i = 0; i < teamArr.length; i++) {
|
||||
|
||||
// 이 팀이 현재 본부에 속한 팀인지 체크
|
||||
if (String(teamArr[i].pdept_sq) === String(dept_sq)) {
|
||||
str += `<option value="${teamArr[i].dept_sq}">${teamArr[i].dept_nm}</option>`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$("#team-" + idx).html(str)
|
||||
fn_user_render("", idx)
|
||||
}
|
||||
|
||||
// 유저 render
|
||||
function fn_user_render(dept_sq, idx) {
|
||||
str = `<option value="">담당자 선택`;
|
||||
if (dept_sq != "") {
|
||||
if (userArr.length > 0) {
|
||||
for (var i = 0; i < userArr.length; i++) {
|
||||
|
||||
// 이 팀이 현재 본부에 속한 팀인지 체크
|
||||
if (String(userArr[i].dept_sq) === String(dept_sq)) {
|
||||
str += `<option value="${userArr[i].usr_sq}">${userArr[i].usr_nm}</option>`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$("#user-" + idx).html(str)
|
||||
}
|
||||
|
||||
function regionModalHide() {
|
||||
const modalEl = document.getElementById('regionModal');
|
||||
const modal = bootstrap.Modal.getInstance(modalEl); // 기존 인스턴스 가져오기
|
||||
|
||||
if (modal) {
|
||||
modal.hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<?= $this->endSection() ?>
|
||||
@@ -112,6 +112,14 @@
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,11 @@
|
||||
text-overflow: ellipsis;
|
||||
max-width: 180px;
|
||||
}
|
||||
|
||||
.swal2-cancel {
|
||||
background-color: #ff0000 !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h1>메뉴 관리</h1>
|
||||
@@ -38,15 +43,87 @@
|
||||
<div class="main-card mb-3 card">
|
||||
<div class="card-header">메뉴 정보</div>
|
||||
<div class="card-body">
|
||||
<form action="frm_menu_info" onsubmit="return false;">
|
||||
<div class="form-group">
|
||||
<form method="POST" id="frm_menu_info" name="frm_menu_info" onsubmit="return false;">
|
||||
<input type="hidden" name="depth" value="ROOT" />
|
||||
<input type="hidden" name="level" value="1" />
|
||||
|
||||
|
||||
<!-- 상위메뉴 -->
|
||||
<div class="position-relative row form-group mb-3">
|
||||
<label class="col-sm-2 col-form-label">상위메뉴</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="mnu_pid" readonly="readonly">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 메뉴아이디 -->
|
||||
<div class="position-relative row form-group mb-3">
|
||||
<label class="col-sm-2 col-form-label">메뉴아이디</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="mnu_id">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 메뉴명 -->
|
||||
<div class="position-relative row form-group mb-3">
|
||||
<label class="col-sm-2 col-form-label">메뉴명</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="mnu_nm">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 메뉴유형 -->
|
||||
<div class="position-relative row form-group mb-3">
|
||||
<label class="col-sm-2 col-form-label">메뉴유형</label>
|
||||
<div class="col-sm-10">
|
||||
<select class="form-control" name="mnu_tp">
|
||||
<option value="">선 택</option>
|
||||
<!-- <option value="R">루트</option> -->
|
||||
<option value="D">디렉토리</option>
|
||||
<option value="P">화면</option>
|
||||
<!-- <option value="A">기능</option>
|
||||
<option value="L">화면링크</option> -->
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 경로 -->
|
||||
<div class="position-relative row form-group mb-3">
|
||||
<label class="col-sm-2 col-form-label">경로</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="mnu_url">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 정렬순서 -->
|
||||
<div class="position-relative row form-group mb-3">
|
||||
<label class="col-sm-2 col-form-label">정렬순서</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="view_odr">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 사용여부 -->
|
||||
<div class="position-relative row form-group mb-3">
|
||||
<label class="col-sm-2 col-form-label">사용여부</label>
|
||||
<div class="col-sm-10">
|
||||
<select class="form-control" name="use_yn">
|
||||
<option value="Y" selected>사용</option>
|
||||
<option value="N">미사용</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="card-footer d-flex justify-content-end gap-2">
|
||||
<button type="button" class="btn btn-success" id="btnNew">
|
||||
신규
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" id="btnSave">
|
||||
저장
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -64,9 +141,11 @@
|
||||
const tpl = document.querySelector('.my-loader-template')
|
||||
let date = new Date()
|
||||
|
||||
var tbl;
|
||||
|
||||
$(function () {
|
||||
|
||||
$("#menuList").jqGrid({
|
||||
tbl = $("#menuList").jqGrid({
|
||||
url: "/manage/menu/getMenuList",
|
||||
datatype: "json",
|
||||
mtype: "POST",
|
||||
@@ -84,14 +163,16 @@
|
||||
viewrecords: true,
|
||||
scrollrows: true,
|
||||
treeGridModel: 'adjacency',
|
||||
colNames: ['메뉴명', '메뉴ID', '메뉴유형코드', '메뉴유형', 'URL', '정렬순서'],
|
||||
colNames: ['메뉴명', '메뉴ID', '메뉴유형', 'URL', '정렬순서', '사용여부', '', ''],
|
||||
colModel: [
|
||||
{ name: 'mnu_nm', index: 'mnu_nm', width: 150 },
|
||||
{ name: 'mnu_id', index: 'mnu_id', width: 80 },
|
||||
{ name: 'menu_tp', index: 'menu_tp', width: 50, hidden: true },
|
||||
{ name: 'menu_tp_nm', index: 'menu_tp_nm', width: 100, align: "center" },
|
||||
{ name: 'mnu_tp_nm', index: 'mnu_tp_nm', width: 80, align: "center" },
|
||||
{ name: 'mnu_url', index: 'mnu_url', width: 200 },
|
||||
{ name: 'view_odr', index: 'view_odr', width: 50, align: "center" }
|
||||
{ name: 'view_odr', index: 'view_odr', width: 50, align: "center" },
|
||||
{ name: 'use_yn_nm', index: 'use_yn_nm', width: 50, align: "center" },
|
||||
{ name: 'mnu_tp', index: 'mnu_tp', hidden: true },
|
||||
{ name: 'use_yn', index: 'use_yn', hidden: true },
|
||||
],
|
||||
|
||||
jsonReader: {
|
||||
@@ -118,16 +199,167 @@
|
||||
$("#menuList")
|
||||
.jqGrid('setGridParam', { datatype: 'local' })
|
||||
.trigger("reloadGrid");
|
||||
}
|
||||
},
|
||||
onSelectRow: function (index, row) {
|
||||
|
||||
var rowKey = $('#menuList').jqGrid('getGridParam', 'selrow');
|
||||
if (rowKey) {
|
||||
var data = $('#menuList').jqGrid('getRowData', rowKey);
|
||||
|
||||
$("#frm_menu_info [name=level]").val(data.level);
|
||||
$("#frm_menu_info [name=mnu_pid]").val(data.mnu_pid);
|
||||
$("#frm_menu_info [name=mnu_id]").val(data.mnu_id);
|
||||
$("#frm_menu_info [name=mnu_nm]").val(data.mnu_nm);
|
||||
$("#frm_menu_info [name=mnu_url]").val(data.mnu_url);
|
||||
$("#frm_menu_info [name=mnu_tp]").val(data.mnu_tp);
|
||||
$("#frm_menu_info [name=view_odr]").val(data.view_odr);
|
||||
$("#frm_menu_info [name=use_yn]").val(data.use_yn);
|
||||
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
// 신규 btn click
|
||||
$("#btnNew").on("click", function () {
|
||||
const level = $("#frm_menu_info [name=level]").val();
|
||||
|
||||
if (level === "2") {
|
||||
$("#frm_menu_info [name=depth]").val("DIR");
|
||||
// $("#frm_menu_info [name=level]").val("1");
|
||||
|
||||
Swal.fire({
|
||||
title: "하위 메뉴 생성 불가",
|
||||
icon: "warning"
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
let id = $("#frm_menu_info [name=mnu_id]").val();
|
||||
if (id === "M") id = "0";
|
||||
|
||||
$("#frm_menu_info")[0].reset();
|
||||
$("#frm_menu_info [name=depth]").val("ROOT");
|
||||
$("#frm_menu_info [name=level]").val("1");
|
||||
$("#frm_menu_info [name=mnu_pid]").val(id);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
// 저장 btn click
|
||||
$("#btnSave").on("click", function () {
|
||||
|
||||
if ($("#frm_menu_info [name=mnu_id]").val() === "") {
|
||||
Swal.fire({
|
||||
title: "메뉴아이디를 입력해 주세요.",
|
||||
icon: "warning"
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if ($("#frm_menu_info [name=mnu_nm]").val() === "") {
|
||||
Swal.fire({
|
||||
title: "메뉴명을 입력해 주세요.",
|
||||
icon: "warning"
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if ($("#frm_menu_info [name=mnu_tp]").val() === "") {
|
||||
Swal.fire({
|
||||
title: "메뉴유형을 선택해 주세요.",
|
||||
icon: "warning"
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if ($("#frm_menu_info [name=mnu_url]").val() === "") {
|
||||
Swal.fire({
|
||||
title: "경로를 입력해 주세요.",
|
||||
icon: "warning"
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if ($("#frm_menu_info [name=view_odr]").val() === "") {
|
||||
Swal.fire({
|
||||
title: "순서를 입력해 주세요.",
|
||||
icon: "warning"
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
swal.fire({
|
||||
text: "저장 하시겠습니까?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonText: "예",
|
||||
cancelButtonText: "아니오",
|
||||
confirmButtonColor: "#3085d6",
|
||||
cancelButtonColor: "#ff0000",
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: '/manage/menu/saveMenu',
|
||||
contentType: 'application/x-www-form-urlencoded;charset=UTF-8',
|
||||
method: 'POST',
|
||||
data: $("#frm_menu_info").serialize(),
|
||||
beforeSend: function () {
|
||||
blockUI.blockPage({
|
||||
message: tpl
|
||||
})
|
||||
},
|
||||
complete: function () {
|
||||
blockUI.unblockPage()
|
||||
},
|
||||
error: function (xhr, error, thrown) {
|
||||
blockUI.unblockPage()
|
||||
var msg = "";
|
||||
if (xhr.responseText != null) {
|
||||
msg = xhr.responseText
|
||||
} else {
|
||||
msg = "잠시후 다시 시도해 주세요."
|
||||
}
|
||||
|
||||
Swal.fire({
|
||||
title: msg,
|
||||
icon: "error"
|
||||
})
|
||||
},
|
||||
success: function (result) {
|
||||
tbl.ajax.reload();
|
||||
clearForm();
|
||||
|
||||
if (result.code == '0') {
|
||||
Swal.fire({
|
||||
title: '정상 처리되었습니다.',
|
||||
icon: "success"
|
||||
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: result.msg,
|
||||
icon: "error"
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
// 폼초기화
|
||||
function clearForm() {
|
||||
$("#frm_menu_info")[0].reset();
|
||||
$("#frm_menu_info [name=depth]").val("ROOT");
|
||||
$("#frm_menu_info [name=level]").val("1");
|
||||
$("#frm_menu_info [name=mnu_pid]").val("0");
|
||||
}
|
||||
|
||||
</script>
|
||||
<?= $this->endSection() ?>
|
||||
272
app/Views/pages/manage/permit/lists.php
Normal file
272
app/Views/pages/manage/permit/lists.php
Normal file
@@ -0,0 +1,272 @@
|
||||
<?= $this->extend('layouts/main') ?>
|
||||
|
||||
<?= $this->section('content') ?>
|
||||
<style>
|
||||
th {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
#logList tbody tr {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.blockUI {
|
||||
z-index: 1500 !important;
|
||||
}
|
||||
|
||||
.ellipsis {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 180px;
|
||||
}
|
||||
|
||||
.swal2-cancel {
|
||||
background-color: #ff0000 !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h1>권한 관리</h1>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-7 col-xl-7">
|
||||
<div class="main-card mb-3 card">
|
||||
<div class="card-header d-flex align-items-center">
|
||||
<!-- 제목 -->
|
||||
<h3 class="card-title mb-0">메뉴 목록</h3>
|
||||
|
||||
<!-- 오른쪽 툴 영역 -->
|
||||
<div class="card-tools d-flex align-items-center ms-auto gap-2">
|
||||
<div class="input-group input-group-sm">
|
||||
<select class="form-control" id="usrlevel">
|
||||
<option value="">그룹 선택</option>
|
||||
<?php foreach ($usrLevel as $d): ?>
|
||||
<option value="<?= $d['cd'] ?>"><?= $d['cd_nm'] ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<button type="button" class="btn btn-primary btn-sm" id="btnSave">
|
||||
저장
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<!-- <table id="menuList" class="table table-hover table-striped table-bordered"></table> -->
|
||||
<div id="menuTree"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form class="form-horizontal" id="permissionSrcFrm" name="permissionSrcFrm">
|
||||
<input type="hidden" name="usr_level" id="usr_level" />
|
||||
<input type="hidden" name="mnu_cd" id="mnu_cd" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- The jqGrid language file code-->
|
||||
<script type="text/javascript" src="//cdn.jsdelivr.net/jqgrid/4.6.0/i18n/grid.locale-kr.js">
|
||||
</script>
|
||||
<!-- The atual jqGrid code -->
|
||||
<script type="text/javascript" src="//cdn.jsdelivr.net/jqgrid/4.6.0/jquery.jqGrid.src.js">
|
||||
</script>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/free-jqgrid/4.15.5/css/ui.jqgrid.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="/plugin/css/jsTree/style.min.css">
|
||||
<script src="/plugin/js/jqgrid/jstree.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
const tpl = document.querySelector('.my-loader-template')
|
||||
let date = new Date()
|
||||
|
||||
$(function () {
|
||||
|
||||
// 그룹 onchange
|
||||
$("#usrlevel").on("change", function () {
|
||||
|
||||
|
||||
if ($(this).val() === "") {
|
||||
$('#menuTree').jstree('destroy');
|
||||
return;
|
||||
}
|
||||
|
||||
changeAuthCombo($(this).val());
|
||||
|
||||
});
|
||||
|
||||
|
||||
// 저장 btn click
|
||||
$("#btnSave").on("click", function () {
|
||||
|
||||
const usr_level = $("#usr_level").val();
|
||||
|
||||
if (usr_level === "") {
|
||||
Swal.fire({
|
||||
title: "그룹을 선택해 주세요.",
|
||||
icon: "error"
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
swal.fire({
|
||||
text: "저장 하시겠습니까?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonText: "예",
|
||||
cancelButtonText: "아니오",
|
||||
confirmButtonColor: "#3085d6",
|
||||
cancelButtonColor: "#ff0000",
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
|
||||
var checked_value = [];
|
||||
checked_value.push($("#menuTree").jstree("get_checked"));
|
||||
$("#menuTree .jstree-undetermined").parent().parent().each(function () {
|
||||
checked_value.push(this.id);
|
||||
});
|
||||
$("#permissionSrcFrm [name=mnu_cd]").val(checked_value);
|
||||
|
||||
$.ajax({
|
||||
url: '/manage/permit/saveMenuAuth',
|
||||
contentType: 'application/x-www-form-urlencoded;charset=UTF-8',
|
||||
method: 'POST',
|
||||
data: $("#permissionSrcFrm").serialize(),
|
||||
beforeSend: function () {
|
||||
blockUI.blockPage({
|
||||
message: tpl
|
||||
})
|
||||
},
|
||||
complete: function () {
|
||||
blockUI.unblockPage()
|
||||
},
|
||||
error: function (xhr, error, thrown) {
|
||||
blockUI.unblockPage()
|
||||
var msg = "";
|
||||
if (xhr.responseText != null) {
|
||||
msg = xhr.responseText
|
||||
} else {
|
||||
msg = "잠시후 다시 시도해 주세요."
|
||||
}
|
||||
|
||||
Swal.fire({
|
||||
title: msg,
|
||||
icon: "error"
|
||||
})
|
||||
},
|
||||
success: function (result) {
|
||||
|
||||
if (result.code == '0') {
|
||||
Swal.fire({
|
||||
title: '정상 처리되었습니다.',
|
||||
icon: "success"
|
||||
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
location.reload();
|
||||
}, 1500);
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: result.msg,
|
||||
icon: "error"
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// 메뉴 목록 및 권한 조회
|
||||
function changeAuthCombo(code) {
|
||||
$("#usr_level").val(code);
|
||||
$('#menuTree').jstree('destroy');
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: '/manage/permit/getMenuAuthList',
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
usr_level: code
|
||||
},
|
||||
beforeSend: function () {
|
||||
// 호출 직전에 실행
|
||||
console.log("로딩 시작");
|
||||
blockUI.blockPage({
|
||||
message: tpl
|
||||
});
|
||||
},
|
||||
complete: function () {
|
||||
// 완료 시(성공/실패 모두)
|
||||
console.log("로딩 종료");
|
||||
blockUI.unblockPage();
|
||||
},
|
||||
error: function (xhr) {
|
||||
console.error("에러", xhr);
|
||||
},
|
||||
success: function (data) {
|
||||
const filteredData = data;
|
||||
|
||||
|
||||
$('#menuTree').jstree({
|
||||
'core': {
|
||||
'data': filteredData
|
||||
},
|
||||
'checkbox': {
|
||||
keep_selected_style: false
|
||||
},
|
||||
'plugins': ['checkbox']
|
||||
}).on('loaded.jstree', function () {
|
||||
$('#menuTree').jstree('open_all');
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
uncheckedItem(data);
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
// $.getJSON('/manage/permit/getMenuAuthList?usr_level=' + code, function (data) {
|
||||
// const filteredData = data;
|
||||
|
||||
|
||||
// $('#menuTree').jstree({
|
||||
// 'core': {
|
||||
// 'data': filteredData
|
||||
// },
|
||||
// 'checkbox': {
|
||||
// keep_selected_style: false
|
||||
// },
|
||||
// 'plugins': ['checkbox']
|
||||
// }).on('loaded.jstree', function () {
|
||||
// $('#menuTree').jstree('open_all');
|
||||
// });
|
||||
|
||||
// setTimeout(() => {
|
||||
// uncheckedItem(data);
|
||||
// }, 500);
|
||||
|
||||
|
||||
// });
|
||||
|
||||
}
|
||||
|
||||
function uncheckedItem(data) {
|
||||
data.map(item => {
|
||||
const newItem = { ...item };
|
||||
if (newItem.state && newItem.state.selected === false) {
|
||||
$('#menuTree').jstree('uncheck_node', newItem.id);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
<?= $this->endSection() ?>
|
||||
@@ -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() ?>
|
||||
462
app/Views/pages/manage/scomplex/lists.php
Normal file
462
app/Views/pages/manage/scomplex/lists.php
Normal file
@@ -0,0 +1,462 @@
|
||||
<?= $this->extend('layouts/main') ?>
|
||||
|
||||
<?= $this->section('content') ?>
|
||||
<style>
|
||||
th {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
#scomplexList tbody tr {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.blockUI {
|
||||
z-index: 1500 !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h1>특이단지 관리</h1>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-xl-12">
|
||||
<div class="main-card mb-3 card">
|
||||
<div class="card-body">
|
||||
<form class="row g-3 align-items-end" id="frm_srch_info" onsubmit="return false;">
|
||||
|
||||
<!-- 1행 -->
|
||||
<div class="col-md-2">
|
||||
<label class="form-label">단지명</label>
|
||||
<input type="text" class="form-control" name="name" placeholder="단지명 입력">
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<label class="form-label">사용 승인/종료일</label>
|
||||
<div class="row g-2">
|
||||
<div class="col-5">
|
||||
<input type="date" class="form-control" name="apporval_date">
|
||||
</div>
|
||||
<div class="col-2 text-center" style="line-height: 35px;">~</div>
|
||||
<div class="col-5">
|
||||
<input type="date" class="form-control" name="end_date">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<label class="form-label">매물 종류</label>
|
||||
<select class="form-control" name="cd">
|
||||
<option value="">선택</option>
|
||||
<?php foreach ($code as $c): ?>
|
||||
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- 2행 -->
|
||||
<div class="col-md-1">
|
||||
<label class="form-label">단지코드</label>
|
||||
<input type="text" class="form-control" name="code">
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">단지주소</label>
|
||||
<input type="text" class="form-control" name="address">
|
||||
</div>
|
||||
|
||||
<!-- 버튼 -->
|
||||
<div class="col-md-1 d-grid">
|
||||
<button type="button" class="btn btn-primary" id="btnSearch">
|
||||
검색
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1 d-grid">
|
||||
<button type="button" class="btn btn-outline-success" id="btnExcel">
|
||||
<i class="fa fas fa-file-excel-o"></i> 엑셀 다운로드
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-12 col-xl-12">
|
||||
<div class="main-card mb-3 card">
|
||||
<div class="card-header">조직 관리</div>
|
||||
<div class="card-body">
|
||||
<table id="scomplexList" class="table table-hover table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>등록일자</th>
|
||||
<th>단지코드</th>
|
||||
<th>단지명</th>
|
||||
<th>단지주소</th>
|
||||
<th>매물종류</th>
|
||||
<th>승인일자</th>
|
||||
<th>종료일자</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- 여기는 비워둠: AJAX로 채움 -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<button type="button" class="btn btn-primary" id="addPhone">
|
||||
등록
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?= $this->section('modals') ?>
|
||||
<div class="modal fade" id="deptModal" tabindex="-1" aria-labelledby="deptModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5" id="deptModalLabel">특이단지 정보</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="frm_scomplex_info" class="needs-validation" onsubmit="return false;" novalidate>
|
||||
<input type="hidden" name="type" value="create" />
|
||||
<input type="hidden" name="sm_seq" />
|
||||
<div class="row g-3">
|
||||
<!-- 단지명 -->
|
||||
<div class="col-md-4">
|
||||
<label for="name" class="form-label mb-1">단지명</label>
|
||||
<input type="text" class="form-control" name="sm_name" id="sm_name" required>
|
||||
</div>
|
||||
|
||||
<!-- 사용승인일 -->
|
||||
<div class="col-md-4">
|
||||
<label for="apporval_date" class="form-label mb-1">사용승인일</label>
|
||||
<input type="date" class="form-control date_picker" name="sm_apporval_date"
|
||||
id="sm_apporval_date" required>
|
||||
</div>
|
||||
|
||||
<!-- 승인종료일 -->
|
||||
<div class="col-md-4">
|
||||
<label for="end_date" class="form-label mb-1">승인종료일</label>
|
||||
<input type="date" class="form-control date_picker" name="sm_end_date" id="sm_end_date"
|
||||
required>
|
||||
</div>
|
||||
|
||||
<!-- 단지코드 -->
|
||||
<div class="col-md-4">
|
||||
<label for="code" class="form-label mb-1">단지코드</label>
|
||||
<input type="text" class="form-control" name="sm_code" id="sm_code" required>
|
||||
</div>
|
||||
|
||||
<!-- 단지주소 -->
|
||||
<div class="col-6">
|
||||
<label for="address" class="form-label mb-1">단지주소</label>
|
||||
<input type="text" class="form-control" name="sm_address" id="sm_address" required>
|
||||
</div>
|
||||
|
||||
<!-- 매물 종류 -->
|
||||
<div class="col-md-2">
|
||||
<label for="cd" class="form-label mb-1">매물 종류</label>
|
||||
<select class="form-control" name="codes" id="codes" required>
|
||||
<option value="">-매물종류-</option>
|
||||
<?php foreach ($code as $c): ?>
|
||||
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<label for="address" class="form-label mb-1">메모</label>
|
||||
<textarea name="sm_memo" id="sm_memo" class="form-control" rows="2"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
|
||||
<button type="button" class="btn btn-primary" id="phoneSave">저장</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css" />
|
||||
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
|
||||
<script defer src="/architectui/assets/js/datatable.kor.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
const tpl = document.querySelector('.my-loader-template');
|
||||
|
||||
|
||||
$(function () {
|
||||
|
||||
$("#srchBonbu").on("change", function (e) {
|
||||
|
||||
var dept_sq = e.target.value
|
||||
|
||||
$("#srchTeam").empty()
|
||||
|
||||
var str = "<option value=''>선택</option>"
|
||||
if (teamArr != null) {
|
||||
|
||||
for (var i = 0; i < teamArr.length; i++) {
|
||||
if (dept_sq === teamArr[i].pdept_sq) {
|
||||
str += "<option value='" + teamArr[i].dept_sq + "'>" + teamArr[i].dept_nm + "</option>"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$("#srchTeam").append(str)
|
||||
|
||||
});
|
||||
|
||||
|
||||
let table = $('#scomplexList').DataTable({
|
||||
language: lang_kor,
|
||||
processing: true,
|
||||
serverSide: false,
|
||||
ajax: {
|
||||
url: '/manage/scomplex/getScomplexList',
|
||||
type: 'GET',
|
||||
data: function (d) {
|
||||
d.name = $("#frm_srch_info [name=name]").val()
|
||||
d.apporval_date = $("#frm_srch_info [name=apporval_date]").val()
|
||||
d.end_date = $("#frm_srch_info [name=end_date]").val()
|
||||
d.code = $("#frm_srch_info [name=code]").val()
|
||||
d.cd = $("#frm_srch_info [name=cd]").val()
|
||||
d.address = $("#frm_srch_info [name=address]").val()
|
||||
|
||||
d.start = d.start || 0
|
||||
d.length = d.length || 10
|
||||
}
|
||||
},
|
||||
"columnDefs": [
|
||||
{ 'targets': '_all', "defaultContent": "" },
|
||||
// { 'className': 'text-center', 'targets': [0, 2, 3, 4] },
|
||||
],
|
||||
columns: [
|
||||
{
|
||||
"data": null,
|
||||
"width": "50px",
|
||||
"render": function (data, type, row, meta) {
|
||||
return meta.row + meta.settings._iDisplayStart + 1;
|
||||
}
|
||||
},
|
||||
{ data: 'insert_tm', "width": "150px" },
|
||||
{ data: 'sm_code', "width": "70px" },
|
||||
{ data: 'sm_name', "width": "200px" },
|
||||
{ data: 'sm_address' },
|
||||
{ data: 'cd_nm', "width": "80px" },
|
||||
{ data: 'sm_apporval_date', "width": "80px" },
|
||||
{ data: 'sm_end_date', "width": "80px" },
|
||||
],
|
||||
// 옵션들 예시
|
||||
paging: true,
|
||||
searching: false,
|
||||
ordering: false,
|
||||
serverSide: true,
|
||||
});
|
||||
|
||||
|
||||
$('#scomplexList tbody').on('click', 'tr', function () {
|
||||
const row = table.row(this).data()
|
||||
if (!row) return
|
||||
|
||||
const modalEl = document.getElementById('deptModal');
|
||||
const myModal = new bootstrap.Modal(modalEl);
|
||||
|
||||
$("#frm_scomplex_info")[0].reset()
|
||||
$("#frm_scomplex_info [name=type]").val("update")
|
||||
|
||||
$("#frm_scomplex_info [name=sm_seq]").val(row.sm_seq)
|
||||
$("#frm_scomplex_info [name=sm_name]").val(row.sm_name)
|
||||
$("#frm_scomplex_info [name=sm_code]").val(row.sm_code)
|
||||
$("#frm_scomplex_info [name=sm_address]").val(row.sm_address)
|
||||
$("#frm_scomplex_info [name=codes]").val(row.cd)
|
||||
$("#frm_scomplex_info [name=sm_apporval_date]").val(row.sm_apporval_date)
|
||||
$("#frm_scomplex_info [name=sm_end_date]").val(row.sm_end_date)
|
||||
$("#frm_scomplex_info [name=sm_memo]").val(row.sm_memo)
|
||||
|
||||
|
||||
myModal.show();
|
||||
|
||||
});
|
||||
|
||||
// [검색] 버튼 눌렀을 때 다시 조회
|
||||
$('#btnSearch').on('click', function () {
|
||||
table.ajax.reload()
|
||||
});
|
||||
|
||||
// 유저 등록 모달
|
||||
$("#addPhone").on("click", function () {
|
||||
$("#frm_scomplex_info")[0].reset()
|
||||
|
||||
$("#frm_scomplex_info [name=type]").val("create")
|
||||
$("#frm_scomplex_info [name=phone_number]").prop("readonly", false)
|
||||
|
||||
const modalEl = document.getElementById('deptModal');
|
||||
const myModal = new bootstrap.Modal(modalEl);
|
||||
myModal.show();
|
||||
});
|
||||
|
||||
|
||||
// 유저정보저장
|
||||
$("#phoneSave").on("click", function () {
|
||||
|
||||
const form = document.getElementById('frm_scomplex_info');
|
||||
|
||||
let isValid = true;
|
||||
|
||||
// Bootstrap5 기본 validation 적용
|
||||
if (!form.checkValidity()) {
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
if (!isValid) {
|
||||
form.classList.add('was-validated');
|
||||
return;
|
||||
}
|
||||
|
||||
swal.fire({
|
||||
text: "저장 하시겠습니까?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonText: "예",
|
||||
cancelButtonText: "아니오",
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
cancelButtonColor: "#d33",
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: '/manage/scomplex/saveScomplex',
|
||||
contentType: 'application/x-www-form-urlencoded;charset=UTF-8',
|
||||
method: 'POST',
|
||||
data: $("#frm_scomplex_info").serialize(),
|
||||
beforeSend: function () {
|
||||
blockUI.blockPage({
|
||||
message: tpl
|
||||
})
|
||||
},
|
||||
complete: function () {
|
||||
blockUI.unblockPage()
|
||||
},
|
||||
error: function (xhr, error, thrown) {
|
||||
blockUI.unblockPage()
|
||||
var msg = "";
|
||||
if (xhr.responseText != null) {
|
||||
msg = xhr.responseText
|
||||
} else {
|
||||
msg = "잠시후 다시 시도해 주세요."
|
||||
}
|
||||
|
||||
Swal.fire({
|
||||
title: msg,
|
||||
icon: "error"
|
||||
})
|
||||
},
|
||||
success: function (result) {
|
||||
|
||||
if (result.code == '0') {
|
||||
deptModalHide()
|
||||
$("#btnSearch").trigger('click')
|
||||
Swal.fire({
|
||||
title: '정상 처리되었습니다.',
|
||||
icon: "success"
|
||||
|
||||
})
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: result.msg,
|
||||
icon: "error"
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
// 엑셀다운 click
|
||||
$("#btnExcel").on("click", function () {
|
||||
|
||||
$.ajax({
|
||||
url: "/manage/scomplex/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);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function deptModalHide() {
|
||||
const modalEl = document.getElementById('deptModal');
|
||||
const modal = bootstrap.Modal.getInstance(modalEl); // 기존 인스턴스 가져오기
|
||||
|
||||
if (modal) {
|
||||
modal.hide();
|
||||
}
|
||||
}
|
||||
|
||||
// 엑셀 다운로드
|
||||
function downloadExcel(data) {
|
||||
const ws = XLSX.utils.json_to_sheet(data);
|
||||
ws['!cols'] = [
|
||||
{ wpx: 100 },
|
||||
{ wpx: 100 },
|
||||
{ wpx: 150 },
|
||||
{ wpx: 100 },
|
||||
{ wpx: 100 },
|
||||
{ wpx: 100 },
|
||||
{ wpx: 150 },
|
||||
{ wpx: 120 },
|
||||
];
|
||||
|
||||
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() ?>
|
||||
@@ -306,8 +306,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
console.log(str)
|
||||
|
||||
$("#srchTeam").append(str)
|
||||
|
||||
});
|
||||
@@ -594,6 +592,14 @@
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user