ソースを参照

达沃特国内贸易里销售订单

caojunjie 1 年間 前
コミット
75708f59b5
1 ファイル変更82 行追加1 行削除
  1. 82 1
      src/views/businessManagement/salesOrder/index.vue

+ 82 - 1
src/views/businessManagement/salesOrder/index.vue

@@ -35,6 +35,11 @@
             </el-table-column>
           </el-table>
         </template>
+          <!--车号1-->
+          <template slot="wagonNumberOne" slot-scope="{ row }">
+              <span style="color: #409EFF;" @click="openTrack(row,1)">{{row.wagonNumberOne}}</span>
+          </template>
+
         <template slot-scope="scope" slot="orderNo">
           <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row, scope.index)">{{scope.row.orgOrderNo}}</span>
         </template>
@@ -90,6 +95,17 @@
     </basic-container>
 
     <detail-page ref="detail" :isProcurements = "isProcurements" @goBack="goBack" :detailData="detailData" v-if="!isShow"></detail-page>
+
+
+      <el-dialog
+          title="实时位置"
+          append-to-body
+          custom-class="dialog_two"
+          :visible.sync="dialogVisible"
+          lock-scroll
+          width="80%">
+          <div id="container"></div>
+      </el-dialog>
   </div>
 </template>
 
@@ -113,6 +129,7 @@ import { getToken } from "@/util/auth";
 import os from "os";
 import { gainUser } from "@/api/basicData/customerInquiry";
 import { getCurrentDate } from "@/util/date";
+import {location} from "@/api/gaude";
 export default {
   name: "customerInformation",
   components: {
@@ -149,10 +166,18 @@ export default {
       isShow: true,
       detailData: {},
       warehouseTypeOption: [],
-      warehouseList: []
+      warehouseList: [],
+        // 车号弹窗显示位置
+        dialogVisible:false,
+        // 当前用户的租户号
+        hctenantId:null,
     };
   },
   async created() {
+      // 获取缓存里的租户号信息
+      this.hctenantId = JSON.parse(localStorage.getItem('saber-tenantId')).content
+
+
     // this.search.businesDate = defaultDate(1);
     this.search.createTime = defaultDate(3);
     // this.option = option
@@ -242,6 +267,62 @@ export default {
     }, 100);
   },
   methods: {
+      // 车号查询位置
+      openTrack(row, index) {
+          location({itemId: row.itemId, plateNo: row.wagonNumberOne, tenantId: this.hctenantId, color: '2'}).then(res => {
+              this.dialogVisible = true
+              let this_ = this
+              setTimeout(function () {
+                  this_.initMap(res.data.data, row.wagonNumberOne);
+              }, 1000)
+          })
+      },
+      markerClick(e) {
+          this.infoWindow.setContent(e.target.content);
+          this.infoWindow.open(this.map, e.target.getPosition());
+      },
+      initMap(data, plateNo) {
+          this.map = new AMap.Map("container", {resizeEnable: true});
+          this.infoWindow = new AMap.InfoWindow({
+              ffset: new AMap.Pixel(0, -30),
+              offset: new AMap.Pixel(0, -30)
+          });
+          let icon = new AMap.Icon({
+              size: new AMap.Size(52, 26), // 图标尺寸
+              image: 'https://trade.tubaosoft.com/file/bladex/000000/1123598821738675201/che.png',
+              imageSize: new AMap.Size(52, 26), // 根据所设置的大小拉伸或压缩图片
+          });
+          this.marker = new AMap.Marker({
+              position: data.location,
+              map: this.map,
+              icon: icon,
+              markerMeta: new AMap.Size(28, 28),
+              offset: new AMap.Pixel(-26, -15),
+              autoRotation: true,
+              angle: -15
+          });
+          this.marker.content = '<div style="width: 300px;">'
+              + '<p style="font-size: 22px;font-weight: bold;background-color: #2d8cf0;color: #fff;">' + plateNo + '</p>'
+              + '<p style="padding: 5px 0"><span style="color: #a0a0a0">最后上报时间:</span>' + new Date(Number(data.time) + 8 * 60 * 60 * 1000).toJSON().split('T').join(' ').substr(0, 19) + '</p>'
+              + '<div style="width: 150px;float: left;">'
+              + '<p style="padding: 5px 0"><span style="color: #a0a0a0">车辆状态:</span>' + (data.speed > 0 ? '行驶中' : '停车') + '</p>'
+              + '</div>'
+              + '<div style="width: 150px;float: right;">'
+              + '<p style="padding: 5px 0"><span style="color: #a0a0a0">速度:</span>' + data.speed + 'km/h</p>'
+              + '</div>'
+              + '<p><span style="color: #a0a0a0">当前位置:</span>' + data.address + '</p>'
+              + '<p style="padding: 5px 0"><span style="color: #a0a0a0">经纬度:</span>' + data.location.join(',') + '</p>'
+              + '</div>'
+          this.infoWindow.open(this.map, this.map.getCenter());
+          this.marker.on('click', this.markerClick);
+          this.marker.emit('click', {target: this.marker});
+          this.map.setFitView();
+      },
+
+
+
+
+
     searchCriteriaSwitch(type) {
       if (type) {
         this.option.height = this.option.height - 190;