shs 1 rok pred
rodič
commit
c7fca70669

+ 5 - 5
aidex-admin/src/main/resources/application.yml

@@ -36,8 +36,8 @@ server:
 # 日志配置
 logging:
   level:
-    com.aidex: info
-    org.springframework: info
+    com.aidex: error
+    org.springframework: error
 
 # 用户配置
 user:
@@ -70,13 +70,13 @@ spring:
   # redis 配置
   redis:
     # 地址
-    host: localhost
+    host: 192.168.1.243
     # 端口,默认为6379
-    port: 16379
+    port: 6379
     # 数据库索引
     database: 0
     # 密码
-    password:
+    password: 12345678
     # 连接超时时间
     timeout: 10s
     lettuce:

+ 8 - 8
aidex-admin/src/main/resources/logback.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <configuration>
     <!-- 日志存放路径 -->
-	<property name="log.path" value="/home/aidex/logs" />
+	<property name="log.path" value="./logs" />
     <!-- 日志输出格式 -->
 	<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
 
@@ -11,7 +11,7 @@
 			<pattern>${log.pattern}</pattern>
 		</encoder>
 	</appender>
-	
+
 	<!-- 系统日志输出 -->
 	<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
 	    <file>${log.path}/sys-info.log</file>
@@ -34,7 +34,7 @@
             <onMismatch>DENY</onMismatch>
         </filter>
 	</appender>
-	
+
 	<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
 	    <file>${log.path}/sys-error.log</file>
         <!-- 循环政策:基于时间创建日志文件 -->
@@ -56,7 +56,7 @@
             <onMismatch>DENY</onMismatch>
         </filter>
     </appender>
-	
+
 	<!-- 用户访问日志输出  -->
     <appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
 		<file>${log.path}/sys-user.log</file>
@@ -70,7 +70,7 @@
             <pattern>${log.pattern}</pattern>
         </encoder>
     </appender>
-	
+
 	<!-- 系统模块日志级别控制  -->
 	<logger name="com.aidex" level="error" />
 	<!-- Spring日志级别控制  -->
@@ -79,15 +79,15 @@
 	<root level="error">
 		<appender-ref ref="console" />
 	</root>
-	
+
 	<!--系统操作日志-->
     <root level="error">
         <appender-ref ref="file_info" />
         <appender-ref ref="file_error" />
     </root>
-	
+
 	<!--系统用户操作日志-->
     <logger name="sys-user" level="error">
         <appender-ref ref="sys-user"/>
     </logger>
-</configuration> 
+</configuration>

+ 5 - 5
aidex-admin/target/classes/application.yml

@@ -36,8 +36,8 @@ server:
 # 日志配置
 logging:
   level:
-    com.aidex: info
-    org.springframework: info
+    com.aidex: error
+    org.springframework: error
 
 # 用户配置
 user:
@@ -70,13 +70,13 @@ spring:
   # redis 配置
   redis:
     # 地址
-    host: localhost
+    host: 192.168.1.243
     # 端口,默认为6379
-    port: 16379
+    port: 6379
     # 数据库索引
     database: 0
     # 密码
-    password:
+    password: 12345678
     # 连接超时时间
     timeout: 10s
     lettuce:

+ 8 - 8
aidex-admin/target/classes/logback.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <configuration>
     <!-- 日志存放路径 -->
-	<property name="log.path" value="/home/aidex/logs" />
+	<property name="log.path" value="./logs" />
     <!-- 日志输出格式 -->
 	<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
 
@@ -11,7 +11,7 @@
 			<pattern>${log.pattern}</pattern>
 		</encoder>
 	</appender>
-	
+
 	<!-- 系统日志输出 -->
 	<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
 	    <file>${log.path}/sys-info.log</file>
@@ -34,7 +34,7 @@
             <onMismatch>DENY</onMismatch>
         </filter>
 	</appender>
-	
+
 	<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
 	    <file>${log.path}/sys-error.log</file>
         <!-- 循环政策:基于时间创建日志文件 -->
@@ -56,7 +56,7 @@
             <onMismatch>DENY</onMismatch>
         </filter>
     </appender>
-	
+
 	<!-- 用户访问日志输出  -->
     <appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
 		<file>${log.path}/sys-user.log</file>
@@ -70,7 +70,7 @@
             <pattern>${log.pattern}</pattern>
         </encoder>
     </appender>
-	
+
 	<!-- 系统模块日志级别控制  -->
 	<logger name="com.aidex" level="error" />
 	<!-- Spring日志级别控制  -->
@@ -79,15 +79,15 @@
 	<root level="error">
 		<appender-ref ref="console" />
 	</root>
-	
+
 	<!--系统操作日志-->
     <root level="error">
         <appender-ref ref="file_info" />
         <appender-ref ref="file_error" />
     </root>
-	
+
 	<!--系统用户操作日志-->
     <logger name="sys-user" level="error">
         <appender-ref ref="sys-user"/>
     </logger>
-</configuration> 
+</configuration>

+ 28 - 0
aidex-controller/src/main/java/com/aidex/web/controller/gps/GpsController.java

@@ -0,0 +1,28 @@
+package com.aidex.web.controller.gps;
+
+import com.aidex.common.core.controller.BaseController;
+import com.aidex.common.core.domain.R;
+import com.aidex.common.gps.server.IGpsService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * Gps相关查询接口
+ */
+@RestController
+@RequestMapping("/monit/gps")
+public class GpsController extends BaseController {
+
+    @Autowired
+    private IGpsService gpsService;
+
+    /**
+     * 查询报警信息列表
+     */
+    @PreAuthorize("@ss.hasPermi('monit:gps:location')")
+    @GetMapping("/location")
+    public R<String> list(String shipId) {
+        return R.data(gpsService.getLocationUrl(shipId));
+    }
+}

+ 6 - 0
aidex-controller/src/main/java/com/aidex/web/controller/system/SysShipController.java

@@ -44,6 +44,12 @@ public class SysShipController extends BaseController {
         return R.data(sysShipService.findPage(sysShip));
     }
 
+    @PreAuthorize("@ss.hasPermi('system:sysShip:list')")
+    @GetMapping("/listAll")
+    public R<List<SysShip>> listAll(SysShip sysShip) {
+        return R.data(sysShipService.findList(sysShip));
+    }
+
     /**
      * 获取船只管理详细信息
      */

+ 6 - 0
aidex-system/pom.xml

@@ -69,5 +69,11 @@
             <version>1.3.1</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+            <version>25.0-jre</version>
+        </dependency>
+
     </dependencies>
 </project>

+ 90 - 0
aidex-system/src/main/java/com/aidex/common/gps/common/GeneratorGspApi.java

@@ -0,0 +1,90 @@
+package com.aidex.common.gps.common;
+
+import com.aidex.common.constant.Constants;
+import com.aidex.common.core.redis.RedisCache;
+import com.aidex.framework.cache.ConfigUtils;
+import com.google.common.base.Joiner;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Component
+public class GeneratorGspApi {
+
+    @Autowired
+    private RedisCache redisCache;
+    private final String apiHost = ConfigUtils.getConfigByKey("sys.gps.api.url").getConfigValue();
+
+    // 获取当前坐标
+    private final String server = "/GetDataService.aspx";
+    private final String mapServer = "/RouterPass.ashx";
+
+    public String GenerationMapUrl(String method,String macId,String mapType){
+        String mds = redisCache.getStringValue(Constants.GPS_TOKEN_PREFIX);
+        Map<String, String> parmas = new HashMap<>();
+        parmas.put("method",method);
+        parmas.put("mds",mds);
+        parmas.put("macid",macId);
+        parmas.put("url","http://www.18gps.net/");
+        parmas.put("mapType",mapType);
+
+        StringBuilder builder = new StringBuilder(apiHost);
+        builder.append(mapServer);
+        builder.append("?");
+        builder.append(GeneratorParams(parmas));
+        return builder.toString();
+    }
+
+
+    public Map<String, String> GenerationParams(String method,String api){
+        String mds = redisCache.getStringValue(Constants.GPS_TOKEN_PREFIX);
+        Map<String, String> parmas = new HashMap<>();
+        parmas.put("method",method);
+        parmas.put("w",api);
+        parmas.put("mds",mds);
+        return parmas;
+    }
+
+    public String GeneratorApi(){
+        StringBuilder builder = new StringBuilder(apiHost);
+        builder.append(server);
+        return builder.toString();
+    }
+
+    public Map<String, String> GeneratorQueryParams(String api){
+        return GenerationParams(RquestMethod.query,api);
+    }
+
+    public Map<String, String> GeneratorSignParams(String api){
+        return GenerationParams(RquestMethod.sign,api);
+    }
+
+    public interface RquestMethod {
+        String query = "QueryApi";
+        String sign = "SignApi";
+        String follow = "Follow";
+        String playback = "Playback";
+    }
+
+    public interface GpsMapType {
+        String GOOGLECN = "GOOGLECN";
+        String BAIDU = "BAIDU";
+        String GAODE = "GAODE";
+        String QQ = "QQ";
+        String DEFAULT = "";
+
+    }
+
+
+    public static String GeneratorParams(Map<String, String> params){
+        // TODO 如果要编码的话自己加下编码逻辑
+        return Joiner.on("&")
+                // 用指定符号代替空值,key 或者value 为null都会被替换
+                .useForNull("")
+                .withKeyValueSeparator("=")
+                .join(params);
+    }
+
+}

+ 15 - 0
aidex-system/src/main/java/com/aidex/common/gps/common/GpsApi.java

@@ -0,0 +1,15 @@
+package com.aidex.common.gps.common;
+
+public interface GpsApi {
+
+    /*
+    * 查询单个定位信息
+    * */
+    String findLocation = "Location";
+
+
+    /*
+     * 批量查询单个定位信息
+     * */
+    String findLocationByBatch = "LocationBatch";
+}

+ 190 - 0
aidex-system/src/main/java/com/aidex/common/gps/common/GpsRequest.java

@@ -0,0 +1,190 @@
+package com.aidex.common.gps.common;
+
+import cn.hutool.http.HttpRequest;
+import com.aidex.common.exception.SysException;
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class GpsRequest<T> {
+
+    @Autowired
+    private GeneratorGspApi generatorGspApi;
+
+
+    public List<T> postArray(Map<String,Object> params, JSONObject body, Integer timeOut){
+        JSONObject res = postRequest(params,body,timeOut);
+        Boolean status = res.getBoolean("success");
+        Integer code = res.getInteger("errorCode");
+        String msg = res.getString("errorDescribe");
+
+        if(status){
+            return (ArrayList<T>) JSONObject.parseObject(res.getString("data"),List.class);
+        }
+        throw new SysException(code,msg);
+
+    }
+
+    public List<T> postArray(Map<String,Object> params, JSONObject body){
+        JSONObject res = postRequest(params,body,1000);
+        Boolean status = res.getBoolean("success");
+        Integer code = res.getInteger("errorCode");
+        String msg = res.getString("errorDescribe");
+
+        if(status){
+            return (ArrayList<T>) JSONObject.parseObject(res.getString("data"),List.class);
+        }
+        throw new SysException(code,msg);
+
+    }
+
+    public List<T> postArray(Map<String,Object> params){
+        JSONObject res = postRequest(params,null,1000);
+        Boolean status = res.getBoolean("success");
+        Integer code = res.getInteger("errorCode");
+        String msg = res.getString("errorDescribe");
+
+        if(status){
+            return (ArrayList<T>) JSONObject.parseObject(res.getString("data"),List.class);
+        }
+        throw new SysException(code,msg);
+
+    }
+
+
+    public T post(Map<String,Object> params, JSONObject body, Integer timeOut){
+        JSONObject res = postRequest(params,body,timeOut);
+        Boolean status = res.getBoolean("success");
+        Integer code = res.getInteger("errorCode");
+        String msg = res.getString("errorDescribe");
+
+        if(status){
+            return (T) JSONObject.parseObject(res.getString("data"), Map.class);
+        }
+        throw new SysException(code,msg);
+
+    }
+
+    public T post(Map<String,Object> params, JSONObject body){
+        JSONObject res = postRequest(params,body,1000);
+        Boolean status = res.getBoolean("success");
+        Integer code = res.getInteger("errorCode");
+        String msg = res.getString("errorDescribe");
+
+        if(status){
+            return (T) JSONObject.parseObject(res.getString("data"), Map.class);
+        }
+        throw new SysException(code,msg);
+
+    }
+
+    public T post(Map<String,Object> params){
+        JSONObject res = postRequest(params,null,1000);
+        Boolean status = res.getBoolean("success");
+        Integer code = res.getInteger("errorCode");
+        String msg = res.getString("errorDescribe");
+
+        if(status){
+            return (T) JSONObject.parseObject(res.getString("data"), Map.class);
+        }
+        throw new SysException(code,msg);
+
+    }
+
+    public List<T> getArray(Map<String,Object> params, JSONObject body, Integer timeOut){
+        JSONObject res = postRequest(params,body,timeOut);
+        Boolean status = res.getBoolean("success");
+        Integer code = res.getInteger("errorCode");
+        String msg = res.getString("errorDescribe");
+
+        if(status){
+            return (ArrayList<T>) JSONObject.parseObject(res.getString("data"),List.class);
+        }
+        throw new SysException(code,msg);
+
+    }
+
+    public List<T> getArray(Map<String,Object> params, JSONObject body){
+        JSONObject res = postRequest(params,body,1000);
+        Boolean status = res.getBoolean("success");
+        Integer code = res.getInteger("errorCode");
+        String msg = res.getString("errorDescribe");
+
+        if(status){
+            return (ArrayList<T>) JSONObject.parseObject(res.getString("data"),List.class);
+        }
+        throw new SysException(code,msg);
+
+    }
+
+    public List<T> getArray(Map<String,Object> params){
+        JSONObject res = postRequest(params,null,1000);
+        Boolean status = res.getBoolean("success");
+        Integer code = res.getInteger("errorCode");
+        String msg = res.getString("errorDescribe");
+
+        if(status){
+            return (ArrayList<T>) JSONObject.parseObject(res.getString("data"),List.class);
+        }
+        throw new SysException(code,msg);
+
+    }
+
+
+    public T get(Map<String,Object> params, JSONObject body, Integer timeOut){
+        JSONObject res = postRequest(params,body,timeOut);
+        Boolean status = res.getBoolean("success");
+        Integer code = res.getInteger("errorCode");
+        String msg = res.getString("errorDescribe");
+
+        if(status){
+            return (T) JSONObject.parseObject(res.getString("data"), Map.class);
+        }
+        throw new SysException(code,msg);
+
+    }
+
+    public T get(Map<String,Object> params, JSONObject body){
+        JSONObject res = postRequest(params,body,1000);
+        Boolean status = res.getBoolean("success");
+        Integer code = res.getInteger("errorCode");
+        String msg = res.getString("errorDescribe");
+
+        if(status){
+            return (T) JSONObject.parseObject(res.getString("data"), Map.class);
+        }
+        throw new SysException(code,msg);
+
+    }
+
+    public T get(Map<String,Object> params){
+        JSONObject res = postRequest(params,null,1000);
+        Boolean status = res.getBoolean("success");
+        Integer code = res.getInteger("errorCode");
+        String msg = res.getString("errorDescribe");
+
+        if(status){
+            return (T) JSONObject.parseObject(res.getString("data"), Map.class);
+        }
+        throw new SysException(code,msg);
+
+    }
+
+    private JSONObject postRequest(Map<String,Object> params, JSONObject body, Integer timeOut){
+        String api = generatorGspApi.GeneratorApi();
+        String res = HttpRequest.post(api).form(params).body(body.toString()).timeout(timeOut).execute().body();
+        return JSON.parseObject(res);
+    }
+
+    private JSONObject getRequest(Map<String,Object> params, JSONObject body, Integer timeOut){
+        String api = generatorGspApi.GeneratorApi();
+        String res = HttpRequest.get(api).form(params).body(body.toString()).timeout(timeOut).execute().body();
+        return JSON.parseObject(res);
+    }
+}

+ 6 - 0
aidex-system/src/main/java/com/aidex/common/gps/server/IGpsService.java

@@ -0,0 +1,6 @@
+package com.aidex.common.gps.server;
+
+public interface IGpsService {
+
+    String getLocationUrl(String ShipId);
+}

+ 23 - 0
aidex-system/src/main/java/com/aidex/common/gps/server/impl/GpsService.java

@@ -0,0 +1,23 @@
+package com.aidex.common.gps.server.impl;
+
+import com.aidex.common.gps.common.GeneratorGspApi;
+import com.aidex.common.gps.server.IGpsService;
+import com.aidex.system.domain.SysShip;
+import com.aidex.system.service.SysShipService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class GpsService implements IGpsService {
+
+    @Autowired
+    private GeneratorGspApi generatorGspApi;
+    @Autowired
+    private SysShipService sysShipService;
+
+
+    public String getLocationUrl(String shipId){
+        SysShip sysShip = sysShipService.get(shipId);
+        return generatorGspApi.GenerationMapUrl(GeneratorGspApi.RquestMethod.follow,sysShip.getGpsDeviceNum(), GeneratorGspApi.GpsMapType.QQ);
+    }
+}

+ 10 - 0
aidex-ui/src/api/gps/gps.js

@@ -0,0 +1,10 @@
+import request from '@/utils/request'
+
+// 当前定位地点获取
+export function location (query) {
+  return request({
+    url: '/monit/gps/location',
+    method: 'get',
+    params: query
+  })
+}

+ 9 - 0
aidex-ui/src/api/system/sysShip.js

@@ -9,6 +9,15 @@ export function listSysShip (query) {
   })
 }
 
+// 查询全部船只列表
+export function listAllSysShip (query) {
+  return request({
+    url: '/system/sysShip/listAll',
+    method: 'get',
+    params: query
+  })
+}
+
 // 查询船只管理详细
 export function getSysShip (id) {
   return request({

+ 92 - 0
aidex-ui/src/views/operation/location/index.vue

@@ -0,0 +1,92 @@
+<template>
+  <div ref="content">
+    <a-card :bordered="false">
+      <a-page-header style="border-bottom: 1px solid rgb(235, 237, 240); padding: 8px 16px" title="" />
+      <split splitHeight="100%" leftWidth="220">
+        <template slot="paneL">
+          <!-- 部门树 -->
+          <ship-tree
+            ref="shipTree"
+            :shipOptions="shipOptions"
+            @select="clickNode"
+          />
+        </template>
+        <template slot="paneR">
+          <!-- 条件搜索 -->
+          <div class="table-page-search-wrapper">
+            <h2>{{ selShipData.shipNanme }}-实时位置</h2>
+          </div>
+          <a-divider />
+          <iframe width="100%" style="border: none; height: calc(100% - 65px)" :src="gpsLocalUrl"></iframe>
+        </template>
+      </split>
+    </a-card>
+  </div>
+</template>
+
+<script>
+import { listAllSysShip } from '@/api/system/sysShip'
+import { location } from '@/api/gps/gps'
+import ShipTree from './modules/ShipTree'
+import Split from '@/components/pt/split/Index'
+export default {
+  name: 'User',
+  components: {
+    Split,
+    ShipTree
+  },
+  data() {
+    return {
+      selShipData: {},
+      shipOptions: [],
+      gpsLocalUrl: ''
+    }
+  },
+  filters: {},
+  created() {
+    this.getTreeselect()
+  },
+  computed: {},
+  watch: {},
+  methods: {
+    /** 查询部门下拉树结构 */
+    getTreeselect() {
+      listAllSysShip().then((response) => {
+        this.shipOptions = response.data
+        this.selShipData = this.shipOptions[0]
+        this.getLocation()
+      })
+    },
+    getLocation() {
+      location({ shipId: this.selShipData.id }).then(res => {
+        this.gpsLocalUrl = res.data
+      })
+    },
+    clickNode(node) {
+      var selectItem = node.$options.propsData.dataRef
+      if (this.selShipData.id !== selectItem.id) {
+        this.selShipData = node.$options.propsData.dataRef
+        this.getLocation()
+      }
+    }
+  }
+}
+</script>
+<style lang="less" scoped>
+.ant-divider-horizontal {
+  margin: 0;
+  background: rgb(235, 237, 240);
+}
+.demo-split {
+  height: 200px;
+}
+.demo-split-pane {
+  padding: 10px;
+}
+.ant-avatar {
+  font-size: 12px;
+  border-radius: 4px;
+  vertical-align: middle;
+  margin-right: 8px;
+}
+</style>

+ 152 - 0
aidex-ui/src/views/operation/location/modules/ShipTree.vue

@@ -0,0 +1,152 @@
+<template>
+  <div>
+    <!-- <a-input-search style="margin-bottom: 8px" placeholder="输入名称回车查询" @search="filterNode" /> -->
+    <a-tree
+      v-if="shipOptions.length > 0"
+      :tree-data="shipOptions"
+      :replaceFields="replaceFields"
+      :default-expanded-keys="expandedKeys"
+      :expanded-keys="expandedKeys"
+      :auto-expand-parent="autoExpandParent"
+      showIcon
+      @select="handleNodeClick"
+      @expand="onExpand"
+    >
+    </a-tree></div>
+</template>
+<script>
+  import allIcon from '@/core/icons'
+const getParentKey = (id, tree) => {
+  let parentKey
+  for (let i = 0; i < tree.length; i++) {
+    const node = tree[i]
+    if (node.children) {
+      if (node.children.some(item => item.id === id)) {
+        parentKey = node.id
+      } else if (getParentKey(id, node.children)) {
+        parentKey = getParentKey(id, node.children)
+      }
+    }
+  }
+  return parentKey
+}
+export default {
+  name: 'ShipTree',
+  props: {
+    shipOptions: {
+          type: Array,
+          required: true
+        },
+    defalutExpandedKeys: {
+          type: Array
+        }
+  },
+  components: {
+    allIcon
+  },
+  data () {
+    return {
+      expandedKeys: this.defalutExpandedKeys,
+      oldShipOptions: [], // 记录查询前数据结构
+      oldExpandedKeys: [],
+      allIcon,
+      replaceFields: { children: 'children', key: 'id', title: 'shipNanme' },
+      shipNodes: [],
+      searchValue: '',
+      autoExpandParent: true
+    }
+  },
+  filters: {
+  },
+  created () {
+  },
+  computed: {
+  },
+  watch: {
+  },
+  methods: {
+    getAllShipNode (nodes) {
+      if (!nodes || nodes.length === 0) {
+        return []
+      }
+      nodes.forEach(node => {
+        this.shipNodes.push({ id: node.id, label: node.label })
+        return this.getAllShipNode(node.children)
+      })
+    },
+    getExpandedKeys (nodes) {
+     if (!nodes || nodes.length === 0) {
+       return []
+     }
+        // 最后一层不展开
+        nodes.forEach(node => {
+        this.shipNodes.push(node.id)
+        return this.getExpandedKeys(node.children)
+        })
+    },
+    // 筛选节点
+    filterNode (value, e) {
+      if (this.oldShipOptions.length === 0) {
+       this.oldShipOptions = this.shipOptions
+       this.oldExpandedKeys = this.expandedKeys
+      }
+      if (value.trim() === '') {
+        // 触发父页面设置树数据
+          this.$emit('setDataOptionInfo', this.oldShipOptions)
+          Object.assign(this, {
+            expandedKeys: this.oldExpandedKeys,
+            searchValue: value,
+            autoExpandParent: true
+          })
+     } else {
+      //  const searchInfo = { shipName: value }
+      //  searchShip(searchInfo).then(response => {
+      //    // 触发父页面设置树数据
+      //     this.$emit('setDataOptionInfo', response.data)
+      //     // this.searchTree(value, response.data)
+      //     this.getExpandedKeys(response.data)
+      //    Object.assign(this, {
+      //      expandedKeys: this.shipNodes,
+      //      searchValue: value,
+      //      autoExpandParent: true
+      //    })
+      //    this.shipNodes = []
+      //  })
+     }
+    },
+    // 节点单击事件,
+    handleNodeClick (keys, event) {
+      this.$emit('select', event.node)
+    },
+    onExpand (expandedKeys) {
+      this.expandedKeys = expandedKeys
+      this.autoExpandParent = false
+    },
+    searchTree (value, options) {
+      this.getAllShipNode(options)
+      console.log('shipNodes', this.shipNodes)
+      const gData = options
+      const expandedKeys = this.shipNodes
+        .map(item => {
+          if (item.label.indexOf(value) > -1) {
+            return getParentKey(item.id, gData)
+          }
+          return null
+        })
+        .filter((item, i, self) => item && self.indexOf(item) === i)
+      Object.assign(this, {
+        expandedKeys: expandedKeys,
+        searchValue: value,
+        autoExpandParent: true
+      })
+      this.shipNodes = []
+    }
+  }
+}
+</script>
+<style lang="less">
+  .depIcon {
+    color: #2f54eb;
+     font-size: 20px;
+  }
+</style>