up1.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <div id="up1">
  3. <div class="bg-color-black">
  4. <div class="d-flex pt-2 pl-2 jc-center pb-2">
  5. <span class="fs-xxl text mx-2 fw-b">已备料未上线数据</span>
  6. </div>
  7. <div class="d-flex jc-center body-box">
  8. <dv-scroll-board :config="config" ref="scroll-board" />
  9. </div>
  10. </div>
  11. </div>
  12. </template>
  13. <script>
  14. export default {
  15. components: {
  16. },
  17. data() {
  18. return {
  19. config: {
  20. header: [],//['线别','生产工单', '机型', '订单数', '备料状态', '计划投入', '计划完成', '计划工时', '加班工时', '提醒事项'],
  21. data: [],
  22. rowNum: 15, //表格行数
  23. headerHeight: 35,
  24. headerBGC: '#0f1325', //表头
  25. oddRowBGC: '#0f1325', //奇数行
  26. evenRowBGC: '#171c33', //偶数行
  27. columnWidth: [],//[130,190, 180, 100, 100, 100, 100, 100, 100, 160],
  28. align: []//['center','left','left','left','left','center','center','center','center']
  29. },
  30. timing: null,
  31. }
  32. },
  33. mounted() {
  34. this.refreshdata()
  35. },
  36. beforeDestroy() {
  37. clearInterval(this.timing)
  38. },
  39. methods: {
  40. refreshdata() {
  41. this.getdata(); //获取-数据
  42. this.timing = setInterval(() => {
  43. this.getdata(); //获取--数据
  44. }, 10000);
  45. },
  46. async getdata() {
  47. var caller = 'KB!WHData';
  48. await this.$http.get("kanban/datalist.action?caller=" + caller + "&_noc=1&page=1&pageSize=100", {
  49. params: {
  50. condition: "1=1" ,
  51. }
  52. }).then((result) => {
  53. let columns = result.data.columns;
  54. let headers = new Array();
  55. let columnWidths = new Array();
  56. let fieldnames = new Array();
  57. let aligns = new Array();
  58. for (let index = 0; index < columns.length; index++) {
  59. const element = columns[index];
  60. if(element.width>0) {
  61. headers.push(element.text);
  62. columnWidths.push(element.width);
  63. fieldnames.push(element.dataIndex);
  64. aligns.push('center');
  65. }
  66. }
  67. this.config.header = headers;
  68. this.config.columnWidth = columnWidths;
  69. this.config.align = aligns;
  70. let dataList = JSON.parse(result.data.data);
  71. let resultList = new Array();
  72. for (let index = 0; index < dataList.length; index++) {
  73. const element = dataList[index];
  74. let item = new Array();
  75. fieldnames.forEach(function (ele) {
  76. // 遍历数组,对每个元素进行操作
  77. item.push("<span class='colorGrass fs-lg'>" + element[ele] + "</span>");
  78. });
  79. /* if (element.v_blstatus == '未领料') { //98%
  80. item.push("<span class='colorRemind fs-lgmd'>" + element.v_blstatus + "</span>");
  81. } else {
  82. item.push("<span class='colorGrass fs-lg'>" + element.v_blstatus + "</span>");
  83. }*/
  84. resultList.push(item);
  85. }
  86. this.config.data = resultList;
  87. /*const scrollBoard = this.$refs['scroll-board'];
  88. //刷新数据
  89. scrollBoard.updateRows(resultList);*/
  90. this.config = { ...this.config };
  91. }, (result) => {
  92. console.error(result)
  93. }
  94. );
  95. }
  96. }
  97. };
  98. </script>
  99. <style lang="scss" class>
  100. $box-height: 950px;
  101. $box-width: 100%;
  102. #up1 {
  103. padding: 13px;
  104. height: $box-height;
  105. width: $box-width;
  106. border-radius: 5px;
  107. .bg-color-black {
  108. border-radius: 10px;
  109. height: $box-height - 25px;
  110. padding: 5px;
  111. }
  112. .text {
  113. color: #c3cbde;
  114. //font-size: 15px;
  115. }
  116. .body-box {
  117. width: $box-width;
  118. .dv-scroll-board .header {
  119. font-size: 20px;
  120. }
  121. .dv-scroll-board {
  122. height: $box-height - 70px;
  123. }
  124. }
  125. }
  126. </style>