통합조회 그리드 체크박스 처리 수정

main
이범준 4 months ago
parent 861d2a3c59
commit 7563adf995

@ -123,6 +123,16 @@ $(document).ready(function() {
var checkbox = $(this);
checkbox.prop("checked", keys.includes(checkbox.val()));
});
let status = getCheckboxesStatus($("#upTbody--${pageName}").find("input[type='checkbox']"));
let thc = $("#upTheadTr--${pageName}").find("input[type='checkbox']");
if(status == 1 && !thc.is(":checked")){
thc.prop("checked", true);
} else if(status == -1 && thc.is(":checked")){
thc.prop("checked", false);
}
};
$P.integrationSearchControl.downDataset.onSelectionChange = (selectedArr) => {
@ -133,8 +143,37 @@ $(document).ready(function() {
var checkbox = $(this);
checkbox.prop("checked", keys.includes(checkbox.val()));
});
let status = getCheckboxesStatus($("#downTbody--${pageName}").find("input[type='checkbox']"));
let thc = $("#downTheadTr--${pageName}").find("input[type='checkbox']");
if(status == 1 && !thc.is(":checked")){
thc.prop("checked", true);
} else if(status == -1 && thc.is(":checked")){
thc.prop("checked", false);
}
};
//그리드 체크박스
$P.selectCheckbox = (obj, arg1, arg2) => {
let table = $(obj).parent().parent().parent().parent();
let id = table[0].id;
if(id.startsWith("up")){
if(arg2 != null){
pageObject['${pageName}'].integrationSearchControl.upDataset.select(arg1, arg2);
} else {
pageObject['${pageName}'].integrationSearchControl.upDataset.select(arg1);
}
} else if(id.startsWith("down")){
if(arg2 != null){
pageObject['${pageName}'].integrationSearchControl.downDataset.select(arg1, arg2);
} else {
pageObject['${pageName}'].integrationSearchControl.downDataset.select(arg1);
}
}
}
$P.toast = new bootstrap.Toast(document.getElementById('divToast--${pageName}'), {
animation: true,
autohide: true,
@ -859,4 +898,17 @@ $(document).ready(function() {
});
function getCheckboxesStatus($checkboxes){
if($checkboxes.length == 0){
return 0;
}
if($checkboxes.filter(":checked").length == $checkboxes.length){
return 1;
} else {
return -1;
}
}
</script>

@ -7,7 +7,7 @@
<th class="cmn" style="width: 56px;">
<input type="checkbox" class="form-check-input"
onchange="integrationSearchControl.dataset.select(this.checked);">
onchange="pageObject['${pageName}'].selectCheckbox(this, this.checked);">
</th>
<th class="cmn" style="width: 140px;"
onclick="searchFromGridTitle('SGG_CD', this.innerText, '', '');"

@ -7,7 +7,7 @@
<tr data-key="{CRDN_ID}">
<td class="cmn text-center">
<input type="checkbox" class="form-check-input" name="gridCheckbox" value="{CRDN_ID}"
onchange="integrationSearchControl.dataset.select('{CRDN_ID}', this.checked);">
onchange="pageObject['${pageName}'].selectCheckbox(this,'{CRDN_ID}', this.checked);">
</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{SGG_NM}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{TASK_SE_NM}</td>

@ -206,7 +206,7 @@
<div class="col-md-6">
<div class="row justify-content-end">
<div class="col-sm-3">
<button type="button" onclick="saveUser();" class="btn btn-primary">저장</button>
<button type="button" onclick="userCtrl.saveUser();" class="btn btn-primary">저장</button>
</div>
</div>
</div>
@ -237,10 +237,10 @@
<script src="/resources/js/base/fimsFormFields.js"></script>
<script>
var userFields = new FimsFormFields("#user-form");
var userControl = newUserControl();
var userCtrl = newUserControl();
userControl.setInfo = obj => {
userFields.set(userControl,obj);
userCtrl.setInfo = obj => {
userFields.set(userCtrl,obj);
let create = isEmpty(obj.USER_ACNT);
if(!create){
@ -262,21 +262,21 @@ userControl.setInfo = obj => {
let input = $(this),
name = input.attr("data-map"),
val = input.val();
userControl.setValue(name, val);
userCtrl.setValue(name, val);
})
.onEnterPress(saveUser);
.onEnterPress(userCtrl.saveUser);
document.querySelector("#user-form input[name='" + (create ? "account" : "name") + "']").focus();
}
userControl.onModify = (changed) => {
userCtrl.onModify = (changed) => {
if (["USER_NM", "EML_ADRS", "MBL_TELNO"].filter(e => changed.includes(e)).length < 1)
return;
userControl.dataset.setState();
userCtrl.dataset.setState();
}
function saveUser() {
userCtrl.saveUser = () => {
if (!$("#user-form").find("input,select").validInputs()) return;
let match = Array.from(document.querySelectorAll("#user-form input[type='password']"))
@ -295,12 +295,12 @@ function saveUser() {
dialog.alert({
content:"현재 사용자 정보를 저장하시겠습니까?",
onOK:() => {
save(userFields.get());
userCtrl.save(userFields.get());
}
});
}
function save(info){
userCtrl.save = (info) => {
var create = isEmpty(info.id)
if(create && "${cntnSeCd}" == "02"){
@ -366,7 +366,7 @@ if(userInfo.USER_ID == null && "${cntnSeCd}" == "02"){
userInfo.USER_SE_CD = "21";
userInfo.CNTN_SE_CD = "02";
}
userControl.setInfo(userInfo);
userCtrl.setInfo(userInfo);
wctx.csrf = window.opener.wctx.csrf;
</script>

Loading…
Cancel
Save