포맷팅 중복 기능 제거

json.get -> ajax.get
main
이범준 1 year ago
parent 0b6bfe00d8
commit e6df49fc14

@ -42,16 +42,16 @@ class FimsFormFields extends FormFields {
const fmtType = input.dataset.fmtType; const fmtType = input.dataset.fmtType;
switch (fmtType) { switch (fmtType) {
case 'dt' : case 'dt' :
value = StrDateTimeFormat.format(value); value = dateTimeFormat.format(value);
break; break;
case 'day' : case 'day' :
value = StrDateFormat.format(value); value = dateFormat.format(value);
break; break;
case 'time' : case 'time' :
value = StrTimeFormat.format(value); value = StrTimeFormat.format(value);
break; break;
case 'number' : case 'number' :
value = CommaNumberFormat.format(value); value = numberFormat.format(value);
break; break;
default: default:
break; break;

@ -1,53 +1,3 @@
/**
* 숫자를 콤마 포멧으로 변환
**/
const CommaNumberFormat = {
format(value){
var reg = /(^[+-]?\d+)(\d{3})/;
value += '';
while (reg.test(value))
value = value.replace(reg, '$1' + ',' + '$2');
return value;
}
}
/**
* yyyyMMddHH24miss
* yyyy-MM-ddTHH24:mi:ss.xxxxxxZ
* @param {string} srcDateStr
* @param {string} delimiter
* @returns {string|*}
*/
const StrDateTimeFormat = {
format(value){
if(value == null || value.isBlank()) return value;
let srcDate = value.replace(/\-|\s|\:|\.|T|Z/g,'');
if(srcDate.length == 8) {
return srcDate.substring(0, 4)+"-"+srcDate.substring(4, 6)+"-"+srcDate.substring(6, 8);
}else if(srcDate.length >= 14){
return srcDate.substring(0, 4)+"-"+srcDate.substring(4, 6)+"-"+srcDate.substring(6, 8)
+ ' ' + srcDate.substring(8, 10) + ':' + srcDate.substring(10, 12) + ':' + srcDate.substring(12, 14);
}else{
return srcDate;
}
}
}
const StrDateFormat = {
format(value){
if(value == null || value.isBlank()) return value;
let srcDate = value.replace(/\-|\s|\:|\./g,'');
if(srcDate.length >= 8) {
return srcDate.substring(0, 4)+"-"+srcDate.substring(4, 6)+"-"+srcDate.substring(6, 8);
}else{
return srcDate;
}
}
}
const StrTimeFormat= { const StrTimeFormat= {
format(value){ format(value){
@ -105,11 +55,11 @@ class FimsDatasetControl extends DatasetControl {
load(pageNum,flag) { load(pageNum,flag) {
if(this._paginationInfo.paging){ if(this._paginationInfo.paging){
this.query.pageNum = pageNum;
this.query.fetchSize = this._paginationInfo.fetchSize; this.query.fetchSize = this._paginationInfo.fetchSize;
this.query.pageNum = pageNum;
} else { } else {
this.query.pageNum = 0;
this.query.fetchSize = 0; this.query.fetchSize = 0;
this.query.pageNum = 0;
} }
this._load(flag); this._load(flag);
@ -118,7 +68,7 @@ class FimsDatasetControl extends DatasetControl {
_load(flag) { _load(flag) {
if (!this.query.pageNum) if (!this.query.pageNum)
this.query.pageNum = 1; this.query.pageNum = 1;
json.get({ ajax.get({
url:this.urls.load, url:this.urls.load,
data:this.query, data:this.query,
success:resp => this.setData(resp,flag) success:resp => this.setData(resp,flag)

@ -1181,7 +1181,7 @@ class DatasetControl {
_load() { _load() {
if (!this.query.pageNum) if (!this.query.pageNum)
this.query.pageNum = 1; this.query.pageNum = 1;
json.get({ ajax.get({
url:this.urls.load, url:this.urls.load,
data:this.query, data:this.query,
success:resp => this.setData(resp) success:resp => this.setData(resp)

Loading…
Cancel
Save