吉安感知网项目-前端
shuishen
2026-01-23 79702b005a055df600ad61b19c2e7a4a01cc3d40
uniapps/work-app/src/pages/work/index.vue
@@ -2,7 +2,7 @@
  <div class="eventTickets" :style="{ paddingTop: topMargin + 'px' }">
    <div class="searchTop">
      <up-search placeholder="请输入关键字搜索"  :animation="true"  v-model="listParams.keyword" :show-action="false"></up-search>
      <up-search placeholder="请输入关键字搜索"  :animation="true"  v-model="listParams.keyword" :show-action="false" @search="handleSearch"></up-search>
    </div>
    <div class="listBox">
      <div class="tabs-container">
@@ -35,7 +35,7 @@
<script setup>
import { useUserStore } from '@/store/index.js'
import {getGdList,getstatusCount} from '/src/api/work/index1.js'
import {getGdList,getstatusCount} from '/src/api/work/index.js'
import dayjs from 'dayjs';
import { getStatusBarHeight } from '@/utils/common';
const userStore = useUserStore()
@@ -49,15 +49,17 @@
    name: '全部工单',
    key: 'all',
    badge: {
      value: 0
      value: 0,
      showZero: true
    },
    status: null
  },
  {
    name: '我的工单',
    key: 'myTickets',
    badge: {
      value: 0
      value: 0,
      showZero: true
    }
  }
@@ -67,7 +69,7 @@
  return dayjs(dateString).format('MM/DD HH:mm');
};
const listParams = ref({
  status: null,
  current: 1,
  size: 12,
  source: 1,
@@ -82,7 +84,7 @@
  const params = {
    current: listParams.value.current,
    size: listParams.value.size,
    // event_name:listParams.value.keyword,
    keyword:listParams.value.keyword,
    onlyMine:currentTab.value=== 'myTickets' ? 1 : 0
  }
  getGdList(params).then(res => {
@@ -105,22 +107,22 @@
    loading.value = false
  })
}
const getstatusCountData=()=>{
   getstatusCount().then(res=>{
  const params={
    keyword:listParams.value.keyword,
  }
   getstatusCount(params).then(res=>{
      const response = res.data.data
       const {  totalCount,myCount } = response
      tabList.value.forEach(tab=>{
         if(tab.key === 'all'){
            tab.badge.value = totalCount || 0
        tab.badge.showZero = true
         }else if(tab.key === 'myTickets'){
            tab.badge.value = myCount || 0
         }else{
            tab.badge.value=statusCount[String(tab.status)] || 0
        tab.badge.showZero = true
         }
      })
@@ -129,7 +131,7 @@
const handleClick = (item) => {
  currentTab.value = item.key
  listParams.value.status = item.status
  listParams.value.current = 1
  hasMore.value = true
  dataList.value = []
@@ -146,6 +148,15 @@
    url: `/subPackages/workDetail/index?id=${val.id}`,
  })
}
// 搜索功能
const handleSearch = () => {
  listParams.value.current = 1
  hasMore.value = true
  dataList.value = []
  getDataList()
  getstatusCountData()
}
const topMargin = getStatusBarHeight()
onShow(() => {
  listParams.value.current = 1