index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <el-row class="mianBox">
  3. <el-row class="headerBox">
  4. <el-col class="title">
  5. <img src="../../../assets/image/arrow.png" alt="" />
  6. {{resInfo.typeName || ''}}
  7. </el-col>
  8. </el-row>
  9. <el-row class="threeBox">
  10. <div class="flexBoxE">
  11. <el-row>
  12. <el-col style="margin-bottom: 50px;">
  13. <span>进门总数</span>
  14. <div class="progress">
  15. <div class="percentage"
  16. :style="{
  17. width: (resList.length > 0 && resList.reduce((a, b) => a + b.into, 0) / resList.reduce((a, b) => a + b.into + b.out, 0) * 100 || 0) + '%',
  18. background: `linear-gradient(to right, #C41825 0%,#E4AB33 100%)`
  19. }"></div>
  20. <span class="percentageValue">{{resList.length > 0 && resList.reduce((a, b) => a + b.into, 0) || 0}}</span>
  21. </div>
  22. </el-col>
  23. <el-col>
  24. <span>出门总数</span>
  25. <div class="progress">
  26. <div class="percentage"
  27. :style="{
  28. width: (resList.length > 0 && resList.reduce((a, b) => a + b.out, 0) / resList.reduce((a, b) => a + b.into + b.out, 0) * 100 || 0) + '%',
  29. background: `linear-gradient(to right, #1C2AB0 0%,#33B8E4 100%)`
  30. }"></div>
  31. <span class="percentageValue">
  32. {{resList.length > 0 && resList.reduce((a, b) => a + b.out, 0) || 0}}
  33. </span>
  34. </div>
  35. </el-col>
  36. </el-row>
  37. </div>
  38. </el-row>
  39. </el-row>
  40. </template>
  41. <script>
  42. export default {
  43. props:['resInfo'],
  44. data() {
  45. return {
  46. resList:[]
  47. };
  48. },
  49. watch: {
  50. resInfo(){
  51. this.getData()
  52. }
  53. },
  54. mounted(){
  55. this.getData()
  56. },
  57. methods: {
  58. async getData(){
  59. let res = await this.$axios.get(this.resInfo.apiAddr + '?' +this.$qs.stringify({
  60. applicationCode: this.resInfo.applicationCode
  61. }))
  62. if(res.success){
  63. this.resList = res.data
  64. }
  65. },
  66. },
  67. };
  68. </script>
  69. <style lang="scss" scoped>
  70. .mianBox {
  71. background: url("../../../assets/image/view2.png") no-repeat;
  72. background-size: 100% 100%;
  73. .threeBox {
  74. width: 100%;
  75. flex: 1;
  76. padding: 0 20px;
  77. box-sizing: border-box;
  78. & > .flexBoxE {
  79. width: 100%;
  80. height: 100%;
  81. & > .el-row {
  82. width: 100%;
  83. height: 100%;
  84. font-size: 16px;
  85. display: flex;
  86. flex-direction: column;
  87. align-items: center;
  88. justify-content: center;
  89. .el-col {
  90. display: flex;
  91. span {
  92. margin-right: 10px;
  93. color: #00FCF9;
  94. }
  95. .progress {
  96. flex: 1;
  97. height: 25px;
  98. display: flex;
  99. .percentage{
  100. height: 100%;
  101. }
  102. .percentageValue{
  103. margin-left: 10px;
  104. }
  105. }
  106. }
  107. }
  108. }
  109. }
  110. }
  111. </style>