Browse Source

车辆记录对接

duanxiaoduan 1 year ago
parent
commit
b8512d11fc
2 changed files with 24 additions and 14 deletions
  1. 1 1
      src/api/common.js
  2. 23 13
      src/views/maintenance/vehicleRecords/index.vue

+ 1 - 1
src/api/common.js

@@ -193,7 +193,7 @@ export function removeimage(data) {
 }
 export function getJson(url,data) {
   return request({
-    url: process.env.VUE_APP_BASE_API + url + data,
+    url:  url + data,
     method: 'get'
   })
 }

+ 23 - 13
src/views/maintenance/vehicleRecords/index.vue

@@ -1,13 +1,12 @@
 <template>
   <div class="app-container">
     <div class="filter-container">
-      <el-select v-model="getdataListParm.parammaps.pastureName" placeholder="牧场" class="filter-item" style="width: 110px">
+      <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-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 v-waves class="filter-item" type="primary" icon="el-icon-search" @click="form_search">搜索</el-button>
-      <el-button v-waves class="filter-item" type="success" icon="el-icon-download" @click="handleDownload">导出</el-button>
-
+      <el-button class="filter-item" type="primary" icon="el-icon-search" @click="form_search">搜索</el-button>
+      <el-button class="filter-item" type="success" icon="el-icon-download" @click="handleDownload">导出</el-button>
     </div>
     <el-table
       :key="tableKey"
@@ -53,20 +52,23 @@
 </template>
 
 <script>
-  import { GetDataByName, checkButtons } from '@/api/common'
+  import { GetDataByName,GetDataByNames,getJson, checkButtons } from '@/api/common'
   import { parseTime } from '@/utils/index.js'
+  import Pagination from '@/components/Pagination' // secondary package based on el-pagination
   import Cookies from 'js-cookie'
   export default{
     name:'VehicleRecords',
+    components: { Pagination },
     data() {
       return {
+        myHeight:document.documentElement.clientHeight - 85- 200,
         buttons:[],
-        listLoading:false,pageNum:0,pageSize:0,total:0,
+        listLoading:false,pageNum:0,pageSize:0,total:0,tableKey: 0,
         list:[],
         getdataListParm: {
-          name: 'geteqSTTList', page: 1, offset: 1, pagecount: 10, returntype: 'Map',
+          page: 1, offset: 1, pagecount: 10, returntype: 'Map',
           parammaps: {
-            pastureName: Cookies.get('pasturename'),
+            pastureid: Cookies.get('pastureid'),
             inputDatetime:[],
             startTime:'',
             stopTime:''
@@ -105,15 +107,23 @@
       },
       get_table_data(){
         this.listLoading = true
+        var startTime = ''
+        var stopTime = ''
         if(this.getdataListParm.parammaps.inputDatetime !== null && this.getdataListParm.parammaps.inputDatetime.length > 0){
-          this.getdataListParm.parammaps.startTime = parseTime(this.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
-          this.getdataListParm.parammaps.stopTime = parseTime(this.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
+          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 = []
-          this.getdataListParm.parammaps.startTime = ''
-          this.getdataListParm.parammaps.stopTime = ''
+          startTime = ''
+          stopTime = ''
         }
-        GetDataByName(this.getdataListParm).then(response => {
+        let url = 'authdata/vehicleL/list'
+        let data = "?pastureId=" + Cookies.get('pastureid')
+        + '&startTime='+ startTime
+        + '&endTime='+ stopTime
+        + '&offset='+ this.getdataListParm.offset
+        + '&pageCount='+ this.getdataListParm.pagecount
+        getJson(url,data).then(response => {
           this.list = response.data.list
           this.pageNum = response.data.pageNum
           this.pageSize = response.data.pageSize