| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872 |
- import { TMapMngr, TFclt } from "/js/vworld/map-mngr.js";
- import { LayerIndex } from "/js/vworld/map-const.js";
- let _mapManager = null;
- let _selectFcltNmbr = null;
- let _vmsTableList = null;
- let _managerData = [];
- const _pageMsg = 'VMS';
- const _pageName = 'VMS 기본정보 관리';
- const _lyrIdx = LayerIndex.Vms;
- const _apiUri = '/api/vms/manager/info';
- const _vmsBtnBoxMap = new Map();
- const _vmsCdTypeMap = new Map();
- const _vmsInputBoxMap = new Map();
- /***
- * VMS_MAX_PHSE_NUM = 16; //VMS 최대 표출면 개수
- VMS_PHSE_CHNG_CYCL = 5; //VMS 표출면 변경 주기(계획된 메시지의 동작시간(초))
- VMS_CMNC_ERR_BASS_VAL = 127; //VMS 통신 오류 기본 값(모듈 전원이 꺼지는 온도값(℃))
- FAN_MTNS_TMPR = 35; //팬동작온도
- HETR_MTNS_TMPR = 0; //히터동작온도
- VMS_MODL_ERR_RATE = 20; //모듈장애율(Options)
- */
- const _updateColumns = {
- brgh_mode: null,
- cmncfail_slot_nmbr : 0,
- cmtrinfr_cnct_yn : "N",
- del_yn : "N",
- envrinfr_cnct_yn : "N",
- fan_mtns_tmpr : 35,
- frst_regr_nmbr : null,
- frst_rgst_dt : null,
- hetr_mtns_tmpr : 0,
- istl_lctn_nm : null,
- last_crct_dt : null,
- last_crpr_nmbr : window.opener.$userId,
- oper_mode : "A",
- panl_off_time : null,
- panl_on_time : null,
- panl_pwer_mode : null,
- pwer_fail_slot_nmbr : 0,
- strm_sesn_nm : null,
- trfc_strg_use_yn : "N",
- vms_cmnc_err_bass_val : 127,
- vms_cmnc_port : null,
- vms_ctlr_id : null,
- vms_ctlr_ip : null,
- vms_ctlr_nmbr : 0,
- vms_frm_type_cd : null,
- vms_id : null,
- vms_loc_ifsc_id : 0,
- vms_max_phse_num : 0,
- vms_modl_err_rate : 20,
- vms_modl_type_cd : null,
- vms_nght_brgh_step : 0,
- vms_nm : null,
- vms_phse_chng_cycl : 5,
- vms_type_cd : null,
- vms_usag_type_cd : null,
- vms_week_brgh_step : 0,
- web_cmra_id : null,
- web_cmra_ip : null,
- web_cmra_port : null,
- web_cmra_pwd : null,
- wthrinfr_cnct_yn : "N",
- x_crdn : 0,
- y_crdn : 0,
- strm_http_addr: null,
- strm_rtsp_addr: null,
- }
- const _btnClasses = [
- 'all-vms-apply-btn',
- 'close-btn',
- 'edit-btn',
- 'add-btn',
- 'del-btn',
- 'save-btn',
- 'cancle-btn'
- ];
- const _inputClasses = [
- 'vms_ctlr_nmbr',
- 'vms_ctlr_id',
- 'vms_nm',
- 'vms_usag_type_cd',
- 'vms_type_cd',
- 'x_crdn',
- 'y_crdn',
- 'vms_ctlr_ip',
- 'vms_cmnc_port',
- 'web_cmra_ip',
- 'web_cmra_port',
- 'web_cmra_id',
- 'web_cmra_pwd',
- 'strm_sesn_nm',
- 'vms_max_phse_num',
- 'panl_on_time',
- 'panl_off_time',
- 'strm_http_addr',
- 'strm_rtsp_addr',
- ];
- const panlTimeColumns = [
- 'panl_on_time',
- 'panl_off_time'
- ];
- $(()=>{
- _vmsTableList = $('.list-table').width('100%').height('100%').dxDataGrid({
- dataSource : null,
- allowColumnReordering : true,
- showColumnLines : true,
- showBorders : true,
- allowColumnResizing : true,
- rowAlternationEnabled : true,
- focusedRowEnabled : true,
- columnAutoWidth : true,
- noDataText : '표출할 정보가 없습니다.',
- keyExpr : 'vms_ctlr_nmbr',
- headerFilter : {
- visible: true,
- },
- scrolling : {
- mode : 'standard',
- },
- paging: {
- enabled: true,
- pageSize: 1000,
- },
- selection: {
- mode: 'single',
- },
- columns:[
- {
- dataField : "vms_ctlr_nmbr",
- caption : "번호",
- alignment : "center",
- sortOrder : 'asc',
- sortIndex : 0,
- cssClass : 'no-padding',
- },
- {
- dataField : "vms_ctlr_id",
- caption : "VMS ID",
- alignment : "center",
- cssClass : 'no-padding',
- },
- {
- dataField : "vms_usag_type_cd",
- caption : "유형",
- alignment : "center",
- cssClass : 'no-padding',
- lookup : {
- dataSource : null,
- valueExpr : "vms_usag_type_cd",
- displayExpr : "vms_usag_type_desc",
- }
- },
- {
- dataField : "vms_type_cd",
- caption : "크기",
- alignment : "center",
- cssClass : 'no-padding',
- lookup : {
- dataSource : null,
- valueExpr : "vms_type_cd",
- displayExpr : "vms_type_nm",
- }
- },
- {
- dataField : "vms_ctlr_ip",
- caption : "제어가 IP",
- alignment : "center",
- cssClass : 'no-padding',
- },
- {
- dataField : "vms_cmnc_port",
- caption : "통신포트",
- alignment : "center",
- cssClass : 'no-padding',
- },
- {
- dataField : "web_cmra_ip",
- caption : "웹카메라 IP",
- alignment : "center",
- cssClass : 'no-padding',
- },
- {
- dataField : "panl_on_time",
- caption : "전광판 ON",
- alignment : "center",
- cssClass : 'no-padding',
- },
- {
- dataField : "panl_off_time",
- caption : "전광판 OFF",
- alignment : "center",
- cssClass : 'no-padding',
- },
- {
- dataField : "vms_max_phse_num",
- caption : "폼 최대갯수",
- alignment : "center",
- cssClass : 'no-padding',
- },
- ],
- onRowDblClick(row){
- vmsTableDblClick(row);
- }
- }).dxDataGrid('instance');
- fetchVmsInputArray();
- fetchVmsButtonArray();
- fetchBaseData();
- });
- //필요 데이터 가져오기
- async function fetchBaseData(){
- getDataAsync('/api/vms/common/vms-type', fetchVmsType);
- getDataAsync('/api/vms/common/vms-usage', fetchVmsUsage);
- getDataAsync(_apiUri, fetchInfoTableList );
- }
- //VMS 목록 수신 및 세팅
- function fetchInfoTableList(jsonData){
- _vmsTableList.option('dataSource', jsonData);
- _managerData.push(jsonData);
- console.log(jsonData);
- doMap();
- updateIcon();
- }
- //VMS 유형 코드 데이터 수신 및 데이터 소스 세팅
- function fetchVmsUsage(jsonData){
- _vmsCdTypeMap.set('vms_usag_type_cd', jsonData);
- _vmsTableList.option('columns[2].lookup.dataSource', jsonData);
- const vmsUsagSelect = _vmsInputBoxMap.get('vms_usag_type_cd').get('input');
- vmsUsagSelect.option('dataSource', jsonData);
- setValue(vmsUsagSelect, jsonData[0].vms_usag_type_cd);
- _vmsInputBoxMap.get('vms_usag_type_cd').set('init', jsonData[0].vms_usag_type_cd);
- }
- //VMS 크기 코드 데이터 수신 및 데이터 소스 세팅
- function fetchVmsType(jsonData){
- _vmsCdTypeMap.set('vms_type_cd', jsonData);
- _vmsTableList.option('columns[3].lookup.dataSource', jsonData);
- const vmsTypeCdSelect = _vmsInputBoxMap.get('vms_type_cd').get('input');
- vmsTypeCdSelect.option('dataSource', jsonData);
- setValue(vmsTypeCdSelect, jsonData[0].vms_type_cd);
- _vmsInputBoxMap.get('vms_type_cd').set('init', jsonData[0].vms_type_cd);
- }
- //버튼들 화면 세팅
- function fetchVmsButtonArray(){
- _btnClasses.forEach( (btnClass)=>{
- _vmsBtnBoxMap.set(btnClass, new Map());
- const btnInfoBox = _vmsBtnBoxMap.get(btnClass);
- btnInfoBox.set('btn', $('.'+btnClass).dxButton({}).dxButton('instance'));
- switch(btnClass){
- case 'all-vms-apply-btn':
- setVmsBtnOption(btnClass, '전체 VMS 적용', 'save', allVmsApplyEvent, true, false);
- break;
- case 'close-btn':
- setVmsBtnOption(btnClass, '닫기', 'close', closeEvent);
- break;
- case 'edit-btn':
- setVmsBtnOption(btnClass, '편집', 'edit', editEvent, true, true);
- btnInfoBox.set('dblClick', [true, false]);
- btnInfoBox.set('event', [false, false]);
- btnInfoBox.set('cancle', [true, false, true]);
- break;
- case 'add-btn':
- setVmsBtnOption(btnClass, '추가', 'plus', addEvent, true, false);
- btnInfoBox.set('dblClick', [true, false]);
- btnInfoBox.set('event', [true, true]);
- btnInfoBox.set('cancle', [true, false, false]);
- break;
- case 'del-btn':
- setVmsBtnOption(btnClass, '삭제', 'minus', delEvent, true, true);
- btnInfoBox.set('dblClick', [true, false]);
- btnInfoBox.set('event', [true, true]);
- btnInfoBox.set('cancle', [true, false, true]);
- break;
- case 'save-btn':
- setVmsBtnOption(btnClass, '저장', 'save', null, true, true);
- btnInfoBox.set('dblClick', [true, true]);
- btnInfoBox.set('event', [true, false]);
- btnInfoBox.set('cancle', [true, true, true]);
- break;
- case 'cancle-btn':
- setVmsBtnOption(btnClass, '취소', 'close', cancleEvent, false, false);
- btnInfoBox.set('dblClick', [false, false]);
- btnInfoBox.set('event', [true, false]);
- btnInfoBox.set('cancle', [false, false, false]);
- break;
- default :
- break
- }
- });
- }
- //inputBox 화면 세팅
- function fetchVmsInputArray(){
- _inputClasses.forEach( (inputClass)=>{
- _vmsInputBoxMap.set(inputClass, new Map());
- const inputBox = _vmsInputBoxMap.get(inputClass);
- inputBox.set('input', null);
- switch(inputClass){
- case 'vms_ctlr_nmbr' :
- setVmsInputOption(inputClass, 'text', 60, null, 10);
- inputBox.set('must', '제어기 번호');
- break
- case 'vms_ctlr_id':
- setVmsInputOption(inputClass, 'text', 100, null, 30);
- inputBox.set('must', 'VMS ID');
- break
- case 'vms_nm' :
- setVmsInputOption(inputClass, 'text', 250, null, 40);
- inputBox.set('must', 'VMS 명칭');
- break
- case 'vms_usag_type_cd' :
- setVmsInputOption(inputClass, 'select', 250);
- inputBox.set('must', 'VMS 유형');
- break
- case 'vms_type_cd' :
- setVmsInputOption(inputClass, 'select', 250);
- inputBox.set('must', 'VMS 크기');
- break
- case 'x_crdn' :
- setVmsInputOption(inputClass, 'text', 120, '0.00000000', 11);
- inputBox.set('must', '위치좌표 X');
- inputBox.get('input').on('valueChanged', (text) => crdnChanges(text, 3));
- break
- case 'y_crdn' :
- setVmsInputOption(inputClass, 'text', 120, '0.00000000', 11);
- inputBox.set('must', '위치좌표 Y');
- inputBox.get('input').on('valueChanged', (text) => crdnChanges(text, 2));
- break
- case 'vms_ctlr_ip' :
- setVmsInputOption(inputClass, 'text', 170, null, 20);
- inputBox.set('must', '제어기 IP');
- break
- case 'vms_cmnc_port' :
- setVmsInputOption(inputClass, 'text', 70, null, 5);
- inputBox.set('must', '제어기 PORT');
- break
- case 'web_cmra_ip' :
- setVmsInputOption(inputClass, 'text', 170, null, 20);
- break
- case 'web_cmra_port' :
- setVmsInputOption(inputClass, 'text', 70, null, 5);
- break
- case 'web_cmra_id' :
- setVmsInputOption(inputClass, 'text', 120, null, 30);
- break
- case 'web_cmra_pwd' :
- setVmsInputOption(inputClass, 'text', 120, null, 64);
- break
- case 'strm_sesn_nm' :
- setVmsInputOption(inputClass, 'text', 250, null, 200);
- break
- case 'strm_http_addr' :
- setVmsInputOption(inputClass, 'text', 250, null, 200);
- break
- case 'strm_rtsp_addr' :
- setVmsInputOption(inputClass, 'text', 250, null, 200);
- break
- case 'vms_max_phse_num' :
- setVmsInputOption(inputClass, 'number', 70, 10, 16);
- break
- case 'panl_on_time' :
- setVmsInputOption(inputClass, 'time', 70, firstSettingTime);
- inputBox.set('must', '전광판 ON 시각');
- break
- case 'panl_off_time' :
- setVmsInputOption(inputClass, 'time', 70, firstSettingTime);
- inputBox.set('must', '전광판 OFF 시각');
- break
- default :
- break
- }
- });
- }
- //input 옵션 세팅
- function setVmsInputOption( inputClass, type, width, value, max, maskRules){
- const inputBox = _vmsInputBoxMap.get(inputClass);
-
- inputBox.set('init', '');
- if(value) inputBox.set('init', value);
-
- switch (type) {
- case 'text':
- inputBox.set('input', $('.' + inputClass).dxTextBox({
- value : value,
- readOnly : true,
- width : width,
- stylingMode : 'outlined',
- height : 25,
- maskRules : maskRules,
- maxLength : max,
- }).dxTextBox('instance'));
- break;
- case 'number':
- inputBox.set('input', $('.' + inputClass).dxNumberBox({
- value : value,
- readOnly : true,
- width : width,
- stylingMode : 'outlined',
- showSpinButtons : true,
- height : 25,
- min : 1,
- max : max,
- }).dxNumberBox('instance'));
- break;
- case 'select':
- const valueExpr = inputClass;
- const displayExpr = valueExpr.substring(0,valueExpr.length-2) + 'desc';
- inputBox.set('input', $('.' + inputClass).dxSelectBox({
- displayExpr : displayExpr,
- valueExpr : valueExpr,
- readOnly : true,
- width : width,
- stylingMode : 'outlined',
- height : 25,
- }).dxSelectBox('instance'));
- break;
- case 'time':
- inputBox.set('input', $('.' + inputClass).dxDateBox({
- type : type,
- value : value,
- readOnly : false,
- width : width,
- stylingMode : 'outlined',
- height : 25,
- displayFormat : 'HH:mm',
- interval : 10,
- }).dxDateBox('instance'));
- break
- default:
- break;
- }
-
-
- }
- //버튼 옵션 세팅
- function setVmsBtnOption( classNm, text, icon, event, visible, disabled){
- let btn = _vmsBtnBoxMap.get(classNm).get('btn');
- if(btn){
- btn.option('text', text);
- btn.option('icon', icon);
- btn.option('onClick', event);
- btn.option('visible', visible);
- btn.option('disabled', disabled);
- btn.option('stylingMode', 'outlined');
- };
- };
- //전체 VMS 적용 이벤트
- function allVmsApplyEvent(){
- const panlOnTime = getInput('panl_on_time');
- const panlOffTime = getInput('panl_off_time');
- let onTime = getValue(panlOnTime);
- let offTime = getValue(panlOffTime)
- let panlTimeParam = {};
- let data = [];
- let ctrlNmvr = null;
- for (let panlTimeColumn of panlTimeColumns){
- const inputBox = _vmsInputBoxMap.get(panlTimeColumn);
- const input = getInput(panlTimeColumn);
-
- if (nullChecker(getValue(input)) === ""){
- input.focus();
- return alertWarning(inputBox.get('must') + '을 입력해주세요', null, input);
- }
- else if (input.option('validationError')){
- input.focus();
- return alertWarning('전광판 On/Off 시각을 바르게 입력해주세요', null, input);
- }
- };
- if (_vmsTableList.getSelectedRowsData().length > 0) ctrlNmvr = _vmsTableList.getSelectedRowsData()[0].vms_ctlr_nmbr;
-
- confirmMessage("제어기 설정 정보를 전체 VMS에 동일하게 적용 하시겠습니까?").done((yes) => {
- if (yes === true) {
- onTime = getSendTime(onTime);
- offTime = getSendTime(offTime);
- panlTimeParam['panl_on_time'] = onTime;
- panlTimeParam['panl_off_time'] = offTime;
-
- const result = postInsertUpdate(_apiUri + '/panl-time', panlTimeParam);
- if (result > 0) {
- refresh(_vmsTableList, data, _apiUri);
-
- if (ctrlNmvr){
- _vmsTableList.clearSelection();
- _vmsTableList.selectRows(ctrlNmvr, true).done(function () {
- _vmsTableList.option("focusedRowKey", ctrlNmvr);
- _vmsTableList.refresh();
- });
- };
-
- eventOff();
- return alertConfirm('VMS 제어기 설정 정보저장<br>제이기 설정 정보를 전체 제어기에 적용 하였습니다.');
- };
- //return alertConfirm('VMS 제이기 설정 정보저장<br>제이기 설정 정보를 전체 제어기에 적용 되지 않았습니다.');
- }
- });
- };
- //닫기 이벤트
- function closeEvent(){
- window.close();
- };
- //편집 이벤트
- function editEvent(){
- eventOn();
- editFcltObject(_selectFcltNmbr, true);
- _vmsBtnBoxMap.get('save-btn').get('btn').off('click');
- _vmsBtnBoxMap.get('save-btn').get('btn').on('click', () => saveEvent('edit'));
- };
- //추가 이벤트
- function addEvent(){
- eventOn(true);
- let center = _mapManager.getCenter();
- const xCrdn = getInput('x_crdn');
- const yCrdn = getInput('y_crdn');
- setValue(xCrdn, center[0]);
- setValue(yCrdn, center[1]);
- const newNum = getNewNmbr();
- addFcltObject(newNum);
- setValue( getInput('vms_ctlr_nmbr'), newNum);
- _vmsBtnBoxMap.get('save-btn').get('btn').off('click');
- _vmsBtnBoxMap.get('save-btn').get('btn').on('click', () => saveEvent());
- };
- //삭제 이벤트
- function delEvent(){
- const vmsCtlrNmbr = _vmsTableList.getSelectedRowsData()[0].vms_ctlr_nmbr;
- if (confirm(_pageMsg + "번호 : " + vmsCtlrNmbr + "\n선택하신 " + _pageMsg + " 정보를 삭제하시겠습니까?")) {
- const result = deleteData(_apiUri, vmsCtlrNmbr);
- if (result > 0) {
- delResultMsg(_pageMsg);
- _managerData = refresh(_vmsTableList, _managerData, _apiUri);
- _vmsTableList.refresh().done(function () {
- _vmsTableList.option("focusedRowIndex", -1);
- _vmsTableList.clearSelection();
- });
- deleteFcltObject(vmsCtlrNmbr);
- }
- }
- };
- //저장 이벤트
- function saveEvent(type){
- let updateData = {..._updateColumns};
- if (type === 'edit') {
- let rowData = _vmsTableList.getSelectedRowsData()[0];
- for (let key in updateData) {
- updateData[key] = rowData[key];
- }
- }
- let selected = false;
- for( let inputClass of _inputClasses){
- const inputBox = _vmsInputBoxMap.get(inputClass);
- const input = getInput(inputClass);
- const value = input.option('value');
- if(inputBox.get('must') && nullChecker(value) === ""){
- input.focus();
- return alertWarning(inputBox.get('must') + " 정보를 입력해주세요.", null, input);
- };
- updateData[inputClass] = value;
- };
- if(!/^[0-9]{1,3}[.]{1}[0-9]{1,3}[.]{1}[0-9]{1,3}[.]{1}[0-9]{1,3}$/.test(updateData.vms_ctlr_ip)){
- const edIp = getInput('vms_ctlr_ip');
- edIp.focus();
- return alertWarning("스트리밍 주소 IP를 형식에 맞게 입력해주세요.", null, edIp);
- };
- if( updateData.web_cmra_ip && !/^[0-9]{1,3}[.]{1}[0-9]{1,3}[.]{1}[0-9]{1,3}[.]{1}[0-9]{1,3}$/.test(updateData.web_cmra_ip)){
- const edIp = getInput('web_cmra_ip');
- edIp.focus();
- return alertWarning("웹카메라 IP를 형식에 맞게 입력해주세요.", null, edIp);
- };
- if( updateData.strm_http_addr && !/^[0-9]{1,3}[.]{1}[0-9]{1,3}[.]{1}[0-9]{1,3}[.]{1}[0-9]{1,3}$/.test(updateData.strm_http_addr)){
- const edIp = getInput('strm_http_addr');
- edIp.focus();
- return alertWarning("스트리밍 HTTP 주소 IP를 형식에 맞게 입력해주세요.", null, edIp);
- };
- if( updateData.strm_rtsp_addr && !/^[0-9]{1,3}[.]{1}[0-9]{1,3}[.]{1}[0-9]{1,3}[.]{1}[0-9]{1,3}$/.test(updateData.strm_rtsp_addr)){
- const edIp = getInput('strm_rtsp_addr');
- edIp.focus();
- return alertWarning("스트리밍 RSTP 주소 IP를 형식에 맞게 입력해주세요.", null, edIp);
- };
-
- for( let panlTimeColumn of panlTimeColumns){
- const input = getInput(panlTimeColumn);
- if(input.option('validationError')){
- input.focus();
- return alertWarning('전광판 On/Off 시각을 바르게 입력해주세요', null, input);
- }
- }
- updateData.panl_on_time = getSendTime(updateData.panl_on_time);
- updateData.panl_off_time = getSendTime(updateData.panl_off_time);
- updateData.vms_id = updateData.vms_ctlr_nmbr % 10000;
- updateData.vms_modl_type_cd = updateData.vms_usag_type_cd === 'VUTN' ? "VMM0" : "VMM1";
- if (_vmsTableList.getRowIndexByKey(updateData.vms_ctlr_nmbr) > -1 && _vmsTableList.getSelectedRowsData().length > 0){
- let selectedData = _vmsTableList.getSelectedRowsData()[0];
- for(let key in updateData){
- if(!_inputClasses.includes(key) && key !== 'vms_id' && key !== 'vms_modl_type_cd'){
- updateData[key] = selectedData[key];
- }
- }
- selected = true;
- }
- console.log(updateData);
- let result = postInsertUpdate(_apiUri + "/" + updateData.vms_ctlr_nmbr, updateData);
-
- if (result <= 0) {
- return alertWarning("VMS 제어기 정보가 저장되지 않았습니다.");
- }
- insResultMsg("VMS 제어기");
- _managerData = refresh(_vmsTableList, _managerData, _apiUri);
- if(selected){
- _vmsTableList.clearSelection();
- _vmsTableList.selectRows(updateData.vms_ctlr_nmbr, true).done(function () {
- _vmsTableList.option("focusedRowKey", updateData.vms_ctlr_nmbr);
- _vmsTableList.refresh();
- });
- }
- eventOff();
- };
- //취소 이벤트
- function cancleEvent(){
- eventOff();
- };
- //vms 목록 더블클릭 이벤트
- function vmsTableDblClick(row){
- if(row.data){
- const vmsInfo = row.data;
- _selectFcltNmbr = vmsInfo.vms_ctlr_nmbr;
- selectFcltObject(_selectFcltNmbr);
- _inputClasses.forEach(inputClass => {
- const inputBox = _vmsInputBoxMap.get(inputClass).get('input');
- setValue(inputBox, vmsInfo[inputClass]);
- if(inputClass === 'panl_on_time' || inputClass === 'panl_off_time'){
- let timeVal = vmsInfo[inputClass];
- let now = nowTime();
- timeVal = now.substring(0,10) +' '+ timeVal.substring(0,2) + ':' + timeVal.substring(2,4)+ ':00';
- timeVal = new Date(timeVal).getTime();
- setValue(inputBox, timeVal);
- }
- });
- _btnClasses.forEach( (btnClass)=>{
- const btnInfoBox = _vmsBtnBoxMap.get(btnClass);
- const btn = btnInfoBox.get('btn');
- if(btnInfoBox.get('dblClick')){
- const options = btnInfoBox.get('dblClick');
- btn.option('visible', options[0]);
- btn.option('disabled', options[1]);
- }
- })
- }
- }
- //이벤트 실행시 발생 이벤트
- function eventOn(init){
- _btnClasses.forEach( (btnClass)=>{
- const btnInfoBox = _vmsBtnBoxMap.get(btnClass);
- const btn = btnInfoBox.get('btn');
- if(btnInfoBox.get('event')){
- const options = btnInfoBox.get('event');
- btn.option('visible', options[0]);
- btn.option('disabled', options[1]);
- };
- });
- _inputClasses.forEach(inputClass => {
- const inputInfoBox = _vmsInputBoxMap.get(inputClass);
- const inputBox = inputInfoBox.get('input');
- inputBox.option('readOnly', false);
-
- if(inputClass === 'vms_ctlr_nmbr'){
- inputBox.option('readOnly', true);
- }
-
- if(init){
- inputBox.option('value', inputInfoBox.get('init'));
- }
- });
-
- dsblOnBtn(_vmsTableList);
- }
- //이벤트 취소시 발생 이벤트
- function eventOff(){
-
- dsblOffBtn(_vmsTableList);
- updateIcon();
- const selectedData = _vmsTableList.getSelectedRowsData();
- const selected = selectedData.length > 0 ? true : false;
-
- _btnClasses.forEach( (btnClass)=>{
- const btnInfoBox = _vmsBtnBoxMap.get(btnClass);
- const btn = btnInfoBox.get('btn');
- if(btnInfoBox.get('cancle')){
- const options = btnInfoBox.get('cancle');
- btn.option('visible', options[0]);
- if (selected) {
- btn.option('disabled', options[1]);
- } else{
- btn.option('disabled', options[2]);
- }
- };
- });
- _inputClasses.forEach(inputClass => {
- const inputInfoBox = _vmsInputBoxMap.get(inputClass);
- const inputBox = inputInfoBox.get('input');
- inputBox.option('readOnly', true);
- if('panl_on_time' === inputClass || 'panl_off_time' === inputClass) inputBox.option('readOnly', false);
- if (selected) {
- inputBox.option('value', selectedData[0][inputClass]);
- } else{
- inputBox.option('value', inputInfoBox.get('init'));
- }
- });
-
- }
- /**
- * 제어기 신규 ID 조회
- */
- function getNewNmbr() {
- let newId = [];
- getData(_apiUri + "/new-id", newId);
- _selectFcltNmbr = newId[0].new_id;
- return _selectFcltNmbr;
- }
- /**
- * 지도 인터페이스 함수........
- */
- function doMap() {
- _mapManager = new TMapMngr("vms-map", "tooltip");
- _mapManager.setEditMode(_lyrIdx, true);
- _mapManager.showLayer(_lyrIdx, true);
- _mapManager.showFcltObjectText(_lyrIdx, true);
- _mapManager.onFcltDragEndFunc = onFcltDragEndFunc; // 객체(시설물) 편집시 객체 이동후 좌표 반환
- _mapManager.onMouseClickFunc = onMouseClickFunc; // 객체 마우스 클릭 이벤트 반환
- fetchMapIconBar($('.map-bar'), _mapManager, _lyrIdx, _pageName);
- }
- function onFcltDragEndFunc(ALyrIdx, ALyrName, ANmbr, ACoordX, ACoordY) {
- if (ALyrIdx != _lyrIdx) {
- return;
- }
- if (ANmbr === _selectFcltNmbr) {
- setValue(getInput('x_crdn'), ACoordX.toFixed(7));
- setValue(getInput('y_crdn'), ACoordY.toFixed(7));
- }
- console.log(`onFcltDragEndFunc, ${ALyrIdx}, ${ALyrName}, ${ANmbr}, ${ACoordX}, ${ACoordY}`);
- }
- function onMouseClickFunc(ALyrIdx, ALyrName, ANmbr, ACoordX, ACoordY, X, Y) {
- if (ALyrIdx != _lyrIdx) {
- return;
- }
- console.log(`onMouseClickFunc, ${ALyrIdx}, ${ALyrName}, ${ANmbr}, ${ACoordX}, ${ACoordY}, ${X}, ${Y}`);
- const obj = _mapManager.findLayerObject(ALyrIdx, ANmbr);
- if (!obj) {
- return;
- }
- }
- /**
- * 지도에 시설물 객체 정보를 그린다.
- */
- function updateIcon() {
- // 기존 객체를 모두 삭제한다.
- _mapManager.removeLayerObject(_lyrIdx);
- // 시설물 객체를 지도에 그린다.
- const objs = new Array();
- _managerData[0].forEach((obj) => {
- const item = new TFclt(obj.vms_ctlr_nmbr, obj.vms_nm, obj.x_crdn, obj.y_crdn);
- objs.push(item);
- });
- console.log(_lyrIdx, objs);
- _mapManager.initFcltObject(_lyrIdx, objs);
- }
- function selectFcltObject(ANmbr) {
- _mapManager.selectLayerObject(_lyrIdx, ANmbr);
- }
- function editFcltObject(ANmbr, AIsEdit) {
- _mapManager.editFcltObject(_lyrIdx, ANmbr, AIsEdit, AIsEdit ? "1" : "0");
- }
- function deleteFcltObject(ANmbr) {
- _mapManager.deleteFcltObject(_lyrIdx, ANmbr);
- _selectFcltNmbr = null;
- }
- function addFcltObject(ANmbr) {
- _mapManager.createFcltObject(_lyrIdx, ANmbr, "New", "New", "1" /*아이콘색결정,시설물유형_N.png*/ /*, x_crdn, y_crdn*/);
- }
- function getInput(column){
- return _vmsInputBoxMap.get(column).get('input')
- }
- //좌표값 변경 시 이벤트
- function crdnChanges(text, num){
- let value = text.value;
- const textBox = text.component
- if(!value || isNaN(value)) return setValue(textBox, '0.0000000');
-
- value = value.toString();
-
- if(value.length <= num) return setValue(textBox, value + ".0000000");
-
- if (!value.includes(".")){
- let front = value.substr(0, num);
- let end = value.substr(num, value.length);
- let zero = "";
- if (end.length < 7) {
- for (let ii = 0; ii < 7 - end.length; ii++) {
- zero += "0";
- }
- }
- if (end.length > 7) end = end.substring(0, 7);
- setValue(textBox, front + "." + end + zero);
- }
- else{
- switch (true) {
- case value.substring(0, value.indexOf(".")) === "":
- setValue(textBox, "0" + value);
- break;
- case value.substring(value.indexOf("."), value.length) === "":
- setValue(textBox, value + "0000000");
- break;
- case value.substring(value.indexOf("."), value.length).length < 7:
- let zero = "";
- for (let ii = 0; ii < 7 - value.substring(value.indexOf(".") + 1, value.length).length; ii++) {
- zero += "0";
- }
- setValue(textBox, value.substring(0, value.indexOf(".")) + value.substring(value.indexOf("."), value.length) + zero);
- break;
- default:
- break;
- }
- }
-
- }
|