OnlineMonitorFooter.cshtml 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. @using Applications.UniversalApi_WebConsole_App.Models.OnlineMonitor
  2. @model Applications.UniversalApi_WebConsole_App.Models.OnlineMonitor.PageNavigationInfo
  3. @{
  4. int screenWidth = 1280;
  5. }
  6. <div id="PumpsPage_Bottom" style="position: absolute; top:@(635-65)px;width:@(screenWidth)px; height: 65px;">
  7. <div id="PumpsPage_Bottom_tabs_blank" style="position: relative; float: left; width: 2%; height: 100%;"></div>
  8. <div id="PumpsPage_Bottom_tabs" style="position: relative; float: left; width: 73%; height: 100%;">
  9. @{
  10. string nozzleTablevisibilty = (Model != null && Model.CurrentTab == Operation.NozzleView) ? "visible" : "hidden";
  11. string nozzleTextcolor = (nozzleTablevisibilty == "visible") ? "white" : "brown";
  12. string pumpTablevisibilty = (Model == null || Model.CurrentTab == Operation.PumpView) ? "visible" : "hidden";
  13. string pumpTextcolor = (pumpTablevisibilty == "visible") ? "white" : "brown";
  14. string chartTablevisibilty = (Model != null && Model.CurrentTab == Operation.ChartView) ? "visible" : "hidden";
  15. string chartTextcolor = (chartTablevisibilty == "visible") ? "white" : "brown";
  16. string uploadTablevisibilty = (Model != null && Model.CurrentTab == Operation.UploadView) ? "visible" : "hidden";
  17. string uploadTextcolor = (uploadTablevisibilty == "visible") ? "white" : "brown";
  18. }
  19. <img id="PumpsPage_Bottom_tab_nozzle" src="~/images/onlineMonitor/footer/pagTab.png" style="position: relative; margin-left: 10px; margin-top: 15px;visibility: @nozzleTablevisibilty" />
  20. <span id="PumpsPage_Bottom_tab_nozzle_text" onclick="TabClicked(this.id)" style="position: absolute; left: 20px; top: 15px; width: 130px; height: 37px; line-height: 37px; text-align: center; color:@nozzleTextcolor; font-size: 22px;">
  21. 油枪查看
  22. </span>
  23. <img id="PumpsPage_Bottom_tab_pumps" src="~/images/onlineMonitor/footer/pagTab.png" style="position: relative; margin-left: 10px; margin-top: 15px;visibility: @pumpTablevisibilty" />
  24. <span id="PumpsPage_Bottom_tab_pumps_text" onclick="TabClicked(this.id)" style="position: absolute; left: @(140 + 2 * 10 + 2 * 10)px; top: 15px; width: 130px; height: 37px; line-height: 37px; text-align: center; color:@pumpTextcolor; font-size: 22px;">
  25. 油机总览
  26. </span>
  27. <img id="PumpsPage_Bottom_tab_tables" src="~/images/onlineMonitor/footer/pagTab.png" style="position: relative; margin-left: 10px; margin-top: 15px;visibility: @chartTablevisibilty" />
  28. <span id="PumpsPage_Bottom_tab_tables_text" onclick="TabClicked(this.id)" style="position: absolute; left: @(2 * 140 + 2 * 10 + 2 * 10)px; top: 15px; width: 130px; height: 37px; line-height: 37px; text-align: center; color:@chartTextcolor; font-size: 22px;">
  29. 图表查询
  30. </span>
  31. <img id="PumpsPage_Bottom_tab_upload" src="~/images/onlineMonitor/footer/pagTab.png" style="position: relative; margin-left: 10px; margin-top: 15px;visibility: @uploadTablevisibilty" />
  32. <span id="PumpsPage_Bottom_tab_upload_text" onclick="TabClicked(this.id)" style="position: absolute; left: @(3 * 140 + 3 * 10 + 3 * 10)px; top: 15px; width: 130px; height: 37px; line-height: 37px; text-align: center; color:@uploadTextcolor; font-size: 22px;">
  33. 数据上传
  34. </span>
  35. </div>
  36. <div id="PumpsPage_Bottom_pages" style="position: relative; float: left; width: 25%; height: 100%;">
  37. @{
  38. var pagePointWidth = 16;
  39. var currentpageMargintop = (65 - pagePointWidth) / 2;
  40. var marginRight = 40;
  41. }
  42. @for (var p = 1; p < 6; p++)
  43. {
  44. var currentPageVisible = (p==1)?"visible":"hidden";
  45. var pageNotShowedVisible = (p == 1) ? "hidden" : "visible";
  46. <img id="PumpsPage_Bottom_pages_img_@p" src="~/images/onlineMonitor/footer/currentpage.png" style="position:absolute; left:@((pagePointWidth+marginRight)*(p-1))px;margin-top: @(currentpageMargintop)px;visibility: @currentPageVisible;" />
  47. <img id="PumpsPage_Bottom_pages_notshowed_img_@p" src="~/images/onlineMonitor/footer/notshowed.png" style="position:absolute; left:@((pagePointWidth+marginRight)*(p-1))px;margin-top: @(currentpageMargintop)px; visibility:@pageNotShowedVisible;" />
  48. }
  49. @*ShowPreviousPage() must be defined in the view which use this partial page,otherwise the page will crash*@
  50. <div id="previousPage" onclick="ShowPreviousPage()" style="position: absolute; width: 50%; height: 100%; left: 0px; top: 0px;"></div>
  51. <div id="nextPage" onclick="ShowNextPage()" style="position: absolute; width: 50%; height: 100%; left:50%; top: 0px;"></div>
  52. </div>
  53. </div>
  54. <script>
  55. var imgChart = document.getElementById("PumpsPage_Bottom_tab_tables");
  56. var imgUpload = document.getElementById("PumpsPage_Bottom_tab_upload");
  57. if ((imgChart!=null &&imgChart.style.visibility==="visible")||(imgUpload!=null && imgUpload.style.visibility==="visible")) {
  58. var pagesDiv = document.getElementById("PumpsPage_Bottom_pages");
  59. if (pagesDiv != null) {
  60. pagesDiv.style.visibility = "hidden";
  61. pagesDiv.style.display = "none";
  62. }
  63. }
  64. function TabClicked(tabId) {
  65. //var tab = document.getElementById(tabId);
  66. //tab.innerHTML = "Clicked";
  67. UpdateTabsDisplay(tabId);
  68. var taburl = "";
  69. if (tabId === "PumpsPage_Bottom_tab_tables_text")
  70. taburl = "/OnlineMonitor/Chart";
  71. //document.location = '@Url.Action("Index","OnlineMonitor",new{tab="ChartView"})';
  72. else if (tabId === "PumpsPage_Bottom_tab_nozzle_text") {
  73. taburl = "/OnlineMonitor/Nozzles";
  74. //document.location = '@Url.Action("Index","OnlineMonitor",new{tab="NozzleView"})';
  75. }
  76. else if (tabId === "PumpsPage_Bottom_tab_upload_text")
  77. taburl = "/OnlineMonitor/Upload";
  78. //document.location = '@Url.Action("Index","OnlineMonitor",new{tab="UploadView"})';
  79. else
  80. taburl = "/OnlineMonitor/Pumps";
  81. //document.location = '@Url.Action("Index","OnlineMonitor")';
  82. $.ajax({
  83. url: taburl,
  84. success: function(data) {
  85. $("#online_tabview").html(data);
  86. }
  87. });
  88. }
  89. function UpdateTabsDisplay(tab) {
  90. var nozzleTablevisibilty = (tab === "PumpsPage_Bottom_tab_nozzle_text") ? "visible" : "hidden";
  91. var nozzleTextcolor = (nozzleTablevisibilty === "visible") ? "white" : "brown";
  92. var pumpTablevisibilty = (tab === "PumpsPage_Bottom_tab_pumps_text") ? "visible" : "hidden";
  93. var pumpTextcolor = (pumpTablevisibilty === "visible") ? "white" : "brown";
  94. var chartTablevisibilty = (tab === "PumpsPage_Bottom_tab_tables_text") ? "visible" : "hidden";
  95. var chartTextcolor = (chartTablevisibilty === "visible") ? "white" : "brown";
  96. var uploadTablevisibilty = (tab === "PumpsPage_Bottom_tab_upload_text") ? "visible" : "hidden";
  97. var uploadTextcolor = (uploadTablevisibilty === "visible") ? "white" : "brown";
  98. if (client != null && client.connected) {
  99. client.end(true, function (err) {
  100. if (err != null) {
  101. console.log("error happens when call mqtt client end");
  102. }
  103. });
  104. client = null;
  105. }
  106. if (document.getElementById("PumpsPage_Bottom_tab_nozzle") !== null && document.getElementById("PumpsPage_Bottom_tab_nozzle_text")) {
  107. document.getElementById("PumpsPage_Bottom_tab_nozzle").style.visibility = nozzleTablevisibilty;
  108. document.getElementById("PumpsPage_Bottom_tab_nozzle_text").style.color = nozzleTextcolor;
  109. }
  110. if (document.getElementById("PumpsPage_Bottom_tab_pumps") !== null && document.getElementById("PumpsPage_Bottom_tab_pumps_text")) {
  111. document.getElementById("PumpsPage_Bottom_tab_pumps").style.visibility = pumpTablevisibilty;
  112. document.getElementById("PumpsPage_Bottom_tab_pumps_text").style.color = pumpTextcolor;
  113. }
  114. if (document.getElementById("PumpsPage_Bottom_tab_tables") !== null && document.getElementById("PumpsPage_Bottom_tab_tables_text")) {
  115. document.getElementById("PumpsPage_Bottom_tab_tables").style.visibility = chartTablevisibilty;
  116. document.getElementById("PumpsPage_Bottom_tab_tables_text").style.color = chartTextcolor;
  117. }
  118. if (document.getElementById("PumpsPage_Bottom_tab_upload") !== null && document.getElementById("PumpsPage_Bottom_tab_upload_text")) {
  119. document.getElementById("PumpsPage_Bottom_tab_upload").style.visibility = uploadTablevisibilty;
  120. document.getElementById("PumpsPage_Bottom_tab_upload_text").style.color = uploadTextcolor;
  121. }
  122. }
  123. @*function TabClicked(tabId) {
  124. //var tab = document.getElementById(tabId);
  125. //tab.innerHTML = "Clicked";
  126. if (tabId === "PumpsPage_Bottom_tab_tables_text")
  127. document.location = '@Url.Action("Index","OnlineMonitor",new{tab="ChartView"})';
  128. else if (tabId === "PumpsPage_Bottom_tab_nozzle_text")
  129. document.location = '@Url.Action("Index","OnlineMonitor",new{tab="NozzleView"})';
  130. else if (tabId === "PumpsPage_Bottom_tab_upload_text")
  131. document.location = '@Url.Action("Index","OnlineMonitor",new{tab="UploadView"})';
  132. else
  133. document.location = '@Url.Action("Index","OnlineMonitor")';
  134. }*@
  135. </script>