var xmlDom; //原始数据
var ationSeaction, unoSeaction, nogreeSeaction, yellowSeaction, wuSeaction;
var VoiceationSeaction = {}; //关注车牌的布防和语音布防
var VoiceunoSeaction = {}; //未知车牌
var VoicenogreeSeaction = {}; //非绿色车牌
var VoiceyellowSeaction = {}; //黄色车牌
var VoicewuSeaction = {}; //无车牌
var broadTime, broadTimeVoice;
var recordlistData; //存放所有车牌库
var beforUse; //表示当前属于谁
var VoiceTimeplan; //声音告警布防时间
var ValueList = []; //存储结果
var noplateSenvity = 50;
var bcs = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'];
var _table = null;
var _tabled = null;
var libnayid = [];
$(document).ready(function() {
    // 下拉选项初始化
    $("#carlinceDefensePlan,#unolinceDefensePlan,#nogreelinceDefensePlan,#yellowlinceDefensePlan,#wulinceDefensePlan").select2({
        width: 360,
        minimumResultsForSearch: -1
    });
    $("#linceSoundType,#linceFrequencyBroadcast,#lincedeploymentTime,#lincelighttype").select2({
        width: 320,
        minimumResultsForSearch: -1
    });
    // 初始化时间选择
    broadTime = $("#Broadcast").TimePlan({
        sectionNum: 6
    });
    broadTimeVoice = $("#BroadcastVoice").TimePlan({
        sectionNum: 6
    });

    // 初始化声音类型
    soundType('linceSoundType', config.deviceCap[0].AudioAlarmType);
    // 播报次数
    var bc = $.i18n.prop("i18n-broadcast").split(",")
    for (var i = 0; i < bc.length; i++) {
        $("<option value='" + bcs[i] + "'>" + bc[i] + "</option>").appendTo("#linceFrequencyBroadcast");
    }
    // 灵敏度
    for (var i = 0; i < 101; i++) {
        $("<option value='" + i + "'>" + i + "</option>").appendTo("#wuseventiy");
    }
    changeTab();
    // 勾选显示隐藏对应车牌模块
    $("#look").change(function() {
        if ($(this).is(':checked')) {
            $(".gzlicen").show()
        } else {
            $(".gzlicen").hide()
        }
    });
    // 使能勾选
    $("#isShowlicense").change(function() {
        if($(this).is(':checked')){
            $("#navdiv").show();
            var qu = document.getElementById('carliand')
            var ld = document.getElementById('carmanagement')
            var ll = document.getElementById('license')
            qu.classList.add('qutable')
            ld.classList.remove('qutable')
            ll.classList.remove('qutable')
            $("#carliands").show()
            $("#carmanagements").hide()
            $("#licenses").hide()
            $("#Lingkslsave").hide()
        }else{
            $("#navdiv").hide();
            $("#carmanagements").hide();
            $("#carliands").hide();
            $("#licenses").hide();
            $("#Lingkslsave").show()
        }
    });
    $("#linceSoundType").change(function() {
        console.log($(this).val());
        linceCustomVoice($(this).val())
    })
    $("#Unknown").change(function() {
        if ($(this).is(':checked')) {
            $(".mslicen").show()
        } else {
            $(".mslicen").hide()
        }
    });
    $("#Nongreen").change(function() {
        if ($(this).is(':checked')) {
            $(".nlslicen").show()
        } else {
            $(".nlslicen").hide()
        }
    });
    $("#Yellow").change(function() {
        if ($(this).is(':checked')) {
            $(".hslicen").show()
        } else {
            $(".hslicen").hide()
        }
    });
    $("#noplate").change(function() {
        if ($(this).is(':checked')) {
            $(".wulicen").show()
            $("#wuseventiy").val(noplateSenvity);
            showlinceSentiy();
        } else {
            $(".wulicen").hide()
        }
    });
    // 关注声音报警勾选
    $("#lincAudiblealarm").change(function() {
        beforUse = 1;
        config.assistCommand="18";//自定义语音的次命令
        if ($(this).is(':checked')) {
            if (VoiceationSeaction.c) {
                $("#linceectiveBrightness").val(VoiceationSeaction.c)
            } else {
                $("#linceectiveBrightness").val(0)
            }
            $("#linceSoundType").val(VoiceationSeaction.a).trigger('change')
            $("#linceFrequencyBroadcast").val(VoiceationSeaction.b).trigger('change')
            $("#lincedeploymentTime").val(VoiceationSeaction.d).trigger('change')
            showlinceVoiceOut();
            $("#myModal").modal('show');
            $("#VoiceTip").show();
        } else {
            $("#VoiceTip").hide();
        }
    });
    // 关注灯光报警勾选
    $("#lincLightalarm").change(function() {
        beforUse = 1
        if ($(this).is(':checked')) {
            $("#myModalnight").modal('show');
            $("#lightTip").show();
        } else {
            $("#lightTip").hide();
        }
    });
    // 陌生声音报警勾选
    $("#unlincAudiblealarm").change(function() {
        beforUse = 2
        config.assistCommand="19";//自定义语音的次命令
        if ($(this).is(':checked')) {
            if (VoiceunoSeaction.c) {
                $("#linceectiveBrightness").val(VoiceunoSeaction.c)
            } else {
                $("#linceectiveBrightness").val(0)
            }
            $("#linceSoundType").val(VoiceunoSeaction.a).trigger('change')
            $("#linceFrequencyBroadcast").val(VoiceunoSeaction.b).trigger('change')
            $("#lincedeploymentTime").val(VoiceunoSeaction.d).trigger('change')
            showlinceVoiceOut();
            $("#myModal").modal('show');
            $("#unoVoiceTip").show();
        } else {
            $("#unoVoiceTip").hide();
        }
    });
    // 陌生灯光报警勾选
    $("#unlincLightalarm").change(function() {
        beforUse = 2
        if ($(this).is(':checked')) {
            $("#myModalnight").modal('show');
            $("#unolightTip").show();
        } else {
            $("#unolightTip").hide();
        }
    });
    // 非绿声音报警勾选
    $("#noglincAudiblealarm").change(function() {
        beforUse = 3;
        config.assistCommand="20";//自定义语音的次命令
        if ($(this).is(':checked')) {
            if (VoicenogreeSeaction.c) {
                $("#linceectiveBrightness").val(VoicenogreeSeaction.c)
            } else {
                $("#linceectiveBrightness").val(0)
            }
            $("#linceSoundType").val(VoicenogreeSeaction.a).trigger('change')
            $("#linceFrequencyBroadcast").val(VoicenogreeSeaction.b).trigger('change')
            $("#lincedeploymentTime").val(VoicenogreeSeaction.d).trigger('change')
            showlinceVoiceOut();
            $("#myModal").modal('show');
            $("#nogVoiceTip").show();
        } else {
            $("#nogVoiceTip").hide();
        }
    });
    // 非绿灯光报警勾选
    $("#noglincLightalarm").change(function() {
        beforUse = 3
        if ($(this).is(':checked')) {
            $("#myModalnight").modal('show');
            $("#noglightTip").show();
        } else {
            $("#noglightTip").hide();
        }
    });
    // 黄色声音报警勾选
    $("#yellincAudiblealarm").change(function() {
        beforUse = 4
        config.assistCommand="21";//自定义语音的次命令
        if ($(this).is(':checked')) {
            if (VoiceyellowSeaction.c) {
                $("#linceectiveBrightness").val(VoiceyellowSeaction.c)
            } else {
                $("#linceectiveBrightness").val(0)
            }
            $("#linceSoundType").val(VoiceyellowSeaction.a).trigger('change')
            $("#linceFrequencyBroadcast").val(VoiceyellowSeaction.b).trigger('change')
            $("#lincedeploymentTime").val(VoiceyellowSeaction.d).trigger('change')
            showlinceVoiceOut();
            $("#myModal").modal('show');
            $("#yelVoiceTip").show();
        } else {
            $("#yelVoiceTip").hide();
        }
    });
    // 黄色灯光报警勾选
    $("#yellincLightalarm").change(function() {
        beforUse = 4
        if ($(this).is(':checked')) {
            $("#myModalnight").modal('show');
            $("#yellightTip").show();
        } else {
            $("#yellightTip").hide();
        }
    });
    // 无车牌声音报警勾选
    $("#wulincAudiblealarm").change(function() {
        beforUse = 5
        config.assistCommand="22";//自定义语音的次命令
        if ($(this).is(':checked')) {
            if (VoicewuSeaction.c) {
                $("#linceectiveBrightness").val(VoicewuSeaction.c)
            } else {
                $("#linceectiveBrightness").val(0)
            }
            $("#linceSoundType").val(VoicewuSeaction.a).trigger('change')
            $("#linceFrequencyBroadcast").val(VoicewuSeaction.b).trigger('change')
            $("#lincedeploymentTime").val(VoicewuSeaction.d).trigger('change')
            showlinceVoiceOut();
            $("#myModal").modal('show');
            $("#wuVoiceTip").show();
        } else {
            $("#wuVoiceTip").hide();
        }
    });
    // 无车牌灯光报警勾选
    $("#wulincLightalarm").change(function() {
        beforUse = 4
        if ($(this).is(':checked')) {
            $("#myModalnight").modal('show');
            $("#yellightTip").show();
        } else {
            $("#yellightTip").hide();
        }
    });
    // 点击关注联动中的设置按钮
    $("#VoiceTip").click(function(event) {
        event.preventDefault();
        beforUse = 1
        config.assistCommand="18";//自定义语音的次命令
        $("#linceSoundType").val(VoiceationSeaction.a).trigger('change')
        $("#linceFrequencyBroadcast").val(VoiceationSeaction.b).trigger('change')
        $("#linceectiveBrightness").val(VoiceationSeaction.c)
        $("#lincedeploymentTime").val(VoiceationSeaction.d).trigger('change')
        $("#myModal").modal('show');
        showlinceVoiceOut();
        $("#linceectiveBrightness").jRange('setValue', $("#linceectiveBrightness").val());

    });
    // 点击陌生联动中的设置按钮
    $("#unoVoiceTip").click(function(event) {
        event.preventDefault();
        beforUse = 2;
        config.assistCommand="19";
        $("#linceSoundType").val(VoiceunoSeaction.a).trigger('change')
        $("#linceFrequencyBroadcast").val(VoiceunoSeaction.b).trigger('change')
        $("#linceectiveBrightness").val(VoiceunoSeaction.c)
        $("#lincedeploymentTime").val(VoiceunoSeaction.d).trigger('change')
        $("#myModal").modal('show');
        showlinceVoiceOut();
        $("#linceectiveBrightness").jRange('setValue', $("#linceectiveBrightness").val());
    });
    // 点击非绿联动中的设置按钮
    $("#nogVoiceTip").click(function(event) {
        event.preventDefault();
        beforUse = 3;
        config.assistCommand="20";
        $("#linceSoundType").val(VoicenogreeSeaction.a).trigger('change')
        $("#linceFrequencyBroadcast").val(VoicenogreeSeaction.b).trigger('change')
        $("#linceectiveBrightness").val(VoicenogreeSeaction.c)
        $("#lincedeploymentTime").val(VoicenogreeSeaction.d).trigger('change')
        $("#myModal").modal('show');
        showlinceVoiceOut();
        $("#linceectiveBrightness").jRange('setValue', $("#linceectiveBrightness").val());
    });
    // 点击黄色联动中的设置按钮
    $("#yelVoiceTip").click(function(event) {
        event.preventDefault();
        beforUse = 4;
        config.assistCommand="21";
        $("#linceSoundType").val(VoiceyellowSeaction.a).trigger('change')
        $("#linceFrequencyBroadcast").val(VoiceyellowSeaction.b).trigger('change')
        $("#linceectiveBrightness").val(VoiceyellowSeaction.c)
        $("#lincedeploymentTime").val(VoiceyellowSeaction.d).trigger('change')
        $("#myModal").modal('show');
        showlinceVoiceOut();
        $("#linceectiveBrightness").jRange('setValue', $("#linceectiveBrightness").val());
    });
    // 点击无车牌联动中的设置按钮
    $("#wuVoiceTip").click(function(event) {
        event.preventDefault();
        beforUse = 5;
        config.assistCommand="22";
        $("#linceSoundType").val(VoicewuSeaction.a).trigger('change')
        $("#linceFrequencyBroadcast").val(VoicewuSeaction.b).trigger('change')
        $("#linceectiveBrightness").val(VoicewuSeaction.c)
        $("#lincedeploymentTime").val(VoicewuSeaction.d).trigger('change')
        $("#myModal").modal('show');
        showlinceVoiceOut();
        $("#linceectiveBrightness").jRange('setValue', $("#linceectiveBrightness").val());
    });

    // 灯光报警点击
    $("#lightTip,#unolightTip,#noglincLightalarm,#yellincLightalarm").click(function(event) {
        event.stopPropagation();
        $("#myModalnight").modal('show');
    });
    // 关闭声音报警布防弹框
    $(".close").click(function() {
        $("#myModal").modal('hide');
    });
    // 点击声音告警中的保存按钮
    $("#voiceSave").click(function() {
        $("#myModal").modal('hide');
        var vtype = $("#linceSoundType").val(); //声音类型
        var fornumber = $("#linceFrequencyBroadcast").val(); //次数值
        var Voicedata = $("#linceectiveBrightness").val(); //音量
        var budetect = $("#lincedeploymentTime").val() //布防时间类型
        if (beforUse == 1) { //关注
            if(budetect==true){
                VoiceationSeaction.g  = takeZero(broadTimeVoice.getvalue());
            }else{
                VoiceationSeaction.g = VoiceationSeaction.g ;
            }
            VoiceationSeaction.a = vtype;
            VoiceationSeaction.b = fornumber;
            VoiceationSeaction.c = Voicedata;
            VoiceationSeaction.d = budetect;
        } else if (beforUse == 2) { //陌生
            if(budetect==true){
                VoiceunoSeaction.g = takeZero(broadTimeVoice.getvalue());
            }else{
                VoiceunoSeaction.g=VoiceunoSeaction.g;
            }
            VoiceunoSeaction.a = vtype;
            VoiceunoSeaction.b = fornumber;
            VoiceunoSeaction.c = Voicedata;
            VoiceunoSeaction.d = budetect;
        } else if (beforUse == 3) {
            if(budetect==true){
                VoicenogreeSeaction.g = takeZero(broadTimeVoice.getvalue());
            }else{
                VoicenogreeSeaction.g=VoicenogreeSeaction.g;
            }
            VoicenogreeSeaction.a = vtype;
            VoicenogreeSeaction.b = fornumber;
            VoicenogreeSeaction.c = Voicedata;
            VoicenogreeSeaction.d = budetect;
        } else if (beforUse == 4) {
            if(budetect==true){
                VoiceyellowSeaction.g = takeZero(broadTimeVoice.getvalue());
            }else{
                VoiceyellowSeaction.g=VoiceyellowSeaction.g;
            }
            VoiceyellowSeaction.a = vtype;
            VoiceyellowSeaction.b = fornumber;
            VoiceyellowSeaction.c = Voicedata;
            VoiceyellowSeaction.d = budetect;
        } else {
            if(budetect==true){
                VoicewuSeaction.g = takeZero(broadTimeVoice.getvalue());
            }else{
                VoicewuSeaction.g=VoicewuSeaction.g;
            }
            VoicewuSeaction.g = takeZero(broadTimeVoice.getvalue());
            VoicewuSeaction.a = vtype;
            VoicewuSeaction.b = fornumber;
            VoicewuSeaction.c = Voicedata;
            VoicewuSeaction.d = budetect;
        }
    });
    // 声音报警中的时间布防切换
    $("#lincedeploymentTime").change(function() {
        if ($(this).val() == 'false') {
            $(".domds").show()
        } else {
            $(".domds").hide()
        }
    });
    $(".domds").click(function() {
        $("#myModal").modal('hide');
        $("#myModalVoicetime").modal('show');
        if (beforUse == 1) { //关注
            if (VoiceationSeaction.g.length == 7 || VoiceationSeaction.g.length == 8) {
                var arr = [];
                arr.push(VoiceationSeaction.g[6])
                for (var i = 0; i < 6; i++) {
                    arr.push(VoiceationSeaction.g[i])
                }
                VoiceationSeaction.g = changeTypefortime(arr)
            }
            broadTimeVoice.setValue(changetimeFool(group(VoiceationSeaction.g, 24)));
        } else if (beforUse == 2) { //陌生
            if (VoiceunoSeaction.g.length == 7 || VoiceunoSeaction.g.length == 8) {
                var arr = [];
                arr.push(VoiceunoSeaction.g[6])
                for (var i = 0; i < 6; i++) {
                    arr.push(VoiceunoSeaction.g[i])
                }
                VoiceunoSeaction.g = changeTypefortime(arr)
            }
            broadTimeVoice.setValue(changetimeFool(group(VoiceunoSeaction.g, 24)));
        } else if (beforUse == 3) { //非绿
            if (VoicenogreeSeaction.g.length == 7 || VoicenogreeSeaction.g.length == 8) {
                var arr = [];
                arr.push(VoicenogreeSeaction.g[6])
                for (var i = 0; i < 6; i++) {
                    arr.push(VoicenogreeSeaction.g[i])
                }
                VoicenogreeSeaction.g = changeTypefortime(arr)
            }
            broadTimeVoice.setValue(changetimeFool(group(VoicenogreeSeaction.g, 24)));
        } else if (beforUse == 4) {
            if (VoiceyellowSeaction.g.length == 7 || VoiceyellowSeaction.g.length == 8) {
                var arr = [];
                arr.push(VoiceyellowSeaction.g[6])
                for (var i = 0; i < 6; i++) {
                    arr.push(VoiceyellowSeaction.g[i])
                }
                VoiceyellowSeaction.g = changeTypefortime(arr)
            }
            broadTimeVoice.setValue(changetimeFool(group(VoiceyellowSeaction.g, 24)));
        } else {
            if (VoicewuSeaction.g.length == 7 || VoicewuSeaction.g.length == 8) {
                var arr = [];
                arr.push(VoicewuSeaction.g[6])
                for (var i = 0; i < 6; i++) {
                    arr.push(VoicewuSeaction.g[i])
                }
                VoicewuSeaction.g = changeTypefortime(arr)
            }
            broadTimeVoice.setValue(changetimeFool(group(VoicewuSeaction.g, 24)));
        }

    });
    // 点击声音布防时间弹框的关闭
    $(".Voiceclose").click(function() {
        $("#myModalVoicetime").modal('hide');
        $("#myModal").modal('show');
    });
    //点击声音布防时间弹框的确认
    $("#PTSave").click(function() {
        $("#myModalVoicetime").modal('hide');
        VoiceTimeplan = takeZero(broadTimeVoice.getvalue());
        if (beforUse == 1) {
            VoiceationSeaction.g = VoiceTimeplan;
        } else if (beforUse == 2) {
            VoiceunoSeaction.g = VoiceTimeplan;
        } else if (beforUse == 3) {
            VoicenogreeSeaction.g = VoiceTimeplan;
        } else if (beforUse == 4) {
            VoiceyellowSeaction.g = VoiceTimeplan;
        } else {
            VoicewuSeaction.g = VoiceTimeplan;
        }
        $("#myModal").modal('show');

    });

    // 关注普通布防
    $("#carlinceDefensePlan").change(function() {
        if ($(this).val() == 'false') {
            $("#showModel").show()
        } else {
            $("#showModel").hide()
        }
    });
    // 陌生普通布防
    $("#unolinceDefensePlan").change(function() {
        if ($(this).val() == 'false') {
            $("#unoshowModel").show()
        } else {
            $("#unoshowModel").hide()
        }
    });
    // 非绿普通布防
    $("#nogreelinceDefensePlan").change(function() {
        if ($(this).val() == 'false') {
            $("#nogreeshowModel").show()
        } else {
            $("#nogreeshowModel").hide()
        }
    });
    // 黄色普通布防
    $("#yellowlinceDefensePlan").change(function() {
        if ($(this).val() == 'false') {
            $("#yellowshowModel").show()
        } else {
            $("#yellowshowModel").hide()
        }
    });
    // 无车牌普通布防
    $("#wulinceDefensePlan").change(function() {
        if ($(this).val() == 'false') {
            $("#wushowModel").show()
        } else {
            $("#wushowModel").hide()
        }
    });
    $("#showModel").click(function() {
        beforUse = 1
        $("#myModaltime").modal('show');
        if (ationSeaction.length == 7 || ationSeaction.length == 8) {
            var arr = [];
            arr.push(ationSeaction[6])
            for (var i = 0; i < 6; i++) {
                arr.push(ationSeaction[i])
            }
            ationSeaction = changeTypefortime(arr)
        }
        broadTime.setValue(changetimeFool(group(ationSeaction, 24)));
    });
    $("#unoshowModel").click(function() {
        beforUse = 2
        $("#myModaltime").modal('show');
        if (unoSeaction.length == 7 || unoSeaction.length == 8) {
            var arr = [];
            arr.push(unoSeaction[6])
            for (var i = 0; i < 6; i++) {
                arr.push(unoSeaction[i])
            }
            unoSeaction = changeTypefortime(arr)
        }
        broadTime.setValue(changetimeFool(group(unoSeaction, 24)));
    });
    $("#nogreeshowModel").click(function() {
        beforUse = 3
        $("#myModaltime").modal('show');
        if (nogreeSeaction.length == 7 || nogreeSeaction.length == 8) {
            var arr = [];
            arr.push(nogreeSeaction[6])
            for (var i = 0; i < 6; i++) {
                arr.push(nogreeSeaction[i])
            }
            nogreeSeaction = changeTypefortime(arr)
        }
        broadTime.setValue(changetimeFool(group(nogreeSeaction, 24)));
    });
    $("#yellowshowModel").click(function() {
        beforUse = 4
        $("#myModaltime").modal('show');
        if (yellowSeaction.length == 7 || yellowSeaction.length == 8) {
            var arr = [];
            arr.push(yellowSeaction[6])
            for (var i = 0; i < 6; i++) {
                arr.push(yellowSeaction[i])
            }
            yellowSeaction = changeTypefortime(arr)
        }
        broadTime.setValue(changetimeFool(group(yellowSeaction, 24)));
    });
    $("#wushowModel").click(function() {
        beforUse = 5
        $("#myModaltime").modal('show');
        if (wuSeaction.length == 7 || wuSeaction.length == 8) {
            var arr = [];
            arr.push(wuSeaction[6])
            for (var i = 0; i < 6; i++) {
                arr.push(wuSeaction[i])
            }
            wuSeaction = changeTypefortime(arr)
        }
        broadTime.setValue(changetimeFool(group(wuSeaction, 24)));
    });

    // 普通布防点击确认
    $("#timeSave").click(function() {
        if (beforUse == 1) {
            ationSeaction = takeZero(broadTime.getvalue());
        } else if (beforUse == 2) {
            unoSeaction = takeZero(broadTime.getvalue());
        } else if (beforUse == 3) {
            nogreeSeaction = takeZero(broadTime.getvalue());
        } else if (beforUse == 4) {
            yellowSeaction = takeZero(broadTime.getvalue());
        } else {
            wuSeaction = takeZero(broadTime.getvalue());
        }
        $("#myModaltime").modal('hide');
    });
    // 主页面的保存按钮
    $("#lincenSave,#Lingkslsave").click(function() {
        if ("admin" == config.user || "super_admin" == config.user) {
            IsNeedReboot = false;
            if ($("#isShowlicense").is(':checked') && config.deviceCap[0].lateFlag == "true") {
                rebootObj = needReboot(14);
                IsNeedReboot = rebootObj.isReBoot;
                if (rebootObj.isReBoot == 'true') {
                    var isUpplementary = rebootObj.hasOwnProperty('isUpplementary') ? rebootObj.isUpplementary : 0;
                    $.RestartModel.mask(setlincensCheck, isUpplementary);
                    return;
                }
            }
            setlincensCheck();
        } else {
            $.optionBootoast($.i18n.prop('i18n-propoe'), "danger");
        }
    });
    // 点击车牌布控
    $("#carliand").click(function() {
        changeTab();
    });
    // 点击车牌库
    $("#carmanagement").click(function() {
        LinceGroupsQueryAll();
        var pz = document.getElementById('carliand')
        var pk = document.getElementById('carmanagement')
        var cp = document.getElementById('license')
        pk.classList.add('qutable')
        cp.classList.remove('qutable')
        pz.classList.remove('qutable')
        $("#carmanagements").show()
        $("#carliands").hide()
        $("#licenses").hide()
        getFacesManagement();
    });
    // 点击车牌管理
    $("#license").click(function() {
        LinceGroupsQueryAll();
        var pz = document.getElementById('carliand')
        var pk = document.getElementById('carmanagement')
        var cp = document.getElementById('license')
        cp.classList.add('qutable')
        pk.classList.remove('qutable')
        pz.classList.remove('qutable')
        $("#carmanagements").hide()
        $("#carliands").hide()
        $("#licenses").show()
    });
    // 点击试听
    $("#lincenbtn").click(function() {
        if (beforUse == 1) {
            setTryvoice('AttentionLicensePlateAudioType', $("#linceSoundType").val(), "", "", "", "")
        } else if (beforUse == 2) {
            setTryvoice('StrangeLicensePlateAudioType', "", $("#linceSoundType").val(), "", "", "")
        } else if (beforUse == 3) {
            setTryvoice('NonGreenLicensePlateAudioType', "", "", $("#linceSoundType").val(), "", "")
        } else if (beforUse == 4) {
            setTryvoice('YellowLicensePlateAudioType', "", "", "", $("#linceSoundType").val(), "")
        } else {
            setTryvoice('NoLicensePlateAudioType', "", "", "", "", $("#linceSoundType").val())
        }
    });
    // 灯光保存
    $("#lightSave").click(function() {
        setlightmode();
        $("#myModalnight").modal('hide');
    });
    // 点击查询车牌
    $("#lincenSerch").click(function() {
        if (!_table) { //实例不存在就渲染
            dataTableDraws('#lincebumberTable');
        } else {
            $('#lincebumberTable').dataTable().fnDraw();
        }
    })

});

function linceCustomVoice(val) {
    if(val==="custom"&&config.deviceCap[0].enableG711U == "true"){//自定义
        if( document.getElementById('linceDefeVoice').childNodes.length > 0){//已经植入html，直接show
            $("#linceDefeVoice").empty();
            loadVoiceURL("ipc/pages/customSound.html",$("#linceDefeVoice"),config.assistCommand)
        }else{ //没有植入,获取一下再去show
            loadVoiceURL("ipc/pages/customSound.html",$("#linceDefeVoice"),config.assistCommand)
        }
    }else{
        $("#linceDefeVoice").hide();  //非自定义声音直接隐藏
    }
}
// 时间布防类型转换
function changeTypefortime(d) {
    var arr = []
    for (var i = 0; i < d.length; i++) {
        for (var q = 0; q < 24; q++) {
            if (d[i].charAt(2 * q) == 1) {
                arr.push(1)
            } else {
                arr.push(0)
            }
        }
    }
    return arr
}
// 默认点击车牌布控配置
function changeTab() {
    var qu = document.getElementById('carliand')
    var ld = document.getElementById('carmanagement')
    var ll = document.getElementById('license')
    qu.classList.add('qutable')
    ld.classList.remove('qutable')
    ll.classList.remove('qutable')
    $("#carliands").show()
    $("#carmanagements").hide()
    $("#licenses").hide()
    getlincensCheck();
    getlightmode();

}
// 灯光报警配置获取
function getlightmode() {
    $.ajax({
        url: window.config.baseUrl + "/Alarm/1/LightWarning",
        type: "GET",
        async: false,
        timeout: 15000,
        beforeSend: function(xhr) {
            xhr.setRequestHeader("If-Modified-Since", "0");
        },
        success: function(xmlDoc, textStatus, xhr) {
            $("#lincelighttype").select2("val", $(xmlDoc).find("LightMode").text());
            $("#linceenoughtime").val($(xmlDoc).find("DelayTime").text());
        },
        error: function(xhr, textStatus, errorThrown) {}
    });
}
// 保存灯光报警
function setlightmode() {
    var LightMode = $("#lincelighttype").select2("val");
    var delaytime = $("#linceenoughtime").val();
    if (beforUse == 1) {
        var Enable = $("#lincLightalarm").is(':checked');
    }
    var r = /^([1-9]|[1-5][0-9]|60)$/;
    if (!r.test(delaytime)) {
        bootoast({
            message: $.i18n.prop('18n-delay-tip'),
            type: 'danger',
            position: 'bottom-center',
            timeout: true,
            animationDuration: 3000,
            dismissable: true
        });
        return;
    }
    var cyXml = "<?xml version='1.0' encoding='UTF-8' ?><LightWarning><Enable>" + Enable + "</Enable><LightMode>" + LightMode + "</LightMode><DelayTime>" + delaytime + "</DelayTime></LightWarning>"
    $.ajax({
        type: "PUT",
        url: window.config.baseUrl + "/Alarm/1/LightWarning",
        async: false,
        processData: false,
        data: cyXml,
        beforeSend: function(xhr) {
            xhr.setRequestHeader("If-Modified-Since", "0");
        },
        complete: function(xhr, textStatus) {
            SaveState(xhr);
        }
    });

}
// 渲染音量条
function showlinceVoiceOut() {
    // 渲染进度条
    $('#linceectiveBrightness').jRange({
        from: 0,
        to: 100,
        // step: 1,
        scale: 1,
        format: '%s',
        width: 260,
        showLabels: false,
        showScale: false,
        onstatechange: function() {
            $("#linceectiveBrightnessValue").text($("#linceectiveBrightness").val());
        },
        onSetPosition: function() {
            $("#linceectiveBrightnessValue").text($("#linceectiveBrightness").val());
        },
        onMouseDown: function() {},
        onMouseUp: function() {}
    });
}
// 渲染灵敏度
function showlinceSentiy() {
    // 渲染进度条
    $('#wuseventiy').jRange({
        from: 0,
        to: 100,
        // step: 1,
        scale: 1,
        format: '%s',
        width: 260,
        showLabels: false,
        showScale: false,
        onstatechange: function() {
            $("#wuseventiyValue").text($("#wuseventiy").val());
        },
        onSetPosition: function() {
            $("#wuseventiyValue").text($("#wuseventiy").val());
        },
        onMouseDown: function() {},
        onMouseUp: function() {}
    });
}
// 获取车牌布控配置
function getlincensCheck() {
    $.ajax({
        url: window.config.baseUrl + "/System/LicensePlateSurveillanceUIDesignCfg",
        type: "GET",
        async: false,
        timeout: 15000,
        beforeSend: function(xhr) {
            xhr.setRequestHeader("If-Modified-Since", "0");
        },
        success: function(xmlDoc, textStatus, xhr) {
            xmlDom = xmlDoc
            var showCheck=JSON.parse($(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('Enable').eq(0).text())
            $("#isShowlicense").prop('checked', showCheck); //使能
            if(showCheck==false){
            $("#navdiv").hide();
            $("#carmanagements").hide();
            $("#carliands").hide();
            $("#licenses").hide();
            $("#Lingkslsave").show()
            }
            var checkBo = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('LicensePlateSuveillanceType').eq(0).text();
            if (checkBo == 0) { //当全部没有被选择的时候
                $("#look").prop('checked', false);
                $(".gzlicen").hide();
                $("#Unknown").prop('checked', false);
                $(".mslicen").hide();
                $("#Nongreen").prop('checked', false);
                $(".nlslicen").hide();
                $("#Yellow").prop('checked', false);
                $(".hslicen").hide();
                $("#noplate").prop('checked', false);
                $(".wulicen").hide();
            } else {
                var BinaryNumber = decimalToBinary(checkBo - 0);
                var ValueArr = getDigits(BinaryNumber);
                if (ValueArr[ValueArr.length - 1] == 1) {
                    $("#look").prop('checked', true);
                    $(".gzlicen").show();
                } else {
                    $("#look").prop('checked', false);
                    $(".gzlicen").hide();
                }
                if (ValueArr.length == 2 || ValueArr.length > 2) {
                    if (ValueArr[ValueArr.length - 2] == 1) {
                        $("#Unknown").prop('checked', true);
                        $(".mslicen").show();
                    } else {
                        $("#Unknown").prop('checked', false);
                        $(".mslicen").hide();
                    }
                }
                if (ValueArr.length == 3 || ValueArr.length > 3) {
                    if (ValueArr[ValueArr.length - 3] == 1) {
                        $("#Nongreen").prop('checked', true);
                        $(".nlslicen").show();
                    } else {
                        $("#Nongreen").prop('checked', false);
                        $(".nlslicen").hide();
                    }
                }
                if (ValueArr.length == 4 || ValueArr.length > 4) {
                    if (ValueArr[ValueArr.length - 4] == 1) {
                        $("#Yellow").prop('checked', true);
                        $(".hslicen").show();
                    } else {
                        $("#Yellow").prop('checked', false);
                        $(".hslicen").hide();
                    }
                }
                if (ValueArr.length == 5 || ValueArr.length > 5) {
                    if (ValueArr[ValueArr.length - 5] == 1) {
                        $("#noplate").prop('checked', true);
                        $(".wulicen").show();
                    } else {
                        $("#noplate").prop('checked', false);
                        $(".wulicen").hide();
                    }
                }
            }
            // 对应rulecfg的个数
            var rulenum = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfgList').eq(0).find('VoiceAlarm').length;
            if (rulenum < 6) {
                for (var i = 0; i < rulenum; i++) {
                    var cfgType = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfgList').eq(0).find('RuleCfg').eq(i).find('SuveillanceType').text();
                    if (cfgType == 'attentionLicensePlate') { //关注
                        $('#carlinceDefensePlan').val($(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('Schedule').find('AllDay').text()).trigger('change');
                        if ($("#carlinceDefensePlan").val() == 'false') {
                            $("#showModel").show();
                        }
                        $("#lincTriggerSDcapture").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find('Snapshot').find("Enable").text())); //触发sd卡抓图
                        $("#lincTriggerSDrecording").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find('Record').find("Enable").text())); //触发sd卡录像
                        $("#lincAudiblealarm").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find('BeepAlert').find('Enable').text())); //触发声音报警
                        $("#lincLightalarm").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find('LightAlarm').find('Enable').text())); //灯光报警
                        $("#lincalarmoutput").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find('AlarmOut').eq(0).find('Enable').text())); //触发报警输出
                        $("#lincTriggerFTP").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find("Ftp").find("Enable").text())); //触发FTP
                        $("#lincTriggerpush").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find("Push").find("Enable").text())); //触发推送
                        if ($("#lincAudiblealarm").is(':checked')) {
                            $("#VoiceTip").show();
                        }
                        if ($("#lincLightalarm").is(':checked')) {
                            $("#lightTip").show();
                        }
                        ationSeaction = getScheduleXp(xmlDoc, i, true);
                        VoiceationSeaction.a = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('VoiceType').text(); //声音类型
                        VoiceationSeaction.b = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('BroadcastCount').text(); //声音次数
                        VoiceationSeaction.c = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('BroadcastVolume').text(); //音量
                        if ($(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('DayMode').text() == 'disable') {
                            VoiceationSeaction.d = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('AllDay').text();
                        } else {
                            VoiceationSeaction.d = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('DayMode').text();
                        }
                        VoiceationSeaction.g = getScheduleXp(xmlDoc, i, false);
                    } else if (cfgType == 'strangeLicensePlate') { //陌生
                        $('#unolinceDefensePlan').val($(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('Schedule').find('AllDay').text()).trigger('change');
                        if ($("#unolinceDefensePlan").val() == 'false') {
                            $("#unoshowModel").show();
                        }
                        $("#unlincTriggerSDcapture").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find('Snapshot').find("Enable").text())); //触发sd卡抓图
                        $("#unlincTriggerSDrecording").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find('Record').find("Enable").text())); //触发sd卡录像
                        $("#unlincAudiblealarm").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find('BeepAlert').find('Enable').text())); //触发声音报警
                        $("#unlincLightalarm").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find('LightAlarm').find('Enable').text())); //灯光报警
                        $("#unlincalarmoutput").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find('AlarmOut').eq(0).find('Enable').text())); //触发报警输出
                        $("#unlincTriggerFTP").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find("Ftp").find("Enable").text())); //触发FTP
                        $("#unlincTriggerpush").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find("Push").find("Enable").text())); //触发推送
                        if ($("#unlincAudiblealarm").is(':checked')) {
                            $("#unoVoiceTip").show();
                        }
                        if ($("#unlincLightalarm").is(':checked')) {
                            $("#unolightTip").show();
                        }
                        unoSeaction = getScheduleXp(xmlDoc, i, true);
                        VoiceunoSeaction.a = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('VoiceType').text(); //声音类型
                        VoiceunoSeaction.b = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('BroadcastCount').text(); //声音次数
                        VoiceunoSeaction.c = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('BroadcastVolume').text(); //音量
                        if ($(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('DayMode').text() == 'disable') {
                            VoiceunoSeaction.d = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('AllDay').text();
                        } else {
                            VoiceunoSeaction.d = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('DayMode').text();
                        }
                        VoiceunoSeaction.g = getScheduleXp(xmlDoc, i, false);

                    } else if (cfgType == 'nonGreenLicensePlate') { //非绿
                        $('#nogreelinceDefensePlan').val($(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('Schedule').find('AllDay').text()).trigger('change');
                        if ($("#nogreelinceDefensePlan").val() == 'false') {
                            $("#nogreeshowModel").show();
                        }
                        $("#noglincTriggerSDcapture").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find('Snapshot').find("Enable").text())); //触发sd卡抓图
                        $("#noglincTriggerSDrecording").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find('Record').find("Enable").text())); //触发sd卡录像
                        $("#noglincAudiblealarm").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find('BeepAlert').find('Enable').text())); //触发声音报警
                        $("#noglincLightalarm").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find('LightAlarm').find('Enable').text())); //灯光报警
                        $("#noglincalarmoutput").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find('AlarmOut').eq(0).find('Enable').text())); //触发报警输出
                        $("#noglincTriggerFTP").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find("Ftp").find("Enable").text())); //触发FTP
                        $("#noglincTriggerpush").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find("Push").find("Enable").text())); //触发推送
                        if ($("#noglincAudiblealarm").is(':checked')) {
                            $("#nogVoiceTip").show();
                        }
                        if ($("#noglincLightalarm").is(':checked')) {
                            $("#noglightTip").show();
                        }
                        nogreeSeaction = getScheduleXp(xmlDoc, i, true);
                        VoicenogreeSeaction.a = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('VoiceType').text(); //声音类型
                        VoicenogreeSeaction.b = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('BroadcastCount').text(); //声音次数
                        VoicenogreeSeaction.c = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('BroadcastVolume').text(); //音量
                        if ($(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('DayMode').text() == 'disable') {
                            VoicenogreeSeaction.d = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('AllDay').text();
                        } else {
                            VoicenogreeSeaction.d = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('DayMode').text();
                        }
                        VoicenogreeSeaction.g = getScheduleXp(xmlDoc, i, false);

                    } else if (cfgType == 'yellowLicensePlate') { //黄色
                        $('#yellowlinceDefensePlan').val($(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('Schedule').find('AllDay').text()).trigger('change');
                        if ($("#yellowlinceDefensePlan").val() == 'false') {
                            $("#yellowshowModel").show();
                        }

                        $("#yellincTriggerSDcapture").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find('Snapshot').find("Enable").text())); //触发sd卡抓图
                        $("#yellincTriggerSDrecording").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find('Record').find("Enable").text())); //触发sd卡录像
                        $("#yellincAudiblealarm").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find('BeepAlert').find('Enable').text())); //触发声音报警
                        $("#yellincLightalarm").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find('LightAlarm').find('Enable').text())); //灯光报警
                        $("#yellincalarmoutput").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find('AlarmOut').eq(0).find('Enable').text())); //触发报警输出
                        $("#yellincTriggerFTP").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find("Ftp").find("Enable").text())); //触发FTP
                        $("#yellincTriggerpush").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find("Push").find("Enable").text())); //触发推送
                        if ($("#yellincAudiblealarm").is(':checked')) {
                            $("#yelVoiceTip").show();
                        }
                        if ($("#yellincLightalarm").is(':checked')) {
                            $("#yellightTip").show();
                        }
                        yellowSeaction = getScheduleXp(xmlDoc, i, true);
                        VoiceyellowSeaction.a = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('VoiceType').text(); //声音类型
                        VoiceyellowSeaction.b = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('BroadcastCount').text(); //声音次数
                        VoiceyellowSeaction.c = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('BroadcastVolume').text(); //音量
                        if ($(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('DayMode').text() == 'disable') {
                            VoiceyellowSeaction.d = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('AllDay').text();
                        } else {
                            VoiceyellowSeaction.d = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('DayMode').text();
                        }
                        VoiceyellowSeaction.g = getScheduleXp(xmlDoc, i, false);
                    } else { //无车牌
                        $('#wulinceDefensePlan').val($(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('Schedule').find('AllDay').text()).trigger('change');
                        if ($("#wulinceDefensePlan").val() == 'false') {
                            $("#wushowModel").show();
                        }
                        noplateSenvity = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfgList').eq(0).find('RuleCfg').eq(i).find('Sensitivity').text()
                        if ($("#noplate").is(":checked")) {
                            $("#wuseventiy").val(noplateSenvity);
                            showlinceSentiy();
                        }
                        $("#wulincTriggerSDcapture").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find('Snapshot').find("Enable").text())); //触发sd卡抓图
                        $("#wulincTriggerSDrecording").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find('Record').find("Enable").text())); //触发sd卡录像
                        $("#wulincAudiblealarm").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find('BeepAlert').find('Enable').text())); //触发声音报警
                        $("#wulincalarmoutput").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find('AlarmOut').eq(0).find('Enable').text())); //触发报警输出
                        $("#wulincTriggerFTP").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find("Ftp").find("Enable").text())); //触发FTP
                        $("#wulincTriggerpush").prop('checked', JSON.parse($(xmlDoc).find('RuleCfg').eq(i).find('Trigger').find("Push").find("Enable").text())); //触发推送
                        if ($("#wulincAudiblealarm").is(':checked')) {
                            $("#wuVoiceTip").show();
                        }
                        // if ($("#yellincLightalarm").is(':checked')) {
                        //     $("#yellightTip").show();
                        // }
                        wuSeaction = getScheduleXp(xmlDoc, i, true);
                        VoicewuSeaction.a = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('VoiceType').text(); //声音类型
                        VoicewuSeaction.b = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('BroadcastCount').text(); //声音次数
                        VoicewuSeaction.c = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('BroadcastVolume').text(); //音量
                        if ($(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('DayMode').text() == 'disable') {
                            VoicewuSeaction.d = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('AllDay').text();
                        } else {
                            VoicewuSeaction.d = $(xmlDoc).find('LicensePlateSurveillanceUIDesignCfg').eq(0).find('RuleCfg').eq(i).find('VoiceAlarm').find('DayMode').text();
                        }
                        VoicewuSeaction.g = getScheduleXp(xmlDoc, i, false);
                    }
                }

            }
        },
        error: function(xhr, textStatus, errorThrown) {

        }
    });
}
// 获取普通布防区域
function getScheduleXp(d, n, type) {
    // 转换xml中的时间
    var timeArr = [];
    var time = [];
    if (type) { //普通布防
        for (var i = 0; i < 7; i++) {
            timeArr[i] = $(d).find('RuleCfg').eq(n).find('Schedule').find('TimeBlock_' + i).eq(0).text()
            for (var o = 0; o < 24; o++) {
                if (timeArr[i].charAt(2 * o) == 1) {
                    time.push(1)
                } else {
                    time.push(0)
                }
            }
        }

    } else { //语音布防
        for (var i = 0; i < 7; i++) {
            timeArr[i] = $(d).find('RuleCfg').eq(n).find('VoiceAlarm').find('TimeBlock_' + i).eq(0).text()
            for (var o = 0; o < 24; o++) {
                if (timeArr[i].charAt(2 * o) == 1) {
                    time.push(1)
                } else {
                    time.push(0)
                }
            }
        }

    }
    return time
}
// 设置车牌布控配置
function setlincensCheck() {
    var lastNumber = 0;
    // 处理关注车牌
    var isAtion = $("#look").is(':checked');
    var isAtionXml = '';
    if (isAtion) {
        if (ationSeaction.length == 168) {
            ationSeaction = keppTime(group(ationSeaction, 24))
        }
        if (VoiceationSeaction.g.length == 168) {
            VoiceationSeaction.g = keppTime(group(VoiceationSeaction.g, 24))
        }
        lastNumber = setBit(lastNumber, 0);
        // 普通布防获取值
        var d, t
        d = $("#carlinceDefensePlan").val()
        if (d == "false") {
            d = "false"
            t = "disable"
        } else if (d == "true") {
            d = "true"
            t = "disable"
        }
        // 声音布防获取值
        var dv, tv
        dv = VoiceationSeaction.d
        if (dv == "false") {
            dv = "false"
            tv = "disable"
        } else if (dv == "true") {
            dv = "true"
            tv = "disable"
        } else if (dv == "evening") {
            dv = "true"
            tv = "evening"
        } else {
            dv = "true"
            tv = "day"
        }
        isAtionXml += '<SuveillanceType>attentionLicensePlate</SuveillanceType><VoiceAlarm><Enable>' + $('#lincAudiblealarm').is(':checked') + '</Enable>' +
            '<VoiceType>' + VoiceationSeaction.a + '</VoiceType><BroadcastCount>' + VoiceationSeaction.b + '</BroadcastCount><BroadcastVolume>' + VoiceationSeaction.c + '</BroadcastVolume>' +
            '<VoiceAlarmSchedule Version="1.0"><DayMode>' + tv + '</DayMode>' +
            '<AllDay>' + dv + '</AllDay><TimeBlockList Version="1.0">' +
            '<TimeBlock_0>' + (VoiceationSeaction.g)[6] + '</TimeBlock_0>' +
            '<TimeBlock_1>' + (VoiceationSeaction.g)[0] + '</TimeBlock_1>' +
            '<TimeBlock_2>' + (VoiceationSeaction.g)[1] + '</TimeBlock_2>' +
            '<TimeBlock_3>' + (VoiceationSeaction.g)[2] + '</TimeBlock_3>' +
            '<TimeBlock_4>' + (VoiceationSeaction.g)[3] + '</TimeBlock_4>' +
            '<TimeBlock_5>' + (VoiceationSeaction.g)[4] + '</TimeBlock_5>' +
            '<TimeBlock_6>' + (VoiceationSeaction.g)[5] + '</TimeBlock_6>' +
            '</TimeBlockList></VoiceAlarmSchedule></VoiceAlarm>' +
            '<Schedule Version="1.0"><DayMode>' + t + '</DayMode>' +
            '<AllDay>' + d + '</AllDay>' +
            '<TimeBlockList Version="1.0">' +
            '<TimeBlock_0>' + ationSeaction[6] + '</TimeBlock_0>' +
            '<TimeBlock_1>' + ationSeaction[0] + '</TimeBlock_1>' +
            '<TimeBlock_2>' + ationSeaction[1] + '</TimeBlock_2>' +
            '<TimeBlock_3>' + ationSeaction[2] + '</TimeBlock_3>' +
            '<TimeBlock_4>' + ationSeaction[3] + '</TimeBlock_4>' +
            '<TimeBlock_5>' + ationSeaction[4] + '</TimeBlock_5>' +
            '<TimeBlock_6>' + ationSeaction[5] + '</TimeBlock_6>' +
            '</TimeBlockList></Schedule>' +
            '<Trigger Version="1.0"><NotifyAMS Version="1.0"><Enable>false</Enable></NotifyAMS>' +
            '<BeepAlert Version="1.0"><Enable>' + $("#lincAudiblealarm").is(':checked') + '</Enable></BeepAlert>' +
            '<FullScreen Version="1.0"><Enable>false</Enable></FullScreen>' +
            '<Mail Version="1.0"><Enable>false</Enable></Mail>' +
            '<Ftp Version="1.0"><Enable>' + $("#lincTriggerFTP").is(':checked') + '</Enable></Ftp>' +
            '<Push Version="1.0"><Enable>' + $("#lincTriggerpush").is(':checked') + '</Enable></Push>' +
            '<AlarmOut Version="1.0"><Enable>' + $("#lincalarmoutput").is(':checked') + '</Enable><AlarmOutMask>1</AlarmOutMask></AlarmOut>' +
            '<Snapshot Version="1.0"><Enable>' + $("#lincTriggerSDcapture").is(':checked') + '</Enable><SnapshotMask>1</SnapshotMask></Snapshot>' +
            '<Record Version="1.0"><Enable>' + $("#lincTriggerSDrecording").is(':checked') + '</Enable><RecordMask>1</RecordMask></Record>' +
            '<PTZ Version="1.0"><Enable>false</Enable></PTZ>' +
            '<LightAlarm Version="1.0"><Enable>' + $("#lincLightalarm").is(':checked') + '</Enable></LightAlarm></Trigger>'
    }
    // 处理陌生车牌
    var isunoAtion = $("#Unknown").is(':checked');
    var isunoAtionXml = '';
    if (isunoAtion) {
        if (unoSeaction.length == 168) {
            unoSeaction = keppTime(group(unoSeaction, 24))
        }
        if (VoiceunoSeaction.g.length == 168) {
            VoiceunoSeaction.g = keppTime(group(VoiceunoSeaction.g, 24))
        }
        lastNumber = setBit(lastNumber, 1);
        // 普通布防获取值
        var nd, nt
        nd = $("#unolinceDefensePlan").val()
        if (nd == "false") {
            nd = "false"
            nt = "disable"
        } else if (nd == "true") {
            nd = "true"
            nt = "disable"
        }
        // 声音布防获取值
        var ndv, ntv
        ndv = VoiceunoSeaction.d
        if (ndv == "false") {
            ndv = "false"
            ntv = "disable"
        } else if (ndv == "true") {
            ndv = "true"
            ntv = "disable"
        } else if (ndv == "evening") {
            ndv = "true"
            ntv = "evening"
        } else {
            ndv = "true"
            ntv = "day"
        }
        isunoAtionXml += '<SuveillanceType>strangeLicensePlate</SuveillanceType><VoiceAlarm><Enable>' + $('#lincAudiblealarm').is(':checked') + '</Enable>' +
            '<VoiceType>' + VoiceunoSeaction.a + '</VoiceType><BroadcastCount>' + VoiceunoSeaction.b + '</BroadcastCount><BroadcastVolume>' + VoiceunoSeaction.c + '</BroadcastVolume>' +
            '<VoiceAlarmSchedule Version="1.0"><DayMode>' + ntv + '</DayMode>' +
            '<AllDay>' + ndv + '</AllDay><TimeBlockList Version="1.0">' +
            '<TimeBlock_0>' + (VoiceunoSeaction.g)[6] + '</TimeBlock_0>' +
            '<TimeBlock_1>' + (VoiceunoSeaction.g)[0] + '</TimeBlock_1>' +
            '<TimeBlock_2>' + (VoiceunoSeaction.g)[1] + '</TimeBlock_2>' +
            '<TimeBlock_3>' + (VoiceunoSeaction.g)[2] + '</TimeBlock_3>' +
            '<TimeBlock_4>' + (VoiceunoSeaction.g)[3] + '</TimeBlock_4>' +
            '<TimeBlock_5>' + (VoiceunoSeaction.g)[4] + '</TimeBlock_5>' +
            '<TimeBlock_6>' + (VoiceunoSeaction.g)[5] + '</TimeBlock_6>' +
            '</TimeBlockList></VoiceAlarmSchedule></VoiceAlarm>' +
            '<Schedule Version="1.0"><DayMode>' + nt + '</DayMode>' +
            '<AllDay>' + nd + '</AllDay>' +
            '<TimeBlockList Version="1.0">' +
            '<TimeBlock_0>' + unoSeaction[6] + '</TimeBlock_0>' +
            '<TimeBlock_1>' + unoSeaction[0] + '</TimeBlock_1>' +
            '<TimeBlock_2>' + unoSeaction[1] + '</TimeBlock_2>' +
            '<TimeBlock_3>' + unoSeaction[2] + '</TimeBlock_3>' +
            '<TimeBlock_4>' + unoSeaction[3] + '</TimeBlock_4>' +
            '<TimeBlock_5>' + unoSeaction[4] + '</TimeBlock_5>' +
            '<TimeBlock_6>' + unoSeaction[5] + '</TimeBlock_6>' +
            '</TimeBlockList></Schedule>' +
            '<Trigger Version="1.0"><NotifyAMS Version="1.0"><Enable>false</Enable></NotifyAMS>' +
            '<BeepAlert Version="1.0"><Enable>' + $("#unlincAudiblealarm").is(':checked') + '</Enable></BeepAlert>' +
            '<FullScreen Version="1.0"><Enable>false</Enable></FullScreen>' +
            '<Mail Version="1.0"><Enable>false</Enable></Mail>' +
            '<Ftp Version="1.0"><Enable>' + $("#unlincTriggerFTP").is(':checked') + '</Enable></Ftp>' +
            '<Push Version="1.0"><Enable>' + $("#unlincTriggerpush").is(':checked') + '</Enable></Push>' +
            '<AlarmOut Version="1.0"><Enable>' + $("#unlincalarmoutput").is(':checked') + '</Enable><AlarmOutMask>1</AlarmOutMask></AlarmOut>' +
            '<Snapshot Version="1.0"><Enable>' + $("#unlincTriggerSDcapture").is(':checked') + '</Enable><SnapshotMask>1</SnapshotMask></Snapshot>' +
            '<Record Version="1.0"><Enable>' + $("#unlincTriggerSDrecording").is(':checked') + '</Enable><RecordMask>1</RecordMask></Record>' +
            '<PTZ Version="1.0"><Enable>false</Enable></PTZ>' +
            '<LightAlarm Version="1.0"><Enable>' + $("#unlincLightalarm").is(':checked') + '</Enable></LightAlarm></Trigger>'
    }
    // 处理非绿车牌
    var isnogAtion = $("#Nongreen").is(':checked');
    var isnogAtionXml = '';
    if (isnogAtion) {
        if (nogreeSeaction.length == 168) {
            nogreeSeaction = keppTime(group(nogreeSeaction, 24))
        }
        if (VoicenogreeSeaction.g.length == 168) {
            VoicenogreeSeaction.g = keppTime(group(VoicenogreeSeaction.g, 24))
        }
        lastNumber = setBit(lastNumber, 2);
        // 普通布防获取值
        var gd, gt
        gd = $("#nogreelinceDefensePlan").val()
        if (gd == "false") {
            gd = "false"
            gt = "disable"
        } else if (gd == "true") {
            gd = "true"
            gt = "disable"
        }
        // 声音布防获取值
        var gdv, gtv
        gdv = VoicenogreeSeaction.d
        if (gdv == "false") {
            gdv = "false"
            gtv = "disable"
        } else if (gdv == "true") {
            gdv = "true"
            gtv = "disable"
        } else if (gdv == "evening") {
            gdv = "true"
            gtv = "evening"
        } else {
            gdv = "true"
            gtv = "day"
        }
        isnogAtionXml += '<SuveillanceType>nonGreenLicensePlate</SuveillanceType><VoiceAlarm><Enable>' + $('#lincAudiblealarm').is(':checked') + '</Enable>' +
            '<VoiceType>' + VoicenogreeSeaction.a + '</VoiceType><BroadcastCount>' + VoicenogreeSeaction.b + '</BroadcastCount><BroadcastVolume>' + VoicenogreeSeaction.c + '</BroadcastVolume>' +
            '<VoiceAlarmSchedule Version="1.0"><DayMode>' + gtv + '</DayMode>' +
            '<AllDay>' + gdv + '</AllDay><TimeBlockList Version="1.0">' +
            '<TimeBlock_0>' + (VoicenogreeSeaction.g)[6] + '</TimeBlock_0>' +
            '<TimeBlock_1>' + (VoicenogreeSeaction.g)[0] + '</TimeBlock_1>' +
            '<TimeBlock_2>' + (VoicenogreeSeaction.g)[1] + '</TimeBlock_2>' +
            '<TimeBlock_3>' + (VoicenogreeSeaction.g)[2] + '</TimeBlock_3>' +
            '<TimeBlock_4>' + (VoicenogreeSeaction.g)[3] + '</TimeBlock_4>' +
            '<TimeBlock_5>' + (VoicenogreeSeaction.g)[4] + '</TimeBlock_5>' +
            '<TimeBlock_6>' + (VoicenogreeSeaction.g)[5] + '</TimeBlock_6>' +
            '</TimeBlockList></VoiceAlarmSchedule></VoiceAlarm>' +
            '<Schedule Version="1.0"><DayMode>' + gt + '</DayMode>' +
            '<AllDay>' + gd + '</AllDay>' +
            '<TimeBlockList Version="1.0">' +
            '<TimeBlock_0>' + nogreeSeaction[6] + '</TimeBlock_0>' +
            '<TimeBlock_1>' + nogreeSeaction[0] + '</TimeBlock_1>' +
            '<TimeBlock_2>' + nogreeSeaction[1] + '</TimeBlock_2>' +
            '<TimeBlock_3>' + nogreeSeaction[2] + '</TimeBlock_3>' +
            '<TimeBlock_4>' + nogreeSeaction[3] + '</TimeBlock_4>' +
            '<TimeBlock_5>' + nogreeSeaction[4] + '</TimeBlock_5>' +
            '<TimeBlock_6>' + nogreeSeaction[5] + '</TimeBlock_6>' +
            '</TimeBlockList></Schedule>' +
            '<Trigger Version="1.0"><NotifyAMS Version="1.0"><Enable>false</Enable></NotifyAMS>' +
            '<BeepAlert Version="1.0"><Enable>' + $("#noglincAudiblealarm").is(':checked') + '</Enable></BeepAlert>' +
            '<FullScreen Version="1.0"><Enable>false</Enable></FullScreen>' +
            '<Mail Version="1.0"><Enable>false</Enable></Mail>' +
            '<Ftp Version="1.0"><Enable>' + $("#noglincTriggerFTP").is(':checked') + '</Enable></Ftp>' +
            '<Push Version="1.0"><Enable>' + $("#noglincTriggerpush").is(':checked') + '</Enable></Push>' +
            '<AlarmOut Version="1.0"><Enable>' + $("#noglincalarmoutput").is(':checked') + '</Enable><AlarmOutMask>1</AlarmOutMask></AlarmOut>' +
            '<Snapshot Version="1.0"><Enable>' + $("#noglincTriggerSDcapture").is(':checked') + '</Enable><SnapshotMask>1</SnapshotMask></Snapshot>' +
            '<Record Version="1.0"><Enable>' + $("#noglincTriggerSDrecording").is(':checked') + '</Enable><RecordMask>1</RecordMask></Record>' +
            '<PTZ Version="1.0"><Enable>false</Enable></PTZ>' +
            '<LightAlarm Version="1.0"><Enable>' + $("#noglincLightalarm").is(':checked') + '</Enable></LightAlarm></Trigger>'
    }
    // 处理黄色车牌
    var isyelAtion = $("#Yellow").is(':checked');
    var isyelAtionXml = '';
    if (isyelAtion) {
        if (yellowSeaction.length == 168) {
            yellowSeaction = keppTime(group(yellowSeaction, 24))
        }
        if (VoiceyellowSeaction.g.length == 168) {
            VoiceyellowSeaction.g = keppTime(group(VoiceyellowSeaction.g, 24))
        }
        lastNumber = setBit(lastNumber, 3);
        // 普通布防获取值
        var yd, yt
        yd = $("#yellowlinceDefensePlan").val()
        if (yd == "false") {
            yd = "false"
            yt = "disable"
        } else if (yd == "true") {
            yd = "true"
            yt = "disable"
        }
        // 声音布防获取值
        var ydv, ytv
        ydv = VoiceyellowSeaction.d
        if (ydv == "false") {
            ydv = "false"
            ytv = "disable"
        } else if (ydv == "true") {
            ydv = "true"
            ytv = "disable"
        } else if (ydv == "evening") {
            ydv = "true"
            ytv = "evening"
        } else {
            ydv = "true"
            ytv = "day"
        }
        isyelAtionXml += '<SuveillanceType>yellowLicensePlate</SuveillanceType><VoiceAlarm><Enable>' + $('#lincAudiblealarm').is(':checked') + '</Enable>' +
            '<VoiceType>' + VoiceyellowSeaction.a + '</VoiceType><BroadcastCount>' + VoiceyellowSeaction.b + '</BroadcastCount><BroadcastVolume>' + VoiceyellowSeaction.c + '</BroadcastVolume>' +
            '<VoiceAlarmSchedule Version="1.0"><DayMode>' + ytv + '</DayMode>' +
            '<AllDay>' + ydv + '</AllDay><TimeBlockList Version="1.0">' +
            '<TimeBlock_0>' + (VoiceyellowSeaction.g)[6] + '</TimeBlock_0>' +
            '<TimeBlock_1>' + (VoiceyellowSeaction.g)[0] + '</TimeBlock_1>' +
            '<TimeBlock_2>' + (VoiceyellowSeaction.g)[1] + '</TimeBlock_2>' +
            '<TimeBlock_3>' + (VoiceyellowSeaction.g)[2] + '</TimeBlock_3>' +
            '<TimeBlock_4>' + (VoiceyellowSeaction.g)[3] + '</TimeBlock_4>' +
            '<TimeBlock_5>' + (VoiceyellowSeaction.g)[4] + '</TimeBlock_5>' +
            '<TimeBlock_6>' + (VoiceyellowSeaction.g)[5] + '</TimeBlock_6>' +
            '</TimeBlockList></VoiceAlarmSchedule></VoiceAlarm>' +
            '<Schedule Version="1.0"><DayMode>' + yt + '</DayMode>' +
            '<AllDay>' + yd + '</AllDay>' +
            '<TimeBlockList Version="1.0">' +
            '<TimeBlock_0>' + yellowSeaction[6] + '</TimeBlock_0>' +
            '<TimeBlock_1>' + yellowSeaction[0] + '</TimeBlock_1>' +
            '<TimeBlock_2>' + yellowSeaction[1] + '</TimeBlock_2>' +
            '<TimeBlock_3>' + yellowSeaction[2] + '</TimeBlock_3>' +
            '<TimeBlock_4>' + yellowSeaction[3] + '</TimeBlock_4>' +
            '<TimeBlock_5>' + yellowSeaction[4] + '</TimeBlock_5>' +
            '<TimeBlock_6>' + yellowSeaction[5] + '</TimeBlock_6>' +
            '</TimeBlockList></Schedule>' +
            '<Trigger Version="1.0"><NotifyAMS Version="1.0"><Enable>false</Enable></NotifyAMS>' +
            '<BeepAlert Version="1.0"><Enable>' + $("#yellincAudiblealarm").is(':checked') + '</Enable></BeepAlert>' +
            '<FullScreen Version="1.0"><Enable>false</Enable></FullScreen>' +
            '<Mail Version="1.0"><Enable>false</Enable></Mail>' +
            '<Ftp Version="1.0"><Enable>' + $("#yellincTriggerFTP").is(':checked') + '</Enable></Ftp>' +
            '<Push Version="1.0"><Enable>' + $("#yellincTriggerpush").is(':checked') + '</Enable></Push>' +
            '<AlarmOut Version="1.0"><Enable>' + $("#yellincalarmoutput").is(':checked') + '</Enable><AlarmOutMask>1</AlarmOutMask></AlarmOut>' +
            '<Snapshot Version="1.0"><Enable>' + $("#yellincTriggerSDcapture").is(':checked') + '</Enable><SnapshotMask>1</SnapshotMask></Snapshot>' +
            '<Record Version="1.0"><Enable>' + $("#yellincTriggerSDrecording").is(':checked') + '</Enable><RecordMask>1</RecordMask></Record>' +
            '<PTZ Version="1.0"><Enable>false</Enable></PTZ>' +
            '<LightAlarm Version="1.0"><Enable>' + $("#yellincLightalarm").is(':checked') + '</Enable></LightAlarm></Trigger>'
    }
    // 处理无车牌
    var iswuAtion = $("#noplate").is(':checked');
    var iswuAtionXml = '';
    if (iswuAtion) {
        if (wuSeaction.length == 168) {
            wuSeaction = keppTime(group(wuSeaction, 24))
        }
        if (VoicewuSeaction.g.length == 168) {
            VoicewuSeaction.g = keppTime(group(VoicewuSeaction.g, 24))
        }
        lastNumber = setBit(lastNumber, 4);
        // 普通布防获取值
        var wd, wt
        wd = $("#wulinceDefensePlan").val()
        if (wd == "false") {
            wd = "false"
            wt = "disable"
        } else if (wd == "true") {
            wd = "true"
            wt = "disable"
        }
        // 声音布防获取值
        var wdv, wtv
        wdv = VoicewuSeaction.d
        if (wdv == "false") {
            wdv = "false"
            wtv = "disable"
        } else if (wdv == "true") {
            wdv = "true"
            wtv = "disable"
        } else if (wdv == "evening") {
            wdv = "true"
            wtv = "evening"
        } else {
            wdv = "true"
            wtv = "day"
        }
        iswuAtionXml += '<SuveillanceType>NoLicensePlate</SuveillanceType><Sensitivity>' + $("#wuseventiy").val() + '</Sensitivity><VoiceAlarm><Enable>' + $('#lincAudiblealarm').is(':checked') + '</Enable>' +
            '<VoiceType>' + VoicewuSeaction.a + '</VoiceType><BroadcastCount>' + VoicewuSeaction.b + '</BroadcastCount><BroadcastVolume>' + VoicewuSeaction.c + '</BroadcastVolume>' +
            '<VoiceAlarmSchedule Version="1.0"><DayMode>' + wtv + '</DayMode>' +
            '<AllDay>' + wdv + '</AllDay><TimeBlockList Version="1.0">' +
            '<TimeBlock_0>' + (VoicewuSeaction.g)[6] + '</TimeBlock_0>' +
            '<TimeBlock_1>' + (VoicewuSeaction.g)[0] + '</TimeBlock_1>' +
            '<TimeBlock_2>' + (VoicewuSeaction.g)[1] + '</TimeBlock_2>' +
            '<TimeBlock_3>' + (VoicewuSeaction.g)[2] + '</TimeBlock_3>' +
            '<TimeBlock_4>' + (VoicewuSeaction.g)[3] + '</TimeBlock_4>' +
            '<TimeBlock_5>' + (VoicewuSeaction.g)[4] + '</TimeBlock_5>' +
            '<TimeBlock_6>' + (VoicewuSeaction.g)[5] + '</TimeBlock_6>' +
            '</TimeBlockList></VoiceAlarmSchedule></VoiceAlarm>' +
            '<Schedule Version="1.0"><DayMode>' + wt + '</DayMode>' +
            '<AllDay>' + wd + '</AllDay>' +
            '<TimeBlockList Version="1.0">' +
            '<TimeBlock_0>' + wuSeaction[6] + '</TimeBlock_0>' +
            '<TimeBlock_1>' + wuSeaction[0] + '</TimeBlock_1>' +
            '<TimeBlock_2>' + wuSeaction[1] + '</TimeBlock_2>' +
            '<TimeBlock_3>' + wuSeaction[2] + '</TimeBlock_3>' +
            '<TimeBlock_4>' + wuSeaction[3] + '</TimeBlock_4>' +
            '<TimeBlock_5>' + wuSeaction[4] + '</TimeBlock_5>' +
            '<TimeBlock_6>' + wuSeaction[5] + '</TimeBlock_6>' +
            '</TimeBlockList></Schedule>' +
            '<Trigger Version="1.0"><NotifyAMS Version="1.0"><Enable>false</Enable></NotifyAMS>' +
            '<BeepAlert Version="1.0"><Enable>' + $("#wulincAudiblealarm").is(':checked') + '</Enable></BeepAlert>' +
            '<FullScreen Version="1.0"><Enable>false</Enable></FullScreen>' +
            '<Mail Version="1.0"><Enable>false</Enable></Mail>' +
            '<Ftp Version="1.0"><Enable>' + $("#wulincTriggerFTP").is(':checked') + '</Enable></Ftp>' +
            '<Push Version="1.0"><Enable>' + $("#wulincTriggerpush").is(':checked') + '</Enable></Push>' +
            '<AlarmOut Version="1.0"><Enable>' + $("#wulincalarmoutput").is(':checked') + '</Enable><AlarmOutMask>1</AlarmOutMask></AlarmOut>' +
            '<Snapshot Version="1.0"><Enable>' + $("#wulincTriggerSDcapture").is(':checked') + '</Enable><SnapshotMask>1</SnapshotMask></Snapshot>' +
            '<Record Version="1.0"><Enable>' + $("#wulincTriggerSDrecording").is(':checked') + '</Enable><RecordMask>1</RecordMask></Record>' +
            '<PTZ Version="1.0"><Enable>false</Enable></PTZ>' +
            '<LightAlarm Version="1.0"><Enable>false</Enable></LightAlarm></Trigger>'
    }
    var xml = '<?xml version="1.0" encoding="utf-8"?><LicensePlateSurveillanceUIDesignCfg><Enable>' + $("#isShowlicense").is(':checked') + '</Enable>' +
        '<LicensePlateSuveillanceType>' + lastNumber + '</LicensePlateSuveillanceType>' +
        '<RuleCfgList><RuleCfg>' + isAtionXml + '</RuleCfg><RuleCfg>' + isunoAtionXml + '</RuleCfg><RuleCfg>' + isnogAtionXml + '</RuleCfg><RuleCfg>' + isyelAtionXml + '</RuleCfg><RuleCfg>' + iswuAtionXml + '</RuleCfg></RuleCfgList></LicensePlateSurveillanceUIDesignCfg>'
    var cyURL = window.config.baseUrl + "/System/LicensePlateSurveillanceUIDesignCfg";
    $.ajax({
        type: "PUT",
        url: cyURL,
        async: false,
        processData: false,
        data: xml,
        beforeSend: function(xhr) {
            xhr.setRequestHeader("If-Modified-Since", "0");
        },
        complete: function(xhr, textStatus) {
            xhrState = xhr
            SaveState(xhr);
        }
    });
}
// 处理默认值
function keppTime(data) {
    var arr = []
    for (var i = 0; i < data.length; i++) {
        var str = ''
        for (var k = 0; k < data[i].length; k++) {
            if (data[i][k] == 0) {
                str += '00'
            } else {
                str += '11'
            }
        }
        arr.push(str)
    }
    return arr
}
//试听
function setTryvoice(v, a, b, c, d, e) {
    var voiceXmldoc = '<?xml version="1.0" encoding="UTF-8" ?>' +
        "<AudioAlarmConfig><ChannelID>1</ChannelID>" +
        "<PeopleAudioType></PeopleAudioType><CarAudio></CarAudio>" +
        "<FireAudioType></FireAudioType><AudioOutputDelay></AudioOutputDelay>" +
        "<AudioVolume></AudioVolume>" +
        "<TryListenType>" + v + "</TryListenType>" +
        "<AlarmInExAudioType></AlarmInExAudioType>" +
        "<VideoShelterAudioType></VideoShelterAudioType>" +
        "<MotionAudioType></MotionAudioType>" +
        "<ElectronicDenceAudioType></ElectronicDenceAudioType>" +
        "<CrossBorderDetectAudioType></CrossBorderDetectAudioType>" +
        "<OffDutyDetectAudioType></OffDutyDetectAudioType>" +
        "<AttentionLicensePlateAudioType>" + a + "</AttentionLicensePlateAudioType>" +
        "<StrangeLicensePlateAudioType>" + b + "</StrangeLicensePlateAudioType>" +
        "<NonGreenLicensePlateAudioType>" + c + "</NonGreenLicensePlateAudioType>" +
        "<YellowLicensePlateAudioType>" + d + "</YellowLicensePlateAudioType>" +
        "<NoLicensePlateAudioType>" + e + "</NoLicensePlateAudioType>" +
        "</AudioAlarmConfig>"
    var cyURL = window.config.baseUrl + "/System/1/TryListenSelectedAlarmAudioV1";
    $.ajax({
        type: "PUT",
        url: cyURL,
        processData: false,
        data: voiceXmldoc,
        beforeSend: function(xhr) {
            xhr.setRequestHeader("If-Modified-Since", "0");
        },
        complete: function(xhr, textStatus) {
            SaveState(xhr, 1);
        }
    });
}
//查询所有车牌库
function LinceGroupsQueryAll() {
    var cyURL = window.config.baseUrl + "/LicensePlateGroup/QueryALL";
    $.ajax({
        type: "PUT",
        url: cyURL,
        async: false,
        processData: false,
        timeout: 15000,
        beforeSend: function(xhr) {
            xhr.setRequestHeader("If-Modified-Since", "0");
            if (window.localStorage.getItem("Token") != "default") {
                xhr.setRequestHeader("TOKEN", window.localStorage.getItem("Token"))
            }
        },
        success: function(xmlDoc, textStatus, xhr) { //在这里获取所有人脸库的值并且渲染页面
            recordlistData = []; //数组重置
            if (sessionStorage.getItem("xystyle") == "p2p") {
                var xmlDocobj = xmlDoc.responseXML;
            } else {
                var xmlDocobj = parseXmlFromStr(xmlDoc);
            }
            var statusflg = $(xmlDocobj).find('ResponseStatus').eq(0).find('statusCode').eq(0).text();
            if ("401" == statusflg) {
                top.location.href = "/";
            }
            var sl = $(xmlDocobj).find('LicensePlateGroupList').eq(0).find('LicensePlateGroup').length;
            for (var i = 0; i < sl; i++) {
                var linceGroupobj = {};
                linceGroupobj.xid = i + 1
                linceGroupobj.GroupName = $(xmlDocobj).find('LicensePlateGroupList').eq(0).find('LicensePlateGroup').eq(i).find('LicensePlateGroupName').text();
                linceGroupobj.CreateTime = $(xmlDocobj).find('LicensePlateGroupList').eq(0).find('LicensePlateGroup').eq(i).find('CreateTime').text();
                linceGroupobj.initLabryNumber = $(xmlDocobj).find('LicensePlateGroupList').eq(0).find('LicensePlateGroup').eq(i).find('LicensePlateNumber').text();
                linceGroupobj.initLabryUID = $(xmlDocobj).find('LicensePlateGroupList').eq(0).find('LicensePlateGroup').eq(i).find('LicensePlateGroupID').text();
                libnayid.push(linceGroupobj.initLabryUID);
                recordlistData.push(linceGroupobj);
            }
        },
        error: function(xhr, textStatus, errorThrown) {
            if ("401" == xhr.status) {
                top.location.href = "/";
            }
        }
    });
}
// 初始化表格
function getFacesManagement() {
    var aoColumns = [{
            "mData": "xid",
        },
        {
            "mData": "GroupName",
            "mRender": function(data) {
                if (data == "VisitorList") {
                    return $.i18n.prop('i18n-face4');
                } else if (data == "WhiteList") {
                    return $.i18n.prop('i18n-face2');
                } else if (data == "BlackList") {
                    return $.i18n.prop('i18n-face3');
                } else {
                    return data;
                }
            }
        },
        {
            "mData": "initLabryNumber",
        },
        // {
        //     "mRender": function(data, type, full) { // 返回自定义内容
        //         return '<span>' + $.i18n.prop('i18n-wifi-none') + '</span>';
        //     },
        //     "mData": null,
        // }

    ];

    _tabled = new table("linceTable", {
        bProcessing: true,
        isCheckBox: false,
        retrieve: true, //可能是表格重复使用时受到影响 必须加上
        bPaginate: false, //翻页功能
        bLengthChange: false, //改变每页显示数据数量
        bFilter: false, //过滤功能
        bSort: false, //排序功能
        bInfo: false, //页脚信息
        bAutoWidth: false, //自动宽度
        aoColumns: aoColumns,
        aaData: recordlistData
    });
}

function dataTableDraws(tableId) {
    var aoColumns = [{
            "mDataProp": "id", //mDataProp
            "sWidth": "10%" //设置列宽
        },
        {
            "mDataProp": "Name",
            "sWidth": "25%" //设置列宽
        }
    ];
    _table = $(tableId).dataTable({
        "language": {
            "lengthMenu": $.i18n.prop('i18n-pageshow') + "_MENU_" + $.i18n.prop('i18n-pagesize'),
            "processing": $.i18n.prop("i18n-page-load"),
            // "info": "第 _START_ 到第 _END_ 条数据，总共有 _TOTAL_ 条记录",
            "sZeroRecords": $.i18n.prop('i18n-sZeroRecords'),
            // "infoFiltered" : "（从 _MAX_ 条数据中过滤得到）",
            "paginate": {
                "first": $.i18n.prop("i18n-sInfo9"),
                "last": $.i18n.prop("i18n-sInfo8"),
                "next": $.i18n.prop("i18n-sNext"),
                "previous": $.i18n.prop("i18n-sPrevious"),
            },
        },
        "retrieve": true, //可能是表格重复使用时受到影响 必须加上
        "processing": true,
        "paging": true,
        "bPaginate": true, //翻页功能
        // "sPaginationType": "bootstrap", //翻页风格
        "bLengthChange": true, //每页显示的记录数
        "bFilter": false, //过滤功能
        "bSort": false, //排序功能
        "bInfo": true, //页脚信息
        "bAutoWidth": false, //自动宽度
        "bServerSide": true, //启用服务器分页
        "bDestroy": false, //解决重新渲染问题
        "iDisplayLength": 10, //每页显示数量
        "aoColumns": aoColumns,
        "dom": '<t><lfip>',
        "infoCallback": function(settings, start, end, max, total, pre) { //自定义总数
            if (total > 0) {
                return $.i18n.prop("i18n-page-tip") + " " + total + " " + $.i18n.prop("i18n-page-tips");
            } else {
                return $.i18n.prop("i18n-page-tip") + " " + 0 + " " + $.i18n.prop("i18n-page-tips");
            }

        },
        // 当表格重绘就会调用这个回调
        fnDrawCallback: function(data) {

        },
        fnServerData: retrieveData
    });
}
// 查询车牌号
function retrieveData(sSource, aoData, fnCallback) {
    //获取pageSize
    var pageSize = aoData[4].value;
    //获取page
    var start = aoData[3].value;
    var page = Math.ceil(start / pageSize) + 1;
    // 查询条件
    xml = '<?xml version="1.0" encoding="utf-8"?>' +
        '<LicensePlateInfoFilter>' +
        '<LicensePlate>' + $("#lincenumber").val() + '</LicensePlate>' +
        '<LicensePlateUUID></LicensePlateUUID>' +
        '<LicensePlateGroupID>' + libnayid[0] + '</LicensePlateGroupID>' +
        '<PageSize>' + pageSize + '</PageSize>' +
        '<PageNum>' + page + '</PageNum>' +
        '</LicensePlateInfoFilter>'
    var ae = window.config.baseUrl + "/LicensePlateGroup/QueryLicensePlateInfoList";
    $.ajax({
        type: "PUT",
        url: ae,
        dataType: 'XML',
        contentType: "application/xml",
        data: xml,
        timeout: 15000,
        beforeSend: function(ak) {
            ak.setRequestHeader("If-Modified-Since", "0");
            if (window.localStorage.getItem("Token") != "default") {
                ak.setRequestHeader("TOKEN", window.localStorage.getItem("Token"))
            }
        },
        success: function(res, an, am) {
            if (sessionStorage.getItem("xystyle") == "p2p") {
                var resulXML = res.responseXML;
            } else {
                var resulXML = res
            }
            var length = $(resulXML).find('LicensePlateInfoList').find('LicensePlateInfo').length;
            var list = [];
            for (var index = 0; index < length; index++) {
                var itme = {};
                itme.id = index + 1
                itme.Name = $(resulXML).find('LicensePlateInfoList').find('LicensePlateInfo').eq(index).find('LicensePlate').text();
                list.push(itme);
            }
            console.log(list, "444445555555");
            //iTotalRecords和iTotalDisplayRecords数据别搞错了
            //iTotalRecords 当前页显示多少条，iTotalDisplayRecords为总条数
            var result = {
                "iTotalRecords": pageSize,
                "iTotalDisplayRecords": $(resulXML).find('LicensePlateInfoList').find('LicenseNumber').text(),
                "aaData": list
            };
            fnCallback(result);
        },
        error: function(af, ag, ae) {
            if ("401" == af.status) {
                top.location.href = "/";
            }
        }
    })

}
