123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
-
- BemsWebApplication.AlarmLog = function (params, viewInfo) {
- "use strict";
- // 알람 정보 저장
- var DataArrayInfo = [];
- var now = new Date();
- function BemsAlarmLogDataSourceLoad(startday, endday) {
- var BemsAlarmLogDataSource = BemsWebApplication.DataUtil.createDataSource({
- dataSourceOptions: {
- select: [
- 'CreatedDateTime', 'BemsAlarmSetting/FacilityName', 'BemsAlarmSetting/PointName', 'CurrentValue', 'BemsAlarmSetting/UpperLimit', 'BemsAlarmSetting/LowerLimit', 'SMSResult', 'EmailResult',
- 'SiteId', 'FacilityTypeId', 'FacilityCode', 'PropertyId', 'FormulaId', 'Conform'
- ],
- expand: ['BemsAlarmSetting'],
- extendOptions: {
- forceOriginalField: true,
- alterNames: {
- 'BemsAlarmSetting/FacilityName': 'FacilityName',
- 'BemsAlarmSetting/PointName': 'PointName',
- 'BemsAlarmSetting/UpperLimit': 'UpperLimit',
- 'BemsAlarmSetting/LowerLimit': 'LowerLimit'
- }
- },
- filter: [
- ['SiteId', '=', BWA.UserInfo.SiteId()],
- 'and',
- ['CreatedDateTime', '>=', startday],
- 'and',
- ['CreatedDateTime', '<=', endday]]
- }
- }, 'BemsAlarmLog');
- BemsAlarmLogDataSource.load().done(function (result) {
- if (result.length == 0) {
- // 알람 버튼 색 컬러 변경 정지
- BWA.AlarmInfo.Alarm_Image_Change = false;
- }
- DataArrayInfo = []; // 초기화
- _.each(result, function (x) {
- var temp_conform;
- var temp = '';
- if (x.FormulaId() != 0) {
- temp = '성능분석';
- }
- else {
- if (x.FacilityTypeId() == 99) {
- temp = '가상시설';
- }
- else {
- temp = '일반시설';
- }
- }
- if (x.Conform())
- temp_conform = "ON";
- else
- temp_conform = "OFF";
- DataArrayInfo.push({
- CreatedDateTime: x.CreatedDateTime,
- Type: temp,
- FacilityName: x.FacilityName,
- PropertyName: x.PointName,
- CurrentValue: x.CurrentValue,
- UpperLimit: x.UpperLimit,
- LowerLimit: x.LowerLimit,
- SMSResult: x.SMSResult,
- EmailResult: x.EmailResult,
- Conform: temp_conform,
- SiteId: x.SiteId,
- FacilityTypeId: x.FacilityTypeId,
- FacilityCode: x.FacilityCode,
- PropertyId: x.PropertyId,
- FormulaId: x.FormulaId
- });
- });
- $("#gridContainer_alarm1").dxDataGrid("instance").option("dataSource", DataArrayInfo);
- })
- }
- function handleViewShown() {
- var tmpDate = new Date();
- var endDay = tmpDate.getDate();
- var startday = new Date(tmpDate.getFullYear(), tmpDate.getMonth(), endDay-7, 0, 0, 0, 0);
- var endday = new Date(tmpDate.getFullYear(), tmpDate.getMonth(), endDay, 23, 59, 59, 0);
- $("#startDate").dxDateBox("instance").option('value', startday);
- $("#endDate").dxDateBox("instance").option('value', endday);
- $("#gridContainer_alarm1").dxDataGrid({
- rowAlternationEnabled: true,
- paging: {
- pageSize: 16
- },
- columns: [
- {
- dataField: 'CreatedDateTime', caption: '날짜', width: '12%', alignment: 'center', sortOrder: 'desc', dataType: "shortDate", format: "yyyy-MM-dd hh:mm:ss",
- customizeText: function (cellInfo) {
- return cellInfo.valueText;
- }
- },
- {
- dataField: 'Type', caption: '타입', width: '5%', alignment: 'center'
- },
- {
- dataField: 'FacilityName', caption: '설비명칭', width: '20%', alignment: 'center'
- },
- {
- dataField: 'PropertyName', caption: '관제점(분석요소)', width: '20%', alignment: 'center'
- },
- {
- dataField: 'CurrentValue', caption: '값', width: '8%', alignment: 'center'
- },
- {
- dataField: 'UpperLimit', caption: '기준상한(이상)', width: '8%', alignment: 'center'
- },
- {
- dataField: 'LowerLimit', caption: '기준하한(이하)', width: '8%', alignment: 'center'
- },
- {
- dataField: 'SMSResult', caption: 'SMS 결과', width: '5.5%', alignment: 'center'
- },
- {
- dataField: 'EmailResult', caption: 'Email 결과', width: '6.5%', alignment: 'center'
- },
- {
- dataField: 'Conform', caption: '알람해제', width: '7%', alignment: 'center'
- },
- // 아래 visible 속성을 true를 준 이유는 조치방법 확인을 클릭했을때, SiteId 등의 값을 읽어오지 못해서다
- {
- dataField: 'SiteId', visible: false
- },
- {
- dataField: 'FacilityTypeId', visible: false
- },
- {
- dataField: 'FacilityCode', visible: false
- },
- {
- dataField: 'PropertyId', visible: false
- },
- { dataField: 'FormulaId', visible: false },
- ],
- // 2019.04.17 엑셀 출력 기능 추가 ~~~
- "export": {
- enabled: true,
- fileName: '알람 로그 내역'
- }
- // ~~~ 2019.04.17 엑셀 출력 기능 추가
- });
- BemsAlarmLogDataSourceLoad(startday, endday);
- }
- var searchViewOptions = {
- }
- function handleSearchInSearchView() {
- }
- var viewModel = $.extend(BWA.CommonView.create(params, viewInfo, searchViewOptions, ko.observable(null), handleViewShown, null, handleSearchInSearchView),
- {
- startDate: {
- pickerType: "calendar",
- value: now,
- formatString: "yyyy년 MM월 dd일",
- maxZoomLevel: "month",
- width: "12%"
- },
- endDate: {
- pickerType: "calendar",
- value: now,
- formatString: "yyyy년 MM월 dd일",
- maxZoomLevel: "month",
- width: "12%"
- },
- modifyButtonClicked: function () {
- var startDate = $("#startDate").dxDateBox("instance").option('value');
- var endDate = $("#endDate").dxDateBox("instance").option('value');
- var endday = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate(), 23, 59, 59, 0);
- BemsAlarmLogDataSourceLoad(startDate, endday);
- }
- });
- return viewModel;
- };
|