report.vue 5.9 KB

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