赫艾前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

214 lines
4.9 KiB

3 years ago
  1. <template>
  2. <div class="mod-config container ">
  3. <div class="pdfMenu" >
  4. <h1 style="color: white">SOP指导书 当前派工单|{{seqNo}}</h1>
  5. </div>
  6. <div class="pdf-wrapper" ref="pdfWrapper">
  7. <pdf ref="pdfViewer"
  8. :src="sopUrl"
  9. :page="sopPage"
  10. @num-pages="setSopPages"
  11. @page-loaded="setPageLoaded"
  12. class="pdf-document"
  13. ></pdf>
  14. </div>
  15. <div class="pdfMenu" >
  16. <h1 style="color: white">SQC指导书 当前操作员|{{operator}}</h1>
  17. </div>
  18. <div class="pdf-wrapper" ref="pdfWrapper">
  19. <pdf ref="pdfViewer"
  20. :src="badUrl"
  21. :page="badPage"
  22. @num-pages="setBadPages"
  23. @page-loaded="setPageLoaded"
  24. class="pdf-document"
  25. ></pdf>
  26. </div>
  27. </div>
  28. </template>
  29. <script>
  30. let rollstop = ''
  31. let rolltimer = ''// 自动滚动的定时任务
  32. let refresher = '' //数据刷新定时器
  33. import {
  34. getSopAddress,
  35. } from '@/api/board.js'
  36. import pdf from 'vue-pdf'
  37. export default {
  38. name: 'sopBoard',
  39. components: {
  40. pdf
  41. },
  42. data () {
  43. return {
  44. tvId:this.$route.query.ip?this.$route.query.ip:'TV001',
  45. operator:'',
  46. seqNo:'',
  47. sopMax: 1,
  48. sopPage: 1,
  49. badMax: 1,
  50. badPage: 1,
  51. height: 200,
  52. tableData: [],
  53. // 默认的刷新,滚动时间,滚动间距
  54. // refreshTime: 5,
  55. // rollTime: 5,
  56. // rollPx: 1,
  57. sopUrl: '',
  58. badUrl: '',
  59. pageLoaded: false,
  60. timeOut:30000,
  61. // packageUrl:'http://192.168.1.130/upload/',
  62. packageUrl:'http://192.168.2.172/sopFile/',
  63. // packageUrl:'http://192.168.1.83:81/upload/',
  64. }
  65. },
  66. mounted () {
  67. this.$nextTick(() => {
  68. this.changePdf();
  69. this.changePage();
  70. this.getPDF();
  71. });
  72. },
  73. methods: {
  74. setSopPages(numPages) {
  75. this.sopMax = numPages
  76. },
  77. setBadPages(numPages) {
  78. this.badMax = numPages
  79. },
  80. setPageLoaded() {
  81. this.pageLoaded = true
  82. },
  83. changePage() {
  84. refresher = setInterval(() => {
  85. if(this.sopPage==this.sopMax){
  86. this.sopPage=1;
  87. }else {
  88. this.sopPage=Number(this.sopPage)+1
  89. }
  90. if(this.badPage==this.badMax){
  91. this.badPage=1;
  92. }else {
  93. this.badPage=Number(this.badPage)+1
  94. }
  95. }, this.timeOut)
  96. },
  97. changePdf() {
  98. refresher = setInterval(() => {
  99. this.getPDF();
  100. }, 30000)
  101. },
  102. getPDF(){
  103. let data={
  104. tvId: this.tvId
  105. }
  106. getSopAddress(data).then(({data}) => {
  107. if(data.code==0){
  108. if(this.sopUrl!=this.packageUrl+data.data.sopAddress){
  109. this.sopUrl=this.packageUrl+data.data.sopAddress;
  110. this.sopPage=1;
  111. }
  112. if(this.badUrl!=this.packageUrl+data.data.badAddress){
  113. this.badUrl=this.packageUrl+data.data.badAddress;
  114. this.badPage=1;
  115. }
  116. console.log(this.sopUrl)
  117. this.operator=data.data.nowOperator;
  118. this.seqNo=data.data.nowSeqNo;
  119. }else {
  120. this.sopUrl='';
  121. this.badUrl='';
  122. this.seqNo='无';
  123. this.operator='无';
  124. }
  125. })
  126. }
  127. },
  128. created () {
  129. // this.search()
  130. // this.refreshTable()
  131. }
  132. }
  133. </script>
  134. <style >
  135. .board2 .el-table .cell {
  136. line-height: 13px;
  137. font-size: 12px;
  138. height: 13px;
  139. padding: 0px;
  140. }
  141. .board2 .el-table .green {
  142. background: #8cee8c;
  143. }
  144. .board2 .el-table .success-row {
  145. background: #1bb61b;
  146. }
  147. .board2 .el-table .false-row {
  148. /*background: #cbcb14;*/
  149. background: #db1212;
  150. }
  151. .board2 .el-table .yellow-row{
  152. background: #ffff00;
  153. }
  154. .container {
  155. font-size: 13px;
  156. position: fixed;
  157. top: 0;
  158. left: 0;
  159. z-index: -1;
  160. width: 100%;
  161. height: 100%;
  162. content: "";
  163. background-image: url(~@/assets/img/factory.jpg);
  164. background-size: cover;
  165. }
  166. .pdf-container {
  167. position: relative;
  168. width: 100%;
  169. height: 100%;
  170. }
  171. .pdf-wrapper {
  172. position: relative;
  173. width: 43%;
  174. height: 100%;
  175. float: left;
  176. margin-top: 0%;
  177. margin-left: 0%;
  178. overflow: hidden;
  179. display: flex;
  180. align-items: center; /* 垂直居中 */
  181. justify-content: center; /* 水平居中 */
  182. }
  183. .pdf-document {
  184. transform-origin: center;
  185. width: 100%;
  186. height: 100%;
  187. }
  188. .pdfMenu {
  189. width: 7%;
  190. height: 100%;
  191. float: left;
  192. writing-mode: vertical-lr; /* 竖排显示,从左到右 */
  193. text-orientation: upright; /* 竖排文字方向为正常朝向 */
  194. display: flex; /* 使用 Flex 布局 */
  195. align-items: center; /* 垂直居中对齐 */
  196. }
  197. .vertical-text {
  198. writing-mode: vertical-lr; /* 竖排显示,从左到右 */
  199. text-orientation: upright; /* 竖排文字方向为正常朝向 */
  200. }
  201. </style>