workShopBoard.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta
  6. name="viewport"
  7. content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
  8. />
  9. <title>index</title>
  10. <script type="text/javascript" src="../plugin/jquery.min.js"></script>
  11. <script type="text/javascript" src="../js/util.js"></script>
  12. <script type="text/javascript" src="../js/common.js"></script>
  13. <link rel="stylesheet" href="../css/common.css" />
  14. <link rel="stylesheet" href="../css/workShop.css" />
  15. <style>
  16. *,
  17. body {
  18. font-size: 0.18rem;
  19. }
  20. </style>
  21. </head>
  22. <script>
  23. $(window).load(function () {
  24. $(".loading").fadeOut();
  25. });
  26. //动态设置视口
  27. const setSize = () => {
  28. // 获取html元素
  29. const html = document.getElementsByTagName("html")[0];
  30. // 获取屏幕宽度
  31. const pageWidth = html.getBoundingClientRect().width;
  32. // 动态计算字体大小(rem)
  33. html.style.fontSize = pageWidth / 20 + "px";
  34. };
  35. setSize();
  36. window.addEventListener("resize", setSize, false);
  37. </script>
  38. <script type="text/javascript" src="../plugin/vue.js"></script>
  39. <script type="text/javascript" src="../plugin/datav.js"></script>
  40. <script type="text/javascript" src="../plugin/echarts.min.js"></script>
  41. <body>
  42. <div class="loading">
  43. <div class="load_box">
  44. <img src="../images/loading.gif" /> 看板加载中,请稍等...
  45. </div>
  46. </div>
  47. <div id="app" class="container">
  48. <div class="info_box" style="top: 4.84rem; left: 1.4rem; color: #ffffff">
  49. {{ warehouseNo }}
  50. </div>
  51. <div class="info_box" style="top: 6rem; left: 1.4rem; color: #85e0ff">
  52. {{ warehouseName }}
  53. </div>
  54. <dv-scroll-board
  55. ref="scrollBoard"
  56. :config="config"
  57. style="width: 12.4rem; height: 8rem; left: 6.6rem; top: 1.8rem"
  58. />
  59. </div>
  60. <script>
  61. var app = new Vue({
  62. el: "#app",
  63. data() {
  64. return {
  65. start: 0,
  66. length: 500,
  67. warehouseNo: "",
  68. warehouseId: null,
  69. warehouseName: "",
  70. header: [
  71. '<span style="color:#85E0FF;font-size:0.24rem">模检具名称</span>',
  72. '<span style="color:#85E0FF;font-size:0.24rem">模检具状态</span>',
  73. '<span style="color:#85E0FF;font-size:0.24rem">零件编号</span>',
  74. '<span style="color:#85E0FF;font-size:0.24rem">使用时间(小时)</span>',
  75. '<span style="color:#85E0FF;font-size:0.24rem">使用次数</span>',
  76. '<span style="color:#85E0FF;font-size:0.24rem">是否需要保养</span>',
  77. ],
  78. config: {},
  79. };
  80. },
  81. methods: {
  82. // 获取车间信息
  83. getWarehouseInfo() {
  84. const _self = this;
  85. const url = "/api/WarehouseResource/queryByWarehouseId";
  86. const params = [["warehouseId", _self.warehouseId]];
  87. ajaxGet(url, params).then((success) => {
  88. if (success.errorCode === 0) {
  89. _self.warehouseNo = success.data.no;
  90. _self.warehouseName = success.data.name;
  91. }
  92. });
  93. },
  94. // 获取表格数据
  95. getTableDatas() {
  96. const _self = this;
  97. const url =
  98. "/api/BulletinBoardResource/queryBoardInventoryByWarehouse";
  99. const params = [
  100. ["start", _self.start],
  101. ["length", _self.length],
  102. ["warehouseId", _self.warehouseId],
  103. ];
  104. ajaxGet(url, params).then((success) => {
  105. if (success.errorCode === 0) {
  106. if (success.datas && success.datas.length > 0) {
  107. const configData = success.datas.map((item) => [
  108. item.name,
  109. item.inventoryStatus,
  110. item.no,
  111. item.useDate,
  112. item.useCount,
  113. item.needMaintain == true ? "是" : "否",
  114. ]);
  115. // 配置轮播表属性
  116. _self.config = {
  117. header: _self.header,
  118. headerHeight: 60,
  119. rowNum: 10,
  120. waitTime: 8000,
  121. carousel: "page",
  122. hoverPause: false,
  123. data: configData,
  124. headerBGC: "#112f6e",
  125. oddRowBGC: "#06105a",
  126. evenRowBGC: "#19225e",
  127. align: [
  128. "center",
  129. "center",
  130. "center",
  131. "center",
  132. "center",
  133. "center",
  134. ],
  135. columnWidth: [260, 160, 350, 200, 180, 200],
  136. };
  137. }
  138. }
  139. });
  140. },
  141. },
  142. mounted() {
  143. const _self = this;
  144. this.warehouseId = getQueryString("warehouseId");
  145. _self.getTableDatas();
  146. _self.getWarehouseInfo();
  147. _self.timer = setInterval(() => {
  148. _self.getTableDatas();
  149. _self.getWarehouseInfo();
  150. }, 6000 * 10 * 6);
  151. },
  152. beforeUnmount() {
  153. const _self = this;
  154. clearInterval(_self.timer);
  155. _self.timer = null;
  156. },
  157. });
  158. </script>
  159. </body>
  160. </html>