소스 정리

main
이범준 3 months ago
parent 6bdb41447a
commit 81b408f532

@ -122,9 +122,9 @@ $(document).ready(function(){
}); });
/************************************************************************** /**************************************************************************
* DatasetControl * DatasetControl, DatasetSupport, FormFields
**************************************************************************/ **************************************************************************/
$P.ctrl = new DatasetControl({ var ctrl = $P.ctrl = new DatasetControl({
dataGetter : obj => obj["List"], appendData:true, dataGetter : obj => obj["List"], appendData:true,
keymapper : info => info ? info.NTC_ID : "", keymapper : info => info ? info.NTC_ID : "",
urls : { urls : {
@ -136,27 +136,23 @@ $(document).ready(function(){
MDFCN_DT : datetimeFormat MDFCN_DT : datetimeFormat
} }
}); });
$P.ctrl.defaultFetchSize = FETCH_XS; ctrl.defaultFetchSize = FETCH_XS;
$P.ctrl.query = { pageNum : 1, fetchSize : $P.ctrl.defaultFetchSize }; ctrl.query = { pageNum : 1, fetchSize : ctrl.defaultFetchSize };
$P.ctrl.beforeCurrent = null; ctrl.beforeCurrent = null;
ctrl.dataset.onDatasetChange = (obj, option) => {
/**************************************************************************
* Dataset.on
**************************************************************************/
$P.ctrl.dataset.onDatasetChange = (obj, option) => {
var t = $P.getGridTemplate(); var t = $P.getGridTemplate();
var trs = Apply.fromDataset.getTbody($P.ctrl.dataset, t.found, t.notFound, t.replacer); var trs = Apply.fromDataset.getTbody(ctrl.dataset, t.found, t.notFound, t.replacer);
$P.renderNtcList(obj["Total"], $P.ctrl.dataset.length, trs, option); $P.renderNtcList(obj["Total"], ctrl.dataset.length, trs, option);
Apply.fromDataset.paging($P.ctrl.dataset, obj, $P.findn("ntcPaging"), $P.findn("ntcPagingInfo")); Apply.fromDataset.paging(ctrl.dataset, obj, $P.findn("ntcPaging"), $P.findn("ntcPagingInfo"));
}; };
$P.ctrl.dataset.onCurrentChange = (dataItem) => { ctrl.dataset.onCurrentChange = (dataItem) => {
Apply.fromDataset.currentRow($P.ctrl.dataset, dataItem, $P.findn("ntcTbody")); Apply.fromDataset.currentRow(ctrl.dataset, dataItem, $P.findn("ntcTbody"));
} }
$P.ctrl.dataset.onSelectionChange = (selectedArr) => { ctrl.dataset.onSelectionChange = (selectedArr) => {
}; };
@ -172,32 +168,32 @@ $(document).ready(function(){
searchForm.find("select[name='sggCd']").val(MY_INFO.info.sggCd); searchForm.find("select[name='sggCd']").val(MY_INFO.info.sggCd);
$P.ctrl.dataset.setData([]); ctrl.dataset.setData([]);
} }
$P.getParams = () => { $P.getParams = () => {
var formFields = new FimsFormFields($P.selectorn("frmSearch")); var formFields = new FimsFormFields($P.selectorn("frmSearch"));
var data = formFields.get(); var data = formFields.get();
data.fetchSize = $P.ctrl.defaultFetchSize; data.fetchSize = ctrl.defaultFetchSize;
return data; return data;
} }
$P.searchNtcList = () => { $P.searchNtcList = () => {
$P.ctrl.query = $P.getParams(); ctrl.query = $P.getParams();
$P.ctrl.load(1); ctrl.load(1);
} }
$P.scrollNtcList = () => { $P.scrollNtcList = () => {
$P.ctrl.load($P.ctrl.query.pageNum + 1); ctrl.load(ctrl.query.pageNum + 1);
} }
$P.refreshNtcList = () => { $P.refreshNtcList = () => {
if($P.ctrl.query.pageNum == null){ if(ctrl.query.pageNum == null){
return; return;
} }
$P.ctrl.reload({all : true}); ctrl.reload({all : true});
} }
$P.getGridTemplate = () => { $P.getGridTemplate = () => {
@ -217,7 +213,7 @@ $(document).ready(function(){
$P.renderNtcList = (total, listLength, trs, option) => { $P.renderNtcList = (total, listLength, trs, option) => {
let noMore = (listLength >= total); let noMore = (listLength >= total);
var initScroll = ($P.ctrl.query.pageNum < 2); var initScroll = (ctrl.query.pageNum < 2);
if(option != null && option.reloaded){ if(option != null && option.reloaded){
initScroll = false; initScroll = false;
} }
@ -235,7 +231,7 @@ $(document).ready(function(){
$P.$findn("ntcTbody").setCurrentRow(dataKey); $P.$findn("ntcTbody").setCurrentRow(dataKey);
Apply.toDataset.current($P.ctrl.dataset, dataKey); Apply.toDataset.current(ctrl.dataset, dataKey);
} }
$P.dblclickNtcList = (dataKey) => { $P.dblclickNtcList = (dataKey) => {
@ -253,7 +249,7 @@ $(document).ready(function(){
} }
ajax.get({ ajax.get({
url : $P.ctrl.urls.getInfo, url : ctrl.urls.getInfo,
data : params, data : params,
success : (resp) => { success : (resp) => {

@ -81,11 +81,11 @@ $(document).ready(function(){
} }
/************************************************************************** /**************************************************************************
* DatasetControl, Dataset, FormFields * DatasetControl, DatasetSupport, FormFields
**************************************************************************/ **************************************************************************/
$P.formFields = new FimsFormFields($P.selectorn("frmEdit")); $P.formFields = new FimsFormFields($P.selectorn("frmEdit"));
$P.ctrl = new DatasetControl({ var ctrl = $P.ctrl = new DatasetControl({
dataGetter : obj => obj["List"], appendData : true, dataGetter : obj => obj["List"], appendData : true,
keymapper : info => info ? info.NTC_ID : "", keymapper : info => info ? info.NTC_ID : "",
urls : { urls : {
@ -101,11 +101,11 @@ $(document).ready(function(){
/************************************************************************** /**************************************************************************
* Dataset.on * Dataset.on
**************************************************************************/ **************************************************************************/
$P.ctrl.dataset.onCurrentChange = (dataItem) => { ctrl.dataset.onCurrentChange = (dataItem) => {
if(!dataItem){ if(!dataItem){
return; return;
} }
$P.formFields.set($P.ctrl,dataItem); $P.formFields.set(ctrl,dataItem);
} }
/************************************************************************** /**************************************************************************
@ -117,10 +117,10 @@ $(document).ready(function(){
var info = $P.formFields.get(); var info = $P.formFields.get();
var create = $P.ctrl.dataset.empty; var create = ctrl.dataset.empty;
ajax.post({ ajax.post({
url : create ? $P.ctrl.urls.create : $P.ctrl.urls.update, url : create ? ctrl.urls.create : ctrl.urls.update,
data : info, data : info,
success : (resp) => { success : (resp) => {
if(resp.saved){ if(resp.saved){
@ -139,7 +139,7 @@ $(document).ready(function(){
var info = $P.formFields.get(); var info = $P.formFields.get();
ajax.post({ ajax.post({
url : $P.ctrl.urls.remove, url : ctrl.urls.remove,
data : info, data : info,
success : (resp) => { success : (resp) => {
if(resp.saved){ if(resp.saved){
@ -165,10 +165,10 @@ $(document).ready(function(){
var ntcInfo = ${ntcInfo}; var ntcInfo = ${ntcInfo};
if(ntcInfo == null){ if(ntcInfo == null){
$P.ctrl.dataset.setData([]); ctrl.dataset.setData([]);
$P.$findn("btnRemove").attr("hidden","hidden"); $P.$findn("btnRemove").attr("hidden","hidden");
} else { } else {
$P.ctrl.dataset.setData([ntcInfo]); ctrl.dataset.setData([ntcInfo]);
$P.$findn("sggCd").attr("disabled","disabled"); $P.$findn("sggCd").attr("disabled","disabled");
if(MY_INFO.institute != "ADMIN00"){ if(MY_INFO.institute != "ADMIN00"){

@ -76,11 +76,11 @@ $(document).ready(function(){
} }
/************************************************************************** /**************************************************************************
* DatasetControl, Dataset, FormFields * DatasetControl, DatasetSupport, FormFields
**************************************************************************/ **************************************************************************/
$P.formFields = new FimsFormFields($P.selectorn("frmEdit")); $P.formFields = new FimsFormFields($P.selectorn("frmEdit"));
$P.ctrl = new DatasetControl({ var ctrl = $P.ctrl = new DatasetControl({
dataGetter : obj => obj["List"], appendData : false, dataGetter : obj => obj["List"], appendData : false,
keymapper : info => info ? info.SCHDL_ID : "", keymapper : info => info ? info.SCHDL_ID : "",
urls : { urls : {
@ -93,14 +93,11 @@ $(document).ready(function(){
} }
}); });
/************************************************************************** ctrl.dataset.onCurrentChange = (dataItem) => {
* Dataset.on
**************************************************************************/
$P.ctrl.dataset.onCurrentChange = (dataItem) => {
if(!dataItem){ if(!dataItem){
return; return;
} }
$P.formFields.set($P.ctrl,dataItem); $P.formFields.set(ctrl,dataItem);
} }
/************************************************************************** /**************************************************************************
@ -120,7 +117,7 @@ $(document).ready(function(){
var create = ($P.$findn("schdlId").val() == ""); var create = ($P.$findn("schdlId").val() == "");
if(create){ if(create){
ajax.post({ ajax.post({
url : $P.ctrl.urls.create, url : ctrl.urls.create,
data : info, data : info,
success : (resp) => { success : (resp) => {
if(resp.saved){ if(resp.saved){
@ -141,7 +138,7 @@ $(document).ready(function(){
}); });
} else { } else {
ajax.post({ ajax.post({
url : $P.ctrl.urls.update, url : ctrl.urls.update,
data : info, data : info,
success : (resp) => { success : (resp) => {
if(resp.saved){ if(resp.saved){
@ -168,7 +165,7 @@ $(document).ready(function(){
var info = $P.formFields.get(); var info = $P.formFields.get();
ajax.post({ ajax.post({
url : $P.ctrl.urls.remove, url : ctrl.urls.remove,
data : info, data : info,
success : (resp) => { success : (resp) => {
if(resp.saved){ if(resp.saved){
@ -201,10 +198,10 @@ $(document).ready(function(){
var schdlInfo = ${schdlInfo}; var schdlInfo = ${schdlInfo};
if(schdlInfo != null){ if(schdlInfo != null){
$P.ctrl.dataset.setData([schdlInfo]); ctrl.dataset.setData([schdlInfo]);
} else { } else {
$P.ctrl.dataset.setData([{ SCHDL_BGNG_YMD : "${schdlBgngYmd}", SCHDL_END_YMD : "${schdlEndYmd}" }]); ctrl.dataset.setData([{ SCHDL_BGNG_YMD : "${schdlBgngYmd}", SCHDL_END_YMD : "${schdlEndYmd}" }]);
$P.$findn("btnRemove").attr("hidden","hidden"); $P.$findn("btnRemove").attr("hidden","hidden");
} }

@ -154,9 +154,9 @@ $(document).ready(function(){
}); });
/************************************************************************** /**************************************************************************
* DatasetControl * DatasetControl, DatasetSupport, FormFields
**************************************************************************/ **************************************************************************/
$P.ctrl = new DatasetControl({ var ctrl = $P.ctrl = new DatasetControl({
dataGetter : obj => obj["List"], appendData:true, dataGetter : obj => obj["List"], appendData:true,
keymapper : info => info ? info.DEPT_CD : "", keymapper : info => info ? info.DEPT_CD : "",
urls : { urls : {
@ -168,28 +168,24 @@ $(document).ready(function(){
MDFCN_DT : datetimeFormat MDFCN_DT : datetimeFormat
} }
}); });
$P.ctrl.defaultFetchSize = FETCH_XS; ctrl.defaultFetchSize = FETCH_XS;
$P.ctrl.query = { pageNum : 1, fetchSize : $P.ctrl.defaultFetchSize }; ctrl.query = { pageNum : 1, fetchSize : ctrl.defaultFetchSize };
$P.ctrl.beforeCurrent = null; ctrl.beforeCurrent = null;
ctrl.dataset.onDatasetChange = (obj, option) => {
/**************************************************************************
* Dataset.on
**************************************************************************/
$P.ctrl.dataset.onDatasetChange = (obj, option) => {
var t = $P.getGridTemplate(); var t = $P.getGridTemplate();
var trs = Apply.fromDataset.getTbody($P.ctrl.dataset, t.found, t.notFound, t.replacer); var trs = Apply.fromDataset.getTbody(ctrl.dataset, t.found, t.notFound, t.replacer);
$P.renderDeptList(obj["Total"], $P.ctrl.dataset.length, trs, option); $P.renderDeptList(obj["Total"], ctrl.dataset.length, trs, option);
Apply.fromDataset.paging($P.ctrl.dataset, obj, $P.findn("deptPaging"), $P.findn("deptPagingInfo")); Apply.fromDataset.paging(ctrl.dataset, obj, $P.findn("deptPaging"), $P.findn("deptPagingInfo"));
}; };
$P.ctrl.dataset.onCurrentChange = (dataItem) => { ctrl.dataset.onCurrentChange = (dataItem) => {
Apply.fromDataset.currentRow($P.ctrl.dataset, dataItem, $P.findn("deptTbody")); Apply.fromDataset.currentRow(ctrl.dataset, dataItem, $P.findn("deptTbody"));
} }
$P.ctrl.dataset.onSelectionChange = (selectedArr) => { ctrl.dataset.onSelectionChange = (selectedArr) => {
Apply.fromDataset.gridCheckbox($P.ctrl.dataset, $P.findn("deptTbody"), 1, selectedArr); Apply.fromDataset.gridCheckbox(ctrl.dataset, $P.findn("deptTbody"), 1, selectedArr);
}; };
@ -205,32 +201,32 @@ $(document).ready(function(){
searchForm.find("select[name='sggCd']").val(MY_INFO.info.sggCd); searchForm.find("select[name='sggCd']").val(MY_INFO.info.sggCd);
$P.ctrl.dataset.setData([]); ctrl.dataset.setData([]);
} }
$P.getParams = () => { $P.getParams = () => {
var formFields = new FimsFormFields($P.selectorn("frmSearch")); var formFields = new FimsFormFields($P.selectorn("frmSearch"));
var data = formFields.get(); var data = formFields.get();
data.fetchSize = $P.ctrl.defaultFetchSize; data.fetchSize = ctrl.defaultFetchSize;
return data; return data;
} }
$P.searchDeptList = () => { $P.searchDeptList = () => {
$P.ctrl.query = $P.getParams(); ctrl.query = $P.getParams();
$P.ctrl.load(1); ctrl.load(1);
} }
$P.scrollDeptList = () => { $P.scrollDeptList = () => {
$P.ctrl.load($P.ctrl.query.pageNum + 1); ctrl.load(ctrl.query.pageNum + 1);
} }
$P.refreshDeptList = () => { $P.refreshDeptList = () => {
if($P.ctrl.query.pageNum == null){ if(ctrl.query.pageNum == null){
return; return;
} }
$P.ctrl.reload({all : true}); ctrl.reload({all : true});
} }
$P.getGridTemplate = () => { $P.getGridTemplate = () => {
@ -250,7 +246,7 @@ $(document).ready(function(){
$P.renderDeptList = (total, listLength, trs, option) => { $P.renderDeptList = (total, listLength, trs, option) => {
let noMore = (listLength >= total); let noMore = (listLength >= total);
var initScroll = ($P.ctrl.query.pageNum < 2); var initScroll = (ctrl.query.pageNum < 2);
if(option != null && option.reloaded){ if(option != null && option.reloaded){
initScroll = false; initScroll = false;
} }
@ -268,7 +264,7 @@ $(document).ready(function(){
$P.$findn("deptTbody").setCurrentRow(dataKey); $P.$findn("deptTbody").setCurrentRow(dataKey);
Apply.toDataset.current($P.ctrl.dataset, dataKey); Apply.toDataset.current(ctrl.dataset, dataKey);
} }
$P.dblclickDeptList = (dataKey) => { $P.dblclickDeptList = (dataKey) => {
@ -282,7 +278,7 @@ $(document).ready(function(){
params.deptCd = deptCd; params.deptCd = deptCd;
ajax.get({ ajax.get({
url : $P.ctrl.urls.getInfo, url : ctrl.urls.getInfo,
data : params, data : params,
success : (resp) => { success : (resp) => {

@ -279,7 +279,7 @@ $(document).ready(function(){
**************************************************************************/ **************************************************************************/
$P.formFields = new FimsFormFields($P.selectorn("frmEdit")); $P.formFields = new FimsFormFields($P.selectorn("frmEdit"));
$P.ctrl = new DatasetControl({ var ctrl = $P.ctrl = new DatasetControl({
dataGetter : obj => obj["List"], appendData : true, dataGetter : obj => obj["List"], appendData : true,
keymapper : info => info ? info.DEPT_CD : "", keymapper : info => info ? info.DEPT_CD : "",
urls : { urls : {
@ -293,11 +293,11 @@ $(document).ready(function(){
/************************************************************************** /**************************************************************************
* Dataset.on * Dataset.on
**************************************************************************/ **************************************************************************/
$P.ctrl.dataset.onCurrentChange = (dataItem) => { ctrl.dataset.onCurrentChange = (dataItem) => {
if(!dataItem){ if(!dataItem){
return; return;
} }
$P.formFields.set($P.ctrl,dataItem); $P.formFields.set(ctrl,dataItem);
} }
/************************************************************************** /**************************************************************************
@ -313,10 +313,10 @@ $(document).ready(function(){
return; return;
} }
var create = $P.ctrl.dataset.empty; var create = ctrl.dataset.empty;
ajax.post({ ajax.post({
url : create ? $P.ctrl.urls.create : $P.ctrl.urls.update, url : create ? ctrl.urls.create : ctrl.urls.update,
data : info, data : info,
success : (resp) => { success : (resp) => {
if(resp.saved){ if(resp.saved){
@ -347,7 +347,7 @@ $(document).ready(function(){
var deptInfo = ${deptInfo}; var deptInfo = ${deptInfo};
$P.$findn("deptID").attr("disabled","disabled"); $P.$findn("deptID").attr("disabled","disabled");
$P.$findn("name").attr("disabled","disabled"); $P.$findn("name").attr("disabled","disabled");
$P.ctrl.dataset.setData([deptInfo]); ctrl.dataset.setData([deptInfo]);
if(deptInfo.USE_YN == "N"){ if(deptInfo.USE_YN == "N"){
$P.$findn("btnSave").attr("disabled","disabled"); $P.$findn("btnSave").attr("disabled","disabled");
} }

Loading…
Cancel
Save