팝업 조회 조건 수정

This commit is contained in:
bd091
2025-10-25 10:03:07 +09:00
parent 03aa2abd8a
commit 68c6196d21
4 changed files with 28 additions and 290 deletions

View File

@@ -7,189 +7,6 @@ let webPopupAgGridData = [];
let webPopupSelectId = "";
/****************************************************************************
* 검색 날짜 설정
//(A:오늘, B:3일, C:7일, D:최근30일, E:최근90일, F:이번달, G:올해, H:지난주, I:지난달)
****************************************************************************/
function fn_webPopupSetDate(param){
if("A"==param){
// 오늘
let toDate = new Date();
let year = toDate.getFullYear();
let month = toDate.getMonth() + 1;
let day = toDate.getDate();
if(month < 10) month = "0" + month;
if(day < 10) day = "0" + day;
webPopupSearchStartDate = year+'-'+month+'-'+day;
webPopupSearchEndDate = year+'-'+month+'-'+day;
}
else if("B"==param){
// 3일
// 검색 종료일자
let toDate = new Date();
let year = toDate.getFullYear();
let month = toDate.getMonth() + 1;
let day = toDate.getDate();
if(month < 10) month = "0" + month;
if(day < 10) day = "0" + day;
webPopupSearchEndDate = year+'-'+month+'-'+day;
// 검색 시작일자
toDate.setDate(toDate.getDate() - 3);
year = toDate.getFullYear();
month = toDate.getMonth() + 1;
day = toDate.getDate();
if(month < 10) month = "0" + month;
if(day < 10) day = "0" + day;
webPopupSearchStartDate = year+'-'+month+'-'+day;
}
else if("C"==param){
// 이번주
// 검색 종료일자
let toDate = new Date();
let year = toDate.getFullYear();
let month = toDate.getMonth() + 1;
let day = toDate.getDate();
if(month < 10) month = "0" + month;
if(day < 10) day = "0" + day;
webPopupSearchEndDate = year+'-'+month+'-'+day;
// 검색 시작일자
toDate.setDate(toDate.getDate() - 7);
year = toDate.getFullYear();
month = toDate.getMonth() + 1;
day = toDate.getDate();
if(month < 10) month = "0" + month;
if(day < 10) day = "0" + day;
webPopupSearchStartDate = year+'-'+month+'-'+day;
}
else if("D"==param){
// 최근30일
let toDate = new Date();
let year = toDate.getFullYear();
let month = toDate.getMonth() + 1;
let day = toDate.getDate();
if(month < 10) month = "0" + month;
if(day < 10) day = "0" + day;
//최근30일
toDate.setDate(toDate.getDate() - 30);
startYear = toDate.getFullYear();
startMonth = toDate.getMonth() + 1;
startDay = toDate.getDate();
if(startMonth < 10) startMonth = "0" + startMonth;
if(startDay < 10) startDay = "0" + startDay;
webPopupSearchStartDate = startYear+'-'+startMonth+'-'+startDay;
webPopupSearchEndDate = year+'-'+month+'-'+day;
}
else if("E"==param){
// 최근90일
// 검색 종료일자
let toDate = new Date();
let year = toDate.getFullYear();
let month = toDate.getMonth() + 1;
let day = toDate.getDate();
if(month < 10) month = "0" + month;
if(day < 10) day = "0" + day;
webPopupSearchEndDate = year+'-'+month+'-'+day;
// 검색 시작일자
toDate.setDate(toDate.getDate() - 90);
year = toDate.getFullYear();
month = toDate.getMonth() + 1;
day = toDate.getDate();
if(month < 10) month = "0" + month;
if(day < 10) day = "0" + day;
webPopupSearchStartDate = year+'-'+month+'-'+day;
}
else if("F"==param){
//F:이번달
// 검색 종료일자
let toDate = new Date();
let year = toDate.getFullYear();
let month = toDate.getMonth() + 1;
let day = toDate.getDate();
if(month < 10) month = "0" + month;
if(day < 10) day = "0" + day;
webPopupSearchEndDate = year+'-'+month+'-'+day;
// 검색 시작일자
webPopupSearchStartDate = year+'-'+month+'-01';
}
else if("G"==param){
// G:올해
// 검색 종료일자
let toDate = new Date();
let year = toDate.getFullYear();
let month = toDate.getMonth() + 1;
let day = toDate.getDate();
if(month < 10) month = "0" + month;
if(day < 10) day = "0" + day;
webPopupSearchEndDate = year+'-'+month+'-'+day;
// 검색 시작일자
webPopupSearchStartDate = year+'-01-01';
}
else if("H"==param){
// H:지난주, I:지난달
// 검색 종료일자
let toDate = new Date();
let year = toDate.getFullYear();
let month = toDate.getMonth() + 1;
let day = toDate.getDate();
if(month < 10) month = "0" + month;
if(day < 10) day = "0" + day;
webPopupSearchEndDate = year+'-'+month+'-'+day;
// 검색 시작일자
webPopupSearchStartDate = year+'-01-01';
}
else if("I"==param){
// I:지난달
// 검색 종료일자
let toDate = new Date();
let year = toDate.getFullYear();
let month = toDate.getMonth() + 1;
let day = toDate.getDate();
if(month < 10) month = "0" + month;
if(day < 10) day = "0" + day;
webPopupSearchEndDate = year+'-'+month+'-'+day;
// 검색 시작일자
webPopupSearchStartDate = year+'-01-01';
}
$("#webPopupSearchStartDate").val(webPopupSearchStartDate).trigger("change");
$("#webPopupSearchEndDate").val(webPopupSearchEndDate).trigger("change");
}
/****************************************************************************
* 콘텐츠 정보 리스트 조회
****************************************************************************/
@@ -202,9 +19,10 @@ function fn_selectListWebPopupJson(){
formData.append("webPopupDir", webPopupDir);
formData.append("webPopupStart", webPopupStart);
formData.append("webPopupLimit", webPopupLimit);
formData.append("webPopupSearchStartDate", webPopupSearchStartDate);
formData.append("webPopupSearchEndDate", webPopupSearchEndDate);
formData.append("webPopupSearchDateType", webPopupSearchDateType);
formData.append("homepageDivCd", $("#homepageDivCd").val());
//formData.append("webPopupSearchStartDate", webPopupSearchStartDate);
//formData.append("webPopupSearchEndDate", webPopupSearchEndDate);
//formData.append("webPopupSearchDateType", webPopupSearchDateType);
$.ajax({
url: encodeURI('/webpopup/selectListWebPopup.do'),
@@ -285,9 +103,9 @@ function fn_webPopupSearch(param){
webPopupCategoryName = $("#webPopupCategoryName").val();
webPopupSearchDateType = $("#webPopupSearchDateType").val();
webPopupSearchStartDate = $("#webPopupSearchStartDate").val();
webPopupSearchEndDate = $("#webPopupSearchEndDate").val();
//webPopupSearchDateType = $("#webPopupSearchDateType").val();
//webPopupSearchStartDate = $("#webPopupSearchStartDate").val();
//webPopupSearchEndDate = $("#webPopupSearchEndDate").val();
fn_selectListWebPopupJson();
}
@@ -297,9 +115,6 @@ function fn_webPopupSearch(param){
* 초기화하기
****************************************************************************/
function fn_webPopupReset(){
fn_webPopupSetDate('D');
$("#webPopupSearchDateType option:eq(0)").prop("selected", true);
$("#webPopupSearchKeyword").val("");
fn_webPopupSearch();
@@ -401,59 +216,6 @@ function fn_webPopupEnter(e){
}
}
/****************************************************************************
* 정렬 이벤트
****************************************************************************/
function fn_alignContent(param, param2){
let align = "";
if("A"==param){
align = "오늘";
fn_webPopupSetDate('A');
}
else if("B"==param){
align = "최근30일";
fn_webPopupSetDate('D');
}
else if("C"==param){
align = "최근90일";
fn_webPopupSetDate('E');
}
else if("D"==param){
align = "이번주";
fn_webPopupSetDate('C');
}
else if("E"==param){
align = "이번달";
fn_webPopupSetDate('F');
}
else if("F"==param){
align = "올해";
fn_webPopupSetDate('G');
}
else if("G"==param){
align = "지난주";
fn_webPopupSetDate('H');
}
else if("H"==param){
align = "지난달";
fn_webPopupSetDate('I');
}
else{
align = "";
}
$("#webPopupSearchDateType").val(param);
$("#webPopupSearchDateType").siblings("button").text(align);
}
/****************************************************************************
* 완료
****************************************************************************/
@@ -510,7 +272,6 @@ let webPopupColumnDefs = [
if (params.value === "02") return "쁘띠";
return params.value;
}},
// {field: "webPopupCategoryName", headerName:"카테고리", minWidth:200},
{field: "filePath", headerName:"이미지", minWidth:100, cellRenderer: thumbnailCellRenderer},
{field: "title", headerName:"제목", minWidth:250, cellStyle:{cursor: 'pointer', color:'#3985EA'}},
// {field: "content", headerName:"내용",minWidth:500},
@@ -526,7 +287,7 @@ let webPopupGridOptions = {
flex: 1,
sortable: true, //정렬 여부
resizable: true, //리사이즈
editable: true, // 그리드에서 데이터 수정
editable: false, // 그리드에서 데이터 수정
cellStyle:{textAlign:'left',fontSize:'14px',padding:'0'},
//suppressSizeToFit:true, //자동 맞춤
//enableRowGroup: true, // 그룹 묶음
@@ -608,16 +369,6 @@ new agGrid.Grid(webPopupGridDiv, webPopupGridOptions);
* 페이지 init
****************************************************************************/
function fn_pageInit(){
// 날짜 datepicker
fn_searchDatePicker("#divWebPopupSearchStartDate", "#divWebPopupSearchEndDate");
if(!webPopupSearchStartDate&&!webPopupSearchEndDate){
// 검색 오늘날짜 셋팅
fn_webPopupSetDate('D');
}else{
$("#webPopupSearchStartDate").val(webPopupSearchStartDate).trigger("change");
$("#webPopupSearchEndDate").val(webPopupSearchEndDate).trigger("change");
}
// 초기 페이징 처리
$("#webPopupSearchKeyword").val(webPopupSearchKeywordParam);
@@ -648,19 +399,6 @@ function fn_pageEvent(){
$("#btnDeleteWebPopup").click(function () {
fn_deleteWebPopup();
});
// 기간 선택 콤보 이벤트
const target = $("#webPopupSearchDateType").siblings("ul.select_option_list");
target.find("li.option_list_item").click(function () {
let selectIdArr = $(this).prop("id").split('_');
let selectId = selectIdArr[1];
let selectName = $(this).text();
$(this).parent().siblings("button").text(selectName);
$(this).parent().siblings("input").val(selectId);
fn_alignContent(selectId);
});
}
$(function(){