esop.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=0.5">
  6. <!-- 一个小时刷新一下当前页 -->
  7. <meta http-equiv="refresh" content="3600">
  8. <title>E-SOP看板</title>
  9. <link href="/lib/bootstrap/bootstrap.min.css" rel="stylesheet" />
  10. <link href="/css/dashboard.css" rel="stylesheet" />
  11. <script type="text/javascript" src="/js/service.js"></script>
  12. <script type="text/javascript" src="/js/session.js"></script>
  13. <script type="text/javascript" src="/js/getService.js"></script>
  14. <script type="text/javascript" src="/js/service/method-get-service.js"></script>
  15. <script type="text/javascript" src="/lib/jquery-3.4.1.js"></script>
  16. <script type="text/javascript" src="/lib/jquery-3.4.1.min.js"></script>
  17. </head>
  18. <body id="container" class="container-fluid">
  19. <div class="row no-padding head-bar" style="height:81px">
  20. <div class="col-lg-1 col-md-1">
  21. </div>
  22. <div class="col-lg-4 col-md-4 page-title">
  23. E-SOP
  24. </div>
  25. <!-- <div class="col-lg-3 col-md-3 block-padding">
  26. <button type="button" class="btn btn-warning"
  27. onclick="window.location.replace('/pages/dashboard/warehouse.html');">仓库看板</button>
  28. <button type="button" class="btn btn-warning"
  29. onclick="window.location.replace('/pages/dashboard/produce.html');">制造看板</button>
  30. <button type="button" class="btn btn-warning"
  31. onclick="window.location.replace('/pages/dashboard/line.html');">产线看板</button>
  32. <button type="button" class="btn btn-warning"
  33. onclick="window.location.replace('/pages/dashboard/quality.html');">品质看板</button>
  34. </div> -->
  35. <div class="col-lg-4 col-md-4">
  36. </div>
  37. </div>
  38. <div class="my-container" id="div-main">
  39. <div class="row block-padding">
  40. <div class="col-lg-4 col-md-4">
  41. <h2>任务({{num}})</h2>
  42. <div style="height: 270px;">
  43. <div class="row">
  44. <div class="col-lg-2 col-md-2 center no-padding" style="width: 19%;">订单号</div>
  45. <div class="col-lg-2 col-md-2 center no-padding" style="width: 19%;">物料号</div>
  46. <div class="col-lg-2 col-md-2 center no-padding" style="width: 35%;">物料名称</div>
  47. <!-- <div class="col-lg-2 col-md-2 center no-padding" style="width: 20%;">规格</div> -->
  48. <div class="col-lg-2 col-md-2 center no-padding" style="width: 12%;">数量</div>
  49. <div class="col-lg-1 col-md-2 center no-padding" style="width: 10%;">操作</div>
  50. </div>
  51. <div class="row" v-for="task in taskList2" style="margin-bottom: 2px;">
  52. <div class="col-lg-2 col-md-2 center no-padding" style="width: 19%;">{{task.orderSheetCode}}</div>
  53. <div class="col-lg-2 col-md-2 center no-padding" style="width: 19%;">{{task.materialCode}}</div>
  54. <div style="width: 35%;overflow:hidden; word-break:break-all;white-space:nowrap" class="col-lg-2 col-md-2 center no-padding" >{{task.materialName}}</div>
  55. <!-- <div class="col-lg-2 col-md-2 center no-padding" style="width: 20%;">{{task.specs}}</div> -->
  56. <div class="col-lg-2 col-md-2 center no-padding" style="width: 12%;">{{task.qty}}</div>
  57. <div class="col-lg-1 col-md-2 center no-padding" style="width: 10%;">
  58. <button type="button" class="btn btn-xs btn-warning" @click="selectFile(task.materialCode)">文件</button>
  59. </div>
  60. </div>
  61. </div>
  62. <br/>
  63. <h2>文件<span id="marText"></span></h2>
  64. <div class="row">
  65. <div class="col-lg-2 col-md-2 center no-padding" style="width: 48%;">文件名</div>
  66. <div class="col-lg-2 col-md-2 center no-padding" style="width: 25%;">文件类型</div>
  67. <div class="col-lg-1 col-md-2 center no-padding" style="width: 25%;">操作</div>
  68. </div>
  69. <div class="row" v-for="task in taskList" style="margin-bottom: 2px;">
  70. <div class="col-lg-2 col-md-2 center no-padding" style="width: 48%;">{{task.fileName}}</div>
  71. <div class="col-lg-2 col-md-2 center no-padding" style="width: 25%;">{{task.fileType}}</div>
  72. <div class="col-lg-1 col-md-2 center no-padding" style="width: 25%;">
  73. <button type="button" class="btn btn-xs btn-warning" @click="showfile(task.fileName,task.fileType)">查看</button>
  74. </div>
  75. </div>
  76. </div>
  77. <div class="col-lg-8 col-md-8" >
  78. <img id="imgInfo" src="/files/imgInfo.jpg" width="100%" height="100%"/>
  79. <iframe id="frameMain" width="98%" border="0" frameborder="0" v-bind:src="filepath" style="background-color:#ffffff"></iframe>
  80. <img id="imgType" src="" width="auto" />
  81. <video id="videoType" src="" controls width="auto" > </video>
  82. <div id="textType" width="auto" ></div>
  83. </div>
  84. </div>
  85. </div>
  86. <!-- jQuery -->
  87. <script src="/lib/jquery.min.js"></script>
  88. <script src="/lib/vue.min.js"></script>
  89. <script src="/lib/echarts/echarts.min.js"></script>
  90. <script src="/lib/echarts/theme/macarons.js"></script>
  91. <script src="/js/service/produce-task.js"></script>
  92. <script type="text/javascript">
  93. $(function () {
  94. hideAll();
  95. $("#imgInfo").show();
  96. })
  97. function hideAll(){
  98. $("#frameMain").hide();
  99. $("#imgType").hide();
  100. $("#videoType").hide();
  101. $("#imgInfo").hide();
  102. }
  103. var marCode = "";
  104. // const taskList1 = [];//ServiceProduceTask.getEsopFileList();
  105. // const taskList2 = [];//ServiceProduceTask.getEsopTaskList();
  106. $("#frameMain").height($(window).height()-110);
  107. $("#imgType").height($(window).height()-110);
  108. $("#videoType").height($(window).height()-110);
  109. var vm = new Vue({
  110. el: '#div-main',
  111. data: {
  112. taskList: [],
  113. taskList2: [],
  114. filepath:"",
  115. num:0
  116. },
  117. methods: {
  118. showfile: function (name,file) {
  119. if(file=='pdf'){
  120. hideAll();
  121. $("#frameMain").show();
  122. this.filepath = "/lib/pdfjs/web/viewer.html?file=/upFiles/"+marCode+"/"+name;
  123. $("#videoType").attr('src',"");
  124. }else if(file=='jpg' || file=='jpeg' || file=='png'){
  125. hideAll();
  126. $("#imgType").show();
  127. $("#imgType").attr('src',"/upFiles/"+marCode+"/"+name);
  128. $("#videoType").attr('src',"");
  129. }else if(file=='avi' || file=='mov' || file=='rmvb' || file=='rm' || file=='flv' || file=='mp4' || file=='3gp'){
  130. hideAll();
  131. $("#videoType").show();
  132. $("#videoType").attr('src',"/upFiles/"+marCode+"/"+name);
  133. }else{
  134. alert("暂时不支持该类型文件的展示");
  135. }
  136. },
  137. selectFile: function(code){
  138. marCode = code;
  139. $("#marText").text("("+code+")");
  140. this.taskList = ServiceProduceTask.getEsopFileList(code);
  141. },
  142. loadData:function(){
  143. this.cacheDataObject = {};
  144. //
  145. const taskList2 = ServiceProduceTask.getEsopTaskList();
  146. this.num = taskList2.length;
  147. this.cacheDataObject.taskList2 = {
  148. data: taskList2,
  149. pagesize: 11,
  150. pageindex: 0
  151. }
  152. this.taskList2 = taskList2.slice(0, this.cacheDataObject.taskList2.pagesize);
  153. },
  154. // 从服务器加载数据并显示
  155. refreshData: function () {
  156. // 关闭定时器
  157. clearInterval(this.timer_short);
  158. this.loadData();
  159. // 开启定时器
  160. this.timer_short = setInterval(this.scrollData, 30000);
  161. },
  162. // 轮播数据
  163. scrollData: function () {
  164. for (var key in this.cacheDataObject) {
  165. const dataList = this.cacheDataObject[key].data;
  166. const pagesize = this.cacheDataObject[key].pagesize;
  167. var pageindex = this.cacheDataObject[key].pageindex + 1;
  168. if (dataList.length > pagesize) {
  169. const pagesum = (dataList.length / pagesize).toFixed(0) * 1 + (dataList.length %
  170. pagesize > 0 ? 1 : 0);
  171. if (pageindex >= pagesum)
  172. pageindex = 0;
  173. this.cacheDataObject[key].pageindex = pageindex;
  174. const startIndex = pageindex * pagesize;
  175. const remainSum = dataList.length - startIndex;
  176. const recordSum = remainSum >= pagesize ? pagesize : remainSum;
  177. const keyPar = dataList.slice(startIndex, startIndex + pagesize);
  178. if(keyPar.length < 1){
  179. continue;
  180. }
  181. this[key] = dataList.slice(startIndex, startIndex + pagesize);
  182. }
  183. }
  184. }
  185. },
  186. mounted() {
  187. this.timer_long = setInterval(this.refreshData, 60000);
  188. this.refreshData();
  189. },
  190. beforeDestroy() {
  191. clearInterval(this.timer_long);
  192. clearInterval(this.timer_short);
  193. }
  194. });
  195. </script>
  196. </body>
  197. </html>