PageSourceSearch

https://spp.kr/resources/js/common/commonPlugin/CommonSearchDate.js

js spp.kr collected 2026-10-08 10:26:20 UTC 7,685 bytes, 146 lines download raw bytes

1
2(function ($) {
3    $.fn.CommonSearchDate = function (opt) {
4        let ID = '';
5        let Obj;
6        let opts;
7
8        $.fn.CommonSearchDate.defaults = {
9            targetId:'sarchDate',
10            radionGroupCheck:false,
11            radioButtonSearchDate : null,
12            searchDateTypePopSelectBox : null,
13            searchDateTypePopSelectBoxOption:null,
14            searchDateInputPopupDiv1:null,
15            searchDateInputPopupDiv:null,
16            searchDatePopupInput:null,
17            searchDateSelectBoxCallback: null
18
19        };
20
21        opts = $.extend({}, $.fn.CommonSearchDate.defaults, opt);
22        ID = $(this)[0].id;
23        Obj = $(this);
24
25
26        function searchDateTypePopSelectBoxOptionEvent(inputData) {
27            console.log('goodsMoneyPopupSelectEvent inputData => ',inputData)
28        }
29
30        function srarchDatePopupEvent(e) {
31            let el = $(e.currentTarget);
32            let type = el.val() ? el.val().toLowerCase() :'t'
33            let start_el = el.parent().siblings(".dateArea").find(".startDate");
34            let end_el = el.parent().siblings(".dateArea").find(".endDate");
35            let today = new Date();
36            if(type == "t") {
37                start_el.val("");
38                end_el.val("");
39            }
40            else if(type == "d") {
41                start_el.val(ezpmpcommonUtil.commonFunc.getDate(today,langCd));
42                end_el.val(ezpmpcommonUtil.commonFunc.getDate(today));
43            }
44            else if(type == "w") {
45                end_el.val(ezpmpcommonUtil.commonFunc.getDate(today));
46                start_el.val(ezpmpcommonUtil.commonFunc.getDate(today.setDate(today.getDate() -7)));
47            }
48            else if(type == "m") {
49                end_el.val(ezpmpcommonUtil.commonFunc.getDate(today));
50                start_el.val(ezpmpcommonUtil.commonFunc.getDate(today.setMonth(today.getMonth() - 1)));
51            }
52            else if(type == "tm") {
53                end_el.val(ezpmpcommonUtil.commonFunc.getDate(today));
54                start_el.val(ezpmpcommonUtil.commonFunc.getDate(today.setMonth(today.getMonth() - 3)));
55            }
56            else if(type == "sm") {
57                end_el.val(ezpmpcommonUtil.commonFunc.getDate(today));
58                start_el.val(ezpmpcommonUtil.commonFunc.getDate(today.setMonth(today.getMonth()-6)));
59            }
60            else if(type == "y") {
61                end_el.val(ezpmpcommonUtil.commonFunc.getDate(today));
62                start_el.val(ezpmpcommonUtil.commonFunc.getDate(today.setFullYear(today.getFullYear()-1)));
63            }
64        }
65
66        radioButton = (obj,opts)=>{
67            let radioButtonSearchDate= opts.radioButtonSearchDate ?? [
68                {for:opts.targetId + "Day",id:opts.targetId + "Day",name:opts.targetId,value:"d",type : 'radio',text:"오늘"},
69                {for:opts.targetId + "Week",id:opts.targetId + "Week",name:opts.targetId,value:"w",type : 'radio',text:"1주일"},
70                {for:opts.targetId + "Month",id:opts.targetId + "Month",name:opts.targetId,value:"m",type : 'radio',text:"1개월"},
71                {for:opts.targetId + "ThreeMonth",id:opts.targetId + "ThreeMonth",name:opts.targetId,value:"tm",type : 'radio',text:"3개월"},
72                {for:opts.targetId + "SixMonth",id:opts.targetId + "SixMonth",name:opts.targetId,value:"sm",type : 'radio',text:"6개월"},
73                {for:opts.targetId + "Year",id:opts.targetId + "Year",name:opts.targetId,value:"y",type : 'radio',text:"1년"},
74                {for:opts.targetId + "All",id:opts.targetId + "All",name:opts.targetId,value:"t",type : 'radio',text:"전체", checked:"checked"},
75            ]
76            ezpmpcommonUtil.commonFunc.createRadioButtonData(ID,null,radioButtonSearchDate,function (data) {
77                obj.append(data);
78                ezpmpcommonUtil.commonFunc.boxEventListenerAdd(null,null , "radio", opts.targetId, 'change', srarchDatePopupEvent);
79            },opts.radionGroupCheck);
80        }
81        searchDatePopupCreate = (obj,opts) => {
82            obj.empty()
83            let searchDateTypePopSelectBox = opts.searchDateTypePopSelectBox ?? {
84                elementType: 'select',
85                elemeneData: {
86                    id: opts.targetId + "_type"
87                }
88            }
89            let searchDateTypePopSelectBoxOption =opts.searchDateTypePopSelectBoxOption ?? [
90                {id: opts.targetId + "TypeCreate", value: "R", selected: "selected", text: "등록일"},
91                {id: opts.targetId + "TypeUpdate", value: "U", text: "수정일"}
92            ]
93            let searchDateInputPopupDiv1 = opts.searchDateInputPopupDiv1 ??{
94                elementType: 'div',
95                elemeneData: {
96                    class: ["dib", "dateArea"]
97                }
98            }
99            let searchDateInputPopupDiv = opts.searchDateInputPopupDiv ?? {
100                elementType: 'div',
101                elemeneData: {
102                    id: opts.targetId + 'PopupInput',
103                    class: "input_hyphen"
104                }
105            }
106            let searchDatePopupInput = opts.searchDatePopupInput ?? {
107                elementType: 'input',
108                elemeneData: {
109                    type: "text",
110                    class: ["input", 'board', 'datepicker', 'cla', 'startDate'],
111                    value: '',
112                    name: opts.targetId + "_start_dt_popup",
113                    id: opts.targetId + "_start_dt_popup",
114                    maxLength: '10',
115                    autoComplete: 'off',
116                    placeholder: 'YYYY-MM-DD',
117                }
118            }
119            ezpmpcommonUtil.commonFunc.createSelectBoxData(opts.targetId + "_type", searchDateTypePopSelectBox, searchDateTypePopSelectBoxOption, function (data) {
120                obj.append(data);
121                ezpmpcommonUtil.commonFunc.boxEventListenerAdd(opts.targetId + "_type", null, 'select', opts.targetId + "_type", 'change', (opts.searchDateSelectBoxCallback ?? searchDateTypePopSelectBoxOptionEvent));
122            });
123            // ezpmpcommonUtil.commonFunc.createElements("searchDatePopup",searchDateTypePopupbutton,null)   //조회기간
124
125            radioButton(obj,opts);
126            let sdind1 = ezpmpcommonUtil.commonFunc.createElementParam(searchDateInputPopupDiv1);
127            let sdind = ezpmpcommonUtil.commonFunc.createElementParam(searchDateInputPopupDiv);
128            let sdinpst = ezpmpcommonUtil.commonFunc.createElementParam(searchDatePopupInput);
129            searchDatePopupInput.elemeneData.name = opts.targetId + "_end_dt_popup";
130            searchDatePopupInput.elemeneData.id = opts.targetId + "_end_dt_popup";
131            searchDatePopupInput.elemeneData.class = ["input", 'board', 'datepicker', 'cla', 'endDate'];
132            let sdinpet = ezpmpcommonUtil.commonFunc.createElementParam(searchDatePopupInput);
133            sdind.append(sdinpst);
134            sdind.append(sdinpet);
135            sdind1.append(sdind)
136            obj.append(sdind1)   //조회기간
137            ezpmpcommonUtil.commonFunc.fninitDateTimePicker('class', 'calendar', "datepicker", '');
138            // sdinpst.datetimepicker();
139            // sdinpet.datetimepicker();
140            // 오늘 날자 강제 이벤트
141            $("input:radio[name='searchDate']:radio[value='t']").prop('checked', true);
142            ezpmpcommonUtil.commonFunc.eventOccurrence('searchDateAll', null, 'change', 't');
143        }
144        searchDatePopupCreate(Obj, opts);
145    }
146})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.