DatasetControl keyMapper 설정 수정

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

@ -97,7 +97,7 @@
</thead> </thead>
<tbody></tbody> <tbody></tbody>
<template is="curly-brackets" class="found"> <template is="curly-brackets" class="found">
<tr data-key="FILE_NAME"> <tr data-index="DATA-INDEX">
<td onclick ondblclick class="text-center">TEMP_GROUP_ID</td> <td onclick ondblclick class="text-center">TEMP_GROUP_ID</td>
<td onclick ondblclick title="{FILE_NAME}" <td onclick ondblclick title="{FILE_NAME}"
class="text-start text-truncate max-w-th">FILE_NAME</td> class="text-start text-truncate max-w-th">FILE_NAME</td>
@ -187,9 +187,9 @@ $(document).ready(function(){
$P.$findn("imageArea").html(""); $P.$findn("imageArea").html("");
if(dataItem && dataItem.data){ if(dataItem && dataItem.data){
var dataKey = dataItem.data.FILE_NAME; var dataIndex = dataItem.index;
$P.$findn("table-responsive").find("tbody").setCurrentRow(dataKey); $P.$findn("table-responsive").find("tbody").setCurrentRow(dataIndex);
if(dataItem.data.FILE_GROUP_TYPE == "BIN"){ if(dataItem.data.FILE_GROUP_TYPE == "BIN"){
var srcArr = []; var srcArr = [];
@ -200,6 +200,7 @@ $(document).ready(function(){
$P.renderImage(srcArr); $P.renderImage(srcArr);
} else { } else {
var dataKey = dataItem.data.FILE_NAME;
if(!dataKey.endsWith(".txt") && !dataKey.endsWith(".TXT")){ if(!dataKey.endsWith(".txt") && !dataKey.endsWith(".TXT")){
var src = dataItem.data.FILE_PATH; var src = dataItem.data.FILE_PATH;
$P.renderImage(src); $P.renderImage(src);
@ -303,7 +304,7 @@ $(document).ready(function(){
var notFound = [$P.$findn("table-responsive").find("template.notFound")[0].innerHTML]; var notFound = [$P.$findn("table-responsive").find("template.notFound")[0].innerHTML];
var found = $P.$findn("table-responsive").find("template.found")[0].innerHTML; var found = $P.$findn("table-responsive").find("template.found")[0].innerHTML;
var replacer = (str, dataItem) => str var replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickParsedInfoList('" + dataItem.getValue("FILE_NAME") + "');"); .replace(/{onclick}/gi, "pageObject['${pageName}'].clickParsedInfoList('{DATA-INDEX}');");
return { return {
found : found, found : found,
@ -354,12 +355,12 @@ $(document).ready(function(){
} }
$P.clickParsedInfoList = (dataKey) => { $P.clickParsedInfoList = (dataIndex) => {
if(dataKey == ""){ if(dataIndex == ""){
return; return;
} }
ctrl.dataset.setCurrent(dataKey); ctrl.dataset.setCurrent(dataIndex);
}; };
$P.createCrdn = () => { $P.createCrdn = () => {
@ -393,13 +394,13 @@ $(document).ready(function(){
data : formData, data : formData,
success : (resp) => { success : (resp) => {
var removedFileName = $P.tempGroup[firstGroupKey].map(item => item.FILE_NAME); let removedFileNameArr = $P.tempGroup[firstGroupKey].map(item => item.FILE_NAME);
delete $P.tempGroup[firstGroupKey]; delete $P.tempGroup[firstGroupKey];
if(resp.saved){ if(resp.saved){
$P.removeCallback(removedFileName); $P.removeCallback(removedFileNameArr);
if(resp.alertMessage){ if(resp.alertMessage){
alert(resp.alertMessage); alert(resp.alertMessage);
@ -430,31 +431,30 @@ $(document).ready(function(){
}, },
success : (resp) => { success : (resp) => {
if(resp.saved){ if(resp.saved){
$P.removeCallback(fileName); $P.removeCallback([fileName]);
} }
} }
}); });
} }
$P.removeCallback = (removedFileName) => { $P.removeCallback = (removedFileNameArr) => {
ctrl.dataset.remove(removedFileName); let removedDataIndexArr = [];
$P.removeTableRow(removedFileName); for(var i = 0; i < removedFileNameArr.length; i++){
let dii = ctrl.dataset.getDataset("item").filter(item=>item.data.FILE_NAME == removedFileNameArr[i])[0].index;
removedDataIndexArr.push(dii);
}
ctrl.dataset.remove(removedDataIndexArr);
$P.removeTableRow(removedDataIndexArr);
} }
$P.removeTableRow = (removedFileName) => { $P.removeTableRow = (removedDataIndexArr) => {
var fileListTable = $P.$findn("table-responsive").find("table")[0]; var fileListTable = $P.$findn("table-responsive").find("table")[0];
var targetArr = []; for(var i = 0; i < removedDataIndexArr.length; i++){
if(Array.isArray(removedFileName)){ var target = removedDataIndexArr[i];
targetArr = removedFileName; var tr = $(fileListTable).find("tbody").find("tr[data-index='"+target+"']");
} else {
targetArr = [removedFileName];
}
for(var i = 0; i < targetArr.length; i++){
var target = targetArr[i];
var tr = $(fileListTable).find("tbody").find("tr[data-key='"+target+"']");
var trIndex = $(fileListTable).find("tbody tr").index(tr); var trIndex = $(fileListTable).find("tbody tr").index(tr);
fileListTable.deleteRow(trIndex+1); fileListTable.deleteRow(trIndex+1);
} }

@ -30,7 +30,7 @@
</thead> </thead>
<tbody name="exmptnVhclTbody"></tbody> <tbody name="exmptnVhclTbody"></tbody>
<template is="curly-brackets" name="exmptnVhclRow"> <template is="curly-brackets" name="exmptnVhclRow">
<tr data-key="HSTRY_SN"> <tr data-index="DATA-INDEX">
<td onclick ondblclick class="text-end">HSTRY_SN</td> <td onclick ondblclick class="text-end">HSTRY_SN</td>
<td onclick ondblclick class="text-center">VHRNO</td> <td onclick ondblclick class="text-center">VHRNO</td>
<td onclick ondblclick class="text-start">EXMPTN_RSN</td> <td onclick ondblclick class="text-start">EXMPTN_RSN</td>

@ -125,9 +125,9 @@
</thead> </thead>
<tbody name="vltnTbody"></tbody> <tbody name="vltnTbody"></tbody>
<template is="curly-brackets" name="vltnRow"> <template is="curly-brackets" name="vltnRow">
<tr data-key="VLTN_CASE_ID"> <tr data-index="DATA-INDEX">
<td class="text-center min-w-px-50 mw-px-50"> <td class="text-center min-w-px-50 mw-px-50">
<input type="radio" name="levyRadio" value="VLTN_CASE_ID" <input type="radio" name="levyRadio" value="DATA-INDEX"
onchange /> onchange />
</td> </td>
<td onclick class="text-center">VLTN_CASE_NM</td> <td onclick class="text-center">VLTN_CASE_NM</td>
@ -155,9 +155,9 @@
</thead> </thead>
<tbody name="warningTbody"></tbody> <tbody name="warningTbody"></tbody>
<template is="curly-brackets" name="warningRow"> <template is="curly-brackets" name="warningRow">
<tr data-key="LEVY_EXCL_RSN_CD"> <tr data-index="DATA-INDEX">
<td class="text-center min-w-px-50 mw-px-50"> <td class="text-center min-w-px-50 mw-px-50">
<input type="radio" name="warningRadio" value="LEVY_EXCL_RSN_CD" <input type="radio" name="warningRadio" value="DATA-INDEX"
onchange /> onchange />
</td> </td>
<td onclick class="text-center">LEVY_EXCL_RSN_NM</td> <td onclick class="text-center">LEVY_EXCL_RSN_NM</td>
@ -186,9 +186,9 @@
</thead> </thead>
<tbody name="nonlevyTbody"></tbody> <tbody name="nonlevyTbody"></tbody>
<template is="curly-brackets" name="nonlevyRow"> <template is="curly-brackets" name="nonlevyRow">
<tr data-key="LEVY_EXCL_RSN_CD"> <tr data-index="DATA-INDEX">
<td class="text-center min-w-px-50 mw-px-50"> <td class="text-center min-w-px-50 mw-px-50">
<input type="radio" name="nonlevyRadio" value="LEVY_EXCL_RSN_CD" <input type="radio" name="nonlevyRadio" value="DATA-INDEX"
onchange /> onchange />
</td> </td>
<td onclick class="text-center">LEVY_EXCL_RSN_NM</td> <td onclick class="text-center">LEVY_EXCL_RSN_NM</td>
@ -372,16 +372,16 @@ $(document).ready(function(){
$P.renderAnsBodyList(resp.nonlevyCaseList.length,'nonlevy'); $P.renderAnsBodyList(resp.nonlevyCaseList.length,'nonlevy');
if(resp.levyCaseList.length > 0){ if(resp.levyCaseList.length > 0){
var current = ctrl.levy.getCurrent()["VLTN_CASE_ID"]; var current = ctrl.levy.getCurrent("item");
$P.clickAnsBodyList(current,'levy'); $P.clickAnsBodyList(current.index,'levy');
} }
if(resp.warningCaseList.length > 0){ if(resp.warningCaseList.length > 0){
var current = ctrl.warning.getCurrent()["LEVY_EXCL_RSN_CD"]; var current = ctrl.warning.getCurrent("item");
$P.clickAnsBodyList(current,'warning'); $P.clickAnsBodyList(current.index,'warning');
} }
if(resp.nonlevyCaseList.length > 0){ if(resp.nonlevyCaseList.length > 0){
var current = ctrl.nonlevy.getCurrent()["LEVY_EXCL_RSN_CD"]; var current = ctrl.nonlevy.getCurrent("item");
$P.clickAnsBodyList(current,'nonlevy'); $P.clickAnsBodyList(current.index,'nonlevy');
} }
} }
}); });
@ -416,25 +416,25 @@ $(document).ready(function(){
var replacer = () => {}; var replacer = () => {};
if(renderDataType == "levy"){ if(renderDataType == "levy"){
replacer = (str, dataItem) => str replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickAnsBodyList('" + dataItem.getValue("VLTN_CASE_ID") + "','levy');") .replace(/{onclick}/gi, "pageObject['${pageName}'].clickAnsBodyList('{DATA-INDEX}','levy');")
.replace(/{onchange}/gi, "pageObject['${pageName}'].radioClickAnsBodyList('" + dataItem.getValue("VLTN_CASE_ID") + "','levy');"); .replace(/{onchange}/gi, "pageObject['${pageName}'].radioClickAnsBodyList('{DATA-INDEX}','levy');");
} else if(renderDataType == "warning"){ } else if(renderDataType == "warning"){
replacer = (str, dataItem) => str replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickAnsBodyList('" + dataItem.getValue("LEVY_EXCL_RSN_CD") + "','warning');") .replace(/{onclick}/gi, "pageObject['${pageName}'].clickAnsBodyList('{DATA-INDEX}','warning');")
.replace(/{onchange}/gi, "pageObject['${pageName}'].radioClickAnsBodyList('" + dataItem.getValue("LEVY_EXCL_RSN_CD") + "','warning');"); .replace(/{onchange}/gi, "pageObject['${pageName}'].radioClickAnsBodyList('{DATA-INDEX}','warning');");
} else if(renderDataType == "nonlevy"){ } else if(renderDataType == "nonlevy"){
replacer = (str, dataItem) => str replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickAnsBodyList('" + dataItem.getValue("LEVY_EXCL_RSN_CD") + "','nonlevy');") .replace(/{onclick}/gi, "pageObject['${pageName}'].clickAnsBodyList('{DATA-INDEX}','nonlevy');")
.replace(/{onchange}/gi, "pageObject['${pageName}'].radioClickAnsBodyList('" + dataItem.getValue("LEVY_EXCL_RSN_CD") + "','nonlevy');"); .replace(/{onchange}/gi, "pageObject['${pageName}'].radioClickAnsBodyList('{DATA-INDEX}','nonlevy');");
} }
var trs = empty ? notFound : ansBodyDS.inStrings(found, replacer); var trs = empty ? notFound : ansBodyDS.inStrings(found, replacer);
$P.$findn(tbodyName).html(trs.join()); $P.$findn(tbodyName).html(trs.join());
} }
$P.radioClickAnsBodyList = (dataKey, gridType) => { $P.radioClickAnsBodyList = (dataIndex, gridType) => {
ctrl[gridType].setCurrent(dataKey); ctrl[gridType].setCurrent(dataIndex);
var tbodyName = ""; var tbodyName = "";
if(gridType == "levy"){ if(gridType == "levy"){
@ -446,7 +446,7 @@ $(document).ready(function(){
} else { } else {
return; return;
} }
$P.$findn(tbodyName).setCurrentRow(dataKey); $P.$findn(tbodyName).setCurrentRow(dataIndex);
if(gridType == "levy" && $P.currentDisplay == "levyAnsBody"){ if(gridType == "levy" && $P.currentDisplay == "levyAnsBody"){
$P.changeAnsBodyText(); $P.changeAnsBodyText();
@ -457,7 +457,7 @@ $(document).ready(function(){
} }
} }
$P.clickAnsBodyList = (dataKey, gridType) => { $P.clickAnsBodyList = (dataIndex, gridType) => {
var radioName = ""; var radioName = "";
if(gridType == "levy"){ if(gridType == "levy"){
radioName = "levyRadio"; radioName = "levyRadio";
@ -469,17 +469,17 @@ $(document).ready(function(){
return; return;
} }
$P.$findn("wrapper").find(":radio[name='"+radioName+"'][value='"+dataKey+"']").prop("checked",true); $P.$findn("wrapper").find(":radio[name='"+radioName+"'][value='"+dataIndex+"']").prop("checked",true);
if(gridType == "levy" && $P.currentDisplay == "levyAnsBody"){ if(gridType == "levy" && $P.currentDisplay == "levyAnsBody"){
$P.$findn("wrapper").find(":radio[name='"+radioName+"'][value='"+dataKey+"']").focus(); $P.$findn("wrapper").find(":radio[name='"+radioName+"'][value='"+dataIndex+"']").focus();
} else if(gridType == "warning" && $P.currentDisplay == "warningAnsBody"){ } else if(gridType == "warning" && $P.currentDisplay == "warningAnsBody"){
$P.$findn("wrapper").find(":radio[name='"+radioName+"'][value='"+dataKey+"']").focus(); $P.$findn("wrapper").find(":radio[name='"+radioName+"'][value='"+dataIndex+"']").focus();
} else if(gridType == "nonlevy" && $P.currentDisplay == "nonlevyAnsBody"){ } else if(gridType == "nonlevy" && $P.currentDisplay == "nonlevyAnsBody"){
$P.$findn("wrapper").find(":radio[name='"+radioName+"'][value='"+dataKey+"']").focus(); $P.$findn("wrapper").find(":radio[name='"+radioName+"'][value='"+dataIndex+"']").focus();
} }
$P.radioClickAnsBodyList(dataKey, gridType); $P.radioClickAnsBodyList(dataIndex, gridType);
} }
$P.changeAnsBodyText = () => { $P.changeAnsBodyText = () => {
@ -530,9 +530,9 @@ $(document).ready(function(){
} }
$P.refreshAnsWordsInfo = () => { $P.refreshAnsWordsInfo = () => {
var cursor1 = ctrl.levy.getCurrent()["VLTN_CASE_ID"]; var cursor1 = ctrl.levy.getCurrent("item").index;
var cursor2 = ctrl.warning.getCurrent()["LEVY_EXCL_RSN_CD"]; var cursor2 = ctrl.warning.getCurrent("item").index;
var cursor3 = ctrl.nonlevy.getCurrent()["LEVY_EXCL_RSN_CD"]; var cursor3 = ctrl.nonlevy.getCurrent("item").index;
var taskSeCd = $P.$findn("frmSearch").find("input[name='taskSeCd']:checked").val(); var taskSeCd = $P.$findn("frmSearch").find("input[name='taskSeCd']:checked").val();
@ -554,18 +554,18 @@ $(document).ready(function(){
if(resp.levyCaseList.length > 0){ if(resp.levyCaseList.length > 0){
ctrl.levy.setCurrent(cursor1); ctrl.levy.setCurrent(cursor1);
var current = ctrl.levy.getCurrent()["VLTN_CASE_ID"]; var current = ctrl.levy.getCurrent("item");
$P.clickAnsBodyList(current,'levy'); $P.clickAnsBodyList(current.index,'levy');
} }
if(resp.warningCaseList.length > 0){ if(resp.warningCaseList.length > 0){
ctrl.warning.setCurrent(cursor2); ctrl.warning.setCurrent(cursor2);
var current = ctrl.warning.getCurrent()["LEVY_EXCL_RSN_CD"]; var current = ctrl.warning.getCurrent("item");
$P.clickAnsBodyList(current,'warning'); $P.clickAnsBodyList(current.index,'warning');
} }
if(resp.nonlevyCaseList.length > 0){ if(resp.nonlevyCaseList.length > 0){
ctrl.nonlevy.setCurrent(cursor3); ctrl.nonlevy.setCurrent(cursor3);
var current = ctrl.nonlevy.getCurrent()["LEVY_EXCL_RSN_CD"]; var current = ctrl.nonlevy.getCurrent("item");
$P.clickAnsBodyList(current,'nonlevy'); $P.clickAnsBodyList(current.index,'nonlevy');
} }
} }
}); });

@ -48,9 +48,9 @@
</thead> </thead>
<tbody name="warningWordsTbody"></tbody> <tbody name="warningWordsTbody"></tbody>
<template is="curly-brackets" name="warningWordsRow"> <template is="curly-brackets" name="warningWordsRow">
<tr data-key="LEVY_EXCL_RSN_CD"> <tr data-index="DATA-INDEX">
<td class="text-center min-w-px-50 mw-px-50"> <td class="text-center min-w-px-50 mw-px-50">
<input type="radio" name="gridRadio" value="LEVY_EXCL_RSN_CD" <input type="radio" name="gridRadio" value="DATA-INDEX"
onchange /> onchange />
</td> </td>
<td onclick class="text-center">LEVY_EXCL_RSN_NM</td> <td onclick class="text-center">LEVY_EXCL_RSN_NM</td>
@ -179,8 +179,8 @@ $(document).ready(function(){
$P.renderWarningWordsList(resp.List.length); $P.renderWarningWordsList(resp.List.length);
if(resp.List.length > 0){ if(resp.List.length > 0){
var current = ctrl.dataset.getCurrent()["LEVY_EXCL_RSN_CD"]; var current = ctrl.dataset.getCurrent("item");
$P.clickWarningWordsList(current); $P.clickWarningWordsList(current.index);
} }
} }
}); });
@ -194,29 +194,29 @@ $(document).ready(function(){
var found = $P.findn("warningWordsRow").innerHTML; var found = $P.findn("warningWordsRow").innerHTML;
var replacer = (str, dataItem) => str var replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickWarningWordsList('" + dataItem.getValue("LEVY_EXCL_RSN_CD") + "');") .replace(/{onclick}/gi, "pageObject['${pageName}'].clickWarningWordsList('{DATA-INDEX}');")
.replace(/{onchange}/gi, "pageObject['${pageName}'].radioClickWarningWordsList('" + dataItem.getValue("LEVY_EXCL_RSN_CD") + "');"); .replace(/{onchange}/gi, "pageObject['${pageName}'].radioClickWarningWordsList('{DATA-INDEX}');");
var trs = empty ? notFound : warningWordsDS.inStrings(found, replacer); var trs = empty ? notFound : warningWordsDS.inStrings(found, replacer);
$P.$findn("warningWordsTbody").html(trs.join()); $P.$findn("warningWordsTbody").html(trs.join());
} }
$P.radioClickWarningWordsList = (dataKey, gridType) => { $P.radioClickWarningWordsList = (dataIndex, gridType) => {
ctrl.dataset.setCurrent(dataKey); ctrl.dataset.setCurrent(dataIndex);
$P.$findn("warningWordsTbody").setCurrentRow(dataKey); $P.$findn("warningWordsTbody").setCurrentRow(dataIndex);
$P.changeTextarea(); $P.changeTextarea();
} }
$P.clickWarningWordsList = (dataKey, gridType) => { $P.clickWarningWordsList = (dataIndex, gridType) => {
$P.$findn("wrapper").find(":radio[name='gridRadio'][value='"+dataKey+"']").prop("checked",true); $P.$findn("wrapper").find(":radio[name='gridRadio'][value='"+dataIndex+"']").prop("checked",true);
$P.$findn("wrapper").find(":radio[name='gridRadio'][value='"+dataKey+"']").focus(); $P.$findn("wrapper").find(":radio[name='gridRadio'][value='"+dataIndex+"']").focus();
$P.radioClickWarningWordsList(dataKey, gridType); $P.radioClickWarningWordsList(dataIndex, gridType);
} }
$P.changeTextarea = () => { $P.changeTextarea = () => {
@ -252,8 +252,8 @@ $(document).ready(function(){
$P.renderWarningWordsList(resp.List.length); $P.renderWarningWordsList(resp.List.length);
if(resp.List.length > 0){ if(resp.List.length > 0){
ctrl.dataset.setCurrent(cursor); ctrl.dataset.setCurrent(cursor);
var current = ctrl.dataset.getCurrent()["LEVY_EXCL_RSN_CD"]; var current = ctrl.dataset.getCurrent("item");
$P.clickWarningWordsList(current,'warning'); $P.clickWarningWordsList(current.index,'warning');
} }
} }

@ -1,7 +1,7 @@
function newCrdn05020Control(page, doctx = ""){ function newCrdn05020Control(page, doctx = ""){
page.ctrl = new DatasetControl({ page.ctrl = new DatasetControl({
dataGetter : obj => obj["List"], dataGetter : obj => obj["List"],
keymapper : info => info ? info.FILE_NAME : "", keys : ["FILE_NAME"],
urls : { }, urls : { },
formats: { formats: {
CRDN_YMD : dateFormat, CRDN_YMD : dateFormat,

@ -1,7 +1,8 @@
function newCrdn08030Control(page, doctx = ""){ function newCrdn08030Control(page, doctx = ""){
page.ctrl = new DatasetControl({ page.ctrl = new DatasetControl({
dataGetter : obj => obj, appendData:false, dataGetter : obj => obj,
keymapper : info => info ? info.HSTRY_SN : "", appendData:false,
keys : ["HSTRY_SN"],
urls : { }, urls : { },
formats: { formats: {
EXMPTN_BGNG_YMD : dateFormat, EXMPTN_BGNG_YMD : dateFormat,

@ -1,16 +1,22 @@
function newCvlc05010Control(page, doctx = ""){ function newCvlc05010Control(page, doctx = ""){
page.ctrl = new AnswerBodyControl({ page.ctrl = new AnswerBodyControl({
dataGetter : obj => obj["levyCaseList"], urls : {}, formats : {}, dataGetter : obj => obj["levyCaseList"],
keymapper : info => info ? info.VLTN_CASE_ID : "" urls : {},
formats : {},
keys : ["VLTN_CASE_ID"]
}, },
{ {
dataGetter : obj => obj["warningCaseList"], urls : {}, formats : {}, dataGetter : obj => obj["warningCaseList"],
keymapper : info => info ? info.LEVY_EXCL_RSN_CD : "" urls : {},
formats : {},
keys : ["LEVY_EXCL_RSN_CD"]
}, },
{ {
dataGetter : obj => obj["nonlevyCaseList"], urls : {}, formats : {}, dataGetter : obj => obj["nonlevyCaseList"],
keymapper : info => info ? info.LEVY_EXCL_RSN_CD : "" urls : {},
formats : {},
keys : ["LEVY_EXCL_RSN_CD"]
}); });
return page.ctrl; return page.ctrl;
} }

@ -1,7 +1,7 @@
function newCvlc06010Control(page, doctx = ""){ function newCvlc06010Control(page, doctx = ""){
page.ctrl = new DatasetControl({ page.ctrl = new DatasetControl({
dataGetter : obj => obj["List"], dataGetter : obj => obj["List"],
keymapper : info => info ? info.LEVY_EXCL_RSN_CD : "", keys : ["LEVY_EXCL_RSN_CD"],
urls : {}, urls : {},
formats : {} formats : {}
}); });

Loading…
Cancel
Save