userControl 소스 동기화

main
mjkhan21 3 months ago
parent 4a2de2dc73
commit 826a46e603

@ -183,9 +183,18 @@ sggDepts.depts.onDatasetChange = obj => {
sggDepts.sggs.setData({sggList: ${sggs}}); sggDepts.sggs.setData({sggList: ${sggs}});
sggDepts.depts.setData({deptList: ${depts}}); sggDepts.depts.setData({deptList: ${depts}});
<c:if test="${!empty userInfo}">infoPrefixCtrl.setData([${userInfo}]);</c:if> var infoPrefixFields = new FormFields("#infoPrefix-form");
<c:if test="${!empty userInfo}">
var info = ${userInfo};
if (infoPrefixCtrl.dataset.empty)
infoPrefixCtrl.dataset.setData({userList: [info]});
else
infoPrefixCtrl.dataset.replace({data: info});
</c:if>
infoPrefixCtrl.setInfo = obj => { infoPrefixCtrl.setInfo = obj => {
infoPrefixFields.set(infoPrefixCtrl, obj);
obj = obj || infoPrefixCtrl.dataset.getCurrent("item"); obj = obj || infoPrefixCtrl.dataset.getCurrent("item");
let create = isEmpty(obj.data.USER_ACNT); let create = isEmpty(obj.data.USER_ACNT);
$("input[name='account']").prop("readonly", !create); $("input[name='account']").prop("readonly", !create);
@ -234,7 +243,7 @@ function saveinfoPrefix() {
dialog.alert({ dialog.alert({
content:"현재 prefixName 정보를 저장하시겠습니까?", content:"현재 prefixName 정보를 저장하시겠습니까?",
onOK:() => { onOK:() => {
infoPrefixCtrl.save(infoPrefixCtrl.toObject()); infoPrefixCtrl.save(infoPrefixFields.get());
} }
}); });
} }
@ -264,5 +273,7 @@ function setDepts(instCode) {
sggDepts.getDepts({instCode: instCode}); sggDepts.getDepts({instCode: instCode});
} }
$(infoPrefixCtrl.selector("[name='birthday']")).datePicker();
//# sourceURL=user-info.jsp //# sourceURL=user-info.jsp
</script> </script>

@ -7,7 +7,7 @@
<div class="d-flex flex-row justify-content-between p-3"> <div class="d-flex flex-row justify-content-between p-3">
<div> <div>
<div class="input-group"> <div class="input-group">
<select name="by" onchange="userCtrl.find('term').focus();" class="form-select"> <select name="by" onchange="userCtrl.find('name', 'term').focus();" class="form-select">
<option value="userName">이름</option> <option value="userName">이름</option>
<option value="userAccount">계정</option> <option value="userAccount">계정</option>
</select> </select>
@ -24,11 +24,11 @@
<table class="datatables-ajax table table-bordered dataTable no-footer"> <table class="datatables-ajax table table-bordered dataTable no-footer">
<thead name="userThead"> <thead name="userThead">
<tr><th tabindex="0" style="width: 158.828px; text-align:center;"><input onchange="userCtrl.select(this.checked);" type="checkbox" class="form-check-input"></th> <tr><th tabindex="0" style="width: 158.828px; text-align:center;"><input onchange="userCtrl.select(this.checked);" type="checkbox" class="form-check-input"></th>
<th data-field="USER_ACNT" class="sorting" style="width: 223.719px;">계정</th> <th style="width: 223.719px;">계정</th>
<th data-field="USER_NM" class="sorting" style="width: 146.156px;">이름</th> <th style="width: 146.156px;">이름</th>
<th class="sorting" style="width: 195.688px;">이메일</th> <th style="width: 195.688px;">이메일</th>
<th class="sorting" style="width: 160.141px;">전화번호(무선)</th> <th style="width: 160.141px;">전화번호(무선)</th>
<th class="sorting" style="width: 230.469px;">등록일자</th> <th style="width: 230.469px;">등록일자</th>
</tr> </tr>
</thead> </thead>
<tbody name="userList"> <tbody name="userList">
@ -62,8 +62,8 @@ var userCtrl = newUserControl();
userCtrl.search = () => { userCtrl.search = () => {
userCtrl.query = { userCtrl.query = {
by: userCtrl.find("by").value, by: userCtrl.find("name", "by").value,
term: userCtrl.find("term").value term: userCtrl.find("name", "term").value
}; };
userCtrl.load(1); userCtrl.load(1);
} }
@ -82,15 +82,15 @@ userCtrl.renderList = () => {
empty = userList.empty; empty = userList.empty;
let trs = empty ? let trs = empty ?
[userCtrl.find("userNotFound").innerHTML] : [userCtrl.find("name", "userNotFound").innerHTML] :
userList.inStrings( userList.inStrings(
userCtrl.find("userRow").innerHTML, userCtrl.find("name", "userRow").innerHTML,
(str, dataItem) => str (str, dataItem) => str
.replace(/{onclick}=""/gi, 'onclick="userCtrl.setCurrent(\'' + dataItem.getValue("USER_ID") + '\');"') .replace(/{onclick}=""/gi, 'onclick="userCtrl.setCurrent(\'{USER_ID}\');"')
.replace(/{ondblclick}=""/gi, 'ondblclick="userCtrl.getInfo(\'' + dataItem.getValue("USER_ID") + '\')"') .replace(/{ondblclick}=""/gi, 'ondblclick="userCtrl.getInfo({userID: \'{USER_ID}\'});"')
); );
userCtrl.find("userList").innerHTML = trs.join(""); userCtrl.find("name", "userList").innerHTML = trs.join("");
userCtrl.querySelector("[name='userThead'] th input[type='checkbox']").checked = false; userCtrl.find("[name='userThead'] th input[type='checkbox']").checked = false;
} }
userCtrl.onDatasetChange = obj => { userCtrl.onDatasetChange = obj => {
@ -116,12 +116,12 @@ userCtrl.onCurrentChange = item => {
userCtrl.onSelectionChange = selected => { userCtrl.onSelectionChange = selected => {
let userList = userCtrl.dataset; let userList = userCtrl.dataset;
let keys = selected.map(e => userList.getKey(e)); let keys = selected.map(e => userList.getKey(e));
userCtrl.querySelectorAll("[name='userList'] input[type='checkbox']") userCtrl.findAll("[name='userList'] input[type='checkbox']")
.forEach(node => { .forEach(node => {
node.checked = keys.includes(node.value); node.checked = keys.includes(node.value);
}); });
userCtrl.querySelectorAll(".enable-onfound") userCtrl.findAll(".enable-onfound")
.forEach(node => { .forEach(node => {
node.disabled = keys.length < 1; node.disabled = keys.length < 1;
}); });
@ -131,7 +131,6 @@ $(userCtrl.selector("[name='term']")).onEnterPress(userCtrl.search);
$(function(){ $(function(){
${onload} ${onload}
tableSorter(userCtrl, "th[data-field]");
userCtrl.setData({ userCtrl.setData({
userList:${userList}, userList:${userList},

@ -53,6 +53,12 @@
${functions} ${functions}
var currentUserCtrl = newUserControl(); var currentUserCtrl = newUserControl();
currentUserCtrl.prefix = "currentUser"; currentUserCtrl.prefix = "currentUser";
currentUserCtrl.onSave = resp => {
if (resp.saved) {
dialog.alert("저장됐습니다.");
dialog.close(currentUserCtrl.prefixed("dialog"));
}
};
function currentUserInfo() { function currentUserInfo() {
currentUserCtrl.dataset.clear(); currentUserCtrl.dataset.clear();

Loading…
Cancel
Save