9a766fe37f46be0e000c531aa076407f1cf15645.svn-base 136 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771
  1. BemsWebApplication.FreeChartAnalysis = function (params, viewInfo) {
  2. var facilityTypeId_fin = 0, facilityCode_fin = 0, parentId_fin = 0, propertyId_fin = 0, facilityName_fin = "", formulaId_fin = 0, controlPoint_fin = "";
  3. var Y_Left_excnt = 0;
  4. var virtualFacility = 99;
  5. var Y_Left_facility_type = ko.observableArray();
  6. var Y_Left_facility_id = ko.observableArray();
  7. var Y_Left_setDataSource1;
  8. var Y_Left_changed = false;
  9. var Y_Left_Caption;
  10. var Y_Left_PointType;
  11. var Y_Left_formulaName;
  12. var Y_Right1_excnt = 0;
  13. var Y_Right1_facility_type = ko.observableArray();
  14. var Y_Right1_facility_id = ko.observableArray();
  15. var Y_Right1_setDataSource1;
  16. var Y_Right1_changed = false;
  17. var Y_Right1_Caption;
  18. var Y_Right1_PointType;
  19. var Y_Right1_formulaName;
  20. var Y_Right2_excnt = 0;
  21. var Y_Right2_facility_type = ko.observableArray();
  22. var Y_Right2_facility_id = ko.observableArray();
  23. var Y_Right2_setDataSource1;
  24. var Y_Right2_changed = false;
  25. var Y_Right2_Caption;
  26. var Y_Right2_PointType;
  27. var Y_Right2_formulaName;
  28. var Y_Left_maxValuecops = 0;
  29. var Y_Left_minValuecops = 0;
  30. var Y_Right1_maxValuecops = 0;
  31. var Y_Right1_minValuecops = 0;
  32. var Y_Right2_maxValuecops = 0;
  33. var Y_Right2_minValuecops = 0;
  34. var DataArrayforChart = ko.observableArray();
  35. var ChartDataArray = [];
  36. var ChartDataArray1 = [];
  37. var ChartDataArray2 = [];
  38. var ChartDataArray3 = [];
  39. var DataArrayforGrid = ko.observableArray();
  40. var GridDataArray = [];
  41. var GridDataArray1 = [];
  42. var GridDataArray2 = [];
  43. var GridDataArray3 = [];
  44. var startDate = ko.observableArray();
  45. var endDate = ko.observableArray();
  46. // 2019.05.17 : 그리드 도표 작업 : 팝업창 추가
  47. // 팝업창뷰 보이기 속성 제어용 변수 선언
  48. var DataGridPopup_Visible = ko.observable(false);
  49. var DataGridPopup_Visible1 = ko.observable(false);
  50. var DataGridPopup_Visible2 = ko.observable(false);
  51. var DataGridPopup_Visible3 = ko.observable(false);
  52. // 그래프 출력 이후 엑셀출력을 위한 팝업창을 위해 임시 저장용 배열 선언
  53. // 2019.05.17 : 그리드 도표 작업 : 팝업창 추가
  54. var endpointSelector = "";
  55. if (BemsWebApplication.config.mode == "production") {
  56. endpointSelector = new DevExpress.EndpointSelector(BemsWebApplication.config.endpoints).config.db.production;
  57. } else {
  58. endpointSelector = new DevExpress.EndpointSelector(BemsWebApplication.config.endpoints).config.db.local;
  59. }
  60. var Time_Interval_Type = [
  61. {
  62. id: 1,
  63. text: "15분"
  64. },
  65. {
  66. id: 2,
  67. text: "시"
  68. },
  69. {
  70. id: 3,
  71. text: "일"
  72. }
  73. ];
  74. var Y_Left_treeViewData = [
  75. {
  76. id: 1,
  77. text: "성능분석",
  78. items: [],
  79. visualFlag: false
  80. },
  81. {
  82. id: 2,
  83. text: "가상 시설",
  84. items: [],
  85. visualFlag: false
  86. },
  87. {
  88. id: 3,
  89. text: "일반 시설",
  90. items: [],
  91. visualFlag: false
  92. }
  93. ];
  94. var Y_Right1_treeViewData = [
  95. {
  96. id: 0,
  97. text: "선택안함",
  98. items: [],
  99. visualFlag: false
  100. },
  101. {
  102. id: 1,
  103. text: "성능분석",
  104. items: [],
  105. visualFlag: false
  106. },
  107. {
  108. id: 2,
  109. text: "가상 시설",
  110. items: [],
  111. visualFlag: false
  112. },
  113. {
  114. id: 3,
  115. text: "일반 시설",
  116. items: [],
  117. visualFlag: false
  118. }
  119. ];
  120. var Y_Right2_treeViewData = [
  121. {
  122. id: 0,
  123. text: "선택안함",
  124. items: [],
  125. visualFlag: false
  126. },
  127. {
  128. id: 1,
  129. text: "성능분석",
  130. items: [],
  131. visualFlag: false
  132. },
  133. {
  134. id: 2,
  135. text: "가상 시설",
  136. items: [],
  137. visualFlag: false
  138. },
  139. {
  140. id: 3,
  141. text: "일반 시설",
  142. items: [],
  143. visualFlag: false
  144. }
  145. ];
  146. function Y_Left_GetPopupTreeViewData() {
  147. Y_Left_treeViewData = [
  148. {
  149. id: 1,
  150. text: "성능분석",
  151. items: [],
  152. visualFlag: false
  153. },
  154. {
  155. id: 2,
  156. text: "가상 시설",
  157. items: [],
  158. visualFlag: false
  159. },
  160. {
  161. id: 3,
  162. text: "일반 시설",
  163. items: [],
  164. visualFlag: false
  165. }
  166. ];
  167. Y_Left_excnt = 4;
  168. var facilityIdIndex = 4;
  169. var dataSource = new DevExpress.data.DataSource({
  170. store: {
  171. type: "odata",
  172. url: endpointSelector + "/BemsFacilityType",
  173. },
  174. requireTotalCount: true,
  175. pageSize: 100
  176. });
  177. dataSource.sort({ getter: "FacilityTypeId", asc: true });
  178. dataSource.load()
  179. .done(function (result) {
  180. for (var i = 0; i < result.length; i++) {
  181. if (result[i].FacilityTypeId < 100) { //성능분석
  182. if (result[i].FacilityTypeId != virtualFacility) {
  183. Y_Left_treeViewData[0].items.push({ id: facilityIdIndex, facilityTypeId: result[i].FacilityTypeId, text: result[i].Name, items: [], visualFlag: false });
  184. facilityIdIndex++;
  185. Y_Left_excnt++;
  186. }
  187. }
  188. }
  189. for (var i = 0; i < result.length; i++) {
  190. if (result[i].FacilityTypeId < 100) { //가상
  191. if (result[i].FacilityTypeId != virtualFacility) {
  192. Y_Left_treeViewData[2].items.push({ id: facilityIdIndex, facilityTypeId: result[i].FacilityTypeId, text: result[i].Name, items: [], visualFlag: false });
  193. facilityIdIndex++;
  194. } else { //일반
  195. Y_Left_treeViewData[1].items.push({ id: facilityIdIndex, facilityTypeId: result[i].FacilityTypeId, text: result[i].Name, items: [], visualFlag: false });
  196. facilityIdIndex++;
  197. }
  198. }
  199. }
  200. var dataSource2 = new DevExpress.data.DataSource({
  201. store: {
  202. type: "odata",
  203. url: endpointSelector + "/CmFacility",
  204. },
  205. requireTotalCount: true,
  206. pageSize: 5000
  207. });
  208. dataSource2.filter([
  209. ["SiteId", "=", BWA.UserInfo.SiteId()]
  210. ]);
  211. dataSource2.sort({ getter: "Name", asc: true });
  212. dataSource2.load()
  213. .done(function (result2) {
  214. for (var i = 0; i < result2.length; i++) {
  215. for (var j = 0; j < Y_Left_treeViewData[0].items.length; j++) {
  216. if (Y_Left_treeViewData[0].items[j].facilityTypeId == result2[i].FacilityTypeId) {
  217. Y_Left_treeViewData[0].items[j].items.push({ id: facilityIdIndex, facilityTypeId: result2[i].FacilityTypeId, facilityCode: result2[i].FacilityCode, text: result2[i].Name, visualFlag: true, parentId: 0 });
  218. facilityIdIndex++;
  219. Y_Left_treeViewData[2].items[j].items.push({ id: facilityIdIndex, facilityTypeId: result2[i].FacilityTypeId, facilityCode: result2[i].FacilityCode, text: result2[i].Name, visualFlag: true, parentId: 2 });
  220. facilityIdIndex++;
  221. break;
  222. }
  223. }
  224. if (result2[i].FacilityTypeId == virtualFacility) {
  225. Y_Left_treeViewData[1].items[0].items.push({ id: facilityIdIndex, facilityTypeId: result2[i].FacilityTypeId, facilityCode: result2[i].FacilityCode, text: result2[i].Name, visualFlag: true, parentId: 1 });
  226. facilityIdIndex++;
  227. }
  228. }
  229. })
  230. .fail(function (error) {
  231. utils.toast.show(error);
  232. });
  233. })
  234. .fail(function (error) {
  235. utils.toast.show(error);
  236. });
  237. }
  238. function Y_Left_GetData(facilityTypeId, facilityCode, parentId) {
  239. if (parentId != 0) { //가상, 일반 시설
  240. var dataSource = new DevExpress.data.DataSource({
  241. store: {
  242. type: "odata",
  243. url: endpointSelector + "/BemsMonitoringPointConfig",
  244. },
  245. requireTotalCount: true,
  246. pageSize: 5000,
  247. expand: ["BemsMonitoringPoint"]
  248. });
  249. dataSource.filter([
  250. ["SiteId", "=", BWA.UserInfo.SiteId()],
  251. "and",
  252. ["FacilityTypeId", "=", facilityTypeId],
  253. "and",
  254. ["FacilityCode", "=", facilityCode]
  255. ]);
  256. dataSource.sort({ getter: "BemsMonitoringPoint/Name", asc: true });
  257. dataSource.load()
  258. .done(function (result) {
  259. Y_Left_setDataSource1 = new Array();
  260. for (var i = 0; i < result.length; i++) {
  261. var Y_Left_setData = { "ControlPoint": "", "FuelType": 0, "FacilityTypeId": 0, "FacilityCode": 0, "PropertyId": 0, "FormulaId": 0 };
  262. Y_Left_setData.ControlPoint = result[i].BemsMonitoringPoint.Name;
  263. var fuelName = result[i].BemsMonitoringPoint.FuelTypeId;
  264. if (fuelName == 0) {
  265. fuelName = "-";
  266. } else if (fuelName == 1) {
  267. fuelName = "전기";
  268. } else if (fuelName == 2) {
  269. fuelName = "가스";
  270. } else {
  271. fuelName = "수도";
  272. }
  273. Y_Left_setData.FuelType = fuelName;
  274. Y_Left_setData.FacilityTypeId = result[i].FacilityTypeId;
  275. Y_Left_setData.FacilityCode = result[i].FacilityCode;
  276. Y_Left_setData.PropertyId = result[i].PropertyId;
  277. Y_Left_setDataSource1.push(Y_Left_setData);
  278. }
  279. $("#Y_Left_ControlId").dxSelectBox('instance').option('value', null);// 텍스트 클리어
  280. $("#Y_Left_ControlId").dxSelectBox({// 두번째 콤보 바인딩
  281. placeholder: "관제점 이름",
  282. dataSource: Y_Left_setDataSource1,
  283. displayExpr: "ControlPoint",
  284. valueExpr: "PropertyId",
  285. onValueChanged: function () {
  286. var value = $("#Y_Left_ControlId").dxSelectBox('instance').option('value');
  287. if (value != null) {
  288. for (var i = 0; i < Y_Left_setDataSource1.length; i++) {
  289. if (Y_Left_setDataSource1[i].PropertyId == value) {
  290. propertyId_fin = Y_Left_setDataSource1[i].PropertyId;
  291. controlPoint_fin = Y_Left_setDataSource1[i].ControlPoint;
  292. formulaId_fin = Y_Left_setDataSource1[i].FormulaId;
  293. break;
  294. }
  295. }
  296. }
  297. }
  298. });
  299. if (Y_Left_changed) {
  300. $("#Y_Left_FacilityCode").dxSelectBox('instance').option('value', FacilityCode_id_temp);
  301. if (Y_Left_setDataSource1 == "") {
  302. Y_Left_changed = true;
  303. }
  304. else {
  305. for (var i = 0; i <= Y_Left_setDataSource1.length; i++) {
  306. if (FormulaId == 0) {
  307. if (Y_Left_setDataSource1[i].PropertyId == PropertyId) {
  308. $("#Y_Left_ControlId").dxSelectBox('instance').option('value', Y_Left_setDataSource1[i].PropertyId);
  309. break;
  310. }
  311. }
  312. else {
  313. if (Y_Left_setDataSource1[i].FormulaId == FormulaId) {
  314. $("#Y_Left_ControlId").dxSelectBox('instance').option('value', Y_Left_setDataSource1[i].FormulaId);
  315. break;
  316. }
  317. }
  318. }
  319. Y_Left_changed = false;
  320. }
  321. }
  322. })
  323. .fail(function (error) {
  324. utils.toast.show(error);
  325. });
  326. } else { //성능
  327. var dataSource = new DevExpress.data.DataSource({
  328. store: {
  329. type: "odata",
  330. url: endpointSelector + "/BemsFormula",
  331. },
  332. requireTotalCount: true,
  333. pageSize: 5000,
  334. expand: ["BemsFormulaBase"]
  335. });
  336. dataSource.filter([
  337. ["SiteId", "=", BWA.UserInfo.SiteId()],
  338. "and",
  339. ["FacilityTypeId", "=", facilityTypeId],
  340. "and",
  341. ["FacilityCode", "=", facilityCode]
  342. ]);
  343. dataSource.sort({ getter: "BemsFormulaBase/Name", asc: true });
  344. dataSource.load()
  345. .done(function (result) {
  346. Y_Left_setDataSource1 = new Array();
  347. for (var i = 0; i < result.length; i++) {
  348. var Y_Left_setData = { "ControlPoint": "", "FuelType": 0, "FacilityTypeId": 0, "FacilityCode": 0, "PropertyId": 0, "FormulaId": 0 };
  349. Y_Left_setData.ControlPoint = result[i].BemsFormulaBase.Name;
  350. Y_Left_setData.FuelType = "-";
  351. Y_Left_setData.FacilityTypeId = result[i].FacilityTypeId;
  352. Y_Left_setData.FacilityCode = result[i].FacilityCode;
  353. Y_Left_setData.FormulaId = result[i].FormulaId;
  354. Y_Left_setDataSource1.push(Y_Left_setData);
  355. }
  356. $("#Y_Left_ControlId").dxSelectBox('instance').option('value', null);// 텍스트 클리어
  357. $("#Y_Left_ControlId").dxSelectBox({// 두번째 콤보 바인딩
  358. placeholder: "관제점 이름",
  359. dataSource: Y_Left_setDataSource1,
  360. displayExpr: "ControlPoint",
  361. valueExpr: "FormulaId",
  362. onValueChanged: function () {
  363. var value = $("#Y_Left_ControlId").dxSelectBox('instance').option('value');
  364. if (value != null) {
  365. for (var i = 0; i < Y_Left_setDataSource1.length; i++) {
  366. if (Y_Left_setDataSource1[i].FormulaId == value) {
  367. propertyId_fin = Y_Left_setDataSource1[i].PropertyId;
  368. controlPoint_fin = Y_Left_setDataSource1[i].ControlPoint;
  369. formulaId_fin = Y_Left_setDataSource1[i].FormulaId;
  370. break;
  371. }
  372. }
  373. }
  374. }
  375. });
  376. if (Y_Left_changed) {
  377. $("#Y_Left_FacilityCode").dxSelectBox('instance').option('value', FacilityCode_id_temp);
  378. if (Y_Left_setDataSource1 == "") {
  379. Y_Left_changed = true;
  380. }
  381. else {
  382. for (var i = 0; i < Y_Left_setDataSource1.length; i++) {
  383. if (FormulaId == 0) {
  384. if (Y_Left_setDataSource1[i].PropertyId == PropertyId) {
  385. $("#Y_Left_ControlId").dxSelectBox('instance').option('value', Y_Left_setDataSource1[i].PropertyId);
  386. break;
  387. }
  388. }
  389. else {
  390. if (Y_Left_setDataSource1[i].FormulaId == FormulaId) {
  391. $("#Y_Left_ControlId").dxSelectBox('instance').option('value', Y_Left_setDataSource1[i].FormulaId);
  392. break;
  393. }
  394. }
  395. }
  396. Y_Left_changed = false;
  397. }
  398. }
  399. })
  400. .fail(function (error) {
  401. utils.toast.show(error);
  402. });
  403. }
  404. }
  405. // Y 좌측 함수 ********************
  406. // Y 우측(1) 함수 ********************
  407. function Y_Right1_GetPopupTreeViewData() {
  408. Y_Right1_treeViewData = [
  409. {
  410. id: 0,
  411. text: "선택안함",
  412. items: [],
  413. visualFlag: false
  414. },
  415. {
  416. id: 1,
  417. text: "성능분석",
  418. items: [],
  419. visualFlag: false
  420. },
  421. {
  422. id: 2,
  423. text: "가상 시설",
  424. items: [],
  425. visualFlag: false
  426. },
  427. {
  428. id: 3,
  429. text: "일반 시설",
  430. items: [],
  431. visualFlag: false
  432. }
  433. ];
  434. Y_Right1_excnt = 4;
  435. var facilityIdIndex = 4;
  436. var dataSource = new DevExpress.data.DataSource({
  437. store: {
  438. type: "odata",
  439. url: endpointSelector + "/BemsFacilityType",
  440. },
  441. requireTotalCount: true,
  442. pageSize: 100
  443. });
  444. dataSource.sort({ getter: "FacilityTypeId", asc: true });
  445. dataSource.load()
  446. .done(function (result) {
  447. for (var i = 0; i < result.length; i++) {
  448. if (result[i].FacilityTypeId < 100) { //성능분석
  449. if (result[i].FacilityTypeId != virtualFacility) {
  450. Y_Right1_treeViewData[0].items.push({ id: facilityIdIndex, facilityTypeId: result[i].FacilityTypeId, text: result[i].Name, items: [], visualFlag: false });
  451. facilityIdIndex++;
  452. Y_Right1_excnt++;
  453. }
  454. }
  455. }
  456. for (var i = 0; i < result.length; i++) {
  457. if (result[i].FacilityTypeId < 100) { //가상
  458. if (result[i].FacilityTypeId != virtualFacility) {
  459. Y_Right1_treeViewData[2].items.push({ id: facilityIdIndex, facilityTypeId: result[i].FacilityTypeId, text: result[i].Name, items: [], visualFlag: false });
  460. facilityIdIndex++;
  461. } else { //일반
  462. Y_Right1_treeViewData[1].items.push({ id: facilityIdIndex, facilityTypeId: result[i].FacilityTypeId, text: result[i].Name, items: [], visualFlag: false });
  463. facilityIdIndex++;
  464. }
  465. }
  466. }
  467. var dataSource2 = new DevExpress.data.DataSource({
  468. store: {
  469. type: "odata",
  470. url: endpointSelector + "/CmFacility",
  471. },
  472. requireTotalCount: true,
  473. pageSize: 5000
  474. });
  475. dataSource2.filter([
  476. ["SiteId", "=", BWA.UserInfo.SiteId()]
  477. ]);
  478. dataSource2.sort({ getter: "Name", asc: true });
  479. dataSource2.load()
  480. .done(function (result2) {
  481. for (var i = 0; i < result2.length; i++) {
  482. for (var j = 0; j < Y_Right1_treeViewData[0].items.length; j++) {
  483. if (Y_Right1_treeViewData[0].items[j].facilityTypeId == result2[i].FacilityTypeId) {
  484. Y_Right1_treeViewData[0].items[j].items.push({ id: facilityIdIndex, facilityTypeId: result2[i].FacilityTypeId, facilityCode: result2[i].FacilityCode, text: result2[i].Name, visualFlag: true, parentId: 0 });
  485. facilityIdIndex++;
  486. Y_Right1_treeViewData[2].items[j].items.push({ id: facilityIdIndex, facilityTypeId: result2[i].FacilityTypeId, facilityCode: result2[i].FacilityCode, text: result2[i].Name, visualFlag: true, parentId: 2 });
  487. facilityIdIndex++;
  488. break;
  489. }
  490. }
  491. if (result2[i].FacilityTypeId == virtualFacility) {
  492. Y_Right1_treeViewData[1].items[0].items.push({ id: facilityIdIndex, facilityTypeId: result2[i].FacilityTypeId, facilityCode: result2[i].FacilityCode, text: result2[i].Name, visualFlag: true, parentId: 1 });
  493. facilityIdIndex++;
  494. }
  495. }
  496. })
  497. .fail(function (error) {
  498. utils.toast.show(error);
  499. });
  500. })
  501. .fail(function (error) {
  502. utils.toast.show(error);
  503. });
  504. }
  505. function Y_Right1_GetData(facilityTypeId, facilityCode, parentId) {
  506. if (parentId != 0) {
  507. var dataSource = new DevExpress.data.DataSource({
  508. store: {
  509. type: "odata",
  510. url: endpointSelector + "/BemsMonitoringPointConfig",
  511. },
  512. requireTotalCount: true,
  513. pageSize: 5000,
  514. expand: ["BemsMonitoringPoint"]
  515. });
  516. dataSource.filter([
  517. ["SiteId", "=", BWA.UserInfo.SiteId()],
  518. "and",
  519. ["FacilityTypeId", "=", facilityTypeId],
  520. "and",
  521. ["FacilityCode", "=", facilityCode]
  522. ]);
  523. dataSource.sort({ getter: "BemsMonitoringPoint/Name", asc: true });
  524. dataSource.load()
  525. .done(function (result) {
  526. Y_Right1_setDataSource1 = new Array();
  527. for (var i = 0; i < result.length; i++) {
  528. var Y_Right1_setData = { "ControlPoint": "", "FuelType": 0, "FacilityTypeId": 0, "FacilityCode": 0, "PropertyId": 0, "FormulaId": 0 };
  529. Y_Right1_setData.ControlPoint = result[i].BemsMonitoringPoint.Name;
  530. var fuelName = result[i].BemsMonitoringPoint.FuelTypeId;
  531. if (fuelName == 0) {
  532. fuelName = "-";
  533. } else if (fuelName == 1) {
  534. fuelName = "전기";
  535. } else if (fuelName == 2) {
  536. fuelName = "가스";
  537. } else {
  538. fuelName = "수도";
  539. }
  540. Y_Right1_setData.FuelType = fuelName;
  541. Y_Right1_setData.FacilityTypeId = result[i].FacilityTypeId;
  542. Y_Right1_setData.FacilityCode = result[i].FacilityCode;
  543. Y_Right1_setData.PropertyId = result[i].PropertyId;
  544. Y_Right1_setDataSource1.push(Y_Right1_setData);
  545. }
  546. $("#Y_Right1_ControlId").dxSelectBox('instance').option('value', null);// 텍스트 클리어
  547. $("#Y_Right1_ControlId").dxSelectBox({// 두번째 콤보 바인딩
  548. placeholder: "관제점 이름",
  549. dataSource: Y_Right1_setDataSource1,
  550. displayExpr: "ControlPoint",
  551. valueExpr: "PropertyId",
  552. onValueChanged: function () {
  553. var value = $("#Y_Right1_ControlId").dxSelectBox('instance').option('value');
  554. if (value != null) {
  555. for (var i = 0; i < Y_Right1_setDataSource1.length; i++) {
  556. if (Y_Right1_setDataSource1[i].PropertyId == value) {
  557. propertyId_fin = Y_Right1_setDataSource1[i].PropertyId;
  558. controlPoint_fin = Y_Right1_setDataSource1[i].ControlPoint;
  559. formulaId_fin = Y_Right1_setDataSource1[i].FormulaId;
  560. break;
  561. }
  562. }
  563. }
  564. }
  565. });
  566. if (Y_Right1_changed) {
  567. $("#Y_Right1_FacilityCode").dxSelectBox('instance').option('value', FacilityCode_id_temp);
  568. if (Y_Right1_setDataSource1 == "") {
  569. Y_Right1_changed = true;
  570. }
  571. else {
  572. for (var i = 0; i <= Y_Right1_setDataSource1.length; i++) {
  573. if (FormulaId == 0) {
  574. if (Y_Right1_setDataSource1[i].PropertyId == PropertyId) {
  575. $("#Y_Right1_ControlId").dxSelectBox('instance').option('value', Y_Right1_setDataSource1[i].PropertyId);
  576. break;
  577. }
  578. }
  579. else {
  580. if (Y_Right1_setDataSource1[i].FormulaId == FormulaId) {
  581. $("#Y_Right1_ControlId").dxSelectBox('instance').option('value', Y_Right1_setDataSource1[i].FormulaId);
  582. break;
  583. }
  584. }
  585. }
  586. Y_Right1_changed = false;
  587. }
  588. }
  589. })
  590. .fail(function (error) {
  591. utils.toast.show(error);
  592. });
  593. } else {
  594. var dataSource = new DevExpress.data.DataSource({
  595. store: {
  596. type: "odata",
  597. url: endpointSelector + "/BemsFormula",
  598. },
  599. requireTotalCount: true,
  600. pageSize: 5000,
  601. expand: ["BemsFormulaBase"]
  602. });
  603. dataSource.filter([
  604. ["SiteId", "=", BWA.UserInfo.SiteId()],
  605. "and",
  606. ["FacilityTypeId", "=", facilityTypeId],
  607. "and",
  608. ["FacilityCode", "=", facilityCode]
  609. ]);
  610. dataSource.sort({ getter: "BemsFormulaBase/Name", asc: true });
  611. dataSource.load()
  612. .done(function (result) {
  613. Y_Right1_setDataSource1 = new Array();
  614. for (var i = 0; i < result.length; i++) {
  615. var Y_Right1_setData = { "ControlPoint": "", "FuelType": 0, "FacilityTypeId": 0, "FacilityCode": 0, "PropertyId": 0, "FormulaId": 0 };
  616. Y_Right1_setData.ControlPoint = result[i].BemsFormulaBase.Name;
  617. Y_Right1_setData.FuelType = "-";
  618. Y_Right1_setData.FacilityTypeId = result[i].FacilityTypeId;
  619. Y_Right1_setData.FacilityCode = result[i].FacilityCode;
  620. Y_Right1_setData.FormulaId = result[i].FormulaId;
  621. Y_Right1_setDataSource1.push(Y_Right1_setData);
  622. }
  623. $("#Y_Right1_ControlId").dxSelectBox('instance').option('value', null);// 텍스트 클리어
  624. $("#Y_Right1_ControlId").dxSelectBox({// 두번째 콤보 바인딩
  625. placeholder: "관제점 이름",
  626. dataSource: Y_Right1_setDataSource1,
  627. displayExpr: "ControlPoint",
  628. valueExpr: "FormulaId",
  629. onValueChanged: function () {
  630. var value = $("#Y_Right1_ControlId").dxSelectBox('instance').option('value');
  631. if (value != null) {
  632. for (var i = 0; i < Y_Right1_setDataSource1.length; i++) {
  633. if (Y_Right1_setDataSource1[i].FormulaId == value) {
  634. propertyId_fin = Y_Right1_setDataSource1[i].PropertyId;
  635. controlPoint_fin = Y_Right1_setDataSource1[i].ControlPoint;
  636. formulaId_fin = Y_Right1_setDataSource1[i].FormulaId;
  637. break;
  638. }
  639. }
  640. }
  641. }
  642. });
  643. if (Y_Right1_changed) {
  644. $("#Y_Right1_FacilityCode").dxSelectBox('instance').option('value', FacilityCode_id_temp);
  645. if (Y_Right1_setDataSource1 == "") {
  646. Y_Right1_changed = true;
  647. }
  648. else {
  649. for (var i = 0; i < Y_Right1_setDataSource1.length; i++) {
  650. if (FormulaId == 0) {
  651. if (Y_Right1_setDataSource1[i].PropertyId == PropertyId) {
  652. $("#Y_Right1_ControlId").dxSelectBox('instance').option('value', Y_Right1_setDataSource1[i].PropertyId);
  653. break;
  654. }
  655. }
  656. else {
  657. if (Y_Right1_setDataSource1[i].FormulaId == FormulaId) {
  658. $("#Y_Right1_ControlId").dxSelectBox('instance').option('value', Y_Right1_setDataSource1[i].FormulaId);
  659. break;
  660. }
  661. }
  662. }
  663. Y_Right1_changed = false;
  664. }
  665. }
  666. })
  667. .fail(function (error) {
  668. utils.toast.show(error);
  669. });
  670. }
  671. }
  672. // Y 우측(1) 함수 ********************
  673. // Y 우측(2) 함수 ********************
  674. function Y_Right2_GetPopupTreeViewData() {
  675. Y_Right2_treeViewData = [
  676. {
  677. id: 0,
  678. text: "선택안함",
  679. items: [],
  680. visualFlag: false
  681. },
  682. {
  683. id: 1,
  684. text: "성능분석",
  685. items: [],
  686. visualFlag: false
  687. },
  688. {
  689. id: 2,
  690. text: "가상 시설",
  691. items: [],
  692. visualFlag: false
  693. },
  694. {
  695. id: 3,
  696. text: "일반 시설",
  697. items: [],
  698. visualFlag: false
  699. }
  700. ];
  701. Y_Right2_excnt = 4;
  702. var facilityIdIndex = 4;
  703. var dataSource = new DevExpress.data.DataSource({
  704. store: {
  705. type: "odata",
  706. url: endpointSelector + "/BemsFacilityType",
  707. },
  708. requireTotalCount: true,
  709. pageSize: 100
  710. });
  711. dataSource.sort({ getter: "FacilityTypeId", asc: true });
  712. dataSource.load()
  713. .done(function (result) {
  714. for (var i = 0; i < result.length; i++) {
  715. if (result[i].FacilityTypeId < 100) { //성능분석
  716. if (result[i].FacilityTypeId != virtualFacility) {
  717. Y_Right2_treeViewData[0].items.push({ id: facilityIdIndex, facilityTypeId: result[i].FacilityTypeId, text: result[i].Name, items: [], visualFlag: false });
  718. facilityIdIndex++;
  719. Y_Right2_excnt++;
  720. }
  721. }
  722. }
  723. for (var i = 0; i < result.length; i++) {
  724. if (result[i].FacilityTypeId < 100) { //가상
  725. if (result[i].FacilityTypeId != virtualFacility) {
  726. Y_Right2_treeViewData[2].items.push({ id: facilityIdIndex, facilityTypeId: result[i].FacilityTypeId, text: result[i].Name, items: [], visualFlag: false });
  727. facilityIdIndex++;
  728. } else { //일반
  729. Y_Right2_treeViewData[1].items.push({ id: facilityIdIndex, facilityTypeId: result[i].FacilityTypeId, text: result[i].Name, items: [], visualFlag: false });
  730. facilityIdIndex++;
  731. }
  732. }
  733. }
  734. var dataSource2 = new DevExpress.data.DataSource({
  735. store: {
  736. type: "odata",
  737. url: endpointSelector + "/CmFacility",
  738. },
  739. requireTotalCount: true,
  740. pageSize: 5000
  741. });
  742. dataSource2.filter([
  743. ["SiteId", "=", BWA.UserInfo.SiteId()]
  744. ]);
  745. dataSource2.sort({ getter: "Name", asc: true });
  746. dataSource2.load()
  747. .done(function (result2) {
  748. for (var i = 0; i < result2.length; i++) {
  749. for (var j = 0; j < Y_Right2_treeViewData[0].items.length; j++) {
  750. if (Y_Right2_treeViewData[0].items[j].facilityTypeId == result2[i].FacilityTypeId) {
  751. Y_Right2_treeViewData[0].items[j].items.push({ id: facilityIdIndex, facilityTypeId: result2[i].FacilityTypeId, facilityCode: result2[i].FacilityCode, text: result2[i].Name, visualFlag: true, parentId: 0 });
  752. facilityIdIndex++;
  753. Y_Right2_treeViewData[2].items[j].items.push({ id: facilityIdIndex, facilityTypeId: result2[i].FacilityTypeId, facilityCode: result2[i].FacilityCode, text: result2[i].Name, visualFlag: true, parentId: 2 });
  754. facilityIdIndex++;
  755. break;
  756. }
  757. }
  758. if (result2[i].FacilityTypeId == virtualFacility) {
  759. Y_Right2_treeViewData[1].items[0].items.push({ id: facilityIdIndex, facilityTypeId: result2[i].FacilityTypeId, facilityCode: result2[i].FacilityCode, text: result2[i].Name, visualFlag: true, parentId: 1 });
  760. facilityIdIndex++;
  761. }
  762. }
  763. })
  764. .fail(function (error) {
  765. utils.toast.show(error);
  766. });
  767. })
  768. .fail(function (error) {
  769. utils.toast.show(error);
  770. });
  771. }
  772. function Y_Right2_GetData(facilityTypeId, facilityCode, parentId) {
  773. if (parentId != 0) {
  774. var dataSource = new DevExpress.data.DataSource({
  775. store: {
  776. type: "odata",
  777. url: endpointSelector + "/BemsMonitoringPointConfig",
  778. },
  779. requireTotalCount: true,
  780. pageSize: 5000,
  781. expand: ["BemsMonitoringPoint"]
  782. });
  783. dataSource.filter([
  784. ["SiteId", "=", BWA.UserInfo.SiteId()],
  785. "and",
  786. ["FacilityTypeId", "=", facilityTypeId],
  787. "and",
  788. ["FacilityCode", "=", facilityCode]
  789. ]);
  790. dataSource.sort({ getter: "BemsMonitoringPoint/Name", asc: true });
  791. dataSource.load()
  792. .done(function (result) {
  793. Y_Right2_setDataSource1 = new Array();
  794. for (var i = 0; i < result.length; i++) {
  795. var Y_Right2_setData = { "ControlPoint": "", "FuelType": 0, "FacilityTypeId": 0, "FacilityCode": 0, "PropertyId": 0, "FormulaId": 0 };
  796. Y_Right2_setData.ControlPoint = result[i].BemsMonitoringPoint.Name;
  797. var fuelName = result[i].BemsMonitoringPoint.FuelTypeId;
  798. if (fuelName == 0) {
  799. fuelName = "-";
  800. } else if (fuelName == 1) {
  801. fuelName = "전기";
  802. } else if (fuelName == 2) {
  803. fuelName = "가스";
  804. } else {
  805. fuelName = "수도";
  806. }
  807. Y_Right2_setData.FuelType = fuelName;
  808. Y_Right2_setData.FacilityTypeId = result[i].FacilityTypeId;
  809. Y_Right2_setData.FacilityCode = result[i].FacilityCode;
  810. Y_Right2_setData.PropertyId = result[i].PropertyId;
  811. Y_Right2_setDataSource1.push(Y_Right2_setData);
  812. }
  813. $("#Y_Right2_ControlId").dxSelectBox('instance').option('value', null);// 텍스트 클리어
  814. $("#Y_Right2_ControlId").dxSelectBox({// 두번째 콤보 바인딩
  815. placeholder: "관제점 이름",
  816. dataSource: Y_Right2_setDataSource1,
  817. displayExpr: "ControlPoint",
  818. valueExpr: "PropertyId",
  819. onValueChanged: function () {
  820. var value = $("#Y_Right2_ControlId").dxSelectBox('instance').option('value');
  821. if (value != null) {
  822. for (var i = 0; i < Y_Right2_setDataSource1.length; i++) {
  823. if (Y_Right2_setDataSource1[i].PropertyId == value) {
  824. propertyId_fin = Y_Right2_setDataSource1[i].PropertyId;
  825. controlPoint_fin = Y_Right2_setDataSource1[i].ControlPoint;
  826. formulaId_fin = Y_Right2_setDataSource1[i].FormulaId;
  827. break;
  828. }
  829. }
  830. }
  831. }
  832. });
  833. if (Y_Right2_changed) {
  834. $("#Y_Right2_FacilityCode").dxSelectBox('instance').option('value', FacilityCode_id_temp);
  835. if (Y_Right2_setDataSource1 == "") {
  836. Y_Right2_changed = true;
  837. }
  838. else {
  839. for (var i = 0; i <= Y_Right2_setDataSource1.length; i++) {
  840. if (FormulaId == 0) {
  841. if (Y_Right2_setDataSource1[i].PropertyId == PropertyId) {
  842. $("#Y_Right2_ControlId").dxSelectBox('instance').option('value', Y_Right2_setDataSource1[i].PropertyId);
  843. break;
  844. }
  845. }
  846. else {
  847. if (Y_Right2_setDataSource1[i].FormulaId == FormulaId) {
  848. $("#Y_Right2_ControlId").dxSelectBox('instance').option('value', Y_Right2_setDataSource1[i].FormulaId);
  849. break;
  850. }
  851. }
  852. }
  853. Y_Right2_changed = false;
  854. }
  855. }
  856. })
  857. .fail(function (error) {
  858. utils.toast.show(error);
  859. });
  860. } else {
  861. var dataSource = new DevExpress.data.DataSource({
  862. store: {
  863. type: "odata",
  864. url: endpointSelector + "/BemsFormula",
  865. },
  866. requireTotalCount: true,
  867. pageSize: 5000,
  868. expand: ["BemsFormulaBase"]
  869. });
  870. dataSource.filter([
  871. ["SiteId", "=", BWA.UserInfo.SiteId()],
  872. "and",
  873. ["FacilityTypeId", "=", facilityTypeId],
  874. "and",
  875. ["FacilityCode", "=", facilityCode]
  876. ]);
  877. dataSource.sort({ getter: "BemsFormulaBase/Name", asc: true });
  878. dataSource.load()
  879. .done(function (result) {
  880. Y_Right2_setDataSource1 = new Array();
  881. for (var i = 0; i < result.length; i++) {
  882. var Y_Right2_setData = { "ControlPoint": "", "FuelType": 0, "FacilityTypeId": 0, "FacilityCode": 0, "PropertyId": 0, "FormulaId": 0 };
  883. Y_Right2_setData.ControlPoint = result[i].BemsFormulaBase.Name;
  884. Y_Right2_setData.FuelType = "-";
  885. Y_Right2_setData.FacilityTypeId = result[i].FacilityTypeId;
  886. Y_Right2_setData.FacilityCode = result[i].FacilityCode;
  887. Y_Right2_setData.FormulaId = result[i].FormulaId;
  888. Y_Right2_setDataSource1.push(Y_Right2_setData);
  889. }
  890. $("#Y_Right2_ControlId").dxSelectBox('instance').option('value', null);// 텍스트 클리어
  891. $("#Y_Right2_ControlId").dxSelectBox({// 두번째 콤보 바인딩
  892. placeholder: "관제점 이름",
  893. dataSource: Y_Right2_setDataSource1,
  894. displayExpr: "ControlPoint",
  895. valueExpr: "FormulaId",
  896. onValueChanged: function () {
  897. var value = $("#Y_Right2_ControlId").dxSelectBox('instance').option('value');
  898. if (value != null) {
  899. for (var i = 0; i < Y_Right2_setDataSource1.length; i++) {
  900. if (Y_Right2_setDataSource1[i].FormulaId == value) {
  901. propertyId_fin = Y_Right2_setDataSource1[i].PropertyId;
  902. controlPoint_fin = Y_Right2_setDataSource1[i].ControlPoint;
  903. formulaId_fin = Y_Right2_setDataSource1[i].FormulaId;
  904. break;
  905. }
  906. }
  907. }
  908. }
  909. });
  910. if (Y_Right2_changed) {
  911. $("#Y_Right2_FacilityCode").dxSelectBox('instance').option('value', FacilityCode_id_temp);
  912. if (Y_Right2_setDataSource1 == "") {
  913. Y_Right2_changed = true;
  914. }
  915. else {
  916. for (var i = 0; i < Y_Right2_setDataSource1.length; i++) {
  917. if (FormulaId == 0) {
  918. if (Y_Right2_setDataSource1[i].PropertyId == PropertyId) {
  919. $("#Y_Right2_ControlId").dxSelectBox('instance').option('value', Y_Right2_setDataSource1[i].PropertyId);
  920. break;
  921. }
  922. }
  923. else {
  924. if (Y_Right2_setDataSource1[i].FormulaId == FormulaId) {
  925. $("#Y_Right2_ControlId").dxSelectBox('instance').option('value', Y_Right2_setDataSource1[i].FormulaId);
  926. break;
  927. }
  928. }
  929. }
  930. Y_Right2_changed = false;
  931. }
  932. }
  933. })
  934. .fail(function (error) {
  935. utils.toast.show(error);
  936. });
  937. }
  938. }
  939. // Y 우측(2) 함수 ********************
  940. // 2017.09.08 : 그리드 도표 작업 : 팝업창 추가
  941. function DataGridPopup_ButtonClick() {
  942. //그래프내 데이터 존재 유무 확인 함수
  943. if (DataArrayforGrid.length == 0) {
  944. utils.toast.show('데이터가 존재하지않습니다.', 'error');
  945. return;
  946. }
  947. if (Y_Right1_PointType == 0 && Y_Right2_PointType == 0)
  948. DataGridPopup_Visible(true);
  949. else if (Y_Right1_PointType != 0 && Y_Right2_PointType == 0)
  950. DataGridPopup_Visible1(true);
  951. else if (Y_Right1_PointType == 0 && Y_Right2_PointType != 0)
  952. DataGridPopup_Visible2(true);
  953. else
  954. DataGridPopup_Visible3(true);
  955. }
  956. function handlePopupShown() {
  957. Y_Right1_PointType
  958. if (Y_Right1_PointType == 0 && Y_Right2_PointType == 0) {
  959. viewModel.Free_ChartDataGridOptions.columns[0].format = 'yyyy-MM-dd HH:mm';
  960. viewModel.Free_ChartDataGridOptions.columns[1].caption = Y_Left_formulaName;
  961. //viewModel.Free_ChartDataGridOptions.columns[2].caption = '-';
  962. //viewModel.Free_ChartDataGridOptions.columns[3].caption = '-';
  963. // 데이타소스 업데이트
  964. $("#Free_ChartDataGrid_Container").dxDataGrid("instance").option("dataSource", DataArrayforGrid);
  965. if (DataArrayforGrid.length == 0) {
  966. utils.toast.show('데이터가 존재하지않습니다.', 'error');
  967. DataGridPopup_Visible(false);
  968. }
  969. else
  970. // 팝업창 갱신
  971. DataGridPopup_Visible(true);
  972. }
  973. else if (Y_Right1_PointType != 0 && Y_Right2_PointType == 0) {
  974. viewModel.Free_ChartDataGridOptions1.columns[1].caption = Y_Left_formulaName;
  975. viewModel.Free_ChartDataGridOptions1.columns[2].caption = Y_Right1_formulaName;
  976. //viewModel.Free_ChartDataGridOptions.columns[3].caption = '-';
  977. // 데이타소스 업데이트
  978. $("#Free_ChartDataGrid_Container1").dxDataGrid("instance").option("dataSource", DataArrayforGrid);
  979. if (DataArrayforGrid.length == 0) {
  980. utils.toast.show('데이터가 존재하지않습니다.', 'error');
  981. DataGridPopup_Visible1(false);
  982. }
  983. else
  984. // 팝업창 갱신
  985. DataGridPopup_Visible1(true);
  986. }
  987. else if (Y_Right1_PointType == 0 && Y_Right2_PointType != 0) {
  988. viewModel.Free_ChartDataGridOptions2.columns[1].caption = Y_Left_formulaName;
  989. //viewModel.Free_ChartDataGridOptions.columns[2].caption = '-';
  990. viewModel.Free_ChartDataGridOptions2.columns[2].caption = Y_Right2_formulaName;
  991. // 데이타소스 업데이트
  992. $("#Free_ChartDataGrid_Container2").dxDataGrid("instance").option("dataSource", DataArrayforGrid);
  993. if (DataArrayforGrid.length == 0) {
  994. utils.toast.show('데이터가 존재하지않습니다.', 'error');
  995. DataGridPopup_Visible2(false);
  996. }
  997. else
  998. // 팝업창 갱신
  999. DataGridPopup_Visible2(true);
  1000. }
  1001. else {
  1002. viewModel.Free_ChartDataGridOptions3.columns[1].caption = Y_Left_formulaName;
  1003. viewModel.Free_ChartDataGridOptions3.columns[2].caption = Y_Right1_formulaName;
  1004. viewModel.Free_ChartDataGridOptions3.columns[3].caption = Y_Right2_formulaName;
  1005. // 데이타소스 업데이트
  1006. $("#Free_ChartDataGrid_Container3").dxDataGrid("instance").option("dataSource", DataArrayforGrid);
  1007. if (DataArrayforGrid.length == 0) {
  1008. utils.toast.show('데이터가 존재하지않습니다.', 'error');
  1009. DataGridPopup_Visible3(false);
  1010. }
  1011. else
  1012. // 팝업창 갱신
  1013. DataGridPopup_Visible3(true);
  1014. }
  1015. }
  1016. // 2017.09.08 : 그리드 도표 작업 : 팝업창 추가
  1017. function handleViewShown() { }
  1018. function handleSearchInSearchView() { }
  1019. // 메뉴 초기화
  1020. function handleEdit() {
  1021. // 시간 정보
  1022. var now = new Date();
  1023. var year = now.getFullYear();
  1024. var month = now.getMonth();
  1025. var day = now.getDate();
  1026. var hour = now.getHours()
  1027. //var test = new Date(year, month, day);
  1028. // 조회 시간 주기
  1029. $("#Time_Interval").dxSelectBox({
  1030. dataSource: Time_Interval_Type,
  1031. displayExpr: "text",
  1032. valueExpr: "id"
  1033. });
  1034. // 조회 시작일
  1035. $("#Search_Date_Start").dxDateBox({
  1036. format: "date",
  1037. value: new Date(year, month, day - 1)
  1038. });
  1039. // 조회 시작 시간
  1040. $("#Search_Time_Start").dxDateBox({
  1041. format: "time",
  1042. value: new Date(year, month, day - 1, hour)
  1043. });
  1044. // 조회 종료일
  1045. $("#Search_Date_End").dxDateBox({
  1046. format: "date",
  1047. value: new Date(year, month, day)
  1048. });
  1049. // 조회 종료 시간
  1050. $("#Search_Time_End").dxDateBox({
  1051. format: "time",
  1052. value: new Date(year, month, day, hour)
  1053. });
  1054. $("#Y_Left_Point_Type_Id").dxSelectBox({
  1055. placeholder: "관제점 타입",
  1056. dataSource: Y_Left_treeViewData,
  1057. displayExpr: "text",
  1058. value: ""
  1059. });
  1060. $("#Y_Left_FacilityTypeId").dxSelectBox({
  1061. placeholder: "설비 타입",
  1062. dataSource: Y_Left_facility_type,
  1063. displayExpr: "text",
  1064. valueExpr: ""
  1065. });
  1066. $("#Y_Left_FacilityCode").dxSelectBox({
  1067. placeholder: "설비 이름",
  1068. dataSource: Y_Left_facility_id,
  1069. displayExpr: "text",
  1070. valueExpr: ""
  1071. });
  1072. $("#Y_Left_ControlId").dxSelectBox({
  1073. placeholder: "관제점 이름",
  1074. dataSource: Y_Left_setDataSource1,
  1075. displayExpr: "ControlPoint",
  1076. valueExpr: ""
  1077. });
  1078. $("#Y_Right1_Point_Type_Id").dxSelectBox({
  1079. placeholder: "관제점 타입",
  1080. dataSource: Y_Right1_treeViewData,
  1081. displayExpr: "text",
  1082. value: ""
  1083. });
  1084. $("#Y_Right1_FacilityTypeId").dxSelectBox({
  1085. placeholder: "설비 타입",
  1086. dataSource: Y_Right1_facility_type,
  1087. displayExpr: "text",
  1088. valueExpr: ""
  1089. });
  1090. $("#Y_Right1_FacilityCode").dxSelectBox({
  1091. placeholder: "설비 이름",
  1092. dataSource: Y_Right1_facility_id,
  1093. displayExpr: "text",
  1094. valueExpr: ""
  1095. });
  1096. $("#Y_Right1_ControlId").dxSelectBox({
  1097. placeholder: "관제점 이름",
  1098. dataSource: Y_Right1_setDataSource1,
  1099. displayExpr: "ControlPoint",
  1100. valueExpr: ""
  1101. });
  1102. $("#Y_Right2_Point_Type_Id").dxSelectBox({
  1103. placeholder: "관제점 타입",
  1104. dataSource: Y_Right2_treeViewData,
  1105. displayExpr: "text",
  1106. value: ""
  1107. });
  1108. $("#Y_Right2_FacilityTypeId").dxSelectBox({
  1109. placeholder: "설비 타입",
  1110. dataSource: Y_Right2_facility_type,
  1111. displayExpr: "text",
  1112. valueExpr: ""
  1113. });
  1114. $("#Y_Right2_FacilityCode").dxSelectBox({
  1115. placeholder: "설비 이름",
  1116. dataSource: Y_Right2_facility_id,
  1117. displayExpr: "text",
  1118. valueExpr: ""
  1119. });
  1120. $("#Y_Right2_ControlId").dxSelectBox({
  1121. placeholder: "관제점 이름",
  1122. dataSource: Y_Right2_setDataSource1,
  1123. displayExpr: "ControlPoint",
  1124. valueExpr: ""
  1125. });
  1126. // 초기값 설정
  1127. $("#Time_Interval").dxSelectBox("instance").option('value', 2);
  1128. $("#Y_Right1_Point_Type_Id").dxSelectBox("instance").option('value', 0);
  1129. $("#Y_Right2_Point_Type_Id").dxSelectBox("instance").option('value', 0);
  1130. // dxLoadPanel 패널
  1131. $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
  1132. $("#Chart_Free").dxChart({
  1133. dataSource: [],
  1134. //palette: "Bright",
  1135. legend: {
  1136. visible: false,
  1137. verticalAlignment: false
  1138. },
  1139. valueAxis: '',
  1140. })
  1141. $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
  1142. DataArrayforChart = [];
  1143. ChartDataArray = [];
  1144. ChartDataArray1 = [];
  1145. ChartDataArray2 = [];
  1146. ChartDataArray3 = [];
  1147. DataArrayforGrid = [];
  1148. GridDataArray = [];
  1149. GridDataArray1 = [];
  1150. GridDataArray2 = [];
  1151. GridDataArray3 = [];
  1152. Y_Left_maxValuecops = 0;
  1153. Y_Left_minValuecops = 0;
  1154. Y_Right1_maxValuecops = 0;
  1155. Y_Right1_minValuecops = 0;
  1156. Y_Right2_maxValuecops = 0;
  1157. Y_Right2_minValuecops = 0;
  1158. Y_Left_PointType = null;
  1159. Y_Left_formulaName = [];
  1160. Y_Left_ChartType = [];
  1161. Y_Left_facilityType = [];
  1162. Y_Left_facilityCode = [];
  1163. Y_Left_formula = [];
  1164. Y_Right1_PointType = null;
  1165. Y_Right1_formulaName = [];
  1166. Y_Right1_ChartType = [];
  1167. Y_Right1_facilityType = [];
  1168. Y_Right1_facilityCode = [];
  1169. Y_Right1_formula = [];
  1170. Y_Right2_PointType = null;
  1171. Y_Right2_formulaName = [];
  1172. Y_Right2_ChartType = [];
  1173. Y_Right2_facilityType = [];
  1174. Y_Right2_facilityCode = [];
  1175. Y_Right2_formula = [];
  1176. }
  1177. var viewModel = $.extend(BWA.CommonView.create(
  1178. params, viewInfo, ko.observable(null), ko.observable(null), handleViewShown, null,
  1179. handleSearchInSearchView, undefined), {
  1180. viewShown: function () {
  1181. // 사이드 메뉴
  1182. $SideMenu.showSideMenuIfWill(params.view);
  1183. // dxLoadPanel 패널
  1184. $("#LoadPanel").dxLoadPanel({
  1185. message: '로딩중...',
  1186. showIndicator: true,
  1187. visible: false
  1188. });
  1189. //초기화
  1190. handleEdit();
  1191. // 시간 정보
  1192. var now = new Date();
  1193. var year = now.getFullYear();
  1194. var month = now.getMonth();
  1195. var day = now.getDate();
  1196. var hour = now.getHours()
  1197. //var test = new Date(year, month, day);
  1198. // 데이터 주기
  1199. $("#Time_Interval").dxSelectBox({
  1200. dataSource: Time_Interval_Type,
  1201. displayExpr: "text",
  1202. valueExpr: "id"
  1203. });
  1204. // 조회 시작일
  1205. $("#Search_Date_Start").dxDateBox({
  1206. format: "date",
  1207. value: new Date(year, month, day - 1)
  1208. });
  1209. // 조회 시작 시간
  1210. $("#Search_Time_Start").dxDateBox({
  1211. format: "time",
  1212. value: new Date(year, month, day - 1, hour)
  1213. });
  1214. // 조회 종료일
  1215. $("#Search_Date_End").dxDateBox({
  1216. format: "date",
  1217. value: new Date(year, month, day)
  1218. });
  1219. // 조회 종료 시간
  1220. $("#Search_Time_End").dxDateBox({
  1221. format: "time",
  1222. value: new Date(year, month, day, hour)
  1223. });
  1224. $("#Time_Interval").dxSelectBox({
  1225. onValueChanged: function () {
  1226. var value = $("#Time_Interval").dxSelectBox('instance').option('value');
  1227. if (value == 3) {
  1228. $("#Search_Time_Start").dxDateBox("instance").option('disabled', true);
  1229. $("#Search_Time_End").dxDateBox("instance").option('disabled', true);
  1230. }
  1231. else {
  1232. $("#Search_Time_Start").dxDateBox("instance").option('disabled', false);
  1233. $("#Search_Time_End").dxDateBox("instance").option('disabled', false);
  1234. }
  1235. }
  1236. });
  1237. // Y 좌측 차트 ********************
  1238. Y_Left_GetPopupTreeViewData();
  1239. Y_Left_facility_type = "";
  1240. Y_Left_facility_id = "";
  1241. $("#Y_Left_Point_Type_Id").dxSelectBox({
  1242. placeholder: "관제점 타입",
  1243. dataSource: Y_Left_treeViewData,
  1244. displayExpr: "text",
  1245. valueExpr: "id"
  1246. });
  1247. $("#Y_Left_FacilityTypeId").dxSelectBox({
  1248. placeholder: "설비 타입"
  1249. });
  1250. $("#Y_Left_FacilityCode").dxSelectBox({
  1251. placeholder: "설비 이름"
  1252. });
  1253. $("#Y_Left_ControlId").dxSelectBox({
  1254. placeholder: "관제점 이름"
  1255. });
  1256. $("#Y_Left_Point_Type_Id").dxSelectBox({
  1257. onValueChanged: function () {
  1258. Y_Left_facility_type = "";
  1259. Y_Left_facility_id = "";
  1260. Y_Left_setDataSource1 = "";
  1261. var value = $("#Y_Left_Point_Type_Id").dxSelectBox('instance').option('value');
  1262. if (value == null || value == "")
  1263. Y_Left_facility_type = "";
  1264. else
  1265. Y_Left_facility_type = Y_Left_treeViewData[value - 1].items;
  1266. $("#Y_Left_FacilityTypeId").dxSelectBox('instance').option('value', null);// 텍스트 클리어
  1267. $("#Y_Left_FacilityTypeId").dxSelectBox({// 두번째 콤보 바인딩
  1268. placeholder: "설비 타입",
  1269. dataSource: Y_Left_facility_type,
  1270. displayExpr: "text",
  1271. valueExpr: "id"
  1272. });
  1273. $("#Y_Left_FacilityCode").dxSelectBox('instance').option('value', null);// 텍스트 클리어
  1274. $("#Y_Left_FacilityCode").dxSelectBox({// 두번째 콤보 바인딩
  1275. placeholder: "설비 이름",
  1276. dataSource: Y_Left_facility_id,
  1277. displayExpr: "text",
  1278. valueExpr: "id"
  1279. });
  1280. $("#Y_Left_ControlId").dxSelectBox('instance').option('value', null);// 텍스트 클리어
  1281. $("#Y_Left_ControlId").dxSelectBox({// 두번째 콤보 바인딩
  1282. placeholder: "관제점 이름",
  1283. dataSource: Y_Left_setDataSource1,
  1284. displayExpr: "ControlPoint",
  1285. valueExpr: "FormulaId"
  1286. });
  1287. }
  1288. });
  1289. $("#Y_Left_FacilityTypeId").dxSelectBox({
  1290. onValueChanged: function () {
  1291. if (Y_Left_facility_type == "") {
  1292. var value1 = $("#Y_Left_Point_Type_Id").dxSelectBox('instance').option('value');
  1293. if (value1 == null || value1 == "")
  1294. Y_Left_facility_type = "";
  1295. else
  1296. Y_Left_facility_type = Y_Left_treeViewData[value1 - 1].items;
  1297. }
  1298. Y_Left_facility_id = "";
  1299. Y_Left_setDataSource1 = "";
  1300. var Pointtype = $("#Y_Left_Point_Type_Id").dxSelectBox('instance').option('value');
  1301. var value = $("#Y_Left_FacilityTypeId").dxSelectBox('instance').option('value');
  1302. if (Pointtype == 1)//성능분석
  1303. {
  1304. if (value != null) {
  1305. Y_Left_facility_id = Y_Left_facility_type[value - 4].items;
  1306. }
  1307. }
  1308. else if (Pointtype == 2) { //가상
  1309. if (value != null) {
  1310. Y_Left_facility_id = Y_Left_facility_type[0].items;
  1311. }
  1312. }
  1313. else { //일반
  1314. if (value != null) {
  1315. Y_Left_facility_id = Y_Left_facility_type[value - Y_Left_excnt].items;
  1316. }
  1317. }
  1318. $("#Y_Left_FacilityCode").dxSelectBox('instance').option('value', null);// 텍스트 클리어
  1319. $("#Y_Left_FacilityCode").dxSelectBox({// 두번째 콤보 바인딩
  1320. placeholder: "설비 이름",
  1321. dataSource: Y_Left_facility_id,
  1322. displayExpr: "text",
  1323. valueExpr: "id"
  1324. });
  1325. $("#Y_Left_ControlId").dxSelectBox('instance').option('value', null);// 텍스트 클리어
  1326. $("#Y_Left_ControlId").dxSelectBox({// 두번째 콤보 바인딩
  1327. placeholder: "관제점 이름",
  1328. dataSource: Y_Left_setDataSource1,
  1329. displayExpr: "ControlPoint",
  1330. valueExpr: "FormulaId"
  1331. });
  1332. }
  1333. });
  1334. $("#Y_Left_FacilityCode").dxSelectBox({
  1335. onValueChanged: function () {
  1336. if (Y_Left_facility_id == "") {
  1337. if (Y_Left_facility_type == "") {
  1338. var value1 = $("#Y_Left_Point_Type_Id").dxSelectBox('instance').option('value');
  1339. if (value1 == null || value1 == "")
  1340. Y_Left_facility_type = "";
  1341. else
  1342. Y_Left_facility_type = Y_Left_treeViewData[value1 - 1].items;
  1343. }
  1344. var Pointtype = $("#Y_Left_Point_Type_Id").dxSelectBox('instance').option('value');
  1345. var value = $("#Y_Left_FacilityTypeId").dxSelectBox('instance').option('value');
  1346. if (Pointtype == 1)//성능분석
  1347. {
  1348. if (value != null) {
  1349. Y_Left_facility_id = Y_Left_facility_type[value - 4].items;
  1350. }
  1351. }
  1352. else if (Pointtype == 2) { //가상
  1353. if (value != null) {
  1354. Y_Left_facility_id = Y_Left_facility_type[0].items;
  1355. }
  1356. }
  1357. else { //일반
  1358. if (value != null) {
  1359. Y_Left_facility_id = Y_Left_facility_type[value - Y_Left_excnt].items;
  1360. }
  1361. }
  1362. }
  1363. Y_Left_setDataSource1 = "";
  1364. var value = $("#Y_Left_FacilityCode").dxSelectBox('instance').option('value');
  1365. facilityTypeId_fin = 0, facilityCode_fin = 0, parentId_fin = 0;
  1366. if (value != null) {
  1367. for (var i = 0; i < Y_Left_facility_id.length; i++) {
  1368. if (Y_Left_facility_id[i].id == value) {
  1369. facilityTypeId_fin = Y_Left_facility_id[i].facilityTypeId;
  1370. facilityCode_fin = Y_Left_facility_id[i].facilityCode;
  1371. parentId_fin = Y_Left_facility_id[i].parentId;
  1372. facilityName_fin = Y_Left_facility_id[i].text;
  1373. break;
  1374. }
  1375. }
  1376. Y_Left_GetData(facilityTypeId_fin, facilityCode_fin, parentId_fin);
  1377. }
  1378. $("#Y_Left_ControlId").dxSelectBox('instance').option('value', null);// 텍스트 클리어
  1379. $("#Y_Left_ControlId").dxSelectBox({// 두번째 콤보 바인딩
  1380. placeholder: "관제점 이름",
  1381. dataSource: Y_Left_setDataSource1,
  1382. displayExpr: "ControlPoint",
  1383. valueExpr: "FormulaId",
  1384. });
  1385. }
  1386. });
  1387. $("#Y_Left_ControlId").dxSelectBox({
  1388. onValueChanged: function () {
  1389. var value = $("#Y_Left_ControlId").dxSelectBox('instance').option('text');
  1390. if (value != null) {
  1391. for (var i = 0; i < Y_Left_setDataSource1.length; i++) {
  1392. if (Y_Left_setDataSource1[i].ControlPoint == value) {
  1393. propertyId_fin = Y_Left_setDataSource1[i].PropertyId;
  1394. controlPoint_fin = Y_Left_setDataSource1[i].ControlPoint;
  1395. formulaId_fin = Y_Left_setDataSource1[i].FormulaId;
  1396. break;
  1397. }
  1398. }
  1399. }
  1400. }
  1401. });
  1402. if (Y_Left_changed) {
  1403. var Point_Type_Id_temp = 0;
  1404. for (var i = 0; i < Y_Left_treeViewData.length; i++) {
  1405. if (Y_Left_treeViewData[i].text == Point_Type_Id) {
  1406. Point_Type_Id_temp = Y_Left_treeViewData[i].id;
  1407. break;
  1408. }
  1409. }
  1410. $("#Y_Left_Point_Type_Id").dxSelectBox('instance').option('value', Point_Type_Id_temp);
  1411. var Y_Left_facility_type_Id_temp = 0;
  1412. for (var j = 0; j < Y_Left_treeViewData[Point_Type_Id_temp - 1].items.length; j++) {
  1413. if (Y_Left_treeViewData[Point_Type_Id_temp - 1].items[j].facilityTypeId == facilityTypeId) {
  1414. Y_Left_facility_type_Id_temp = Y_Left_treeViewData[Point_Type_Id_temp - 1].items[j].id;
  1415. break;
  1416. }
  1417. }
  1418. $("#Y_Left_FacilityTypeId").dxSelectBox('instance').option('value', Y_Left_facility_type_Id_temp);
  1419. var FacilityCode_temp = 0;
  1420. var facilityTypeId_temp = 0;
  1421. var parentId_temp = 0;
  1422. var delete_value
  1423. var FacilityCode_id_temp = 0;
  1424. if (Point_Type_Id_temp == 1) {
  1425. delete_value = 4;
  1426. }
  1427. else if (Point_Type_Id_temp == 2) {
  1428. delete_value = Y_Left_facility_type_Id_temp;
  1429. }
  1430. else {
  1431. delete_value = Y_Left_excnt;
  1432. }
  1433. for (var k = 0; k < Y_Left_treeViewData[Point_Type_Id_temp - 1].items[Y_Left_facility_type_Id_temp - delete_value].items.length; k++) {
  1434. if (Y_Left_treeViewData[Point_Type_Id_temp - 1].items[Y_Left_facility_type_Id_temp - delete_value].items[k].facilityCode == FacilityCode) {
  1435. FacilityCode_id_temp = Y_Left_treeViewData[Point_Type_Id_temp - 1].items[Y_Left_facility_type_Id_temp - delete_value].items[k].id;
  1436. FacilityCode_temp = Y_Left_treeViewData[Point_Type_Id_temp - 1].items[Y_Left_facility_type_Id_temp - delete_value].items[k].facilityCode;
  1437. facilityTypeId_temp = Y_Left_treeViewData[Point_Type_Id_temp - 1].items[Y_Left_facility_type_Id_temp - delete_value].items[k].facilityTypeId;
  1438. parentId_temp = Y_Left_treeViewData[Point_Type_Id_temp - 1].items[Y_Left_facility_type_Id_temp - delete_value].items[k].parentId;
  1439. break;
  1440. }
  1441. }
  1442. Y_Left_GetData(facilityTypeId_temp, FacilityCode_temp, parentId_temp);
  1443. }
  1444. // Y축 좌측 시리즈 선택
  1445. $("#Y_Left_ChartType").dxSelectBox({
  1446. items: [
  1447. "bar",
  1448. "line",
  1449. "area",
  1450. "scatter",
  1451. "spline",
  1452. "splinearea",
  1453. "stepline",
  1454. "steparea"
  1455. ],
  1456. value: "bar"
  1457. });
  1458. // Y 좌측 차트 ********************
  1459. // Y 우측(1) 차트 ********************
  1460. Y_Right1_GetPopupTreeViewData();
  1461. Y_Right1_facility_type = "";
  1462. Y_Right1_facility_id = "";
  1463. $("#Y_Right1_Point_Type_Id").dxSelectBox({
  1464. placeholder: "관제점 타입",
  1465. dataSource: Y_Right1_treeViewData,
  1466. displayExpr: "text",
  1467. valueExpr: "id"
  1468. });
  1469. $("#Y_Right1_FacilityTypeId").dxSelectBox({
  1470. placeholder: "설비 타입"
  1471. });
  1472. $("#Y_Right1_FacilityCode").dxSelectBox({
  1473. placeholder: "설비 이름"
  1474. });
  1475. $("#Y_Right1_ControlId").dxSelectBox({
  1476. placeholder: "관제점 이름"
  1477. });
  1478. $("#Y_Right1_Point_Type_Id").dxSelectBox({
  1479. onValueChanged: function () {
  1480. Y_Right1_facility_type = "";
  1481. Y_Right1_facility_id = "";
  1482. Y_Right1_setDataSource1 = "";
  1483. var value = $("#Y_Right1_Point_Type_Id").dxSelectBox('instance').option('value');
  1484. if (value == null || value == 0 || value == "")
  1485. Y_Right1_facility_type = "";
  1486. else
  1487. Y_Right1_facility_type = Y_Right1_treeViewData[value - 1].items;
  1488. $("#Y_Right1_FacilityTypeId").dxSelectBox('instance').option('value', null);// 텍스트 클리어
  1489. $("#Y_Right1_FacilityTypeId").dxSelectBox({// 두번째 콤보 바인딩
  1490. placeholder: "설비 타입",
  1491. dataSource: Y_Right1_facility_type,
  1492. displayExpr: "text",
  1493. valueExpr: "id"
  1494. });
  1495. $("#Y_Right1_FacilityCode").dxSelectBox('instance').option('value', null);// 텍스트 클리어
  1496. $("#Y_Right1_FacilityCode").dxSelectBox({// 두번째 콤보 바인딩
  1497. placeholder: "설비 이름",
  1498. dataSource: Y_Right1_facility_id,
  1499. displayExpr: "text",
  1500. valueExpr: "id"
  1501. });
  1502. $("#Y_Right1_ControlId").dxSelectBox('instance').option('value', null);// 텍스트 클리어
  1503. $("#Y_Right1_ControlId").dxSelectBox({// 두번째 콤보 바인딩
  1504. placeholder: "관제점 이름",
  1505. dataSource: Y_Right1_setDataSource1,
  1506. displayExpr: "ControlPoint",
  1507. valueExpr: "FormulaId"
  1508. });
  1509. }
  1510. });
  1511. $("#Y_Right1_FacilityTypeId").dxSelectBox({
  1512. onValueChanged: function () {
  1513. if (Y_Right1_facility_type == "") {
  1514. var value1 = $("#Y_Right1_Point_Type_Id").dxSelectBox('instance').option('value');
  1515. if (value1 == null || value1 == 0 || value1 == "")
  1516. Y_Right1_facility_type = "";
  1517. else
  1518. Y_Right1_facility_type = Y_Right1_treeViewData[value1 - 1].items;
  1519. }
  1520. Y_Right1_facility_id = "";
  1521. Y_Right1_setDataSource1 = "";
  1522. var Pointtype = $("#Y_Right1_Point_Type_Id").dxSelectBox('instance').option('value');
  1523. var value = $("#Y_Right1_FacilityTypeId").dxSelectBox('instance').option('value');
  1524. if (Pointtype == 1)//성능분석
  1525. {
  1526. if (value != null) {
  1527. Y_Right1_facility_id = Y_Right1_facility_type[value - 4].items;
  1528. }
  1529. }
  1530. else if (Pointtype == 2) { //가상
  1531. if (value != null) {
  1532. Y_Right1_facility_id = Y_Right1_facility_type[0].items;
  1533. }
  1534. }
  1535. else if (Pointtype == 3) { //일반
  1536. if (value != null) {
  1537. Y_Right1_facility_id = Y_Right1_facility_type[value - Y_Right1_excnt].items;
  1538. }
  1539. }
  1540. $("#Y_Right1_FacilityCode").dxSelectBox('instance').option('value', null);// 텍스트 클리어
  1541. $("#Y_Right1_FacilityCode").dxSelectBox({// 두번째 콤보 바인딩
  1542. placeholder: "설비 이름",
  1543. dataSource: Y_Right1_facility_id,
  1544. displayExpr: "text",
  1545. valueExpr: "id"
  1546. });
  1547. $("#Y_Right1_ControlId").dxSelectBox('instance').option('value', null);// 텍스트 클리어
  1548. $("#Y_Right1_ControlId").dxSelectBox({// 두번째 콤보 바인딩
  1549. placeholder: "관제점 이름",
  1550. dataSource: Y_Right1_setDataSource1,
  1551. displayExpr: "ControlPoint",
  1552. valueExpr: "FormulaId"
  1553. });
  1554. }
  1555. });
  1556. $("#Y_Right1_FacilityCode").dxSelectBox({
  1557. onValueChanged: function () {
  1558. if (Y_Right1_facility_id == "") {
  1559. if (Y_Right1_facility_type == "") {
  1560. var value1 = $("#Y_Right1_Point_Type_Id").dxSelectBox('instance').option('value');
  1561. if (value1 == null || value1 == 0 || value1 == "")
  1562. Y_Right1_facility_type = "";
  1563. else
  1564. Y_Right1_facility_type = Y_Right1_treeViewData[value1 - 1].items;
  1565. }
  1566. var Pointtype = $("#Y_Right1_Point_Type_Id").dxSelectBox('instance').option('value');
  1567. var value = $("#Y_Right1_FacilityTypeId").dxSelectBox('instance').option('value');
  1568. if (Pointtype == 1)//성능분석
  1569. {
  1570. if (value != null) {
  1571. Y_Right1_facility_id = Y_Right1_facility_type[value - 4].items;
  1572. }
  1573. }
  1574. else if (Pointtype == 2) { //가상
  1575. if (value != null) {
  1576. Y_Right1_facility_id = Y_Right1_facility_type[0].items;
  1577. }
  1578. }
  1579. else if (Pointtype == 3) { //일반
  1580. if (value != null) {
  1581. Y_Right1_facility_id = Y_Right1_facility_type[value - Y_Right1_excnt].items;
  1582. }
  1583. }
  1584. }
  1585. Y_Right1_setDataSource1 = "";
  1586. var value = $("#Y_Right1_FacilityCode").dxSelectBox('instance').option('value');
  1587. facilityTypeId_fin = 0, facilityCode_fin = 0, parentId_fin = 0;
  1588. if (value != null) {
  1589. for (var i = 0; i < Y_Right1_facility_id.length; i++) {
  1590. if (Y_Right1_facility_id[i].id == value) {
  1591. facilityTypeId_fin = Y_Right1_facility_id[i].facilityTypeId;
  1592. facilityCode_fin = Y_Right1_facility_id[i].facilityCode;
  1593. parentId_fin = Y_Right1_facility_id[i].parentId;
  1594. facilityName_fin = Y_Right1_facility_id[i].text;
  1595. break;
  1596. }
  1597. }
  1598. Y_Right1_GetData(facilityTypeId_fin, facilityCode_fin, parentId_fin);
  1599. }
  1600. $("#Y_Right1_ControlId").dxSelectBox('instance').option('value', null);// 텍스트 클리어
  1601. $("#Y_Right1_ControlId").dxSelectBox({// 두번째 콤보 바인딩
  1602. placeholder: "관제점 이름",
  1603. dataSource: Y_Right1_setDataSource1,
  1604. displayExpr: "ControlPoint",
  1605. valueExpr: "FormulaId",
  1606. });
  1607. }
  1608. });
  1609. $("#Y_Right1_ControlId").dxSelectBox({
  1610. onValueChanged: function () {
  1611. var value = $("#Y_Right1_ControlId").dxSelectBox('instance').option('text');
  1612. if (value != null) {
  1613. for (var i = 0; i < Y_Right1_setDataSource1.length; i++) {
  1614. if (Y_Right1_setDataSource1[i].ControlPoint == value) {
  1615. propertyId_fin = Y_Right1_setDataSource1[i].PropertyId;
  1616. controlPoint_fin = Y_Right1_setDataSource1[i].ControlPoint;
  1617. formulaId_fin = Y_Right1_setDataSource1[i].FormulaId;
  1618. break;
  1619. }
  1620. }
  1621. }
  1622. }
  1623. });
  1624. if (Y_Right1_changed) {
  1625. var Point_Type_Id_temp = 0;
  1626. for (var i = 0; i < Y_Right1_treeViewData.length; i++) {
  1627. if (Y_Right1_treeViewData[i].text == Point_Type_Id) {
  1628. Point_Type_Id_temp = Y_Right1_treeViewData[i].id;
  1629. break;
  1630. }
  1631. }
  1632. $("#Y_Right1_Point_Type_Id").dxSelectBox('instance').option('value', Point_Type_Id_temp);
  1633. var Y_Right1_facility_type_Id_temp = 0;
  1634. for (var j = 0; j < Y_Right1_treeViewData[Point_Type_Id_temp - 1].items.length; j++) {
  1635. if (Y_Right1_treeViewData[Point_Type_Id_temp - 1].items[j].facilityTypeId == facilityTypeId) {
  1636. Y_Right1_facility_type_Id_temp = Y_Right1_treeViewData[Point_Type_Id_temp - 1].items[j].id;
  1637. break;
  1638. }
  1639. }
  1640. $("#Y_Right1_FacilityTypeId").dxSelectBox('instance').option('value', Y_Right1_facility_type_Id_temp);
  1641. var FacilityCode_temp = 0;
  1642. var facilityTypeId_temp = 0;
  1643. var parentId_temp = 0;
  1644. var delete_value
  1645. var FacilityCode_id_temp = 0;
  1646. if (Point_Type_Id_temp == 1) {
  1647. delete_value = 4;
  1648. }
  1649. else if (Point_Type_Id_temp == 2) {
  1650. delete_value = Y_Right1_facility_type_Id_temp;
  1651. }
  1652. else {
  1653. delete_value = Y_Right1_excnt;
  1654. }
  1655. for (var k = 0; k < Y_Right1_treeViewData[Point_Type_Id_temp - 1].items[Y_Right1_facility_type_Id_temp - delete_value].items.length; k++) {
  1656. if (Y_Right1_treeViewData[Point_Type_Id_temp - 1].items[Y_Right1_facility_type_Id_temp - delete_value].items[k].facilityCode == FacilityCode) {
  1657. FacilityCode_id_temp = Y_Right1_treeViewData[Point_Type_Id_temp - 1].items[Y_Right1_facility_type_Id_temp - delete_value].items[k].id;
  1658. FacilityCode_temp = Y_Right1_treeViewData[Point_Type_Id_temp - 1].items[Y_Right1_facility_type_Id_temp - delete_value].items[k].facilityCode;
  1659. facilityTypeId_temp = Y_Right1_treeViewData[Point_Type_Id_temp - 1].items[Y_Right1_facility_type_Id_temp - delete_value].items[k].facilityTypeId;
  1660. parentId_temp = Y_Right1_treeViewData[Point_Type_Id_temp - 1].items[Y_Right1_facility_type_Id_temp - delete_value].items[k].parentId;
  1661. break;
  1662. }
  1663. }
  1664. Y_Right1_GetData(facilityTypeId_temp, FacilityCode_temp, parentId_temp);
  1665. }
  1666. // Y축 우측(1) 시리즈 선택
  1667. $("#Y_Right1_ChartType").dxSelectBox({
  1668. items: [
  1669. "bar",
  1670. "line",
  1671. "area",
  1672. "scatter",
  1673. "spline",
  1674. "splinearea",
  1675. "stepline",
  1676. "steparea"
  1677. ],
  1678. value: "bar"
  1679. });
  1680. // Y 우측(1) 차트 ********************
  1681. // Y 우측(2) 차트 ********************
  1682. Y_Right2_GetPopupTreeViewData();
  1683. Y_Right2_facility_type = "";
  1684. Y_Right2_facility_id = "";
  1685. $("#Y_Right2_Point_Type_Id").dxSelectBox({
  1686. placeholder: "관제점 타입",
  1687. dataSource: Y_Right2_treeViewData,
  1688. displayExpr: "text",
  1689. valueExpr: "id"
  1690. });
  1691. $("#Y_Right2_FacilityTypeId").dxSelectBox({
  1692. placeholder: "설비 타입"
  1693. });
  1694. $("#Y_Right2_FacilityCode").dxSelectBox({
  1695. placeholder: "설비 이름"
  1696. });
  1697. $("#Y_Right2_ControlId").dxSelectBox({
  1698. placeholder: "관제점 이름"
  1699. });
  1700. $("#Y_Right2_Point_Type_Id").dxSelectBox({
  1701. onValueChanged: function () {
  1702. Y_Right2_facility_type = "";
  1703. Y_Right2_facility_id = "";
  1704. Y_Right2_setDataSource1 = "";
  1705. var value = $("#Y_Right2_Point_Type_Id").dxSelectBox('instance').option('value');
  1706. if (value == null || value == 0 || value == "")
  1707. Y_Right2_facility_type = "";
  1708. else
  1709. Y_Right2_facility_type = Y_Right2_treeViewData[value - 1].items;
  1710. $("#Y_Right2_FacilityTypeId").dxSelectBox('instance').option('value', null);// 텍스트 클리어
  1711. $("#Y_Right2_FacilityTypeId").dxSelectBox({// 두번째 콤보 바인딩
  1712. placeholder: "설비 타입",
  1713. dataSource: Y_Right2_facility_type,
  1714. displayExpr: "text",
  1715. valueExpr: "id"
  1716. });
  1717. $("#Y_Right2_FacilityCode").dxSelectBox('instance').option('value', null);// 텍스트 클리어
  1718. $("#Y_Right2_FacilityCode").dxSelectBox({// 두번째 콤보 바인딩
  1719. placeholder: "설비 이름",
  1720. dataSource: Y_Right2_facility_id,
  1721. displayExpr: "text",
  1722. valueExpr: "id"
  1723. });
  1724. $("#Y_Right2_ControlId").dxSelectBox('instance').option('value', null);// 텍스트 클리어
  1725. $("#Y_Right2_ControlId").dxSelectBox({// 두번째 콤보 바인딩
  1726. placeholder: "관제점 이름",
  1727. dataSource: Y_Right2_setDataSource1,
  1728. displayExpr: "ControlPoint",
  1729. valueExpr: "FormulaId"
  1730. });
  1731. }
  1732. });
  1733. $("#Y_Right2_FacilityTypeId").dxSelectBox({
  1734. onValueChanged: function () {
  1735. if (Y_Right2_facility_type == "") {
  1736. var value1 = $("#Y_Right2_Point_Type_Id").dxSelectBox('instance').option('value');
  1737. if (value1 == null || value1 == 0 || value1 == "")
  1738. Y_Right2_facility_type = "";
  1739. else
  1740. Y_Right2_facility_type = Y_Right2_treeViewData[value1 - 1].items;
  1741. }
  1742. Y_Right2_facility_id = "";
  1743. Y_Right2_setDataSource1 = "";
  1744. var Pointtype = $("#Y_Right2_Point_Type_Id").dxSelectBox('instance').option('value');
  1745. var value = $("#Y_Right2_FacilityTypeId").dxSelectBox('instance').option('value');
  1746. if (Pointtype == 1)//성능분석
  1747. {
  1748. if (value != null) {
  1749. Y_Right2_facility_id = Y_Right2_facility_type[value - 4].items;
  1750. }
  1751. }
  1752. else if (Pointtype == 2) { //가상
  1753. if (value != null) {
  1754. Y_Right2_facility_id = Y_Right2_facility_type[0].items;
  1755. }
  1756. }
  1757. else { //일반
  1758. if (value != null) {
  1759. Y_Right2_facility_id = Y_Right2_facility_type[value - Y_Right2_excnt].items;
  1760. }
  1761. }
  1762. $("#Y_Right2_FacilityCode").dxSelectBox('instance').option('value', null);// 텍스트 클리어
  1763. $("#Y_Right2_FacilityCode").dxSelectBox({// 두번째 콤보 바인딩
  1764. placeholder: "설비 이름",
  1765. dataSource: Y_Right2_facility_id,
  1766. displayExpr: "text",
  1767. valueExpr: "id"
  1768. });
  1769. $("#Y_Right2_ControlId").dxSelectBox('instance').option('value', null);// 텍스트 클리어
  1770. $("#Y_Right2_ControlId").dxSelectBox({// 두번째 콤보 바인딩
  1771. placeholder: "관제점 이름",
  1772. dataSource: Y_Right2_setDataSource1,
  1773. displayExpr: "ControlPoint",
  1774. valueExpr: "FormulaId"
  1775. });
  1776. }
  1777. });
  1778. $("#Y_Right2_FacilityCode").dxSelectBox({
  1779. onValueChanged: function () {
  1780. if (Y_Right2_facility_id == "") {
  1781. if (Y_Right2_facility_type == "") {
  1782. var value1 = $("#Y_Right2_Point_Type_Id").dxSelectBox('instance').option('value');
  1783. if (value1 == null || value1 == 0 || value1 == "")
  1784. Y_Right2_facility_type = "";
  1785. else
  1786. Y_Right2_facility_type = Y_Right2_treeViewData[value1 - 1].items;
  1787. }
  1788. var Pointtype = $("#Y_Right2_Point_Type_Id").dxSelectBox('instance').option('value');
  1789. var value = $("#Y_Right2_FacilityTypeId").dxSelectBox('instance').option('value');
  1790. if (Pointtype == 1)//성능분석
  1791. {
  1792. if (value != null) {
  1793. Y_Right2_facility_id = Y_Right2_facility_type[value - 4].items;
  1794. }
  1795. }
  1796. else if (Pointtype == 2) { //가상
  1797. if (value != null) {
  1798. Y_Right2_facility_id = Y_Right2_facility_type[0].items;
  1799. }
  1800. }
  1801. else { //일반
  1802. if (value != null) {
  1803. Y_Right2_facility_id = Y_Right2_facility_type[value - Y_Right2_excnt].items;
  1804. }
  1805. }
  1806. }
  1807. Y_Right2_setDataSource1 = "";
  1808. var value = $("#Y_Right2_FacilityCode").dxSelectBox('instance').option('value');
  1809. facilityTypeId_fin = 0, facilityCode_fin = 0, parentId_fin = 0;
  1810. if (value != null) {
  1811. for (var i = 0; i < Y_Right2_facility_id.length; i++) {
  1812. if (Y_Right2_facility_id[i].id == value) {
  1813. facilityTypeId_fin = Y_Right2_facility_id[i].facilityTypeId;
  1814. facilityCode_fin = Y_Right2_facility_id[i].facilityCode;
  1815. parentId_fin = Y_Right2_facility_id[i].parentId;
  1816. facilityName_fin = Y_Right2_facility_id[i].text;
  1817. break;
  1818. }
  1819. }
  1820. Y_Right2_GetData(facilityTypeId_fin, facilityCode_fin, parentId_fin);
  1821. }
  1822. $("#Y_Right2_ControlId").dxSelectBox('instance').option('value', null);// 텍스트 클리어
  1823. $("#Y_Right2_ControlId").dxSelectBox({// 두번째 콤보 바인딩
  1824. placeholder: "관제점 이름",
  1825. dataSource: Y_Right2_setDataSource1,
  1826. displayExpr: "ControlPoint",
  1827. valueExpr: "FormulaId",
  1828. });
  1829. }
  1830. });
  1831. $("#Y_Right2_ControlId").dxSelectBox({
  1832. onValueChanged: function () {
  1833. var value = $("#Y_Right2_ControlId").dxSelectBox('instance').option('text');
  1834. if (value != null) {
  1835. for (var i = 0; i < Y_Right2_setDataSource1.length; i++) {
  1836. if (Y_Right2_setDataSource1[i].ControlPoint == value) {
  1837. propertyId_fin = Y_Right2_setDataSource1[i].PropertyId;
  1838. controlPoint_fin = Y_Right2_setDataSource1[i].ControlPoint;
  1839. formulaId_fin = Y_Right2_setDataSource1[i].FormulaId;
  1840. break;
  1841. }
  1842. }
  1843. }
  1844. }
  1845. });
  1846. if (Y_Right2_changed) {
  1847. var Point_Type_Id_temp = 0;
  1848. for (var i = 0; i < Y_Right2_treeViewData.length; i++) {
  1849. if (Y_Right2_treeViewData[i].text == Point_Type_Id) {
  1850. Point_Type_Id_temp = Y_Right2_treeViewData[i].id;
  1851. break;
  1852. }
  1853. }
  1854. $("#Y_Right2_Point_Type_Id").dxSelectBox('instance').option('value', Point_Type_Id_temp);
  1855. var Y_Right2_facility_type_Id_temp = 0;
  1856. for (var j = 0; j < Y_Right2_treeViewData[Point_Type_Id_temp - 1].items.length; j++) {
  1857. if (Y_Right2_treeViewData[Point_Type_Id_temp - 1].items[j].facilityTypeId == facilityTypeId) {
  1858. Y_Right2_facility_type_Id_temp = Y_Right2_treeViewData[Point_Type_Id_temp - 1].items[j].id;
  1859. break;
  1860. }
  1861. }
  1862. $("#Y_Right2_FacilityTypeId").dxSelectBox('instance').option('value', Y_Right2_facility_type_Id_temp);
  1863. var FacilityCode_temp = 0;
  1864. var facilityTypeId_temp = 0;
  1865. var parentId_temp = 0;
  1866. var delete_value
  1867. var FacilityCode_id_temp = 0;
  1868. if (Point_Type_Id_temp == 1) {
  1869. delete_value = 4;
  1870. }
  1871. else if (Point_Type_Id_temp == 2) {
  1872. delete_value = Y_Right2_facility_type_Id_temp;
  1873. }
  1874. else {
  1875. delete_value = Y_Right2_excnt;
  1876. }
  1877. for (var k = 0; k < Y_Right2_treeViewData[Point_Type_Id_temp - 1].items[Y_Right2_facility_type_Id_temp - delete_value].items.length; k++) {
  1878. if (Y_Right2_treeViewData[Point_Type_Id_temp - 1].items[Y_Right2_facility_type_Id_temp - delete_value].items[k].facilityCode == FacilityCode) {
  1879. FacilityCode_id_temp = Y_Right2_treeViewData[Point_Type_Id_temp - 1].items[Y_Right2_facility_type_Id_temp - delete_value].items[k].id;
  1880. FacilityCode_temp = Y_Right2_treeViewData[Point_Type_Id_temp - 1].items[Y_Right2_facility_type_Id_temp - delete_value].items[k].facilityCode;
  1881. facilityTypeId_temp = Y_Right2_treeViewData[Point_Type_Id_temp - 1].items[Y_Right2_facility_type_Id_temp - delete_value].items[k].facilityTypeId;
  1882. parentId_temp = Y_Right2_treeViewData[Point_Type_Id_temp - 1].items[Y_Right2_facility_type_Id_temp - delete_value].items[k].parentId;
  1883. break;
  1884. }
  1885. }
  1886. Y_Right2_GetData(facilityTypeId_temp, FacilityCode_temp, parentId_temp);
  1887. }
  1888. // Y축 우측(2) 시리즈 선택
  1889. $("#Y_Right2_ChartType").dxSelectBox({
  1890. items: [
  1891. "bar",
  1892. "line",
  1893. "area",
  1894. "scatter",
  1895. "spline",
  1896. "splinearea",
  1897. "stepline",
  1898. "steparea"
  1899. ],
  1900. value: "bar"
  1901. });
  1902. // Y 우측(2) 차트 ********************
  1903. var v1 = $("#Y_Right1_Point_Type_Id").dxSelectBox("instance").option('value', 0);
  1904. $("#Y_Right2_Point_Type_Id").dxSelectBox("instance").option('value', 0);
  1905. // 조회 버튼
  1906. $("#Button_Search").dxButton({
  1907. text: "조회",
  1908. onClick: function () {
  1909. Y_Left_PointType = $("#Y_Left_Point_Type_Id").dxSelectBox('instance').option('value');
  1910. Y_Left_formulaName = $("#Y_Left_ControlId").dxSelectBox('instance').option('text');
  1911. var Y_Left_ChartType = $("#Y_Left_ChartType").dxSelectBox('instance').option('text');
  1912. var Y_Left_facilityType = $("#Y_Left_FacilityTypeId").dxSelectBox('instance').option('value');
  1913. var Y_Left_facilityCode = $("#Y_Left_FacilityCode").dxSelectBox('instance').option('value');
  1914. var Y_Left_controlId = $("#Y_Left_ControlId").dxSelectBox('instance').option('value');
  1915. if (Y_Left_PointType == 1) //성능분석
  1916. Y_Left_facilityType = Y_Left_facilityType - 3;
  1917. else if (Y_Left_PointType == 2) //가상 시설
  1918. Y_Left_facilityType = 99;
  1919. else if (Y_Left_PointType == 3) // 일반 시설
  1920. Y_Left_facilityType = Y_Left_facilityType - 49;
  1921. for (var i = 0; i < Y_Left_facility_id.length; i++) {
  1922. if (Y_Left_facility_id[i].id == Y_Left_facilityCode) {
  1923. Y_Left_facilityCode = Y_Left_facility_id[i].facilityCode;
  1924. break;
  1925. }
  1926. }
  1927. Y_Right1_PointType = $("#Y_Right1_Point_Type_Id").dxSelectBox('instance').option('value');
  1928. if (Y_Right1_PointType == 0) { // 데이터 오류 방지
  1929. Y_Right1_formulaName = $("#Y_Left_ControlId").dxSelectBox('instance').option('text');
  1930. var Y_Right1_ChartType = $("#Y_Left_ChartType").dxSelectBox('instance').option('text');
  1931. var Y_Right1_facilityType = $("#Y_Left_FacilityTypeId").dxSelectBox('instance').option('value');
  1932. var Y_Right1_facilityCode = $("#Y_Left_FacilityCode").dxSelectBox('instance').option('value');
  1933. var Y_Right1_controlId = $("#Y_Left_ControlId").dxSelectBox('instance').option('value');
  1934. }
  1935. else {
  1936. Y_Right1_formulaName = $("#Y_Right1_ControlId").dxSelectBox('instance').option('text');
  1937. var Y_Right1_ChartType = $("#Y_Right1_ChartType").dxSelectBox('instance').option('text');
  1938. var Y_Right1_facilityType = $("#Y_Right1_FacilityTypeId").dxSelectBox('instance').option('value');
  1939. var Y_Right1_facilityCode = $("#Y_Right1_FacilityCode").dxSelectBox('instance').option('value');
  1940. var Y_Right1_controlId = $("#Y_Right1_ControlId").dxSelectBox('instance').option('value');
  1941. if (Y_Right1_PointType == 1) //성능분석
  1942. Y_Right1_facilityType = Y_Right1_facilityType - 3;
  1943. else if (Y_Right1_PointType == 2) //가상 시설
  1944. Y_Right1_facilityType = 99;
  1945. else if (Y_Right1_PointType == 3) // 일반 시설
  1946. Y_Right1_facilityType = Y_Right1_facilityType - 49;
  1947. for (var i = 0; i < Y_Right1_facility_id.length; i++) {
  1948. if (Y_Right1_facility_id[i].id == Y_Right1_facilityCode) {
  1949. Y_Right1_facilityCode = Y_Right1_facility_id[i].facilityCode;
  1950. break;
  1951. }
  1952. }
  1953. }
  1954. Y_Right2_PointType = $("#Y_Right2_Point_Type_Id").dxSelectBox('instance').option('value');
  1955. if (Y_Right2_PointType == 0) { // 데이터 오류 방지
  1956. Y_Right2_formulaName = $("#Y_Left_ControlId").dxSelectBox('instance').option('text');
  1957. var Y_Right2_ChartType = $("#Y_Left_ChartType").dxSelectBox('instance').option('text');
  1958. var Y_Right2_facilityType = $("#Y_Left_FacilityTypeId").dxSelectBox('instance').option('value');
  1959. var Y_Right2_facilityCode = $("#Y_Left_FacilityCode").dxSelectBox('instance').option('value');
  1960. var Y_Right2_controlId = $("#Y_Left_ControlId").dxSelectBox('instance').option('value');
  1961. }
  1962. else {
  1963. Y_Right2_formulaName = $("#Y_Right2_ControlId").dxSelectBox('instance').option('text');
  1964. var Y_Right2_ChartType = $("#Y_Right2_ChartType").dxSelectBox('instance').option('text');
  1965. var Y_Right2_facilityType = $("#Y_Right2_FacilityTypeId").dxSelectBox('instance').option('value');
  1966. var Y_Right2_facilityCode = $("#Y_Right2_FacilityCode").dxSelectBox('instance').option('value');
  1967. var Y_Right2_controlId = $("#Y_Right2_ControlId").dxSelectBox('instance').option('value');
  1968. if (Y_Right2_PointType == 1) //성능분석
  1969. Y_Right2_facilityType = Y_Right2_facilityType - 3;
  1970. else if (Y_Right2_PointType == 2) //가상 시설
  1971. Y_Right2_facilityType = 99;
  1972. else if (Y_Right2_PointType == 3) // 일반 시설
  1973. Y_Right2_facilityType = Y_Right2_facilityType - 49;
  1974. for (var i = 0; i < Y_Right2_facility_id.length; i++) {
  1975. if (Y_Right2_facility_id[i].id == Y_Right2_facilityCode) {
  1976. Y_Right2_facilityCode = Y_Right2_facility_id[i].facilityCode;
  1977. break;
  1978. }
  1979. }
  1980. }
  1981. var timeIntervalType = $("#Time_Interval").dxSelectBox('instance').option('value');
  1982. var start_date = $("#Search_Date_Start").dxDateBox('instance').option('value');
  1983. var end_date = $("#Search_Date_End").dxDateBox('instance').option('value');
  1984. if (timeIntervalType != 3) {
  1985. var start_time = $("#Search_Time_Start").dxDateBox('instance').option('value');
  1986. var end_time = $("#Search_Time_End").dxDateBox('instance').option('value');
  1987. }
  1988. // 시 선택
  1989. if (timeIntervalType == 1)
  1990. var timeType = $Code.TimeType.QUARTERMIN;
  1991. else if (timeIntervalType == 2)
  1992. var timeType = $Code.TimeType.HOUR;
  1993. else if (timeIntervalType == 3)
  1994. var timeType = $Code.TimeType.DAY;
  1995. // 필수 정보 확인
  1996. if (Y_Left_PointType == null || Y_Left_facilityType == null || Y_Left_facilityCode == null || Y_Left_controlId == null) {
  1997. utils.toast.show($G('Error_Formula_NotInputData'), 'error');
  1998. return;
  1999. }
  2000. if (Y_Right1_PointType != 0 && (Y_Right1_PointType == null || Y_Right1_facilityType == null || Y_Right1_facilityCode == null || Y_Right1_controlId == null)) {
  2001. utils.toast.show($G('Error_Formula_NotInputData'), 'error');
  2002. return;
  2003. }
  2004. if (Y_Right2_PointType != 0 && (Y_Right2_PointType == null || Y_Right2_facilityType == null || Y_Right2_facilityCode == null || Y_Right2_controlId == null)) {
  2005. utils.toast.show($G('Error_Formula_NotInputData'), 'error');
  2006. return;
  2007. }
  2008. // dxLoadPanel 패널 시작
  2009. $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
  2010. if (timeIntervalType != 3) {
  2011. startDate = new Date(start_date.getFullYear(), start_date.getMonth(), start_date.getDate(), start_time.getHours(), start_time.getMinutes());
  2012. endDate = new Date(end_date.getFullYear(), end_date.getMonth(), end_date.getDate(), end_time.getHours(), end_time.getMinutes());
  2013. }
  2014. else {
  2015. startDate = new Date(start_date.getFullYear(), start_date.getMonth(), start_date.getDate());
  2016. endDate = new Date(end_date.getFullYear(), end_date.getMonth(), end_date.getDate());
  2017. }
  2018. // 컨트롤러에 데이터 요청 (성능분석/일반설비,가상설비 별로 다르게 데이터를 요청해야한다) 2019.05.
  2019. var formulaGet = new BWA.Chart.FormulaGet(BWA.UserInfo.SiteId());
  2020. var virtualNormalPointHistory_CurrentValueGet = new BWA.Chart.VirtualNormalPointHistory_CurrentValueGet(BWA.UserInfo.SiteId());
  2021. var promises = [];
  2022. var commonParameters = {
  2023. TimeIntervalType: timeType,
  2024. StartDate: startDate,
  2025. EndDate: endDate
  2026. };
  2027. if (Y_Left_PointType == 1) {
  2028. var Y_Left_Parameters = {
  2029. FacilityTypeId: Y_Left_facilityType,
  2030. FacilityCode: Y_Left_facilityCode,
  2031. FormulaId: Y_Left_controlId,
  2032. };
  2033. }
  2034. else {
  2035. var Y_Left_Parameters = {
  2036. FacilityTypeId: Y_Left_facilityType,
  2037. FacilityCode: Y_Left_facilityCode,
  2038. PropertyId: Y_Left_controlId,
  2039. };
  2040. }
  2041. if (Y_Right1_PointType == 1) {
  2042. var Y_Right1_Parameters = {
  2043. FacilityTypeId: Y_Right1_facilityType,
  2044. FacilityCode: Y_Right1_facilityCode,
  2045. FormulaId: Y_Right1_controlId,
  2046. };
  2047. }
  2048. else {
  2049. var Y_Right1_Parameters = {
  2050. FacilityTypeId: Y_Right1_facilityType,
  2051. FacilityCode: Y_Right1_facilityCode,
  2052. PropertyId: Y_Right1_controlId,
  2053. };
  2054. }
  2055. if (Y_Right2_PointType == 1) {
  2056. var Y_Right2_Parameters = {
  2057. FacilityTypeId: Y_Right2_facilityType,
  2058. FacilityCode: Y_Right2_facilityCode,
  2059. FormulaId: Y_Right2_controlId,
  2060. };
  2061. }
  2062. else {
  2063. var Y_Right2_Parameters = {
  2064. FacilityTypeId: Y_Right2_facilityType,
  2065. FacilityCode: Y_Right2_facilityCode,
  2066. PropertyId: Y_Right2_controlId,
  2067. };
  2068. }
  2069. if (Y_Left_PointType == 1)
  2070. promises.push(formulaGet.apiGet(_.extend(Y_Left_Parameters, commonParameters)));
  2071. else
  2072. promises.push(virtualNormalPointHistory_CurrentValueGet.apiGet(_.extend(Y_Left_Parameters, commonParameters)));
  2073. if (Y_Right1_PointType == 1)
  2074. promises.push(formulaGet.apiGet(_.extend(Y_Right1_Parameters, commonParameters)));
  2075. else
  2076. promises.push(virtualNormalPointHistory_CurrentValueGet.apiGet(_.extend(Y_Right1_Parameters, commonParameters)));
  2077. if (Y_Right2_PointType == 1)
  2078. promises.push(formulaGet.apiGet(_.extend(Y_Right2_Parameters, commonParameters)));
  2079. else
  2080. promises.push(virtualNormalPointHistory_CurrentValueGet.apiGet(_.extend(Y_Right2_Parameters, commonParameters)));
  2081. DataArrayforChart = [];
  2082. ChartDataArray = [];
  2083. ChartDataArray1 = [];
  2084. ChartDataArray2 = [];
  2085. ChartDataArray3 = [];
  2086. DataArrayforGrid = [];
  2087. GridDataArray = [];
  2088. GridDataArray1 = [];
  2089. GridDataArray2 = [];
  2090. GridDataArray3 = [];
  2091. Y_Left_maxValuecops = 0;
  2092. Y_Right1_maxValuecops = 0;
  2093. Y_Right2_maxValuecops = 0;
  2094. $.when.apply(this, promises).done(function (values, value2, value3) {
  2095. if (Y_Left_PointType != 1)
  2096. values[0] = values[0][0];
  2097. if (Y_Right1_PointType != 1)
  2098. value2[0] = value2[0][0];
  2099. if (Y_Right2_PointType != 1)
  2100. value3[0] = value3[0][0];
  2101. _.each(values[0], function (x) {
  2102. if (Y_Left_maxValuecops < x.Value) Y_Left_maxValuecops = x.Value;
  2103. if (Y_Left_minValuecops >= x.Value) Y_Left_minValuecops = x.Value;
  2104. ChartDataArray.push({
  2105. DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeType, moment(x.DateTime).toDate()),
  2106. value1: x.Value
  2107. });
  2108. ChartDataArray1.push({
  2109. DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeType, moment(x.DateTime).toDate()),
  2110. value1: x.Value
  2111. });
  2112. ChartDataArray2.push({
  2113. DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeType, moment(x.DateTime).toDate()),
  2114. value1: x.Value
  2115. });
  2116. ChartDataArray3.push({
  2117. DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeType, moment(x.DateTime).toDate()),
  2118. value1: x.Value
  2119. });
  2120. DataArrayforChart = ChartDataArray;
  2121. });
  2122. if (Y_Right1_PointType != 0 && Y_Right2_PointType == 0) {
  2123. var i = 0;
  2124. _.each(value2[0], function (x) {
  2125. if (Y_Right1_maxValuecops < x.Value) Y_Right1_maxValuecops = x.Value;
  2126. if (Y_Right1_minValuecops >= x.Value) Y_Right1_minValuecops = x.Value;
  2127. ChartDataArray1[i].value2 = x.Value;
  2128. ChartDataArray3[i].value2 = x.Value;
  2129. i++;
  2130. });
  2131. DataArrayforChart = ChartDataArray1;
  2132. }
  2133. if (Y_Right1_PointType == 0 && Y_Right2_PointType != 0) {
  2134. var i = 0;
  2135. _.each(value3[0], function (x) {
  2136. if (Y_Right2_maxValuecops < x.Value) Y_Right2_maxValuecops = x.Value;
  2137. if (Y_Right2_minValuecops >= x.Value) Y_Right2_minValuecops = x.Value;
  2138. ChartDataArray2[i].value3 = x.Value;
  2139. ChartDataArray3[i].value3 = x.Value;
  2140. i++;
  2141. });
  2142. DataArrayforChart = ChartDataArray2;
  2143. }
  2144. if (Y_Right1_PointType != 0 && Y_Right2_PointType != 0) {
  2145. var i = 0;
  2146. _.each(value2[0], function (x) {
  2147. if (Y_Right1_maxValuecops < x.Value) Y_Right1_maxValuecops = x.Value;
  2148. if (Y_Right1_minValuecops >= x.Value) Y_Right1_minValuecops = x.Value;
  2149. ChartDataArray3[i].value2 = x.Value;
  2150. i++;
  2151. });
  2152. var i = 0;
  2153. _.each(value3[0], function (x) {
  2154. if (Y_Right2_maxValuecops < x.Value) Y_Right2_maxValuecops = x.Value;
  2155. if (Y_Right2_minValuecops >= x.Value) Y_Right2_minValuecops = x.Value;
  2156. ChartDataArray3[i].value3 = x.Value;
  2157. i++;
  2158. });
  2159. DataArrayforChart = ChartDataArray3;
  2160. }
  2161. //도표를 위한 데이터 업데이트
  2162. _.each(values[0], function (x) {
  2163. if (Y_Left_maxValuecops < x.Value) Y_Left_maxValuecops = x.Value;
  2164. if (Y_Left_minValuecops >= x.Value) Y_Left_minValuecops = x.Value;
  2165. GridDataArray.push({
  2166. DateTime: BWA.Chart.getCustermTimeArgumentAxisString($Code.TimeType.QUARTERMIN, moment(x.DateTime).toDate()),
  2167. value1: x.Value
  2168. });
  2169. GridDataArray1.push({
  2170. DateTime: BWA.Chart.getCustermTimeArgumentAxisString($Code.TimeType.QUARTERMIN, moment(x.DateTime).toDate()),
  2171. value1: x.Value
  2172. });
  2173. GridDataArray2.push({
  2174. DateTime: BWA.Chart.getCustermTimeArgumentAxisString($Code.TimeType.QUARTERMIN, moment(x.DateTime).toDate()),
  2175. value1: x.Value
  2176. });
  2177. GridDataArray3.push({
  2178. DateTime: BWA.Chart.getCustermTimeArgumentAxisString($Code.TimeType.QUARTERMIN, moment(x.DateTime).toDate()),
  2179. value1: x.Value
  2180. });
  2181. DataArrayforGrid = GridDataArray;
  2182. });
  2183. if (Y_Right1_PointType != 0 && Y_Right2_PointType == 0) {
  2184. var i = 0;
  2185. _.each(value2[0], function (x) {
  2186. if (Y_Right1_maxValuecops < x.Value) Y_Right1_maxValuecops = x.Value;
  2187. if (Y_Right1_minValuecops >= x.Value) Y_Right1_minValuecops = x.Value;
  2188. GridDataArray1[i].value2 = x.Value;
  2189. GridDataArray3[i].value2 = x.Value;
  2190. i++;
  2191. });
  2192. DataArrayforGrid = GridDataArray1;
  2193. }
  2194. if (Y_Right1_PointType == 0 && Y_Right2_PointType != 0) {
  2195. var i = 0;
  2196. _.each(value3[0], function (x) {
  2197. if (Y_Right2_maxValuecops < x.Value) Y_Right2_maxValuecops = x.Value;
  2198. if (Y_Right2_minValuecops >= x.Value) Y_Right2_minValuecops = x.Value;
  2199. GridDataArray2[i].value3 = x.Value;
  2200. GridDataArray3[i].value3 = x.Value;
  2201. i++;
  2202. });
  2203. DataArrayforGrid = GridDataArray2;
  2204. }
  2205. if (Y_Right1_PointType != 0 && Y_Right2_PointType != 0) {
  2206. var i = 0;
  2207. _.each(value2[0], function (x) {
  2208. if (Y_Right1_maxValuecops < x.Value) Y_Right1_maxValuecops = x.Value;
  2209. if (Y_Right1_minValuecops >= x.Value) Y_Right1_minValuecops = x.Value;
  2210. GridDataArray3[i].value2 = x.Value;
  2211. i++;
  2212. });
  2213. var i = 0;
  2214. _.each(value3[0], function (x) {
  2215. if (Y_Right2_maxValuecops < x.Value) Y_Right2_maxValuecops = x.Value;
  2216. if (Y_Right2_minValuecops >= x.Value) Y_Right2_minValuecops = x.Value;
  2217. GridDataArray3[i].value3 = x.Value;
  2218. i++;
  2219. });
  2220. DataArrayforGrid = GridDataArray3;
  2221. }
  2222. //도표를 위한 데이터 업데이트
  2223. $("#Chart_Free").dxChart({
  2224. dataSource: DataArrayforChart,
  2225. palette: "Bright",
  2226. legend: {
  2227. visible: true,
  2228. verticalAlignment: 'top',
  2229. horizontalAlignment: 'center'
  2230. },
  2231. commonSeriesSettings: {
  2232. argumentField: "DateTime",
  2233. selectionStyle: {
  2234. hatching: {
  2235. direction: "left"
  2236. }
  2237. }
  2238. },
  2239. valueAxis: valueAxis(Y_Left_formulaName, Y_Left_maxValuecops, Y_Right1_formulaName, Y_Right1_PointType, Y_Right1_maxValuecops, Y_Right2_formulaName, Y_Right2_PointType, Y_Right2_maxValuecops),
  2240. series: series(Y_Left_formulaName, Y_Left_ChartType, Y_Right1_formulaName, Y_Right1_ChartType, Y_Right1_PointType, Y_Right2_formulaName, Y_Right2_ChartType, Y_Right2_PointType),
  2241. crosshair: {
  2242. enabled: true,
  2243. width: 2,
  2244. horizontalLine: {
  2245. visible: false,
  2246. //color: 'skyblue',
  2247. dashStyle: 'dash'
  2248. },
  2249. verticalLine: {
  2250. visible: true,
  2251. color: 'black',
  2252. dashStyle: 'dash'
  2253. },
  2254. label: {
  2255. visible: true,
  2256. backgroundColor: "#949494",
  2257. font: {
  2258. color: "#fff",
  2259. size: 12,
  2260. }
  2261. }
  2262. },
  2263. panes: [{
  2264. name: 'topPane',
  2265. border: {
  2266. visible: false,
  2267. left: false,
  2268. right: false,
  2269. top: false,
  2270. color: 'gray'
  2271. }
  2272. }, ],
  2273. defaultPane: "topPane",
  2274. tooltip: {
  2275. format: 'fixedPoint',
  2276. enabled: true,
  2277. precision: 2,
  2278. },
  2279. })
  2280. // dxLoadPanel 패널 정지
  2281. $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
  2282. }).fail(function (error) {
  2283. // dxLoadPanel 패널 정지
  2284. $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
  2285. });
  2286. }
  2287. });
  2288. // 차트 세팅
  2289. function valueAxis(Y_Left_formulaName, Y_Left_maxValuecops, Y_Right1_formulaName, Y_Right1_PointType, Y_Right1_maxValuecops, Y_Right2_formulaName, Y_Right2_PointType, Y_Right2_maxValuecops) {
  2290. var valueAxis = '';
  2291. // 기본
  2292. var Y_Left_valueAxis = [{
  2293. pane: 'topPane',
  2294. name: 'value1',
  2295. position: 'left',
  2296. type: 'continuous',
  2297. valueType: 'numeric',
  2298. tickInterval: Math.round(Y_Left_maxValuecops / 5) + 1,
  2299. //valueMarginsEnabled: true,
  2300. //minValueMargin: 0,
  2301. //maxValueMargin: 0,
  2302. //min: Y_Left_minValuecops,
  2303. //max: Y_Left_maxValuecops,
  2304. label: {
  2305. //font: { color: '#c96374' },
  2306. visible: true,
  2307. },
  2308. title: {
  2309. text: Y_Left_formulaName
  2310. }
  2311. }];
  2312. var Y_Right1_valueAxis = [{
  2313. pane: 'topPane',
  2314. name: 'value2',
  2315. position: 'right',
  2316. type: 'continuous',
  2317. valueType: 'numeric',
  2318. tickInterval: Math.round(Y_Right1_maxValuecops / 5) + 1,
  2319. //valueMarginsEnabled: true,
  2320. //minValueMargin: 0,
  2321. //maxValueMargin: 0,
  2322. //min: Y_Right1_minValuecops,
  2323. //max: Y_Right1_maxValuecops,
  2324. label: {
  2325. font: { color: 'red' },
  2326. visible: true,
  2327. },
  2328. title: {
  2329. text: Y_Right1_formulaName
  2330. }
  2331. }];
  2332. var Y_Right2_valueAxis = [{
  2333. pane: 'topPane',
  2334. name: 'value3',
  2335. position: 'right',
  2336. type: 'continuous',
  2337. valueType: 'numeric',
  2338. tickInterval: Math.round(Y_Right2_maxValuecops / 5) + 1,
  2339. //valueMarginsEnabled: true,
  2340. //minValueMargin: 0,
  2341. //maxValueMargin: 0,
  2342. //min: Y_Right1_minValuecops,
  2343. //max: Y_Right1_maxValuecops,
  2344. label: {
  2345. font: { color: 'blue' },
  2346. visible: true,
  2347. },
  2348. title: {
  2349. text: Y_Right2_formulaName
  2350. }
  2351. }];
  2352. if (Y_Right1_PointType == 0 && Y_Right2_PointType == 0)
  2353. valueAxis = Y_Left_valueAxis;
  2354. else if (Y_Right1_PointType != 0 && Y_Right2_PointType == 0)
  2355. valueAxis = Y_Left_valueAxis.concat(Y_Right1_valueAxis);
  2356. else if (Y_Right1_PointType == 0 && Y_Right2_PointType != 0)
  2357. valueAxis = Y_Left_valueAxis.concat(Y_Right2_valueAxis);
  2358. else {
  2359. valueAxis = Y_Left_valueAxis.concat(Y_Right1_valueAxis);
  2360. valueAxis = valueAxis.concat(Y_Right2_valueAxis);
  2361. }
  2362. return valueAxis;
  2363. }
  2364. // 차트 세팅
  2365. function series(Y_Left_formulaName, Y_Left_ChartType, Y_Right1_formulaName, Y_Right1_ChartType, Y_Right1_PointType, Y_Right2_formulaName, Y_Right2_ChartType, Y_Right2_PointType) {
  2366. var series = '';
  2367. // 기본
  2368. var Y_Left_series = [{
  2369. axis: 'value1',
  2370. type: Y_Left_ChartType,
  2371. pane: 'topPane',
  2372. name: Y_Left_formulaName,
  2373. argumentField: "DateTime",
  2374. valueField: 'value1', //
  2375. //label: {
  2376. // visible: false,
  2377. //},
  2378. point: { size: 8 }
  2379. }];
  2380. var Y_Right1_series = [{
  2381. axis: 'value2',
  2382. type: Y_Right1_ChartType,
  2383. pane: 'topPane',
  2384. color: 'red',
  2385. name: Y_Right1_formulaName,
  2386. argumentField: "DateTime",
  2387. valueField: 'value2', //
  2388. //label: {
  2389. // visible: false,
  2390. //},
  2391. point: { size: 8 },
  2392. label: {
  2393. visible: false,
  2394. font: { color: 'red', },
  2395. }
  2396. }];
  2397. var Y_Right2_series = [{
  2398. axis: 'value3',
  2399. type: Y_Right2_ChartType,
  2400. pane: 'topPane',
  2401. color: 'blue',
  2402. name: Y_Right2_formulaName,
  2403. argumentField: "DateTime",
  2404. valueField: 'value3', //
  2405. //label: {
  2406. // visible: false,
  2407. //},
  2408. point: { size: 8 },
  2409. label: {
  2410. visible: false,
  2411. font: { color: 'blue', },
  2412. }
  2413. }];
  2414. if (Y_Right1_PointType == 0 && Y_Right2_PointType == 0)
  2415. series = Y_Left_series;
  2416. else if (Y_Right1_PointType != 0 && Y_Right2_PointType == 0)
  2417. series = Y_Left_series.concat(Y_Right1_series);
  2418. else if (Y_Right1_PointType == 0 && Y_Right2_PointType != 0)
  2419. series = Y_Left_series.concat(Y_Right2_series);
  2420. else {
  2421. series = Y_Left_series.concat(Y_Right1_series);
  2422. series = series.concat(Y_Right2_series);
  2423. }
  2424. return series;
  2425. }
  2426. }
  2427. // 2019.05.17 : 그리드 도표 작업 : 팝업창 추가
  2428. , Free_ChartDataGridPopup_ButtonClicked: DataGridPopup_ButtonClick
  2429. // 2019.05.17 : 그리드 도표 작업 : 팝업창 추가
  2430. });
  2431. // 2017.09.08 : 그리드 도표 작업 : 팝업창 추가
  2432. viewModel.Free_ChartDataGridPopupOptions = {
  2433. width: '700px',
  2434. height: '750px', // cyim 2017.05.30 : 테스트 결과 Devextreme 버그임. px 로 지정하면 초기 출력시 정확하게 가운데에 있지만, auto 설정시 화면아래에 위치하게 됨
  2435. contentTemplate: "content",
  2436. showTitle: true,
  2437. title: "도표",
  2438. visible: DataGridPopup_Visible,
  2439. dragEnabled: true,
  2440. closeOnOutsideClick: true,
  2441. shownAction: handlePopupShown,
  2442. animation: window.utils.popup.createAnimation()
  2443. };
  2444. // 2017.09.08 : 그리드 도표 작업 : 팝업창 추가
  2445. // 2017.09.08 : 그리드 도표 작업 : 팝업창 추가
  2446. // 주석이 너무 없음. 나중에 변경 작업을 진행하는 누군가가 시간 소비를 하지 않기 위해...남김
  2447. // 시간 포맷은 그래프에 귀속해야 되므로 포맷은 변경하지 않는 것이 유리함
  2448. // 전기,가스,수도 와 같이 선택적으로 변경해야 된다면 아래와 같이 캡션은 고정하지 말것
  2449. viewModel.Free_ChartDataGridOptions = {
  2450. dataSource: DataArrayforGrid,
  2451. paging: { pageSize: 17 },
  2452. columns: [
  2453. { dataField: 'DateTime', caption: "날짜", width: '50%', alignment: 'center', format: 'fixedPoint', precision: 2 },
  2454. { dataField: 'value1', width: '50%', alignment: 'center', format: 'fixedPoint', precision: 2 },
  2455. ],
  2456. // 엑셀 출력
  2457. "export": {
  2458. enabled: true,
  2459. fileName: '사용자 지정차트 데이터'
  2460. }
  2461. };
  2462. viewModel.Free_ChartDataGridPopupOptions1 = {
  2463. width: '700px',
  2464. height: '750px', // cyim 2017.05.30 : 테스트 결과 Devextreme 버그임. px 로 지정하면 초기 출력시 정확하게 가운데에 있지만, auto 설정시 화면아래에 위치하게 됨
  2465. contentTemplate: "content",
  2466. showTitle: true,
  2467. title: "도표",
  2468. visible: DataGridPopup_Visible1,
  2469. dragEnabled: true,
  2470. closeOnOutsideClick: true,
  2471. shownAction: handlePopupShown,
  2472. animation: window.utils.popup.createAnimation()
  2473. };
  2474. viewModel.Free_ChartDataGridOptions1 = {
  2475. dataSource: DataArrayforGrid,
  2476. paging: { pageSize: 17 },
  2477. columns: [
  2478. { dataField: 'DateTime', caption: "날짜", width: '50%', alignment: 'center', format: 'fixedPoint', precision: 2 },
  2479. { dataField: 'value1', width: '25%', alignment: 'center', format: 'fixedPoint', precision: 2 },
  2480. { dataField: 'value2', width: '25%', alignment: 'center', format: 'fixedPoint', precision: 2 },
  2481. ],
  2482. // 엑셀 출력
  2483. "export": {
  2484. enabled: true,
  2485. fileName: '사용자 지정차트 데이터'
  2486. }
  2487. };
  2488. viewModel.Free_ChartDataGridPopupOptions2 = {
  2489. width: '700px',
  2490. height: '750px', // cyim 2017.05.30 : 테스트 결과 Devextreme 버그임. px 로 지정하면 초기 출력시 정확하게 가운데에 있지만, auto 설정시 화면아래에 위치하게 됨
  2491. contentTemplate: "content",
  2492. showTitle: true,
  2493. title: "도표",
  2494. visible: DataGridPopup_Visible2,
  2495. dragEnabled: true,
  2496. closeOnOutsideClick: true,
  2497. shownAction: handlePopupShown,
  2498. animation: window.utils.popup.createAnimation()
  2499. };
  2500. viewModel.Free_ChartDataGridOptions2 = {
  2501. dataSource: DataArrayforGrid,
  2502. paging: { pageSize: 17 },
  2503. columns: [
  2504. { dataField: 'DateTime', caption: "날짜", width: '50%', alignment: 'center', format: 'fixedPoint', precision: 2 },
  2505. { dataField: 'value1', width: '25%', alignment: 'center', format: 'fixedPoint', precision: 2 },
  2506. { dataField: 'value3', width: '25%', alignment: 'center', format: 'fixedPoint', precision: 2 },
  2507. ],
  2508. // 엑셀 출력
  2509. "export": {
  2510. enabled: true,
  2511. fileName: '사용자 지정차트 데이터'
  2512. }
  2513. };
  2514. viewModel.Free_ChartDataGridPopupOptions3 = {
  2515. width: '700px',
  2516. height: '750px', // cyim 2017.05.30 : 테스트 결과 Devextreme 버그임. px 로 지정하면 초기 출력시 정확하게 가운데에 있지만, auto 설정시 화면아래에 위치하게 됨
  2517. contentTemplate: "content",
  2518. showTitle: true,
  2519. title: "도표",
  2520. visible: DataGridPopup_Visible3,
  2521. dragEnabled: true,
  2522. closeOnOutsideClick: true,
  2523. shownAction: handlePopupShown,
  2524. animation: window.utils.popup.createAnimation()
  2525. };
  2526. viewModel.Free_ChartDataGridOptions3 = {
  2527. dataSource: DataArrayforGrid,
  2528. paging: { pageSize: 17 },
  2529. columns: [
  2530. { dataField: 'DateTime', caption: "날짜", width: '25%', alignment: 'center' },//, format: 'fixedPoint', precision: 2, },
  2531. { dataField: 'value1', width: '25%', alignment: 'center', format: 'fixedPoint', precision: 2 },
  2532. { dataField: 'value2', width: '25%', alignment: 'center', format: 'fixedPoint', precision: 2 },
  2533. { dataField: 'value3', width: '25%', alignment: 'center', format: 'fixedPoint', precision: 2 },
  2534. ],
  2535. // 엑셀 출력
  2536. "export": {
  2537. enabled: true,
  2538. fileName: '사용자 지정차트 데이터'
  2539. }
  2540. };
  2541. // 2017.09.08 : 그리드 도표 작업 : 팝업창 추가
  2542. viewModel.handleEdit = handleEdit;
  2543. return viewModel;
  2544. };