浏览代码

工分调整

ouyj 4 月之前
父节点
当前提交
131b2657c4
共有 1 个文件被更改,包括 110 次插入111 次删除
  1. 110 111
      pages/score/index.uvue

+ 110 - 111
pages/score/index.uvue

@@ -5,9 +5,9 @@
     <view class="search-bar">
       <view class="search-box">
         <image class="search-icon" src="/static/images/workbench/list/1.png" mode="aspectFit"></image>
-        <input
-          class="search-input"
-          placeholder="搜索工单编、风机编号"
+        <input 
+          class="search-input" 
+          placeholder="搜索工单编、风机编号"
           v-model="searchKeyword"
           @confirm="handleSearch"
         />
@@ -18,36 +18,36 @@
     <!-- 工单评分状态筛选 -->
     <view class="status-bar">
       <view class="status-box">
-        <text
-          class="status-txt"
+        <text 
+          class="status-txt" 
           :class="{ 'stauts-sel': statusFilter === '' }"
           @click="filterByStatus('')"
         >
           全部
         </text>
-        <text
-          class="status-txt"
+        <text 
+          class="status-txt" 
           :class="{ 'stauts-sel': statusFilter === 'to_self' }"
           @click="filterByStatus('to_self')"
         >
           待自评
         </text>
-        <text
-          class="status-txt"
+        <text 
+          class="status-txt" 
           :class="{ 'stauts-sel': statusFilter === 'to_re' }"
           @click="filterByStatus('to_re')"
         >
           待复评
         </text>
-        <text
-          class="status-txt"
+        <text 
+          class="status-txt" 
           :class="{ 'stauts-sel': statusFilter === 'to_confirm' }"
           @click="filterByStatus('to_confirm')"
         >
           待确认
         </text>
-        <text
-          class="status-txt"
+        <text 
+          class="status-txt" 
           :class="{ 'stauts-sel': statusFilter === 'to_final' }"
           @click="filterByStatus('to_final')"
         >
@@ -61,22 +61,22 @@
       <view class="stats-header">
         <text class="stats-title">{{ monthTitle }}月度工分</text>
         <view class="month-filters">
-          <text
-            class="month-filter"
+          <text 
+            class="month-filter" 
             :class="{ 'month-filter-sel': selectedMonth === 'prev' }"
             @click="changeMonth('prev')"
           >
             上月
           </text>
-          <text
-            class="month-filter"
+          <text 
+            class="month-filter" 
             :class="{ 'month-filter-sel': selectedMonth === 'current' }"
             @click="changeMonth('current')"
           >
             本月
           </text>
-          <text
-            class="month-filter"
+          <text 
+            class="month-filter" 
             :class="{ 'month-filter-sel': selectedMonth === 'custom' }"
             @click="showCustomDatePicker"
           >
@@ -91,7 +91,7 @@
           <text class="score-value">{{ totalScore }}分</text>
           <text class="score-label">{{ monthTitle }}总工分</text>
         </view>
-
+        
         <view class="score-breakdown">
           <view class="breakdown-item">
             <text class="breakdown-label">维保工分</text>
@@ -110,14 +110,14 @@
     </view>
 
     <!-- 工单评分列表 -->
-    <common-list
-      :dataList="orderList"
-      :loading="loading"
-      :refreshing="refreshing"
-      :hasMore="hasMore"
-      @refresh="handleRefresh"
-      @loadMore="loadMore"
-      @itemClick="handleItemClick"
+    <common-list 
+      :dataList="orderList" 
+      :loading="loading" 
+      :refreshing="refreshing" 
+      :hasMore="hasMore" 
+      @refresh="handleRefresh" 
+      @loadMore="loadMore" 
+      @itemClick="handleItemClick" 
       class="list-with-padding"
     >
       <template #default="{ item, index }">
@@ -139,8 +139,8 @@
             </view>
 			<view class="info-row">
 			  <view class="info-label">
-			    <text class="text-gray">工作结束时间: {{ formatDate(getPropertyValue(item, 'assignTime')) }}</text>
-			  </view>
+			    <text class="text-gray">工作结束时间: {{ formatDate(getPropertyValue(item, 'realEndTime')) }}</text>
+			  </view> 
 			</view>
           </view>
         </view>
@@ -156,7 +156,7 @@
             <text class="cancel-btn" @click="closeDatePicker">取消</text>
           </view>
         </view>
-
+        
         <view class="date-picker-container">
           <view class="date-picker-item">
             <!-- <text class="date-label">选择年月</text> -->
@@ -167,14 +167,14 @@
         </view>
       </view>
     </l-popup>
-
+    
     <!-- Date Picker -->
     <l-popup v-model="showDatePicker" position="bottom" :z-index="1000">
-      <l-date-time-picker
-        :mode="3"
+      <l-date-time-picker 
+        :mode="3" 
         format="YYYY-MM"
         :modelValue="customDate"
-        confirm-btn="确定"
+        confirm-btn="确定" 
         cancel-btn="取消"
         @confirm="onDateConfirm"
         @cancel="showDatePicker = false">
@@ -191,7 +191,7 @@
     import { listOrderScores, getOrderScoreStatistics, listMobileOrderScores } from '@/api/score/index'
     import { getDictDataByType } from '@/api/dict/index'
     import type { SysDictData } from '@/types/dict'
-
+    
     // 数据状态
     const searchKeyword = ref<string>('')
     const statusFilter = ref<string>('')
@@ -207,11 +207,11 @@
     const rank = ref<number | null>(null)
     const totalRankingUsers = ref<number | null>(null)
     const customDate = ref<string>('')
-
+    
     // 弹窗显示状态
     const showDatePickerPopup = ref<boolean>(false)
     const showDatePicker = ref<boolean>(false)
-
+    
     // 工单状态字典列表
     const statusDictList = ref<SysDictData[]>([])
     // 维保类型字典列表
@@ -219,7 +219,7 @@
     // 检修类型字典列表
     const maintenanceTypeDictList = ref<SysDictData[]>([])
     const dictLoaded = ref<boolean>(false)
-
+    
     // 计算属性
     const monthTitle = computed(() => {
       switch (selectedMonth.value) {
@@ -234,32 +234,32 @@
           return '本月'
       }
     })
-
+    
     // 打开自定义日期选择弹窗
     function showCustomDatePicker() {
-      showDatePickerPopup.value = true
+      showDatePickerPopup.value = true 
     }
-
+    
     function closeDatePicker() {
       showDatePicker.value = false
       showDatePickerPopup.value = false
     }
-
+    
     // 打开日期选择器
     function openDatePicker() {
       showDatePicker.value = true
-    }
-
+    } 
+    
     // 获取工单评分状态字典列表
     const loadStatusDictList = async (): Promise<void> => {
         try {
             const result = await getDictDataByType('gxt_scoring_status')
             const resultObj = result as UTSJSONObject
-
+            
             if (resultObj['code'] == 200) {
                 const data = resultObj['data'] as any[]
                 const dictData: SysDictData[] = []
-
+                
                 if (data != null && data.length > 0) {
                     for (let i = 0; i < data.length; i++) {
                         const item = data[i] as UTSJSONObject
@@ -281,24 +281,24 @@
                         dictData.push(dictItem)
                     }
                 }
-
+                
                 statusDictList.value = dictData
             }
         } catch (e: any) {
             console.error('获取工单评分状态字典失败:', e.message)
         }
     }
-
+    
     // 获取维保类型字典列表
     const loadInspectionTypeDictList = async (): Promise<void> => {
         try {
             const result = await getDictDataByType('gxt_inspection_type')
             const resultObj = result as UTSJSONObject
-
+            
             if (resultObj['code'] == 200) {
                 const data = resultObj['data'] as any[]
                 const dictData: SysDictData[] = []
-
+                
                 if (data != null && data.length > 0) {
                     for (let i = 0; i < data.length; i++) {
                         const item = data[i] as UTSJSONObject
@@ -320,24 +320,24 @@
                         dictData.push(dictItem)
                     }
                 }
-
+                
                 inspectionTypeDictList.value = dictData
             }
         } catch (e: any) {
             console.error('获取维保类型字典失败:', e.message)
         }
     }
-
+    
     // 获取检修类型字典列表
     const loadMaintenanceTypeDictList = async (): Promise<void> => {
         try {
             const result = await getDictDataByType('gxt_maintenance_type')
             const resultObj = result as UTSJSONObject
-
+            
             if (resultObj['code'] == 200) {
                 const data = resultObj['data'] as any[]
                 const dictData: SysDictData[] = []
-
+                
                 if (data != null && data.length > 0) {
                     for (let i = 0; i < data.length; i++) {
                         const item = data[i] as UTSJSONObject
@@ -359,14 +359,14 @@
                         dictData.push(dictItem)
                     }
                 }
-
+                
                 maintenanceTypeDictList.value = dictData
             }
         } catch (e: any) {
             console.error('获取检修类型字典失败:', e.message)
         }
     }
-
+    
     // Helper function to safely extract properties from item
     function getPropertyValue(item: any | null, propertyName: string): string {
       if (item == null) return ''
@@ -374,7 +374,7 @@
       const value = itemObj[propertyName]
       return value != null ? '' + value : ''
     }
-
+    
     // 获取工单类型文本
     function getWorkOrderTypeText(orderType: string | null): string {
       if (orderType != null) {
@@ -386,13 +386,13 @@
       }
       return ""
     }
-
+    
     // 获取工单类型相关信息(维保类型或检修类型)
     function getWorkOrderTypeInfo(item: any | null): string {
       if (item == null) return ''
-
+      
       const orderType = getPropertyValue(item, 'orderType')
-
+      
       // 维保工单显示维保类型
       if (orderType == "2") {
         const inspectionType = getPropertyValue(item, 'inspectionType')
@@ -401,12 +401,12 @@
           if (inspectionTypeDictList.value.length == 0) {
             return inspectionType
           }
-
+          
             // 查找字典中对应的标签
             const dictItem = inspectionTypeDictList.value.find(dict => dict.dictValue == inspectionType)
             return (dictItem != null ? dictItem.dictLabel : inspectionType) as string
         }
-      }
+      } 
       // 维修工单显示检修类型
       else if (orderType == "1") {
         const maintenanceType = getPropertyValue(item, 'maintenanceType')
@@ -415,33 +415,33 @@
           if (maintenanceTypeDictList.value.length == 0) {
             return maintenanceType
           }
-
+          
             // 查找字典中对应的标签
             const dictItem = maintenanceTypeDictList.value.find(dict => dict.dictValue == maintenanceType)
             return (dictItem != null ? dictItem.dictLabel : maintenanceType) as string
         }
       }
-
+      
       return ""
     }
-
+    
     // 获取工单状态文本
     function getScoringStatus(item: any | null): string | null {
         if (item == null) return ''
         const rawStatus = getPropertyValue(item, 'scoringStatus')
-
+        
         if (rawStatus == null || rawStatus == '') return ''
-
+        
         // 如果字典尚未加载,返回原始值
         if (!dictLoaded.value) {
             return rawStatus
         }
-
+        
         // 查找字典中对应的标签
         const dictItem = statusDictList.value.find(dict => dict.dictValue == rawStatus)
         return dictItem != null ? dictItem.dictLabel : rawStatus
     }
-
+    
     // 获取工单评分状态文本
     function getOrderStatusText(status: string | null): string {
       const statusMap: UTSJSONObject = {
@@ -450,12 +450,12 @@
         '3': '待确认',
         '4': '待终评'
       }
-
+      
       if (status == null) return ''
       const result = statusMap[status]
       return result != null ? result as string : '未知状态'
     }
-
+    
     // 获取统计数据
     function getStatistics() {
       // Convert 'current' and 'prev' values to actual date strings
@@ -472,16 +472,16 @@
           const monthStr = prevMonth === 0 ? '12' : prevMonth.toString().padStart(2, '0');
         monthValue = `${prevYear}-${monthStr}`;
       }
-
+      
       const params: UTSJSONObject = {
         //scoringStatus: statusFilter.value,
         month: monthValue
       }
-
+      
       getOrderScoreStatistics(params).then((response: any) => {
         const resultObj = response as UTSJSONObject
         const responseData = resultObj['data'] as UTSJSONObject
-
+        
         if (responseData != null) {
           totalScore.value = (responseData['totalScore'] != null) ? parseFloat((responseData['totalScore'] as number).toFixed(2)) : 0
           maintenanceScore.value = (responseData['maintenanceScore'] != null) ? parseFloat((responseData['maintenanceScore'] as number).toFixed(2)) : 0
@@ -497,7 +497,7 @@
         }
       })
     }
-
+	
 	function onDateConfirm(value: string) {
 	  customDate.value = value
 	  showDatePicker.value = false
@@ -505,21 +505,21 @@
 	  selectedMonth.value = 'custom'
 	  getStatistics()
 	}
-
+		
     // 方法
     function loadData(isRefresh: boolean) {
       const shouldRefresh = isRefresh
-
+      
       if (loading.value && !shouldRefresh) {
         return
-      }
-
+      } 
+      
       loading.value = true
       if (shouldRefresh) {
         currentPage.value = 1
         refreshing.value = true
       }
-
+      
       // Convert 'current' and 'prev' values to actual date strings
       let monthValue = '';
       if (selectedMonth.value === 'custom') {
@@ -527,7 +527,7 @@
       } else if (selectedMonth.value === 'current') {
         const now = new Date();
         const m = now.getMonth() + 1
-        let mStr = m.toString()
+        let mStr = m.toString() 
         if (m < 10) {
           mStr = '0' + mStr
         }
@@ -538,11 +538,11 @@
         const prevYear = prevMonth === 0 ? now.getFullYear() - 1 : now.getFullYear();
         let monthStr = prevMonth === 0 ? '12' : prevMonth.toString()
         if (prevMonth !== 0 && prevMonth < 10) {
-          monthStr = '0' + monthStr
+          monthStr = '0' + monthStr 
         }
         monthValue = `${prevYear}-${monthStr}`;
       }
-
+      
       const params: UTSJSONObject = {
         pageNum: currentPage.value,
         pageSize: 5,
@@ -550,21 +550,21 @@
         scoringStatus: statusFilter.value,
         month: monthValue
       }
-
+      
       listMobileOrderScores(params).then((response: any) => {
         // 提取响应数据
         const resultObj = response as UTSJSONObject
         console.log('API响应数据:', resultObj)
         const responseData = resultObj['rows'] as any[]
         const responseTotal = resultObj['total'] as number
-
+        
         if (shouldRefresh) {
           orderList.value = Array.isArray(responseData) ? responseData : []
         } else {
           const currentRows = Array.isArray(responseData) ? responseData : []
           orderList.value = [...orderList.value, ...currentRows]
         }
-
+        
         hasMore.value = orderList.value.length < responseTotal
         loading.value = false
         refreshing.value = false
@@ -573,39 +573,39 @@
         refreshing.value = false
       })
     }
-
+    
     function handleSearch() {
       loadData(true)
     }
-
+    
     function clearSearch() {
       searchKeyword.value = ""
       loadData(true)
     }
-
+    
     function filterByStatus(status: string) {
       statusFilter.value = status
       loadData(true)
       getStatistics()
     }
-
+    
     function changeMonth(month: string) {
       selectedMonth.value = month
       //loadData(true)
       getStatistics()
     }
-
+    
     function loadMore() {
       if (!hasMore.value || loading.value) return
-
+      
       currentPage.value++
       loadData(false)
     }
-
+    
     function handleRefresh() {
       loadData(true)
     }
-
+    
     // 点击列表项
     function handleItemClick(item: any | null, index: number): void {
       if (item == null) return
@@ -621,12 +621,12 @@
         })
       }
     }
-
+    
     function formatNumber(value: number | null) {
       if (value === null) return '0.0'
       return value.toFixed(2)
     }
-
+    
 	// 获取工单评分状态样式类
 	function getStatusClass(item: any | null): string {
 	    if (item == null) return ''
@@ -634,7 +634,7 @@
 	    if (rawStatus == null || rawStatus == '') return ''
 	    return `status-${rawStatus}`
 	}
-
+	
 	function formatDate(dateString: string) {
 	  if (dateString == '' || dateString == null) return ''
 	  const date = new Date(dateString)
@@ -645,7 +645,7 @@
 	  const minutes = date.getMinutes().toString().padStart(2, '0')
 	  return `${year}-${month}-${day} ${hours}:${minutes}`
 	}
-
+	
     // 生命周期
     onMounted(() => {
       loadStatusDictList()
@@ -689,7 +689,7 @@
     font-size: 28rpx;
     color: #333333;
   }
-
+  
   .clear-icon {
     margin-left: 12rpx;
     font-size: 28rpx;
@@ -709,7 +709,7 @@
   align-items: center;
   height: 72rpx;
   flex: 1;
-
+  
   .status-txt {
     padding: 8px 12px;
     text-align: center;
@@ -718,7 +718,7 @@
     background-color: #fff;
     font-size: 28rpx;
   }
-
+  
   .stauts-sel {
     background-color: #007AFF;
     color: #fff;
@@ -811,7 +811,7 @@
   line-height: 1.4;
 }
 
-.breakdown-value {
+.breakdown-value { 
   font-size: 28rpx;
   color: #666;
   display: flex;
@@ -856,24 +856,24 @@
   flex-direction: row;
   justify-content: space-between;
   align-items: center;
-
+  
   .info-label {
     font-size: 26rpx;
     color: #666;
   }
-
+  
   .info-value-row {
     flex-direction: row;
     align-items: center;
   }
-
+  
   .score-text {
     font-size: 28rpx;
     color: #ff9900;
     font-weight: bold;
     margin-right: 20rpx;
   }
-
+  
   .status-text {
     font-size: 24rpx;
     padding: 4rpx 12rpx;
@@ -978,7 +978,7 @@
   background-color: #ebf5ff;
   color: #409eff;
   border-color: #d8ebff;
-}
+} 
 
 /* 待确认 */
 .status-to_confirm {
@@ -993,7 +993,7 @@
   background-color: #ebf5ff;
   color: #409eff;
   border-color: #d8ebff;
-}
+} 
 
 /* 待归档 */
 .status-to_archive {
@@ -1008,5 +1008,4 @@
   color: #5cb87a;
   border-color: #c2e7b0;
 }
-</style>
-
+</style>