zengh
2022-05-16 63ad2c3598400370dd7da5534659fd7e768a0a4a
public/map/widgets/patrolManagement/PatrolManagement.js
@@ -61,7 +61,7 @@
    "esri/dijit/PopupTemplate",
    "widgets/clientManagement/FlareClusterLayer_v3",
    "dojo/domReady!"
], function (
], function(
    dojo,
    declare,
    lang,
@@ -127,6 +127,9 @@
        layuiLadate: null,
        tabIndex: 0,
        isEngineer: false,
        // 保留添加实体图层的变量
        addEntitys: null,
        entitysData: [],
@@ -141,6 +144,10 @@
        polygonFlag: false,
        editToolbar: null,
        addPolygonEntitys: null,
        //基础路径
        // pathUrl: "http://localhost:83",
        pathUrl: "http://s16s652780.51mypc.cn/api",
        // 所有的面图层
        entityPolygonAll: null,
@@ -157,6 +164,10 @@
        // 用来记录巡逻区域或者巡逻路线的下标的
        patrolIndex: 0,
        //是否可编辑
        isEdit: false,
        // 拖拽
        isDown: false,
        x: 0,
@@ -166,20 +177,30 @@
        // 电子围栏需要新增的Id
        newElectronicFenceId: null,
        node: null,
        treeData: null,
        // 新增路线时,派发人员,人员名称,以及人员id
        peopleRealName: null,
        pepleRealId: null,
        constructor: function (options, srcRefNode) {
        constructor: function(options, srcRefNode) {
            this._map = options.map;
            objThis = this;
            this.addEntitys = new GraphicsLayer({id: 'addEntitys'});
            this.addEntitys = new GraphicsLayer({
                id: 'addEntitys'
            });
            // 添加点面线的图层
            this.addPolygonEntitys = new GraphicsLayer({id: 'addPolygonEntitys'});
            this.addPolygonEntitys = new GraphicsLayer({
                id: 'addPolygonEntitys'
            });
            // 添加所有图层的地方
            this.entityPolygonAll = new GraphicsLayer({id: 'entityPolygonAll'});
            this.entityPolygonAll = new GraphicsLayer({
                id: 'entityPolygonAll'
            });
            this._map.addLayer(this.addEntitys);
@@ -191,477 +212,709 @@
        },
        startup: function () {
            objThis._map.addLayer(objThis._siteLayer);
        startup: function() {
            var that = this;
            // 顶部tab得切换事件
            $('.police-dispatching-tab li').click(function () {
                if (that.tabIndex == $(this).index()) return;
                if (that.entitysData.length > 0) {
                    that.addEntitys.clear();
                    that.entitysData = [];
            //删除巡逻路线点击事件
            $(".mapBtn .delBtn").click(function() {
                if (!that.isEngineer) {
                    layui.use('layer', function() {
                        layui.layer.msg('请先新增巡逻路线信息!')
                    })
                    return;
                }
                that.patrolIndex = 0;
                that.polygonFlag = false;
                that.entityPolygonAll.clear();
                that.modifyPolygon();
                // 切换时清除新增点线面数组中保存得数据,与清除地图上得实体
                that.polygonData = [];
                that.addPolygonEntitys.clear();
                $(this).addClass('on').siblings().removeClass('on');
                var ind = $(this).index();
                $($('.police-container > div')[ind]).stop().show().siblings().stop().hide();
                if (ind == 0) {
                    $('#distributeCategory div:eq(0)').html('全部' + '<i></i>');
                    $('#distributeState div:eq(0)').html('全部' + '<i></i>');
                    that.getPoliceTable($('.police-container-distribute').find('.tbody tbody'), $('#dispatchingStartTime').val(), $('#dispatchingEndTime').val(), '', '', '');
                } else if (ind == 1) {
                    // that.getOwnerTable($($('.analysis-container > div')[ind]).find('.tbody tbody'), '', '');
                    $('.police-dispatching .police-container .police-container-patrol .tab-header li:eq(0)').addClass('on').siblings().removeClass('on');
                    $('.police-dispatching .police-container .police-container-patrol .main-content>li:eq(0)').stop().show().siblings().hide();
                    that.patrolArea($('.police-dispatching .police-container .police-container-patrol .main-content>li:eq(0) .table .tbody tbody'), '');
                } else if (ind == 2) {
                    that.getSecurityPeople($('.police-dispatching .police-container .police-container-policeforce .table .tbody tbody'), '');
                }
                that.tabIndex = $(this).index();
            })
            // 警情分发中的行点击事件
            $('.police-container .police-container-distribute .table .tbody').off('click', 'tr').on('click', 'tr', function () {
                var lgtd = Number($(this).attr('lgtd'));
                var lttd = Number($(this).attr('lttd'));
                var position = new esri.geometry.Point(lgtd, lttd, new esri.SpatialReference({wkid: 4326}));//根据输入坐标信息找地图上的点
                that._map.centerAndZoom(position, 18);//缩放,10是缩放级别,可以自定义,数值越大缩放越大
            })
            // 编辑,跟进按钮元素的父元素的点击事件
            $('.police-container .police-container-distribute .table .tbody').off('click', '.operation').on('click', '.operation', function (event) {
                event.stopPropagation();
            })
            // 警情分发中的编辑按钮的点击事件
            $('.police-container .police-container-distribute .table .tbody').off('click', '.edit').on('click', '.edit', function (event) {
                event.stopPropagation();
                that.editParentInd = null;
                that.editParentInd = $(this).parent().parent().index();
                var id = $(this).attr('term-list');
                that.treatmentIndex = null;
                if (!$('.police-container-distribute-details .security-guard-nearby').is(':hidden')) {
                    $('.police-container-distribute-details .security-guard-nearby').stop().hide();
                }
                if (!$('.police-container-distribute-details').is(':hidden')) {
                    $('.police-container-distribute-details').stop().hide();
                }
                $('.police-container-distribute-details .content table tbody').empty();
                var str = '';
                $.ajax({
                    url: 'https://web.byisf.com/api/blade-jfpts/jingdan/jingdan/selectdInfo?deviceNumber=&id=' + id,
                    type: 'POST',
                    dataType: 'JSON',
                    success: function (data) {
                        var result = data.data[0];
                        var t = result.galarmTime.substr(0, 10);
                        var e = result.galarmTime.substr(11);
                        var time = t + '&nbsp;' + e;
                        str += "<tr> <td>报警人姓名:</td> <td>" + result.galarmPeople + "</td> <td>联系方式:</td> <td>" + result.phoneNumber + "</td> </tr>";
                        str += "<tr> <td>事发地址:</td> <td>" + result.place + "</td> <td>行政区:</td> <td>" + result.addvnm + "</td> </>";
                        str += "<tr> <td>报警时间:</td> <td>" + time + "</td> <td>报警内容:</td> <td>" + result.content + "</td> </tr>";
                        str += "<tr> <td>警情级别:</td> <td>" + result.level + "</td> <td>警情类别:</td> <td>" + result.waringType + "</td> </tr>";
                        str += "<tr> <td>处理方式:</td> <td class='treatment-method'> <input type='radio' name='treatmentMethod' value='派发保安' lgtd=" + result.jd + " lttd=" + result.wd + "> <span>派发保安</span> <input type='radio' name='treatmentMethod' value='提示业主'> <span>提示业主</span> </td> <td>处理人:</td> <td class='securityname'></td> </tr>";
                        str += "<tr> <td>是否上报110:</td> <td class='report-oneonezero'> <input type='radio' name='callPhone' value='是'> <span>是</span> <input type='radio' name='callPhone' value='否'> <span>否</span> </td> <td>设备编号:</td> <td>" + result.deviceNumber + "</td> </tr>";
                        $('.police-container-distribute-details .content table tbody').append(str);
                        $('.police-container-distribute-details .handle-button .confirm').attr('police-id', result.id);
                        $('.police-container-distribute-details .handle-button').stop().show();
                        $('.police-container-distribute-details .header h4').text('警情分发');
                        $('.police-container-distribute-details').stop().show();
                        $('.police-container-distribute-details .content table tbody').off('click', '.treatment-method input').on('click', '.treatment-method input', function () {
                            if (that.treatmentIndex != $(this).val()) {
                                if ($(this).val() == '派发保安') {
                                    var str = '';
                                    $('.police-container-distribute-details .security-guard-nearby .security-staff-content tbody').empty();
                                    $.ajax({
                                        url: 'https://web.byisf.com/api/blade-jfpts/position/position/selectry',
                                        type: 'POST',
                                        data: {
                                            coordinate: "point(" + $(this).attr('lgtd') + "," + $(this).attr('lttd') + ")"
                                        },
                                        dataType: 'JSON',
                                        success: function (data) {
                                            var result = data.data;
                                            for (var i = 0; i < result.length; i++) {
                                                str += "<tr> <td>" + (Number(i) + 1) + "</td> <td>" + result[i].sname + "</td> <td>" + result[i].distance.toFixed(2) + "</td> <td><input type='radio' name='securityStaff' securityid=" + result[i].snumber + " securityname=" + result[i].sname + "> </td> </tr>"
                                            }
                                            $('.police-container-distribute-details .security-guard-nearby .security-staff-content tbody').append(str);
                                        }
                                    })
                                    $('.police-container-distribute-details .security-guard-nearby').stop().show();
                                } else {
                                    $('.police-container-distribute-details .content table tbody .securityname').text('');
                                    $('.police-container-distribute-details .security-guard-nearby').stop().hide();
                                }
                                that.treatmentIndex = $(this).val();
                            }
                        })
                    }
                })
            })
            // 警情分发中的详情的确认按钮
            $('.police-container-distribute-details .handle-button .confirm').off('click').click(function () {
                var self = this;
                layui.use('layer', function () {
                    var layer = layui.layer;
                    if (that.treatmentIndex == null) {
                        layer.msg('请选择处理方式', {
                            shade: [0.8, '#393D49'],
                            time: 1000
                        })
                        return
                    } else {
                        if (that.treatmentIndex == '派发保安') {
                            if (that.securityFlag == false) {
                                layer.msg('请选取保安', {
                                    shade: [0.8, '#393D49'],
                                    time: 1000
                                })
                                return
                            }
                        }
                    }
                    var id = $(self).attr('police-id');
                    var handletype = null;
                    if (that.treatmentIndex != null) {
                        if (that.treatmentIndex == '派发保安') {
                            handletype = '0';
                        } else {
                            handletype = '1';
                        }
                    }
                    // 发送请求修改警单数据
                //需选中巡逻路线,然后进行删除
                layer.confirm('是否确认删除', {
                    btn: ['确定', '取消'], //按钮
                    title: false
                }, function() {
                    //删除数据库数据
                    $.ajax({
                        url: 'https://web.byisf.com/api/blade-jfpts/jingdan/jingdan/updateInfo',
                        url: that.pathUrl + '/routeIn/routein/removeByRegionId',
                        type: 'POST',
                        data: {
                            id: id,
                            // handleP: $('.police-container-distribute-details .content table tbody tr:eq(4) td:eq(3)').attr('people-id'),
                            // handName: $('.police-container-distribute-details .content table tbody tr:eq(4) td:eq(3)').text(),
                            handleP: $('.police-container-distribute-details .content table tbody .securityname').attr('id'),
                            handName: $('.police-container-distribute-details .content table tbody .securityname').text(),
                            handletype: handletype,
                            type: '2'
                        },
                        dataType: 'JSON',
                        success: function (data) {
                            if (data.code == 200) {
                                if (!$('.police-container-distribute-details .security-guard-nearby').is(':hidden')) {
                                    $('.police-container-distribute-details .security-guard-nearby').stop().hide();
                                }
                                $('.police-container-distribute-details').stop().hide();
                                $('.police-container .police-container-distribute .table .tbody tr:eq(' + that.editParentInd + ') td:eq(2)').text('处理中');
                                $('.police-container .police-container-distribute .table .tbody tr:eq(' + that.editParentInd + ') td:eq(4)').html("<input class='follow-up' type='button' value='跟进' >");
                        data: {
                            regionId: that.node
                        },
                        success: function(result) {
                            if (result.code == 200) {
                                layui.use('layer', function() {
                                    layui.layer.msg('删除巡逻路线成功!')
                                })
                            }
                        }
                    })
                });
            })
            // 警情分发中的跟进按钮的点击事件
            $('.police-container .police-container-distribute .table .tbody').off('click', '.follow-up').on('click', '.follow-up', function () {
                var id = $(this).attr('term-list');
                if (!$('.police-container-distribute-details').is(':hidden')) {
                    $('.police-container-distribute-details').stop().hide();
                }
                $('.police-container-distribute-details .content table tbody').empty();
                var str = '';
                $.ajax({
                    url: 'https://web.byisf.com/api/blade-jfpts/jingdan/jingdan/selectdInfo?deviceNumber=&id=' + id,
                    type: 'POST',
                    dataType: 'JSON',
                    success: function (data) {
                        var result = data.data[0];
                        var t = result.galarmTime.substr(0, 10);
                        var e = result.galarmTime.substr(11);
                        var time = t + '&nbsp;' + e;
                        str += "<tr> <td>报警人姓名:</td> <td>" + result.galarmPeople + "</td> <td>联系方式:</td> <td>" + result.phoneNumber + "</td> </tr>";
                        str += "<tr> <td>事发地址:</td> <td>" + result.place + "</td> <td>行政区:</td> <td>" + result.addvnm + "</td> </>";
                        str += "<tr> <td>报警时间:</td> <td>" + time + "</td> <td>报警内容:</td> <td>" + result.content + "</td> </tr>";
                        str += "<tr> <td>警情级别:</td> <td>" + result.level + "</td> <td>警情类别:</td> <td>" + result.waringType + "</td> </tr>";
                        str += "<tr> <td>处理方式:</td> <td class='treatment-method'> " + (result.type == 2 ? '处理中' : '待处理') + " </td> <td>处理人:</td> <td class='securityname'> " + result.handName + " </td> </tr>";
                        str += "<tr> <td>是否上报110:</td> <td class='report-oneonezero'> <input type='radio' name='callPhone' value='是'> <span>是</span> <input type='radio' name='callPhone' value='否'> <span>否</span> </td> <td>设备编号:</td> <td>" + 1111 + "</td> </tr>";
                        $('.police-container-distribute-details .content table tbody').append(str);
                        $('.police-container-distribute-details .header h4').text('警情跟进');
                        $('.police-container-distribute-details .handle-button').stop().hide();
                        $('.police-container-distribute-details').stop().show();
                    }
                    that.addPolygonEntitys.clear();
                    //修改巡逻路线状态
                    that.isEngineer = false;
                })
            })
            // 警情分发中的详情的取消按钮
            $('.police-container-distribute-details .handle-button .cancel').off('click').click(function () {
                if (!$('.police-container-distribute-details .security-guard-nearby').is(':hidden')) {
                    $('.police-container-distribute-details .security-guard-nearby').stop().hide();
            //编辑巡逻路线
            $('.mapBtn .editBtn').click(function() {
                if (!that.isEngineer) {
                    layui.use('layer', function() {
                        layui.layer.msg('请先新增巡逻路线信息!')
                    })
                    return;
                }
                $('.police-container-distribute-details').stop().hide();
                $("#editEngineeringMap").css("color", "#3385FF");
                //修改为可编辑状态
                that.isEdit = true;
                layui.use('layer', function() {
                    layui.layer.msg('点击巡逻路线图形即可编辑');
                })
            })
            // 警情分发中详情的关闭按钮
            $('.police-container-distribute-details .header .close').off('click').click(function () {
                if (!$('.police-container-distribute-details .security-guard-nearby').is(':hidden')) {
                    $('.police-container-distribute-details .security-guard-nearby').stop().hide();
                }
                $('.police-container-distribute-details').stop().hide();
            })
            // 派发保安的确认按钮
            $('.police-container-distribute-details .security-guard-nearby .security-staff-confirm input').off('click').click(function () {
                var list = $('.police-container-distribute-details .security-guard-nearby .security-staff-content input');
                that.securityFlag = false;
                var id = null;
                var securityname = null;
                for (var i = 0; i < list.length; i++) {
                    if ($(list[i]).prop('checked') == true) {
                        that.securityFlag = true;
                        id = $(list[i]).attr('securityid');
                        securityname = $(list[i]).attr('securityname');
                        break;
                    }
                }
                if (that.securityFlag == false) {
                    layui.use('layer', function () {
                        var layer = layui.layer;
                        layer.msg('请选取保安', {
                            shade: [0.8, '#393D49'],
                            time: 1000
            //新增电子围栏
            $('.mapBtn .insBtn').click(function() {
                //修改按钮样式
                $("#insertEngineeringMap").css("color", "#3385FF")
                    //判断
                if (that.isEngineer) {
                    layui.use('layer', function() {
                            layui.layer.msg('已存在电子围栏');
                        })
                    });
                        //新增按钮颜色改回
                    $("#insertEngineeringMap").css("color", "#757575");
                } else {
                    $('.police-container-distribute-details .content table tbody .securityname').attr('id', id).text(securityname);
                    $('.police-container-distribute-details .security-guard-nearby').stop().hide();
                }
            })
            // 警情信息中类别移入事件
            $('#distributeCategory').mouseenter(function () {
                if ($('#distributeCategory .select-list').is(':hidden')) {
                    $('#distributeCategory .select-list').stop().slideDown(0);
                    layui.use('layer', function() {
                        layui.layer.msg('请开始划分电子围栏');
                    })
                    that.polygonFlag = true;
                }
            })
            // 警情信息中得类别移出事件
            $('#distributeCategory').mouseleave(function () {
                if (!$('#distributeCategory .select-list').is(':hidden')) {
                    $('#distributeCategory .select-list').stop().slideUp(0);
                }
            })
            // 警情信息中类别移入事件
            $('#distributeState').mouseenter(function () {
                if ($('#distributeState .select-list').is(':hidden')) {
                    $('#distributeState .select-list').stop().slideDown(0);
                }
            })
            // 警情信息中得类别移出事件
            $('#distributeState').mouseleave(function () {
                if (!$('#distributeState .select-list').is(':hidden')) {
                    $('#distributeState .select-list').stop().slideUp(0);
                }
            })
            //  警情信息类,业主信息类,设备信息类别,具体项的点击事件
            $('.police-container > div .select-list').off('click', 'li').on('click', 'li', function (event) {
                var text = $(this).text();
                $(this).parent().parent().prev().html(text + '<i></i>');
                $(this).parent().parent().stop().slideUp(0);
                if (text == '全部') text = '';
                var textOrr = '';
                var textList = '';
                var stateType = '';
                if (that.tabIndex == 0) {
                    // that.getPoliceTable($('.analysis-container-police').find('.tbody tbody'), $('#dispatchingStartTime').val(), $('#dispatchingEndTime').val(), text);
                    if ($(this).attr('key')) {
                        textOrr = $('#distributeState div:eq(0)').text().trim();
                        textList = $('.police-dispatching .police-container .distribute-state .select-list ul li');
                        for (var i = 0; i < textList.length; i++) {
                            if (textOrr == $(textList[i]).text()) {
                                stateType = $(textList[i]).attr('statetype');
                            }
                        }
                        that.getPoliceTable($('.police-container-distribute').find('.tbody tbody'), $('#dispatchingStartTime').val(), $('#dispatchingEndTime').val(), '', $(this).attr('addvcd'), stateType);
                    } else {
                        textOrr = $('#distributeCategory div:eq(0)').text().trim();
                        textList = $('.police-dispatching .police-container .distribute-district .select-list ul li');
                        for (var i = 0; i < textList.length; i++) {
                            if (textOrr == $(textList[i]).text()) {
                                stateType = $(textList[i]).attr('addvcd');
                            }
                        }
                        that.getPoliceTable($('.police-container-distribute').find('.tbody tbody'), $('#dispatchingStartTime').val(), $('#dispatchingEndTime').val(), '', stateType, $(this).attr('stateType'));
                    }
                }
            })
            // 时间查询
            $('#dispatchingSelectTime').off('click').click(function () {
                var times = $(this).prevAll();
                // 开始时间
                var startTime = $(times[1]).val();
                // 结束时间
                var endTime = $(times[0]).val();
                var textOne = $('#distributeCategory div:eq(0)').text().trim();
                var addvcd = '';
                var list = $('.police-dispatching .police-container .distribute-district .select-list ul li');
                if (textOne == '全部') {
                    addvcd = '';
                } else {
                    if (list.length > 0) {
                        for (var i = 0; i < list.length; i++) {
                            if (textOne == $(list[i]).text()) {
                                addvcd = $(list[i]).attr('addvcd')
                            }
                        }
                    }
                }
            //查询数据
            $.ajax({
                url: this.pathUrl + '/blade-system/region/lazy-tree?code=3601',
                type: 'GET',
                dataType: 'JSON',
                success: function(res) {
                    that.treeData = res.data;
                    //默认展开二级目录
                    that.treeData[0]['spread'] = true;
                    //加载树
                    layui.use('tree', function() {
                        var tree = layui.tree;
                        //渲染
                        var inst1 = tree.render({
                            elem: '#region-tree',
                            data: that.treeData,
                            showLine: false,
                            customOperate: true,
                            id: "regionTree",
                            edit: ['add', 'update', 'del'],
                            click: function(obj) {
                                //获取当前点击的节点数据
                                var data = obj.data;
                                that.node = data.id;
                                that.isEngineer = false;
                                var extent = null;
                                //显示操作按钮
                                document.getElementById('mapBtn').style.display = "block";
                                that.currentDrawing.forEach(item => {
                                    if (data.id == item.regionId) {
                                        extent = item.extent;
                                        that._map.setExtent(extent.expand(1.5));
                                        that.isEngineer = true;
                                        return;
                                    }
                                });
                            },
                            operate: function(obj) {
                                if (obj.type == "add") {
                                    //prompt层
                                    layer.prompt({ title: '区域名称', formType: 3 }, function(pass, index) {
                                        layer.close(index);
                                        var data = {
                                                parentCode: obj.data.id,
                                                name: pass
                                            }
                                            //新增区域
                                        $.ajax({
                                            url: that.pathUrl + '/blade-system/region/saves',
                                            type: 'POST',
                                            dataType: 'JSON',
                                            contentType: "application/json",
                                            data: JSON.stringify(data),
                                            success: function(data) {
                                                if (data.code == 200) {
                                                    $.ajax({
                                                        url: that.pathUrl + '/blade-system/region/lazy-tree?code=3601',
                                                        type: 'GET',
                                                        dataType: 'JSON',
                                                        success: function(res) {
                                                            that.treeData = res.data;
                                                            //默认展开二级目录
                                                            that.treeData[0]['spread'] = true;
                                                            tree.reload('regionTree', {
                                                                data: that.treeData
                                                            })
                                                        }
                                                    })
                                                }
                                            }
                                        })
                                    });
                var textTwo = $('#distributeState div:eq(0)').text().trim();
                var stateType = '';
                var stateList = $('.police-dispatching .police-container .distribute-state .select-list ul li');
                if (textTwo == '全部') {
                    stateType = '';
                } else {
                    if (stateList.length > 0) {
                        for (var i = 0; i < stateList.length; i++) {
                            if (textTwo == $(stateList[i]).text()) {
                                stateType = $(stateList[i]).attr('statetype')
                            }
                        }
                    }
                }
                that.getPoliceTable($('.police-container-distribute').find('.tbody tbody'), startTime, endTime, '', addvcd, stateType);
            })
            //  巡逻区域中的行点击事件
            $('.police-container .police-container-patrol .main-content>li:eq(0) .table .tbody').off('click', 'tr').on('click', 'tr', function () {
                var flyid = $(this).attr('flyid');
                var flyname = $(this).attr('flyname');
                var extent = null;
                for (var i = 0; i < that.currentDrawing.length; i++) {
                    if (flyid == that.currentDrawing[i].id && flyname == that.currentDrawing[i].regionName) {
                        extent = that.currentDrawing[i].extent;
                    }
                }
                // debugger
                that._map.setExtent(extent.expand(1.5));
                // var myFeatureExtent = new Extent(extent.)
                // thisObj._map.setExtent(myFeatureExtent.expand(2));
                // var lgtd = Number($(this).attr('lgtd'));
                // var lttd = Number($(this).attr('lttd'));
                // var position = new esri.geometry.Point(lgtd, lttd, new esri.SpatialReference({ wkid: 4326 }));//根据输入坐标信息找地图上的点
                // that._map.centerAndZoom(position, 14);//缩放,10是缩放级别,可以自定义,数值越大缩放越大
            })
            // 巡逻区域的新增按钮
            $('.police-container .police-container-patrol .main-content>li:eq(0) .distribute-table-content .operation .add').off('click').click(function () {
                var url = './popup/html/region-name.html';
                layui.use('layer', function () {
                    that.layuiLayer = layui.layer;
                    that.layuiLayer.config({
                        extend: 'myskin/region-name.css'
                    });
                    that.layuiLayer.close(that.layuiLayer.index);
                    that.layuiLayer.open({
                        title: '区域名称',
                        type: 2,
                        shadeClose: false,
                        shade: 0.3,
                        maxmin: false, //开启最大化最小化按钮
                        area: ['320px', '206px'],
                        offset: 'auto',
                        skin: 'region-name',
                        content: url,
                        closeBtn: 1,
                        success: function (layero, index) {
                            layero.find('iframe').contents().find(".start-editing").off('click').click(function () {
                                // 区域名称
                                var regionName = layero.find('iframe').contents().find('.region-name-input').val();
                                var regionDescribe = layero.find('iframe').contents().find('.region-name-textarea').val();
                                if (regionName == '') {
                                    that.layuiLayer.msg('请填写区域名称', {
                                        time: 1000
                                    })
                                    return
                                }
                                if (regionDescribe == '') {
                                    that.layuiLayer.msg('请填写区域描述', {
                                        time: 1000
                                    })
                                    return
                                if (obj.type == "update") {
                                    if (obj.data.id.length == 6 || obj.data.id.length == 4) {
                                        return;
                                    }
                                    //prompt层
                                    layer.prompt({ title: '区域名称', formType: 3 }, function(pass, index) {
                                        layer.close(index);
                                        const data = {
                                                code: obj.data.id,
                                                name: pass
                                            }
                                            //修改区域名称
                                        $.ajax({
                                            url: that.pathUrl + '/blade-system/region/update',
                                            type: 'POST',
                                            dataType: 'JSON',
                                            contentType: "application/json",
                                            data: JSON.stringify(data),
                                            success: function(data) {
                                                if (data.code == 200) {
                                                    $.ajax({
                                                        url: that.pathUrl + '/blade-system/region/lazy-tree?code=3601',
                                                        type: 'GET',
                                                        dataType: 'JSON',
                                                        success: function(res) {
                                                            that.treeData = res.data;
                                                            //默认展开二级目录
                                                            that.treeData[0]['spread'] = true;
                                                            tree.reload('regionTree', {
                                                                data: that.treeData
                                                            })
                                                        }
                                                    })
                                                }
                                            }
                                        })
                                    });
                                }
                                that.globalRegionName = regionName;
                                that.routeOrRegionDescribe = regionDescribe;
                                if (obj.type == "del") {
                                    if (obj.data.id.length == 6 || obj.data.id.length == 4) {
                                        return;
                                    }
                                    //删除区域
                                    $.ajax({
                                        url: that.pathUrl + '/blade-system/region/remove',
                                        type: 'POST',
                                        dataType: 'JSON',
                                        // contentType: "application/json",
                                        data: {
                                            id: obj.data.id,
                                        },
                                        success: function(data) {
                                            if (data.code == 200) {
                                                $.ajax({
                                                    url: that.pathUrl + '/blade-system/region/lazy-tree?code=3601',
                                                    type: 'GET',
                                                    dataType: 'JSON',
                                                    success: function(res) {
                                                        that.treeData = res.data;
                                                        //默认展开二级目录
                                                        that.treeData[0]['spread'] = true;
                                                        tree.reload('regionTree', {
                                                            data: that.treeData
                                                        })
                                                    }
                                                })
                                            }
                                        }
                                    })
                                // 开启,可以勾选线段
                                that.polygonFlag = true;
                                that.layuiLayer.close(index);
                                }
                            }
                        });
                    });
                }
            })
            objThis._map.addLayer(objThis._siteLayer);
            var that = this;
            // 顶部tab得切换事件
            $('.police-dispatching-tab li').click(function() {
                    if (that.tabIndex == $(this).index()) return;
                    if (that.entitysData.length > 0) {
                        that.addEntitys.clear();
                        that.entitysData = [];
                    }
                    that.patrolIndex = 0;
                    that.polygonFlag = false;
                    that.entityPolygonAll.clear();
                    that.modifyPolygon();
                    // 切换时清除新增点线面数组中保存得数据,与清除地图上得实体
                    that.polygonData = [];
                    that.addPolygonEntitys.clear();
                    $(this).addClass('on').siblings().removeClass('on');
                    var ind = $(this).index();
                    $($('.police-container > div')[ind]).stop().show().siblings().stop().hide();
                    if (ind == 0) {
                        $('#distributeCategory div:eq(0)').html('全部' + '<i></i>');
                        $('#distributeState div:eq(0)').html('全部' + '<i></i>');
                        that.getPoliceTable($('.police-container-distribute').find('.tbody tbody'), $('#dispatchingStartTime').val(), $('#dispatchingEndTime').val(), '', '', '');
                    } else if (ind == 1) {
                        // that.getOwnerTable($($('.analysis-container > div')[ind]).find('.tbody tbody'), '', '');
                        $('.police-dispatching .police-container .police-container-patrol .tab-header li:eq(0)').addClass('on').siblings().removeClass('on');
                        $('.police-dispatching .police-container .police-container-patrol .main-content>li:eq(0)').stop().show().siblings().hide();
                        that.patrolArea($('.police-dispatching .police-container .police-container-patrol .main-content>li:eq(0) .table .tbody tbody'), '');
                    } else if (ind == 2) {
                        that.getSecurityPeople($('.police-dispatching .police-container .police-container-policeforce .table .tbody tbody'), '');
                    }
                    that.tabIndex = $(this).index();
                })
                // 警情分发中的行点击事件
            $('.police-container .police-container-distribute .table .tbody').off('click', 'tr').on('click', 'tr', function() {
                    var lgtd = Number($(this).attr('lgtd'));
                    var lttd = Number($(this).attr('lttd'));
                    var position = new esri.geometry.Point(lgtd, lttd, new esri.SpatialReference({
                        wkid: 4326
                    })); //根据输入坐标信息找地图上的点
                    that._map.centerAndZoom(position, 18); //缩放,10是缩放级别,可以自定义,数值越大缩放越大
                })
                // 编辑,跟进按钮元素的父元素的点击事件
            $('.police-container .police-container-distribute .table .tbody').off('click', '.operation').on('click', '.operation', function(event) {
                    event.stopPropagation();
                })
                // 警情分发中的编辑按钮的点击事件
            $('.police-container .police-container-distribute .table .tbody').off('click', '.edit').on('click', '.edit', function(event) {
                    event.stopPropagation();
                    that.editParentInd = null;
                    that.editParentInd = $(this).parent().parent().index();
                    var id = $(this).attr('term-list');
                    that.treatmentIndex = null;
                    if (!$('.police-container-distribute-details .security-guard-nearby').is(':hidden')) {
                        $('.police-container-distribute-details .security-guard-nearby').stop().hide();
                    }
                    if (!$('.police-container-distribute-details').is(':hidden')) {
                        $('.police-container-distribute-details').stop().hide();
                    }
                    $('.police-container-distribute-details .content table tbody').empty();
                    var str = '';
                    $.ajax({
                        url: 'http://61.131.136.25:2082/api/jingdan/jingdan/selectdInfo?deviceNumber=&id=' + id,
                        type: 'POST',
                        dataType: 'JSON',
                        success: function(data) {
                            var result = data.data[0];
                            var t = result.galarmTime.substr(0, 10);
                            var e = result.galarmTime.substr(11);
                            var time = t + '&nbsp;' + e;
                            str += "<tr> <td>报警人姓名:</td> <td>" + result.galarmPeople + "</td> <td>联系方式:</td> <td>" + result.phoneNumber + "</td> </tr>";
                            str += "<tr> <td>事发地址:</td> <td>" + result.place + "</td> <td>行政区:</td> <td>" + result.addvnm + "</td> </>";
                            str += "<tr> <td>报警时间:</td> <td>" + time + "</td> <td>报警内容:</td> <td>" + result.content + "</td> </tr>";
                            str += "<tr> <td>警情级别:</td> <td>" + result.level + "</td> <td>警情类别:</td> <td>" + result.waringType + "</td> </tr>";
                            str += "<tr> <td>处理方式:</td> <td class='treatment-method'> <input type='radio' name='treatmentMethod' value='派发保安' lgtd=" + result.jd + " lttd=" + result.wd + "> <span>派发保安</span> <input type='radio' name='treatmentMethod' value='提示业主'> <span>提示业主</span> </td> <td>处理人:</td> <td class='securityname'></td> </tr>";
                            str += "<tr> <td>是否上报110:</td> <td class='report-oneonezero'> <input type='radio' name='callPhone' value='是'> <span>是</span> <input type='radio' name='callPhone' value='否'> <span>否</span> </td> <td>设备编号:</td> <td>" + result.deviceNumber + "</td> </tr>";
                            $('.police-container-distribute-details .content table tbody').append(str);
                            $('.police-container-distribute-details .handle-button .confirm').attr('police-id', result.id);
                            $('.police-container-distribute-details .handle-button').stop().show();
                            $('.police-container-distribute-details .header h4').text('警情分发');
                            $('.police-container-distribute-details').stop().show();
                            $('.police-container-distribute-details .content table tbody').off('click', '.treatment-method input').on('click', '.treatment-method input', function() {
                                if (that.treatmentIndex != $(this).val()) {
                                    if ($(this).val() == '派发保安') {
                                        var str = '';
                                        $('.police-container-distribute-details .security-guard-nearby .security-staff-content tbody').empty();
                                        $.ajax({
                                            url: 'http://61.131.136.25:2082/api/position/position/selectry',
                                            type: 'POST',
                                            data: {
                                                coordinate: "point(" + $(this).attr('lgtd') + "," + $(this).attr('lttd') + ")"
                                            },
                                            dataType: 'JSON',
                                            success: function(data) {
                                                var result = data.data;
                                                for (var i = 0; i < result.length; i++) {
                                                    str += "<tr> <td>" + (Number(i) + 1) + "</td> <td>" + result[i].sname + "</td> <td>" + result[i].distance.toFixed(2) + "</td> <td><input type='radio' name='securityStaff' securityid=" + result[i].snumber + " securityname=" + result[i].sname + "> </td> </tr>"
                                                }
                                                $('.police-container-distribute-details .security-guard-nearby .security-staff-content tbody').append(str);
                                            }
                                        })
                                        $('.police-container-distribute-details .security-guard-nearby').stop().show();
                                    } else {
                                        $('.police-container-distribute-details .content table tbody .securityname').text('');
                                        $('.police-container-distribute-details .security-guard-nearby').stop().hide();
                                    }
                                    that.treatmentIndex = $(this).val();
                                }
                            })
                        }
                    })
                })
                // 警情分发中的详情的确认按钮
            $('.police-container-distribute-details .handle-button .confirm').off('click').click(function() {
                    var self = this;
                    layui.use('layer', function() {
                        var layer = layui.layer;
                        if (that.treatmentIndex == null) {
                            layer.msg('请选择处理方式', {
                                shade: [0.8, '#393D49'],
                                time: 1000
                            })
                            return
                        } else {
                            if (that.treatmentIndex == '派发保安') {
                                if (that.securityFlag == false) {
                                    layer.msg('请选取保安', {
                                        shade: [0.8, '#393D49'],
                                        time: 1000
                                    })
                                    return
                                }
                            }
                        }
                        var id = $(self).attr('police-id');
                        var handletype = null;
                        if (that.treatmentIndex != null) {
                            if (that.treatmentIndex == '派发保安') {
                                handletype = '0';
                            } else {
                                handletype = '1';
                            }
                        }
                        // 发送请求修改警单数据
                        $.ajax({
                            url: 'http://61.131.136.25:2082/api/jingdan/jingdan/updateInfo',
                            type: 'POST',
                            data: {
                                id: id,
                                // handleP: $('.police-container-distribute-details .content table tbody tr:eq(4) td:eq(3)').attr('people-id'),
                                // handName: $('.police-container-distribute-details .content table tbody tr:eq(4) td:eq(3)').text(),
                                handleP: $('.police-container-distribute-details .content table tbody .securityname').attr('id'),
                                handName: $('.police-container-distribute-details .content table tbody .securityname').text(),
                                handletype: handletype,
                                type: '2'
                            },
                            dataType: 'JSON',
                            success: function(data) {
                                if (data.code == 200) {
                                    if (!$('.police-container-distribute-details .security-guard-nearby').is(':hidden')) {
                                        $('.police-container-distribute-details .security-guard-nearby').stop().hide();
                                    }
                                    $('.police-container-distribute-details').stop().hide();
                                    $('.police-container .police-container-distribute .table .tbody tr:eq(' + that.editParentInd + ') td:eq(2)').text('处理中');
                                    $('.police-container .police-container-distribute .table .tbody tr:eq(' + that.editParentInd + ') td:eq(4)').html("<input class='follow-up' type='button' value='跟进' >");
                                }
                            }
                        })
                    });
                })
                // 警情分发中的跟进按钮的点击事件
            $('.police-container .police-container-distribute .table .tbody').off('click', '.follow-up').on('click', '.follow-up', function() {
                    var id = $(this).attr('term-list');
            })
            // 查找按钮
            $('.police-container .police-container-patrol .main-content>li:eq(0) .distribute-table-content .operation .query').off('click').click(function () {
                    if (!$('.police-container-distribute-details').is(':hidden')) {
                        $('.police-container-distribute-details').stop().hide();
                    }
                    $('.police-container-distribute-details .content table tbody').empty();
                    var str = '';
                    $.ajax({
                        url: 'http://61.131.136.25:2082/api/jingdan/jingdan/selectdInfo?deviceNumber=&id=' + id,
                        type: 'POST',
                        dataType: 'JSON',
                        success: function(data) {
                            var result = data.data[0];
                            var t = result.galarmTime.substr(0, 10);
                            var e = result.galarmTime.substr(11);
                            var time = t + '&nbsp;' + e;
                            str += "<tr> <td>报警人姓名:</td> <td>" + result.galarmPeople + "</td> <td>联系方式:</td> <td>" + result.phoneNumber + "</td> </tr>";
                            str += "<tr> <td>事发地址:</td> <td>" + result.place + "</td> <td>行政区:</td> <td>" + result.addvnm + "</td> </>";
                            str += "<tr> <td>报警时间:</td> <td>" + time + "</td> <td>报警内容:</td> <td>" + result.content + "</td> </tr>";
                            str += "<tr> <td>警情级别:</td> <td>" + result.level + "</td> <td>警情类别:</td> <td>" + result.waringType + "</td> </tr>";
                            str += "<tr> <td>处理方式:</td> <td class='treatment-method'> " + (result.type == 2 ? '处理中' : '待处理') + " </td> <td>处理人:</td> <td class='securityname'> " + result.handName + " </td> </tr>";
                            str += "<tr> <td>是否上报110:</td> <td class='report-oneonezero'> <input type='radio' name='callPhone' value='是'> <span>是</span> <input type='radio' name='callPhone' value='否'> <span>否</span> </td> <td>设备编号:</td> <td>" + 1111 + "</td> </tr>";
                            $('.police-container-distribute-details .content table tbody').append(str);
                            $('.police-container-distribute-details .header h4').text('警情跟进');
                            $('.police-container-distribute-details .handle-button').stop().hide();
                            $('.police-container-distribute-details').stop().show();
                        }
                    })
                })
                // 警情分发中的详情的取消按钮
            $('.police-container-distribute-details .handle-button .cancel').off('click').click(function() {
                    if (!$('.police-container-distribute-details .security-guard-nearby').is(':hidden')) {
                        $('.police-container-distribute-details .security-guard-nearby').stop().hide();
                    }
                    $('.police-container-distribute-details').stop().hide();
                })
                // 警情分发中详情的关闭按钮
            $('.police-container-distribute-details .header .close').off('click').click(function() {
                    if (!$('.police-container-distribute-details .security-guard-nearby').is(':hidden')) {
                        $('.police-container-distribute-details .security-guard-nearby').stop().hide();
                    }
                    $('.police-container-distribute-details').stop().hide();
                })
                // 派发保安的确认按钮
            $('.police-container-distribute-details .security-guard-nearby .security-staff-confirm input').off('click').click(function() {
                    var list = $('.police-container-distribute-details .security-guard-nearby .security-staff-content input');
                    that.securityFlag = false;
                    var id = null;
                    var securityname = null;
                    for (var i = 0; i < list.length; i++) {
                        if ($(list[i]).prop('checked') == true) {
                            that.securityFlag = true;
                            id = $(list[i]).attr('securityid');
                            securityname = $(list[i]).attr('securityname');
                            break;
                        }
                    }
                    if (that.securityFlag == false) {
                        layui.use('layer', function() {
                            var layer = layui.layer;
                            layer.msg('请选取保安', {
                                shade: [0.8, '#393D49'],
                                time: 1000
                            })
                        });
                    } else {
                        $('.police-container-distribute-details .content table tbody .securityname').attr('id', id).text(securityname);
                        $('.police-container-distribute-details .security-guard-nearby').stop().hide();
                    }
                })
                // 警情信息中类别移入事件
            $('#distributeCategory').mouseenter(function() {
                    if ($('#distributeCategory .select-list').is(':hidden')) {
                        $('#distributeCategory .select-list').stop().slideDown(0);
                    }
                })
                // 警情信息中得类别移出事件
            $('#distributeCategory').mouseleave(function() {
                    if (!$('#distributeCategory .select-list').is(':hidden')) {
                        $('#distributeCategory .select-list').stop().slideUp(0);
                    }
                })
                // 警情信息中类别移入事件
            $('#distributeState').mouseenter(function() {
                    if ($('#distributeState .select-list').is(':hidden')) {
                        $('#distributeState .select-list').stop().slideDown(0);
                    }
                })
                // 警情信息中得类别移出事件
            $('#distributeState').mouseleave(function() {
                    if (!$('#distributeState .select-list').is(':hidden')) {
                        $('#distributeState .select-list').stop().slideUp(0);
                    }
                })
                //  警情信息类,业主信息类,设备信息类别,具体项的点击事件
            $('.police-container > div .select-list').off('click', 'li').on('click', 'li', function(event) {
                    var text = $(this).text();
                    $(this).parent().parent().prev().html(text + '<i></i>');
                    $(this).parent().parent().stop().slideUp(0);
                    if (text == '全部') text = '';
                    var textOrr = '';
                    var textList = '';
                    var stateType = '';
                    if (that.tabIndex == 0) {
                        // that.getPoliceTable($('.analysis-container-police').find('.tbody tbody'), $('#dispatchingStartTime').val(), $('#dispatchingEndTime').val(), text);
                        if ($(this).attr('key')) {
                            textOrr = $('#distributeState div:eq(0)').text().trim();
                            textList = $('.police-dispatching .police-container .distribute-state .select-list ul li');
                            for (var i = 0; i < textList.length; i++) {
                                if (textOrr == $(textList[i]).text()) {
                                    stateType = $(textList[i]).attr('statetype');
                                }
                            }
                            that.getPoliceTable($('.police-container-distribute').find('.tbody tbody'), $('#dispatchingStartTime').val(), $('#dispatchingEndTime').val(), '', $(this).attr('addvcd'), stateType);
                        } else {
                            textOrr = $('#distributeCategory div:eq(0)').text().trim();
                            textList = $('.police-dispatching .police-container .distribute-district .select-list ul li');
                            for (var i = 0; i < textList.length; i++) {
                                if (textOrr == $(textList[i]).text()) {
                                    stateType = $(textList[i]).attr('addvcd');
                                }
                            }
                            that.getPoliceTable($('.police-container-distribute').find('.tbody tbody'), $('#dispatchingStartTime').val(), $('#dispatchingEndTime').val(), '', stateType, $(this).attr('stateType'));
                        }
                    }
                })
                // 时间查询
            $('#dispatchingSelectTime').off('click').click(function() {
                    var times = $(this).prevAll();
                    // 开始时间
                    var startTime = $(times[1]).val();
                    // 结束时间
                    var endTime = $(times[0]).val();
                    var textOne = $('#distributeCategory div:eq(0)').text().trim();
                    var addvcd = '';
                    var list = $('.police-dispatching .police-container .distribute-district .select-list ul li');
                    if (textOne == '全部') {
                        addvcd = '';
                    } else {
                        if (list.length > 0) {
                            for (var i = 0; i < list.length; i++) {
                                if (textOne == $(list[i]).text()) {
                                    addvcd = $(list[i]).attr('addvcd')
                                }
                            }
                        }
                    }
                    var textTwo = $('#distributeState div:eq(0)').text().trim();
                    var stateType = '';
                    var stateList = $('.police-dispatching .police-container .distribute-state .select-list ul li');
                    if (textTwo == '全部') {
                        stateType = '';
                    } else {
                        if (stateList.length > 0) {
                            for (var i = 0; i < stateList.length; i++) {
                                if (textTwo == $(stateList[i]).text()) {
                                    stateType = $(stateList[i]).attr('statetype')
                                }
                            }
                        }
                    }
                    that.getPoliceTable($('.police-container-distribute').find('.tbody tbody'), startTime, endTime, '', addvcd, stateType);
                })
                //  巡逻区域中的行点击事件
            $('.police-container .police-container-patrol .main-content>li:eq(0) .table .tbody').off('click', 'tr').on('click', 'tr', function() {
                    var flyid = $(this).attr('flyid');
                    var flyname = $(this).attr('flyname');
                    var extent = null;
                    for (var i = 0; i < that.currentDrawing.length; i++) {
                        if (flyid == that.currentDrawing[i].id && flyname == that.currentDrawing[i].regionName) {
                            extent = that.currentDrawing[i].extent;
                        }
                    }
                    // debugger
                    that._map.setExtent(extent.expand(1.5));
                    // var myFeatureExtent = new Extent(extent.)
                    // thisObj._map.setExtent(myFeatureExtent.expand(2));
                    // var lgtd = Number($(this).attr('lgtd'));
                    // var lttd = Number($(this).attr('lttd'));
                    // var position = new esri.geometry.Point(lgtd, lttd, new esri.SpatialReference({ wkid: 4326 }));//根据输入坐标信息找地图上的点
                    // that._map.centerAndZoom(position, 14);//缩放,10是缩放级别,可以自定义,数值越大缩放越大
                })
                // 巡逻区域的新增按钮
            $('.police-container .police-container-patrol .main-content>li:eq(0) .distribute-table-content .operation .add').off('click').click(function() {
                    var url = './popup/html/region-name.html';
                    layui.use('layer', function() {
                        that.layuiLayer = layui.layer;
                        that.layuiLayer.config({
                            extend: 'myskin/region-name.css'
                        });
                        that.layuiLayer.close(that.layuiLayer.index);
                        that.layuiLayer.open({
                            title: '区域名称',
                            type: 2,
                            shadeClose: false,
                            shade: 0.3,
                            maxmin: false, //开启最大化最小化按钮
                            area: ['320px', '206px'],
                            offset: 'auto',
                            skin: 'region-name',
                            content: url,
                            closeBtn: 1,
                            success: function(layero, index) {
                                layero.find('iframe').contents().find(".start-editing").off('click').click(function() {
                                    // 区域名称
                                    var regionName = layero.find('iframe').contents().find('.region-name-input').val();
                                    var regionDescribe = layero.find('iframe').contents().find('.region-name-textarea').val();
                                    if (regionName == '') {
                                        that.layuiLayer.msg('请填写区域名称', {
                                            time: 1000
                                        })
                                        return
                                    }
                                    if (regionDescribe == '') {
                                        that.layuiLayer.msg('请填写区域描述', {
                                            time: 1000
                                        })
                                        return
                                    }
                                    that.globalRegionName = regionName;
                                    that.routeOrRegionDescribe = regionDescribe;
                                    // 开启,可以勾选线段
                                    that.polygonFlag = true;
                                    that.layuiLayer.close(index);
                                })
                            }
                        });
                    })
                })
                // 查找按钮
            $('.police-container .police-container-patrol .main-content>li:eq(0) .distribute-table-content .operation .query').off('click').click(function() {
                var routerName = $('.police-container .police-container-patrol .main-content>li:eq(0) .distribute-table-content .route-name').val();
                // if (routerName == '') {
                //   layui.use('layer', function () {
@@ -677,13 +930,15 @@
            })
            // 保安出警管理表格中点击事件
            $('.police-dispatching .police-container .police-container-policeforce .table .tbody tbody').off('click', 'input').on('click', 'input', function (event) {
            $('.police-dispatching .police-container .police-container-policeforce .table .tbody tbody').off('click', 'input').on('click', 'input', function(event) {
                event.stopPropagation();
                var lgtd = Number($(this).parent().parent().attr('lgtd'));
                var lttd = Number($(this).parent().parent().attr('lttd'));
                var position = new esri.geometry.Point(lgtd, lttd, new esri.SpatialReference({wkid: 4326}));//根据输入坐标信息找地图上的点
                var position = new esri.geometry.Point(lgtd, lttd, new esri.SpatialReference({
                    wkid: 4326
                })); //根据输入坐标信息找地图上的点
                that.newElectronicFenceId = null;
                that._map.centerAndZoom(position, 18);//缩放,10是缩放级别,可以自定义,数值越大缩放越大
                that._map.centerAndZoom(position, 18); //缩放,10是缩放级别,可以自定义,数值越大缩放越大
                var graphic = that.entityPolygonAll.graphics;
                for (var i = 0; i < graphic.length; i++) {
                    if (graphic[i].objId.id == $(this).attr('resultid')) {
@@ -692,7 +947,7 @@
                            that.electronicFence();
                            that.activateToolbar(graphic[i]);
                        } else {
                            layui.use('layer', function () {
                            layui.use('layer', function() {
                                layui.layer.msg('请开始划分电子围栏');
                            })
                            that.polygonFlag = true;
@@ -701,18 +956,20 @@
                    }
                }
            })
            $('.police-dispatching .police-container .police-container-policeforce .table .tbody tbody').off('click', 'tr').on('click', 'tr', function (event) {
            $('.police-dispatching .police-container .police-container-policeforce .table .tbody tbody').off('click', 'tr').on('click', 'tr', function(event) {
                event.stopPropagation();
                var lgtd = Number($(this).attr('lgtd'));
                var lttd = Number($(this).attr('lttd'));
                var position = new esri.geometry.Point(lgtd, lttd, new esri.SpatialReference({wkid: 4326}));//根据输入坐标信息找地图上的点
                var position = new esri.geometry.Point(lgtd, lttd, new esri.SpatialReference({
                    wkid: 4326
                })); //根据输入坐标信息找地图上的点
                that._map.centerAndZoom(position, 18);//缩放,10是缩放级别,可以自定义,数值越大缩放越大
                that._map.centerAndZoom(position, 18); //缩放,10是缩放级别,可以自定义,数值越大缩放越大
                var snumber = $(this).attr('term-snumber');
                var url = './popup/html/personnel-information-management.html?id=' + snumber;
                layui.use('layer', function () {
                layui.use('layer', function() {
                    that.layuiLayer = layui.layer;
                    that.layuiLayer.config({
                        extend: 'myskin/personnel-information-management.css'
@@ -732,7 +989,7 @@
                    });
                })
            })
            $('.police-dispatching .police-container .police-container-policeforce .table .tbody tbody').off('click', 'tr td').on('click', 'tr td', function (event) {
            $('.police-dispatching .police-container .police-container-policeforce .table .tbody tbody').off('click', 'tr td').on('click', 'tr td', function(event) {
                if ($(this).index() == 4) {
                    event.stopPropagation();
                    return;
@@ -741,124 +998,124 @@
            })
            // 巡逻管理中,巡逻路线和巡逻区域的切换换
            $('.police-dispatching .police-container .police-container-patrol .tab-header li').off('click').click(function () {
                if (that.patrolIndex == $(this).index()) return;
                $(this).addClass('on').siblings().removeClass('on');
                $(".police-dispatching .police-container .police-container-patrol .main-content li:eq(" + $(this).index() + ")").stop().show().siblings().stop().hide();
            $('.police-dispatching .police-container .police-container-patrol .tab-header li').off('click').click(function() {
                    if (that.patrolIndex == $(this).index()) return;
                    $(this).addClass('on').siblings().removeClass('on');
                    $(".police-dispatching .police-container .police-container-patrol .main-content li:eq(" + $(this).index() + ")").stop().show().siblings().stop().hide();
                that.polygonFlag = false;
                that.entityPolygonAll.clear();
                that.modifyPolygon();
                    that.polygonFlag = false;
                    that.entityPolygonAll.clear();
                    that.modifyPolygon();
                // 切换时清除新增点线面数组中保存得数据,与清除地图上得实体
                that.polygonData = [];
                that.addPolygonEntitys.clear();
                    // 切换时清除新增点线面数组中保存得数据,与清除地图上得实体
                    that.polygonData = [];
                    that.addPolygonEntitys.clear();
                if ($(this).index() == 1) {
                    $('.police-dispatching .police-container .police-container-patrol .main-content .select-list ul').empty();
                    $.ajax({
                        url: 'https://web.byisf.com/api/blade-jfpts/regions/regions/selectqy',
                        type: 'GET',
                        dataType: 'JSON',
                        success: function (res) {
                            var result = res.data;
                            $('.police-dispatching .police-container .police-container-patrol .main-content .select>ul>li>div:eq(0)').html(result[0].regionName + '<i></i>').attr('regionId', result[0].regionId);
                            for (var i = 0; i < result.length; i++) {
                                $('.police-dispatching .police-container .police-container-patrol .main-content .select-list ul').append($("<li regionId='" + result[i].regionId + "'>" + result[i].regionName + "</li>"))
                    if ($(this).index() == 1) {
                        $('.police-dispatching .police-container .police-container-patrol .main-content .select-list ul').empty();
                        $.ajax({
                            url: 'http://61.131.136.25:2082/api/regions/regions/selectqy',
                            type: 'GET',
                            dataType: 'JSON',
                            success: function(res) {
                                var result = res.data;
                                $('.police-dispatching .police-container .police-container-patrol .main-content .select>ul>li>div:eq(0)').html(result[0].regionName + '<i></i>').attr('regionId', result[0].regionId);
                                for (var i = 0; i < result.length; i++) {
                                    $('.police-dispatching .police-container .police-container-patrol .main-content .select-list ul').append($("<li regionId='" + result[i].regionId + "'>" + result[i].regionName + "</li>"))
                                }
                            }
                        }
                    })
                    that.getRouteInformation($('.police-dispatching .police-container .police-container-patrol .main-content>li:eq(1) .table .tbody tbody'), '');
                } else {
                        })
                        that.getRouteInformation($('.police-dispatching .police-container .police-container-patrol .main-content>li:eq(1) .table .tbody tbody'), '');
                    } else {
                    that.patrolArea($('.police-dispatching .police-container .police-container-patrol .main-content>li:eq(0) .table .tbody tbody'), '');
                }
                        that.patrolArea($('.police-dispatching .police-container .police-container-patrol .main-content>li:eq(0) .table .tbody tbody'), '');
                    }
                that.patrolIndex = $(this).index();
            })
            // 巡逻管理下面的巡逻路线中的select选择框的移入事件
            $('#patrolRoute').mouseenter(function () {
                if ($('#patrolRoute .select-list').is(':hidden')) {
                    $('#patrolRoute .select-list').stop().slideDown(0);
                }
            })
            // 巡逻管理下面的巡逻路线中的select选择框的移出事件
            $('#patrolRoute').mouseleave(function () {
                if (!$('#patrolRoute .select-list').is(':hidden')) {
                    $('#patrolRoute .select-list').stop().slideUp(0);
                }
            })
            // 巡逻路线中区域选择的具体项的点击事件
            $('.police-dispatching .police-container .police-container-patrol .select-list').off('click', 'li').on('click', 'li', function (event) {
                var text = $(this).text();
                $(this).parent().parent().prev().html(text + '<i></i>').attr('regionId', $(this).attr('regionId'));
                $(this).parent().parent().stop().slideUp(0);
            })
            // 巡逻路线中的新增按钮的点击事件
            $('.police-dispatching .police-container .police-container-patrol .main-content>li:eq(1) .add').off('click').click(function () {
                var url = './popup/html/route-name-layer.html';
                layui.use('layer', function () {
                    that.layuiLayer = layui.layer;
                    that.layuiLayer.config({
                        extend: 'myskin/route-name-layer.css'
                    });
                    that.layuiLayer.closeAll();
                    that.layuiLayer.open({
                        title: '路线名称及描述',
                        type: 2,
                        shadeClose: false,
                        shade: 0.3,
                        maxmin: false, //开启最大化最小化按钮
                        area: ['320px', '266px'],
                        offset: 'auto',
                        skin: 'route-name-layer',
                        content: url,
                        closeBtn: 1,
                        resize: false,
                        success: function (layero, index) {
                            layero.find('iframe').contents().find(".start-editing").off('click').click(function () {
                                // 区域名称 or 路线名称
                                var routeName = layero.find('iframe').contents().find('.route-name-layer-input').val();
                                var routeDescribe = layero.find('iframe').contents().find('.route-name-layer-textarea').val();
                                var peopleRealName = layero.find('iframe').contents().find('.route-personnel').val();
                                var pepleRealId = layero.find('iframe').contents().find('.route-personnel').attr('peopleid');
                                if (routeName == '') {
                                    that.layuiLayer.msg('请填写路线名称', {
                                        time: 1000
                                    })
                                    return
                                }
                                if (routeDescribe == '') {
                                    that.layuiLayer.msg('请填写路线描述', {
                                        time: 1000
                                    })
                                    return
                                }
                                if (pepleRealId == '') {
                                    that.layuiLayer.msg('请选择人员', {
                                        time: 1000
                                    })
                                    return
                                }
                                that.peopleRealName = peopleRealName;
                                that.pepleRealId = pepleRealId;
                                that.globalRegionName = routeName;
                                that.routeOrRegionDescribe = routeDescribe;
                                // // 开启,可以勾选线段
                                that.polygonFlag = true;
                                that.layuiLayer.close(index);
                            })
                        }
                    });
                    that.patrolIndex = $(this).index();
                })
                // 巡逻管理下面的巡逻路线中的select选择框的移入事件
            $('#patrolRoute').mouseenter(function() {
                    if ($('#patrolRoute .select-list').is(':hidden')) {
                        $('#patrolRoute .select-list').stop().slideDown(0);
                    }
                })
                // 巡逻管理下面的巡逻路线中的select选择框的移出事件
            $('#patrolRoute').mouseleave(function() {
                    if (!$('#patrolRoute .select-list').is(':hidden')) {
                        $('#patrolRoute .select-list').stop().slideUp(0);
                    }
                })
                // 巡逻路线中区域选择的具体项的点击事件
            $('.police-dispatching .police-container .police-container-patrol .select-list').off('click', 'li').on('click', 'li', function(event) {
                    var text = $(this).text();
                    $(this).parent().parent().prev().html(text + '<i></i>').attr('regionId', $(this).attr('regionId'));
                    $(this).parent().parent().stop().slideUp(0);
                })
                // 巡逻路线中的新增按钮的点击事件
            $('.police-dispatching .police-container .police-container-patrol .main-content>li:eq(1) .add').off('click').click(function() {
                    var url = './popup/html/route-name-layer.html';
                    layui.use('layer', function() {
                        that.layuiLayer = layui.layer;
                        that.layuiLayer.config({
                            extend: 'myskin/route-name-layer.css'
                        });
                        that.layuiLayer.closeAll();
                        that.layuiLayer.open({
                            title: '路线名称及描述',
                            type: 2,
                            shadeClose: false,
                            shade: 0.3,
                            maxmin: false, //开启最大化最小化按钮
                            area: ['320px', '216px'],
                            offset: 'auto',
                            skin: 'route-name-layer',
                            content: url,
                            closeBtn: 1,
                            resize: false,
                            success: function(layero, index) {
                                layero.find('iframe').contents().find(".start-editing").off('click').click(function() {
                                    // 区域名称 or 路线名称
                                    var routeName = layero.find('iframe').contents().find('.route-name-layer-input').val();
                                    var routeDescribe = layero.find('iframe').contents().find('.route-name-layer-textarea').val();
                                    var peopleRealName = layero.find('iframe').contents().find('.route-personnel').val();
                                    var pepleRealId = layero.find('iframe').contents().find('.route-personnel').attr('peopleid');
                                    if (routeName == '') {
                                        that.layuiLayer.msg('请填写路线名称', {
                                            time: 1000
                                        })
                                        return
                                    }
            })
            // 巡逻路线行点击事件
            $('.police-container .police-container-patrol .main-content>li:eq(1) .table .tbody').off('click', 'tr').on('click', 'tr', function () {
                                    if (routeDescribe == '') {
                                        that.layuiLayer.msg('请填写路线描述', {
                                            time: 1000
                                        })
                                        return
                                    }
                                    // if (pepleRealId == '') {
                                    //   that.layuiLayer.msg('请选择人员', {
                                    //     time: 1000
                                    //   })
                                    //   return
                                    // }
                                    that.peopleRealName = peopleRealName;
                                    that.pepleRealId = '485';
                                    that.globalRegionName = routeName;
                                    that.routeOrRegionDescribe = routeDescribe;
                                    // // 开启,可以勾选线段
                                    that.polygonFlag = true;
                                    that.layuiLayer.close(index);
                                })
                            }
                        });
                    })
                })
                // 巡逻路线行点击事件
            $('.police-container .police-container-patrol .main-content>li:eq(1) .table .tbody').off('click', 'tr').on('click', 'tr', function() {
                var flyid = $(this).attr('flyid');
                var flyname = $(this).attr('flyname');
                var extent = null;
@@ -869,14 +1126,14 @@
                }
                that._map.setExtent(extent.expand(1.5));
            })
            $('.police-container .police-container-patrol .main-content>li:eq(1) .table .tbody').off('click', 'tr td').on('click', 'tr td', function (event) {
            $('.police-container .police-container-patrol .main-content>li:eq(1) .table .tbody').off('click', 'tr td').on('click', 'tr td', function(event) {
                if ($(this).index() == 4) {
                    event.stopPropagation();
                    return;
                }
            })
            $('.police-container .police-container-patrol .main-content>li:eq(1) .table .tbody').off('click', 'input').on('click', 'input', function (event) {
            $('.police-container .police-container-patrol .main-content>li:eq(1) .table .tbody').off('click', 'input').on('click', 'input', function(event) {
                event.stopPropagation();
                var routeName = $(this).parent().parent().children('td:eq(2)').text();
                var routeId = $(this).parent().parent().attr('flyid');
@@ -885,7 +1142,7 @@
                var url = './popup/html/routename-and-peoplename.html?routeName=' + routeName + '&routeId=' + routeId + '&peopleName=' + peopleName;
                layui.use('layer', function () {
                layui.use('layer', function() {
                    that.layuiLayer = layui.layer;
                    that.layuiLayer.config({
                        extend: 'myskin/routename-and-peoplename.css'
@@ -897,14 +1154,14 @@
                        shadeClose: false,
                        shade: 0.3,
                        maxmin: false, //开启最大化最小化按钮
                        area: ['320px', '172px'],
                        area: ['320px', '132px'],
                        offset: 'auto',
                        skin: 'routename-and-peoplename',
                        content: url,
                        closeBtn: 1,
                        resize: false,
                        success: function (layero, index) {
                            layero.find('iframe').contents().find(".confirm-update").off('click').click(function () {
                        success: function(layero, index) {
                            layero.find('iframe').contents().find(".confirm-update").off('click').click(function() {
                                // 区域名称 or 路线名称
                                var peoplelayerName = layero.find('iframe').contents().find('.peoplename-update').val();
@@ -912,28 +1169,33 @@
                                console.log(peoplelayerName, peoplelayerId);
                                if (peoplelayerName == peopleName) {
                                    that.layuiLayer.close(index);
                                    that.layuiLayer.msg('人员未更改!');
                                } else {
                                    $.ajax({
                                        url: 'https://web.byisf.com/api/blade-jfpts/duty/duty/updatedtInfo',
                                        type: 'POST',
                                        data: {
                                            rid: routeId,
                                            snumber: peoplelayerId,
                                            sname: peoplelayerName
                                        },
                                        dataType: 'JSON',
                                        success: function (res) {
                                            if (res.code == 200) {
                                                that.layuiLayer.close(index);
                                                $(self).parent().parent().children('td:eq(1)').text(peoplelayerName);
                                                that.layuiLayer.msg('人员已更改!');
                                            }
                                // if (peoplelayerName == peopleName) {
                                //   that.layuiLayer.close(index);
                                //   that.layuiLayer.msg('人员未更改!');
                                // } else {
                                $.ajax({
                                    url: 'http://61.131.136.25:2082/api/duty/duty/updatedtInfo',
                                    type: 'POST',
                                    data: {
                                        rid: routeId,
                                        snumber: peoplelayerId,
                                        sname: '张三'
                                    },
                                    dataType: 'JSON',
                                    success: function(res) {
                                        if (res.code == 200) {
                                            that.layuiLayer.close(index);
                                            $(self).parent().parent().children('td:eq(1)').text(peoplelayerName);
                                            that.layuiLayer.msg('人员已更改!');
                                        }
                                    })
                                }
                                    }
                                })
                                // }
                            })
                        }
@@ -945,7 +1207,7 @@
            // 查找按钮
            $('.police-container .police-container-patrol .main-content>li:eq(1) .distribute-table-content .operation .query').off('click').click(function () {
            $('.police-container .police-container-patrol .main-content>li:eq(1) .distribute-table-content .operation .query').off('click').click(function() {
                var routerName = $('.police-container .police-container-patrol .main-content>li:eq(1) .distribute-table-content .route-name').val();
                // if (routerName == '') {
                //   layui.use('layer', function () {
@@ -960,7 +1222,7 @@
            })
        },
        open: function () {
        open: function() {
            var that = this;
            $("#tabcontainer").css("width", "360px");
@@ -968,14 +1230,14 @@
            AppEvent.dispatchAppEvent(AppEvent.APPLICATION_RESIZE, {});
            document.oncontextmenu = function (event) {
            document.oncontextmenu = function(event) {
                event.preventDefault();
            };
            document.getElementById('mainMapWidget').onmousedown = function (event) {
            document.getElementById('mainMapWidget').onmousedown = function(event) {
                if (event.button == 2) {
                    if (that.polygonData.length < 2) {
                        layui.use('layer', function () {
                        layui.use('layer', function() {
                            layui.layer.msg('不能形成区域,请继续划分!!!')
                        })
                        return;
@@ -1007,38 +1269,34 @@
                        if (that.tabIndex == 1) {
                            if (that.patrolIndex == 1) {
                                $.ajax({
                                    url: 'https://web.byisf.com/api/blade-jfpts/routeIn/routein/insertlx',
                                    url: 'http://61.131.136.25:2082/api/routeIn/routein/insertlx',
                                    type: 'POST',
                                    dataType: 'JSON',
                                    data: {
                                        routeName: that.globalRegionName,
                                        regionId: $('#patrolRoute div:eq(0)').attr('regionid'),
                                        regionId: that.node,
                                        routeInfo: dataStr,
                                        remarks: that.routeOrRegionDescribe,
                                        creatName: ''
                                    },
                                    success: function (result) {
                                    success: function(result) {
                                        if (result.code == 200) {
                                            that.addPolygonEntitys.clear();
                                            layui.use('layer', function() {
                                                    layui.layer.msg('新增巡逻路线成功!')
                                                })
                                                //清除点信息
                                            that.polygonData = [];
                                            that.getRouteInformation($('.police-dispatching .police-container .police-container-patrol .table .tbody tbody'), '');
                                            $.ajax({
                                                url: 'https://web.byisf.com/api/blade-jfpts/duty/duty/insertduty',
                                                type: 'POST',
                                                dataType: 'JSON',
                                                data: {
                                                    sname: that.peopleRealName,
                                                    snumber: that.pepleRealId,
                                                    rid: result.data,
                                                    regionId: $('#patrolRoute div:eq(0)').attr('regionid'),
                                                    type: 0
                                                },
                                                success: function (data) {
                                                    if (data.code == 200) {
                                                        alert(1);
                                                    }
                                                }
                                            })
                                            //新增按钮颜色改回
                                            $("#insertEngineeringMap").css("color", "#757575");
                                            //清空线图层信息
                                            that.addLineEntitys.clear();
                                            //修改电子围栏数据状态
                                            that.isEngineer = true;
                                            //修改电子围栏选中状态
                                            that.isChecked = false;
                                            //修改电子围栏编辑状态
                                            that.polygonFlag = false;
                                        }
                                    }
                                })
@@ -1048,7 +1306,7 @@
                                // that.pepleRealId = pepleRealId;
                            } else {
                                $.ajax({
                                    url: 'https://web.byisf.com/api/blade-jfpts/regions/regions/insterqy',
                                    url: 'http://61.131.136.25:2082/api/regions/regions/insterqy',
                                    type: 'POST',
                                    dataType: 'JSON',
                                    data: {
@@ -1056,7 +1314,7 @@
                                        coordinate: dataStr,
                                        remarks: that.routeOrRegionDescribe
                                    },
                                    success: function (result) {
                                    success: function(result) {
                                        if (result.code == 200) {
                                            that.addPolygonEntitys.clear();
                                            that.polygonData = [];
@@ -1067,7 +1325,7 @@
                            }
                        } else if (that.tabIndex == 2) {
                            $.ajax({
                                url: 'https://web.byisf.com/api/blade-jfpts/enclosure/enclosure/insertes',
                                url: 'http://61.131.136.25:2082/api/enclosure/enclosure/insertes',
                                type: 'POST',
                                dataType: 'JSON',
                                data: {
@@ -1075,7 +1333,7 @@
                                    aname: that.newElectronicFenceId.aname,
                                    routeInfo: dataStr
                                },
                                success: function (result) {
                                success: function(result) {
                                    if (result.code == 200) {
                                        that.addPolygonEntitys.clear();
                                        that.polygonData = [];
@@ -1096,27 +1354,67 @@
            }
            // $('.police-dispatching .police-container .police-container-patrol .main-content .select-list ul').empty();
            // $.ajax({
            //     url: 'http://61.131.136.25:2082/api/regions/regions/selectqy',
            //     type: 'GET',
            //     dataType: 'JSON',
            //     success: function (res) {
            //         var result = res.data;
            //         $('.police-dispatching .police-container .police-container-patrol .main-content .select>ul>li>div:eq(0)').html(result[0].regionName + '<i></i>').attr('regionId', result[0].regionId);
            //         for (var i = 0; i < result.length; i++) {
            //             $('.police-dispatching .police-container .police-container-patrol .main-content .select-list ul').append($("<li regionId='" + result[i].regionId + "'>" + result[i].regionName + "</li>"))
            //         }
            //     }
            // })
            // that.getRouteInformation($('.police-dispatching .police-container .police-container-patrol .main-content>li:eq(1) .table .tbody tbody'), '');
            that.polygonFlag = false;
            that.entityPolygonAll.clear();
            that.modifyPolygon();
            // 切换时清除新增点线面数组中保存得数据,与清除地图上得实体
            that.polygonData = [];
            that.addPolygonEntitys.clear();
            that.treatmentIndex = null;
            that.tabIndex = 0;
            $('.police-dispatching-tab li:eq(0)').addClass('on').siblings().removeClass('on');
            $($('.police-container > div')[0]).stop().show().siblings().stop().hide();
            that.tabIndex = 1;
            that.patrolIndex = 1;
            $('.police-dispatching-tab li:eq(1)').addClass('on').siblings().removeClass('on');
            $($('.police-container > div')[1]).stop().show().siblings().stop().hide();
            $('.police-dispatching .police-container .distribute-district .select-list ul').empty();
            $('.police-dispatching .police-container .distribute-district .select-list ul').append("<li key='addvcd' addvcd=''>全部</li>");
            $.ajax({
                url: 'https://web.byisf.com/api/blade-jfpts/district/district/selectList',
                type: 'POST',
                url: 'http://61.131.136.25:2082/api/regions/regions/selectqy',
                type: 'GET',
                dataType: 'JSON',
                success: function (data) {
                    for (var i = 0; i < data.data.length; i++) {
                        $('.police-dispatching .police-container .distribute-district .select-list ul').append("<li key='addvcd' addvcd=" + data.data[i].addvcd + ">" + data.data[i].addvnm + "</li>");
                success: function(res) {
                    var result = res.data;
                    $('.police-dispatching .police-container .police-container-patrol .main-content .select>ul>li>div:eq(0)').html(result[0].regionName + '<i></i>').attr('regionId', result[0].regionId);
                    for (var i = 0; i < result.length; i++) {
                        $('.police-dispatching .police-container .police-container-patrol .main-content .select-list ul').append($("<li regionId='" + result[i].regionId + "'>" + result[i].regionName + "</li>"))
                    }
                }
            })
            that.getRouteInformation($('.police-dispatching .police-container .police-container-patrol .main-content>li:eq(1) .table .tbody tbody'), '');
            // $.ajax({
            //     url: 'http://61.131.136.25:2082/api/district/district/selectList',
            //     type: 'POST',
            //     dataType: 'JSON',
            //     success: function (data) {
            //         for (var i = 0; i < data.data.length; i++) {
            //             $('.police-dispatching .police-container .distribute-district .select-list ul').append("<li key='addvcd' addvcd=" + data.data[i].addvcd + ">" + data.data[i].addvnm + "</li>");
            //         }
            //     }
            // })
            layui.use('laydate', function () {
            layui.use('laydate', function() {
                that.layuiLadate = layui.laydate;
                //执行一个laydate实例 开始
                that.layuiLadate.render({
@@ -1147,7 +1445,7 @@
            $('.police-dispatching-tab li:eq(1)').trigger('click');
        },
        close: function () {
        close: function() {
            $("#tabcontainer").css("width", "66%");
            $('#mapcontentClass').removeClass('client-max-map'); //删除样式
@@ -1165,8 +1463,10 @@
            this.addPolygonEntitys.clear();
        },
        // 鼠标点击事件
        clickHand: function () {
        clickHand: function() {
            var self = this;
            var that = this;
            self._map.onClick = mapClick;
@@ -1190,6 +1490,7 @@
                    y: evt.screenPoint.y,
                });
                // debugger;
                if (self.tabIndex == 0) {
                    if (evt.graphic) {
@@ -1211,16 +1512,21 @@
                                return;
                            }
                        } else { // 不在编辑中
                            if (evt.graphic) { // 点击在图形上
                                // 保存当前点击得图形
                                // self.currentDrawing = evt.graphic;
                            if (that.isEdit) {
                                if (evt.graphic) { // 点击在图形上
                                    // 保存当前点击得图形
                                    // self.currentDrawing = evt.graphic;
                                self.modifyPolygon();
                                self.activateToolbar(evt.graphic);
                            } else { // 点击不在图形上
                                    self.modifyPolygon();
                                    self.activateToolbar(evt.graphic);
                                self.modifyPolygon()
                                } else { // 点击不在图形上
                                    self.modifyPolygon()
                                }
                            }
                        }
                    } else {
@@ -1288,7 +1594,7 @@
            // 提示信息
            $(document).off('mousemove').mousemove(function (e) {
            $(document).off('mousemove').mousemove(function(e) {
                var y = e.clientY + 10;
                var x = e.clientX + 20;
@@ -1340,10 +1646,10 @@
         *
         * @param {number} id 警情ID
         */
        policeDetails: function (id) {
        policeDetails: function(id) {
            var that = this;
            var url = './popup/html/police-details.html?obj=' + id;
            layui.use('layer', function () {
            layui.use('layer', function() {
                that.layuiLayer = layui.layer;
                that.layuiLayer.config({
                    extend: 'myskin/police-details.css'
@@ -1368,10 +1674,10 @@
         *
         * @param {number} id 警情ID
         */
        ownerDetails: function (id) {
        ownerDetails: function(id) {
            var that = this;
            var url = './popup/html/owner-details.html?id=' + id;
            layui.use('layer', function () {
            layui.use('layer', function() {
                that.layuiLayer = layui.layer;
                that.layuiLayer.config({
                    extend: 'myskin/owner-details.css'
@@ -1396,10 +1702,10 @@
         *
         * @param {number} id 设备ID
         */
        equipmentDetails: function (id) {
        equipmentDetails: function(id) {
            var that = this;
            var url = './popup/html/equipment-details.html?obj=' + id;
            layui.use('layer', function () {
            layui.use('layer', function() {
                that.layuiLayer = layui.layer;
                that.layuiLayer.config({
                    extend: 'myskin/equipment-details.css'
@@ -1461,11 +1767,11 @@
         * @param {string} endTime 结束时间
         * @param {*} waringType 警情的类别
         */
        getPoliceTable: function (dom, beginTime, endTime, waringType, addvcd, type) {
        getPoliceTable: function(dom, beginTime, endTime, waringType, addvcd, type) {
            dom.empty();
            var that = this;
            $.ajax({
                url: 'https://web.byisf.com/api/blade-jfpts/jingdan/jingdan/selectList',
                url: 'http://61.131.136.25:2082/api/jingdan/jingdan/selectList',
                type: 'POST',
                dataType: 'JSON',
                data: {
@@ -1475,7 +1781,7 @@
                    addvcd: addvcd,
                    type: type
                },
                success: function (data) {
                success: function(data) {
                    var result = data.data;
                    var str = '';
                    that.entitysData = [];
@@ -1522,19 +1828,19 @@
            })
        },
        // 获取区域信息列表
        patrolArea: function (dom, regionName) {
        patrolArea: function(dom, regionName) {
            dom.empty();
            var that = this;
            that.currentDrawing = [];
            that.entityPolygonAll.clear();
            $.ajax({
                url: 'https://web.byisf.com/api/blade-jfpts/regions/regions/selectList',
                url: 'http://61.131.136.25:2082/api/regions/regions/selectList',
                type: 'POST',
                dataType: 'JSON',
                data: {
                    regionName: regionName
                },
                success: function (data) {
                success: function(data) {
                    var result = data.data;
                    var str = '';
                    var entityArr = [];
@@ -1566,19 +1872,19 @@
            })
        },
        // 获取路线信息列表
        getRouteInformation: function (dom, routeName) {
        getRouteInformation: function(dom, routeName) {
            dom.empty();
            var that = this;
            that.currentDrawing = [];
            that.entityPolygonAll.clear();
            $.ajax({
                url: 'https://web.byisf.com/api/blade-jfpts/routeIn/routein/selectList',
                url: 'http://61.131.136.25:2082/api/routeIn/routein/selectList',
                type: 'POST',
                dataType: 'JSON',
                data: {
                    routeName: routeName
                },
                success: function (data) {
                success: function(data) {
                    var result = data.data;
                    var str = '';
                    var entityArr = [];
@@ -1600,7 +1906,7 @@
                        objId.routeName = result[i].routeName;
                        objId.remarks = result[i].remarks;
                        that.addPolygonAll(that.entityPolygonAll, entityArr, objId);
                        str += "<tr flyid=" + result[i].id + " flyname=" + result[i].routeName + "> <td>" + (Number(i) + 1) + "</td> <td>" + result[i].sname + "</td> <td>" + result[i].routeName + "</td> <td> <a href='javascript:;' title=" + result[i].rtime + ">" + result[i].rtime.substr(5, 11) + "</a></td> <td><input type='button' value='编辑'></td> </tr>";
                        str += "<tr flyid=" + result[i].id + " flyname=" + result[i].routeName + "> <td>" + (Number(i) + 1) + "</td> <td style='display: none;'>" + result[i].sname + "</td> <td>" + result[i].routeName + "</td> <td> <a href='javascript:;' title=" + result[i].rtime + ">" + result[i].rtime.substr(5, 11) + "</a></td> <td><input type='button' value='编辑'></td> </tr>";
                        dom.append(str);
                        str = '';
                    }
@@ -1608,16 +1914,16 @@
            })
        },
        // 获取保安人员信息列表
        getSecurityPeople: function (dom, deviceType) {
        getSecurityPeople: function(dom, deviceType) {
            dom.empty();
            var that = this;
            that.currentDrawing = [];
            that.entityPolygonAll.clear();
            $.ajax({
                url: 'https://web.byisf.com/api/blade-jfpts/security/security/selectList',
                url: 'http://61.131.136.25:2082/api/security/security/selectList',
                type: 'POST',
                dataType: 'JSON',
                success: function (data) {
                success: function(data) {
                    var result = data.data;
                    var str = '';
                    that.entitysData = [];
@@ -1668,11 +1974,13 @@
            })
        },
        // 创建实体图层
        createEntitys: function (entitys, entityContent, name, item, lgtd, lttd, outlineColors) {
        createEntitys: function(entitys, entityContent, name, item, lgtd, lttd, outlineColors) {
            var symbol = new esri.symbol.PictureMarkerSymbol(outlineColors, 26, 26);
            symbol.name = name;
            var pt = new Point(lgtd, lttd, new esri.SpatialReference({wkid: 4326}));
            var pt = new Point(lgtd, lttd, new esri.SpatialReference({
                wkid: 4326
            }));
            pt.entityData = item;
            var graphic = new esri.Graphic(pt, symbol);
            entitys.add(graphic);
@@ -1680,13 +1988,15 @@
            entityContent.push(item);
        },
        addPoint: function (entitys, lgtd, lttd) {
        addPoint: function(entitys, lgtd, lttd) {
            var symbol = new esri.symbol.PictureMarkerSymbol('./images/real-time-callPolice.png', 10, 10);
            var pt = new Point(lgtd, lttd, new SpatialReference({wkid: 4326}));
            var pt = new Point(lgtd, lttd, new SpatialReference({
                wkid: 4326
            }));
            var graphic = new esri.Graphic(pt, symbol);
            entitys.add(graphic);
        },
        addPolyline: function (entitys, path) {
        addPolyline: function(entitys, path) {
            entitys.clear();
            var polylineSymbol = new SimpleLineSymbol();
            polylineSymbol.color = [255, 0, 0, 1];
@@ -1700,7 +2010,7 @@
            entitys.add(new Graphic(polyline, polylineSymbol));
        },
        addPolygon: function (entitys, rings) {
        addPolygon: function(entitys, rings) {
            entitys.clear();
            var polygonSymbol = new SimpleFillSymbol();
            polygonSymbol.color = [24, 255, 243, 0.411];
@@ -1714,7 +2024,7 @@
            entitys.add(new Graphic(polygon, polygonSymbol));
        },
        activateToolbar: function (graphic) {
        activateToolbar: function(graphic) {
            var tool = 0;
            this.editToolbar = new Edit(this._map);
@@ -1745,7 +2055,7 @@
        },
        addPolygonAll: function (entitys, rings, objId) {
        addPolygonAll: function(entitys, rings, objId) {
            // entitys.clear();
            var graphic = null;
            if (this.patrolIndex == 1) {
@@ -1809,7 +2119,7 @@
            entitys.add(graphic);
        },
        modifyPolygon: function () {
        modifyPolygon: function() {
            var self = this;
            if (self.editToolbar != null) {
@@ -1845,7 +2155,7 @@
                    dataStr = dataStr.substring(0, dataStr.length - 1);
                    $.ajax({
                        url: 'https://web.byisf.com/api/blade-jfpts/routeIn/routein/updatelx',
                        url: 'http://61.131.136.25:2082/api/routeIn/routein/updatelx',
                        type: 'POST',
                        dataType: 'JSON',
                        data: {
@@ -1855,8 +2165,16 @@
                            routeInfo: dataStr,
                            remarks: polygon.graphic.objId.remarks,
                        },
                        success: function (result) {
                        success: function(result) {
                            if (result.code == 200) {
                                layui.use('layer', function() {
                                        layui.layer.msg('巡逻路线修改成功!');
                                    })
                                    //修改按钮颜色
                                $("#editEngineeringMap").css("color", "#757575");
                                // $("#securityMapTips4").css("display", "none");
                                self.isEdit = false;
                                self.editToolbarStatus = false;
                            }
                        }
@@ -1893,7 +2211,7 @@
                    dataStr = dataStr.substring(0, dataStr.length - 1);
                    $.ajax({
                        url: 'https://web.byisf.com/api/blade-jfpts/regions/regions/updateqy',
                        url: 'http://61.131.136.25:2082/api/regions/regions/updateqy',
                        type: 'POST',
                        dataType: 'JSON',
                        data: {
@@ -1903,7 +2221,7 @@
                            coordinate: dataStr,
                            remarks: polygon.graphic.objId.remarks
                        },
                        success: function (result) {
                        success: function(result) {
                            if (result.code == 200) {
                            }
@@ -1915,7 +2233,7 @@
            }
        },
        electronicFence: function () {
        electronicFence: function() {
            var self = this;
            if (self.editToolbar != null) {
                var polygon = self.editToolbar.getCurrentState();
@@ -1949,7 +2267,7 @@
                dataStr = dataStr.substring(0, dataStr.length - 1);
                $.ajax({
                    url: 'https://web.byisf.com/api/blade-jfpts/enclosure/enclosure/updatee',
                    url: 'http://61.131.136.25:2082/api/enclosure/enclosure/updatee',
                    type: 'POST',
                    dataType: 'JSON',
                    data: {
@@ -1958,7 +2276,7 @@
                        anumber: polygon.graphic.objId.anumber,
                        routeInfo: dataStr
                    },
                    success: function (result) {
                    success: function(result) {
                        if (result.code == 200) {
                        }
@@ -1968,7 +2286,7 @@
        },
        //聚合图层事件
        flareClusterLayer: function (datas) {
        flareClusterLayer: function(datas) {
            var that = this;
@@ -1981,7 +2299,9 @@
            //init the layer, more options are available and explained in the cluster layer constructor
            that.clusterLayer = new FlareClusterLayer({
                id: "flare-cluster-layer",
                spatialReference: new esri.SpatialReference({"wkid": 4326}),
                spatialReference: new esri.SpatialReference({
                    "wkid": 4326
                }),
                subTypeFlareProperty: "facilityType",
                singleFlareTooltipProperty: "name",
                displaySubTypeFlares: true,
@@ -1990,10 +2310,10 @@
                preClustered: preClustered,
                clusterRatio: 75,
                clusterAreaDisplay: areaDisplayMode,
                clusteringBegin: function () {
                clusteringBegin: function() {
                    console.log("clustering begin");
                },
                clusteringComplete: function () {
                clusteringComplete: function() {
                    console.log("clustering complete");
                }
            });
@@ -2015,10 +2335,21 @@
            //set up a popup template
            var template = new PopupTemplate({
                title: "{name}",
                fieldInfos: [
                    {fieldName: "facilityType", label: "Facility Type", visible: true},
                    {fieldName: "postcode", label: "Post Code", visible: true},
                    {fieldName: "isOpen", label: "Opening Hours", visible: true}
                fieldInfos: [{
                        fieldName: "facilityType",
                        label: "Facility Type",
                        visible: true
                    },
                    {
                        fieldName: "postcode",
                        label: "Post Code",
                        visible: true
                    },
                    {
                        fieldName: "isOpen",
                        label: "Opening Hours",
                        visible: true
                    }
                ]
            });
@@ -2031,8 +2362,8 @@
            that.clusterLayer.addData(datas);
        }
        , clearLayer: function () {
        },
        clearLayer: function() {
            var that = this;
            that._map.removeLayer(that.clusterLayer);
            that.clusterLayer = null;