let locationBtn = null; let createBtn = null; let cancleBtn = null; let missBtn = null; let incdCfrmBtn = null; let incdInfoCfrmBtn = null; let refreshBtn = null; let incdEndBtn = null; let prcdIncdTable = null; let newIncdTable = null; let endIncdTable = null; let commonUri = '/api/manage/incident'; let autoIncdTable = null; let prcdLinkBtn = null; let searchBtn = null; let closeBtn = null; let vmsListBtn = null; const pageMsg = '돌발'; //신규 돌발 등록 관련 let newIncdOccrId = null; let newRgstDt = null; let newIncdOrgnCd = null; let newOcrrLctnNm = null; let newIncdExpl = null; let newCmtrGradCd = null; let newIfmrNm = null; let newIncdCnfmMthdCd = null; let newIncdSernCd = null; let newIncdTypeCd = null; let newIncdCnfmDt = null; let newIncdTypeClsfCd = null; let newIncdTitl = null; let newIncdStrtDt = null; let newIncdEndPrarDt = null; let newIncdData = []; let autoIncdData = []; //돌발 진행상황 처리 관련 let prcdIncdOccrId = null; let prcdRgstDt = null; let prcdIncdOrgnCd = null; let prcdOcrrLctnNm = null; let prcdIncdExpl = null; let prcdCmtrGradCd = null; let prcdIfmrNm = null; let prcdIncdCnfmMthdCd = null; let prcdIncdSernCd = null; let prcdIncdTypeCd = null; let prcdIncdTypeClsfCd = null; let prcdIncdTitl = null; let prcdIncdStrtDt = null; let prcdIncdEndPrarDt = null; let prcdLinkId = null; let prcdXcrdn = null; let prcdYcrdn = null; let prcdVmsDsplYn = null; let prcdStrtLctnNm = null; let prcdEndLctnNm = null; let prcdVmsIncdTypeCd = null; let prcdVmsIncdDetlTypeCd = null; let prcdIncdOcrrLane0 = null; let prcdIncdOcrrLane1 = null; let prcdIncdOcrrLane2 = null; let prcdIncdOcrrLane3 = null; let prcdIncdOcrrLane4 = null; let prcdIncdOcrrLane5 = null; let prcdIncdClsrLane0 = null; let prcdIncdClsrLane1 = null; let prcdIncdClsrLane2 = null; let prcdIncdClsrLane3 = null; let prcdIncdClsrLane4 = null; let prcdIncdClsrLane5 = null; let prcdSmltVhclUnum = null; let prcdMdltVhclUnum = null; let prcdInjrPnum = null; let prcdFtltPnum = null; let prcdDelyLngt = null; let prcdIncdLngt = null; let prcdWthrCd = null; let prcdRespLvlCd = null; let prcdTrubVhclYn = null; let prcdFaltYn = null; let prcdFrwtYn = null; let procData = []; let incdOcrrLaneArr = []; let incdClsrLaneArr = []; //돌발 종료 처리 관련 let endIncdOccrId = null; let endRgstDt = null; let endIncdOrgnCd = null; let endOcrrLctnNm = null; let endIncdExpl = null; let endCmtrGradCd = null; let endIfmrNm = null; let endIncdCnfmMthdCd = null; let endIncdSernCd = null; let endIncdTypeCd = null; let endIncdTypeClsfCd = null; let endIncdTitl = null; let endIncdStrtDt = null; let endIncdEndPrarDt = null; let endLinkId = null; let endXcrdn = null; let endYcrdn = null; let endRespLvlCd = null; let endIncdEndCnfmMthdCd = null; let endIncdEndDt = null; let endRecrCont = null; let endMblzEqpmCont = null; let endMblzPnum = null; let endRecrPerd = null; let endData = []; //코드 관련 let incdOrgnCdData = []; let cmtrGradCdData = []; let incdCnfmMthdCdData = []; let incdSernCdData = []; let incdTypeCdData = []; let incdTypeClsfCdData = []; let respLvlCdData = []; let wthrCdData = []; let incdEndCnfmMthdCdData = []; let trvlLmntTypeCdData = []; let vmsCdData = []; let vmsClsfCdData = []; //이력조회 관련 let historyCheck = null; let historyStrtDt = null; let historyStrtTime = null; let historyEndDt = null; let historyEndTime = null; let historySearchBtn = null; //pop-up const listOption = 'width = 800, height = 900, top = 40, left = 500, resizable=yes, scrollbars=no'; const vmsListOption = 'width = 600, height = 600, top = 200, left = 660, resizable=yes, scrollbars=no'; const mapOption = 'width = 1700, height = 900, top = 40, left = 100, resizable=yes, scrollbars=no'; const _multiSelct = false; const _linkLevel = 1; const getParam = { MultiSelect : _multiSelct, LinkLevel : _linkLevel, LinkInfo : [], }; //데이트 컬럼 const dateColumns = ['rgst_dt','incd_end_prar_dt', 'incd_cnfm_dt', 'incd_strt_dt', 'incd_end_dt', 'detc_dt']; incdOrgnCdData = getCodeData( incdOrgnCdData, '/ist'); cmtrGradCdData = getCodeData( cmtrGradCdData, '/ltcu'); incdCnfmMthdCdData = getCodeData( incdCnfmMthdCdData, '/icm'); incdSernCdData = getCodeData( incdSernCdData, '/srlu'); incdTypeClsfCdData = getCodeData( incdTypeClsfCdData, '/idtu'); if(incdTypeClsfCdData.length > 0) incdTypeCdData = getCodeData(incdTypeCdData, '/idtu/' + incdTypeClsfCdData[0].code); respLvlCdData = getCodeData(respLvlCdData, '/rsl'); wthrCdData = getCodeData(wthrCdData, '/wetu'); incdEndCnfmMthdCdData = getCodeData(incdEndCnfmMthdCdData, '/icm'); trvlLmntTypeCdData = getCodeData(trvlLmntTypeCdData, '/prtu'); vmsClsfCdData = getCodeData( vmsClsfCdData, '/vit'); //신규 돌발 등록 input const newInputArr = [ //돌발 ID newIncdOccrId = { box : null, type : 'text', column : 'incd_ocrr_id', readOnly : true, width : 200, }, //등록일시 newRgstDt = { box : null, type : 'datetime', column : 'rgst_dt', displayFormat : 'yyyy-MM-dd HH:mm:ss', readOnly : true, width : 200, }, //돌발구분코드 newIncdOrgnCd = { box : null, type : 'select', column : 'incd_orgn_cd', width : 180, items : incdOrgnCdData, max : 100, }, //발생위치설명 newOcrrLctnNm = { box : null, type : 'text', column : 'ocrr_lctn_nm', width : 500, must : '발생위치설명', max : 100, }, //돌발상황설명 newIncdExpl = { box : null, type : 'text', column : 'incd_expl', width : 500, must : '돌발상황설명', max : 600, }, //소통상황코드 newCmtrGradCd = { box : null, type : 'select', column : 'cmtr_grad_cd', items : cmtrGradCdData, width : 300, }, //제보자명 newIfmrNm = { box : null, type : 'text', column : 'ifmr_nm', width : 250, max : 20, }, //확인방법 코드 newIncdCnfmMthdCd = { box : null, type : 'select', column : 'incd_cnfm_mthd_cd', items : incdCnfmMthdCdData, width : 250, }, //심각도 코드 newIncdSernCd = { box : null, column : 'incd_sern_cd', items : incdSernCdData, type : 'select', width : 250, }, //돌발 세부 유형 코드 newIncdTypeCd = { box : null, column : 'incd_type_cd', items : incdTypeCdData, type : 'select', width : 180, }, //돌발확인시각 newIncdCnfmDt = { box : null, type : 'datetime', column : 'incd_cnfm_dt', width : 170, displayFormat : 'yyyy-MM-dd HH:mm:ss', value : new Date() }, //돌발 유형 코드 newIncdTypeClsfCd = { box : null, column : 'incd_type_clsf_cd', items : incdTypeClsfCdData, type : 'select', width : 180, method : function(){ incdTypeCdData = setDetailCd( incdTypeCdData, newIncdTypeCd, newIncdTypeClsfCd, 'idtu'); } }, //돌발제목 newIncdTitl = { box : null, column : 'incd_titl', type : 'text', width : 500, max : 400, must : '돌발제목', }, //돌발시작시각 newIncdStrtDt = { box : null, type : 'datetime', column : 'incd_strt_dt', width : 170, displayFormat : 'yyyy-MM-dd HH:mm:ss', value : new Date() }, //종료예정시각 newIncdEndPrarDt = { box : null, type : 'datetime', column : 'incd_end_prar_dt', width : 170, displayFormat : 'yyyy-MM-dd HH:mm:ss', value : new Date(new Date().setDate(new Date().getDate()+1)), }, ] //진행상황처리 const prcdInputArr = [ //돌발 ID prcdIncdOccrId = { box : null, type : 'text', column : 'incd_ocrr_id', readOnly : true, width : 200, }, //등록일시 prcdRgstDt = { box : null, type : 'datetime', column : 'rgst_dt', readOnly : true, displayFormat : 'yyyy-MM-dd HH:mm:ss', width : 200, }, //돌발구분코드 prcdIncdOrgnCd = { box : null, type : 'select', column : 'incd_orgn_cd', width : 180, items : incdOrgnCdData, must : '돌발구분', }, //발생위치설명 prcdOcrrLctnNm = { box : null, type : 'text', column : 'ocrr_lctn_nm', width : 500, must : '발생위치설명', max : 100, }, //돌발상황설명 prcdIncdExpl = { box : null, type : 'text', column : 'incd_expl', width : 600, must : '돌발상황설명', max : 600, }, //소통상황코드 prcdCmtrGradCd = { box : null, type : 'select', column : 'cmtr_grad_cd', items : cmtrGradCdData, width : 180, }, //제보자명 prcdIfmrNm = { box : null, type : 'text', column : 'ifmr_nm', width : 250, max : 20, }, //확인방법 코드 prcdIncdCnfmMthdCd = { box : null, type : 'select', column : 'incd_cnfm_mthd_cd', items : incdCnfmMthdCdData, width : 250, must : '확인방법', }, //심각도 코드 prcdIncdSernCd = { box : null, column : 'incd_sern_cd', items : incdSernCdData, type : 'select', width : 250, must : '심각도', }, //돌발 세부 유형 코드 prcdIncdTypeCd = { box : null, column : 'incd_type_cd', items : incdTypeCdData, type : 'select', width : 200, must : '돌발세부유형', }, //돌발 유형 코드 prcdIncdTypeClsfCd = { box : null, column : 'incd_type_clsf_cd', items : incdTypeClsfCdData, type : 'select', width : 200, must : '돌발유형', method : function(){ incdTypeCdData = setDetailCd( incdTypeCdData, prcdIncdTypeCd, prcdIncdTypeClsfCd, 'idtu'); } }, //돌발제목 prcdIncdTitl = { box : null, column : 'incd_titl', type : 'text', width : 600, must : '돌발제목', max : 400, }, //돌발시작시각 prcdIncdStrtDt = { box : null, type : 'datetime', column : 'incd_strt_dt', width : 170, displayFormat : 'yyyy-MM-dd', must : '돌발시작시각', }, //종료예정시각 prcdIncdEndPrarDt = { box : null, type : 'datetime', column : 'incd_end_prar_dt', width : 170, displayFormat : 'yyyy-MM-dd', must : '종료예정시각', }, //링크ID prcdLinkId = { box : null, type : 'text', column : 'link_id', width : 280, readOnly : true, must : '발생구간(링크)', }, //x좌표 prcdXcrdn = { box : null, type : 'text', column : 'x_crdn', width : 170, value : '0.000000', must : '발생좌표(X)', max : 11, method : function(text){ crdnChanges(text, 3); }, }, //y좌표 prcdYcrdn = { box : null, type : 'text', column : 'y_crdn', width : 170, value : '0.000000', must : '발생좌표(Y)', max : 10, method : function(text){ crdnChanges(text, 2); }, }, //vms 표출여부 prcdVmsDsplYn = { box : null, type : 'check', value : false, column : 'vms_dspl_yn', text : 'VMS 표출', width : 170, method : function(){ const checkYn = getValue(prcdVmsDsplYn.box) vmsListBtn.option('disabled', !checkYn); prcdStrtLctnNm.box.option('disabled', !checkYn); prcdEndLctnNm.box.option('disabled', !checkYn); prcdVmsIncdTypeCd.box.option('disabled', !checkYn); prcdVmsIncdDetlTypeCd.box.option('disabled', !checkYn); } }, //vms 시점명 prcdStrtLctnNm = { box : null, type : 'text', column : 'strt_lctn_nm', width : 120, placeholder : '시점명', max : 10, }, //vms 종점명 prcdEndLctnNm = { box : null, type : 'text', column : 'end_lctn_nm', width : 120, placeholder : '종점명', max : 10, }, //vms 돌발유형 prcdVmsIncdTypeCd = { box : null, type : 'select', items : vmsClsfCdData, column : 'vms_incd_type_cd', width : 150, method : function(){ vmsCdData = setDetailCd( vmsCdData, prcdVmsIncdDetlTypeCd, prcdVmsIncdTypeCd, 'vit'); } }, //vms 돌발 세부유형 prcdVmsIncdDetlTypeCd = { box : null, type : 'select', items : [], column : 'vms_incd_detl_type_cd', width : 150, }, //발생차로 갓길 prcdIncdOcrrLane0 = { box : null, type : 'check', column : 'incd_ocrr_lane_0', value : false, width : 170, text : '갓길' }, //발생차로 1 prcdIncdOcrrLane1 = { box : null, type : 'check', column : 'incd_ocrr_lane_1', value : false, width : 170, text : '1' }, //발생차로 2 prcdIncdOcrrLane2 = { box : null, type : 'check', column : 'incd_ocrr_lane_2', value : false, width : 170, text : '2' }, //발생차로 3 prcdIncdOcrrLane3 = { box : null, type : 'check', column : 'incd_ocrr_lane_3', value : false, width : 170, text : '3' }, //발생차로 4 prcdIncdOcrrLane4 = { box : null, type : 'check', column : 'incd_ocrr_lane_4', value : false, width : 4, text : '4' }, //발생차로 5 prcdIncdOcrrLane5 = { box : null, type : 'check', column : 'incd_ocrr_lane_5', value : false, width : 5, text : '5' }, //폐쇄차로 갓길 prcdIncdClsrLane0 = { box : null, type : 'check', column : 'incd_clsr_lane_0', value : false, text : '갓길' }, //폐쇄차로 1 prcdIncdClsrLane1 = { box : null, type : 'check', column : 'incd_clsr_lane_1', value : false, text : '1' }, //폐쇄차로 2 prcdIncdClsrLane2 = { box : null, type : 'check', column : 'incd_clsr_lane_2', value : false, text : '2' }, //폐쇄차로 3 prcdIncdClsrLane3 = { box : null, type : 'check', column : 'incd_clsr_lane_3', value : false, text : '3' }, //폐쇄차로 4 prcdIncdClsrLane4 = { box : null, type : 'check', column : 'incd_clsr_lane_4', value : false, text : '4' }, //폐쇄차로 5 prcdIncdClsrLane5 = { box : null, type : 'check', column : 'incd_clsr_lane_5', value : false, text : '5' }, //소형차량대수 prcdSmltVhclUnum = { box : null, type : 'number', column : 'smlt_vhcl_unum', value : '0', width : 80, }, //중대형차량대수 prcdMdltVhclUnum = { box : null, type : 'number', column : 'mdlt_vhcl_unum', value : '0', width : 80, }, //부상자수 prcdInjrPnum = { box : null, type : 'number', column : 'injr_pnum', value : '0', width : 80, }, //사망자수 prcdFtltPnum = { box : null, type : 'number', column : 'ftlt_pnum', value : '0', width : 80, }, //지체길이 prcdDelyLngt = { box : null, type : 'number', column : 'dely_lngt', value : '0', width : 90, }, //발생길이 prcdIncdLngt = { box : null, type : 'number', column : 'incd_lngt', value : '0', width : 90, }, //기상조건 코드 prcdWthrCd = { box : null, type : 'select', column : 'wthr_cd', items : wthrCdData, width : 110, }, //대응수준 코드 prcdRespLvlCd = { box : null, type : 'select', column : 'resp_lvl_cd', items : respLvlCdData, width : 110, }, //고장차량여부 prcdTrubVhclYn = { box : null, type : 'check', column : 'trub_vhcl_yn', value : false, width : 100, text : '고장차량' }, //낙하물여부 prcdFaltYn = { box : null, type : 'check', column : 'falt_yn', value : false, width : 100, text : '낙하물' }, //화재위험물여부 prcdFrwtYn = { box : null, type : 'check', column : 'frwt_yn', value : false, width : 100, text : '화재위험물' }, ] //돌빌 종료 처리 input const endInputArr = [ //돌발 ID endIncdOccrId = { box : null, type : 'text', column : 'incd_ocrr_id', readOnly : true, width : 200, }, //등록일시 endRgstDt = { box : null, type : 'datetime', column : 'rgst_dt', displayFormat : 'yyyy-MM-dd HH:mm:ss', readOnly : true, width : 200, }, //돌발구분코드 endIncdOrgnCd = { box : null, type : 'select', column : 'incd_orgn_cd', readOnly : true, width : 180, items : incdOrgnCdData, }, //발생위치설명 endOcrrLctnNm = { box : null, type : 'text', readOnly : true, column : 'ocrr_lctn_nm', width : 500, }, //돌발상황설명 endIncdExpl = { box : null, type : 'text', readOnly : true, column : 'incd_expl', width : 600, }, //소통상황코드 endCmtrGradCd = { box : null, type : 'select', column : 'cmtr_grad_cd', readOnly : true, items : cmtrGradCdData, width : 180, }, //대응수준코드 endRespLvlCd = { box : null, type : 'select', column : 'resp_lvl_cd', readOnly : true, items : respLvlCdData, width : 180, }, //링크ID endLinkId = { box : null, type : 'text', column : 'link_id', readOnly : true, width : 280, readOnly : true, }, //x좌표 endXcrdn = { box : null, type : 'text', column : 'x_crdn', readOnly : true, width : 170, value : '0.000000', }, //y좌표 endYcrdn = { box : null, type : 'text', column : 'y_crdn', readOnly : true, width : 170, value : '0.000000', }, //제보자명 endIfmrNm = { box : null, type : 'text', column : 'ifmr_nm', readOnly : true, width : 250, }, //확인방법 코드 endIncdCnfmMthdCd = { box : null, type : 'select', column : 'incd_cnfm_mthd_cd', readOnly : true, items : incdCnfmMthdCdData, width : 250, }, //심각도 코드 endIncdSernCd = { box : null, column : 'incd_sern_cd', readOnly : true, items : incdSernCdData, type : 'select', width : 250, }, //돌발 세부 유형 코드 endIncdTypeCd = { box : null, column : 'incd_type_cd', readOnly : true, items : incdTypeCdData, type : 'select', width : 200, }, //돌발 유형 코드 endIncdTypeClsfCd = { box : null, column : 'incd_type_clsf_cd', readOnly : true, items : incdTypeClsfCdData, type : 'select', width : 200, method : function(){ incdTypeCdData = setDetailCd( incdTypeCdData, endIncdTypeCd, endIncdTypeClsfCd, 'idtu'); } }, //돌발제목 endIncdTitl = { box : null, column : 'incd_titl', readOnly : true, type : 'text', width : 500, }, //돌발시작시각 endIncdStrtDt = { box : null, type : 'datetime', column : 'incd_strt_dt', width : 170, readOnly : true, displayFormat : 'yyyy-MM-dd', }, //종료예정시각 endIncdEndPrarDt = { box : null, type : 'datetime', column : 'incd_end_prar_dt', width : 170, readOnly : true, displayFormat : 'yyyy-MM-dd', }, //돌발 종료 확인 방법 코드 endIncdEndCnfmMthdCd = { box : null, column : 'incd_end_cnfm_mthd_cd', items : incdEndCnfmMthdCdData, type : 'select', must : '돌발종료확인방법', width : 250, }, //돌발종료시각 endIncdEndDt = { box : null, type : 'datetime', column : 'incd_end_dt', width : 250, must : '돌발종료시각', displayFormat : 'yyyy-MM-dd HH:mm:ss', }, //출동장비내용 endMblzEqpmCont = { box : null, column : 'mblz_eqpm_cont', type : 'text', width : 500, }, //복구 내용 endRecrCont = { box : null, column : 'recr_cont', type : 'text', width : 500, }, //출동 인원수 endMblzPnum = { box : null, type : 'number', column : 'mblz_pnum', width : 80, value : '0' }, //복구기간 endRecrPerd = { box : null, type : 'number', column : 'recr_perd', width : 80, value : '0' }, ] //버튼 배열 const btnArr = [ locationBtn = { box : null, text : '위치보기', class : 'location-btn', icon : 'globe', new : { visible : true, disabled : true, click : {visible:true, disabled:true}, cancle : {visible:true, disabled:true}, }, prcd : { visible : true, disabled : true, }, end : { visible : true, disabled : true, }, }, createBtn = { box : null, text : '신규등록', icon : 'plus', new : { visible : true, disabled : false, click : {visible:false, disabled:false}, cancle : {visible:true, disabled:false}, }, prcd : { visible : false, disabled : false, }, end : { visible : false, disabled : false, }, class : 'create-btn', method : function(){ //id 조회 필요 let newId =[]; getData('/api/manage/incident/new-id', newId); setValue(newIncdOccrId.box, newId[0].incd_ocrr_id) setValue(newRgstDt.box, new Date()); btnArr.map((item)=>{ if(item.new.click){ item.box.option('disabled', item.new.click.disabled); item.box.option('visible', item.new.click.visible); } }) eventOn( newInputArr ); } }, cancleBtn = { box : null, text : '등록취소', icon : 'undo', new : { visible : false, disabled : false, click : {visible:true, disabled:false}, cancle : {visible:false, disabled:false}, }, prcd : { visible : false, disabled : false, }, end : { visible : false, disabled : false, }, class : 'cancle-btn', method : function(){ eventOff(newInputArr); btnArr.map((item)=>{ if(item.new.cancle){ item.box.option('visible', item.new.cancle.visible); item.box.option('disabled', item.new.cancle.disabled); } }) } }, missBtn = { box : null, text : '오보판정', icon : 'edit', class : 'miss-btn', new : { visible : true, disabled : true, click : {visible:true, disabled:true}, cancle : {visible:true, disabled:true}, }, prcd : { visible : true, disabled : true, click : {visible:true, disabled:false}, cancle : {visible:true, disabled:true}, }, end : { visible : false, disabled : true, }, }, incdCfrmBtn = { box : null, text : '돌발확정', icon : 'save', new : { visible : true, disabled : true, click : {visible:true, disabled:false}, cancle : {visible:true, disabled:true}, }, prcd : { visible : false, disabled : true, }, end : { visible : false, disabled : true, }, class : 'incd-cfrm-btn', method : function(){ let updateData = {}; for(idx in newInputArr){ if(newInputArr[idx].must && nullChecker(getValue(newInputArr[idx].box)).trim() === ""){ alertWarning('입력되지 않은 정보가 있습니다. [' + newInputArr[idx].must + ']', null, newInputArr[idx].box); return false; } updateData[newInputArr[idx].column] = getValue(newInputArr[idx].box); } updateData['incd_prgr_step_cd'] = 'ISS2'; updateData['utis_cnct_yn'] = 'N'; sendDateFormat(updateData); let result = postInsertUpdate(commonUri + '/' + getValue(newIncdOccrId.box), updateData); if (result > 0) { insResultMsg('신규' + pageMsg); refreshIncd(); eventOff(newInputArr); } } }, incdInfoCfrmBtn = { box : null, text : '정보등록', icon : 'save', new : { visible : false, disabled : false, }, prcd : { visible : true, disabled : true, }, end : { visible : false, disabled : false, }, class : 'incd-info-cfrm-btn', method : function(){ const vmsData = [ 'cmtr_grad_cd', 'end_lctn_nm', 'incd_end_prar_dt', 'incd_ocrr_id', 'incd_prgr_step_cd', 'incd_strt_dt', 'link_id', 'ocrr_lctn_nm', 'strt_lctn_nm', 'vms_incd_detl_type_cd', 'vms_incd_type_cd', 'vms_dspl_yn', ]; let error = false; let updateCheck = [ 'falt_yn', 'frwt_yn', 'trub_vhcl_yn', 'vms_dspl_yn' ]; let vmsUpdateData = {}; let updateData = {...getInstance(prcdIncdTable).getSelectedRowsData()[0]}; for(idx in prcdInputArr){ const input = prcdInputArr[idx]; const value = getValue(input.box); switch (true) { case input.must && nullChecker(value).trim() === "": alertWarning('입력되지 않은 정보가 있습니다. [' + input.must + ']', null, input.box); error = true; break; case input.type === 'check' : if (updateCheck.includes(input.column))updateData[input.column] = getCheckData(input.box); if (vmsData.includes(input.column))vmsUpdateData[input.column] = getCheckData(input.box); break; case input.type !== 'check': updateData[input.column] = value; if (vmsData.includes(input.column))vmsUpdateData[input.column] = value; break; default: break; } } if (error) return false; updateData['incd_ocrr_lane'] = getLaneVal(incdOcrrLaneArr); updateData['incd_clsr_lane'] = getLaneVal(incdClsrLaneArr); vmsUpdateData['incd_clsr_lane'] = updateData['incd_clsr_lane']; if (isNaN(updateData.link_id)){ updateData.link_id = Number(updateData.link_id.substring(updateData.link_id.indexOf('[')+1,updateData.link_id.indexOf(']'))); vmsUpdateData.link_id = updateData.link_id }; updateData = sendDateFormat(updateData); vmsUpdateData = sendDateFormat(vmsUpdateData); let resultCnt = 0; if (updateData.vms_dspl_yn){ resultCnt = postInsertUpdate(commonUri + '/vms/incd/'+ vmsUpdateData.incd_ocrr_id, vmsUpdateData); } resultCnt += postInsertUpdate(commonUri + '/' + updateData.incd_ocrr_id, updateData); if (resultCnt > 0) { insResultMsg(pageMsg + '진행상황'); refreshIncd(); eventOff(prcdInputArr); } } }, refreshBtn = { box : null, text : '초기화', icon : 'refresh', new : { visible : false, disabled : false, }, prcd : { visible : true, disabled : true, }, end : { visible : true, disabled : true, }, class : 'refresh-btn', }, incdEndBtn = { box : null, text : '돌발종료', icon : 'save', new : { visible : false, disabled : false, }, prcd : { visible : false, disabled : false, }, end : { visible : true, disabled : true, }, class : 'incd-end-btn', method : function(){ let updateData = {...getInstance(endIncdTable).getSelectedRowsData()[0]}; let endColumns = [ 'incd_end_dt', 'incd_end_cnfm_mthd_cd', 'mblz_eqpm_cont', 'recr_cont', 'mblz_pnum', 'recr_perd' ]; for(idx in endInputArr){ const input = endInputArr[idx]; const value = getValue(input.box); if(input.must && nullChecker(value).trim() === "") { alertWarning('입력되지 않은 정보가 있습니다. [' + input.must + ']', null, input.box); return false; } else if(endColumns.includes(input.column)){ updateData[input.column] = value; } } updateData['incd_prgr_step_cd'] = 'ISS3'; if (isNaN(updateData.link_id)){ updateData.link_id = Number(updateData.link_id.substring(updateData.link_id.indexOf('[')+1, updateData.link_id.indexOf(']'))); }; updateData = sendDateFormat(updateData); let resultCnt = 0; resultCnt += postInsertUpdate(commonUri + '/' + updateData.incd_ocrr_id, updateData); if (resultCnt > 0) { insResultMsg(pageMsg + '종료 처리'); refreshIncd(); eventOff(endInputArr); } } }, ] //이력 조회 배열 const historyArr = [ historyCheck = { class : 'history-check', box : null, text : '이력조회', disabled : false, type : 'check', method : function(e){ historyArr.map((item)=>{ if(item.class !== 'history-check') item.box.option('disabled', !item.box.option('disabled')); }) if(!getValue(historyCheck.box)) endIncdTable.dxDataGrid('instance').option('dataSource', procData[0]); } }, historyStrtDt = { class : 'history-strt-dt', type : 'date', width : 120, box : null, displayFormat : 'yyyy-MM-dd', value : new Date().setMonth( new Date().getMonth() - 1), }, historyStrtTime = { class : 'history-strt-time', type : 'time', displayFormat : 'HH', width : 70, interval : 60, value : firstSettingTime, box : null, }, historyEndDt = { class : 'history-end-dt', type : 'date', width : 120, box : null, displayFormat : 'yyyy-MM-dd', value : new Date(), }, historyEndTime = { class : 'history-end-time', box : null, width : 70, type : 'time', displayFormat : 'HH', value : new Date().getTime(), interval : 60, }, historySearchBtn = { class : 'history-search-btn', box : null, icon : 'refresh', type : 'button', text : '조회', method : function(){ if(!validationCheck(historyStrtDt.box, historyEndDt.box, historyStrtTime.box, historyEndTime.box)) return false; let FROM_DT = getDate(getValue(historyStrtDt.box),getValue(historyStrtTime.box)).substring(0,10); let TO_DT = getDate(getValue(historyEndDt.box),getValue(historyEndTime.box)).substring(0,10); let searchData = {}; searchData['FROM_DT'] = FROM_DT; searchData['TO_DT'] = TO_DT; let historyData = []; historyData = formatData('', historyData, searchData); endIncdTable.dxDataGrid('instance').option('dataSource',historyData[0]); } }, ] const toggleArr = [ { box : null, formNm : 'new', formToggle : 'toggle-down', tabToggle : 'toggle' }, { box : null, formNm : 'prcd', formToggle : 'toggle-down', tabToggle : 'toggle' }, { box : null, formNm : 'end', formToggle : 'end-toggle-down', tabToggle : 'end-toggle' } ] autoIncdData = formatData( '/auto', autoIncdData ); procData = formatData( '/progress', procData ); newIncdData = formatData( '/registered', newIncdData ); $(()=>{ init(); $('body').on('click',function(){ $(".add-select-btn").addClass('dpl-none'); }) //추가 버튼 목록에서 선택 $(".add-select-btn > div:nth-child(1)").on('click',function(){ event.stopPropagation(); window.open('./incident-popup-link.html', '목록 구간', listOption); $(".add-select-btn").addClass('dpl-none'); }) //추가 버튼 맵에서 선택 $(".add-select-btn > div:nth-child(2)").on('click',function(){ event.stopPropagation(); window.open('./incident-popup-map.html', '지도 구간', mapOption); $(".add-select-btn").addClass('dpl-none'); }) }) function init(){ //화면 텍스트 상자 세팅 setViewInputArray( newInputArr, 'new' ); setViewInputArray( prcdInputArr, 'prcd' ); setViewInputArray( endInputArr, 'end' ); //차로 정보 Array incdOcrrLaneArr.push(prcdIncdOcrrLane0, prcdIncdOcrrLane1, prcdIncdOcrrLane2, prcdIncdOcrrLane3, prcdIncdOcrrLane4, prcdIncdOcrrLane5); incdClsrLaneArr.push(prcdIncdClsrLane0, prcdIncdClsrLane1, prcdIncdClsrLane2, prcdIncdClsrLane3, prcdIncdClsrLane4, prcdIncdClsrLane5); //이력 정보 세팅 historyArr.map((item)=>{ switch (item.type) { case 'date': item.box = $("." + item.class).dxDateBox({ width : item.width, stylingMode : 'outlined', height : 25, type : item.type, readOnly : item.readOnly, displayFormat : item.displayFormat, value : item.value, disabled : true, }).dxDateBox('instance'); break; case 'time': item.box = $("." + item.class).dxDateBox({ width : item.width, stylingMode : 'outlined', height : 25, type : item.type, readOnly : item.readOnly, displayFormat : item.displayFormat, value : item.value, interval : item.interval, disabled : true, }).dxDateBox('instance'); break; case 'button': item.box = $("." + item.class).dxButton({ stylingMode : 'outlined', icon : item.icon, height : 27, disabled : true, text : item.text, onClick(){ if(item.method){ item.method(); } } }).dxButton('instance'); break; case 'check': item.box = $("." + item.class).dxCheckBox({ stylingMode : 'outlined', text : item.text, onValueChanged(){ if(item.method){ item.method(); } } }).dxCheckBox('instance'); break; default: break; } }) prcdLinkBtn = $(".prcd-link-btn").dxButton({ text : '선택', icon : 'todo', stylingMode : 'outlined', disabled : true, onClick(){ event.stopPropagation(); $('.add-select-btn').toggleClass('dpl-none'); } }).dxButton('instance'); searchBtn = $(".search-btn").dxButton({ stylingMode : 'outlined', text : '조회', icon : 'refresh', onClick(){ refreshIncd(); } }).dxButton('instance'); closeBtn = $(".close-btn").dxButton({ stylingMode : 'outlined', text : '닫기', icon : 'close', onClick(){ window.close(); } }).dxButton('instance'); vmsListBtn = $(".vms-list-btn").dxButton({ stylingMode : 'outlined', text : 'VMS 목록', disabled : true, onClick(){ window.open('./incident-popup-vms.html', '돌발구간 VMS 정보', vmsListOption); } }).dxButton('instance'); btnArr.map((item)=>{ item.box = $('.' + item.class).dxButton({ stylingMode : 'outlined', text : item.text, icon : item.icon, visible : item.new.visible, disabled : item.new.disabled, onClick(){ if(item.method){ item.method(); } } }).dxButton('instance'); }); locationBtn.box.on('click', () => lookLocation(newIncdTable)); missBtn.box.on('click', () => missEvent(newIncdTable)); prcdIncdTable = $('