1
mayisheng
2022-08-15 81f54040c2cb65537c6c6e1db8358a39a57dea0d
src/components/campusNav/index.vue
@@ -1,20 +1,20 @@
<template>
    <tool-small-box class="campus-nav-box">
        <template slot="tool-small-box-header">
    <public-box class="campus-nav-box">
        <template slot="public-box-header">
            <div class="title">
                <img class="icon deblurring" src="/img/icon/xndh.png" alt />
                <span>社区内导航</span>
                <span>校区内导航</span>
            </div>
            <img class="close" src="/img/navicon/close.png" alt @click="closeModel" />
            <img class="close deblurring" src="/img/navicon/close.png" alt @click="closeModel" />
        </template>
        <template slot="tool-small-box-content">
        <template slot="public-box-content">
            <div class="tab">
                <ul>
                    <li @click="tabClick('步行')" :class="{on:tabOneFlag}">
                    <li @click="tabClick('步行')" :class="{ on: tabOneFlag }">
                        <i></i>
                        步行
                    </li>
                    <li @click="tabClick('驾车')" :class="{on:tabTwoFlag}">
                    <li @click="tabClick('驾车')" :class="{ on: tabTwoFlag }">
                        <i></i>
                        驾车
                    </li>
@@ -25,7 +25,7 @@
                    <div id="ToNameContainer">
                        <el-input v-model="toNameText" @input="toNameChange" placeholder="起点……">
                            <template slot="prepend">
                                <i class="el-icon-location" style="color: green;"></i>
                                <i class="el-icon-location mydingwei" style="color: green"></i>
                            </template>
                        </el-input>
                        <div v-show="toNameShow" class="toname-value-box">
@@ -34,14 +34,14 @@
                                    v-for="(item, index) in toNameList"
                                    :key="index"
                                    @click="originChange(item)"
                                >{{item.mechanismname}}</li>
                                >{{ item.mechanismname }}</li>
                            </ul>
                        </div>
                    </div>
                    <div id="ComeNameContainer">
                        <el-input v-model="comeNameText" @input="comeNameChange" placeholder="终点……">
                            <template slot="prepend">
                                <i class="el-icon-location" style="color: red;"></i>
                                <i class="el-icon-location mydingwei" style="color: red"></i>
                            </template>
                        </el-input>
                        <div v-show="comeNameShow" class="comename-value-box">
@@ -50,7 +50,7 @@
                                    v-for="(item, index) in comeNameList"
                                    :key="index"
                                    @click="terminusChange(item)"
                                >{{item.mechanismname}}</li>
                                >{{ item.mechanismname }}</li>
                            </ul>
                        </div>
                    </div>
@@ -59,35 +59,53 @@
                    <el-button @click="startNavigation" type="primary">导航</el-button>
                </div>
            </div>
            <div class="path-box" v-show="pathBoxShow">
                <ul>
                    <li v-for="(item, index) in pathBoxList" :key="index">{{item.instruction}}</li>
                </ul>
            </div>
        </template>
    </tool-small-box>
    </public-box>
</template>
<script>
import { mapGetters } from 'vuex'
import { getSearchList } from '@/api/pc/public/search'
import axios from 'axios'
const CamPusNavLayer = {
    campusStartLayer: null,
    campusEndLayer: null,
    campusRouteLayer: null
}
export default {
    name: 'campusNav',
    data () {
        return {
            tabOneFlag: true,
            tabTwoFlag: false,
            DC: null,
            navigationWay: '步行',
            routeLayer: null,
            toNameText: '',
            comeNameText: '',
            toNameList: [],
            comeNameList: [],
            toNameShow: false,
            comeNameShow: false
            comeNameShow: false,
            overChouse: false,
            butChouse: '',
            pathBoxShow: false,
            pathBoxList: [],
            isOverRouter: false // 是否启用了导航
        }
    },
    computed: {
        ...mapGetters([
            'viewer',
            'twoOrThree',
            // 起点
            'startingPoint',
@@ -127,9 +145,145 @@
        }
    },
    created () {
        this.DC = global.DC
    },
    mounted () {
        const leftBut = document.querySelectorAll('.el-input-group__prepend')
        leftBut[0].onclick = () => {
            this.chouseDian('start')
        }
        leftBut[1].onclick = () => {
            this.chouseDian('end')
        }
    },
    methods: {
        chouseDian (val) {
            const that = this
            that.clearLayer() // 清除完成的导航
            if (that.isOverRouter) {
                // 若是已经有导航,恢复未点击图标
                if (val == 'start') {
                    // 初始化图标图层
                    if (CamPusNavLayer.campusEndLayer == null) {
                        CamPusNavLayer.campusEndLayer = new global.DC.VectorLayer('campusEndLayer')
                        global.viewer.addLayer(CamPusNavLayer.campusEndLayer)
                    } else {
                        CamPusNavLayer.campusEndLayer.clear()
                    }
                    // console.log("baoliuend", "see");
                    that.$store.commit('SET_STARTINGPOINT', [])
                    const endEntity = new global.DC.Billboard(
                        new global.DC.Position(
                            Number(this.terminus[0]),
                            Number(this.terminus[1]),
                            Number(this.terminus[2])
                        ),
                        '/img/navicon/end.png'
                    )
                    CamPusNavLayer.campusEndLayer.addOverlay(endEntity)
                } else if (val == 'end') {
                    // 初始化图标图层
                    if (CamPusNavLayer.campusStartLayer == null) {
                        CamPusNavLayer.campusStartLayer = new global.DC.VectorLayer('campusStartLayer')
                        global.viewer.addLayer(CamPusNavLayer.campusStartLayer)
                    } else {
                        CamPusNavLayer.campusStartLayer.clear()
                    }
                    // console.log("baoliustart", "see");
                    that.$store.commit('SET_TERMINUS', [])
                    const startEntity = new global.DC.Billboard(
                        new global.DC.Position(
                            Number(this.startingPoint[0]),
                            Number(this.startingPoint[1]),
                            Number(this.startingPoint[2])
                        ),
                        '/img/navicon/start.png'
                    )
                    CamPusNavLayer.campusStartLayer.addOverlay(startEntity)
                }
            }
            // console.log(val, "see1");
            this.butChouse = val
            // 关闭其他地图事件
            that.$store.commit('set_closeMapClick', true)
            // 添加标记
            const tooltip = global.viewer.tooltip
            tooltip.enable = true
            let title = ''
            if (val == 'start') {
                title = '点击选择起点'
                // 初始化图标图层
                if (CamPusNavLayer.campusStartLayer == null) {
                    CamPusNavLayer.campusStartLayer = new global.DC.VectorLayer('campusStartLayer')
                    global.viewer.addLayer(CamPusNavLayer.campusStartLayer)
                } else {
                    CamPusNavLayer.campusStartLayer.clear()
                }
            } else if (val == 'end') {
                title = '点击选择终点'
                // 初始化图标图层
                if (CamPusNavLayer.campusEndLayer == null) {
                    CamPusNavLayer.campusEndLayer = new global.DC.VectorLayer('campusEndLayer')
                    global.viewer.addLayer(CamPusNavLayer.campusEndLayer)
                } else {
                    CamPusNavLayer.campusEndLayer.clear()
                }
            }
            that.overChouse = false // 开启事件
            // 地图选点
            that.clicks = global.viewer.on(global.DC.MouseEventType.CLICK, (e) => {
                if (that.overChouse) {
                    return
                }
                const lnglat = [e.wgs84SurfacePosition.lng, e.wgs84SurfacePosition.lat]
                // console.log(lnglat, "see11");
                // console.log(that.butChouse, "see11");
                // 应用数据
                if (that.butChouse == 'start') {
                    that.toNameText = '自定义起点'
                    // 传输坐标数据
                    that.$store.commit('SET_STARTINGPOINT', [...lnglat, 0])
                    // 起点
                    const startEntity = new global.DC.Billboard(
                        new global.DC.Position(
                            Number(lnglat[0]),
                            Number(lnglat[1]),
                            Number(0)
                        ),
                        '/img/navicon/start.png'
                    )
                    CamPusNavLayer.campusStartLayer.addOverlay(startEntity)
                } else if (that.butChouse == 'end') {
                    that.comeNameText = '自定义终点'
                    // 传输坐标数据
                    that.$store.commit('SET_TERMINUS', [...lnglat, 0])
                    // 终点
                    const endEntity = new global.DC.Billboard(
                        new global.DC.Position(
                            Number(lnglat[0]),
                            Number(lnglat[1]),
                            Number(0)
                        ),
                        '/img/navicon/end.png'
                    )
                    CamPusNavLayer.campusEndLayer.addOverlay(endEntity)
                }
                title = ''
                tooltip.enable = false
                that.overChouse = true // 关闭事件
                // 开启其他地图事件
                that.$store.commit('set_closeMapClick', false)
            })
            that.moves = global.viewer.on(global.DC.MouseEventType.MOUSE_MOVE, (e) => {
                if (that.overChouse) {
                    return
                }
                // let lnglat = [e.wgs84SurfacePosition.lng, e.wgs84SurfacePosition.lat];
                tooltip.showAt(e.windowPosition, title)
            })
        },
        closeModel () {
            if (this.$route.path.indexOf('/campusnavi') != -1) {
                this.$store.dispatch('delVisitedViews', this.$route)
@@ -142,8 +296,21 @@
            this.comeNameText = ''
            this.comeNameList = []
            this.comeNameShow = false
            if (this.routeLayer != null) {
                this.routeLayer.clear()
            this.pathBoxList = []
            this.pathBoxShow = false
            if (CamPusNavLayer.campusRouteLayer != null) {
                CamPusNavLayer.campusRouteLayer.clear()
                this.isOverRouter = false
            }
            // 清除自定义位置
            if (CamPusNavLayer.campusStartLayer != null) {
                CamPusNavLayer.campusStartLayer.clear()
                // CamPusNavLayer.campusStartLayer = null;
            }
            if (CamPusNavLayer.campusEndLayer != null) {
                CamPusNavLayer.campusEndLayer.clear()
                // CamPusNavLayer.campusEndLayer = null;
            }
            this.$store.commit('SET_COMENAME', '')
            this.$store.commit('SET_TERMINUS', null)
@@ -159,11 +326,22 @@
        },
        startNavigation () {
            if (this.routeLayer == null) {
                this.routeLayer = new this.DC.VectorLayer('navigation')
                this.viewer.addLayer(this.routeLayer)
            const that = this
            // 清除自定义位置
            if (CamPusNavLayer.campusStartLayer != null) {
                CamPusNavLayer.campusStartLayer.clear()
                // CamPusNavLayer.campusStartLayer = null;
            }
            if (CamPusNavLayer.campusEndLayer != null) {
                CamPusNavLayer.campusEndLayer.clear()
                // CamPusNavLayer.campusEndLayer = null;
            }
            if (CamPusNavLayer.campusRouteLayer == null) {
                CamPusNavLayer.campusRouteLayer = new global.DC.VectorLayer('campusRouteLayer')
                global.viewer.addLayer(CamPusNavLayer.campusRouteLayer)
            } else {
                this.routeLayer.clear()
                CamPusNavLayer.campusRouteLayer.clear()
            }
            if (this.startingPoint == null) {
                this.$message('请输入起点!!!')
@@ -172,12 +350,26 @@
                this.$message('请输入终点!!!')
            }
            // var start = this.DC.Transform.transformWGS84ToCartesian()
            const startEntity = new this.DC.Billboard(new this.DC.Position(Number(this.startingPoint[0]), Number(this.startingPoint[1]), Number(this.startingPoint[2])), '/img/navicon/start.png')
            this.routeLayer.addOverlay(startEntity)
            // var end = this.DC.Transform.transformWGS84ToCartesian()
            const endEntity = new this.DC.Billboard(new this.DC.Position(Number(this.terminus[0]), Number(this.terminus[1]), Number(this.terminus[2])), '/img/navicon/end.png')
            this.routeLayer.addOverlay(endEntity)
            // var start = global.DC.Transform.transformWGS84ToCartesian()
            const startEntity = new global.DC.Billboard(
                new global.DC.Position(
                    Number(this.startingPoint[0]),
                    Number(this.startingPoint[1]),
                    Number(this.startingPoint[2])
                ),
                '/img/navicon/start.png'
            )
            CamPusNavLayer.campusRouteLayer.addOverlay(startEntity)
            // var end = global.DC.Transform.transformWGS84ToCartesian()
            const endEntity = new global.DC.Billboard(
                new global.DC.Position(
                    Number(this.terminus[0]),
                    Number(this.terminus[1]),
                    Number(this.terminus[2])
                ),
                '/img/navicon/end.png'
            )
            CamPusNavLayer.campusRouteLayer.addOverlay(endEntity)
            var routes = ''
@@ -186,170 +378,206 @@
            var endLog = Number(this.terminus[0]).toFixed(6)
            var endLat = Number(this.terminus[1]).toFixed(6)
            var origin = this.DC.CoordTransform.WGS84ToGCJ02(startLog, startLat)
            var destination = this.DC.CoordTransform.WGS84ToGCJ02(endLog, endLat)
            var origin = global.DC.CoordTransform.WGS84ToGCJ02(startLog, startLat)
            var destination = global.DC.CoordTransform.WGS84ToGCJ02(endLog, endLat)
            if (this.navigationWay == '步行') {
                axios.get('https://restapi.amap.com/v3/direction/walking', {
                    params: {
                        origin: `${origin[0].toFixed(6) + ',' + origin[1].toFixed(6)}`,
                        destination: `${destination[0].toFixed(6) + ',' + destination[1].toFixed(6)}`,
                        key: '4b3e1db3211054ce5b466407cbb9d221',
                        output: 'json'
                    }
                }).then(res => {
                    if (res.data.info == 'OVER_DIRECTION_RANGE') {
                        this.$message({
                            message: '超出步行范围!',
                            type: 'warning',
                            duration: 3000
                        })
                    }
                    res.data.route.paths[0].steps.forEach(item => {
                        item.polyline = item.polyline.split(';')
                        var lineArr = []
                        item.polyline.forEach(it => {
                            it = it.split(',')
                            lineArr.push(this.DC.CoordTransform.GCJ02ToWGS84(it[0], it[1]).join(','))
                        })
                        lineArr = lineArr.join(';')
                        lineArr += ';'
                        routes += lineArr
                    })
                    routes = startLog + ',' + startLat + ';' + routes + endLog + ',' + endLat
                    const polyline = new this.DC.Polyline(routes)
                    polyline.setStyle({
                        width: 3,
                        material: new this.DC.PolylineTrailMaterialProperty({
                            color: this.DC.Color.RED,
                            speed: 10
                        }),
                        clampToGround: true
                    })
                    this.routeLayer.addOverlay(polyline)
                    if (this.twoOrThree == '真三维') {
                        this.viewer.flyTo(this.routeLayer)
                    } else {
                        var longitude = null
                        var latitude = null
                        startLog = Number(startLog)
                        endLog = Number(endLog)
                        if (startLog > endLog) {
                            longitude = (startLog - endLog) / 2 + endLog
                        } else {
                            longitude = (endLog - startLog) / 2 + startLog
                axios
                    .get('https://restapi.amap.com/v3/direction/walking', {
                        params: {
                            origin: `${origin[0].toFixed(6) + ',' + origin[1].toFixed(6)}`,
                            destination: `${destination[0].toFixed(6) + ',' + destination[1].toFixed(6)
                                }`,
                            key: '4b3e1db3211054ce5b466407cbb9d221',
                            output: 'json'
                        }
                        startLat = Number(startLat)
                        endLat = Number(endLat)
                        if (startLat > endLat) {
                            latitude = (startLat - endLat) / 2 + endLat
                        } else {
                            latitude = (endLat - startLat) / 2 + startLat
                    })
                    .then((res) => {
                        if (res.data.info == 'OVER_DIRECTION_RANGE') {
                            this.$message({
                                message: '超出步行范围!',
                                type: 'warning',
                                duration: 3000
                            })
                        }
                        this.viewer.camera.setView({
                            // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
                            // fromDegrees()方法,将经纬度和高程转换为世界坐标
                            destination: this.DC.Namespace.Cesium.Cartesian3.fromDegrees(longitude, latitude, 600),
                            orientation: {
                                // 指向
                                heading: this.DC.Namespace.Cesium.Math.toRadians(0, 0),
                                // 视角
                                pitch: this.DC.Namespace.Cesium.Math.toRadians(-90),
                                roll: 0.0
                        this.pathBoxList = []
                        res.data.route.paths[0].steps.forEach((item) => {
                            this.pathBoxList.push({ instruction: item.instruction, orientation: item.orientation, action: item.action })
                            item.polyline = item.polyline.split(';')
                            var lineArr = []
                            item.polyline.forEach((it) => {
                                it = it.split(',')
                                lineArr.push(
                                    global.DC.CoordTransform.GCJ02ToWGS84(it[0], it[1]).join(',')
                                )
                            })
                            lineArr = lineArr.join(';')
                            lineArr += ';'
                            routes += lineArr
                        })
                        this.pathBoxShow = true
                        routes =
                            startLog + ',' + startLat + ';' + routes + endLog + ',' + endLat
                        const polyline = new global.DC.Polyline(routes)
                        polyline.setStyle({
                            width: 6,
                            arcType: true,
                            material: new global.DC.PolylineImageTrailMaterialProperty({
                                color: global.DC.Namespace.Cesium.Color.fromBytes(10, 255, 10),
                                speed: 60,
                                image: '/img/icon/right.png',
                                repeat: { x: 320, y: 1 }
                            }),
                            clampToGround: true
                        })
                        CamPusNavLayer.campusRouteLayer.addOverlay(polyline)
                        if (this.twoOrThree == '真三维') {
                            global.viewer.flyTo(CamPusNavLayer.campusRouteLayer)
                        } else {
                            var longitude = null
                            var latitude = null
                            startLog = Number(startLog)
                            endLog = Number(endLog)
                            if (startLog > endLog) {
                                longitude = (startLog - endLog) / 2 + endLog
                            } else {
                                longitude = (endLog - startLog) / 2 + startLog
                            }
                        })
                    }
                })
                            startLat = Number(startLat)
                            endLat = Number(endLat)
                            if (startLat > endLat) {
                                latitude = (startLat - endLat) / 2 + endLat
                            } else {
                                latitude = (endLat - startLat) / 2 + startLat
                            }
                            that.isOverRouter = true
                            global.viewer.camera.setView({
                                // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
                                // fromDegrees()方法,将经纬度和高程转换为世界坐标
                                destination: global.DC.Namespace.Cesium.Cartesian3.fromDegrees(
                                    longitude,
                                    latitude,
                                    600
                                ),
                                orientation: {
                                    // 指向
                                    heading: global.DC.Namespace.Cesium.Math.toRadians(0, 0),
                                    // 视角
                                    pitch: global.DC.Namespace.Cesium.Math.toRadians(-90),
                                    roll: 0.0
                                }
                            })
                        }
                    })
            } else {
                axios.get('https://restapi.amap.com/v3/direction/driving', {
                    params: {
                        origin: `${origin[0].toFixed(6) + ',' + origin[1].toFixed(6)}`,
                        destination: `${destination[0].toFixed(6) + ',' + destination[1].toFixed(6)}`,
                        key: '4b3e1db3211054ce5b466407cbb9d221',
                        strategy: 2,
                        extensions: 'all',
                        output: 'json'
                    }
                }).then(res => {
                    res.data.route.paths[0].steps.forEach(item => {
                        item.polyline = item.polyline.split(';')
                axios
                    .get('https://restapi.amap.com/v3/direction/driving', {
                        params: {
                            origin: `${origin[0].toFixed(6) + ',' + origin[1].toFixed(6)}`,
                            destination: `${destination[0].toFixed(6) + ',' + destination[1].toFixed(6)
                                }`,
                            key: '4b3e1db3211054ce5b466407cbb9d221',
                            strategy: 2,
                            extensions: 'all',
                            output: 'json'
                        }
                    })
                    .then((res) => {
                        res.data.route.paths[0].steps.forEach((item) => {
                            item.polyline = item.polyline.split(';')
                        var lineArr = []
                            var lineArr = []
                        item.polyline.forEach(it => {
                            it = it.split(',')
                            lineArr.push(this.DC.CoordTransform.GCJ02ToWGS84(it[0], it[1]).join(','))
                            item.polyline.forEach((it) => {
                                it = it.split(',')
                                lineArr.push(
                                    global.DC.CoordTransform.GCJ02ToWGS84(it[0], it[1]).join(',')
                                )
                            })
                            lineArr = lineArr.join(';')
                            lineArr += ';'
                            routes += lineArr
                        })
                        lineArr = lineArr.join(';')
                        routes =
                            startLog + ',' + startLat + ';' + routes + endLog + ',' + endLat
                        lineArr += ';'
                        const polyline = new global.DC.Polyline(routes)
                        polyline.setStyle({
                            width: 6,
                            arcType: true,
                            material: new global.DC.PolylineImageTrailMaterialProperty({
                                color: global.DC.Namespace.Cesium.Color.fromBytes(10, 255, 10),
                                speed: 60,
                                image: '/img/icon/right.png',
                                repeat: { x: 320, y: 1 }
                            }),
                            clampToGround: true
                        })
                        routes += lineArr
                    })
                        CamPusNavLayer.campusRouteLayer.addOverlay(polyline)
                    routes = startLog + ',' + startLat + ';' + routes + endLog + ',' + endLat
                    const polyline = new this.DC.Polyline(routes)
                    polyline.setStyle({
                        width: 3,
                        material: new this.DC.PolylineTrailMaterialProperty({
                            color: this.DC.Color.RED,
                            speed: 10
                        }),
                        clampToGround: true
                    })
                    this.routeLayer.addOverlay(polyline)
                    if (this.twoOrThree == '真三维') {
                        this.viewer.flyTo(this.routeLayer)
                    } else {
                        var longitude = null
                        var latitude = null
                        startLog = Number(startLog)
                        endLog = Number(endLog)
                        if (startLog > endLog) {
                            longitude = (startLog - endLog) / 2 + endLog
                        if (this.twoOrThree == '真三维') {
                            global.viewer.flyTo(CamPusNavLayer.campusRouteLayer)
                        } else {
                            longitude = (endLog - startLog) / 2 + startLog
                        }
                        startLat = Number(startLat)
                        endLat = Number(endLat)
                        if (startLat > endLat) {
                            latitude = (startLat - endLat) / 2 + endLat
                        } else {
                            latitude = (endLat - startLat) / 2 + startLat
                        }
                        this.viewer.camera.setView({
                            // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
                            // fromDegrees()方法,将经纬度和高程转换为世界坐标
                            destination: this.DC.Namespace.Cesium.Cartesian3.fromDegrees(longitude, latitude, 600),
                            orientation: {
                                // 指向
                                heading: this.DC.Namespace.Cesium.Math.toRadians(0, 0),
                                // 视角
                                pitch: this.DC.Namespace.Cesium.Math.toRadians(-90),
                                roll: 0.0
                            var longitude = null
                            var latitude = null
                            startLog = Number(startLog)
                            endLog = Number(endLog)
                            if (startLog > endLog) {
                                longitude = (startLog - endLog) / 2 + endLog
                            } else {
                                longitude = (endLog - startLog) / 2 + startLog
                            }
                        })
                    }
                })
                            startLat = Number(startLat)
                            endLat = Number(endLat)
                            if (startLat > endLat) {
                                latitude = (startLat - endLat) / 2 + endLat
                            } else {
                                latitude = (endLat - startLat) / 2 + startLat
                            }
                            that.isOverRouter = true
                            global.viewer.camera.setView({
                                // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
                                // fromDegrees()方法,将经纬度和高程转换为世界坐标
                                destination: global.DC.Namespace.Cesium.Cartesian3.fromDegrees(
                                    longitude,
                                    latitude,
                                    600
                                ),
                                orientation: {
                                    // 指向
                                    heading: global.DC.Namespace.Cesium.Math.toRadians(0, 0),
                                    // 视角
                                    pitch: global.DC.Namespace.Cesium.Math.toRadians(-90),
                                    roll: 0.0
                                }
                            })
                        }
                    })
            }
        },
        clearLayer () {
            if (this.routeLayer != null) {
                this.routeLayer.clear()
            if (CamPusNavLayer.campusRouteLayer != null) {
                CamPusNavLayer.campusRouteLayer.clear()
                this.pathBoxList = []
                this.pathBoxShow = false
            }
        },
@@ -359,7 +587,7 @@
                this.toNameShow = false
                return
            }
            getSearchList({ mechanismName: this.toNameText }).then(res => {
            getSearchList({ mechanismName: this.toNameText }).then((res) => {
                if (res.data.data.length > 0) {
                    this.toNameList = res.data.data
                    this.toNameShow = true
@@ -373,7 +601,7 @@
                this.comeNameShow = false
                return
            }
            getSearchList({ mechanismName: this.comeNameText }).then(res => {
            getSearchList({ mechanismName: this.comeNameText }).then((res) => {
                if (res.data.data.length > 0) {
                    this.comeNameList = res.data.data
                    this.comeNameShow = true
@@ -385,7 +613,8 @@
            var toBox = document.getElementById('ToNameContainer')
            if (toBox) {
                if (!toBox.contains(event.target)) { // 这句是说如果我们点击到了id为myPanel以外的区域
                if (!toBox.contains(event.target)) {
                    // 这句是说如果我们点击到了id为myPanel以外的区域
                    this.toNameShow = false
                }
            }
@@ -393,7 +622,8 @@
            var comeBox = document.getElementById('ComeNameContainer')
            if (comeBox) {
                if (!comeBox.contains(event.target)) { // 这句是说如果我们点击到了id为myPanel以外的区域
                if (!comeBox.contains(event.target)) {
                    // 这句是说如果我们点击到了id为myPanel以外的区域
                    this.comeNameShow = false
                }
            }
@@ -428,9 +658,11 @@
            this.comeNameShow = false
            this.comeNameList = []
        }
    },
    destroyed () {
        // this.closeModel();
    }
}
</script>
<style lang='scss' scope>
</style>
<style lang="scss" scope></style>