소스 정리

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

@ -106,8 +106,8 @@
<script>
/**************************************************************************
* Global Variable
**************************************************************************/
* Global Variable
**************************************************************************/
pageObject["${pageName}"] = newDoctxFinder("${pageName}");
@ -122,9 +122,9 @@ $(document).ready(function(){
});
/**************************************************************************
* DatasetControl
**************************************************************************/
$P.ctrl = new DatasetControl({
* DatasetControl, DatasetSupport, FormFields
**************************************************************************/
var ctrl = $P.ctrl = new DatasetControl({
dataGetter : obj => obj["List"], appendData:true,
keymapper : info => info ? info.NTC_ID : "",
urls : {
@ -136,33 +136,29 @@ $(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) => {
};
/**************************************************************************
* pageObject.function
**************************************************************************/
* pageObject.function
**************************************************************************/
$P.fnReset = () => {
var searchForm = $P.$findn("frmSearch");
searchForm.find("input[type='radio']").not("[name='taskSeCd']").prop("checked", false);
@ -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) => {
@ -295,15 +291,15 @@ $(document).ready(function(){
};
/**************************************************************************
* element.on
**************************************************************************/
* element.on
**************************************************************************/
$P.$findn("btnReset").on('click', () => $P.fnReset());
$P.$findn("btnSearch").on('click', () => $P.searchNtcList());
$P.$findn("btnAdd").on('click', () => $P.createNtc());
/**************************************************************************
* 초기화
**************************************************************************/
* 초기화
**************************************************************************/
Componentization.fnMakeResizableTable($P.findn("table-responsive"));
Componentization.fnMakeScrollableTable($P.findn("table-responsive"), $P.scrollNtcList);

@ -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 : {
@ -99,28 +99,28 @@ $(document).ready(function(){
});
/**************************************************************************
* Dataset.on
**************************************************************************/
$P.ctrl.dataset.onCurrentChange = (dataItem) => {
* Dataset.on
**************************************************************************/
ctrl.dataset.onCurrentChange = (dataItem) => {
if(!dataItem){
return;
}
$P.formFields.set($P.ctrl,dataItem);
$P.formFields.set(ctrl,dataItem);
}
/**************************************************************************
* pageObject.function
**************************************************************************/
* pageObject.function
**************************************************************************/
$P.fnSave = () => {
if(!AppSupport.customValidate($P.$findn("frmEdit").find("input"))) return;
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){
@ -154,21 +154,21 @@ $(document).ready(function(){
}
/**************************************************************************
* element.on
**************************************************************************/
* element.on
**************************************************************************/
$P.$findn("btnSave").on('click', () => $P.fnSave());
$P.$findn("btnRemove").on('click', () => $P.fnRemove());
/**************************************************************************
* 초기화
**************************************************************************/
* 초기화
**************************************************************************/
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,19 +93,16 @@ $(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);
}
/**************************************************************************
* pageObject.function
**************************************************************************/
* pageObject.function
**************************************************************************/
$P.fnSave = () => {
if(!AppSupport.customValidate($P.$findn("frmEdit").find("input"))) return;
@ -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){
@ -189,22 +186,22 @@ $(document).ready(function(){
}
/**************************************************************************
* element.on
**************************************************************************/
* element.on
**************************************************************************/
$P.$findn("btnSave").on('click', () => $P.fnSave());
$P.$findn("btnRemove").on('click', () => $P.fnRemove());
/**************************************************************************
* 초기화
**************************************************************************/
* 초기화
**************************************************************************/
AppSupport.initDatepicker($P.findn("frmEdit")); //달력 초기화
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");
}

@ -138,8 +138,8 @@
<script>
/**************************************************************************
* Global Variable
**************************************************************************/
* Global Variable
**************************************************************************/
pageObject["${pageName}"] = newDoctxFinder("${pageName}");
@ -154,9 +154,9 @@ $(document).ready(function(){
});
/**************************************************************************
* DatasetControl
**************************************************************************/
$P.ctrl = new DatasetControl({
* DatasetControl, DatasetSupport, FormFields
**************************************************************************/
var ctrl = $P.ctrl = new DatasetControl({
dataGetter : obj => obj["List"], appendData:true,
keymapper : info => info ? info.DEPT_CD : "",
urls : {
@ -168,34 +168,30 @@ $(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);
};
/**************************************************************************
* pageObject.function
**************************************************************************/
* pageObject.function
**************************************************************************/
$P.fnReset = () => {
var searchForm = $P.$findn("frmSearch");
searchForm.find("input[type='radio']").not("[name='taskSeCd']").prop("checked", false);
@ -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) => {
@ -325,14 +321,14 @@ $(document).ready(function(){
};
/**************************************************************************
* element.on
**************************************************************************/
* element.on
**************************************************************************/
$P.$findn("btnReset").on('click', () => $P.fnReset());
$P.$findn("btnSearch").on('click', () => $P.searchDeptList());
/**************************************************************************
* 초기화
**************************************************************************/
* 초기화
**************************************************************************/
Componentization.fnMakeResizableTable($P.findn("table-responsive"));
Componentization.fnMakeScrollableTable($P.findn("table-responsive"), $P.scrollDeptList);

@ -275,11 +275,11 @@ $(document).ready(function(){
}
/**************************************************************************
* DatasetControl, Dataset, FormFields
**************************************************************************/
* DatasetControl, Dataset, 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.DEPT_CD : "",
urls : {
@ -291,18 +291,18 @@ $(document).ready(function(){
});
/**************************************************************************
* Dataset.on
**************************************************************************/
$P.ctrl.dataset.onCurrentChange = (dataItem) => {
* Dataset.on
**************************************************************************/
ctrl.dataset.onCurrentChange = (dataItem) => {
if(!dataItem){
return;
}
$P.formFields.set($P.ctrl,dataItem);
$P.formFields.set(ctrl,dataItem);
}
/**************************************************************************
* pageObject.function
**************************************************************************/
* pageObject.function
**************************************************************************/
$P.fnSave = () => {
if(!AppSupport.customValidate($P.$findn("frmEdit").find("input"))) return;
@ -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){
@ -331,14 +331,14 @@ $(document).ready(function(){
}
/**************************************************************************
* element.on
**************************************************************************/
$P.$findn("btnSave").on('click', () => $P.fnSave());
* element.on
**************************************************************************/
$P.$findn("btnSave").on('click', () => $P.fnSave());
/**************************************************************************
* 초기화
**************************************************************************/
* 초기화
**************************************************************************/
if(MY_INFO.institute == 'ADMIN00') {
$P.$findn("forRootAdmin").removeAttr("hidden");
@ -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