bottom1.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <div id="production-plan" class="plan-container">
  3. <div class="plan-header">
  4. <div class="header-content">
  5. <span class="header-title">产线计划</span>
  6. </div>
  7. </div>
  8. <div class="plan-body">
  9. <dv-scroll-board
  10. :config="config"
  11. ref="scrollBoard"
  12. class="scroll-board"
  13. />
  14. </div>
  15. </div>
  16. </template>
  17. <script>
  18. export default {
  19. name: 'ProductionPlan',
  20. data() {
  21. return {
  22. config: {
  23. header: ['线别', '销售工单', '业务员', '产品名称', '订单数', '备料状态', '计划完成数量', '完成数量', '完成进度', '提醒事项', '异常事项'],
  24. data: [],
  25. rowNum: 9,
  26. headerHeight: 35,
  27. headerBGC: 'rgba(15,19,37,0.1)',
  28. oddRowBGC: 'rgba(15,19,37,0.1)',
  29. evenRowBGC: 'rgba(23,28,51,0.1)',
  30. columnWidth: [130, 190, 110, 200, 120, 140, 180, 180, 160, 210, 180],
  31. align: ['center', 'center', 'left', 'left', 'left', 'left', 'center', 'center', 'center', 'center', 'center']
  32. },
  33. refreshInterval: null,
  34. apiCaller: 'KB!ZZDayPlan'
  35. }
  36. },
  37. mounted() {
  38. this.initDataRefresh()
  39. },
  40. beforeDestroy() {
  41. this.clearRefreshInterval()
  42. },
  43. methods: {
  44. initDataRefresh() {
  45. this.fetchData()
  46. this.refreshInterval = setInterval(this.fetchData, 10000)
  47. },
  48. clearRefreshInterval() {
  49. if (this.refreshInterval) {
  50. clearInterval(this.refreshInterval)
  51. this.refreshInterval = null
  52. }
  53. },
  54. async fetchData() {
  55. try {
  56. const response = await this.$http.get("kanban/datalist.action", {
  57. params: {
  58. caller: this.apiCaller,
  59. _noc: 1,
  60. page: 1,
  61. pageSize: 100,
  62. condition: "1=1"
  63. }
  64. })
  65. this.processResponseData(response.data.data)
  66. } catch (error) {
  67. console.error('数据获取失败:', error)
  68. }
  69. },
  70. processResponseData(rawData) {
  71. try {
  72. const dataList = JSON.parse(rawData)
  73. const formattedData = dataList.map(item => this.formatRowData(item))
  74. this.$refs.scrollBoard.updateRows(formattedData)
  75. } catch (error) {
  76. console.error('数据处理失败:', error)
  77. }
  78. },
  79. formatRowData(item) {
  80. const rowClass = item.v_remark1 && item.v_remark1 !== "" ? 'colorRed' :
  81. item.v_blstatus == '加工中' ? 'colorRemind' : item.v_blstatus == '已完成'?'colorGrass':'colorY';
  82. return [
  83. this.createCell(item.v_licode, rowClass),
  84. this.createCell(item.v_sacode, rowClass),
  85. this.createCell(item.v_seller, rowClass),
  86. this.createCell(item.v_jitype, rowClass),
  87. this.createCell(item.v_qty, rowClass),
  88. this.createCell(item.v_blstatus, rowClass),
  89. this.createCell(item.v_planoutqty, rowClass),
  90. this.createCell(item.v_madeqty, rowClass),
  91. this.createCell(item.v_madejd, rowClass),
  92. this.createCell(item.v_remark, rowClass),
  93. this.createCell(item.v_remark1, rowClass),
  94. this.createCell(item.v_yc, rowClass)
  95. ]
  96. },
  97. createCell(content, className) {
  98. return `<span class="${className} fs-xxl">${content || ''}</span>`
  99. }
  100. }
  101. }
  102. </script>
  103. <style lang="scss" scoped>
  104. .plan-container {
  105. padding: 13px;
  106. height: 520px;
  107. width: 100%;
  108. border-radius: 5px;
  109. .plan-header {
  110. .header-content {
  111. border-radius: 10px;
  112. padding: 5px;
  113. background-color: rgba(15, 19, 37, 0.1);
  114. .header-title {
  115. color: #c3cbde;
  116. font-size: 25px;
  117. font-weight: bold;
  118. display: flex;
  119. justify-content: center;
  120. align-items: center;
  121. padding: 5px 10px;
  122. }
  123. }
  124. }
  125. .plan-body {
  126. margin-top: 5px;
  127. .scroll-board {
  128. height: 470px;
  129. border-radius: 10px;
  130. ::v-deep .header {
  131. font-size: 25px;
  132. }
  133. }
  134. }
  135. }
  136. // 颜色类可以放在全局样式中
  137. .colorRed {
  138. color: #ff4d4f;
  139. }
  140. .colorRemind {
  141. color: #faad14;
  142. }
  143. .colorGrass {
  144. color: #52c41a;
  145. }
  146. .fs-xxl {
  147. font-size: 16px;
  148. }
  149. </style>