caojunjie 3 سال پیش
والد
کامیت
b3b43415da

+ 51 - 7
src/components/trackPlayback.vue

@@ -31,12 +31,16 @@ export default {
     dialogVisible: {
       type: Boolean
     },
+    parkingPoint: {
+      type: Boolean
+    },
     lineArr:Object,
   },
   data(){
     return{
       map: null,
-      marker: null
+      marker: null,
+      infoWindow: null
     }
   },
   beforeDestroy() {
@@ -82,15 +86,47 @@ export default {
         strokeWeight: 6 //线宽
         // strokeStyle: "solid"  //线样式
       });
-
-      this.marker.on("moving", function (e) {
-        passedPolyline.setPath(e.passedPath);
-      });
-
+      if (this.parkingPoint.length>0){
+        this.infoWindow = new AMap.InfoWindow({
+          offset: new AMap.Pixel(0, -30)
+        });
+        for (let i = 0; i < this.parkingPoint.length; i++) {
+          this.marker = new AMap.Marker({
+            position: this.parkingPoint[i].location,
+            map: this.map
+          });
+          // (this.parkingPoint[i].ete - this.parkingPoint[i].bte)
+          console.log(this.fun(this.parkingPoint[i].bte, this.parkingPoint[i].ete));
+          this.marker.content = '<div style="width: 300px;">'
+              + '<p style="font-size: 22px;font-weight: bold;background-color: #2d8cf0;color: #fff;">' + this.fun(this.parkingPoint[i].bte, this.parkingPoint[i].ete) + '</p>'
+              + '<p style="padding: 5px 0"><span style="color: #a0a0a0">停车时间:</span>' + (new Date(Number(this.parkingPoint[i].bte) + 8 * 60 * 60 * 1000).toJSON().split('T').join(' ').substr(0, 19)).slice(5,19)+'至'+ (new Date(Number(this.parkingPoint[i].ete) + 8 * 60 * 60 * 1000).toJSON().split('T').join(' ').substr(0, 19)).slice(5,19)+ '</p>'
+              + '<p><span style="color: #a0a0a0">当前位置:</span>' +this.parkingPoint[i].address + '</p>'
+              + '</div>'
+          this.marker.on('click', this.markerClick);
+          this.marker.emit('click', {target: this.marker});
+        }
+      }
       this.map.setFitView();
     },
+    fun(startTime,endTime) {
+      let usedTime = endTime - startTime; // 相差的毫秒数
+      let days = Math.floor(usedTime / (24 * 3600 * 1000)); // 计算出天数
+      let leavel = usedTime % (24 * 3600 * 1000); // 计算天数后剩余的时间
+      let hours = Math.floor(leavel / (3600 * 1000)); // 计算剩余的小时数
+      let leavel2 = leavel % (3600 * 1000); // 计算剩余小时后剩余的毫秒数
+      let minutes = Math.floor(leavel2 / (60 * 1000)); // 计算剩余的分钟数
+      if (startTime && endTime){
+        return  days + '天' + hours + '时' + minutes + '分'
+      }else {
+        return '获取失败'
+      }
+    },
+    markerClick(e) {
+      this.infoWindow.setContent(e.target.content);
+      this.infoWindow.open(this.map, e.target.getPosition());
+    },
     startAnimation() {
-      this.marker.moveAlong(this.lineArr, 100000);
+      this.marker.moveAlong(this.lineArr, 10000);
     },
     pauseAnimation() {
       this.marker.pauseMove();
@@ -154,4 +190,12 @@ export default {
 ::v-deep .el-dialog__body {
   padding: 0 20px 10px 20px !important;
 }
+
+::v-deep .amap-info-close{
+  right: 10px!important;
+  top: 12px !important;
+}
+::v-deep .amap-info-content{
+  padding: 5px 5px 5px 5px !important;
+}
 </style>

+ 3 - 3
src/views/landTransportation/dispatchingCars/detailPage.vue

@@ -239,7 +239,7 @@
               size="small"
               type="text"
               @click="changeFleetT(row, index)"
-              v-if="row.status===2||row.status===3"
+              v-if="row.status !== 0 || row.status !==1 || row.status !==4"
           >变 更
           </el-button>
           <el-button
@@ -1566,8 +1566,8 @@ export default {
   },
   methods: {
     openTrack(row){
-      gaude({itemId: row.id,plateNo:row.plateNo,tenantId:'234557'}).then(res => {
-        this.lineArr = res.data.data
+      gaude({itemId: row.id,plateNo:row.plateNo,tenantId:'234557',color:'2'}).then(res => {
+        this.lineArr = res.data.data.trackArray
         this.dialogVisibleTwo = true
         let this_=this
         setTimeout(function(){

+ 3 - 3
src/views/landTransportation/motorcadeDriver/index.vue

@@ -447,11 +447,11 @@ export default {
             search: true,
             index: 8,
             allowCreate: true,
-            prop: 'plateNo',
+            prop: "plateNo",
             overHidden: true,
             filterable: true,
             cascader: ['driverId'],
-            type: 'select',
+            type: "select",
             dicUrl: "/api/blade-client/land-vehicle/vehicle-list?fleetId={{key}}",
             props: {
               label: "plateNo",
@@ -467,7 +467,7 @@ export default {
             filterable: true,
             index: 9,
             prop: 'driverId',
-            type: 'select',
+            type: "select",
             dicUrl: "/api/blade-client/land-driver/driver-list?plateNo={{key}}",
             props: {
               label: "name",

+ 2 - 2
src/views/landTransportation/placeAnOrder/detailPage.vue

@@ -1521,8 +1521,8 @@ export default {
   },
   methods: {
     openTrack(row){
-      gaude({itemId: row.id,plateNo:row.plateNo,tenantId:'234557'}).then(res => {
-        this.lineArr = res.data.data
+      gaude({itemId: row.id,plateNo:row.plateNo,tenantId:'234557',color:'2'}).then(res => {
+        this.lineArr = res.data.data.trackArray
         this.dialogVisible = true
         let this_=this
         setTimeout(function(){

+ 29 - 3
src/views/landTransportation/reportAnalysis/index.vue

@@ -11,9 +11,14 @@
           @resetColumn="resetColumn"
           @saveColumn="saveColumn"
           @search-change="searchChange"
+          @search-reset="query = {}"
           @search-criteria-switch="searchCriteriaSwitch"
           @row-save="(row,done,loading)=>{rowSave(row,0,done,loading)}"
           @row-update="rowSave">
+        <template slot="plateNo" slot-scope="{row}">
+                <span class="el-button--text" style="cursor: pointer"
+                      @click="openTrack(row)">{{ row.plateNo }}</span>
+        </template>
         <template slot="menuLeft">
           <el-button type="info" size="small" @click="outExport" icon="el-icon-download">导出</el-button>
         </template>
@@ -132,6 +137,7 @@
           <el-button @click="enclosure = false" size="small">取 消</el-button>
         </span>
       </el-dialog>
+      <track-playback :dialogVisible="dialogVisibleTwo" :parkingPoint="parkingPoint" :lineArr="lineArr" ref="playback"></track-playback>
     </basic-container>
   </div>
 </template>
@@ -152,6 +158,7 @@ import {
   cancelConfirm, standingBookCollection
 } from "@/api/landTransportation";
 import {getToken} from "@/util/auth";
+import {gaude} from "@/api/gaude";
 
 export default {
   name: "index",
@@ -160,6 +167,9 @@ export default {
       key: 0,
       form: {},
       enclosure:false,
+      dialogVisibleTwo:false,
+      lineArr: [],
+      parkingPoint: [],
       orderList: [],
       collectionOptionBackup: {
         align: 'center',
@@ -215,6 +225,7 @@ export default {
       incidentalType: false,
       confirmStatus:0,
       activeName: '',
+      query: {},
       page: {
         pageSize: 10,
         currentPage: 1,
@@ -456,6 +467,17 @@ export default {
     }
   },
   methods: {
+    openTrack(row){
+      gaude({itemId: row.id,plateNo:row.plateNo,tenantId:'234557',color:'2'}).then(res => {
+        this.lineArr = res.data.data.trackArray
+        this.parkingPoint = res.data.data.parkArray
+        this.dialogVisibleTwo = true
+        let this_=this
+        setTimeout(function(){
+          this_.$refs.playback.initMap();
+        },100)
+      })
+    },
     //导出
     outExport() {
       this.$confirm('是否导出数据明细?', '提示', {
@@ -580,6 +602,7 @@ export default {
     },
     //搜索
     searchChange(params, done) {
+      this.query = params;
       this.onLoad(this.page, params)
       done();
     },
@@ -597,12 +620,15 @@ export default {
         size: page.pageSize,
         current: page.currentPage,
         tag: '0',
-        ...params
+        ...params?params:this.query
       }
+      console.log(queryParams)
       if (queryParams.arrivalTime) {
-        queryParams.beginArrivalTime = params.arrivalTime[0]
-        queryParams.endArrivalTime = params.arrivalTime[1]
+        queryParams.beginArrivalTime = queryParams.arrivalTime[0]
+        queryParams.endArrivalTime = queryParams.arrivalTime[1]
         delete queryParams.arrivalTime
+      }else {
+
       }
       this.loading = true;
       standingBookCollection(queryParams).then(res => {