userControl 소스 동기화

main
mjkhan21 3 months ago
parent 4a2de2dc73
commit 826a46e603

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

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

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

Loading…
Cancel
Save