bottom1.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <div id="bottom2">
  3. <div class="up">
  4. <div class="bg-color-black">
  5. <div class="d-flex pt-1 pl-2 pb-2 jc-center">
  6. <span class="fs-xxl text mx-2 fw-b">订单执行进度</span>
  7. </div>
  8. <div class="body-box" ref="bodyBox">
  9. <dv-scroll-board
  10. :config="config"
  11. ref="scroll-board"
  12. :key="componentKey"
  13. style="width:100%;height:100%"
  14. />
  15. </div>
  16. </div>
  17. </div>
  18. </div>
  19. </template>
  20. <script>
  21. export default {
  22. data() {
  23. return {
  24. config: {
  25. header: ['单号','业务员','产品编号','产品名称', '订单数','裁切','打点','SMT','无尘1','无尘2','组装1','组装2','样品','丝印','包装'],
  26. data: [],
  27. rowNum: 14,
  28. headerHeight: 45,
  29. headerBGC: 'rgba(15,19,37,0.27)',
  30. oddRowBGC: 'rgba(15,19,37,0.6)',
  31. evenRowBGC: 'rgba(23,28,51,0.51)',
  32. columnWidth: [150,110,220,170,110,110,110,110,110,110,110,110,110,110,110],
  33. align: ['center','center','center','center','center','center','center','center','center','center','center','center','center','center','center'],
  34. index: false,
  35. carousel: 'page',
  36. hoverPause: true,
  37. // 添加等待时间确保高度计算正确
  38. waitTime: 10000
  39. },
  40. timing: null,
  41. componentKey: 0
  42. }
  43. },
  44. mounted() {
  45. this.refreshdata();
  46. this.resizeHandler();
  47. window.addEventListener('resize', this.resizeHandler);
  48. },
  49. activated() {
  50. this.componentKey += 1;
  51. this.$nextTick(() => {
  52. this.resizeHandler();
  53. });
  54. this.refreshdata();
  55. },
  56. beforeDestroy() {
  57. clearInterval(this.timing);
  58. if (this.$refs['scroll-board'] && this.$refs['scroll-board'].destroy) {
  59. this.$refs['scroll-board'].destroy();
  60. }
  61. window.removeEventListener('resize', this.resizeHandler);
  62. },
  63. methods: {
  64. resizeHandler() {
  65. this.$nextTick(() => {
  66. if (this.$refs.bodyBox) {
  67. const height = this.$refs.bodyBox.clientHeight - 40; // 减去一些边距
  68. this.config = {
  69. ...this.config,
  70. height: height + 'px'
  71. };
  72. this.componentKey += 1; // 强制重新渲染以应用新高度
  73. }
  74. });
  75. },
  76. refreshdata() {
  77. this.getdata();
  78. this.timing = setInterval(() => {
  79. this.getdata();
  80. }, 10000);
  81. },
  82. async getdata() {
  83. var caller = 'KB!MakeProcess';
  84. try {
  85. const result = await this.$http.get("kanban/datalist.action?caller=" + caller + "&_noc=1&page=1&pageSize=100", {
  86. params: { condition: "1=1" }
  87. });
  88. const dataList = JSON.parse(result.data.data);
  89. const resultList = dataList.map(element => {
  90. const item = [];
  91. const baseClass = 'cell-text';
  92. item.push(`<span class="${baseClass} colorY">${element.v_salecode}</span>`);
  93. item.push(`<span class="${baseClass} colorY">${element.sa_seller}</span>`);
  94. item.push(`<span class="${baseClass} colorY">${element.v_prodcode}</span>`);
  95. item.push(`<span class="${baseClass} colorY">${element.v_prdetail}</span>`);
  96. item.push(`<span class="${baseClass} colorY">${element.v_qty}</span>`);
  97. const processes = ['裁切', '打点', 'smt', '无尘01', '无尘02', '组装01', '组装02', '样品', '丝印', '包装'];
  98. processes.forEach(process => {
  99. const val = element[process];
  100. if(element.v_qty == val) {
  101. item.push(`<span class="${baseClass} colorGrass">${val}</span>`);
  102. } else if(element.v_qty > val && val > 0) {
  103. item.push(`<span class="${baseClass} colorRemind">${val}</span>`);
  104. } else {
  105. item.push(`<span class="${baseClass} colorY">${val}</span>`);
  106. }
  107. });
  108. return item;
  109. });
  110. this.$nextTick(() => {
  111. const scrollBoard = this.$refs['scroll-board'];
  112. if (scrollBoard) {
  113. scrollBoard.updateRows(resultList);
  114. if (scrollBoard.resize) {
  115. scrollBoard.resize();
  116. }
  117. }
  118. });
  119. } catch (error) {
  120. console.error(error);
  121. }
  122. }
  123. }
  124. };
  125. </script>
  126. <style lang="scss">
  127. $box-height: 950px;
  128. $box-width: 100%;
  129. #bottom2 {
  130. padding: 10px;
  131. height: $box-height;
  132. width: $box-width;
  133. border-radius: 5px;
  134. .up {
  135. height: 100%;
  136. .bg-color-black {
  137. border-radius: 10px;
  138. height: 100%;
  139. padding: 5px;
  140. display: flex;
  141. flex-direction: column;
  142. }
  143. .text {
  144. color: #c3cbde;
  145. font-size: 25px;
  146. }
  147. .body-box {
  148. flex: 1;
  149. width: $box-width;
  150. height: $box-height; // 修复flex布局中的高度问题
  151. overflow: hidden;
  152. position: relative;
  153. .dv-scroll-board {
  154. width: 100% !important;
  155. height: 100% !important;
  156. .header {
  157. font-size: 28px !important;
  158. .header-item {
  159. line-height: 45px !important;
  160. padding: 0 5px !important;
  161. }
  162. }
  163. .rows {
  164. .row-item {
  165. line-height: 45px !important;
  166. margin: 0 !important;
  167. padding: 0 !important;
  168. span.cell-text {
  169. display: inline-block;
  170. vertical-align: middle;
  171. font-size: 28px !important;
  172. line-height: 1.5 !important;
  173. padding: 0 5px !important;
  174. }
  175. }
  176. }
  177. }
  178. }
  179. }
  180. }
  181. </style>