| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 | 
							- BemsWebApplication.SetChart = function (params, viewInfo) {
 
-     "use strict";
 
-     var facilityTypeDataSource = BemsWebApplication.db.createDataSource('BemsFacilityType', true);
 
-     var ChartInfoDataSource = BemsWebApplication.db.createDataSource('BemsChartInfo', true);
 
-     var facilityTypes = ko.observableArray();
 
-     var ChartInfo = ko.observableArray();
 
-     var searchfacilityTypes = ko.observableArray();
 
-     var facilityTypeDeferred = new $.Deferred();
 
-     var BemsFormulaBaseDataSource = BemsWebApplication.db.createDataSource('BemsFormulaBase', true, true);
 
-     var formulaListByFacilityType = ko.observableArray();
 
-     var palettes = ['Default', 'Soft Pastel', 'Harmony Light', 'Pastel', 'Bright', 'Soft', 'Ocean', 'Vintage', 'Violet'];
 
-     var chartTypes = ['bar', 'line', 'spline', 'area', 'scatter', 'splinearea', 'stepline', 'steparea'];
 
-     var dataSourceOptions = {
 
-         select: [
 
-             'SiteId', 'FacilityTypeId', 'BemsFacilityType/Name',
 
-             'ChartId', 'Palette', 'Title',
 
-             'LAxTitle', 'UseLAxMinMax', 'LAxMin', 'LAxMax',
 
-             'RAxTitle', 'UseRAxMinMax', 'RAxMin', 'RAxMax',
 
-             'UseX', 'XAxTitle', 'XSFmId', 'XSType', 'UseXAxMinMax', 'XAxMin', 'XAxMax',
 
-             'LSFmId1', 'LSName1', 'LSType1',
 
-             'LSFmId2', 'LSName2', 'LSType2',
 
-             'LSFmId3', 'LSName3', 'LSType3',
 
-             'LSFmId4', 'LSName4', 'LSType4',
 
-             'RSFmId1', 'RSName1', 'RSType1',
 
-             'RSFmId2', 'RSName2', 'RSType2',
 
-             'RSFmId3', 'RSName3', 'RSType3',
 
-             'RSFmId4', 'RSName4', 'RSType4',
 
-             'UseChart',
 
-             'UseLCTLine', 'LCTLineTitle', 'LCTLineValue',
 
-             'UseRCTLine', 'RCTLineTitle', 'RCTLineValue',
 
-         ],
 
-         filter: [
 
-             ['SiteId', '=', BWA.UserInfo.SiteId()]
 
-         ],
 
-         expand: [
 
-             'BemsFacilityType',
 
-         ],
 
-         extendOptions: {
 
-             forceOriginalField: true
 
-         },
 
-     };
 
-     var viewModel = BWA.DataGrid.createViewWithDataGrid(params, viewInfo, 'BemsChartInfo', {
 
-         dataSourceOptions: dataSourceOptions,
 
-         columns: [
 
-                 { dataField: 'SiteId', caption: '번호', width: '8%', alignment: 'center', sortOder: 'desc' },
 
-                 { dataField: 'BemsFacilityType/Name', caption: '설비타입', width: '15%', alignment: 'center' },
 
-                 { dataField: 'ChartId', caption: '차트ID', width: '10%', alignment: 'center' },
 
-                 { dataField: 'Title', caption: '차트타이틀', width: '15%', alignment: 'center' },
 
-                 { dataField: 'Palette', caption: '차트 색상', width: '15%', alignment: 'center' },
 
-                 { dataField: 'LAxTitle', caption: '좌Y축 타이틀', width: '20%', alignment: 'center' },
 
-                 { dataField: 'LSName1', caption: '좌Y축 항목1 타이틀', width: '20%', alignment: 'center' },
 
-                 /*{
 
-                     dataField: 'UseLAxMinMax', caption: '좌Y축 최대최소값 사용', width: '5%', alignment: 'center',
 
-                     customizeText: function (cellInfo) { return $G.isUse(cellInfo.value); }
 
-                 },*/
 
-                 { dataField: 'RAxTitle', caption: '우Y축 타이틀', width: '20%', alignment: 'center' },
 
-                 /*{
 
-                     dataField: 'UseRAxMinMax', caption: '우Y축 최대최소값 사용', width: '5%', alignment: 'center',
 
-                     customizeText: function (cellInfo) { return $G.isUse(cellInfo.value); }
 
-                 },*/
 
-                 { dataField: 'RSName1', caption: '우Y축 항목1 타이틀', width: '20%', alignment: 'center' },
 
-                 //{ dataField: 'Palette', caption: $G('phoneNo'), width: '20%', alignment: 'center' },
 
-                 /*
 
-                 {
 
-                     dataField: 'IsControlSchedule', caption: '제어스케줄', width: '15%', alignment: 'center',
 
-                     customizeText: function (cellInfo) {
 
-                         return $G.isUse(cellInfo.value);
 
-                     }
 
-                 },*/
 
-                 {
 
-                     dataField: 'UseChart', caption: '차트 사용', width: '15%', alignment: 'center',
 
-                     customizeText: function (cellInfo) {
 
-                         return $G.isUse(cellInfo.value);
 
-                         //return $G.isYes(cellInfo.value);
 
-                     }
 
-                 }
 
-                 //utils.datagrid.columnIsUse('10%'),
 
-         ],
 
-         // 2019.04.17 엑셀 출력 기능 추가 ~~~
 
-         "export": {
 
-             enabled: true,
 
-             fileName: '성능분석 차트 설정 내용'
 
-         },
 
-         onExporting: function (e) {
 
-             e.component.columnOption("SiteId", "visible", false);
 
-         },
 
-         onExported: function (e) {
 
-             e.component.columnOption("SiteId", "visible", true);
 
-         },
 
-         // ~~~ 2019.04.17 엑셀 출력 기능 추가
 
-         paging: {
 
-             pageSize: 18,
 
-             enabled: true
 
-         },
 
-         pager: {
 
-             //showPageSizeSelector: false,
 
-             //allowedPageSizes: 18,
 
-             //showInfo: false
 
-         },
 
-         promiseDataInSearchView: facilityTypeDeferred.promise(),
 
-         searchViewItems: [{ id: 'FacilityTypeId', ignoreValue: 0, defaultValue: 0, dataSource: searchfacilityTypes }, { id: 'Name' }],
 
-         handleDataGridRowClick: function (id, dataGrid, clickRow, popupVisible) {
 
-             dataGrid.clearSelection();
 
-             viewModel.isNewInPopup(false);
 
-             var data = clickRow.data;
 
-             viewModel.handleSelectBoxChangeFacilityType({ value: data.FacilityTypeId() });
 
-             //var dataModel = viewModel.dataModel;
 
-             /*
 
-             dataModel.CompanyName = $KoSet(dataModel.CompanyName, data['CmCompany/Name']);
 
-             dataModel.DepartmentName = $KoSet(dataModel.DepartmentName, data['CmDepartment/Name']);
 
-             dataModel.BusinessFieldName = $KoSet(dataModel.BusinessFieldName, data['CmBusinessField/Name']);
 
-             dataModel.UserGroupName = $KoSet(dataModel.UserGroupName, data['CmUserGroup/Name']);
 
-             dataModel.IsScheduleUser = $KoSet(dataModel.IsScheduleUser, data.IsScheduleUser());
 
-             dataModel.IsSI = $KoSet(dataModel.IsSI, data.IsSI());
 
-             dataModel.IsMobile = $KoSet(dataModel.IsMobile, data.IsMobile());*/
 
-             popupVisible(true);
 
-         },
 
-         handleViewShowing: function () {
 
-             facilityTypeDataSource.filter([
 
-                 ['FacilityTypeId', '<', 50]/*,
 
-                 'and',
 
-                 ['FacilityTypeId', '<>', 1],
 
-                 'and',
 
-                 ['FacilityTypeId', '<>', 2],
 
-                 'and',
 
-                 ['FacilityTypeId', '<>', 8],*/
 
-             ]);
 
-             facilityTypeDataSource.load().done(function (result) {
 
-                 facilityTypes(result);
 
-                 //searchfacilityTypes([{ facilityTypeId: 0, Name: $G('selectAll') }].concat(result));
 
-                 searchfacilityTypes(result);
 
-                 facilityTypeDeferred.resolve();
 
-             });
 
-             ChartInfoDataSource.load().done(function (result) {
 
-                 ChartInfo(result);
 
-             });
 
-         },
 
-         handlePopupShowing: function (isNewInPopup, dataViewModel) {
 
-             if (isNewInPopup()) {
 
-                 dataViewModel.ChartId(1);
 
-                 dataViewModel.UseChart(true);
 
-                 dataViewModel.UseX(false);
 
-                 dataViewModel.UseXAxMinMax(false);
 
-                 dataViewModel.UseLAxMinMax(false);
 
-                 dataViewModel.UseRAxMinMax(false);
 
-                 dataViewModel.Palette('Default');
 
-                 dataViewModel.UseLCTLine(false);
 
-                 dataViewModel.UseRCTLine(false);
 
-             }
 
-         },
 
-         popupWidth: 1000,
 
-         handleViewShown: function () {
 
-         },
 
-         //2015 12 21 hcLee
 
-         isUseSiteId: (BWA.UserInfo.isAdmin() == false) ? true : false,
 
-         beforeInsertingDataViewModel: function (dataModel, dbModelId) {
 
-             var dfd = $.Deferred();
 
-             var result;
 
-             for (var i = 0; i < ChartInfo().length; i++) {
 
-                 if (viewModel.dataModel.ChartId() == ChartInfo()[i].ChartId()) {
 
-                     result = false;
 
-                     break;
 
-                 }
 
-                 else {
 
-                     result = true;
 
-                 }
 
-             }
 
-             if (result) {
 
-                 dfd.resolve(true);
 
-             } else {
 
-                 dfd.resolve(false, '차트 ID가 중복되었습니다.');
 
-             }
 
-             return dfd.promise();
 
-         },
 
-         /*
 
-         beforeInsertingDataViewModel: function (dataModel, dbModelId) {
 
-             var dfd = $.Deferred();
 
-             $.when(BWA.api.post('BemsMonitoringPoint/GetMaxSiteId', null))
 
-             .done(function (newPid) {
 
-                 if (newPid > 0) {
 
-                     dataModel.SiteId(newPid);
 
-                     dfd.resolve(true); // hcLee OK good, (true, false 또는 객체로 리턴가능함) 2015 11 19
 
-                 }
 
-                 else dfd.resolve(false, 'SiteId 자동 생성에 실패하였습니다!'); // hcLee OK good, (true, false 또는 객체로 리턴가능함) 2015 11 19
 
-             });
 
-             return dfd.promise();
 
-         },*/
 
-         handleAfterLoadingModelByKey: function (data, dataViewModel, isNewInPopup) {
 
-             // 사이트정보는 생성 후 삭제할 수 없음
 
-             viewModel.visibleDeleteButton(true);
 
-         }
 
-     });
 
-     viewModel.isEditModeInPopup.subscribe(function (value) {
 
-         viewModel.visibleDeleteButton(true);
 
-     });
 
-     {
 
-         viewModel.popupInsertButtonOptions.visible = true;
 
-     }
 
-     viewModel.facilityTypes = facilityTypes;
 
-     viewModel.palettes = palettes;
 
-     viewModel.chartTypes = chartTypes;
 
-     viewModel.formulaListByFacilityType = formulaListByFacilityType;
 
-     viewModel.handleSelectBoxChangeFacilityType = function (e) {
 
-         // hcLee 2018 03 02
 
-         //기존 setArrayDataSourceFilter 를 확장하여 추가한 함수이다.
 
-         // 동기화 Deferred 때문에 이 함수 동기화 내부에서 formulaListByFacilityType에 외기온도,습도 를 강제로 추가하는 코드가 존재 해야만
 
-         // 팝업 콤보에 정상으로 추가된 항목(외기온도,습도)이 보이게 된다.
 
-         BWA.DataUtil.setArrayDataSourceFilterForChartSet(BemsFormulaBaseDataSource, 'FacilityTypeId', e.value, formulaListByFacilityType);
 
-         var i = 0;
 
-     }
 
-     return viewModel;
 
- };
 
 
  |