79dd888e0984f1ce12ddb3fc412a8fc563964122.svn-base 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102
  1. BemsWebApplication.PowerSavingCycle = function (params, viewInfo) {
  2. "use strict";
  3. //전역 변수 선언
  4. var endpointSelector = "";
  5. var currentTabIndex = ko.observable(0);
  6. if (BemsWebApplication.config.mode == "production") {
  7. endpointSelector = new DevExpress.EndpointSelector(BemsWebApplication.config.endpoints).config.db.production;
  8. } else {
  9. endpointSelector = new DevExpress.EndpointSelector(BemsWebApplication.config.endpoints).config.db.local;
  10. }
  11. var initialized = false, inoutdoorinitialized = false, Etcinitialized = false;
  12. var SiteId = BWA.UserInfo.SiteId();
  13. var today = new Date();
  14. var searchday = new Date();
  15. var eq = BWA.DataUtil.constructEqualFilter;
  16. var AIR_HANDLING = $Code.FacilityType.AIR_HANDLING;
  17. var timeIntervalType = $Code.TimeIntervalType.QUARTERMIN;
  18. var OUTDOOR = $Code.FacilityType.OUTDOOR;
  19. var temp_facility_DataSource = [{
  20. Name: "",
  21. Nickname: "",
  22. FacilityUsage: "",
  23. FacilityCode: 0
  24. }];
  25. var facilityname = "", facilitynickname = "", facilityusage = "", facilitycode = 0;
  26. var ENTHALPY_CHECK = $Code.Formula[AIR_HANDLING].ENTHALPY_CHECK;
  27. var CO2 = $Code.Formula[AIR_HANDLING].CO2;
  28. var CO = $Code.Formula[AIR_HANDLING].CO;
  29. var DUST = $Code.Formula[AIR_HANDLING].DUST;
  30. var OZONE = $Code.Formula[AIR_HANDLING].OZONE;
  31. var S_VOLUME = $Code.Formula[AIR_HANDLING].S_VOLUME;
  32. var F_TEMP = $Code.Formula[AIR_HANDLING].F_TEMP; //환기
  33. var F_HUMY = $Code.Formula[AIR_HANDLING].F_HUMY;
  34. var formulaGet = new BWA.Chart.FormulaGet(SiteId);
  35. var DUTYCYCLE_ONOFF = $Code.Formula[AIR_HANDLING].DUTYCYCLE_ONOFF;
  36. var ONOFF = $Code.Formula[AIR_HANDLING].ONOFF; //onoff
  37. var OUT_TEMPERATURE = $Code.Formula[OUTDOOR].TEMPERATURE;
  38. var OUT_HUMIDITY = $Code.Formula[OUTDOOR].HUMIDITY;
  39. var chartTempOnOFF = BWA.Chart.Instance('chartTempOnOFF', 'dxChart');
  40. var chartFanLoad = BWA.Chart.Instance('chartFanLoad', 'dxChart');
  41. var chartInOut = BWA.Chart.Instance('chartInOutdoor', 'dxChart');
  42. var chartEtc = BWA.Chart.Instance('chartEtc', 'dxChart');
  43. var chartLayout = new BWA.ChartLayout({
  44. divs: [
  45. {
  46. id: 'TempOnOFF',
  47. chartId: 'chartTempOnOFF'
  48. },
  49. {
  50. id: 'InOutDoor',
  51. chartId: 'chartInOutdoor'
  52. },
  53. ,
  54. {
  55. id: 'FanLoad',
  56. chartId: 'chartFanLoad'
  57. }
  58. ],
  59. multiViewOptions: {
  60. viewIndex: currentTabIndex,
  61. viewCount: 1
  62. }
  63. });
  64. var IndoordataArray = [], IndoortemponoffdataArray = [], IndoorhumydataArray = [], IndooronoffdataArray = [], IndoorstempdataArray = [], IndoortempdataArray = [], finalIndoortemponoffdataArray = [], Indoortemp = false, Indoorhumy = false;
  65. var CodataArray = [], Co2dataArray = [], DustdataArray = [], OzonedataArray = [], EtcdataArray = [];
  66. var Codata = false, Co2data = false, Dustdata = false, Ozonedata = false;
  67. var outdoordataArray = [], outdoorhumydataArray = [], outdoortempdataArray = [], outdoortemp = false, outdoorhumy = false;
  68. var outdoorenthalpy = false, Indoorenthalpy = false;
  69. var QUARTERMIN = $Code.TimeType.QUARTERMIN;
  70. var visiblePopup = ko.observable(false);
  71. var InOutdoorDataGridPopup_Visible = ko.observable(false), EtcDataGridPopup_Visible = ko.observable(false);
  72. function facilitydataSourceAdd(cnt) { // 설비 개수만큼 추가
  73. for (var i = 0; i < cnt ; i++) {
  74. temp_facility_DataSource.push({
  75. Name: "",
  76. Nickname: "",
  77. FacilityUsage: "",
  78. FacilityCode: 0
  79. });
  80. }
  81. }
  82. function GetDataSource(FacilityCode, FormulaId) { // 설비 개수만큼 추가
  83. var BemsTempFormulaDataSource = new DevExpress.data.DataSource({ // 실내온도 가져오기
  84. store: {
  85. type: "odata",
  86. url: endpointSelector + "/BemsFormulaParameter"
  87. },
  88. requireTotalCount: true,
  89. pageSize: 5
  90. });
  91. BemsTempFormulaDataSource.filter([
  92. eq('SiteId', SiteId),
  93. 'and',
  94. eq('FacilityCode', FacilityCode),
  95. 'and',
  96. eq('FormulaId', FormulaId)
  97. ]);
  98. BemsTempFormulaDataSource.load()
  99. .done(function (BemsFormula) {
  100. if (BemsFormula.length != 0) {
  101. if (BemsFormula.length == 1) {
  102. var ParameterFacilityCode = BemsFormula[0].ParameterFacilityCode;
  103. var parameterpropertyId = BemsFormula[0].ParameterPropertyId;
  104. var BemsTempDataSource = new DevExpress.data.DataSource({
  105. store: {
  106. type: "odata",
  107. url: endpointSelector + "/BemsMonitoringPointHistory15min"
  108. },
  109. requireTotalCount: true,
  110. pageSize: 1440
  111. });
  112. BemsTempDataSource.filter([
  113. ['CreatedDateTime', ">=", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate(), 0, 0, 0)],
  114. 'and',
  115. ['CreatedDateTime', "<", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate() + 1, 0, 0, 0)],
  116. 'and',
  117. ['SiteId', "=", SiteId],
  118. 'and',
  119. ['FacilityCode', "=", ParameterFacilityCode],
  120. 'and',
  121. ['PropertyId', "=", parameterpropertyId]
  122. ]);
  123. BemsTempDataSource.sort({ getter: "CreatedDateTime", desc: true });
  124. BemsTempDataSource.load()
  125. .done(function (BemsTemp) {
  126. if (BemsTemp.length != 0) {
  127. var Temp = BemsTemp[0].CurrentValue;
  128. if (FormulaId == CO2) {
  129. Co2dataArray = [];
  130. var state;
  131. if (Temp <= 1000) {
  132. state = "(적정)";
  133. }
  134. else {
  135. state = "(부적정)";
  136. }
  137. $("#co2").dxTextBox("instance").option('value', Temp.toFixed(2) + "ppm" + state);
  138. for (var i = 0; i < BemsTemp.length; i++) {
  139. Co2dataArray.push({
  140. DateTime: BemsTemp[i].CreatedDateTime,
  141. Co2: BemsTemp[i].CurrentValue
  142. });
  143. }
  144. Co2data = true;
  145. }
  146. else if (FormulaId == CO) {
  147. CodataArray = [];
  148. var state;
  149. if (Temp <= 2) {
  150. state = "(좋음)";
  151. }
  152. else if ((2 < Temp) && (Temp <= 9)) {
  153. state = "(보통)";
  154. }
  155. else if ((9 < Temp) && (Temp <= 15)) {
  156. state = "(나쁨)";
  157. }
  158. else {
  159. state = "(매우나쁨)";
  160. }
  161. $("#co").dxTextBox("instance").option('value', Temp.toFixed(2) + "ppm" + state);
  162. for (var i = 0; i < BemsTemp.length; i++) {
  163. CodataArray.push({
  164. DateTime: BemsTemp[i].CreatedDateTime,
  165. Co: BemsTemp[i].CurrentValue
  166. });
  167. }
  168. Codata = true;
  169. }
  170. else if (FormulaId == DUST) {
  171. DustdataArray = [];
  172. var state;
  173. if (Temp <= 30) {
  174. state = "(좋음)";
  175. }
  176. else if ((30 < Temp) && (Temp <= 80)) {
  177. state = "(보통)";
  178. }
  179. else if ((80 < Temp) && (Temp <= 150)) {
  180. state = "(나쁨)";
  181. }
  182. else {
  183. state = "(매우나쁨)";
  184. }
  185. $("#dust").dxTextBox("instance").option('value', Temp.toFixed(2) + "㎍/㎥" + state);
  186. for (var i = 0; i < BemsTemp.length; i++) {
  187. DustdataArray.push({
  188. DateTime: BemsTemp[i].CreatedDateTime,
  189. Dust: BemsTemp[i].CurrentValue
  190. });
  191. }
  192. Dustdata = true;
  193. }
  194. else if (FormulaId == OZONE) {
  195. OzonedataArray = [];
  196. var state;
  197. if (Temp <= 0.03) {
  198. state = "(좋음)";
  199. }
  200. else if ((0.03 < Temp) && (Temp <= 0.09)) {
  201. state = "(보통)";
  202. }
  203. else if ((0.09 < Temp) && (Temp <= 0.150)) {
  204. state = "(나쁨)";
  205. }
  206. else {
  207. state = "(매우나쁨)";
  208. }
  209. $("#ozone").dxTextBox("instance").option('value', Temp.toFixed(2) + "ppm" + state);
  210. for (var i = 0; i < BemsTemp.length; i++) {
  211. OzonedataArray.push({
  212. DateTime: BemsTemp[i].CreatedDateTime,
  213. Ozone: BemsTemp[i].CurrentValue
  214. });
  215. }
  216. Ozonedata = true;
  217. }
  218. }
  219. else {
  220. utils.toast.show("[BemsMonitoringPointHistory15min] 정보가 없습니다.");
  221. }
  222. });
  223. }
  224. }
  225. else {
  226. utils.toast.show("[BemsFormulaParameter] 실내외 정보가 없습니다.");
  227. }
  228. });
  229. }
  230. function GetEnthalpyDataSource(FacilityCode, FormulaId, FormulaId2) { // 온도, 습도
  231. var BemsTempFormulaDataSource = new DevExpress.data.DataSource({ // 실내온도 가져오기
  232. store: {
  233. type: "odata",
  234. url: endpointSelector + "/BemsFormulaParameter"
  235. },
  236. requireTotalCount: true,
  237. pageSize: 5
  238. });
  239. BemsTempFormulaDataSource.filter([
  240. eq('SiteId', SiteId),
  241. 'and',
  242. eq('FacilityCode', FacilityCode),
  243. 'and',
  244. eq('FormulaId', FormulaId)
  245. ]);
  246. BemsTempFormulaDataSource.load()
  247. .done(function (BemsFormula) {
  248. if (BemsFormula.length != 0) {
  249. if (BemsFormula.length == 1) {
  250. var ParameterFacilityCode = BemsFormula[0].ParameterFacilityCode;
  251. var parameterpropertyId = BemsFormula[0].ParameterPropertyId;
  252. var BemsTempDataSource = new DevExpress.data.DataSource({
  253. store: {
  254. type: "odata",
  255. url: endpointSelector + "/BemsMonitoringPointHistory15min"
  256. },
  257. requireTotalCount: true,
  258. pageSize: 1440
  259. });
  260. BemsTempDataSource.filter([
  261. ['CreatedDateTime', ">=", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate(), 0, 0, 0)],
  262. 'and',
  263. ['CreatedDateTime', "<", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate() + 1, 0, 0, 0)],
  264. 'and',
  265. ['SiteId', "=", SiteId],
  266. 'and',
  267. ['FacilityCode', "=", ParameterFacilityCode],
  268. 'and',
  269. ['PropertyId', "=", parameterpropertyId]
  270. ]);
  271. BemsTempDataSource.sort({ getter: "CreatedDateTime", desc: true });
  272. BemsTempDataSource.load()
  273. .done(function (BemsTemp) {
  274. if (BemsTemp.length != 0) {
  275. var Temp = BemsTemp[0].CurrentValue;
  276. if (FormulaId == F_TEMP) { // 환기 온도
  277. IndoortempdataArray = [], IndoorhumydataArray = [], IndoortemponoffdataArray = [], IndoordataArray = [], IndoorstempdataArray = [], IndooronoffdataArray = [], finalIndoortemponoffdataArray = [];
  278. $("#indoor_temp").dxTextBox("instance").option('value', Temp.toFixed(2) + "℃");
  279. for (var i = 0; i < BemsTemp.length; i++) {
  280. IndoortempdataArray.push({
  281. DateTime: BemsTemp[i].CreatedDateTime,
  282. IndoorTemp: BemsTemp[i].CurrentValue
  283. });
  284. }
  285. var BemsTempFormulaDataSource = new DevExpress.data.DataSource({ // 실내온도 가져오기
  286. store: {
  287. type: "odata",
  288. url: endpointSelector + "/BemsFormulaParameter"
  289. },
  290. requireTotalCount: true,
  291. pageSize: 5
  292. });
  293. BemsTempFormulaDataSource.filter([
  294. eq('SiteId', SiteId),
  295. 'and',
  296. eq('FacilityCode', FacilityCode),
  297. 'and',
  298. eq('FormulaId', FormulaId2)
  299. ]);
  300. BemsTempFormulaDataSource.load()
  301. .done(function (BemsFormula) {
  302. if (BemsFormula.length != 0) {
  303. if (BemsFormula.length == 1) {
  304. var ParameterFacilityCode = BemsFormula[0].ParameterFacilityCode;
  305. var parameterpropertyId = BemsFormula[0].ParameterPropertyId;
  306. var BemsTempDataSource = new DevExpress.data.DataSource({
  307. store: {
  308. type: "odata",
  309. url: endpointSelector + "/BemsMonitoringPointHistory15min"
  310. },
  311. requireTotalCount: true,
  312. pageSize: 1440
  313. });
  314. BemsTempDataSource.filter([
  315. ['CreatedDateTime', ">=", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate(), 0, 0, 0)],
  316. 'and',
  317. ['CreatedDateTime', "<", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate() + 1, 0, 0, 0)],
  318. 'and',
  319. ['SiteId', "=", SiteId],
  320. 'and',
  321. ['FacilityCode', "=", ParameterFacilityCode],
  322. 'and',
  323. ['PropertyId', "=", parameterpropertyId]
  324. ]);
  325. BemsTempDataSource.sort({ getter: "CreatedDateTime", desc: true });
  326. BemsTempDataSource.load()
  327. .done(function (BemsTemp) {
  328. if (BemsTemp.length != 0) {
  329. if (FormulaId2 == F_HUMY) {
  330. var Temp = BemsTemp[0].CurrentValue;
  331. $("#indoor_humy").dxTextBox("instance").option('value', Temp.toFixed(2) + "%"); //환기 습도
  332. for (var i = 0; i < BemsTemp.length; i++) {
  333. IndoorhumydataArray.push({
  334. DateTime: BemsTemp[i].CreatedDateTime,
  335. IndoorHumy: BemsTemp[i].CurrentValue
  336. });
  337. }
  338. var array_length_size = Math.max(IndoortempdataArray.length, IndoorhumydataArray.length);
  339. if (IndoortempdataArray.length == IndoorhumydataArray.length) {
  340. for (var i = 0; i < array_length_size; i++) {
  341. IndoordataArray.push(
  342. {
  343. DateTime: IndoortempdataArray[i].DateTime,
  344. IndoorTemp: IndoortempdataArray[i].IndoorTemp,
  345. IndoorHumy: IndoorhumydataArray[i].IndoorHumy
  346. });
  347. }
  348. }
  349. }
  350. else if (FormulaId2 == ONOFF) {
  351. for (var i = 0; i < BemsTemp.length; i++) {
  352. var temp;
  353. if (BemsTemp[i].CurrentValue == true) {
  354. temp = 1;
  355. }
  356. else {
  357. temp = 0;
  358. }
  359. IndooronoffdataArray.push({
  360. DateTime: BemsTemp[i].CreatedDateTime,
  361. Indooronoff: temp
  362. });
  363. }
  364. var array_length_size = Math.max(IndoortempdataArray.length, IndooronoffdataArray.length);
  365. if (IndoortempdataArray.length == IndooronoffdataArray.length) {
  366. for (var i = 0; i < array_length_size; i++) {
  367. IndoortemponoffdataArray.push(
  368. {
  369. DateTime: IndoortempdataArray[i].DateTime,
  370. IndoorTemp: IndoortempdataArray[i].IndoorTemp,
  371. Indooronoff: IndooronoffdataArray[i].Indooronoff
  372. });
  373. }
  374. var BemsSTempDataSource = new DevExpress.data.DataSource({
  375. store: {
  376. type: "odata",
  377. url: endpointSelector + "/BemsControlAHUTempConfig"
  378. },
  379. requireTotalCount: true,
  380. pageSize: 1
  381. });
  382. BemsSTempDataSource.filter([
  383. ['SiteId', "=", SiteId],
  384. 'and',
  385. ['FacilityCode', "=", ParameterFacilityCode]
  386. ]);
  387. BemsSTempDataSource.load()
  388. .done(function (STemp) {
  389. var Maxtemp, Mintemp;
  390. if (STemp.length == 0) {
  391. //utils.toast.show("공조기 기준온도가 없습니다.");
  392. finalIndoortemponoffdataArray = IndoortemponoffdataArray;
  393. }
  394. else {
  395. Maxtemp = STemp[0].MaxTemperature;
  396. Mintemp = STemp[0].MinTemperature;
  397. for (var i = 0; i < IndoortemponoffdataArray.length; i++) {
  398. finalIndoortemponoffdataArray.push(
  399. {
  400. DateTime: IndoortempdataArray[i].DateTime,
  401. IndoorTemp: IndoortempdataArray[i].IndoorTemp,
  402. Indooronoff: IndooronoffdataArray[i].Indooronoff,
  403. Maxtemp: Maxtemp,
  404. Mintemp: Mintemp
  405. });
  406. }
  407. }
  408. var options = BWA.ChartOptions.PowerSavingCycle.getChartTempOnOFFOptions(QUARTERMIN);
  409. options.dataSource = finalIndoortemponoffdataArray;
  410. chartTempOnOFF().option(options);
  411. });
  412. }
  413. }
  414. }
  415. });
  416. }
  417. }
  418. });
  419. }
  420. }
  421. else {
  422. utils.toast.show("[BemsMonitoringPointHistory15min] 정보가 없습니다.");
  423. }
  424. });
  425. }
  426. }
  427. else {
  428. utils.toast.show("[BemsFormulaParameter] 실내외 정보가 없습니다.");
  429. }
  430. });
  431. }
  432. function GetLoadDataSource() { //팬부하 가져오기 함수
  433. var facilitycode = $("#Airconfitioner_select").dxSelectBox("instance").option('value').FacilityCode();
  434. var formula = $Code.Formula[$Code.FacilityType.AIR_HANDLING];
  435. var formulaIds = _.values(formula);
  436. var promises = [];
  437. _.each(formulaIds, function (formulaId) {
  438. var p = formulaGet.apiGet({
  439. SiteId: SiteId,
  440. FacilityTypeId: AIR_HANDLING,
  441. FacilityCode: facilitycode,
  442. FormulaId: formulaId,
  443. TimeIntervalType: timeIntervalType,
  444. StartDate: new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate(), 0, 0, 0),
  445. EndDate: new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate() + 1, 0, 0, 0)
  446. });
  447. promises.push(p);
  448. });
  449. $.when.apply(this, promises)
  450. .done(function (A23, A24, DUTYCYCLE_CHECK) {
  451. A23 = A23[0];//급기팬 소비전력
  452. A24 = A24[0];//환기팬 소비전력
  453. DUTYCYCLE_CHECK = DUTYCYCLE_CHECK[0];//절전사이클 확인
  454. var dataArray_Temp = [];
  455. var dataArray_Temp1 = [];
  456. var dataArray_Temp2 = [];
  457. var dataArray_Temp3 = [];
  458. var dataArray_Temp4 = [];
  459. var dataArray_Temp5 = [];
  460. _.each(A23, function (x) {
  461. dataArray_Temp.push({
  462. DateTime: BWA.Chart.getCustermTimeArgumentAxisString(QUARTERMIN, moment(x.DateTime).toDate()),
  463. A23: x.Value
  464. });
  465. });
  466. _.each(A24, function (x) {
  467. dataArray_Temp1.push({
  468. DateTime: BWA.Chart.getCustermTimeArgumentAxisString(QUARTERMIN, moment(x.DateTime).toDate()),
  469. A24: x.Value
  470. });
  471. });
  472. _.each(DUTYCYCLE_CHECK, function (x) {
  473. var temp;
  474. if (x.Value > 0) {
  475. temp = 1;
  476. }
  477. else {
  478. temp = 0
  479. }
  480. dataArray_Temp2.push({
  481. DateTime: BWA.Chart.getCustermTimeArgumentAxisString(QUARTERMIN, moment(x.DateTime).toDate()),
  482. DUTYCYCLE_CHECK: temp
  483. });
  484. });
  485. var array_length_size = Math.max(dataArray_Temp.length, dataArray_Temp1.length, dataArray_Temp2.length);
  486. if (dataArray_Temp.length == dataArray_Temp1.length && dataArray_Temp1.length == dataArray_Temp2.length) {
  487. var tempFANLoad = 0, tempSave = 0, count = 0, tempfanload = 0, save = 0;
  488. for (var i = 0; i < array_length_size; i++) {
  489. dataArray_Temp3.push(
  490. {
  491. DateTime: dataArray_Temp[i].DateTime,
  492. FANLoad: dataArray_Temp[i].A23 + dataArray_Temp1[i].A24,
  493. DUTYCYCLE_CHECK: dataArray_Temp2[i].DUTYCYCLE_CHECK
  494. });
  495. }
  496. for (var i = 0; i < array_length_size; i++) {
  497. if (dataArray_Temp3[i].DUTYCYCLE_CHECK == 1) {
  498. if (count == 0) {
  499. tempFANLoad = 0;
  500. tempSave = dataArray_Temp4[i - 1].FANLoad;
  501. }
  502. else {
  503. tempFANLoad = 0;
  504. tempSave = dataArray_Temp4[i - 1].Save;
  505. }
  506. count++
  507. }
  508. else {
  509. tempFANLoad = dataArray_Temp3[i].FANLoad;
  510. tempSave = 0;
  511. count = 0;
  512. }
  513. dataArray_Temp4.push(
  514. {
  515. DateTime: dataArray_Temp3[i].DateTime,
  516. FANLoad: tempFANLoad,
  517. Save: tempSave
  518. });
  519. tempfanload += dataArray_Temp4[i].FANLoad;
  520. save += dataArray_Temp4[i].Save
  521. }
  522. $("#predfanload").dxTextBox("instance").option('value', parseFloat((tempfanload + save).toFixed(2)) + "Kwh");
  523. $("#nowfanload").dxTextBox("instance").option('value', parseFloat(tempfanload.toFixed(2)) + "Kwh");
  524. $("#totlareduction").dxTextBox("instance").option('value', parseFloat(save.toFixed(2)) + "Kwh");
  525. }
  526. var dataArrayresult = dataArray_Temp4;
  527. var options = BWA.ChartOptions.PowerSavingCycle.getChartFanLoadOptions(QUARTERMIN);
  528. options.dataSource = dataArrayresult;
  529. chartFanLoad().option(options);
  530. })
  531. .fail(function (error) {
  532. });
  533. }
  534. function GetOutDataSource() { // 온도, 습도
  535. var BemsTempFormulaDataSource = new DevExpress.data.DataSource({ // 실내온도 가져오기
  536. store: {
  537. type: "odata",
  538. url: endpointSelector + "/BemsFormulaParameter"
  539. },
  540. requireTotalCount: true,
  541. pageSize: 5
  542. });
  543. BemsTempFormulaDataSource.filter([
  544. eq('SiteId', SiteId),
  545. 'and',
  546. eq('FacilityTypeId', OUTDOOR),
  547. 'and',
  548. eq('FormulaId', OUT_TEMPERATURE)
  549. ]);
  550. BemsTempFormulaDataSource.load()
  551. .done(function (BemsFormula) {
  552. if (BemsFormula.length != 0) {
  553. if (BemsFormula.length == 1) {
  554. var parameterpropertyId = BemsFormula[0].ParameterPropertyId;
  555. var FacilityCode = BemsFormula[0].ParameterFacilityCode;
  556. var BemsTempDataSource = new DevExpress.data.DataSource({
  557. store: {
  558. type: "odata",
  559. url: endpointSelector + "/BemsMonitoringPointHistory15min"
  560. },
  561. requireTotalCount: true,
  562. pageSize: 1440
  563. });
  564. BemsTempDataSource.filter([
  565. ['CreatedDateTime', ">=", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate(), 0, 0, 0)],
  566. 'and',
  567. ['CreatedDateTime', "<", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate() + 1, 0, 0, 0)],
  568. 'and',
  569. ['SiteId', "=", SiteId],
  570. 'and',
  571. ['FacilityCode', "=", FacilityCode],
  572. 'and',
  573. ['PropertyId', "=", parameterpropertyId]
  574. ]);
  575. BemsTempDataSource.sort({ getter: "CreatedDateTime", desc: true });
  576. BemsTempDataSource.load()
  577. .done(function (BemsTemp) {
  578. if (BemsTemp.length != 0) {
  579. var Temp = BemsTemp[0].CurrentValue;
  580. outdoortempdataArray = [], outdoorhumydataArray = [], outdoordataArray = [];;
  581. outdoortemp = true;
  582. $("#outdoor_temp").dxTextBox("instance").option('value', Temp.toFixed(2) + "℃");
  583. for (var i = 0; i < BemsTemp.length; i++) {
  584. outdoortempdataArray.push({
  585. DateTime: BemsTemp[i].CreatedDateTime,
  586. outdoorTemp: BemsTemp[i].CurrentValue
  587. });
  588. }
  589. var BemsTempFormulaDataSource = new DevExpress.data.DataSource({ // 실내온도 가져오기
  590. store: {
  591. type: "odata",
  592. url: endpointSelector + "/BemsFormulaParameter"
  593. },
  594. requireTotalCount: true,
  595. pageSize: 5
  596. });
  597. BemsTempFormulaDataSource.filter([
  598. eq('SiteId', SiteId),
  599. 'and',
  600. eq('FacilityTypeId', OUTDOOR),
  601. 'and',
  602. eq('FormulaId', OUT_HUMIDITY)
  603. ]);
  604. BemsTempFormulaDataSource.load()
  605. .done(function (BemsFormula) {
  606. if (BemsFormula.length != 0) {
  607. if (BemsFormula.length == 1) {
  608. var parameterpropertyId = BemsFormula[0].ParameterPropertyId;
  609. var FacilityCode = BemsFormula[0].ParameterFacilityCode;
  610. var BemsTempDataSource = new DevExpress.data.DataSource({
  611. store: {
  612. type: "odata",
  613. url: endpointSelector + "/BemsMonitoringPointHistory15min"
  614. },
  615. requireTotalCount: true,
  616. pageSize: 1440
  617. });
  618. BemsTempDataSource.filter([
  619. ['CreatedDateTime', ">=", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate(), 0, 0, 0)],
  620. 'and',
  621. ['CreatedDateTime', "<", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate() + 1, 0, 0, 0)],
  622. 'and',
  623. ['SiteId', "=", SiteId],
  624. 'and',
  625. ['FacilityCode', "=", FacilityCode],
  626. 'and',
  627. ['PropertyId', "=", parameterpropertyId]
  628. ]);
  629. BemsTempDataSource.sort({ getter: "CreatedDateTime", desc: true });
  630. BemsTempDataSource.load()
  631. .done(function (BemsTemp) {
  632. if (BemsTemp.length != 0) {
  633. var Temp = BemsTemp[0].CurrentValue;
  634. $("#outdoor_humy").dxTextBox("instance").option('value', Temp.toFixed(2) + "%");
  635. for (var i = 0; i < BemsTemp.length; i++) {
  636. outdoorhumydataArray.push({
  637. DateTime: BemsTemp[i].CreatedDateTime,
  638. outdoorHumy: BemsTemp[i].CurrentValue
  639. });
  640. }
  641. var array_length_size = Math.max(outdoortempdataArray.length, outdoorhumydataArray.length);
  642. if (outdoortempdataArray.length == outdoorhumydataArray.length) {
  643. for (var i = 0; i < array_length_size; i++) {
  644. outdoordataArray.push(
  645. {
  646. DateTime: outdoortempdataArray[i].DateTime,
  647. outdoorTemp: outdoortempdataArray[i].outdoorTemp,
  648. outdoorHumy: outdoorhumydataArray[i].outdoorHumy
  649. });
  650. }
  651. }
  652. }
  653. });
  654. }
  655. }
  656. });
  657. }
  658. else {
  659. utils.toast.show("[BemsMonitoringPointHistory15min] 정보가 없습니다.");
  660. }
  661. });
  662. }
  663. }
  664. else {
  665. utils.toast.show("[BemsFormulaParameter] 실내외 정보가 없습니다.");
  666. }
  667. });
  668. }
  669. function handleViewShown() {
  670. if (initialized === false) {
  671. var chartOption = BWA.ChartOptions.PowerSavingCycle;
  672. chartTempOnOFF = chartTempOnOFF(chartOption.getChartTempOnOFFOptions(QUARTERMIN));
  673. chartFanLoad = chartFanLoad(chartOption.getChartFanLoadOptions(QUARTERMIN));
  674. initialized = true;
  675. }
  676. $("#PowerSaving_onoff").dxSwitch({
  677. value: false,
  678. onText: 'On',
  679. offText: 'Off'
  680. });
  681. $("#PowerSaving_control").dxButton({
  682. text: "제어",
  683. onClick: function () {
  684. var PowerSavingonoff = $("#PowerSaving_onoff").dxSwitch("instance").option('value');
  685. if (PowerSavingonoff)
  686. PowerSavingonoff = 1;
  687. else
  688. PowerSavingonoff = 0;
  689. var FacilityTypeId = $("#Airconfitioner_select").dxSelectBox("instance").option('value').FacilityTypeId();
  690. var FacilityCode = $("#Airconfitioner_select").dxSelectBox("instance").option('value').FacilityCode();
  691. var param = {
  692. SiteId: SiteId,
  693. FacilityTypeId: FacilityTypeId,
  694. FacilityCode: FacilityCode,
  695. FormulaId: DUTYCYCLE_ONOFF,
  696. ControlValue: PowerSavingonoff,
  697. };
  698. BWA.api.post('BemsFormula/ControlPoint', null, param).done(function () {
  699. utils.toast.show('절전 사이클 제어 완료');
  700. })
  701. .fail(function (error) {
  702. utils.toast.show('절전 사이클 제어를 실패하였습니다.');
  703. });
  704. }
  705. });
  706. $("#S_Temp_Btn").dxButton({
  707. text: "기준온도 설정",
  708. onClick: function () {
  709. if ($("#Set_Max_Temp").dxTextBox("instance") != null)
  710. $("#Set_Max_Temp").dxTextBox("instance").option('value', null);
  711. if ($("#Set_Min_Temp").dxTextBox("instance") != null)
  712. $("#Set_Min_Temp").dxTextBox("instance").option('value', null);
  713. visiblePopup(true);
  714. }
  715. });
  716. $("#inoutdoor_inform").dxButton({
  717. text: "차트",
  718. onClick: function () {
  719. InOutdoorDataGridPopup_Visible(true);
  720. }
  721. });
  722. $("#etc_inform").dxButton({
  723. text: "차트",
  724. onClick: function () {
  725. EtcDataGridPopup_Visible(true);
  726. }
  727. });
  728. $("#Airconfitioner_date").dxDateBox({
  729. displayFormat: "yyyy-MM-dd",
  730. value: today,
  731. max: today,
  732. onValueChanged: function (e) {
  733. if (e.value != null) {
  734. searchday = e.value;
  735. facilityname = $("#Airconfitioner_select").dxSelectBox("instance").option('value').Name();
  736. facilitynickname = $("#Airconfitioner_select").dxSelectBox("instance").option('value').Nickname();
  737. facilityusage = $("#Airconfitioner_select").dxSelectBox("instance").option('value').FacilityUsage();
  738. facilitycode = $("#Airconfitioner_select").dxSelectBox("instance").option('value').FacilityCode();
  739. $("#facilityname").dxTextBox("instance").option('value', facilityname);
  740. $("#facilitynickname").dxTextBox("instance").option('value', facilitynickname);
  741. $("#facilityusage").dxTextBox("instance").option('value', facilityusage);
  742. GetEnthalpyDataSource(facilitycode, F_TEMP, F_HUMY);
  743. GetEnthalpyDataSource(facilitycode, F_TEMP, ONOFF);
  744. GetOutDataSource();
  745. GetLoadDataSource();
  746. GetDataSource(facilitycode, CO2);
  747. GetDataSource(facilitycode, CO);
  748. GetDataSource(facilitycode, DUST);
  749. GetDataSource(facilitycode, OZONE);
  750. }
  751. }
  752. });
  753. $("#Airconfitioner_select").dxSelectBox({
  754. dataSource: temp_facility_DataSource,
  755. displayExpr: "Nickname",
  756. onValueChanged: function (e) {
  757. if (e.value != null) {
  758. facilityname = e.value.Name();
  759. facilitynickname = e.value.Nickname();
  760. facilityusage = e.value.FacilityUsage();
  761. facilitycode = e.value.FacilityCode();
  762. $("#facilityname").dxTextBox("instance").option('value', facilityname);
  763. $("#facilitynickname").dxTextBox("instance").option('value', facilitynickname);
  764. $("#facilityusage").dxTextBox("instance").option('value', facilityusage);
  765. GetEnthalpyDataSource(facilitycode, F_TEMP, F_HUMY);
  766. GetEnthalpyDataSource(facilitycode, F_TEMP, ONOFF);
  767. GetOutDataSource();
  768. GetLoadDataSource();
  769. GetDataSource(facilitycode, CO2);
  770. GetDataSource(facilitycode, CO);
  771. GetDataSource(facilitycode, DUST);
  772. GetDataSource(facilitycode, OZONE);
  773. }
  774. }
  775. });
  776. $("#co").dxTextBox({
  777. readOnly: true
  778. });
  779. $("#co2").dxTextBox({
  780. readOnly: true
  781. });
  782. $("#dust").dxTextBox({
  783. readOnly: true
  784. });
  785. $("#ozone").dxTextBox({
  786. readOnly: true
  787. });
  788. $("#predfanload").dxTextBox({
  789. readOnly: true
  790. });
  791. $("#nowfanload").dxTextBox({
  792. readOnly: true
  793. });
  794. $("#totlareduction").dxTextBox({
  795. readOnly: true
  796. });
  797. $("#outdoor_humy").dxTextBox({
  798. readOnly: true
  799. });
  800. $("#outdoor_temp").dxTextBox({
  801. readOnly: true
  802. });
  803. $("#indoor_humy").dxTextBox({
  804. readOnly: true
  805. });
  806. $("#indoor_temp").dxTextBox({
  807. readOnly: true
  808. });
  809. $("#enthalpy_content").dxTextBox({
  810. readOnly: true
  811. });
  812. $("#facilityname").dxTextBox({
  813. readOnly: true,
  814. });
  815. $("#facilitynickname").dxTextBox({
  816. readOnly: true,
  817. });
  818. $("#facilityusage").dxTextBox({
  819. readOnly: true,
  820. });
  821. }
  822. function handleViewHidden() {
  823. var paging = BWA.ChartLayout.Paging;
  824. paging.sideOverlayVisible(false);
  825. }
  826. function handleViewShowing() {
  827. var facilityDataSource = BWA.db.createDataSource('CmFacility');
  828. facilityDataSource.filter([
  829. eq('SiteId', SiteId),
  830. 'and',
  831. eq('FacilityTypeId', AIR_HANDLING)
  832. ]);
  833. facilityDataSource.load().done(function (facilities) {
  834. var cnt = 0, k = 0;
  835. if (facilities.length != 0) {
  836. for (var i = 0; i < facilities.length; i++) {
  837. if ((facilities[i].Nickname().substring(0, 3) != "OHU") && (facilities[i].Nickname().substring(0, 3) != "OAU")) {
  838. cnt++;
  839. }
  840. }
  841. var tempfacilities = new Array(cnt);
  842. for (var i = 0; i < facilities.length; i++) {
  843. if ((facilities[i].Nickname().substring(0, 3) != "OHU") && (facilities[i].Nickname().substring(0, 3) != "OAU")) {
  844. tempfacilities[k] = facilities[i];
  845. k++;
  846. }
  847. }
  848. if (tempfacilities.length > 1) {
  849. facilitydataSourceAdd(tempfacilities.length - 1);
  850. }
  851. temp_facility_DataSource = tempfacilities;
  852. $("#Airconfitioner_select").dxSelectBox({
  853. dataSource: temp_facility_DataSource,
  854. displayExpr: "Nickname",
  855. });
  856. $("#Airconfitioner_select").dxSelectBox("instance").option('value', temp_facility_DataSource[0]);
  857. }
  858. else {
  859. utils.toast.show("[CmFacility] 공조기 정보가 없습니다.");
  860. }
  861. });
  862. }
  863. function InoutDoorhandlePopupShown() {
  864. if (inoutdoorinitialized === false) {
  865. var chartOption = BWA.ChartOptions.EnthalpyControl;
  866. chartInOut = chartInOut(chartOption.getChartInOutDoorOptions(QUARTERMIN));
  867. inoutdoorinitialized = true;
  868. }
  869. var Array = [];
  870. var enthalpy_length_size = Math.max(IndoordataArray.length, outdoordataArray.length);
  871. if (IndoordataArray.length == outdoordataArray.length) {
  872. for (var i = 0; i < enthalpy_length_size; i++) {
  873. Array.push(
  874. {
  875. DateTime: IndoordataArray[i].DateTime,
  876. IndoorTemp: IndoortempdataArray[i].IndoorTemp,
  877. IndoorHumy: IndoorhumydataArray[i].IndoorHumy,
  878. outdoorTemp: outdoordataArray[i].outdoorTemp,
  879. outdoorHumy: outdoordataArray[i].outdoorHumy
  880. });
  881. }
  882. var options = BWA.ChartOptions.EnthalpyControl.getChartInOutDoorOptions(QUARTERMIN);
  883. options.dataSource = Array;
  884. chartInOut().option(options);
  885. }
  886. }
  887. function isNumber(s) {
  888. s += ''; // 문자열로 변환
  889. s = s.replace(/^\s*|\s*$/g, ''); // 좌우 공백 제거
  890. if (s == '' || isNaN(s)) return false;
  891. return true;
  892. }
  893. function EtchandlePopupShown() {
  894. if (Etcinitialized === false) {
  895. var chartOption = BWA.ChartOptions.EnthalpyControl;
  896. chartEtc = chartEtc(chartOption.getChartEtcOptions(QUARTERMIN));
  897. Etcinitialized = true;
  898. }
  899. if (Ozonedata && Dustdata && Codata && Co2data) {
  900. EtcdataArray = [];
  901. var array_length_size = Math.max(OzonedataArray.length, DustdataArray.length, CodataArray.length, Co2dataArray.length);
  902. if (OzonedataArray.length == DustdataArray.length && CodataArray.length == Co2dataArray.length && DustdataArray.length == CodataArray.length) {
  903. for (var i = 0; i < array_length_size; i++) {
  904. EtcdataArray.push(
  905. {
  906. DateTime: OzonedataArray[i].DateTime,
  907. Ozone: OzonedataArray[i].Ozone,
  908. Dust: DustdataArray[i].Dust,
  909. Co: CodataArray[i].Co,
  910. Co2: Co2dataArray[i].Co2
  911. });
  912. }
  913. }
  914. Ozonedata = false, Dustdata = false, Codata = false, Co2data = false;
  915. var options = BWA.ChartOptions.EnthalpyControl.getChartEtcOptions(QUARTERMIN);
  916. options.dataSource = EtcdataArray;
  917. chartEtc().option(options);
  918. }
  919. }
  920. function handleSearchInSearchView(filter, searchViewItems) {
  921. }
  922. var searchViewOptions = {
  923. }
  924. var viewModel = $.extend(BWA.CommonView.create(params, viewInfo, searchViewOptions, ko.observable(null), handleViewShown, null, handleSearchInSearchView, undefined, chartLayout), {
  925. viewHidden: handleViewHidden,
  926. viewShowing: handleViewShowing,
  927. onHidden: function () {
  928. },
  929. });
  930. viewModel.InoutDoorDataGridPopupOptions = {
  931. width: '1000px',
  932. height: '550px',
  933. contentTemplate: "content",
  934. showTitle: true,
  935. title: "차트",
  936. visible: InOutdoorDataGridPopup_Visible,
  937. dragEnabled: true,
  938. closeOnOutsideClick: true,
  939. shownAction: InoutDoorhandlePopupShown,
  940. animation: window.utils.popup.createAnimation()
  941. };
  942. viewModel.EtcDataGridPopupOptions = {
  943. width: '1000px',
  944. height: '550px',
  945. contentTemplate: "content",
  946. showTitle: true,
  947. title: "차트",
  948. visible: EtcDataGridPopup_Visible,
  949. dragEnabled: true,
  950. closeOnOutsideClick: true,
  951. shownAction: EtchandlePopupShown,
  952. animation: window.utils.popup.createAnimation()
  953. };
  954. viewModel.popupOptions = {
  955. width: 330,
  956. height: 200,
  957. visible: visiblePopup,
  958. dragEnabled: true,
  959. shading: true,
  960. closeOnOutsideClick: true,
  961. shadingColor: 'transparent',
  962. showTitle: true,
  963. title: "기준온도 설정",
  964. showCloseButton: true,
  965. onShowing: function () {
  966. },
  967. onShown: function (t, tt) {
  968. $("#Save_Btn").dxButton({
  969. text: "저장",
  970. onClick: function () {
  971. var tempfacilitycode = $("#Airconfitioner_select").dxSelectBox("instance").option('value').FacilityCode();
  972. var tempMaxvalue = $("#Set_Max_Temp").dxTextBox("instance").option('value');
  973. var tempMinvalue = $("#Set_Min_Temp").dxTextBox("instance").option('value');
  974. if (!isNumber(tempMaxvalue) || !isNumber(tempMinvalue)) {
  975. utils.toast.show("숫자를 입력해주십시요.");
  976. }
  977. if (!(tempMaxvalue) >= tempMinvalue) {
  978. utils.toast.show("기준온도 최대값 , 최소값이 잘못 입력되었습니다.");
  979. return;
  980. }
  981. else {
  982. tempMaxvalue = parseFloat(parseFloat(tempMaxvalue).toFixed(2));
  983. tempMinvalue = parseFloat(parseFloat(tempMinvalue).toFixed(2));
  984. $("#Set_Max_Temp").dxTextBox("instance").option('value', tempMaxvalue);
  985. $("#Set_Min_Temp").dxTextBox("instance").option('value', tempMinvalue);
  986. var BemsSTempDataSource = new DevExpress.data.DataSource({
  987. store: {
  988. type: "odata",
  989. url: endpointSelector + "/BemsControlAHUTempConfig"
  990. },
  991. requireTotalCount: true,
  992. pageSize: 1
  993. });
  994. BemsSTempDataSource.filter([
  995. ['SiteId', "=", SiteId],
  996. 'and',
  997. ['FacilityCode', "=", tempfacilitycode]
  998. ]);
  999. BemsSTempDataSource.load()
  1000. .done(function (STemp) {
  1001. if (STemp.length == 0) {
  1002. BWA.api.post('BemsControlAHUTempConfig/Insert', {
  1003. SiteId: SiteId,
  1004. FacilityTypeId: AIR_HANDLING,
  1005. FacilityCode: tempfacilitycode,
  1006. MaxTemperature: tempMaxvalue,
  1007. MinTemperature: tempMinvalue
  1008. }).done(function () {
  1009. var facilitycode = $("#Airconfitioner_select").dxSelectBox("instance").option('value').FacilityCode();
  1010. GetEnthalpyDataSource(facilitycode, F_TEMP, F_HUMY);
  1011. GetEnthalpyDataSource(facilitycode, F_TEMP, ONOFF);
  1012. utils.toast.show("공조기 기준온도를 설정하였습니다.");
  1013. visiblePopup(false);
  1014. }).fail(function (error) {
  1015. utils.toast.show("공조기 기준온도 설정를 실패하였습니다.");
  1016. });
  1017. }
  1018. else {
  1019. BWA.api.post('BemsControlAHUTempConfig/Update', {
  1020. SiteId: SiteId,
  1021. FacilityTypeId: AIR_HANDLING,
  1022. FacilityCode: tempfacilitycode,
  1023. MaxTemperature: tempMaxvalue,
  1024. MinTemperature: tempMinvalue
  1025. }).done(function () {
  1026. var facilitycode = $("#Airconfitioner_select").dxSelectBox("instance").option('value').FacilityCode();
  1027. GetEnthalpyDataSource(facilitycode, F_TEMP, F_HUMY);
  1028. GetEnthalpyDataSource(facilitycode, F_TEMP, ONOFF);
  1029. utils.toast.show("공조기 기준온도를 설정하였습니다.");
  1030. visiblePopup(false);
  1031. }).fail(function (error) {
  1032. utils.toast.show("공조기 기준온도 설정를 실패하였습니다.");
  1033. });
  1034. }
  1035. });
  1036. }
  1037. }
  1038. });
  1039. $("#Set_Max_Temp").dxTextBox({
  1040. placeholder: "기준온도 최대값 설정"
  1041. });
  1042. $("#Set_Min_Temp").dxTextBox({
  1043. placeholder: "기준온도 최소값 설정"
  1044. });
  1045. },
  1046. onHidden: function () {
  1047. }
  1048. };
  1049. viewModel.currentTabIndex = currentTabIndex;
  1050. return viewModel;
  1051. };