demo.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  6. <link rel="shortcut icon" href="/img/logo.png" />
  7. <link rel="bookmark" href="/img/logo.png" />
  8. <link rel="stylesheet" href="../DashBoard.css?v3" />
  9. <script src="/Plugins/jquery-3.4.1/jquery-3.4.1.min.js"></script>
  10. <script src="/Plugins/xrequest/xrequest.min.js"></script>
  11. <script src="/Plugins/xcountto/xcountTo2.js"></script>
  12. <title>东科软件</title>
  13. </head>
  14. <body>
  15. <div class="m4_box_1920_1080">
  16. <div class="m4_box_title" onclick="showHelp()" style="cursor:pointer">
  17. <div class="m4_box_title_arrow"></div><div class="m4_box_title_arrow2"></div> <div>施釉工艺</div><span class="m4_box_title_loading" id="报表加载"></span>
  18. </div>
  19. <div class="m4_box_body">
  20. <div style="width:1720px;height:410px;display:flex;flex-direction:row;">
  21. <div style="width: 1335px;height:410px;">
  22. <!--1号机器人流量-->
  23. <canvas id="canvasRobot1" style="-moz-user-select: none;-webkit-user-select: none;-ms-user-select: none; height:410px;width:100%"></canvas>
  24. </div>
  25. <div style="width: 385px; height: 390px; padding-left:20px;">
  26. <!--流量-->
  27. <table cellspacing="0" cellpadding="0" border="0" style="width:100%;">
  28. <tr class="tr_title_warning">
  29. <td>平均流量 l/h</td>
  30. <td>累计流量 l </td>
  31. </tr>
  32. <tr class="tr_bg_light_warning" style="height:140px;">
  33. <td id="agv1" data-decimals="2" data-speed="2000" style="font-size: 40px; width: 50%"></td>
  34. <td id="sum1" data-speed="2000" style="font-size: 40px; width: 50%"></td>
  35. </tr>
  36. </table>
  37. </div>
  38. </div>
  39. <div style="width:1720px;height:410px;display:flex;flex-direction:row;">
  40. <div style="width: 1335px;height:410px;">
  41. <!--2号机器人流量-->
  42. <canvas id="canvasRobot2" style="-moz-user-select: none;-webkit-user-select: none;-ms-user-select: none; height:410px;width:100%"></canvas>
  43. </div>
  44. <div style="width: 385px; height: 390px; padding-left:20px;">
  45. <!--流量-->
  46. <table cellspacing="0" cellpadding="0" border="0" style="width:100%;">
  47. <tr class="tr_title_warning">
  48. <td>平均流量 l/h</td>
  49. <td>累计流量 l </td>
  50. </tr>
  51. <tr class="tr_bg_light_warning" style="height:140px;">
  52. <td id="agv2" data-decimals="2" data-speed="2000" style="font-size: 40px; width: 50%"></td>
  53. <td id="sum2" data-speed="2000" style="font-size: 40px; width: 50%"></td>
  54. </tr>
  55. </table>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. <script>
  61. //缺陷统计刷新时间
  62. var refreshTime1 = 10000;
  63. var currentTime1 = 0;
  64. var doGetData;
  65. var doGetTime;
  66. var frameHeight;
  67. var tableHeight;
  68. var offsetHeight = 20;
  69. $(document).ready(function () {
  70. initData();
  71. doGetData = setInterval(function () { timeUpdate(); }, 1000);
  72. });
  73. //帮助说明
  74. function showHelp() {
  75. var message = "统计说明:" + "\n";
  76. message += "这是文字说明这是文字说明这是文字说明这是文字说明这是文字说明这是文字说明这是文字说明" + "\n";
  77. message += "这是文字说明这是文字说明这是文字说明这是文字说明这是文字说明这是文字说明这是文字说明" + "\n";
  78. message += "这是文字说明这是文字说明这是文字说明这是文字说明这是文字说明这是文字说明这是文字说明" + "\n";
  79. alert(message);
  80. }
  81. function timeUpdate() {
  82. if (currentTime1 <= 0) {
  83. //clearData();
  84. loadData();
  85. currentTime1 = refreshTime1;
  86. }
  87. else {
  88. if (currentTime1 > 0) {
  89. $('#报表加载').html('刷新:' + currentTime1 / 1000 + ' 秒');
  90. currentTime1 = currentTime1 - 1000;
  91. }
  92. }
  93. }
  94. function clearData() {
  95. //清除数据
  96. //工序产量===================================
  97. //window.Robot1.data.labels = ['', '', '', '', '', '', ''];
  98. window.Robot1.data.datasets[1].data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  99. window.Robot1.update();
  100. //===================================================
  101. //window.Robot2.data.labels = ['', '', '', '', '', '', ''];
  102. window.Robot2.data.datasets[1].data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  103. window.Robot2.update();
  104. }
  105. function loadData() {
  106. $.get("demo.ashx?m=1", function (data) {
  107. var jsondata = JSON.parse(data);
  108. if (jsondata["success"] == true) {
  109. for (var i = 0; i < jsondata["rows"].length; i++) {
  110. window.Robot1.data.labels[i] = jsondata["rows"][i]["时间"];
  111. window.Robot1.data.datasets[0].data[i] = 1.50;
  112. window.Robot1.data.datasets[1].data[i] = jsondata["rows"][i]["流量"];
  113. window.Robot1.data.datasets[2].data[i] = 1.70;
  114. }
  115. var myDate = new Date();
  116. for (var j = myDate.getHours(); j < 24; j++) {
  117. window.Robot1.data.datasets[1].data[j] = null;
  118. }
  119. window.Robot1.update();
  120. }
  121. });
  122. $.get("demo.ashx?m=2", function (data) {
  123. var jsondata = JSON.parse(data);
  124. if (jsondata["success"] == true) {
  125. for (var i = 0; i < jsondata["rows"].length; i++) {
  126. window.Robot2.data.labels[i] = jsondata["rows"][i]["时间"];
  127. window.Robot2.data.datasets[0].data[i] = 1.50;
  128. window.Robot2.data.datasets[1].data[i] = jsondata["rows"][i]["流量"];
  129. window.Robot2.data.datasets[2].data[i] = 1.70;
  130. }
  131. var myDate = new Date();
  132. for (var j = myDate.getHours(); j < 24; j++) {
  133. window.Robot2.data.datasets[1].data[j] = null;
  134. }
  135. window.Robot2.update();
  136. }
  137. });
  138. $.get("demo.ashx?m=table1", function (data) {
  139. var jsondata = JSON.parse(data);
  140. if (jsondata["success"] == true) {
  141. $("#agv1").attr('data-to', jsondata["rows"][0]["平均流量"]);
  142. $("#agv1").countTo();
  143. $("#sum1").attr('data-to', jsondata["rows"][0]["累计流量"]);
  144. $("#sum1").countTo();
  145. }
  146. });
  147. $.get("demo.ashx?m=table2", function (data) {
  148. var jsondata = JSON.parse(data);
  149. if (jsondata["success"] == true) {
  150. $("#agv2").attr('data-to', jsondata["rows"][0]["平均流量"]);
  151. $("#agv2").countTo();
  152. $("#sum2").attr('data-to', jsondata["rows"][0]["累计流量"]);
  153. $("#sum2").countTo();
  154. }
  155. });
  156. ////机器人1=========================================
  157. //window.Robot1.data.datasets[0].data = [
  158. // 50,
  159. // 50,
  160. // 50,
  161. // 50,
  162. // 50,
  163. // 50,
  164. // 50
  165. //];
  166. //window.Robot1.data.datasets[1].data = [
  167. // randomScalingFactor(200) + 110,
  168. // randomScalingFactor(200) + 110,
  169. // randomScalingFactor(200) + 110,
  170. // randomScalingFactor(200) + 110,
  171. // randomScalingFactor(200) + 110,
  172. // randomScalingFactor(200) + 110,
  173. // randomScalingFactor(200) + 110
  174. //];
  175. //window.Robot1.data.datasets[2].data = [
  176. // 350,
  177. // 350,
  178. // 350,
  179. // 350,
  180. // 350,
  181. // 350,
  182. // 350
  183. //];
  184. //window.Robot1.update();
  185. ////===================================================
  186. ////机器人2=========================================
  187. //window.Robot2.data.datasets[0].data = [
  188. // 50,
  189. // 50,
  190. // 50,
  191. // 50,
  192. // 50,
  193. // 50,
  194. // 50
  195. //];
  196. //window.Robot2.data.datasets[1].data = [
  197. // randomScalingFactor(200) + 110,
  198. // randomScalingFactor(200) + 110,
  199. // randomScalingFactor(200) + 110,
  200. // randomScalingFactor(200) + 110,
  201. // randomScalingFactor(200) + 110,
  202. // randomScalingFactor(200) + 110,
  203. // randomScalingFactor(200) + 110
  204. //];
  205. //window.Robot2.data.datasets[2].data = [
  206. // 350,
  207. // 350,
  208. // 350,
  209. // 350,
  210. // 350,
  211. // 350,
  212. // 350
  213. //];
  214. //window.Robot2.update();
  215. ////===================================================
  216. }
  217. function initData() {
  218. window.chartColors = {
  219. red: 'rgb(255, 99, 132)',
  220. orange: 'rgb(255, 159, 64)',
  221. yellow: 'rgb(255, 250, 86)',
  222. green: 'rgb(75, 192, 192)',
  223. blue: 'rgb(54, 162, 250)',
  224. purple: 'rgb(153, 102, 255)',
  225. grey: 'rgb(231,233,237)'
  226. };
  227. var color = Chart.helpers.color;
  228. window.randomScalingFactor = function (num) {
  229. return Math.round(Math.random() * num);
  230. }
  231. Chart.defaults.global.defaultFontColor = 'white';
  232. Chart.defaults.global.defaultFontSize = 24;
  233. Chart.defaults.global.legend.display = false;
  234. //机器人1===========================================
  235. window.configRobot1 = {
  236. data: {
  237. labels: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23'],
  238. datasets: [{
  239. label: '最低预警线',
  240. backgroundColor: color(window.chartColors.orange).alpha(0.6).rgbString(),
  241. fill: false,
  242. borderColor: window.chartColors.orange,
  243. borderWidth: 2,
  244. pointRadius: 10,
  245. data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  246. },
  247. {
  248. label: '施釉机器人(1号)',
  249. backgroundColor: color(window.chartColors.blue).alpha(0.6).rgbString(),
  250. fill: false,
  251. borderColor: window.chartColors.blue,
  252. borderWidth: 2,
  253. pointRadius: 15,
  254. data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  255. },
  256. {
  257. label: '最高预警线',
  258. backgroundColor: color(window.chartColors.red).alpha(0.6).rgbString(),
  259. fill: false,
  260. borderColor: window.chartColors.red,
  261. borderWidth: 2,
  262. pointRadius: 10,
  263. data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  264. }
  265. ]
  266. },
  267. type: 'line',
  268. options: {
  269. legend: {
  270. display: true
  271. },
  272. title: {
  273. display: true,
  274. text: "施釉机器人(1号)流量统计"
  275. },
  276. tooltips: {
  277. mode: 'point',
  278. intersect: false
  279. },
  280. responsive: true,
  281. scales: {
  282. xAxes: [{
  283. stacked: false
  284. }],
  285. yAxes: [{
  286. display: true,
  287. stacked: false,
  288. ticks: {
  289. min: 1.4,
  290. stepSize: 0.05,
  291. max: 1.8
  292. }
  293. }]
  294. }
  295. }
  296. };
  297. var ctxRobot1 = document.getElementById("canvasRobot1").getContext("2d");
  298. window.Robot1 = new Chart(ctxRobot1, configRobot1);
  299. //===================================================
  300. //机器人2===========================================
  301. window.configRobot2 = {
  302. data: {
  303. labels: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23'],
  304. datasets: [{
  305. label: '最低预警线',
  306. backgroundColor: color(window.chartColors.orange).alpha(0.6).rgbString(),
  307. fill: false,
  308. borderColor: window.chartColors.orange,
  309. borderWidth: 2,
  310. pointRadius: 10,
  311. data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  312. },
  313. {
  314. label: '施釉机器人(2号)',
  315. backgroundColor: color(window.chartColors.blue).alpha(0.6).rgbString(),
  316. fill: false,
  317. borderColor: window.chartColors.blue,
  318. borderWidth: 2,
  319. pointRadius: 15,
  320. data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  321. },
  322. {
  323. label: '最高预警线',
  324. backgroundColor: color(window.chartColors.red).alpha(0.6).rgbString(),
  325. fill: false,
  326. borderColor: window.chartColors.red,
  327. borderWidth: 2,
  328. pointRadius: 10,
  329. data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  330. }
  331. ]
  332. },
  333. type: 'line',
  334. options: {
  335. legend: {
  336. display: true
  337. },
  338. title: {
  339. display: true,
  340. text: "施釉机器人(2号)流量统计"
  341. },
  342. tooltips: {
  343. mode: 'point',
  344. intersect: false
  345. },
  346. responsive: true,
  347. scales: {
  348. xAxes: [{
  349. stacked: false
  350. }],
  351. yAxes: [{
  352. display: true,
  353. stacked: false,
  354. ticks: {
  355. min: 1.4,
  356. stepSize: 0.05,
  357. max: 1.8
  358. }
  359. }]
  360. }
  361. }
  362. };
  363. var ctxRobot2 = document.getElementById("canvasRobot2").getContext("2d");
  364. window.Robot2 = new Chart(ctxRobot2, configRobot2);
  365. //===================================================
  366. }
  367. </script>
  368. <script src="/Plugins/chartjs-2.8.0/chart-2.8.min.js"></script>
  369. <!--<script src="/Plugins/chartjs-2.8.0/chartjs-plugin-datalabels.js"></script>-->
  370. <script src="/Plugins/chartjs-2.8.0/utils.js"></script>
  371. <script src="/Plugins/circleChart/circleChart.min.js"></script>
  372. </body>
  373. </html>