Browse Source

车辆轨迹分析改为历史轨迹查看

ZXW 7 years ago
parent
commit
6209f537f6

+ 2 - 5
src/widgets/XJCarPathAnalysis/Widget.html

@@ -168,11 +168,8 @@ $$
     </div>
 </div>
 $$
-<div class="pathpointinfowindow">
+<div class="pathpointinfowindow"> 
     <p><span>定位时间:${time}</span></p>
-    <p><span>间距:${distance}</span></p>
-    <p><span>耗时:${timespan}</span></p>
     <p><span>速度:${speed}</span></p>
-    <p><span>卫星:${star}</span></P>
-    <p><span>精度:${precision}</span></p>
+  
 </div>

+ 20 - 161
src/widgets/XJCarPathAnalysis/Widget.ts

@@ -437,14 +437,14 @@ class XJCarPathAnalysis extends BaseWidget {
             //分页显示分析结果
             this.pageIndex = 1;
             this.pageSize = 5;
-            this.requestPathAnalysisResult(this.pageIndex, this.pageSize, queryParms[0], queryParms[1], queryParms[3], queryParms[4], this.initPathAnalysisResultList.bind(this));
+           // this.requestPathAnalysisResult(this.pageIndex, this.pageSize, queryParms[0], queryParms[1], queryParms[3], queryParms[4], this.initPathAnalysisResultList.bind(this));
             //添加巡检人员需巡检的巡检点到地图
-            this.checkPointGraphicLayer.clear();
-            if (this.pathAnalysisDetailpanel !== undefined) {
-                this.pathAnalysisDetailpanel.Destroy();
-                this.pathAnalysisDetailpanel = undefined;
-            }
-            this.requestWorkerCheckPoint(queryParms[0], queryParms[1], queryParms[2]);
+            // this.checkPointGraphicLayer.clear();
+            // if (this.pathAnalysisDetailpanel !== undefined) {
+            //     this.pathAnalysisDetailpanel.Destroy();
+            //     this.pathAnalysisDetailpanel = undefined;
+            // }
+            // this.requestWorkerCheckPoint(queryParms[0], queryParms[1], queryParms[2]);
 
         }
     }
@@ -479,17 +479,16 @@ class XJCarPathAnalysis extends BaseWidget {
             data: {
                 "pagesize": pagesize,
                 "pageindex": pageindex,
-                "uploadtime1": date + " " + startTime,
-                "uploadtime2": date + " " + endTime,
-                "carid": carId,
-                'gps_type': 1
+                "start": date + " " + startTime,
+                "end": date + " " + endTime,
+                "carid": carId             
             },
             success: function (result) {
                 this.domObj.find(" button.query").prop("disabled", "");
                 this.domObj.find("button.query").text("查询");
                 if (result.code !== 1) {
                     toast.Show(config.MSG_error);
-                } else if (result.result.rows.length==0||result.result.rows[0].guiji.length === 0) {
+                } else if (result.result.rows.length==0) {
                     toast.Show(config.MSG_null);
                 } else {
                     callback(result);
@@ -662,7 +661,7 @@ class XJCarPathAnalysis extends BaseWidget {
     addPathToMap(result) {
         //清除原有的图形
         this.analysisPathGraphicLayer.clear();
-        var rows: Array<any> = result.result.rows[0].guiji;
+        var rows: Array<any> = result.result.rows;
         var linePath: Array<any> = [];
 
         for (var i = 0, length = rows.length; i < length; i++) {
@@ -676,19 +675,15 @@ class XJCarPathAnalysis extends BaseWidget {
             });
             var graphic = new Graphic(point, this.symbol.pointSymbol, "", infoTemplate);
             //设置点的属性
-            var time = rows[i].gpstime.split(" ")[1];//gps定位时间
-            var distance = (rows[i].distance != null) ? (rows[i].distance) : "-";//与上一个点的距离(m)
-            var needTime = (rows[i].gps_timespan != null) ? (rows[i].gps_timespan).toFixed(2) : "-";//与上一个点的时间间隔(s->min)
+            var time = rows[i].gpstime;//gps定位时间
+           // var distance = (rows[i].distance != null) ? (rows[i].distance) : "-";//与上一个点的距离(m)
+            //var needTime = (rows[i].gps_timespan != null) ? (rows[i].gps_timespan).toFixed(2) : "-";//与上一个点的时间间隔(s->min)
             var speed = (rows[i].speed === "" || rows[i].speed === null) ? "-" : (rows[i].speed).toFixed(2);//速度(m/s)
-            var star = rows[i].gps_star || "-";
-            var precision = rows[i].gps_precision || "-"
-            graphic.setAttributes({
-                "distance": distance + "m",
+            //var star = rows[i].gps_star || "-";
+            //var precision = rows[i].gps_precision || "-"
+            graphic.setAttributes({    
                 "time": time,
-                "timespan": needTime + "s",
-                "speed": speed + "m/s",
-                "star": star + "个",
-                "precision": precision
+                "speed": speed + "km/h",
             });
             if (i !== 1 || i !== length - 1) {
                 this.analysisPathGraphicLayer.add(graphic);
@@ -766,143 +761,7 @@ class XJCarPathAnalysis extends BaseWidget {
     }
 
 
-    /*
-   * 查看单个巡检人员的计划,及完成情况,用于和巡检轨迹对比
-   */
-
-    //获取巡检人巡检点
-    requestWorkerCheckPoint(userid, dateNow, dateNext) {
-        //获取巡检人员巡检计划包含今天的所有巡检计划id
-        this.requestWorkerAllPlanId(userid, dateNow, this.requestCheckedPoint.bind(this));
-        //
-
-    }
-
-    //获取巡检人员巡检计划包含今天的所有巡检计划id
-    requestWorkerAllPlanId(userid, searchDate, callback) {
-        var config = this.config.requestWorkerAllPlanId;
-        var toast = this.AppX.runtimeConfig.toast;
-        $.ajax({
-            headers: {
-                'Token': AppX.appConfig.xjxj,
-                'departmentid': AppX.appConfig.departmentid,
-            },
-            type: "POST",
-            url: AppX.appConfig.xjapiroot.replace(/\/+$/, "") + config.URL_request,
-            data: {
-                "user_id": userid,
-                "search_date": searchDate,
-                "isvalid": 1
-            },
-            success: function (response) {
-
-                if (response.code != 1) {
-                    console.log(config.MSG_error);
-                    return;
-                } else if (response.result.length === 0) {
-                    console.log(config.MSG_null);
-                    return;
-                } else {
-                    var rows = response.result.rows;
-                    for (var i = 0, length = rows.length; i < length; i++) {
-                        var mainPlanId = rows[i].plan_id; //巡检主计划id
-                        callback(mainPlanId, searchDate, this.addWorkerCheckedPointList.bind(this));
-                    }
-                }
-            }.bind(this),
-            error: function () {
-                toast.Show(config.MSG_error);
-            },
-            dataType: "json",
-        });
-    }
-
-    //获取某个计划下的巡检点
-    requestCheckedPoint(mainPlanId, searchDate, callBack) {
-        var config = this.config.requestCheckedPoint;
-        var toast = this.AppX.runtimeConfig.toast;
-        $.ajax({
-            headers: {
-                'Token': AppX.appConfig.xjxj,
-                'departmentid': AppX.appConfig.departmentid,
-            },
-            type: "POST",
-            url: AppX.appConfig.xjapiroot.replace(/\/+$/, "") + config.URL_request,
-            data: {
-                "plan_id": mainPlanId,
-                "search_date": searchDate,
-            },
-            success: function (response) {
-
-                if (response.code != 1) {
-                    console.log(config.MSG_error);
-                } else if (response.result.length === 0) {
-                    console.log(config.MSG_null);
-                } else {
-                    callBack(response);
-                }
-            }.bind(this),
-            error: function () {
-                console.log(config.MSG_error);
-            },
-            dataType: "json",
-        });
-    }
-
-    //添加巡检点到地图
-    addWorkerCheckedPointList(result) {
-        var checkPoints = result.result[0].plan_child_points;
-        for (var i = 0, length = checkPoints.length; i < length; i++) {
-            //设备名称
-            var name = checkPoints[i].name;
-            if (name === "") {
-                name = checkPoints[i].device_type_name;
-            }
-            //
-            var devicePng = "";
-            var checkedTime = "--";
-
-            var state = checkPoints[i].isover;
-            var geometryJson = "";//点、线、面
-            geometryJson = checkPoints[i].geometry;
-            var geometry;
-            var symbol = undefined;
-            if (/paths/.test(geometryJson)) {
-                geometry = new Polyline(JSON.parse(geometryJson));
-                if (state == 0) {//未检
-                    symbol = this.symbol.planCheckingLineSymbol;
-                } else {//已检
-                    checkedTime = checkPoints[i].over_date.split(" ")[1];
-                    symbol = this.symbol.planCheckedLineSymbol;
-                }
-
-            } else if (/rings/.test(geometry)) {
-                geometry = new Polygon(JSON.parse(geometryJson));
-                if (state == 0) {//未检
-                    symbol = this.symbol.planCheckingPointSymbol;
-                } else {//已检
-                    checkedTime = checkPoints[i].last_time.split(" ")[1];
-                    symbol = this.symbol.planCheckedPointSymbol;
-                }
-
-            } else {
-                geometry = new Point(JSON.parse(geometryJson));
-                if (state == 0) {//未检
-                    symbol = this.symbol.planCheckingPointSymbol;
-                } else {//已检
-                    checkedTime = checkPoints[i].last_time.split(" ")[1];
-                    symbol = this.symbol.planCheckedPointSymbol;
-                }
-
-            }
-            //添加巡检设备到地图
-            var deviceGraphic = new Graphic(geometry, symbol);
-            this.checkPointGraphicLayer.add(deviceGraphic);
-        }
-    }
-
-
-
+  
 }
 
 

+ 3 - 3
src/widgets/XJCarPathAnalysis/config.json

@@ -26,9 +26,9 @@
         "PNGPATH_CheckingPointPng": "/widgets/XJPathAnalysis/css/img/checkingpoint.png"
     },
     "requestPathAnalysisResult": {
-        "URL_request": "/Gps/list",
-        "MSG_error": "轨迹分析出错!",
-        "MSG_null": "轨迹分析结果为空!"
+        "URL_request": "/GpsCar/list",
+        "MSG_error": "获取轨迹出错!",
+        "MSG_null": "获取轨迹结果为空!"
     },
     "requestWorkerAllPlanId": {
         "URL_request": "/Plan/list",

+ 4 - 0
src/widgets/XJCarPathAnalysis/css/style.scss

@@ -13,6 +13,10 @@
     .query {
         margin-top: 15px;
     }
+
+    .company{
+        display: none;
+    }
 }