index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <view class="card_wrap">
  3. <view class="header_wrap">
  4. <view class="header_left">{{title}}</view>
  5. <dateSelect @confirm="dateSelectChange"></dateSelect>
  6. </view>
  7. <view class="main_warp">
  8. <view class="clueState_top_wrap">
  9. <view class="top_left_wrap">
  10. <view class="top_lable">
  11. 新增线索
  12. </view>
  13. <view class="top_value">{{newClue ? newClue.count : "-"}}</view>
  14. </view>
  15. <view class="top_left_wrap">
  16. <view class="top_lable">
  17. 有进展
  18. </view>
  19. <view class="top_value">{{progressState}}</view>
  20. </view>
  21. </view>
  22. <scroll-view scroll-x="true">
  23. <view class="clueState_bottom_wrap">
  24. <view class="clue_state" v-for="(item,index) in progressList" :key="index">
  25. <view class="state_label">{{item.clueStateName}}</view>
  26. <view class="state_value">{{item.count}}</view>
  27. </view>
  28. </view>
  29. </scroll-view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. import dateSelect from "../dateSelect/index.vue";
  35. export default{
  36. components : {
  37. dateSelect
  38. },
  39. props : {
  40. type : {
  41. type : Number | String
  42. },
  43. },
  44. computed : {
  45. title(){
  46. return this.type === '1' ? "团队工作成果" : "个人工作成果";
  47. },
  48. newClue(){
  49. return this.clueStateList.find(v=>v.clueState === '1');
  50. },
  51. progressState(){
  52. return this.clueStateList.reduce((acc,cur)=>{
  53. acc += cur.isProgress ? cur.count : 0;
  54. return acc;
  55. },0);
  56. },
  57. progressList(){
  58. return this.clueStateList.filter(v=>v.isProgress);
  59. }
  60. },
  61. data(){
  62. return {
  63. clueStateList : [],
  64. }
  65. },
  66. methods : {
  67. async statisticsCaseState(queryParams) {
  68. const {
  69. data
  70. } = await uni.$u.api.statisticsCaseState(queryParams);
  71. this.clueStateList = data;
  72. },
  73. dateSelectChange(queryParams){
  74. queryParams.type = this.type
  75. this.statisticsCaseState(queryParams);
  76. },
  77. handleToClue(){
  78. if(this.type === "1"){
  79. uni.switchTab({
  80. url : "/pages/publicClue/index"
  81. });
  82. }else{
  83. uni.switchTab({
  84. url : "/pages/privateClue/index"
  85. });
  86. }
  87. },
  88. },
  89. }
  90. </script>
  91. <style lang="scss" scoped>
  92. .header_wrap{
  93. display: flex;
  94. justify-content: space-between;
  95. }
  96. .main_warp {
  97. padding: 30rpx;
  98. .clueState_top_wrap {
  99. display: flex;
  100. justify-content: space-evenly;
  101. width: 100%;
  102. .top_left_wrap {
  103. width: 50%;
  104. padding-bottom: 30rpx;
  105. border-bottom: 1px solid #ddd;
  106. &:last-child{
  107. border-left: 1px solid #ddd;
  108. border-bottom: none;
  109. }
  110. .top_lable {
  111. text-align: center;
  112. font-size: 26rpx;
  113. color: #666666;
  114. }
  115. .top_value {
  116. text-align: center;
  117. font-size: 30rpx;
  118. font-weight: bold;
  119. }
  120. }
  121. }
  122. .clueState_bottom_wrap {
  123. display: flex;
  124. .clue_state {
  125. text-align: left;
  126. padding-right: 30rpx;
  127. .state_label {
  128. font-size: 26rpx;
  129. color: #666666;
  130. display: inline-flex;
  131. /* 关键改动:改为行内弹性盒子 */
  132. align-items: center;
  133. /* 垂直居中 */
  134. white-space: nowrap;
  135. /* 关键:禁止文本换行 */
  136. }
  137. .state_value {
  138. font-size: 30rpx;
  139. font-weight: bold;
  140. }
  141. }
  142. }
  143. }
  144. </style>