bottom2.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <div id="quabottom2">
  3. <div class="bg-color-black">
  4. <div class="d-flex pt-1 pl-2 jc-center">
  5. <span class="fs-xxxl text mx-2 fw-b">近15天来料不良批次</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. import { mapState } from "vuex";
  15. export default {
  16. computed: {
  17. //数组写法
  18. ...mapState(['user', 'factoryoptions', 'factory']),
  19. },
  20. data() {
  21. return {
  22. config: {
  23. header: [],//['供方编号','物料编号', '物料名称','批次数量','处理结果'],
  24. data: [],
  25. rowNum: 5, //表格行数
  26. headerHeight: 40,
  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,200, 100,100,100],
  31. align: [],//['left','center','center','center','center'],
  32. carousel:'page',
  33. waitTime:2500
  34. },
  35. timing: null,
  36. }
  37. },
  38. mounted() {
  39. this.refreshdata();
  40. },
  41. beforeDestroy() {
  42. clearInterval(this.timing)
  43. },
  44. methods: {
  45. refreshdata() {
  46. this.getdata(); //获取-数据
  47. this.timing = setInterval(() => {
  48. this.getdata(); //获取--数据
  49. }, 30000);
  50. },
  51. async getdata() {
  52. var caller = 'KB!IQC!NGDATA';
  53. await this.$http.get("kanban/datalist.action?caller=" + caller + "&_noc=1&page=1&pageSize=100", {
  54. params: {
  55. condition: "1=1",
  56. }
  57. }).then((result) => {
  58. let columns = result.data.columns;
  59. let headers = new Array();
  60. let columnWidths = new Array();
  61. let fieldnames = new Array();
  62. let aligns = new Array();
  63. for (let index = 0; index < columns.length; index++) {
  64. const element = columns[index];
  65. if (element.width > 0) {
  66. headers.push(element.text);
  67. columnWidths.push(element.width);
  68. fieldnames.push(element.dataIndex);
  69. aligns.push('center');
  70. }
  71. }
  72. this.config.header = headers;
  73. this.config.columnWidth = columnWidths;
  74. this.config.align = aligns;
  75. let dataList = JSON.parse(result.data.data);
  76. let resultList = new Array();
  77. for (let index = 0; index < dataList.length; index++) {
  78. const element = dataList[index];
  79. let cellClass = 'colorGrass';
  80. if (element.qc_result == '不合格') {
  81. cellClass = 'colorRed';
  82. } else if (element.qc_result == '特采') {
  83. cellClass = 'colorRemind';
  84. }
  85. let item = new Array();
  86. fieldnames.forEach(function (ele) {
  87. // 遍历数组,对每个元素进行操作
  88. item.push(`<span class="fs-xl ${cellClass}">` + element[ele] + `</span>`);
  89. });
  90. resultList.push(item);
  91. }
  92. this.config.data = resultList;
  93. this.config = { ...this.config };
  94. }, (result) => {
  95. console.error(result)
  96. }
  97. );
  98. }
  99. }
  100. }
  101. </script>
  102. <style lang="scss" scoped>
  103. $box-height: 325px;
  104. $box-width: 100%;
  105. #quabottom2 {
  106. padding: 13px;
  107. height: $box-height;
  108. // font-size: 32px;
  109. width: $box-width;
  110. border-radius: 5px;
  111. .bg-color-black {
  112. height: $box-height - 25px;
  113. border-radius: 10px;
  114. padding: 5px;
  115. width: $box-width;
  116. .body-box {
  117. padding-top: 15px;
  118. }
  119. }
  120. .text {
  121. color: #c3cbde;
  122. //font-size: 15px;
  123. }
  124. .body-box {
  125. width: $box-width;
  126. ::v-deep .dv-scroll-board {
  127. height: 260px;
  128. padding-top: 0px; // 添加这行减少顶部间距
  129. .header {
  130. font-size: 20px !important;
  131. color: #c3cbde !important;
  132. }
  133. .rows {
  134. .row-item {
  135. font-size: 20px !important;
  136. color: #c3cbde !important;
  137. }
  138. }
  139. }
  140. }
  141. }
  142. </style>