up1.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <div id="up1">
  3. <div class="bg-color-black1">
  4. <div class ="left">
  5. <p class="vertical-text">
  6. 设备状况
  7. </p>
  8. </div>
  9. <div class="body-box">
  10. <div class="percent mt-2">
  11. <div class="circletitle">{{ rate.title }}</div>
  12. <CenterChart
  13. :id="rate.id"
  14. :tips="rate.tips"
  15. :colorObj="rate.colorData"
  16. />
  17. </div>
  18. <div class="dec">
  19. <div class="mt-3">车间总设备数量:{{totalqty}}</div>
  20. <div class="mt-3">正常运行设备数量:{{okqty}}</div>
  21. <div class="mt-3">异常设备数量:{{abnormalqty}}</div>
  22. <div class="mt-3">已保养设备数量:{{byqty}}</div>
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27. </template>
  28. <script>
  29. import CenterChart from "../../components/prodlinechart/up1Chart/up1DChart";
  30. export default {
  31. components: {CenterChart},
  32. data() {
  33. return {
  34. totalqty: 0,
  35. okqty: 0,
  36. abnormalqty: 0,
  37. byqty: 0,
  38. timing:null,
  39. rate: {
  40. id: 'centerRate1',
  41. tips: 60,
  42. title:'保养状况',
  43. colorData: {
  44. textStyle: '#000000',
  45. series: {
  46. color: ['rgba(19,122,244,0.29)', 'transparent'],
  47. dataColor: {
  48. normal: '#00aa55',
  49. shadowColor: '#0ad386'
  50. }
  51. }
  52. }
  53. },
  54. }
  55. },
  56. mounted() {
  57. this.refreshdata()
  58. },
  59. beforeDestroy () {
  60. clearInterval(this.timing)
  61. },
  62. methods: {
  63. refreshdata() {
  64. this.getdata(); //获取-数据
  65. this.timing = setInterval(() => {
  66. this.getdata(); //获取--数据
  67. }, 10000);
  68. },
  69. async getdata() {
  70. //今日保养完成率
  71. await this.$http.get("kanban/datalist.action?caller=KB!LINEDEVICEMAINTAINRATE&_noc=1&page=1&pageSize=100",{
  72. params: {
  73. condition: "de_workshop='"+sessionStorage.getItem('li_code')+"'"
  74. }
  75. }).then((result)=>{
  76. let dataList = JSON.parse(result.data.data);
  77. if (dataList.length > 0) {
  78. const element = dataList[0];
  79. this.rate.tips = element.rate;
  80. }
  81. },(result)=>{
  82. console.error(result)
  83. }
  84. );
  85. //设备数量汇总
  86. var caller = 'KB!LINEDEVICETOTAL';
  87. await this.$http.get("kanban/datalist.action?caller=" + caller + "&_noc=1&page=1&pageSize=100", {
  88. params: {
  89. condition: "de_workshop='"+sessionStorage.getItem('li_code')+"'"
  90. }
  91. }).then((result) => {
  92. let dataList = JSON.parse(result.data.data);
  93. if (dataList.length > 0) {
  94. this.totalqty = dataList[0].totalqty;
  95. this.okqty = dataList[0].okqty;
  96. this.abnormalqty = dataList[0].abnormalqty;
  97. this.byqty = dataList[0].byqty;
  98. }
  99. }, (result) => {
  100. console.error(result)
  101. }
  102. );
  103. }
  104. }
  105. }
  106. </script>
  107. <style lang="scss" scoped>
  108. $box-height: 320px;
  109. $box-width: 100%;
  110. #up1 {
  111. padding: 13px;
  112. height: $box-height;
  113. width: $box-width;
  114. border-radius: 5px;
  115. .bg-color-black1 {
  116. height: $box-height - 25px;
  117. border-radius: 10px;
  118. padding: 5px ;
  119. display: grid;
  120. grid-template-columns: 0.5fr 1.5fr ;
  121. }
  122. .left{
  123. display: flex;
  124. align-items: center; /* 垂直居中 */
  125. .vertical-text {
  126. width:50px;
  127. height: 280px;
  128. border-radius: 15px;
  129. color: white; /* 文字颜色 */
  130. background: linear-gradient(160deg, #0066cc, #0044aa);
  131. font-size: 24px;
  132. padding: 0px 13px 0px 13px;
  133. line-height: 70px;
  134. text-align: center;
  135. font-weight: bold;
  136. }
  137. }
  138. .body-box {
  139. border-radius: 10px;
  140. overflow: hidden;
  141. .percent {
  142. flex-wrap: wrap;
  143. display: flex;
  144. justify-content: center;
  145. left:30%;
  146. flex-direction: column;
  147. .circletitle{
  148. margin-bottom:.5rem;
  149. font-size:1.2308rem;
  150. font-weight: bold;
  151. margin-left: 80px;
  152. }
  153. }
  154. .dec{
  155. display: flex;
  156. -webkit-box-pack:center;
  157. -ms-flex-pack:center;
  158. justify-content:center;
  159. font-size:1.2308rem;
  160. font-weight: bold;
  161. flex-direction: column;
  162. letter-spacing: 2px;
  163. margin-left:.75rem
  164. }
  165. }
  166. }
  167. </style>