pengjing 1 年之前
父节点
当前提交
a5a1020843

+ 16 - 1
YLShipBuildLandMap.Web/wwwroot/app/main/map-index.html

@@ -4,10 +4,15 @@
     </div>
     <div class="search_panel">
         <div class="search_label">
-            <input type="text" style="" ng-model="searchInput" id="searchInput"/>
+            <input type="text" style="" ng-model="searchInput" id="searchInput" />
             <img src="images/search3.png" ng-click="searchBuilding()" />
         </div>
     </div>
+    <div class="search_list" ng-if="searchInput!='' && isShowSearchList">
+        <div style="padding:10px;">
+            <p ng-repeat="it in searchList" ng-click="clickSearchRoom(it)">{{it.BuildingName}}-{{it.FloorName}}-{{it.RoomName}}-{{it.DepartmentOrServiceName}}</p>
+        </div>
+    </div>
 </div>
 <div ng-if="isShowMark" id="nowPositionMask" class="nowPositionMask" ng-click="showModal()" ng-style="nowPositionStyle">
     <div class="mask"></div>
@@ -113,6 +118,16 @@
                     cursor: pointer;
                 }
 
+        .map_page .search_list {
+            position: absolute;
+            z-index: 1000;
+            top: 100px;
+        }
+    .search_list {
+        border-radius: 8px;
+        background-color: #f7f9fb;
+    }
+
     .nowPositionMask {
         position: absolute;
         z-index: 1000;

+ 42 - 4
YLShipBuildLandMap.Web/wwwroot/app/main/map-index.js

@@ -14,6 +14,8 @@
         $scope.floorList = [];
         $scope.roomList = [];
         $scope.roomModel = [];
+        $scope.searchList = [];
+        $scope.isShowSearchList = false;
 
         $("#mapimg").css("height", $(window).height());
 
@@ -41,14 +43,14 @@
 
             if ($scope.searchInput) {
 
-                var buildingList = $scope.buildingXYAxisList.filter(x => x.BuildingName.indexOf($scope.searchInput) >= 0);
+                /*var buildingList = $scope.buildingXYAxisList.filter(x => x.BuildingName.indexOf($scope.searchInput) >= 0);
                 if (buildingList.length > 0) {
                     $scope.goBuilding(buildingList[0]);
                     return;
-                }
+                }*/
 
                 var searchRoomList = $scope.allRoomList.filter(x => x.DepartmentOrServiceName.indexOf($scope.searchInput) >= 0);
-                if (searchRoomList.length > 0) {
+                /*if (searchRoomList.length > 0) {
                     var searchRoom = searchRoomList[0];
                     buildingList = $scope.buildingXYAxisList.filter(x => x.BuildingId == searchRoom.BuildingId);
                     if (buildingList.length > 0) {
@@ -60,7 +62,31 @@
                             $scope.floorClick(searchFloor[0]);
                         }, 500);
                     }
-                }
+                }*/
+
+                $scope.searchList = [];
+
+                searchRoomList.forEach(r => {
+                    var building = $scope.buildingXYAxisList.filter(e => e.BuildingId == r.BuildingId);
+                    $scope.searchList.push({ BuildingFloorId: r.BuildingFloorId, BuildingId: r.BuildingId, RoomName: r.RoomName, DepartmentOrServiceName: r.DepartmentOrServiceName, FloorName: r.FloorName, BuildingName: building.length > 0 ? building[0].BuildingName:"" });
+                });
+
+                $scope.isShowSearchList = $scope.searchList.length > 0;
+            }
+        };
+
+        $scope.clickSearchRoom = function (room) {
+            $scope.isShowSearchList = false;
+            var buildingList = $scope.buildingXYAxisList.filter(x => x.BuildingId == room.BuildingId);
+
+            if (buildingList.length > 0) {
+                $scope.goBuilding(buildingList[0]);
+
+                var searchFloor = $scope.floorList.filter(x => x.BuildingFloorId == room.BuildingFloorId);
+
+                $timeout(function () {
+                    $scope.floorClick(searchFloor[0]);
+                }, 500);
             }
         };
 
@@ -155,6 +181,18 @@
             return $scope.searchInput != '' && ((room.RoomName != null && room.RoomName != '' && room.RoomName.indexOf($scope.searchInput) >= 0) || (room.DepartmentOrServiceName != null && room.DepartmentOrServiceName != '' && room.DepartmentOrServiceName.indexOf($scope.searchInput) >= 0));
         };
 
+        $(document).on('touchstart', function (e) {
+            // touch start event handler code here
+        });
+
+        $(document).on('touchmove', function (e) {
+            // touch move event handler code here
+        });
+
+        $(document).on('touchend', function (e) {
+            // touch end event handler code here
+        });
+
         //加载列表数据
         $scope.getBuildingXYAxisList = function () {
             $http

+ 9 - 1
YLShipBuildLandMap.Web/wwwroot/app/main/map.js

@@ -5,8 +5,16 @@
 
             $("#mapimg").css("height", $(window).height());
 
+            var minX = 0.757002;
+            var maxX = 0.891748;
+            var minY = 0.422746;
+            var maxY = 0.536480;
+
             $("#mapimg").click(function (e) {
-                if (e.offsetX >= 1000 && e.offsetX <= 1178 && e.offsetY >= 394 && e.offsetY <= 500) {
+
+                var img = $("#mapimg")[0];
+
+                if (e.offsetX >= minX * img.width && e.offsetX <= maxX * img.width && e.offsetY >= minY * img.height && e.offsetY <= maxY * img.height) {
                     $state.go("map-index");
                 }
                 else {