DatasetControl keyMapper 설정 수정

main
이범준 3 months ago
parent c640b606d0
commit 9ddb9c1f07

@ -163,7 +163,7 @@
</thead>
<tbody name="crdnTbody"></tbody>
<template is="curly-brackets" name="crdnRow">
<tr data-key="CRDN_ID">
<tr data-index="DATA-INDEX">
<td onclick ondblclick class="text-end">ROW_NUM</td>
<td onclick ondblclick class="text-center">CVLCPT_RCPT_NO</td>
<td onclick ondblclick class="text-center">CVLCPT_LIST_NO</td>
@ -398,8 +398,8 @@ $(document).ready(function(){
var notFound = [$P.findn("crdnNotFound").innerHTML];
var found = $P.findn("crdnRow").innerHTML;
var replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickCrdnList('" + dataItem.getValue("CRDN_ID") + "');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].dblclickCrdnList('" + dataItem.getValue("CRDN_ID") + "');");
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickCrdnList('{DATA-INDEX}');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].dblclickCrdnList('{CRDN_ID}');");
return {
found : found,
@ -421,23 +421,30 @@ $(document).ready(function(){
//보안모드
fn_securityModeToggle($("#securityMode--top").is(":checked"));
$P.holdList.forEach(function(item){
$P.$findn("crdnTbody").find("tr[data-key='"+item+"']").addClass("bg-dark");
$P.holdList.forEach(function(h_item){
let filtered = ctrl.dataset.getDataset("item").filter(item => item.data.CRDN_ID == h_item);
if(filtered.length > 0){
$P.$findn("crdnTbody").find("tr[data-index='"+filtered[0].index+"']").addClass("bg-dark");
}
});
}
$P.clickCrdnList = (dataKey) => {
if(dataKey == ""){
$P.clickCrdnList = (dataIndex) => {
if(dataIndex == ""){
$P.$findn("bottomCrdnPlc").val("");
return;
}
$P.$findn("crdnTbody").setCurrentRow(dataKey);
$P.$findn("crdnTbody").setCurrentRow(dataIndex);
$P.$findn("bottomCrdnPlc").val(ctrl.dataset.getData(dataKey)["CRDN_PLC"]);
$P.$findn("bottomCrdnPlc").val(ctrl.dataset.getData(dataIndex)["CRDN_PLC"]);
if($P.holdList.includes(dataKey)){
let crdnId = ctrl.dataset.getData(dataIndex)["CRDN_ID"];
if($P.holdList.includes(crdnId)){
$P.$findn("btnOpenCvlcptOrgnl").hide();
$P.$findn("btnDelete").hide();
$P.$findn("btnDeleteSameRcptYmd").hide();
@ -447,7 +454,7 @@ $(document).ready(function(){
$P.$findn("btnDeleteSameRcptYmd").show();
}
Apply.toDataset.current(ctrl.dataset, dataKey);
Apply.toDataset.current(ctrl.dataset, dataIndex);
}
$P.dblclickCrdnList = (dataKey) => {
@ -499,19 +506,31 @@ $(document).ready(function(){
});
}
$P.fnHold = () => {
var curKey = ctrl.dataset.getCurrent()["CRDN_ID"];
$P.fnHold = (argCrdnId) => {
var curKey;
if(argCrdnId != null){
curKey = argCrdnId;
} else {
curKey = ctrl.dataset.getCurrent()["CRDN_ID"];
}
if($P.holdList.includes(curKey)){
return;
}
$P.holdList.push(curKey);
$P.$findn("crdnTbody").find("tr[data-key='"+curKey+"']").addClass("bg-dark");
let dataIndex;
if(argCrdnId != null){
dataIndex = ctrl.dataset.getDataset("item").filter(item => item.data.CRDN_ID == argCrdnId).index;
} else {
dataIndex = ctrl.dataset.getCurrent("item").index;
}
$P.$findn("crdnTbody").find("tr[data-index='"+dataIndex+"']").addClass("bg-dark");
if(dataIndex == ctrl.dataset.getCurrent("item").index){
$P.$findn("btnOpenCvlcptOrgnl").hide();
$P.$findn("btnDelete").hide();
$P.$findn("btnDeleteSameRcptYmd").hide();
}
}
$P.fnRemove = (rcptYmd) => {
@ -542,13 +561,13 @@ $(document).ready(function(){
ctrl.dataset.select(curKey,true);
}
var selected = ctrl.dataset.getKeys("selected");
var selected = ctrl.dataset.getDataset("selected");
if (selected.length < 1) {
return;
}
var params = {
"crdnIds" : selected.join(",")
"crdnIds" : selected.map(item => item.CRDN_ID).join(",")
};
ajax.post({
@ -629,51 +648,55 @@ $(document).ready(function(){
}
$P.provide = {
"getCountStatus" : function(currentKey){
var ds = ctrl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey);
return (index+1) + " of " + ds.length;
"getCountStatus" : function(currentCrdnId){
var dsArray = ctrl.dataset.getDataset();
var arrayIndex = dsArray.findIndex(item => item.CRDN_ID == currentCrdnId);
return (arrayIndex+1) + " of " + dsArray.length;
},
"getNextKey" : function(currentKey){
var ds = ctrl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey);
if(ds.length > index+1){
if($P.holdList.includes(ds[index+1]["CRDN_ID"])){
return $P.provide.getNextKey(ds[index+1]["CRDN_ID"]);
"getNextKey" : function(currentCrdnId){
var dsArray = ctrl.dataset.getDataset();
var arrayIndex = dsArray.findIndex(item => item.CRDN_ID == currentCrdnId);
if(dsArray.length > arrayIndex+1){
if($P.holdList.includes(dsArray[arrayIndex+1]["CRDN_ID"])){
return $P.provide.getNextKey(dsArray[arrayIndex+1]["CRDN_ID"]);
} else {
return ds[index+1]["CRDN_ID"];
return dsArray[arrayIndex+1]["CRDN_ID"];
}
} else {
return "";
}
},
"getPrevKey" : function(currentKey){
var ds = ctrl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey);
if(index != 0 && ds.length > 1){
if($P.holdList.includes(ds[index-1]["CRDN_ID"])){
return $P.provide.getPrevKey(ds[index-1]["CRDN_ID"]);
"getPrevKey" : function(currentCrdnId){
var dsArray = ctrl.dataset.getDataset();
var arrayIndex = dsArray.findIndex(item => item.CRDN_ID == currentCrdnId);
if(arrayIndex != 0 && dsArray.length > 1){
if($P.holdList.includes(dsArray[arrayIndex-1]["CRDN_ID"])){
return $P.provide.getPrevKey(dsArray[arrayIndex-1]["CRDN_ID"]);
} else {
return ds[index-1]["CRDN_ID"];
return dsArray[arrayIndex-1]["CRDN_ID"];
}
} else {
return "";
}
},
"selectRow" : function(currentKey){
$P.clickCrdnList(currentKey);
"selectRow" : function(currentCrdnId){
let filtered = ctrl.dataset.getDataset("item").filter(item => item.data.CRDN_ID == currentCrdnId);
if(filtered.length > 0){
$P.clickCrdnList(filtered[0].index);
}
},
"holdRow" : function(currentKey){
$P.fnHold(currentKey);
"holdRow" : function(currentCrdnId){
$P.fnHold(currentCrdnId);
},
"refreshList" : function(){
$P.refreshCrdnList();
},
"hasData" : function(key){
if(ctrl.dataset.getData(key) == null){
return false;
} else {
"hasData" : function(crdnId){
let filtered = ctrl.dataset.getDataset("item").filter(item => item.data.CRDN_ID == crdnId);
if(filtered.length > 0){
return true;
} else {
return false;
}
},
};

@ -186,10 +186,10 @@
</thead>
<tbody name="crdnTbody"></tbody>
<template is="curly-brackets" name="crdnRow">
<tr data-key="CRDN_ID">
<tr data-index="DATA-INDEX">
<td onclick ondblclick class="text-end">ROW_NUM</td>
<td class="text-center">
<input type="checkbox" name="gridCheckbox" name="gridCheckbox" value="CRDN_ID"
<input type="checkbox" name="gridCheckbox" name="gridCheckbox" value="DATA-INDEX"
onchange="pageObject['${pageName}'].checkCrdnList(this, this.checked);" />
</td>
<td onclick ondblclick class="text-center">CVLCPT_RCPT_NO</td>
@ -358,8 +358,8 @@ $(document).ready(function(){
var notFound = [$P.findn("crdnNotFound").innerHTML];
var found = $P.findn("crdnRow").innerHTML;
var replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickCrdnList('" + dataItem.getValue("CRDN_ID") + "');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].dblclickCrdnList('" + dataItem.getValue("CRDN_ID") + "');");
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickCrdnList('{DATA-INDEX}');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].dblclickCrdnList('{CRDN_ID}');");
return {
found : found,
@ -382,10 +382,10 @@ $(document).ready(function(){
fn_securityModeToggle($("#securityMode--top").is(":checked"));
$P.$findn("crdnTbody").find("tr[data-key]").each(function(item){
var crdnId = this.dataset.key;
$P.$findn("crdnTbody").find("tr[data-index]").each(function(item){
var dataIndex = this.dataset.index;
var data = ctrl.dataset.getData(crdnId);
var data = ctrl.dataset.getData(dataIndex);
if(data.COPY_EXIST_YN == "Y"){
$(this).addClass("text-red");
@ -408,13 +408,13 @@ $(document).ready(function(){
Apply.toDataset.selection(ctrl.dataset, element, bool);
}
$P.clickCrdnList = (dataKey) => {
if(dataKey == ""){
$P.clickCrdnList = (dataIndex) => {
if(dataIndex == ""){
return;
}
$P.$findn("crdnTbody").setCurrentRow(dataKey);
$P.$findn("crdnTbody").setCurrentRow(dataIndex);
Apply.toDataset.current(ctrl.dataset, dataKey);
Apply.toDataset.current(ctrl.dataset, dataIndex);
}
$P.dblclickCrdnList = (dataKey) => {
@ -532,7 +532,7 @@ $(document).ready(function(){
$P.fnExecuteAnswer = () => {
var count = ctrl.dataset.getKeys("selected").length;
var count = ctrl.dataset.getDataset("selected").length;
dialog.alert({
content : "선택된 "+count+"건의 자료를 답변등록을 실행하시겠습니까?",
@ -547,7 +547,7 @@ $(document).ready(function(){
$P.fnAnswerComplete = () => {
var count = ctrl.dataset.getKeys("selected").length;
var count = ctrl.dataset.getDataset("selected").length;
dialog.alert({
content : "선택된 "+count+"건의 자료를 답변완료 상태로 변경하시겠습니까?",
@ -567,7 +567,7 @@ $(document).ready(function(){
url : ctrl.urls.update,
data : {
"processType" : processType,
"crdnIds" : ctrl.dataset.getKeys("selected").join(",")
"crdnIds" : ctrl.dataset.getDataset("selected").map(item=>item.CRDN_ID).join(",")
},
success : (resp) => {
if(resp.saved){
@ -641,31 +641,34 @@ $(document).ready(function(){
}
$P.provide = {
"getCountStatus" : function(currentKey){
var ds = ctrl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey);
return (index+1) + " of " + ds.length;
"getCountStatus" : function(currentCrdnId){
var dsArray = ctrl.dataset.getDataset();
var arrayIndex = dsArray.findIndex(item => item.CRDN_ID == currentCrdnId);
return (arrayIndex+1) + " of " + dsArray.length;
},
"getNextKey" : function(currentKey){
var ds = ctrl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey);
if(ds.length > index+1){
return ds[index+1]["CRDN_ID"];
"getNextKey" : function(currentCrdnId){
var dsArray = ctrl.dataset.getDataset();
var arrayIndex = dsArray.findIndex(item => item.CRDN_ID == currentCrdnId);
if(dsArray.length > arrayIndex+1){
return dsArray[arrayIndex+1]["CRDN_ID"];
} else {
return "";
}
},
"getPrevKey" : function(currentKey){
var ds = ctrl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey);
if(index != 0 && ds.length > 1){
return ds[index-1]["CRDN_ID"];
"getPrevKey" : function(currentCrdnId){
var dsArray = ctrl.dataset.getDataset();
var arrayIndex = dsArray.findIndex(item => item.CRDN_ID == currentCrdnId);
if(arrayIndex != 0 && dsArray.length > 1){
return dsArray[arrayIndex-1]["CRDN_ID"];
} else {
return "";
}
},
"selectRow" : function(currentKey){
$P.clickCrdnList(currentKey);
"selectRow" : function(currentCrdnId){
let filtered = ctrl.dataset.getDataset("item").filter(item => item.data.CRDN_ID == currentCrdnId);
if(filtered.length > 0){
$P.clickCrdnList(filtered[0].index);
}
},
"refreshList" : function(){
$P.refreshCrdnList();

@ -164,7 +164,7 @@
</thead>
<tbody name="crdnTbody"></tbody>
<template is="curly-brackets" name="crdnRow">
<tr data-key="CRDN_ID">
<tr data-index="DATA-INDEX">
<td onclick ondblclick class="text-end">ROW_NUM</td>
<td onclick ondblclick class="text-center">CVLCPT_RCPT_NO</td>
<td onclick ondblclick class="text-center">CVLCPT_LIST_NO</td>
@ -357,8 +357,8 @@ $(document).ready(function(){
var notFound = [$P.findn("crdnNotFound").innerHTML];
var found = $P.findn("crdnRow").innerHTML;
var replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickCrdnList('" + dataItem.getValue("CRDN_ID") + "');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].dblclickCrdnList('" + dataItem.getValue("CRDN_ID") + "');");
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickCrdnList('{DATA-INDEX}');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].dblclickCrdnList('{CRDN_ID}');");
return {
@ -383,14 +383,14 @@ $(document).ready(function(){
}
$P.clickCrdnList = (dataKey) => {
if(dataKey == ""){
$P.clickCrdnList = (dataIndex) => {
if(dataIndex == ""){
return;
}
$P.$findn("crdnTbody").setCurrentRow(dataKey);
$P.$findn("crdnTbody").setCurrentRow(dataIndex);
Apply.toDataset.current(ctrl.dataset, dataKey);
Apply.toDataset.current(ctrl.dataset, dataIndex);
}
$P.dblclickCrdnList = (dataKey) => {
@ -430,25 +430,25 @@ $(document).ready(function(){
var curKey = cur["CRDN_ID"];
ctrl.dataset.select(curKey,true);
var selected = ctrl.dataset.getKeys("selected");
var selected = ctrl.dataset.getDataset("selected");
if (selected.length < 1) {
return;
}
var params = {
"crdnIds" : selected.join(",")
"crdnIds" : selected.map(item=>item.CRDN_ID).join(",")
};
ajax.post({
url : ctrl.urls.remove,
data : params,
success : (resp) => {
$P.saveCallback(selected, resp);
$P.saveCallback(resp);
}
});
}
$P.saveCallback = (selected, resp) => {
$P.saveCallback = (resp) => {
if (resp.saved){
$P.toast.show();
AppSupport.sleep(1000).then(() => $P.refreshCrdnList());
@ -499,40 +499,44 @@ $(document).ready(function(){
}
$P.provide = {
"getCountStatus" : function(currentKey){
var ds = ctrl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey);
return (index+1) + " of " + ds.length;
"getCountStatus" : function(currentCrdnId){
var dsArray = ctrl.dataset.getDataset();
var arrayindex = dsArray.findIndex(item => item.CRDN_ID == currentCrdnId);
return (arrayindex+1) + " of " + dsArray.length;
},
"getNextKey" : function(currentKey){
var ds = ctrl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey);
if(ds.length > index+1){
return ds[index+1]["CRDN_ID"];
"getNextKey" : function(currentCrdnId){
var dsArray = ctrl.dataset.getDataset();
var arrayindex = dsArray.findIndex(item => item.CRDN_ID == currentCrdnId);
if(dsArray.length > arrayindex+1){
return dsArray[arrayindex+1]["CRDN_ID"];
} else {
return "";
}
},
"getPrevKey" : function(currentKey){
var ds = ctrl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey);
if(index != 0 && ds.length > 1){
return ds[index-1]["CRDN_ID"];
"getPrevKey" : function(currentCrdnId){
var dsArray = ctrl.dataset.getDataset();
var arrayindex = dsArray.findIndex(item => item.CRDN_ID == currentCrdnId);
if(arrayindex != 0 && dsArray.length > 1){
return dsArray[arrayindex-1]["CRDN_ID"];
} else {
return "";
}
},
"selectRow" : function(currentKey){
$P.clickCrdnList(currentKey);
"selectRow" : function(currentCrdnId){
let filtered = ctrl.dataset.getDataset("item").filter(item => item.data.CRDN_ID == currentCrdnId);
if(filtered.length > 0){
$P.clickCrdnList(filtered[0].index);
}
},
"refreshList" : function(){
$P.refreshCrdnList();
},
"hasData" : function(key){
if(ctrl.dataset.getData(key) == null){
return false;
} else {
"hasData" : function(crdnId){
let filtered = ctrl.dataset.getDataset("item").filter(item=>item.data.CRDN_ID == crdnId);
if(filtered.length > 0){
return true;
} else {
return false;
}
},
};

@ -86,7 +86,7 @@
</thead>
<tbody name="dmndTbody"></tbody>
<template is="curly-brackets" name="dmndRow">
<tr data-key="INDIV_ID">
<tr data-index="DATA-INDEX">
<td onclick class="text-end">ROW_NUM</td>
<td onclick class="text-center">DMND_YMD</td>
<td onclick class="text-center">RGTR</td>
@ -274,7 +274,7 @@ $(document).ready(function(){
var notFound = [$P.findn("dmndNotFound").innerHTML];
var found = $P.findn("dmndRow").innerHTML;
var replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickDmndList('" + dataItem.getValue("INDIV_ID") + "');");
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickDmndList('{DATA-INDEX}');");
return {
found : found,
@ -294,13 +294,13 @@ $(document).ready(function(){
$P.findn("table-responsive").changeContent(trs, initScroll, noMore);
}
$P.clickDmndList = (dataKey) => {
if(dataKey == ""){
$P.clickDmndList = (dataIndex) => {
if(dataIndex == ""){
return;
}
$P.$findn("dmndTbody").setCurrentRow(dataKey);
Apply.toDataset.current(ctrl.dataset, dataKey);
$P.$findn("dmndTbody").setCurrentRow(dataIndex);
Apply.toDataset.current(ctrl.dataset, dataIndex);
}
$P.fnRemove = (allCompleteDataIds) => {
@ -317,26 +317,26 @@ $(document).ready(function(){
ctrl.dataset.select(curKey,true);
}
var selected = ctrl.dataset.getKeys("selected");
var selected = ctrl.dataset.getDataset("selected");
if (selected.length < 1) {
return;
}
var params = {
"indivIds" : selected.join(",")
"indivIds" : selected.map(item=>item.INDIV_ID).join(",")
};
ajax.post({
url : ctrl.urls.remove,
data : params,
success : (resp) => {
$P.removeCallback(selected, resp);
$P.removeCallback(resp);
}
});
}
$P.removeCallback = (selected, resp) => {
$P.removeCallback = (resp) => {
if (resp.saved){
$P.$findn("toastText").html("삭제 되었습니다.");
$P.toast.show();

@ -1,7 +1,8 @@
function newCvlc01010Control(page, doctx = ""){
page.ctrl = new DatasetControl({
dataGetter : obj => obj["List"], appendData:true,
keymapper : info => info ? info.CRDN_ID : "",
dataGetter : obj => obj["List"],
appendData:true,
keys : ["CRDN_ID"],
urls : {
load : "",
getInfo : "",

@ -1,7 +1,8 @@
function newCvlc02010Control(page, doctx = ""){
page.ctrl = new DatasetControl({
dataGetter : obj => obj["List"], appendData:true,
keymapper : info => info ? info.CRDN_ID : "",
dataGetter : obj => obj["List"],
appendData:true,
keys : ["CRDN_ID"],
urls : {
load : "",
getInfo : "",

@ -1,7 +1,8 @@
function newCvlc03010Control(page, doctx = ""){
page.ctrl = new DatasetControl({
dataGetter : obj => obj["List"], appendData:true,
keymapper : info => info ? info.CRDN_ID : "",
dataGetter : obj => obj["List"],
appendData:true,
keys : ["CRDN_ID"],
urls : {
load : "",
getInfo : "",

@ -1,7 +1,8 @@
function newCvlc04010Control(page, doctx = ""){
page.ctrl = new DatasetControl({
dataGetter : obj => obj["List"], appendData:true,
keymapper : info => info ? info.INDIV_ID : "",
dataGetter : obj => obj["List"],
appendData:true,
keys : ["INDIV_ID"],
urls : {
load : "",
create : "",

Loading…
Cancel
Save