index.html 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <title>设备平台大数据中心</title>
  8. <link href="../css/bootstrap.css" rel="stylesheet">
  9. <link rel="stylesheet" href="../css/base.css">
  10. <link rel="stylesheet" href="../css/index.css">
  11. <style>
  12. .t_title{
  13. width: 100%;
  14. height: 100%;
  15. text-align: center;
  16. font-size: 2.5em;
  17. line-height: 80px;
  18. color: #fff;
  19. }
  20. #chart_map{
  21. cursor: pointer;
  22. }
  23. .t_show{
  24. position: absolute;
  25. top: 0;
  26. right: 0;
  27. border-radius: 2px;
  28. background: #2C58A6;
  29. padding: 2px 5px;
  30. color: #fff;
  31. cursor: pointer;
  32. }
  33. </style>
  34. </head>
  35. <body>
  36. <!--header-->
  37. <div class="header">
  38. <div class="bg_header">
  39. <div class="header_nav fl t_title">
  40. 服务平台大数据中心
  41. </div>
  42. </div>
  43. </div>
  44. <!--main-->
  45. <div class="data_content" style="height: 100vh;">
  46. <div class="data_bottom">
  47. <!--<div class="bottom_1 fl t_btn5" style="cursor: pointer;">
  48. <div class="t_line_box">
  49. <i class="t_l_line"></i>
  50. <i class="l_t_line"></i>
  51. </div>
  52. <div class="t_line_box">
  53. <i class="t_r_line"></i>
  54. <i class="r_t_line"></i>
  55. </div>
  56. <div class="t_line_box">
  57. <i class="l_b_line"></i>
  58. <i class="b_l_line"></i>
  59. </div>
  60. <div class="t_line_box">
  61. <i class="r_b_line"></i>
  62. <i class="b_r_line"></i>
  63. </div>
  64. <div class="main_title">
  65. <img src="../picture/t_7.png" alt="">
  66. 农村电商交易概况
  67. </div>
  68. <div class="main_table t_btn8">
  69. <img src="../picture/jichuang.jpg">
  70. <table>
  71. <thead>
  72. <tr>
  73. <th>设备状态</th>
  74. <th>空闲</th>
  75. </tr>
  76. </thead>
  77. <tbody>
  78. <tr>
  79. <td>设备名称</td>
  80. <td>设备名称</td>
  81. </tr>
  82. <tr>
  83. <td>型号</td>
  84. <td>型号</td>
  85. </tr>
  86. <tr>
  87. <td>主轴转速</td>
  88. <td>12000</td>
  89. </tr>
  90. <tr>
  91. <td>主轴倍率</td>
  92. <td>12000</td>
  93. </tr>
  94. <tr>
  95. <td>进给速度</td>
  96. <td>12000</td>
  97. </tr>
  98. <tr>
  99. <td>进给倍率</td>
  100. <td>12000</td>
  101. </tr>
  102. </tbody>
  103. </table>
  104. </div>
  105. </div>-->
  106. </div>
  107. </div>
  108. </body>
  109. <script src="../js/jquery.min.js"></script>
  110. <script src="../js/bootstrap.min.js"></script>
  111. <script src="../js/common.js"></script>
  112. <script src="../js/echarts.min.js"></script>
  113. <script src="../js/datatool.js"></script>
  114. <!-- <script src="scripts/china.js"></script> -->
  115. <script src="../js/guangxi.js"></script>
  116. <script type="text/javascript">
  117. // 假设设备信息的容器元素是一个 <div> 标签,并具有类名 "data_bottom"
  118. const container = document.querySelector('.data_bottom');
  119. var requestData;
  120. function init(){
  121. callAPI();
  122. // 首次调用函数开始刷新
  123. refreshPage();
  124. }
  125. function refreshPage() {
  126. setTimeout(function() {
  127. location.reload(true); // 重新加载页面,参数为 true 表示强制从服务器重新加载
  128. callAPI();
  129. }, 10000); // 设置10秒钟的定时器
  130. }
  131. function callAPI() {
  132. requestData = {
  133. // 根据你的后端要求构建 PageParam 对象
  134. pageParam: {
  135. // 可能需要添加具体的属性值,比如 pageSize, pageNumber 等等
  136. "openPage": "NO"
  137. }
  138. };
  139. $.ajax({
  140. url:"/admin/page/crudQuery/aDevice",
  141. type: "POST", // 指定请求类型为 POST
  142. contentType: "application/json", // 设置请求的内容类型为 JSON
  143. dataType: "JSON",
  144. data: JSON.stringify(requestData), // 将请求数据转换为 JSON 字符串
  145. success:function(resp){
  146. // 获取接口返回的设备信息数组
  147. const devices = resp.data.rows;
  148. // 循环遍历设备信息数组
  149. devices.forEach(device => {
  150. // 创建一个新的 div 元素用于展示设备信息
  151. const newDeviceDiv = document.createElement('div');
  152. newDeviceDiv.classList.add('bottom_1', 'fl', 't_btn5');
  153. // 构建设备信息的 HTML 结构
  154. newDeviceDiv.innerHTML = `
  155. <div class="main_title">
  156. <img src="../picture/t_7.png" alt="">
  157. ${device.deviceName ? device.deviceName : '未知'}
  158. </div>
  159. <div class="main_table t_btn8" id=\"${device.id}\">
  160. <img src="../picture/device/`+device.deviceModel+`.jpg" ">
  161. <table>
  162. <thead>
  163. <tr>
  164. <th>设备状态</th>
  165. <th>${device.deviceState}</th>
  166. </tr>
  167. </thead>
  168. <tbody>
  169. <tr>
  170. <td>设备厂家</td>
  171. <td>${device.factory? device.factory : '未知'}</td>
  172. </tr>
  173. <tr>
  174. <td>型号</td>
  175. <td>${device.deviceModel? device.deviceModel : '未知'}</td>
  176. </tr>
  177. <td>主程序号</td>
  178. <td>${device.mainProg}</td>
  179. </tr>
  180. <tr>
  181. <td>主轴转速</td>
  182. <td>${device.actSpindle}</td>
  183. </tr>
  184. <tr>
  185. <td>主轴倍率</td>
  186. <td>${device.spindleMagnification}</td>
  187. </tr>
  188. <tr>
  189. <td>进给速度</td>
  190. <td>${device.actFeed}</td>
  191. </tr>
  192. </tbody>
  193. </table>
  194. </div>
  195. `;
  196. // 将创建的设备信息 div 添加到容器中
  197. container.appendChild(newDeviceDiv);
  198. const deviceContainer = document.getElementById(device.id);
  199. deviceContainer.addEventListener('click', function() {
  200. // 点击事件触发时,构建新的请求数据
  201. var detailRequestData = {
  202. deviceId: device.id // 假设接口需要的参数是 deviceId
  203. };
  204. const id = device.id; // 假设设备元素的 ID 存储在 data-id 属性中
  205. // 动态创建链接并跳转
  206. const link = document.createElement('a');
  207. link.href = '/admin/bigScreenDetail/index.html?id=' + encodeURIComponent(id);
  208. link.target = '_blank'; // 设置链接在新标签页中打开
  209. document.body.appendChild(link);
  210. link.click();
  211. // 发送新的请求
  212. /*$.ajax({
  213. url: "/admin/page/crudQuery/deviceDetail",
  214. type: "POST",
  215. contentType: "application/json",
  216. dataType: "JSON",
  217. data: JSON.stringify(detailRequestData),
  218. success: function(detailResp) {
  219. // 成功返回数据后,渲染新页面
  220. renderDetailPage(detailResp);
  221. }
  222. });*/
  223. });
  224. });
  225. }
  226. });
  227. }
  228. init();
  229. </script>
  230. </html>