report.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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="getList"></u-input>
  15. </view>
  16. <view class="query-right" @click="getList">搜索</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. this.getList();
  67. },
  68. initList(){
  69. this.queryParams.page = 1;
  70. this.isOver = false;
  71. this.list = [];
  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.getList()
  123. this.$showToast('重新生成成功')
  124. },
  125. scrolltolower(){
  126. if(this.isOver) return
  127. this.getList()
  128. }
  129. }
  130. }
  131. </script>
  132. <style scoped lang="scss">
  133. .default_page{
  134. padding: 0 24rpx 40rpx;
  135. background: #F7F7F7;
  136. box-sizing: border-box;
  137. .top_bg{
  138. width: 100%;
  139. position: absolute;
  140. left: 0;
  141. top: 0;
  142. }
  143. .query{
  144. width: calc(100% - 12rpx);
  145. margin: 40rpx 6rpx 0;
  146. height: 72rpx;
  147. background: #FFFFFF;
  148. border-radius: 36rpx;
  149. padding: 0 36rpx;
  150. box-sizing: border-box;
  151. position: relative;
  152. &-inp{
  153. flex: 1;
  154. padding: 0 20rpx;
  155. box-sizing: border-box;
  156. }
  157. &-right{
  158. font-size: 28rpx;
  159. color: #33A7A7;
  160. padding-left: 20rpx;
  161. position: relative;
  162. &::before{
  163. content: '';
  164. width: 1rpx;
  165. height: 30rpx;
  166. background: rgba(51, 167, 167, .5);
  167. position: absolute;
  168. left: 0;
  169. top: 50%;
  170. margin-top: -15rpx;
  171. }
  172. }
  173. }
  174. .box{
  175. flex: 1;
  176. overflow-y: auto;
  177. }
  178. .tab{
  179. margin-top: 20rpx;
  180. position: relative;
  181. &-pre{
  182. width: 50%;
  183. font-family: PingFangSC, PingFang SC;
  184. font-weight: 400;
  185. font-size: 30rpx;
  186. color: #002846;
  187. line-height: 42rpx;
  188. text-align: center;
  189. &.active{
  190. font-weight: bold;
  191. font-size: 32rpx;
  192. line-height: 45rpx;
  193. position: relative;
  194. &::after{
  195. content: '';
  196. width: 48rpx;
  197. height: 6rpx;
  198. background: #335368;
  199. border-radius: 9rpx;
  200. position: absolute;
  201. left: 50%;
  202. margin-left: -24rpx;
  203. bottom: -22rpx;
  204. }
  205. }
  206. }
  207. }
  208. }
  209. </style>