UserControl 변경: class -> function
parent
239d18a496
commit
f1a79edf7a
@ -1,127 +1,125 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
|
||||
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
|
||||
<c:set var="prefixName" scope="request">사용자</c:set>
|
||||
<!-- Page Body -->
|
||||
<div class="card">
|
||||
<div class="card" data-doctx="select-user"><!-- Page Body -->
|
||||
<div class="card-datatable text-nowrap">
|
||||
<div id="DataTables_Table_0_wrapper" class="dataTables_wrapper dt-bootstrap5 no-footer">
|
||||
<div class="d-flex flex-row justify-content-between p-3">
|
||||
<div>
|
||||
<div class="input-group" id="DataTables_Table_0_length">
|
||||
<select id="_userBy" onchange="document.getElementById('_userTerm').focus();" aria-controls="DataTables_Table_0" class="form-select">
|
||||
<option value="${infoPrefix}Name">이름</option>
|
||||
<option value="${infoPrefix}Account">계정</option>
|
||||
<select name="by" onchange="userSelector.find('term').focus();" aria-controls="DataTables_Table_0" class="form-select">
|
||||
<option value="userName">이름</option>
|
||||
<option value="userAccount">계정</option>
|
||||
</select>
|
||||
<input id="_userTerm" autofocus type="text" placeholder="조회 조건을 입력하십시오." class="form-control">
|
||||
<input name="term" autofocus type="text" placeholder="조회 조건을 입력하십시오." class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<button onclick="search${infoPrefix}s();" class="btn btn-primary">찾기</button>
|
||||
<button onclick="userSelector.search();" class="btn btn-primary">찾기</button>
|
||||
</div>
|
||||
</div>
|
||||
<table class="datatables-ajax table table-bordered dataTable no-footer" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
|
||||
<thead id="_${infoPrefix}Thead">
|
||||
<tr><th tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" style="text-align:center;"><input onchange="${infoPrefix}Control.dataset.select(this.checked);" type="checkbox" class="form-check-input"></th>
|
||||
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending" >시군구명</th>
|
||||
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending" >기관명</th>
|
||||
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending" >부서명</th>
|
||||
<table class="datatables-ajax table table-bordered dataTable no-footer" >
|
||||
<thead name="userThead">
|
||||
<tr><th tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" style="text-align:center;"><input onchange="userSelector.dataset.select(this.checked);" type="checkbox" class="form-check-input"></th>
|
||||
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" >시군구명</th>
|
||||
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" >기관명</th>
|
||||
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" >부서명</th>
|
||||
<th class="sorting sorting_asc" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Full name: activate to sort column descending" >계정</th>
|
||||
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending" >이름</th>
|
||||
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Start date: activate to sort column ascending" >등록일자</th>
|
||||
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" >이름</th>
|
||||
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" >등록일자</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="_${infoPrefix}List">
|
||||
<tbody name="userList">
|
||||
</tbody>
|
||||
<template id="_${infoPrefix}Row">
|
||||
<template name="userRow">
|
||||
<tr data-key="{USER_ID}">
|
||||
<td style="text-align:center;"><input value="{USER_ID}" onchange="${infoPrefix}Control.dataset.select('{USER_ID}', this.checked);" type="checkbox" class="form-check-input"></td>
|
||||
<td onclick="${infoPrefix}Control.setCurrent('{USER_ID}')" ondblclick="${infoPrefix}Control.getInfo({})">{SGG_NM}</td>
|
||||
<td onclick="${infoPrefix}Control.setCurrent('{USER_ID}')" ondblclick="${infoPrefix}Control.getInfo({})">{INST_NM}</td>
|
||||
<td onclick="${infoPrefix}Control.setCurrent('{USER_ID}')" ondblclick="${infoPrefix}Control.getInfo({})">{DEPT_NM}</td>
|
||||
<td onclick="${infoPrefix}Control.setCurrent('{USER_ID}')" ondblclick="${infoPrefix}Control.getInfo({})">{USER_ACNT}</td>
|
||||
<td onclick="${infoPrefix}Control.setCurrent('{USER_ID}')" ondblclick="${infoPrefix}Control.getInfo({})">{USER_NM}</td>
|
||||
<td onclick="${infoPrefix}Control.setCurrent('{USER_ID}')" ondblclick="${infoPrefix}Control.getInfo({})">{REG_DT}</td>
|
||||
<td style="text-align:center;"><input value="{USER_ID}" onchange="userSelector.dataset.select('{USER_ID}', this.checked);" type="checkbox" class="form-check-input"></td>
|
||||
<td onclick="userSelector.setCurrent('{USER_ID}')" ondblclick="userSelector.getInfo({})">{SGG_NM}</td>
|
||||
<td onclick="userSelector.setCurrent('{USER_ID}')" ondblclick="userSelector.getInfo({})">{INST_NM}</td>
|
||||
<td onclick="userSelector.setCurrent('{USER_ID}')" ondblclick="userSelector.getInfo({})">{DEPT_NM}</td>
|
||||
<td onclick="userSelector.setCurrent('{USER_ID}')" ondblclick="userSelector.getInfo({})">{USER_ACNT}</td>
|
||||
<td onclick="userSelector.setCurrent('{USER_ID}')" ondblclick="userSelector.getInfo({})">{USER_NM}</td>
|
||||
<td onclick="userSelector.setCurrent('{USER_ID}')" ondblclick="userSelector.getInfo({})">{REG_DT}</td>
|
||||
</tr>
|
||||
</template>
|
||||
<template id="_${infoPrefix}NotFound">
|
||||
<template name="userNotFound">
|
||||
<tr class="odd">
|
||||
<td valign="top" colspan="7" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
|
||||
</tr>
|
||||
</template>
|
||||
</table>
|
||||
<div class="d-flex flex-row p-3 justify-content-between">
|
||||
<label id="_${infoPrefix}PagingInfo" class="dataTables_info" role="status" aria-live="polite"></label>
|
||||
<ul id="_${infoPrefix}Paging" class="pagination pagination-primary">
|
||||
<label name="userPagingInfo" class="dataTables_info" role="status" aria-live="polite"></label>
|
||||
<ul name="userPaging" class="pagination pagination-primary">
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--/ Page Body -->
|
||||
</div><!--/ Page Body -->
|
||||
<script >
|
||||
var ${infoPrefix}Control = new UserControl();
|
||||
var userSelector = newUserControl("select-user");
|
||||
|
||||
function getSelectedUser() {
|
||||
let selected = ${infoPrefix}Control.dataset.getKeys("selected");
|
||||
let selected = userSelector.dataset.getKeys("selected");
|
||||
if (selected.length < 1)
|
||||
return dialog.alert("사용자를 선택하십시오.");
|
||||
else
|
||||
return selected;
|
||||
}
|
||||
|
||||
function search${infoPrefix}s() {
|
||||
${infoPrefix}Control.query = {
|
||||
by:$("#_userBy").val(),
|
||||
term:$("#_userTerm").val()
|
||||
userSelector.search = () => {
|
||||
userSelector.query = {
|
||||
by: userSelector.find("by").value,
|
||||
term: userSelector.find("term").value
|
||||
};
|
||||
${infoPrefix}Control.load(1);
|
||||
userSelector.load(1);
|
||||
}
|
||||
|
||||
${infoPrefix}Control.onDatasetChange = obj => {
|
||||
let ${infoPrefix}List = ${infoPrefix}Control.dataset;
|
||||
let empty = ${infoPrefix}List.empty;
|
||||
userSelector.onDatasetChange = obj => {
|
||||
let list = userSelector.dataset;
|
||||
let empty = list.empty;
|
||||
|
||||
let trs = empty ?
|
||||
[document.getElementById("_${infoPrefix}NotFound").innerHTML] : <%-- from template#${infoPrefix}NotFound --%>
|
||||
${infoPrefix}List.inStrings(document.getElementById("_${infoPrefix}Row").innerHTML); <%-- from template#${infoPrefix}Row --%>
|
||||
$("#_${infoPrefix}List").html(trs.join());
|
||||
$("#_${infoPrefix}Thead").find("th input[type='checkbox']").prop("checked", false);
|
||||
[userSelector.find("userNotFound").innerHTML] :
|
||||
list.inStrings(userSelector.find("userRow").innerHTML);
|
||||
userSelector.find("userList").innerHTML = trs.join("");
|
||||
userSelector.querySelector("[name='userThead'] th input[type='checkbox']").checked = false;
|
||||
|
||||
$("#_${infoPrefix}Paging").setPaging({
|
||||
list:${infoPrefix}Control.dataset,
|
||||
prefix:${infoPrefix}Control.prefix,
|
||||
start:obj.${infoPrefix}Start,
|
||||
totalSize:obj.${infoPrefix}Total,
|
||||
fetchSize:obj.${infoPrefix}Fetch,
|
||||
func:"${infoPrefix}Control.load({index})"
|
||||
$(userSelector.selector("[name='userPaging']")).setPaging({
|
||||
list: list,
|
||||
prefix: userSelector.prefix,
|
||||
start: obj.userStart,
|
||||
totalSize: obj.userTotal,
|
||||
fetchSize: obj.userFetch,
|
||||
func:"userSelector.load({index})"
|
||||
});
|
||||
};
|
||||
|
||||
${infoPrefix}Control.onCurrentChange = item => {
|
||||
userSelector.onCurrentChange = item => {
|
||||
if (!item) return;
|
||||
|
||||
let key = item.data.USER_ID;
|
||||
$("#_${infoPrefix}List").setCurrentRow(key);
|
||||
$(userSelector.selector("[name='userList']")).setCurrentRow(key);
|
||||
};
|
||||
|
||||
${infoPrefix}Control.onSelectionChange = selected => {
|
||||
let ${infoPrefix}List = ${infoPrefix}Control.dataset;
|
||||
let keys = selected.map(e => ${infoPrefix}List.getKey(e));
|
||||
$("#_${infoPrefix}List input[type='checkbox']").each(function() {
|
||||
userSelector.onSelectionChange = selected => {
|
||||
let list = userSelector.dataset;
|
||||
let keys = selected.map(e => list.getKey(e));
|
||||
$(userSelector.selector("[name='userList'] input[type='checkbox']")).each(function() {
|
||||
let checkbox = $(this);
|
||||
checkbox.prop("checked", keys.includes(checkbox.val()));
|
||||
});
|
||||
};
|
||||
|
||||
$("#_userTerm").onEnterPress(search${infoPrefix}s);
|
||||
$(userSelector.selector("[name='term']")).onEnterPress(userSelector.search);
|
||||
|
||||
$(function(){
|
||||
${onload}
|
||||
${infoPrefix}Control.setData({
|
||||
${infoPrefix}List:${userList},
|
||||
${infoPrefix}Start:${userStart},
|
||||
${infoPrefix}Fetch:${userFetch},
|
||||
${infoPrefix}Total:${userTotal}
|
||||
userSelector.setData({
|
||||
userList:${userList},
|
||||
userStart:${userStart},
|
||||
userFetch:${userFetch},
|
||||
userTotal:${userTotal}
|
||||
});
|
||||
});
|
||||
//# sourceURL=select-user.jsp
|
||||
|
Loading…
Reference in New Issue