00d2e8406195a54312e9bb051a4d4f3ca4ea97ee.svn-base 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. BemsWebApplication.AirHandlingAnalysis = function(params, viewInfo) {
  2. "use strict";
  3. var initialized = false,
  4. shouldReload = false,
  5. datagrid = null,
  6. currentTabIndex = ko.observable(0),
  7. facilityViewModel = new BWA.CmFacilityViewModel(),
  8. dataSource;
  9. var m_Facility;
  10. var multiViewItems = [{
  11. template: 'mainCharts'
  12. }, {
  13. template: 'subCharts'
  14. }
  15. ];
  16. var facilityDataSource = BWA.db.createDataSource('CmFacility'),
  17. facilitiesForSearch = ko.observableArray(),
  18. facilityCodeForSearch = ko.observable(0),
  19. deferredForSearch = new $.Deferred();
  20. var visiblePopup = ko.observable(false);
  21. var dataCalorie = ko.observableArray(),
  22. dataAtfw = ko.observableArray(),
  23. dataTemperatureCalorie = ko.observableArray(),
  24. dataTemperatureElectricity = ko.observableArray()
  25. ;
  26. var formulaGet = new BWA.Chart.FormulaGet(BWA.UserInfo.SiteId());
  27. //var timeBoxForSearch = BWA.SearchView.createDateTimeBox();
  28. // cyim 2016.08.22 : 성능분석 그래프의 경우 시간 데이타만 표시되어야 한다
  29. var timeBoxForSearch = BWA.SearchView.createDateTimeBox($G.TimeTypesForHourOnly, null, false);
  30. var chartCalorieC = BWA.Chart.Instance('chartCalorieCAIR', 'dxChart'),
  31. chartCalorieH = BWA.Chart.Instance('chartCalorieHAIR', 'dxChart'),
  32. chartAtfw = BWA.Chart.Instance('chartAtfwAIR', 'dxChart'),
  33. chartVOpen = BWA.Chart.Instance('chartVOpenAIR', 'dxChart'),
  34. chartTemperatureElectricity = BWA.Chart.Instance('chartTemperatureElectricityAIR', 'dxChart');
  35. //chartTemperatureCalorie = BWA.Chart.Instance('chartTemperatureCalorie', 'dxChart'),
  36. // chartTemperatureElectricity2 = BWA.Chart.Instance('chartTemperatureElectricity2AIR', 'dxChart');
  37. var chartLayout = new BWA.ChartLayout({
  38. divs: [[{
  39. id: 'airHandlingDetail'
  40. }, {
  41. id: 'calorieC',
  42. chartId: 'chartCalorieCAIR'
  43. },{
  44. id: 'calorieH',
  45. chartId: 'chartCalorieHAIR'
  46. },{
  47. id: 'atfw',
  48. chartId: 'chartAtfwAIR'
  49. }, {
  50. id: 'VOpen',
  51. chartId: 'chartVOpenAIR'
  52. }, {
  53. id: 'temperatureElectricity',
  54. chartId: 'chartTemperatureElectricityAIR'
  55. }, {
  56. id: 'temperatureCalorie',
  57. chartId: 'chartTemperatureCalorieAIR'
  58. }, {
  59. id: 'temperatureElectricity2',
  60. chartId: 'chartTemperatureElectricity2AIR'
  61. }
  62. ]],
  63. multiViewOptions: {
  64. viewIndex: currentTabIndex,
  65. viewCount: 1
  66. }
  67. });
  68. var m = moment();
  69. dataCalorie([
  70. { DateTime: new Date(m.year(), m.month(), 1), Value: 50 },
  71. { DateTime: new Date(m.year(), m.month(), 2), Value: 50 },
  72. { DateTime: new Date(m.year(), m.month(), 3), Value: 60 },
  73. { DateTime: new Date(m.year(), m.month(), 4), Value: 80 },
  74. { DateTime: new Date(m.year(), m.month(), 5), Value: 100 },
  75. { DateTime: new Date(m.year(), m.month(), 6), Value: 40, },
  76. { DateTime: new Date(m.year(), m.month(), 7), Value: 120 },
  77. { DateTime: new Date(m.year(), m.month(), 31), Value: 120 }
  78. ]);
  79. // 추가 2015 04 20 hcLee ->
  80. var CODE = $Code,
  81. FuelType = CODE.FuelType,
  82. FT = CODE.FacilityType,
  83. FC = CODE.FacilityCode,
  84. F = CODE.Formula,
  85. TIT = CODE.TimeIntervalType;
  86. // 추가 2015 04 20 hcLee <-
  87. //dataMonthForBar(dataDayForBar());
  88. //dataDayForPie([
  89. // { FuelTypeName: '전기', Value: 320 },
  90. // { FuelTypeName: '가스', Value: 350 },
  91. // { FuelTypeName: '수도', Value: 360 },
  92. //]);
  93. //dataMonthForPie(dataDayForPie());
  94. function handleViewShown() {
  95. if (initialized === false) {
  96. var chartOption = BWA.ChartOptions.WaterCoolingAnalysis;
  97. //chartCalorieC = chartCalorieC(chartOption.getChartCalorieCOptions(timeBoxForSearch.type()));
  98. chartCalorieC = chartCalorieC(chartOption.getChart_1_Options(timeBoxForSearch.type()));
  99. //chartCalorieH = chartCalorieH(chartOption.getChartCalorieHOptions(timeBoxForSearch.type()));
  100. chartCalorieH = chartCalorieH(chartOption.getChart_2_Options(timeBoxForSearch.type()));
  101. chartAtfw = chartAtfw(chartOption.getChartAtfwOptions(timeBoxForSearch.type()));
  102. //chartVOpen = chartVOpen(chartOption.getChartVOpenOptions(timeBoxForSearch.type()));
  103. chartVOpen = chartVOpen(chartOption.getChart_3_Options(timeBoxForSearch.type()));
  104. chartTemperatureElectricity = chartTemperatureElectricity(chartOption.getTemperatureElectricityOptions(timeBoxForSearch.type()));
  105. //chartTemperatureCalorie = chartTemperatureCalorie(chartOption.getChartTemperatureCalorieOptions($Code.TimeType.HOUR));
  106. // chartTemperatureElectricity2 = chartTemperatureElectricity2(chartOption.getTemperatureElectricityOptions(timeBoxForSearch.type()));
  107. initialized = true;
  108. }
  109. //hcLee 2016 07 12
  110. timeBoxForSearch.setDefaultDate();
  111. var eq = BWA.DataUtil.constructEqualFilter;
  112. facilityDataSource.filter([
  113. eq('SiteId', BWA.UserInfo.SiteId()),
  114. 'and',
  115. eq('FacilityTypeId', $Code.FacilityType.AIR_HANDLING)
  116. ]);
  117. facilityDataSource.load().done(function(facilities) {
  118. facilitiesForSearch(facilities);
  119. if (_.isEmpty(facilities) === false) {
  120. var f = facilities[0];
  121. handleSelectedFacilityInSearchView(f);
  122. handleSearchInSearchView();
  123. var datagrid = $('#airHandlingDataGridViewInSearchView').dxDataGrid('instance');
  124. if (_.has(datagrid, 'selectRows')) {
  125. datagrid.selectRows(f);
  126. }
  127. }
  128. });
  129. }
  130. if (shouldReload) {
  131. //shouldReload = false;
  132. //dataSource.pageIndex(0);
  133. //dataSource.load();
  134. }
  135. function handleViewHidden() {
  136. var paging = BWA.ChartLayout.Paging;
  137. paging.sideOverlayVisible(false);
  138. $SearchView.visibleObservable(false); // hcLee 2015 03 23
  139. visiblePopup(false);
  140. }
  141. function handleViewShowing() {
  142. }
  143. function refreshList() {
  144. //dataSource.pageIndex(0);
  145. //dataSource.load();
  146. }
  147. var searchViewOptions = {
  148. searchViewItems: [
  149. { id: 'FacilityCode', ignoreValue: 0, defaultValue: 0, value: facilityCodeForSearch, dataSource: facilitiesForSearch },
  150. ],
  151. promiseDataInSearchView: deferredForSearch.promise()
  152. };
  153. function handleSelectedFacilityInSearchView(facility) {
  154. m_Facility = facility;
  155. return;
  156. }
  157. function handleSearchInSearchView(filter, searchViewItems) {
  158. //console.log(filter);
  159. //console.log(searchViewItems);
  160. if (m_Facility == null) return;
  161. visiblePopup(true);
  162. var f = m_Facility.toJS();
  163. facilityViewModel.fromJS(f);
  164. //var timeIntervalType = $Code.TimeIntervalType.QUARTERMIN;
  165. var timeIntervalType = timeBoxForSearch.type();
  166. var formula = $Code.Formula[$Code.FacilityType.AIR_HANDLING];
  167. var formulaIds = _.values(formula);
  168. var date = timeBoxForSearch.getDate();
  169. //utils.toast.displayTime=1000000;
  170. //utils.toast.show('공조기 성능분석 중 입니다. 잠시만 기다려 주세요');
  171. // var startDate = moment().
  172. var promises = [];
  173. _.each(formulaIds, function (formulaId) {
  174. var p = formulaGet.apiGet({
  175. FacilityTypeId: f.FacilityTypeId,
  176. FacilityCode: f.FacilityCode,
  177. FormulaId: formulaId,
  178. TimeIntervalType: timeIntervalType,
  179. StartDate: date.startDate,
  180. EndDate: date.endDate
  181. });
  182. promises.push(p);
  183. });
  184. // 외기 온도와 습도를 위해 추가 hcLee 2015 04 20 ->
  185. var commonParameters = {
  186. //TimeIntervalType: $Code.TimeIntervalType.QUARTERMIN,
  187. TimeIntervalType: timeIntervalType,
  188. StartDate: date.startDate,
  189. EndDate: date.endDate
  190. };
  191. var temperatureParameters = {
  192. FacilityTypeId: FT.OUTDOOR,
  193. FacilityCode: FC.OUTDOOR,
  194. FormulaId: F[FT.OUTDOOR].TEMPERATURE,
  195. };
  196. /*var humidityParameters = _.extend({}, temperatureParameters, {
  197. FormulaId: F[FT.OUTDOOR].HUMIDITY,
  198. });*/
  199. promises.push(formulaGet.apiGet(_.extend(temperatureParameters, commonParameters)));
  200. //promises.push(formulaGet.apiGet(_.extend(humidityParameters, commonParameters)));
  201. // 외기 온도와 습도를 위해 추가 hcLee 2015 04 20 <-
  202. //promises.push(utils.toast.show('공조기 성능분석 중 입니다. 잠시만 기다려 주세요'));
  203. $.when.apply(this, promises)
  204. .done(function (coldWaterCalories, hotWaterCalories, coldWaterAtfws,
  205. hotWaterAtfws, in_temperatures, out_temperatures, cold_electricities, hot_electricities,
  206. cold_vopen, hot_vopen,
  207. cold_in_temperatures, cold_out_temperatures, // 이 2개는 2015 06 15일 추가
  208. f_temp, f_humi, // 2015 07 10 추가
  209. co2, // 2015 07 10 추가
  210. x16, x17, x18, x19, x20,
  211. A21, A22, A23, A24, A25, A26,
  212. OUTtemperatures) {
  213. coldWaterCalories = coldWaterCalories[0];
  214. hotWaterCalories = hotWaterCalories[0];
  215. coldWaterAtfws = coldWaterAtfws[0];
  216. hotWaterAtfws = hotWaterAtfws[0];
  217. in_temperatures = in_temperatures[0];
  218. out_temperatures = out_temperatures[0];
  219. cold_electricities = cold_electricities[0];
  220. hot_electricities = hot_electricities[0];
  221. cold_vopen = cold_vopen[0];
  222. hot_vopen = hot_vopen[0];
  223. cold_in_temperatures = cold_in_temperatures[0];
  224. cold_out_temperatures = cold_out_temperatures[0];
  225. A21 = A21[0];
  226. A22 = A22[0];
  227. A23 = A23[0];// 급기휀 소비전력
  228. A24 = A24[0];// 환기휀 소비전력
  229. A25 = A25[0];// 급기휀 주파수
  230. A26 = A26[0];// 환기휀 주파수
  231. OUTtemperatures = OUTtemperatures[0];
  232. BWA.Chart.mapWithConvertingDateTime(coldWaterCalories, timeBoxForSearch.type());
  233. BWA.Chart.mapWithConvertingDateTime(hotWaterCalories, timeBoxForSearch.type());
  234. //BWA.Chart.mapWithConvertingDateTime(coldWaterAtfws);
  235. //BWA.Chart.mapWithConvertingDateTime(hotWaterAtfws);
  236. BWA.Chart.mapWithConvertingDateTime(OUTtemperatures, timeBoxForSearch.type());
  237. /*
  238. var coldWaterCalorieDataArray = _.map(coldWaterCalories, function (x) {
  239. return {
  240. DateTime: x.DateTime,
  241. //DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeBoxForSearch.type(), x.DateTime),
  242. CV: x.Value
  243. };
  244. })
  245. _.each(cold_in_temperatures, function (x) {
  246. coldWaterCalorieDataArray.push({
  247. //DateTime: moment(x.DateTime).toDate(),
  248. DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeBoxForSearch.type(), moment(x.DateTime).toDate()),
  249. cold_in_temp: x.Value
  250. });
  251. });
  252. _.each(cold_out_temperatures, function (x) {
  253. coldWaterCalorieDataArray.push({
  254. //DateTime: moment(x.DateTime).toDate(),
  255. DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeBoxForSearch.type(), moment(x.DateTime).toDate()),
  256. cold_out_temp: x.Value
  257. });
  258. });
  259. var options = BWA.ChartOptions.WaterCoolingAnalysis.getChartCalorieCOptions(timeBoxForSearch.type());
  260. options.dataSource = coldWaterCalorieDataArray;
  261. chartCalorieC().option(options); */
  262. var DataArray = _.map(A21, function (x) {
  263. return {
  264. DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeBoxForSearch.type(), moment(x.DateTime).toDate()),
  265. kcal: x.Value
  266. };
  267. })
  268. _.each(coldWaterAtfws, function (x) {
  269. DataArray.push({
  270. DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeBoxForSearch.type(), moment(x.DateTime).toDate()),
  271. afw : x.Value
  272. });
  273. });
  274. var options = BWA.ChartOptions.WaterCoolingAnalysis.getChart_1_Options(timeBoxForSearch.type());
  275. options.dataSource = DataArray;
  276. chartCalorieC().option(options);
  277. // chart 2
  278. /* var hotWaterCalorieDataArray = _.map(hotWaterCalories, function (x) {
  279. return {
  280. DateTime: x.DateTime,
  281. //DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeBoxForSearch.type(), x.DateTime),
  282. HV: x.Value
  283. };
  284. })
  285. //var calories = coldWaterCalorieDataArray.concat(hotWaterCalorieDataArray);
  286. _.each(in_temperatures, function (x) {
  287. hotWaterCalorieDataArray.push({
  288. //DateTime: moment(x.DateTime).toDate(),
  289. DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeBoxForSearch.type(), moment(x.DateTime).toDate()),
  290. in_temp: x.Value
  291. });
  292. });
  293. _.each(out_temperatures, function (x) {
  294. hotWaterCalorieDataArray.push({
  295. //DateTime: moment(x.DateTime).toDate(),
  296. DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeBoxForSearch.type(), moment(x.DateTime).toDate()),
  297. out_temp: x.Value
  298. });
  299. });
  300. //var chartOption = BWA.ChartOptions.WaterCoolingAnalysis;
  301. //chartOption.getChartCalorieOptions(timeBoxForSearch.type());
  302. //chartCalorie().option.getChartCalorieOptions(timeBoxForSearch.type())
  303. var options = BWA.ChartOptions.WaterCoolingAnalysis.getChartCalorieHOptions(timeBoxForSearch.type());
  304. //chartCalorie().option('argumentAxis', null); // 2015 05 21 결국 이 코드가 필요 함 (시간 축 에러 해결)
  305. options.dataSource = hotWaterCalorieDataArray;
  306. chartCalorieH().option(options); */
  307. var DataArray = _.map(A22, function (x) {
  308. return {
  309. DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeBoxForSearch.type(), moment(x.DateTime).toDate()),
  310. kcal: x.Value
  311. };
  312. })
  313. _.each(hotWaterAtfws, function (x) {
  314. DataArray.push({
  315. DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeBoxForSearch.type(), moment(x.DateTime).toDate()),
  316. afw: x.Value
  317. });
  318. });
  319. var options = BWA.ChartOptions.WaterCoolingAnalysis.getChart_2_Options(timeBoxForSearch.type());
  320. options.dataSource = DataArray;
  321. chartCalorieH().option(options);
  322. var atfwDataArray = [];
  323. var maxValueCHV = 0;
  324. _.map(coldWaterAtfws, function (x) {
  325. atfwDataArray.push({
  326. //DateTime: moment(x.DateTime).toDate(),
  327. DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeBoxForSearch.type(), moment(x.DateTime).toDate()),
  328. CV: x.Value
  329. });
  330. if (maxValueCHV < x.Value) maxValueCHV = x.Value;
  331. })
  332. _.map(hotWaterAtfws, function (x) {
  333. atfwDataArray.push({
  334. //DateTime: moment(x.DateTime).toDate(),
  335. DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeBoxForSearch.type(), moment(x.DateTime).toDate()),
  336. HV: x.Value
  337. });
  338. if (maxValueCHV < x.Value) maxValueCHV = x.Value;
  339. })
  340. options = BWA.ChartOptions.WaterCoolingAnalysis.getChartAtfwOptions(timeBoxForSearch.type());
  341. //chartAtfw().option('argumentAxis', null); // 2015 05 21 결국 이 코드가 필요 함 (시간 축 에러 해결)
  342. //maxValueCHV = 30;
  343. options.valueAxis[0].tickInterval = Math.round(Math.round(maxValueCHV) / 5) + 1;
  344. options.dataSource = atfwDataArray.concat(OUTtemperatures);
  345. chartAtfw().option(options); // 냉난방ATF와 외기온도관계
  346. //chart 4
  347. var DataArray = _.map(A23, function (x) {
  348. return {
  349. DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeBoxForSearch.type(), moment(x.DateTime).toDate()),
  350. inkw: x.Value
  351. };
  352. })
  353. _.each(A24, function (x) {
  354. DataArray.push({
  355. DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeBoxForSearch.type(), moment(x.DateTime).toDate()),
  356. outkw : x.Value
  357. });
  358. });
  359. _.each(A25, function (x) {
  360. DataArray.push({
  361. DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeBoxForSearch.type(), moment(x.DateTime).toDate()),
  362. inhz: x.Value
  363. });
  364. });
  365. _.each(A26, function (x) {
  366. DataArray.push({
  367. DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeBoxForSearch.type(), moment(x.DateTime).toDate()),
  368. outhz: x.Value
  369. });
  370. });
  371. var options = BWA.ChartOptions.WaterCoolingAnalysis.getChart_3_Options(timeBoxForSearch.type());
  372. options.dataSource = DataArray;
  373. chartVOpen().option(options);
  374. //chart3
  375. //chartTemperatureCalorie().option('dataSource', calories.concat(OUTtemperatures));
  376. //BWA.Chart.mapWithConvertingDateTime(cold_vopen);
  377. //BWA.Chart.mapWithConvertingDateTime(hot_vopen);
  378. /*
  379. var vopenDataArray = [];
  380. maxValueCHV = 0;
  381. _.map(cold_vopen, function (x) {
  382. vopenDataArray.push({
  383. //DateTime: moment(x.DateTime).toDate(),
  384. DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeBoxForSearch.type(), moment(x.DateTime).toDate()),
  385. CV: x.Value
  386. });
  387. if (maxValueCHV < x.Value) maxValueCHV = x.Value;
  388. })
  389. _.map(hot_vopen, function (x) {
  390. vopenDataArray.push({
  391. //DateTime: moment(x.DateTime).toDate(),
  392. DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeBoxForSearch.type(), moment(x.DateTime).toDate()),
  393. HV: x.Value
  394. });
  395. if (maxValueCHV < x.Value) maxValueCHV = x.Value;
  396. })
  397. options = BWA.ChartOptions.WaterCoolingAnalysis.getChartVOpenOptions(timeBoxForSearch.type());
  398. options.valueAxis[0].tickInterval = Math.round(maxValueCHV / 5) + 1;
  399. //chartVOpen().option('argumentAxis', null); // 2015 05 21 결국 이 코드가 필요 함 (시간 축 에러 해결)
  400. options.dataSource = vopenDataArray.concat(OUTtemperatures);
  401. chartVOpen().option(options); // 냉난방ATF와 외기온도관계
  402. */
  403. //chart 5
  404. maxValueCHV = 0;
  405. var electricityDataArray = _.map(cold_electricities, function (x) {
  406. if (maxValueCHV < x.Value) maxValueCHV = x.Value;
  407. return {
  408. //DateTime: moment(x.DateTime).toDate(),
  409. DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeBoxForSearch.type(), moment(x.DateTime).toDate()),
  410. CV: x.Value
  411. };
  412. });
  413. var hotelectricityDataArray = _.map(hot_electricities, function (x) {
  414. if (maxValueCHV < x.Value) maxValueCHV = x.Value;
  415. return {
  416. //DateTime: moment(x.DateTime).toDate(),
  417. DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeBoxForSearch.type(), moment(x.DateTime).toDate()),
  418. HV: x.Value
  419. };
  420. });
  421. options = BWA.ChartOptions.WaterCoolingAnalysis.getTemperatureElectricityOptions(timeBoxForSearch.type());
  422. //chartTemperatureElectricity().option('argumentAxis', null); // 2015 05 21 결국 이 코드가 필요 함 (시간 축 에러 해결)
  423. options.valueAxis[0].tickInterval = Math.round(maxValueCHV / 5) + 1;
  424. electricityDataArray = electricityDataArray.concat(hotelectricityDataArray);
  425. options.dataSource = electricityDataArray.concat(OUTtemperatures);
  426. chartTemperatureElectricity().option(options);
  427. visiblePopup(false);
  428. /* msgbox.
  429. $("#large-indicator").dxLoadIndicator({
  430. height: 60,
  431. width: 60
  432. });*/
  433. //chartTemperatureCalorie().option('dataSource', calories.concat(OUTtemperatures));
  434. //chartTemperatureElectricity2().option('dataSource', electricityDataArray.concat(OUTtemperatures));
  435. })
  436. .fail(function (error) {
  437. //alert(error);
  438. visiblePopup(false);
  439. });
  440. }
  441. var viewModel = $.extend(BWA.CommonView.create(
  442. params, viewInfo, searchViewOptions, ko.observable(null),
  443. handleViewShown, null, handleSearchInSearchView, undefined,
  444. chartLayout), {
  445. // facility: facilityViewModel,
  446. viewHidden: handleViewHidden, // hcLee 2015 06 03
  447. refreshList: refreshList,
  448. viewShowing: handleViewShowing,
  449. scrolling: { mode: 'infinite' },
  450. airHandlingDataGridOptions: {
  451. dataSource: facilitiesForSearch,
  452. columns: [
  453. { dataField: 'Name', caption: $G('facilityName'), width: '100%', alignment: 'left' }
  454. ],
  455. filterRow: {
  456. visible: true,
  457. showOperationChooser: false
  458. },
  459. selection: {
  460. mode: 'single'
  461. },
  462. rowClick: function(clickRow) {
  463. handleSelectedFacilityInSearchView(clickRow.data);
  464. }
  465. },
  466. contentReadyAction: function(e) {
  467. datagrid = e.component;
  468. }
  469. });
  470. viewModel.timeBoxForSearch = timeBoxForSearch;
  471. viewModel.currentTabIndex = currentTabIndex;
  472. viewModel.multiViewItems = [{
  473. facility: facilityViewModel,
  474. template: 'mainCharts'
  475. }, {
  476. template: 'subCharts'
  477. }
  478. ];
  479. $HourGlassPopup(viewModel, visiblePopup);
  480. return viewModel;
  481. };