esop.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
  5. <meta http-equiv="Pragma" content="no-cache" />
  6. <meta http-equiv="Expires" content="0" />
  7. <meta charset="utf-8">
  8. <meta name="viewport" content="width=device-width, initial-scale=0.5">
  9. <title>E-SOP</title>
  10. <link href="/lib/bootstrap/bootstrap.min.css" rel="stylesheet" />
  11. <link href="/css/dashboard.css" rel="stylesheet" />
  12. <script type="text/javascript" src="/js/service.js"></script>
  13. <script type="text/javascript" src="/js/session.js"></script>
  14. <script type="text/javascript" src="/js/getService.js"></script>
  15. <script type="text/javascript" src="/js/service/method-get-service.js"></script>
  16. <script type="text/javascript" src="/lib/jquery-3.4.1.js"></script>
  17. <script type="text/javascript" src="/lib/jquery-3.4.1.min.js"></script>
  18. </head>
  19. <body id="container" class="container-fluid">
  20. <div class="row no-padding head-bar" style="height:81px">
  21. <div class="col-lg-1 col-md-1">
  22. </div>
  23. <div class="col-lg-4 col-md-4 page-title">
  24. E-SOP
  25. </div>
  26. <div class="col-lg-4 col-md-4 block-padding">
  27. <button type="button" class="btn btn-warning"
  28. onclick="window.location.replace('/pages/dashboard/warehouse.html');">仓库看板</button>
  29. <button type="button" class="btn btn-warning"
  30. onclick="window.location.replace('/pages/dashboard/produce.html');">制造看板</button>
  31. <button type="button" class="btn btn-warning"
  32. onclick="window.location.replace('/pages/dashboard/line.html');">产线看板</button>
  33. <button type="button" class="btn btn-warning"
  34. onclick="window.location.replace('/pages/dashboard/quality.html');">品质看板</button>
  35. <button type="button" class="btn btn-warning"
  36. onclick="window.location.replace('/pages/dashboard/video1.html');">云看板</button>
  37. </div>
  38. <div class="col-lg-4 col-md-4">
  39. </div>
  40. </div>
  41. <div class="my-container" id="div-main">
  42. <div class="row block-padding">
  43. <div class="col-lg-3 col-md-3">
  44. <h3>任务({{num}})
  45. <button style="background-color: #003D80;" @click="SYPage()">首页</button>
  46. <button style="background-color: #003D80;" @click="beforePage()">上页</button>
  47. <button style="background-color: #003D80;" @click="afterPage()">下页</button></h3>
  48. <div style="height: 270px;">
  49. <div class="row">
  50. <div class="col-lg-2 col-md-2 center no-padding" style="width: 19%;">订单号</div>
  51. <div class="col-lg-2 col-md-2 center no-padding" style="width: 19%;">物料号</div>
  52. <div class="col-lg-2 col-md-2 center no-padding" style="width: 35%;">物料名称</div>
  53. <!-- <div class="col-lg-2 col-md-2 center no-padding" style="width: 20%;">规格</div> -->
  54. <div class="col-lg-2 col-md-2 center no-padding" style="width: 12%;">数量</div>
  55. <div class="col-lg-1 col-md-2 center no-padding" style="width: 10%;">操作</div>
  56. </div>
  57. <div class="row" v-for="task in taskList2" style="margin-bottom: 2px;">
  58. <div class="col-lg-2 col-md-2 center no-padding" style="width: 19%;">{{task.orderSheetCode}}</div>
  59. <div class="col-lg-2 col-md-2 center no-padding" style="width: 19%;">{{task.materialCode}}</div>
  60. <div style="width: 35%;overflow:hidden; word-break:break-all;white-space:nowrap" class="col-lg-2 col-md-2 left no-padding" >{{task.materialName}}</div>
  61. <!-- <div class="col-lg-2 col-md-2 center no-padding" style="width: 20%;">{{task.specs}}</div> -->
  62. <div class="col-lg-2 col-md-2 center no-padding" style="width: 12%;">{{task.qty}}</div>
  63. <div class="col-lg-1 col-md-2 center no-padding" style="width: 10%;">
  64. <button type="button" class="btn btn-xs " :style="{background:task.color}" @click="selectFile(task.materialCode,task.orderSheetCode)">文件</button>
  65. </div>
  66. </div>
  67. <div class="row" >
  68. <div class="col-lg-2 col-md-2 center no-padding" style="width: 19%;"></div>
  69. <div class="col-lg-2 col-md-2 center no-padding" style="width: 19%;"></div>
  70. <div style="width: 33%;overflow:hidden; word-break:break-all;white-space:nowrap" class="col-lg-2 col-md-2 left no-padding" ></div>
  71. <!-- <div class="col-lg-2 col-md-2 center no-padding" style="width: 20%;">{{task.specs}}</div> -->
  72. <div class="col-lg-2 col-md-2 center no-padding" style="width: 12%;"><h5>第{{(pIndex+10)/10}}页</h5></div>
  73. <div class="col-lg-1 col-md-2 center no-padding" style="width: 12%;">
  74. <h5>共{{total}}页</h5>
  75. </div>
  76. </div>
  77. </div>
  78. <br/>
  79. <h3>文件<span id="marText"></span></h3>
  80. <div class="row">
  81. <div class="col-lg-2 col-md-2 center no-padding" style="width: 48%;">文件名</div>
  82. <div class="col-lg-2 col-md-2 center no-padding" style="width: 25%;">文件类型</div>
  83. <div class="col-lg-1 col-md-2 center no-padding" style="width: 25%;">操作</div>
  84. </div>
  85. <div class="row" v-for="task in taskList" style="margin-bottom: 2px;">
  86. <div class="col-lg-2 col-md-2 center no-padding" style="width: 48%;">{{task.fileName}}</div>
  87. <div class="col-lg-2 col-md-2 center no-padding" style="width: 25%;">{{task.fileType}}</div>
  88. <div class="col-lg-1 col-md-2 center no-padding" style="width: 25%;">
  89. <button type="button" class="btn btn-xs btn-warning" @click="showfile(task.fileName,task.fileType)">查看</button>
  90. </div>
  91. </div>
  92. </div>
  93. <div class="col-lg-9 col-md-9">
  94. <img id="imgInfo" src="/files/imgInfo.jpg" width="100%" height="100%"/>
  95. <iframe id="frameMain" width="100%" border="0" frameborder="0" v-bind:src="filepath" style="background-color:#ffffff"></iframe>
  96. <img id="imgType" src="" width="auto" />
  97. <video id="videoType" src="" controls width="auto" > </video>
  98. <div id="textType" width="auto" ></div>
  99. </div>
  100. </div>
  101. </div>
  102. <!-- jQuery -->
  103. <script src="/lib/jquery.min.js"></script>
  104. <script src="/lib/vue.min.js"></script>
  105. <script src="/lib/echarts/echarts.min.js"></script>
  106. <script src="/lib/echarts/theme/macarons.js"></script>
  107. <script src="/js/service/produce-task.js"></script>
  108. <script type="text/javascript">
  109. $(function () {
  110. hideAll();
  111. $("#imgInfo").show();
  112. })
  113. function hideAll(){
  114. $("#frameMain").hide();
  115. $("#imgType").hide();
  116. $("#videoType").hide();
  117. $("#imgInfo").hide();
  118. }
  119. function setIframeHeight(iframe) {
  120. if (iframe) {
  121. var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;
  122. if (iframeWin.document.body) {
  123. iframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight;
  124. }
  125. }
  126. };
  127. var marCode = "";
  128. // const taskList1 = [];//ServiceProduceTask.getEsopFileList();
  129. // const taskList2 = [];//ServiceProduceTask.getEsopTaskList();
  130. // setIframeHeight(document.getElementById('frameMain'));
  131. // $("#frameMain").height($(window).height()+110);
  132. // $("#imgType").height($(window).height()-110);
  133. // $("#videoType").height($(window).height()-110);
  134. $("#frameMain").height($(window).height()-110);
  135. $("#imgType").height($(window).height()-110);
  136. $("#videoType").height($(window).height()-110);
  137. // const taskList2 = ServiceProduceTask.getEsopTaskList();
  138. // //获取总页数
  139. // var total=(taskList2.length/10).toFixed(0);
  140. // if(taskList2.length%10<5){
  141. // total=Number(total)+1
  142. // }
  143. var vm = new Vue({
  144. el: '#div-main',
  145. data: {
  146. taskList: [],
  147. taskList2: [],
  148. taskList3: [],
  149. filepath:"",
  150. num:0,
  151. pIndex:0,
  152. pSize:10,
  153. cacheDataObject: {}, // 从服务器加载的全数据,界面只取某几条
  154. total:0,
  155. timer_long: '' // 定时取服务器数据
  156. },
  157. methods: {
  158. SYPage(){
  159. this.pIndex = 0;
  160. this.pSize = 10;
  161. this.taskList2 = this.taskList3.slice(this.pIndex, this.pSize);
  162. // this.taskList2 = this.taskList2.slice(this.pIndex, this.pSize);
  163. },
  164. beforePage(){
  165. if(this.pIndex == 0){
  166. alert("已是第一页");
  167. return;
  168. }
  169. this.pIndex = this.pIndex - 10;
  170. this.pSize = this.pSize - 10;
  171. this.taskList2 = this.taskList3.slice(this.pIndex, this.pSize);
  172. // this.taskList2 = taskList2.slice(this.pIndex, this.pSize);
  173. },
  174. afterPage(){
  175. // if(this.pSize >= taskList2.length){
  176. // alert("已是最后一页");
  177. // return;
  178. // }
  179. if(this.pSize >= this.taskList3.length){
  180. alert("已是最后一页");
  181. return;
  182. }
  183. this.pIndex = this.pSize;
  184. this.pSize = this.pSize + 10;
  185. this.taskList2 = this.taskList3.slice(this.pIndex, this.pSize);
  186. // this.taskList2 = taskList2.slice(this.pIndex, this.pSize);
  187. },
  188. showfile: function (name,file) {
  189. if(file=='pdf'){
  190. hideAll();
  191. $("#frameMain").show();
  192. this.filepath = "/lib/pdfjs/web/viewer.html?file=/upFiles/"+marCode+"/"+name;
  193. // this.filepath = "/lib/pdfjs/web/viewer.html?file=/upFiles/"+name;
  194. $("#videoType").attr('src',"");
  195. }else if(file=='jpg' || file=='jpeg' || file=='png'){
  196. hideAll();
  197. $("#imgType").show();
  198. $("#imgType").attr('src',"/upFiles/"+marCode+"/"+name);
  199. // $("#imgType").attr('src',"/upFiles/"+name);
  200. $("#videoType").attr('src',"");
  201. }else if(file=='avi' || file=='mov' || file=='rmvb' || file=='rm' || file=='flv' || file=='mp4' || file=='3gp'){
  202. hideAll();
  203. $("#videoType").show();
  204. $("#videoType").attr('src',"/upFiles/"+marCode+"/"+name);
  205. // $("#videoType").attr('src',"/upFiles/"+name);
  206. }else{
  207. alert("暂时不支持该类型文件的展示");
  208. }
  209. },
  210. selectFile: function(code,moCode){
  211. marCode = code;
  212. $("#marText").text("("+code+")");
  213. this.taskList = ServiceProduceTask.getEsopFileList(code,moCode);
  214. console.log(this.taskList)
  215. },
  216. loadData:function(){
  217. //获取最新数据
  218. const taskList2 = ServiceProduceTask.getEsopTaskList();
  219. //不分页全部数据
  220. this.taskList3=JSON.parse(JSON.stringify(taskList2))
  221. console.log(taskList2)
  222. this.num=taskList2.length;
  223. //获取总页数
  224. this.total=(taskList2.length/10).toFixed(0);
  225. if(taskList2.length%10<5){
  226. this.total=Number(this.total)+1
  227. }
  228. //分页当前数据
  229. this.pIndex = 0;
  230. this.pSize = 10;
  231. this.taskList2 = taskList2.slice(this.pIndex, this.pSize);
  232. },
  233. // 从服务器加载数据并显示
  234. refreshData: function () {
  235. // 关闭定时器
  236. // clearInterval(this.timer_short);
  237. this.loadData();
  238. // 开启定时器
  239. // this.timer_short = setInterval(this.scrollData, 30000);
  240. },
  241. // 轮播数据
  242. scrollData: function () {
  243. // for (var key in this.cacheDataObject) {
  244. // const dataList = this.cacheDataObject[key].data;
  245. // const pagesize = this.cacheDataObject[key].pagesize;
  246. // var pageindex = this.cacheDataObject[key].pageindex + 1;
  247. // if (dataList.length > pagesize) {
  248. // const pagesum = (dataList.length / pagesize).toFixed(0) * 1 + (dataList.length %
  249. // pagesize > 0 ? 1 : 0);
  250. // if (pageindex >= pagesum)
  251. // pageindex = 0;
  252. // this.cacheDataObject[key].pageindex = pageindex;
  253. // const startIndex = pageindex * pagesize;
  254. // const remainSum = dataList.length - startIndex;
  255. // const recordSum = remainSum >= pagesize ? pagesize : remainSum;
  256. // const keyPar = dataList.slice(startIndex, startIndex + pagesize);
  257. // if(keyPar.length < 1){
  258. // continue;
  259. // }
  260. // this[key] = dataList.slice(startIndex, startIndex + pagesize);
  261. // }
  262. // }
  263. }
  264. },
  265. mounted() {
  266. // this.taskList2 = taskList2.slice(this.pIndex, this.pSize);
  267. this.timer_long = setInterval(this.refreshData, 600000);
  268. this.refreshData();
  269. },
  270. beforeDestroy() {
  271. clearInterval(this.timer_long);
  272. // clearInterval(this.timer_long);
  273. // clearInterval(this.timer_short);
  274. }
  275. });
  276. </script>
  277. </body>
  278. </html>