From 826a46e603476ef7f24bc677791c1f9a0648a610 Mon Sep 17 00:00:00 2001 From: mjkhan21 Date: Thu, 22 Aug 2024 15:49:05 +0900 Subject: [PATCH] =?UTF-8?q?userControl=20=EC=86=8C=EC=8A=A4=20=EB=8F=99?= =?UTF-8?q?=EA=B8=B0=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WEB-INF/jsp/base/user/user-info.jsp | 15 +++++++-- .../WEB-INF/jsp/base/user/user-main.jsp | 33 +++++++++---------- src/main/webapp/WEB-INF/jsp/include/top.jsp | 6 ++++ 3 files changed, 35 insertions(+), 19 deletions(-) diff --git a/src/main/webapp/WEB-INF/jsp/base/user/user-info.jsp b/src/main/webapp/WEB-INF/jsp/base/user/user-info.jsp index e46e5e9..f6b0995 100644 --- a/src/main/webapp/WEB-INF/jsp/base/user/user-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/base/user/user-info.jsp @@ -183,9 +183,18 @@ sggDepts.depts.onDatasetChange = obj => { sggDepts.sggs.setData({sggList: ${sggs}}); sggDepts.depts.setData({deptList: ${depts}}); -infoPrefixCtrl.setData([${userInfo}]); +var infoPrefixFields = new FormFields("#infoPrefix-form"); + + +var info = ${userInfo}; +if (infoPrefixCtrl.dataset.empty) + infoPrefixCtrl.dataset.setData({userList: [info]}); +else + infoPrefixCtrl.dataset.replace({data: info}); + 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 diff --git a/src/main/webapp/WEB-INF/jsp/base/user/user-main.jsp b/src/main/webapp/WEB-INF/jsp/base/user/user-main.jsp index e3efa91..5f2cd2f 100644 --- a/src/main/webapp/WEB-INF/jsp/base/user/user-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/base/user/user-main.jsp @@ -7,7 +7,7 @@
- @@ -24,11 +24,11 @@ - - - - - + + + + + @@ -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}, diff --git a/src/main/webapp/WEB-INF/jsp/include/top.jsp b/src/main/webapp/WEB-INF/jsp/include/top.jsp index 51ec56c..463aab0 100644 --- a/src/main/webapp/WEB-INF/jsp/include/top.jsp +++ b/src/main/webapp/WEB-INF/jsp/include/top.jsp @@ -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();