포맷팅 중복 기능 제거

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;
switch (fmtType) {
case 'dt' :
value = StrDateTimeFormat.format(value);
value = dateTimeFormat.format(value);
break;
case 'day' :
value = StrDateFormat.format(value);
value = dateFormat.format(value);
break;
case 'time' :
value = StrTimeFormat.format(value);
break;
case 'number' :
value = CommaNumberFormat.format(value);
value = numberFormat.format(value);
break;
default:
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= {
format(value){
@ -105,11 +55,11 @@ class FimsDatasetControl extends DatasetControl {
load(pageNum,flag) {
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 {
this.query.fetchSize = 0;
this.query.pageNum = 0;
this.query.fetchSize = 0;
}
this._load(flag);
@ -118,7 +68,7 @@ class FimsDatasetControl extends DatasetControl {
_load(flag) {
if (!this.query.pageNum)
this.query.pageNum = 1;
json.get({
ajax.get({
url:this.urls.load,
data:this.query,
success:resp => this.setData(resp,flag)

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

Loading…
Cancel
Save