123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286 |
-
- BWA.AlarmInfo = {
- Alarm_Image_Change: ko.observable(false)
- };
- $(function () {
- 'use strict';
- var AlarmPopupVisible = ko.observable(false);
- BWA.AlarmPopup = {
- AlarmPopupOptions: {
- visible: AlarmPopupVisible,
- width: '1400px',
- height: '850px',
- contentTemplate: "content",
- showTitle: true,
- title: "알람정보",
- dragEnabled: false,
- closeOnOutsideClick: false,
- shadingColor: 'rgba(0,0,0,0.0)',
- shownAction: handlePopupShown,
- animation: window.utils.popup.createAnimation()
- },
- AlarmPopupOpen: function() {
- AlarmPopupVisible(true);
- },
- AlarmPopupCheckOptions: {
- visible: false,
- width: '400px',
- height: '400px',
- contentTemplate: "content",
- showTitle: true,
- title: "조치방법",
- dragEnabled: false,
- closeOnOutsideClick: false,
- shadingColor: 'rgba(0,0,0,0.0)',
-
- animation: window.utils.popup.createAnimation()
- },
- }
-
- var DataArrayInfo = [];
-
- function handlePopupShown() {
-
- $("#LoadPanel").dxLoadPanel({
- message: '전체 알람 해제중...',
- showIndicator: true,
- visible: false
- });
- $("#Button_StopAlarm").dxButton({
- text: "전체 알람 해제",
- onClick: function () {
- var num = DataArrayInfo.length;
- if (num == 0) {
-
- utils.toast.show('해제 할 알람 정보가 없습니다.', 'error');
- return;
- }
- DevExpress.ui.dialog.confirm("전체 알람 해제 하시겠습니까?", "전체 알람 해제").done(function (dialogResult) {
- if (dialogResult)
- {
-
- $("#Button_StopAlarm").dxButton('instance').option('disabled', true);
-
- $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
-
- BWA.AlarmInfo.Alarm_Image_Change = false;
- var index = 0;
- for (var i = 0; i < num; i++) {
- BWA.db.BemsAlarmLog.update({
- SiteId: DataArrayInfo[i].SiteId(),
- FacilityTypeId: DataArrayInfo[i].FacilityTypeId(),
- FacilityCode: DataArrayInfo[i].FacilityCode(),
- PropertyId: DataArrayInfo[i].PropertyId(),
- FormulaId: DataArrayInfo[i].FormulaId(),
- CreatedDateTime: DataArrayInfo[i].CreatedDateTime()
- },
- {
- Conform: true
- }).done(function () {
- index++;
- if (num == index) {
-
- DataArrayInfo = [];
- $("#gridContainer_alarm").dxDataGrid("instance").option("dataSource", DataArrayInfo);
-
- $("#Button_StopAlarm").dxButton('instance').option('disabled', false);
-
- $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
- }
- }).fail(function () {
- index++;
- if (num == index) {
-
- $("#Button_StopAlarm").dxButton('instance').option('disabled', false);
-
- $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
-
- utils.toast.show('전체 알람 해제시 에러가 발생하였습니다.', 'error');
- }
- });
- }
- }
- });
-
- }
- });
-
- $("#gridContainer_alarm").dxDataGrid({
- rowAlternationEnabled: true,
- paging: {
- pageSize: 21
- },
- columns: [
- { dataField: 'CreatedDateTime', caption: '날짜', width: '12%', alignment: 'center', dataType: 'date', format: 'yyyy-MM-dd HH:mm:ss', sortOrder: 'asc', },
- { 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: '9%', alignment: 'center' },
- { dataField: 'LowerLimit', caption: '기준하한(이하)', width: '9%', alignment: 'center' },
- { dataField: 'SMSResult', caption: 'SMS 결과', width: '6%', alignment: 'center' },
- { dataField: 'EmailResult', caption: 'Email 결과', width: '6%', alignment: 'center' },
- { dataField: 'Check', caption: '조치방법', width: '5%', alignment: 'center' },
-
- { dataField: 'SiteId', visible: true },
- { dataField: 'FacilityTypeId', visible: true },
- { dataField: 'FacilityCode', visible: true },
- { dataField: 'PropertyId', visible: true },
- { dataField: 'FormulaId', visible: true },
- ],
-
- onCellClick: function (object) {
- if (object.columnIndex == 9) {
- var DataArrayInfo = object.values;
- var SiteId = DataArrayInfo[10];
- var FacilityTypeId = DataArrayInfo[11];
- var FacilityCode = DataArrayInfo[12];
- var PropertyId = DataArrayInfo[13];
- var FormulaId = DataArrayInfo[14];
-
- $("#PopupAlarmCheck").dxPopup('instance').option('visible', true);
- var BemsAlarmSettingDataSource = BemsWebApplication.db.createDataSource('BemsAlarmSetting');
- BemsAlarmSettingDataSource.filter([
- ['SiteId', '=', parseInt(SiteId)],
- 'and',
- ['FacilityTypeId', '=', parseInt(FacilityTypeId)],
- 'and',
- ['FacilityCode', '=', parseInt(FacilityCode)],
- 'and',
- ['PropertyId', '=', parseInt(PropertyId)],
- 'and',
- ['FormulaId', '=', parseInt(FormulaId)]
- ]);
- BemsAlarmSettingDataSource.load().done(function (result) {
- _.each(result, function (x) {
- $("#TextArea_Check").dxTextArea({
- disabled: true,
- value: x.Content
- });
- });
- })
- }
- },
- });
- var BemsAlarmLogDataSource = BemsWebApplication.DataUtil.createDataSource({
- dataSourceOptions: {
- select: [
- 'CreatedDateTime', 'BemsAlarmSetting/FacilityName', 'BemsAlarmSetting/PointName', 'CurrentValue', 'BemsAlarmSetting/UpperLimit', 'BemsAlarmSetting/LowerLimit', 'SMSResult', 'EmailResult',
- 'SiteId', 'FacilityTypeId', 'FacilityCode', 'PropertyId', 'FormulaId'
- ],
- expand: ['BemsAlarmSetting'],
- extendOptions: {
- forceOriginalField: true,
- alterNames: {
- 'BemsAlarmSetting/FacilityName': 'FacilityName',
- 'BemsAlarmSetting/PointName': 'PointName',
- 'BemsAlarmSetting/UpperLimit': 'UpperLimit',
- 'BemsAlarmSetting/LowerLimit': 'LowerLimit'
- }
- },
- filter: [
- ['SiteId', '=', BWA.UserInfo.SiteId()],
- 'and',
- ['Conform', '=', false]
- ]
- }
- }, 'BemsAlarmLog');
- BemsAlarmLogDataSource.load().done(function (result) {
- if(result.length == 0)
- {
-
- BWA.AlarmInfo.Alarm_Image_Change = false;
- }
- DataArrayInfo = [];
- _.each(result, function (x) {
- var temp = '';
- if (x.FormulaId() != 0) {
- temp = '성능분석';
- }
- else {
- if (x.FacilityTypeId() == 99) {
- temp = '가상시설';
- }
- else {
- temp = '일반시설';
- }
- }
- 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,
- Check: "확인",
- SiteId: x.SiteId,
- FacilityTypeId: x.FacilityTypeId,
- FacilityCode: x.FacilityCode,
- PropertyId: x.PropertyId,
- FormulaId: x.FormulaId
- });
- });
- $("#gridContainer_alarm").dxDataGrid("instance").option("dataSource", DataArrayInfo);
- })
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
- });
|