123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- <script setup name="ChartETASearch">
- import {ref,reactive} from 'vue'
- import apiSheet from '@/api/sheet'
- import { showToast } from 'vant'
- import moment from 'moment'
- import { useRouter, useRoute } from 'vue-router'
- import { useNoAuth } from '@/hooks/useNoAuth'
- const router = useRouter()
- const route = useRoute()
- const keyword=ref('')
- const listState = reactive({
- list:[],
- page:1,
- pageSize:20,
- finished:false,
- loading:false
- })
- async function getList(){
- const res=await apiSheet.sheetListEs({
- CurrentIndex: listState.page,
- PageSize: listState.pageSize,
- Keyword: keyword.value,
- IsShowMe: false,
- Source: route.query.Source
- })
- if(res.Ret===200){
- listState.loading=false
- if(!res.Data){
- listState.finished=true
- return
- }
-
- listState.finished=res.Data.Paging.IsEnd
- const arr=res.Data.List||[]
- listState.list=[...listState.list,...arr]
- }
- }
- function onLoad(){
- listState.page++
- getList()
- }
- function handleSearch(){
- if(!keyword.value){
- showToast('请输入关键词')
- return
- }
- listState.page=1
- listState.list=[]
- listState.finished=false
- getList()
- }
- function goDetail(item){
- if(!item.HaveOperaAuth) return showToast(useNoAuth().sheet)
- let path = '/shared/detail'
- if(item.Source === 5) path = '/balance/detail'
- router.push({
- path,
- query:{
- id:item.ExcelInfoId,
- }
- })
- }
- </script>
- <template>
- <div class="excel-search-list-page">
- <div class="search-box">
- <van-search
- shape="round"
- :placeholder="$t('shared_table.enter_table_name')"
- v-model="keyword"
- @search="handleSearch"
- />
- </div>
- <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="">
- <van-list
- v-model:loading="listState.loading"
- :finished="listState.finished"
- :finished-text="listState.list.length > 0 ? $t('shared_table.no_more') : $t('shared_table.no_table')"
- :immediate-check="false"
- @load="onLoad"
- >
- <ul class="list-wrap">
- <li class="item" v-for="item in listState.list" :key="item.ChartInfoId" @click="goDetail(item)">
- <div class="van-ellipsis name" v-html="item.SearchText"></div>
- <img class="img" :src="!item.HaveOperaAuth?useNoAuth().noAuthImg:item.ExcelImage" alt="">
- <div class="time">
- <span>{{moment(item.CreateTime).format('YYYY-MM-DD')}}</span>
- <span>{{item.SysUserRealName}}</span>
- </div>
- </li>
- <li class="item" style="height:0;padding:0;border:none"></li>
- <li class="item" style="height:0;padding:0;border:none"></li>
- <li class="item" style="height:0;padding:0;border:none"></li>
- </ul>
- </van-list>
- </div>
- </template>
- <style lang="scss" scoped>
- .search-box{
- position: sticky;
- top: 0;
- background-color: #fff;
- z-index: 99;
- }
- .list-wrap{
- padding: $page-padding;
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- .item{
- width: 326px;
- padding: 14px;
- background: #FFFFFF;
- border: 1px solid $border-color;
- box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.03);
- border-radius: 12px;
- box-sizing: border-box;
- margin-bottom: 30px;
- .img{
- margin: 14px 0;
- width: 100%;
- height: 220px;
- }
- .time{
- display: flex;
- justify-content: space-between;
- color: $font-grey_999;
- font-size: 28px;
- }
- }
- }
- @media screen and (min-width:$media-width){
- // .search-box{
- // top: 60px;
- // }
- .list-wrap{
- padding: 20px 30px;
- justify-content: center;
- .item{
- width: 260px;
- padding: 14px;
- border-radius: 6px;
- margin-left: 8px;
- margin-right: 8px;
- margin-bottom: 15px;
- .img{
- margin: 14px 0;
- width: 100%;
- height: 200px;
- }
- .time{
- font-size: 14px;
- justify-content: flex-start;
- span{
- margin-right: 20px;
- }
- }
- }
-
- }
- }
- </style>
|