소스 정리

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

@ -81,11 +81,11 @@ $(document).ready(function(){
}
/**************************************************************************
* DatasetControl, Dataset, FormFields
* DatasetControl, DatasetSupport, FormFields
**************************************************************************/
$P.formFields = new FimsFormFields($P.selectorn("frmEdit"));
$P.ctrl = new DatasetControl({
var ctrl = $P.ctrl = new DatasetControl({
dataGetter : obj => obj["List"], appendData : true,
keymapper : info => info ? info.NTC_ID : "",
urls : {
@ -101,11 +101,11 @@ $(document).ready(function(){
/**************************************************************************
* Dataset.on
**************************************************************************/
$P.ctrl.dataset.onCurrentChange = (dataItem) => {
ctrl.dataset.onCurrentChange = (dataItem) => {
if(!dataItem){
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 create = $P.ctrl.dataset.empty;
var create = ctrl.dataset.empty;
ajax.post({
url : create ? $P.ctrl.urls.create : $P.ctrl.urls.update,
url : create ? ctrl.urls.create : ctrl.urls.update,
data : info,
success : (resp) => {
if(resp.saved){
@ -139,7 +139,7 @@ $(document).ready(function(){
var info = $P.formFields.get();
ajax.post({
url : $P.ctrl.urls.remove,
url : ctrl.urls.remove,
data : info,
success : (resp) => {
if(resp.saved){
@ -165,10 +165,10 @@ $(document).ready(function(){
var ntcInfo = ${ntcInfo};
if(ntcInfo == null){
$P.ctrl.dataset.setData([]);
ctrl.dataset.setData([]);
$P.$findn("btnRemove").attr("hidden","hidden");
} else {
$P.ctrl.dataset.setData([ntcInfo]);
ctrl.dataset.setData([ntcInfo]);
$P.$findn("sggCd").attr("disabled","disabled");
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.ctrl = new DatasetControl({
var ctrl = $P.ctrl = new DatasetControl({
dataGetter : obj => obj["List"], appendData : false,
keymapper : info => info ? info.SCHDL_ID : "",
urls : {
@ -93,14 +93,11 @@ $(document).ready(function(){
}
});
/**************************************************************************
* Dataset.on
**************************************************************************/
$P.ctrl.dataset.onCurrentChange = (dataItem) => {
ctrl.dataset.onCurrentChange = (dataItem) => {
if(!dataItem){
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() == "");
if(create){
ajax.post({
url : $P.ctrl.urls.create,
url : ctrl.urls.create,
data : info,
success : (resp) => {
if(resp.saved){
@ -141,7 +138,7 @@ $(document).ready(function(){
});
} else {
ajax.post({
url : $P.ctrl.urls.update,
url : ctrl.urls.update,
data : info,
success : (resp) => {
if(resp.saved){
@ -168,7 +165,7 @@ $(document).ready(function(){
var info = $P.formFields.get();
ajax.post({
url : $P.ctrl.urls.remove,
url : ctrl.urls.remove,
data : info,
success : (resp) => {
if(resp.saved){
@ -201,10 +198,10 @@ $(document).ready(function(){
var schdlInfo = ${schdlInfo};
if(schdlInfo != null){
$P.ctrl.dataset.setData([schdlInfo]);
ctrl.dataset.setData([schdlInfo]);
} 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");
}

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

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

Loading…
Cancel
Save