Kaynağa Gözat

车辆记录接口对接

duanxiaoduan 1 yıl önce
ebeveyn
işleme
629c7603a2
1 değiştirilmiş dosya ile 47 ekleme ve 32 silme
  1. 47 32
      src/views/maintenance/vehicleRecords/index.vue

+ 47 - 32
src/views/maintenance/vehicleRecords/index.vue

@@ -2,7 +2,7 @@
   <div class="app-container">
     <div class="filter-container">
       <el-select v-model="getdataListParm.parammaps.pastureid" placeholder="牧场" class="filter-item" style="width: 110px">
-        <el-option v-for="item in findAllPasture" :key="item.id" :label="item.name" :value="item.name" />
+        <el-option v-for="item in findAllPasture" :key="item.id" :label="item.name" :value="item.id" />
       </el-select>
       <el-date-picker v-model="getdataListParm.parammaps.inputDatetime" class="inputDatetime filter-item"  clearable type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 250px;margin-right: 10px;" />
       <el-button class="filter-item" type="primary" icon="el-icon-search" @click="form_search">搜索</el-button>
@@ -28,23 +28,23 @@
         </template>
       </el-table-column>
       <el-table-column label="牧场" min-width="90px" align="center" prop="pastureName" />
-      <el-table-column label="日期" min-width="90px" align="center" prop="pastureName" />
-      <el-table-column label="设备编码" min-width="90px" align="center" prop="pastureName" />
-      <el-table-column label="柳工机号" min-width="90px" align="center" prop="pastureName" />
-      <el-table-column label="开机小时(H)" min-width="90px" align="center" prop="pastureName" />
-      <el-table-column label="怠速小时(H)" min-width="90px" align="center" prop="pastureName" />
-      <el-table-column label="油耗(L)" min-width="90px" align="center" prop="pastureName" />
-      <el-table-column label="怠速油耗(H)" min-width="90px" align="center" prop="pastureName" />
-      <el-table-column label="平均油耗(L/H)" min-width="90px" align="center" prop="pastureName" />
-      <el-table-column label="经度" min-width="90px" align="center" prop="pastureName" />
-      <el-table-column label="维度" prop="enabledTime" min-width="120px" align="center" />
-      <el-table-column label="油位(%)" prop="blockTime" min-width="120px" align="center" />
-      <el-table-column label="耗电量" prop="blockTime" min-width="120px" align="center" />
-      <el-table-column label="平价耗电量" prop="blockTime" min-width="120px" align="center" />
-      <el-table-column label="充电量" prop="blockTime" min-width="120px" align="center" />
-      <el-table-column label="充电时长" prop="blockTime" min-width="120px" align="center" />
-      <el-table-column label="电动设备状态" prop="blockTime" min-width="120px" align="center" />
-      <el-table-column label="电池包 SOC(%)" prop="blockTime" min-width="120px" align="center" />
+      <el-table-column label="日期" min-width="90px" align="center" prop="dataTime" />
+      <el-table-column label="设备编码" min-width="90px" align="center" prop="eqCode" />
+      <el-table-column label="柳工机号" min-width="90px" align="center" prop="license" />
+      <el-table-column label="开机小时(H)" min-width="90px" align="center" prop="workHour" />
+      <el-table-column label="怠速小时(H)" min-width="90px" align="center" prop="idleHour" />
+      <el-table-column label="油耗(L)" min-width="90px" align="center" prop="fuelConsumption" />
+      <el-table-column label="怠速油耗(H)" min-width="90px" align="center" prop="idleFuel" />
+      <el-table-column label="平均油耗(L/H)" min-width="90px" align="center" prop="hoursConsumption" />
+      <el-table-column label="经度" min-width="90px" align="center" prop="longitude" />
+      <el-table-column label="维度" prop="latitude" min-width="120px" align="center" />
+      <el-table-column label="油位(%)" prop="fuelLevel" min-width="120px" align="center" />
+      <el-table-column label="耗电量" prop="powerConsumption" min-width="120px" align="center" />
+      <el-table-column label="平价耗电量" prop="hoursPowerConsumption" min-width="120px" align="center" />
+      <el-table-column label="充电量" prop="chargeCapacity" min-width="120px" align="center" />
+      <el-table-column label="充电时长" prop="chargeHour" min-width="120px" align="center" />
+      <el-table-column label="电动设备状态" prop="chargeStatus" min-width="120px" align="center" />
+      <el-table-column label="电池包 SOC(%)" prop="batteryPackSoc" min-width="120px" align="center" />
     </el-table>
     <pagination v-show="total>0" :total="total" :page.sync="getdataListParm.offset" :limit.sync="getdataListParm.pagecount" @pagination="get_table_data" />
 
@@ -68,7 +68,7 @@
         getdataListParm: {
           page: 1, offset: 1, pagecount: 10, returntype: 'Map',
           parammaps: {
-            pastureid: Cookies.get('pastureid'),
+            pastureid: parseInt(Cookies.get('pastureid')),
             inputDatetime:[],
             startTime:'',
             stopTime:''
@@ -92,7 +92,7 @@
         that.get_auto_buttons()
       })
       this.get_select_list()
-      this.get_table_data()
+
     },
     methods:{
       get_auto_buttons() {
@@ -103,6 +103,7 @@
       get_select_list() {
         GetDataByNames(this.requestParams).then(response => {
           this.findAllPasture = response.data.findAllPasture.list
+          this.get_table_data()
         })
       },
       get_table_data(){
@@ -118,13 +119,13 @@
           stopTime = ''
         }
         let url = 'authdata/vehicleL/list'
-        let data = "?pastureId=" + Cookies.get('pastureid')
+        let data = "?pastureId=" + this.getdataListParm.parammaps.pastureid
         + '&startTime='+ startTime
         + '&endTime='+ stopTime
         + '&offset='+ this.getdataListParm.offset
         + '&pageCount='+ this.getdataListParm.pagecount
         getJson(url,data).then(response => {
-          this.list = response.data.list
+          this.list = response.data
           this.pageNum = response.data.pageNum
           this.pageSize = response.data.pageSize
           if (response.data.total) {
@@ -150,15 +151,28 @@
           }
           this.percentage = this.percentage
         }, 1000)
-        this.requestParam.name = 'meteringOutfit'
-        this.requestParam.parammaps.formType = '车辆记录'
-        this.requestParam.parammaps.pastureName = this.getdataListParm.parammaps.pastureName
-        this.requestParam.parammaps.departName = this.getdataListParm.parammaps.departName
-        GetDataByName(this.requestParam).then(response => {
+
+        let url = 'authdata/vehicleL/list'
+        var startTime = ''
+        var stopTime = ''
+        if(this.getdataListParm.parammaps.inputDatetime !== null && this.getdataListParm.parammaps.inputDatetime.length > 0){
+          startTime = parseTime(this.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
+          stopTime = parseTime(this.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
+        }else{
+          this.getdataListParm.parammaps.inputDatetime = []
+          startTime = ''
+          stopTime = ''
+        }
+        let data = "?pastureId=" + this.getdataListParm.parammaps.pastureid
+        + '&startTime='+ startTime
+        + '&endTime='+ stopTime
+        + '&offset='+ this.getdataListParm.offset
+        + '&pageCount='+ 0
+        getJson(url,data).then(response => {
           this.$nextTick(() => {
             import('@/vendor/Export2Excel').then(excel => {
-              const list1 = response.data.list
-              if (response.data.list !== '') {
+              const list1 = response.data
+              if (response.data !== '') {
                 this.percentage = 99
                 setTimeout(() => {
                   this.isPercentage = false
@@ -166,13 +180,14 @@
               }
 
               const tHeader = [
-                '牧场','日期','设备编码','柳工机号','开机小时(H)','怠速小时(H)','油耗(L)','怠速油耗(H)','平均油耗(L/H)','经度','油位(%)','耗电量','平价耗电量','充电量','充电时长','电动设备状态','电池包 SOC(%)'
+                '牧场','日期','设备编码','柳工机号','开机小时(H)','怠速小时(H)','油耗(L)','怠速油耗(H)','平均油耗(L/H)','经度','维度','油位(%)','耗电量','平价耗电量','充电量','充电时长','电动设备状态','电池包 SOC(%)'
               ]
               const filterVal = [
-                '','','','','','','','','','','','','','','','',''
+                'pastureName','dataTime','eqCode','license','workHour','idleHour','fuelConsumption','idleFuel','hoursConsumption','longitude','latitude',
+                'fuelLevel','powerConsumption','hoursPowerConsumption','chargeCapacity','chargeHour','chargeStatus','batteryPackSoc'
               ]
               const data1 = this.formatJson(filterVal, list1)
-              excel.export_json_to_excel({ header: tHeader, data: data1, filename: this.requestParam.parammaps.formType, autoWidth: true, bookType: 'xlsx' })
+              excel.export_json_to_excel({ header: tHeader, data: data1, filename: '车辆记录', autoWidth: true, bookType: 'xlsx' })
             })
           })
         })