up2.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <div id="up2">
  3. <div class="bg-color-black">
  4. <div class="d-flex pt-1 pl-2 jc-center">
  5. <span class="fs-xxl text mx-2 fw-b">当日工序计划进度</span>
  6. </div>
  7. <div class="body-box">
  8. <div class="pt-2 " >
  9. <BarChart :bardata="bardata" />
  10. </div>
  11. <div class="d-flex jc-center fs-xl fw-b rate flex-column mt-2">
  12. <div>当日已完成比例:{{finishRate}}% </div>
  13. <div class="mt-1">当日未达成比例:{{unfinishRate}}%</div>
  14. </div>
  15. </div>
  16. </div>
  17. </div>
  18. </template>
  19. <script>
  20. import BarChart from '@/components/zzchart/up2Chart'
  21. import {mapState} from "vuex";
  22. export default {
  23. computed: {
  24. ...mapState(['factory']),
  25. },
  26. data() {
  27. return {
  28. timing:null,
  29. bardata : {
  30. planData:[],
  31. actData:[],
  32. yAxis:[],
  33. max : 1000,
  34. },
  35. finishRate:0,
  36. unfinishRate:0,
  37. }
  38. },
  39. components: {BarChart},
  40. mounted() {
  41. this.refreshdata();
  42. },
  43. beforeDestroy () {
  44. clearInterval(this.timing)
  45. },
  46. methods: {
  47. refreshdata() {
  48. this.setdata(); //获取数据
  49. this.timing = setInterval(() => {
  50. this.setdata(); //获取-主题词
  51. }, 10000);
  52. },
  53. async setdata() {
  54. //当前工单
  55. var caller = 'KB!LongLineLinePlan';
  56. await this.$http.get("kanban/datalist.action?caller="+caller+"&_noc=1&page=1&pageSize=100",{
  57. params: {
  58. condition: "V_OUTLINE='组装'" ,
  59. }
  60. }).then((result)=>{
  61. let dataList = JSON.parse(result.data.data);
  62. if(dataList.length>0){
  63. let yAxis0 = new Array();
  64. let series0 = new Array();
  65. let series1 = new Array();
  66. var maxnumber=0;
  67. for (let index = 0; index < dataList.length; index++) {
  68. const element = dataList[index];
  69. yAxis0.push(element.v_wccode);
  70. //计划
  71. series0.push(element.v_planqty);
  72. if(element.v_planqty>maxnumber){
  73. maxnumber= element.v_planqty;
  74. }
  75. //实际
  76. series1.push(element.v_actqty);
  77. if(element.v_actqty>maxnumber){
  78. maxnumber= element.v_actqty;
  79. }
  80. }
  81. this.bardata.planData = series0;
  82. this.bardata.actData = series1;
  83. this.bardata.yAxis = yAxis0;
  84. this.bardata.max = Math.ceil(maxnumber*1.2);
  85. }
  86. },(result)=>{
  87. console.error(result)
  88. }
  89. );
  90. this.finishRate = 0;
  91. this.unfinishRate = 0;
  92. //比例,用的是总看板的达成比例caller,如果不一样,自行修改caller
  93. caller = 'KB!TOTALDayMakeRate';
  94. await this.$http.get("kanban/datalist.action?caller="+caller+"&_noc=1&page=1&pageSize=100",{
  95. params: {
  96. condition: "V_OUTLINE='组装'"
  97. }
  98. }).then((result) => {
  99. let dataList = JSON.parse(result.data.data);
  100. if(dataList.length>0){
  101. this.finishRate = dataList[0].finishrate;
  102. this.unfinishRate = dataList[0].unfinishrate;
  103. }
  104. }, (result) => {
  105. console.error(result)
  106. }
  107. );
  108. }
  109. }
  110. }
  111. </script>
  112. <style lang="scss" scoped>
  113. $box-height: 430px;
  114. $box-width: 100%;
  115. #up2 {
  116. padding: 13px;
  117. height: $box-height;
  118. font-size: 40px;
  119. width: $box-width;
  120. border-radius: 5px;
  121. .bg-color-black {
  122. height: $box-height - 25px;
  123. //width: $box-width - 10px;
  124. border-radius: 10px;
  125. padding: 5px ;
  126. }
  127. .text {
  128. color: #c3cbde;
  129. font-size: 25px;
  130. }
  131. .body-box {
  132. border-radius: 10px;
  133. overflow: hidden;
  134. .rate{
  135. justify-content: center; /* 水平居中 */
  136. align-items: center;
  137. }
  138. }
  139. }
  140. </style>