sharedSearch.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <script setup name="ChartETASearch">
  2. import {ref,reactive} from 'vue'
  3. import apiSheet from '@/api/sheet'
  4. import { showToast } from 'vant'
  5. import moment from 'moment'
  6. import { useRouter, useRoute } from 'vue-router'
  7. import { useNoAuth } from '@/hooks/useNoAuth'
  8. const router = useRouter()
  9. const route = useRoute()
  10. const keyword=ref('')
  11. const listState = reactive({
  12. list:[],
  13. page:1,
  14. pageSize:20,
  15. finished:false,
  16. loading:false
  17. })
  18. async function getList(){
  19. const res=await apiSheet.sheetListEs({
  20. CurrentIndex: listState.page,
  21. PageSize: listState.pageSize,
  22. Keyword: keyword.value,
  23. IsShowMe: false,
  24. Source: route.query.Source
  25. })
  26. if(res.Ret===200){
  27. listState.loading=false
  28. if(!res.Data){
  29. listState.finished=true
  30. return
  31. }
  32. listState.finished=res.Data.Paging.IsEnd
  33. const arr=res.Data.List||[]
  34. listState.list=[...listState.list,...arr]
  35. }
  36. }
  37. function onLoad(){
  38. listState.page++
  39. getList()
  40. }
  41. function handleSearch(){
  42. if(!keyword.value){
  43. showToast('请输入关键词')
  44. return
  45. }
  46. listState.page=1
  47. listState.list=[]
  48. listState.finished=false
  49. getList()
  50. }
  51. function goDetail(item){
  52. if(!item.HaveOperaAuth) return showToast(useNoAuth().sheet)
  53. let path = '/shared/detail'
  54. if(item.Source === 5) path = '/balance/detail'
  55. router.push({
  56. path,
  57. query:{
  58. id:item.ExcelInfoId,
  59. }
  60. })
  61. }
  62. </script>
  63. <template>
  64. <div class="excel-search-list-page">
  65. <div class="search-box">
  66. <van-search
  67. shape="round"
  68. :placeholder="$t('shared_table.enter_table_name')"
  69. v-model="keyword"
  70. @search="handleSearch"
  71. />
  72. </div>
  73. <img v-if="listState.list.length==0&&listState.finished&&keyword" class="list-empty-img" src="https://hzstatic.hzinsights.com/static/ETA_mobile/empty_img.png" alt="">
  74. <van-list
  75. v-model:loading="listState.loading"
  76. :finished="listState.finished"
  77. :finished-text="listState.list.length > 0 ? $t('shared_table.no_more') : $t('shared_table.no_table')"
  78. :immediate-check="false"
  79. @load="onLoad"
  80. >
  81. <ul class="list-wrap">
  82. <li class="item" v-for="item in listState.list" :key="item.ChartInfoId" @click="goDetail(item)">
  83. <div class="van-ellipsis name" v-html="item.SearchText"></div>
  84. <img class="img" :src="!item.HaveOperaAuth?useNoAuth().noAuthImg:item.ExcelImage" alt="">
  85. <div class="time">
  86. <span>{{moment(item.CreateTime).format('YYYY-MM-DD')}}</span>
  87. <span>{{item.SysUserRealName}}</span>
  88. </div>
  89. </li>
  90. <li class="item" style="height:0;padding:0;border:none"></li>
  91. <li class="item" style="height:0;padding:0;border:none"></li>
  92. <li class="item" style="height:0;padding:0;border:none"></li>
  93. </ul>
  94. </van-list>
  95. </div>
  96. </template>
  97. <style lang="scss" scoped>
  98. .search-box{
  99. position: sticky;
  100. top: 0;
  101. background-color: #fff;
  102. z-index: 99;
  103. }
  104. .list-wrap{
  105. padding: $page-padding;
  106. display: flex;
  107. flex-wrap: wrap;
  108. justify-content: space-between;
  109. .item{
  110. width: 326px;
  111. padding: 14px;
  112. background: #FFFFFF;
  113. border: 1px solid $border-color;
  114. box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.03);
  115. border-radius: 12px;
  116. box-sizing: border-box;
  117. margin-bottom: 30px;
  118. .img{
  119. margin: 14px 0;
  120. width: 100%;
  121. height: 220px;
  122. }
  123. .time{
  124. display: flex;
  125. justify-content: space-between;
  126. color: $font-grey_999;
  127. font-size: 28px;
  128. }
  129. }
  130. }
  131. @media screen and (min-width:$media-width){
  132. // .search-box{
  133. // top: 60px;
  134. // }
  135. .list-wrap{
  136. padding: 20px 30px;
  137. justify-content: center;
  138. .item{
  139. width: 260px;
  140. padding: 14px;
  141. border-radius: 6px;
  142. margin-left: 8px;
  143. margin-right: 8px;
  144. margin-bottom: 15px;
  145. .img{
  146. margin: 14px 0;
  147. width: 100%;
  148. height: 200px;
  149. }
  150. .time{
  151. font-size: 14px;
  152. justify-content: flex-start;
  153. span{
  154. margin-right: 20px;
  155. }
  156. }
  157. }
  158. }
  159. }
  160. </style>