|
|
@@ -1,4 +1,6 @@
|
|
|
-
|
|
|
+const emptyStr = `<tr>
|
|
|
+ <td><span>조회 된 항목이 없습니다.</span></td>
|
|
|
+ </tr>`;
|
|
|
$(()=>{
|
|
|
init();
|
|
|
})
|
|
|
@@ -10,6 +12,7 @@ function init () {
|
|
|
const $type = $('.type');
|
|
|
const $amBtn = $('.button.amount');
|
|
|
const $comBtn = $('.button.comm');
|
|
|
+ const $conBtn = $('.button.congest');
|
|
|
const $toggle = $('.table-toggle');
|
|
|
|
|
|
const now = new Date();
|
|
|
@@ -19,9 +22,13 @@ function init () {
|
|
|
|
|
|
$amBtn.on('click', () => searchStatisticsAmount());
|
|
|
$comBtn.on('click', ()=> searchStatisticsComm());
|
|
|
+ $conBtn.on('click', ()=> searchStatisticsCongest());
|
|
|
+
|
|
|
$type.on('change', function(){
|
|
|
const isDisabled = !($(this).val() === 'dd');
|
|
|
$date.attr('disabled', isDisabled);
|
|
|
+ const opacity = isDisabled ? 0 : 1;
|
|
|
+ $date.css('opacity', opacity);
|
|
|
})
|
|
|
|
|
|
if ($year[0]) {
|
|
|
@@ -93,7 +100,7 @@ function init () {
|
|
|
if ($date[0]) {
|
|
|
let options = getDateOptions(1, nowDate, '일');
|
|
|
$date.html(options);
|
|
|
- $date.val(nowMonth);
|
|
|
+ $date.val(nowDate);
|
|
|
}
|
|
|
|
|
|
if ($toggle[0]) {
|
|
|
@@ -104,6 +111,7 @@ function init () {
|
|
|
$(this).addClass("active");
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -167,13 +175,10 @@ function searchStatisticsAmount() {
|
|
|
toDt : toDt,
|
|
|
}
|
|
|
|
|
|
- let height = 'calc(-400px + 100vh)';
|
|
|
- $table.css('height', height);
|
|
|
+ // let height = 'calc(-400px + 100vh)';
|
|
|
+ // $table.css('height', height);
|
|
|
$tbody.html('<tr><td><span><img src="/images/icon/loading.gif"></span></td></tr>');
|
|
|
getDataAsync('/api/statistics/amount/' + type, "POST", param, null, (jsonData)=>{
|
|
|
- let emptyStr = `<tr>
|
|
|
- <td><span>조회 된 항목이 없습니다.</span></td>
|
|
|
- </tr>`;
|
|
|
let str = emptyStr;
|
|
|
let thead = "";
|
|
|
|
|
|
@@ -193,8 +198,8 @@ function searchStatisticsAmount() {
|
|
|
}
|
|
|
str += `</tr>`
|
|
|
});
|
|
|
- height = 'auto';
|
|
|
- $table.css('height', height);
|
|
|
+ // height = 'auto';
|
|
|
+ // $table.css('height', height);
|
|
|
}
|
|
|
if (limit) {
|
|
|
thead = '<th>구간</th>';
|
|
|
@@ -251,16 +256,12 @@ function searchStatisticsComm() {
|
|
|
toDt : toDt,
|
|
|
}
|
|
|
|
|
|
- let height = 'calc(-443px + 100vh)';
|
|
|
+ // let height = 'calc(-443px + 100vh)';
|
|
|
let url = "/speed";
|
|
|
- $table.css('height', height);
|
|
|
+ // $table.css('height', height);
|
|
|
$tbody.html('<tr><td><span><img src="/images/icon/loading.gif"></span></td></tr>');
|
|
|
- console.log(active);
|
|
|
if (active === '지/정체통계') url = '/grade';
|
|
|
|
|
|
- let emptyStr = `<tr>
|
|
|
- <td><span>조회 된 항목이 없습니다.</span></td>
|
|
|
- </tr>`;
|
|
|
let thead = "";
|
|
|
if (limit) {
|
|
|
thead = '<th>구간</th>';
|
|
|
@@ -296,8 +297,8 @@ function searchStatisticsComm() {
|
|
|
}
|
|
|
str += `</tr>`
|
|
|
});
|
|
|
- height = 'auto';
|
|
|
- $table.css('height', height);
|
|
|
+ // height = 'auto';
|
|
|
+ // $table.css('height', height);
|
|
|
}
|
|
|
|
|
|
$thead.html(thead);
|
|
|
@@ -309,6 +310,61 @@ function searchStatisticsComm() {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * 정체 통계 조회
|
|
|
+ */
|
|
|
+function searchStatisticsCongest() {
|
|
|
+ const $type = $('.type');
|
|
|
+ const $day = $('.day');
|
|
|
+ const $thead = $('.thead');
|
|
|
+ const $tbody = $('.table-content');
|
|
|
+ const $table = $('.table-box table');
|
|
|
+ const type = $type.val();
|
|
|
+ const day = $day.val();
|
|
|
+ const now = new Date();
|
|
|
+ const year = now.getFullYear();
|
|
|
+ let month = (Number(now.getMonth()) - 1) - Number(type);
|
|
|
+ if (month < 10) {
|
|
|
+ month = "0" + month;
|
|
|
+ }
|
|
|
+ const statYm = year + month;
|
|
|
+
|
|
|
+ const param = {
|
|
|
+ statYm : statYm,
|
|
|
+ day : day,
|
|
|
+ }
|
|
|
+
|
|
|
+ // let height = 'calc(-443px + 100vh)';
|
|
|
+ // $table.css('height', height);
|
|
|
+ $tbody.html('<tr><td><span><img src="/images/icon/loading.gif"></span></td></tr>');
|
|
|
+
|
|
|
+
|
|
|
+ getDataAsync('/api/statistics/congest' , "POST", param, null, (jsonData)=>{
|
|
|
+ let str = emptyStr;
|
|
|
+
|
|
|
+ if (jsonData && jsonData.length > 0) {
|
|
|
+ str = "";
|
|
|
+ jsonData.forEach((obj)=>{
|
|
|
+ const { road_nm, strt_nm, end_nm, strt_tm, end_tm, sped} = obj;
|
|
|
+
|
|
|
+ str += `<tr>
|
|
|
+ <td>${road_nm}</td>
|
|
|
+ <td>${strt_nm}</td>
|
|
|
+ <td>${end_nm}</td>
|
|
|
+ <td>${strt_tm}</td>
|
|
|
+ <td>${end_tm}</td>
|
|
|
+ <td>${sped} km</td>
|
|
|
+ </tr>`
|
|
|
+ });
|
|
|
+ // height = 'auto';
|
|
|
+ // $table.css('height', height);
|
|
|
+ }
|
|
|
+ $tbody.html(str);
|
|
|
+ }, ()=>{
|
|
|
+ $tbody.html(emptyStr);
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* 조회 날짜 값 포맷
|
|
|
* @param year 년도
|