Browse Source

维保明细

bls-dan 2 years ago
parent
commit
7fd920dfab

+ 15 - 10
src/pages/views/home/components/MaintenanceDynamics.vue

@@ -50,17 +50,17 @@
         <n-date-picker
           v-model:value="leftContent.bottom.range"
           type="daterange"
-          clearable
           style="width: 260px;"
         />
 
         <n-data-table
           :columns="leftContent.bottom.head"
-          :data="leftContent.bottom.body"
+          :data="tableData"
           :bordered="false"
           single-column
           striped
           size="large"
+          style="height: 300px;"
         />
         <div class="page">
           <n-pagination
@@ -164,7 +164,7 @@ import Box from '@/components/box.vue'
 import SelectDate from '@/components/selectDate.vue'
 
 import {
-  Ref, onMounted, ref, watch
+  Ref, computed, onMounted, ref, watch
 } from 'vue'
 import Echart from '@/components/chart.vue'
 import MaintenanceDynamicsService from '../services/maintenanceDynamics.Service'
@@ -387,13 +387,13 @@ const leftContent:Ref<any> = ref({
   ],
   bottom: {
     head: [
-      { title: '序号', key: 'num' },
-      { title: '车辆编号', key: 'carNum' },
-      { title: '车牌号', key: 'carNumber' },
+      { title: '序号', render: (rowData: object, rowIndex: number) => rowIndex + 1 },
+      { title: '车辆编号', key: 'code' },
+      { title: '车牌号', key: 'licensePlate' },
       { title: '线路', key: 'line' },
-      { title: '维修类型', key: 'type' },
-      { title: '故障原因', key: 'cause' },
-      { title: '维修点位', key: 'postion' },
+      { title: '维修类型', key: 'maintenanceType' },
+      { title: '故障原因', key: 'faultReason' },
+      { title: '维修点位', key: 'maintenanceLocation' },
       { title: '报修时间', key: 'time' },
       { title: '维保结果', key: 'result' }
 
@@ -685,6 +685,10 @@ async function getBusLineDetailAll() {
   }, 0)}`
 }
 getBusLineDetailAll()
+const tableData = computed(() => {
+  const { num, size } = leftContent.value.bottom.page
+  return leftContent.value.bottom.body.slice((num - 1) * size, num * size)
+})
 async function getMaintenanceDetail() {
   const { range } = leftContent.value.bottom
   const params = {
@@ -692,7 +696,8 @@ async function getMaintenanceDetail() {
     endTime: format(range[1], 'yyyy-MM-dd HH:mm:ss')
   }
   const res = await maintenanceDynamicsService.getMaintenanceDetail(params)
-  console.log(res, 'res')
+  leftContent.value.bottom.body = res
+  leftContent.value.bottom.page.total = res.length
 }
 getMaintenanceDetail()
 

+ 1 - 1
src/pages/views/home/services/maintenanceDynamics.Service.ts

@@ -82,7 +82,7 @@ export default class MaintenanceDynamicsService extends Service {
     const { startTime, endTime } = params
     const { success, data } = await this.netService.get(`/maintenance/getMaintenanceDetail?startTime=${startTime}&endTime=${endTime}`)
     if (success) {
-      return data || []
+      return data?.list || []
     }
     return []
   }