report.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <view class="default_page adffc" :style="{'height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='我的报告' bgColor="transparent"></cus-header>
  4. <image class="top_bg" :src="imgBase+'report_bg.png'" mode="widthFix"></image>
  5. <view class="tab adfac">
  6. <view class="tab-pre" :class="{'active':tindex===0}" @click="changeTab(0)">我收到的</view>
  7. <view class="tab-pre" :class="{'active':tindex===1}" @click="changeTab(1)">我生成的</view>
  8. <view class="tab-pre" :class="{'active':tindex===2}" @click="changeTab(2)">我发送的</view>
  9. </view>
  10. <view class="query adfacjb">
  11. <u-icon name="search" size="38rpx" color="#B3BFC8"></u-icon>
  12. <view class="query-inp">
  13. <u-input v-model="queryParams.teamName" border="none" fontSize="26rpx" color="#002846" clearable
  14. placeholder="请输入团队名称查询" @confirm="getList"></u-input>
  15. </view>
  16. </view>
  17. <view class="box" v-if="list.length">
  18. <template v-if="tindex===0">
  19. <receive-list :list="list" @scrolltolower="scrolltolower"></receive-list>
  20. </template>
  21. <template v-else-if="tindex===1">
  22. <generate-list :list="list" @scrolltolower="scrolltolower" @reSendReport="reSendReport"></generate-list>
  23. </template>
  24. <template v-else-if="tindex===2">
  25. <send-list :list="list" @scrolltolower="scrolltolower"></send-list>
  26. </template>
  27. </view>
  28. <view style="flex: 1;" v-else>
  29. <page-empty text='暂无报告'></page-empty>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. import ReceiveList from './components/report/receiveList.vue'
  35. import GenerateList from './components/report/generateList.vue'
  36. import SendList from './components/report/sendList.vue'
  37. import PageEmpty from '@/components/pageEmpty/index.vue'
  38. export default {
  39. components:{
  40. ReceiveList,
  41. GenerateList,
  42. SendList,
  43. PageEmpty
  44. },
  45. data(){
  46. return {
  47. tindex:0,
  48. queryParams:{
  49. page:1,
  50. limit:10,
  51. teamName:''
  52. },
  53. list:[],
  54. isOver:false,
  55. categoryData:[]
  56. }
  57. },
  58. onLoad() {
  59. this.getList();
  60. },
  61. methods:{
  62. changeTab(index){
  63. this.tindex = index;
  64. this.initList();
  65. this.getList();
  66. },
  67. initList(){
  68. this.queryParams.page = 1;
  69. this.isOver = false;
  70. this.list = [];
  71. },
  72. getList(){
  73. if(this.tindex===0) this.getReceiveList()
  74. else if(this.tindex===1) this.getGenerateList()
  75. else if(this.tindex===2) this.getSendList()
  76. },
  77. getReceiveList(){
  78. this.$api.get('/core/report/receivedReportList',this.queryParams).then(({data:res})=>{
  79. if(res.code!==0) return this.$showToast(res.msg)
  80. this.list = [...this.list,...res.data.list];
  81. this.queryParams.page++;
  82. if(res.data.list.length===0) this.isOver = true;
  83. })
  84. },
  85. getGenerateList(){
  86. this.$api.get('/core/report/generatedReportList',this.queryParams).then(({data:res})=>{
  87. if(res.code!==0) return this.$showToast(res.msg)
  88. this.list = [...this.list,...res.data.list];
  89. this.queryParams.page++;
  90. if(res.data.list.length===0) this.isOver = true;
  91. })
  92. },
  93. async getUserCategoryData(){
  94. return new Promise((resolve,reject)=>{
  95. this.$api.get('/getListByType/UserCategory').then(({data:res})=>{
  96. if(res.code!==0) return this.$showToast(res.msg)
  97. this.categoryData = res.data.map(d=>({name:d.dictLabel,id:d.dictValue}))
  98. resolve()
  99. })
  100. })
  101. },
  102. async getSendList(){
  103. await this.getUserCategoryData()
  104. let query = JSON.parse(JSON.stringify(this.queryParams));
  105. query.coachId = uni.getStorageSync('userInfo')&&JSON.parse(uni.getStorageSync('userInfo')).id||'';
  106. this.$api.get('/core/report/receivedReportList',query).then(({data:res})=>{
  107. if(res.code!==0) return this.$showToast(res.msg)
  108. this.list = [...this.list,...res.data.list];
  109. this.list.forEach(l=>{
  110. l.categoryName = this.categoryData.find(c=>c.id===l.category).name||'';
  111. })
  112. this.queryParams.page++;
  113. if(res.data.list.length===0) this.isOver = true;
  114. })
  115. },
  116. reSendReport(){
  117. this.initList();
  118. this.getList()
  119. this.$showToast('重新生成成功')
  120. },
  121. scrolltolower(){
  122. if(this.isOver) return
  123. this.getList()
  124. }
  125. }
  126. }
  127. </script>
  128. <style scoped lang="scss">
  129. .default_page{
  130. padding: 0 24rpx 40rpx;
  131. background: #F7F7F7;
  132. box-sizing: border-box;
  133. .top_bg{
  134. width: 100%;
  135. position: absolute;
  136. left: 0;
  137. top: 0;
  138. }
  139. .query{
  140. width: calc(100% - 12rpx);
  141. margin: 40rpx 6rpx 0;
  142. height: 72rpx;
  143. background: #FFFFFF;
  144. border-radius: 36rpx;
  145. padding: 0 36rpx;
  146. box-sizing: border-box;
  147. position: relative;
  148. &-inp{
  149. width: calc(100% - 55rpx);
  150. }
  151. }
  152. .box{
  153. flex: 1;
  154. overflow-y: auto;
  155. }
  156. .tab{
  157. margin-top: 20rpx;
  158. position: relative;
  159. &-pre{
  160. width: 50%;
  161. font-family: PingFangSC, PingFang SC;
  162. font-weight: 400;
  163. font-size: 30rpx;
  164. color: #002846;
  165. line-height: 42rpx;
  166. text-align: center;
  167. &.active{
  168. font-weight: bold;
  169. font-size: 32rpx;
  170. line-height: 45rpx;
  171. position: relative;
  172. &::after{
  173. content: '';
  174. width: 48rpx;
  175. height: 6rpx;
  176. background: #335368;
  177. border-radius: 9rpx;
  178. position: absolute;
  179. left: 50%;
  180. margin-left: -24rpx;
  181. bottom: -22rpx;
  182. }
  183. }
  184. }
  185. }
  186. }
  187. </style>