diff --git a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn06020-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn06020-main.jsp index f36ce5c0..6b2a1782 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn06020-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn06020-main.jsp @@ -377,6 +377,8 @@ $(document).ready(function(){ }); $P.photoInspectionControl.defaultFetchSize = FETCH_XS; $P.photoInspectionControl.untilPageNum = 0; + $P.photoInspectionControl.tableRenderComplete = false; + //동일차량검사 datasetControl 인스턴스 $P.sameVehicleControl = new InspectionControl({ @@ -398,7 +400,9 @@ $(document).ready(function(){ ); $P.sameVehicleControl.defaultFetchSize = FETCH_XS; $P.sameVehicleControl.untilPageNum = 0; - + $P.sameVehicleControl.main.tableRenderComplete = false; + $P.sameVehicleControl.sub.tableRenderComplete = false; + $P.photoInspectionControl.getNext = (key) => { var ds = $P.photoInspectionControl.dataset.getDataset(); @@ -423,9 +427,21 @@ $(document).ready(function(){ start: obj["Start"], totalSize: obj["Total"], fetchSize: obj["Fetch"], func: "pageObject['${pageName}'].photoInspectionControl.load({index})" }); - + + $P.photoInspectionControl.tableRenderComplete = true; }; + $P.photoInspectionControl.onCurrentChange = (item) => { + if($P.photoInspectionControl.tableRenderComplete){ + $P.photoInspectionControl.tableRenderComplete = false; + if(!item){ + $P.clickInspectionDataList("","photoInspection"); + } else { + $P.clickInspectionDataList($P.photoInspectionControl.getCurrent()["CRDN_ID"],"photoInspection"); + } + } + } + $P.sameVehicleControl.main.onDatasetChange = (obj) => { $P.renderInspectionDataList(obj["Total"], "sameVehicleInspectionMain"); @@ -436,14 +452,38 @@ $(document).ready(function(){ start: obj["Start"], totalSize: obj["Total"], fetchSize: obj["Fetch"], func: "pageObject['${pageName}'].sameVehicleControl.main.load({index})" }); - + + + $P.sameVehicleControl.main.tableRenderComplete = true; }; - + $P.sameVehicleControl.main.onCurrentChange = (item) => { + if($P.sameVehicleControl.main.tableRenderComplete){ + $P.sameVehicleControl.main.tableRenderComplete = false; + if(!item){ + $P.clickInspectionDataList("","sameVehicleInspectionMain"); + } else { + $P.clickInspectionDataList($P.sameVehicleControl.main.getCurrent()["CRDN_ID_LIST"],"sameVehicleInspectionMain"); + } + } + } + $P.sameVehicleControl.sub.onDatasetChange = (obj) => { $P.renderInspectionDataList(obj["Total"], "sameVehicleInspectionSub"); + $P.sameVehicleControl.sub.tableRenderComplete = true; }; - + + $P.sameVehicleControl.sub.onCurrentChange = (item) => { + if($P.sameVehicleControl.sub.tableRenderComplete){ + $P.sameVehicleControl.sub.tableRenderComplete = false; + if(!item){ + $P.clickInspectionDataList("","sameVehicleInspectionSub"); + } else { + $P.clickInspectionDataList($P.sameVehicleControl.sub.getCurrent()["CRDN_ID"],"sameVehicleInspectionSub"); + } + } + }; + /************************************************************************** * pageObject.function **************************************************************************/ @@ -452,7 +492,6 @@ $(document).ready(function(){ $('#schCrdnYmdTo--${pageName}').datepicker('setDate', new Date()); $P.photoInspectionControl.setData([]); $P.sameVehicleControl.main.setData([]); - $P.sameVehicleControl.sub.setData([]); }; $P.fnResetAndChangeBiz = (taskSeCd) => { @@ -506,8 +545,8 @@ $(document).ready(function(){ default: break; } } - $P.searchDetailInspectionDataList = () => { - $P.sameVehicleControl.sub.query = { "crdnIDs" : $P.sameVehicleControl.main.getCurrent()["CRDN_ID_LIST"].split(",") }; + $P.searchDetailInspectionDataList = (dataKey) => { + $P.sameVehicleControl.sub.query = { "crdnIDs" : dataKey.split(",") }; $P.sameVehicleControl.sub.query.taskSeCd = $P.sameVehicleControl.main.query.taskSeCd; $P.sameVehicleControl.sub.load(0); } @@ -542,11 +581,18 @@ $(document).ready(function(){ $P.clickInspectionDataList = (dataKey, gridType) => { switch (gridType) { case "photoInspection": - $P.photoInspectionControl.setCurrent(dataKey); + + if(dataKey == ""){ + $("#curDataVhrno--${pageName}").html(""); + $("#nextDataVhrno--${pageName}").html(""); + $("#curDataFiles--${pageName}").html(""); + $("#nextDataFiles--${pageName}").html(""); + return; + } + $("#photoInspectionTbody--${pageName}").setCurrentRow(dataKey); - var curDataVhrno = $P.photoInspectionControl.getCurrent(dataKey)["VHRNO"]; - + var curDataVhrno = $P.photoInspectionControl.dataset.getData(dataKey)["VHRNO"]; var nextData = $P.photoInspectionControl.getNext(dataKey); var nextDataKey = nextData != null ? nextData.CRDN_ID : ""; var nextDataVhrno = nextData != null ? nextData.VHRNO : ""; @@ -582,15 +628,24 @@ $(document).ready(function(){ } }); + + $P.photoInspectionControl.setCurrent(dataKey); break; case "sameVehicleInspectionMain": - $P.sameVehicleControl.main.setCurrent(dataKey); + if(dataKey == ""){ + $P.sameVehicleControl.sub.setData([]); + return; + } $("#sameVehicleInspectionMainTbody--${pageName}").setCurrentRow(dataKey); - $P.searchDetailInspectionDataList(); + $P.searchDetailInspectionDataList(dataKey); + $P.sameVehicleControl.main.setCurrent(dataKey); break; case "sameVehicleInspectionSub": - $P.sameVehicleControl.sub.setCurrent(dataKey); + if(dataKey == ""){ + return; + } $("#sameVehicleInspectionSubTbody--${pageName}").setCurrentRow(dataKey); + $P.sameVehicleControl.sub.setCurrent(dataKey); break; } }