var laydateObj;
var taskList = {
    data: [],
    init: function () {
        this.getData();
    },
    getData: function () {
        let _this = this;
        $.ajax({
            url: baseURL_gjjc + "GetTaskList.ashx",
            type: "post",
            dataType: "json",
            data: {
                keywords: $("#rw-keywords").val(),
                // date: $("#rw-date").val(),
                page: 1,
                limit: 100
            },
            success: function (data) {
                if (data.data && data.data.length > 0) {
                    _this.data = data.data;
                    _this.setData(data.data);
                    map.getMap(data.data);
                } else {
                    map.getMap([]);
                    $("#rwList").html('<div class="noData">暂无数据</div>');
                }
            },
            error: function (jqXHR) {
                map.getMap([]);
                $("#rwList").html('<div class="noData">暂无数据</div>');
                console.log("发生错误：" + jqXHR.status);
            }
        })
    },
    setData: function (data) {
        var str = '';
        for (var i = 0; i < data.length; i++) {
            var item = data[i];
            str += `
                <div class="panel-item">
                    <div class="panel-head">${item.project_no ? '【' + item.project_no + '】' : ''}${item.project_name}</div>
                    <div class="panel-info">
            `;
            for (var j = 0; j < item.task_list.length; j++) {
                var item2 = item.task_list[j];
                str += `
                    <div class="info-item">
                        <div id="rwInfo-${i}-${j}">
                            <div class="item-head" onclick="listClick('rwInfo-${i}-${j}')" data-mapx="${item2.mapx}" data-mapy="${item2.mapy}" data-index="${i}" data-index2="${j}">
                                <div class="flex-item">
                                    <div class="icon ${item2.abnormal_count > 0 ? 'showTip' : ''}"><img src="../static/images/icon_rwd.png"/></div>
                                    任务单：${item2.task_no}
                                </div>
                                <div class="flex-item">
                                    <div class="icon icon2"><img src="../static/images/jiantou.png"/></div>
                                </div>
                            </div>
                            <div class="item-main hidden">
                                ${item2.sample_list.map((item3, index3) => {
                    return (`<div class="flex-item" onclick="detail.listgetsubRightData('${item.project_id}', '${item3.sample_id}', '${j}','${index3}')"><p>样品编号：${item3.sample_no}</p><p class="desc ${item3.ysjl_count>0?'blue':'yellow'}">${item3.ysjl_count>0?`<img src="../static/images/icon_gj_mr.png"/>钢筋数：${item3.sample_count}`:'<img src="../static/images/icon_gj_xz.png"/>暂未检测'}</p></div>`);
                }).join('')
                    }
                            </div>
                        </div>
                    </div>
                `;
            }
            str += `
                    </div>
                </div>
            `;
        }
        $("#rwList").html(str);
    },
    // prevDate() {
    //     $("#rw-date").val(getNextDate(($("#rw-date").val()), -1));
    //     laydateObj.config.value = getNextDate(($("#rw-date").val(), new Date()), -1);
    //     this.getData();
    // },
    // nextDate() {
    //     $("#rw-date").val(getNextDate(($("#rw-date").val()), 1));
    //     laydateObj.config.value = getNextDate(($("#rw-date").val(), new Date()), 1);
    //     this.getData();
    // }
}
$("#rw-keywords").keydown(function (event) {
    if (event.keyCode == 13) {
        taskList.getData();
    }
});

var testCount = {
    init: function () {
        this.getData();
    },
    getData: function () {
        let _this = this;
        $.ajax({
            url: baseURL_gjjc + "GetTestCount.ashx",
            type: "post",
            dataType: "json",
            success: function (data) {
                if (data.data && data.data.length > 0) {
                    _this.setData(data.data);
                } else {
                    $("#gczs").html('0');
                    $("#jrzj").html('0');
                    $("#yjc").html('0');
                }
            },
            error: function (jqXHR) {
                $("#gczs").html('0');
                $("#jrzj").html('0');
                $("#yjc").html('0');
                console.log("发生错误：" + jqXHR.status);
            }
        })
    },
    setData: function (data) {
        console.log(data)
        $("#gczs").html(data[0].project_count);
        $("#jrzj").html(data[0].today_project_count);
        $("#yjc").html(data[0].today_test_count);
    }
}

var map = {
    getMap: function (data) {
        var options = {
            subdistrict: 0,
            extensions: 'all',
            level: 'province'
        };
        var district = new AMap.DistrictSearch(options);
        district.search($("#province").html(), function (status, result) {
            var bounds = result.districtList[0]['boundaries'];
            var mask = [];
            for (var i = 0; i < bounds.length; i++) {
                mask.push([bounds[i]]);
            }
            var map = new AMap.Map("map", {
                mask: mask,
                expandZoomRange: true,
                zoom: 7,
                zooms: [5, 20],
                mapStyle: 'amap://styles/d3ce37d9fe39b7cc5f08f48af52802a2',
                resizeEnable: true,
                viewMode: '3D',
                showLabel: true
            });
            var district = null;
            var polygons = [];
            function drawBounds() {
                if (!district) {
                    var opts = {
                        subdistrict: 0,
                        extensions: 'all',
                        level: 'district'
                    };
                    district = new AMap.DistrictSearch(opts);
                }
                //行政区查询
                district.setLevel('district')
                district.search($("#area").html(), function(status, result) {
                // district.search('杭州市', function (status, result) {
                    map.remove(polygons)//清除上次结果
                    polygons = [];
                    var bounds = result.districtList[0].boundaries;
                    if (bounds) {
                        for (var i = 0, l = bounds.length; i < l; i++) {
                            var polygon = new AMap.Polygon({
                                strokeWeight: 1,
                                path: bounds[i],
                                fillOpacity: 0.4,
                                fillColor: '#80d8ff',
                                strokeColor: '#0091ea'
                            });
                            polygons.push(polygon);
                        }
                    }
                    map.add(polygons)
                    map.setFitView(polygons);//视口自适应
                });
            }
            drawBounds();
            var infoWindow = new AMap.InfoWindow({
                offset: new AMap.Pixel(0, -30)
            });
            if (data && data.length > 0) {
                for (var i = 0; i < data.length; i++) {
                    for (let y = 0; y < data[i].task_list.length; y++) {
                        let item2 = data[i].task_list[y]
                        var img = 'icon_hui.png';
                        /**
                         * is_today == 0 ----- 非今日
                         * is_today == 1 ----- 今日在检
                         */
                        if (item2.is_today == 1) {
                            img = 'icon_lv.png';
                        } else{
                            img = 'icon_hui.png';
                        }
                        var marker = new AMap.Marker({
                            position: [item2.mapx, item2.mapy],
                            icon: new AMap.Icon({
                                size: new AMap.Size(28, 28),
                                image: '../static/images/' + img
                            }),
                            map: map
                        });
                        marker.content = `
                        <div class="info-item">
                            <p onclick="detail.getData('${data[i].project_id}')" style="padding: 0.2rem .5rem .2rem .3rem">${data[i].project_name}</p>
                            <p class='btn' onclick="getBottomData.showPopup('${data[i].project_id}','${item2.SceneTask_id}','${item2.customer_id}','${item2.task_id}','${item2.order_id}')">异常录入</p>
                        </div>`;
                        marker.on('mouseover', infoOpen);
                        marker.on('click', newMAp);
                    }
                }
                map.setZoomAndCenter(7, [Number(data[0].task_list[0].mapx), Number(data[0].task_list[0].mapy)]);
            }
            function newMAp(e) {
                var infoWindow = new AMap.InfoWindow({
                    offset: new AMap.Pixel(0, -30)
                });
                infoWindow.setContent(e.target.content);
                infoWindow.open(map, e.target.getPosition());
            }
            function infoOpen(e) {
                infoWindow.setContent(e.target.content);
                infoWindow.open(map, e.target.getPosition());
            }

            $("#rwList .item-head").click(function () {
                var mapx = $(this).attr('data-mapx');
                var mapy = $(this).attr('data-mapy');
                if(Math.floor(mapx) ==0 && Math.floor(mapy) == 0){
                    return false;
                }
                var index = Number($(this).attr('data-index'));
                var item = taskList.data[index];
                var index2 = Number($(this).attr('data-index2'));
                var item2 = taskList.data[index].task_list[index2];
                if (mapx && mapy) {
                    map.setZoomAndCenter(12, [Number(mapx), Number(mapy)]);
                    infoWindow.setContent(`<div class="info-item">
                        <p onclick="detail.getData('${item.project_id}')" style="padding: 0.2rem .5rem .2rem .3rem">${item.project_name}</p>
                        <p class='btn' onclick="getBottomData.showPopup('${item.project_id}','${item2.SceneTask_id}','${item2.customer_id}','${item2.task_id}','${item2.order_id}')">异常录入</p>
                    </div>`);
                    infoWindow.open(map, { Q: Number(mapy), R: Number(mapx), lat: Number(mapy), lng: Number(mapx) });
                }
            })
            map.setMapStyle('amap://styles/d3ce37d9fe39b7cc5f08f48af52802a2');
        })
    },
}

var getBottomData = {
    showPopup: function (project_id, table_id, customer_id, task_id, order_id) {
        $(".layui-form")[0].reset()
        this.formData = {
            project_id,
            table_id,
            customer_id,
            task_id,
            order_id
        }
        layer.open({
            type: 1,
            shadeClose: true,
            maxmin: true,
            title: "<p class='popup-title'>异常信息录入</p>",
            area: ['8rem', '45%'],
            content: $('#popup-unusual'),
            end: function () {
                $("#popup-unusual").css('display', 'none');
            }
        });
    },
}

var detail = {
    data: [],
    ysjl_list: [],
    getData: function (project_id, sample_id, index, index2) {
        let _this = this;
        $.ajax({
            url: baseURL_gjjc + "GetTaskInfo.ashx",
            type: "post",
            dataType: "json",
            data: {
                project_id
            },
            success: function (data) {
                if (data.data && data.data.length > 0) {
                    _this.setLeftData(data.data, sample_id, index, index2);
                } else {
                    $("#subrwList").html('<div class="noData">暂无数据</div>');
                }
            },
            error: function (jqXHR) {
                $("#subrwList").html('<div class="noData">暂无数据</div>');
                console.log("发生错误：" + jqXHR.status);
            }
        })
    },
    setLeftData: function (data, sample_id, aindex, aindex2) {
        this.data = data;
        var str = '';
        for (var i = 0; i < data.length; i++) {
            var item = data[i];
            str += `
                <div class="info-item">
                    <div id="subrwInfo-${i}">
                        <div class="item-head" onclick="detail.setRightData('${i}', 'subrwInfo-${i}')">
                            <div class="flex-item">
                                <div class="icon ${item.abnormal_count > 0 ? 'showTip' : ''}"><img src="../static/images/icon_rwd.png"/></div>
                                任务单：${item.task_no}
                            </div>
                            <div class="flex-item">
                                <div class="icon icon2"><img src="../static/images/jiantou.png"/></div>
                            </div>
                        </div>
                        <div class="item-tab"><div>样品数量：${item.sample_list.length}</div></div>
                   
                        <div class="item-main hidden">
                            ${item.sample_list.map((item2, index2) => {
                return (`<div class="flex-item" onclick="detail.getsubRightData('${item2.sample_id}', '${i}','${index2}')"><p>样品编号：${item2.sample_no}</p><p class="desc ${item2.ysjl_count>0?'blue':'yellow'}">${item2.ysjl_count>0?`<img src="../static/images/icon_gj_mr.png"/>钢筋数：${item2.sample_count}`:'<img src="../static/images/icon_gj_xz.png"/>暂未检测'}</p></div>`);
            }).join('')
                }
                        </div>
                    </div>
                </div>
            `;
        }
        $("#popup-info .left-item").html(str);
        if(sample_id){
            detail.getsubRightData(sample_id, aindex, aindex2);
            sublistClick('subrwInfo-'+aindex);
            this.showPopup();
        }else{
            this.setRightData(0, 'subrwInfo-0');
            this.showPopup();
        }
    },
    setRightData(index, id) {
        sublistClick(id);
        var item = this.data[index];
        $("#subrwList .info-item").removeClass("active");
        $("#subrwList .flex-item").removeClass("active");
        $("#popup-info .info-item:nth-child(" + (Number(index) + 1) + ")").addClass("active");
        $("#popup-info .head").html(`${item.project_no ? '【' + item.project_no + '】' : ''}${item.project_name}`);
        $("#popup-info .right-item1").html(`
            <div class="main-item1">
                <div class="flex-item"><div class="value">任务单号：${item.task_no}</div><div class="value">检测单位：${item.customer_name}</div></div>
                <div class="flex-item"><div class="value">开始时间：${item.test_begin_datetime}</div><div class="value">最近数据上传：${item.test_end_datetime}</div></div>
                ${item.report_file && `<div class="flex-item"><div class="value">钢筋文件：<a href="${item.report_file}" style="color:#C0D3E6">点击查看</a></div></div>`
            }
                <div class="flex-item flex-item2 over-flex">
                    ${item.faceimg_list&&item.faceimg_list.length>0 ? item.faceimg_list.map((item2) => {
                return (`
                                <div class="box">
                                    <div class="img">
                                        <img src="${item2.image_url}" />
                                    </div>
                                    <div class="item">
                                        <div class="type"><p class="name">人脸识别</p><p>${item2.op_name}</p></div>
                                        <div class="time">${item2.datatime}</div>
                                    </div>
                                </div>
                            `);
            }).join('')
            : '暂无数据' }
                </div>
            </div>
            <div class="main-item">
                <div class="ma-i">
                    ${item.flow_list.length > 0 ?
                item.flow_list.map((item2, index2) => {
                    return (`
                                <div class="item">
                                    <div class="value">
                                        <div class="blue">第${index2 + 1}步 / ${item2.flowpath_no_str}</div>
                                        <div>检测人员：${item2.op_name}</div>
                                        <div>${item2.create_time}</div>
                                    </div>
                                    <div class="imgArr">
                                        ${item2.file_list.map((item3, index3) => {
                        return (`
                                                    <img src="${item3.file_path}" onclick="detail.imgView('${index}','${index2}','${index3}')"/>
                                                `);
                    }).join('')
                        }
                                    </div>
                                </div>
                            `);
                }).join('')
                : '<div class="noData">暂无数据</div>'
            }
                </div>
            </div>
        `);
        $("#popup-info .right-item2").addClass("hiddenImportant");
        $("#popup-info .right-item1").removeClass("hiddenImportant");
    },
    getsubRightData(sample_id, index, index2) {
        console.log(sample_id, index, index2);
        let _this = this;
        $.ajax({
            url: baseURL_gjjc + "GetPartInfo.ashx",
            type: "post",
            dataType: "json",
            data: {
                sample_id
            },
            success: function (data) {
                if (data.data) {
                    for(var i=0; i<data.data.length; i++){
                        if(data.data[i].ysjl_list){
                            for(var j=0; j<data.data[i].ysjl_list.length; j++){
                                var item = data.data[i].ysjl_list[j];
                                data.data[i].ysjl_list[j].jc_dataArr = [];
                                var z = 0;
                                for(var k=1; k<=100; k++){
                                    if(item['jc_data'+k] != null && item['jc_data'+k] != undefined){
                                        if(!item.jc_dataArr[z]){
                                            item.jc_dataArr[z] = {value: []};
                                        }
                                        item.jc_dataArr[z]['value'].push(item['jc_data'+k]);
                                        if(k%9==0){z = z+1}
                                    }
                                }
                            }
                        }
                    }
                    _this.setsubRightData(index, index2, data.data);
                } else {
                    // $("#subrwList").html('<div class="noData">暂无数据</div>');
                }
            },
            error: function (jqXHR) {
                // $("#subrwList").html('<div class="noData">暂无数据</div>');
                console.log("发生错误：" + jqXHR.status);
            }
        })
    },
    setsubRightData(index, index2, data) {
        $("#subrwList .info-item").removeClass("active");
        $("#subrwList .flex-item").removeClass("active");
        $("#subrwList .info-item:nth-child(" + (Number(index) + 1) + ") .flex-item:nth-child(" + (Number(index2) + 1) + ")").addClass("active");
        $("#popup-info .right-item1").addClass("hiddenImportant");
        $("#popup-info .right-item2").removeClass("hiddenImportant");
        var item = data[0];
        this.ysjl_list = item.ysjl_list;
        $("#popup-info .right-item2").html(`
            <!-- <div class="flex-item"><div class="value">任务单号：${item.task_no}</div><div class="value">检测单位：${item.customer_name}</div></div>
            <div class="name-item">样品编号：【${item.sample_no}】</div> -->
            ${item.ysjl_list && item.ysjl_list.length > 0 ? '' : '<div class="noData">暂无数据</div>'}
            <div class="info-item ${item.ysjl_list && item.ysjl_list.length > 0 ? '' : 'hidden'}">
            <!-- <div class="desc"><p>主筋直径：${item.main_bar_diameter?item.main_bar_diameter+'mm':''}</p><p>主筋间距：${item.main_bar_spacing?item.main_bar_spacing+'mm':''}</p></div>
                <div class="desc"><p>箍筋直径：${item.stirrup_diameter?item.stirrup_diameter+'mm':''}</p><p>箍筋间距：${item.stirrup_spacing?item.stirrup_spacing+'mm':''}</p></div>
                <div class="desc"><p>设计厚度：${item.design_thickness?item.design_thickness+'mm':''}</p><p>试验仪器编号：${item.equ_no}</p></div>
                <div class="desc"><p>仪器检测时间：${item.test_time}</p><p>数据接收时间：${item.receive_time}</p></div>
                <div class="desc"><p>数据同步时间：${item.create_time}</p><p>操作人员：${item.op_name}</p></div>
                <div class="desc"><p style="width: 100%">检测位置：${item.address}</p></div> -->
                <div class="bw-item">
                    ${item.ysjl_list && item.ysjl_list.length > 0 ? item.ysjl_list.map((item2, index2) => {
                    return (`
                        <div class="main-item" style="background: transparent; height: auto;">
                        <div class="name-item"><div class="right1">第4次/JGJ检测<img class="icon1" src="../static/images/tip.png">构件编号：${item2.component_no}<p class="tips">该构件编号由设备上传</p></div><div>数据接收时间： 2023-03-12 09:21<img class="icon2" src="../static/images/jiantou.png"/></div></div>
                            <div class="sub-item">
                                <div class="desc"><p>任务单号：${item.main_bar_diameter?item.main_bar_diameter+'mm':''}</p><p>检测单位：${item.main_bar_spacing?item.main_bar_spacing+'mm':''}</p></div>
                                <div class="desc"><p>样品编号：${item.stirrup_diameter?item.stirrup_diameter+'mm':''}</p><p>主筋直径：${item.stirrup_spacing?item.stirrup_spacing+'mm':''}</p></div>
                                <div class="desc"><p>箍筋直径：${item.design_thickness?item.design_thickness+'mm':''}</p><p>主筋间距：${item.equ_no}</p></div>
                                <div class="desc"><p>设计厚度：${item.test_time}</p><p>箍筋间距：${item.receive_time}</p></div>
                                <div class="desc"><p>仪器检测时间：${item.create_time}</p><p>试验仪器编号：${item.op_name}</p></div>
                                <div class="desc"><p>数据同步时间：${item.create_time}</p><p>操作人员：${item.op_name}</p></div>
                                <div class="desc"><p style="width: 100%">检测位置：${item.address}</p></div>`+
                                item2.jc_dataArr.map((item3, index3) => {
                                    return (`
                                        <div class="card">
                                            <div class="sub-name">
                                                <div>钢筋序号：${index3+1}</div>
                                                <div>单位：mm</div>
                                            </div>
                                            <div class="value-item">
                                                <div class="sub-value">
                                                    <div class="item1 ${item3.value[0]?'':'hidden'}">${item3.value[0]}</div>
                                                    <div class="item1 ${item3.value[1]?'':'hidden'}">${item3.value[1]}</div>
                                                    <div class="item1 ${item3.value[2]?'':'hidden'}">${item3.value[2]}</div>
                                                </div>
                                                <div class="sub-value">
                                                    <div class="item1 ${item3.value[3]?'':'hidden'}">${item3.value[3]}</div>
                                                    <div class="item1 ${item3.value[4]?'':'hidden'}">${item3.value[4]}</div>
                                                    <div class="item1 ${item3.value[5]?'':'hidden'}">${item3.value[5]}</div>
                                                </div>
                                                <div class="sub-value">
                                                    <div class="item1 ${item3.value[6]?'':'hidden'}">${item3.value[6]}</div>
                                                    <div class="item1 ${item3.value[7]?'':'hidden'}">${item3.value[7]}</div>
                                                    <div class="item1 ${item3.value[8]?'':'hidden'}">${item3.value[8]}</div>
                                                </div>
                                            </div>
                                        </div>
                                    `);
                                }).join('')
                            +`</div>    
                        </div>
                    `);
                }).join('')
                : '<div class="noData">暂无数据</div>'
            }
                </div>
            </div>
        `);
    },
    listgetsubRightData: function(project_id, sample_id, index, index2){
        detail.getData(project_id, sample_id, index, index2);
    },
    showPopup: function () {
        layer.open({
            type: 1,
            shadeClose: true,
            maxmin: true,
            title: "<p class='popup-title'>钢筋检测详情</p>",
            area: ['13rem', '75%'],
            content: $('#popup-info'),
            end: function () {
                $("#popup-info").css('display', 'none');
            }
        });
    },
    imgView(index, index2, index3) {
        var arr = this.data[index].flow_list[index2].file_list;
        $("#swiper .swiper-wrapper").html("");
        $("#swiper").removeClass("hidden");
        for (var i = 0; i < arr.length; i++) {
            $("#swiper .swiper-wrapper").append('<div class="swiper-slide"><img src="' + arr[i].file_path + '" /></div>');
        }
        var mySwiper = new Swiper('.swiper-container', {
            navigation: {
                nextEl: '.swiper-button-next',
                prevEl: '.swiper-button-prev',
            },
            observer: true,
            observeParents: true,
            initialSlide: index3
        });
    },
    swiperHide() {
        $("#swiper").addClass("hidden");
    }
}

function mouseover(index, e) {
    var arr = [];
    for (i in detail.ysjl_list[index]) {
        if (i != 'jc_data21' && i != 'test_status') {
            arr.push(detail.ysjl_list[index][i]);
        }
    }
    $("#hoverInfo").html(`
        ${arr.map(item2 => {
        return (`
                    <div>${item2}</div>
                `);
    }).join('')
        }
    `);
    setTimeout(() => {
        var divW = $("#hoverInfo").width();
        var screenW = $(window).width();
        if (e.clientX + divW > screenW) {
            $("#hoverInfo").css("left", 'auto').css("right", 0).css("top", e.clientY + 10 + 'px').removeClass("hidden");
        } else {
            $("#hoverInfo").css("left", e.clientX + 10 + 'px').css("right", 'auto').css("top", e.clientY + 10 + 'px').removeClass("hidden");
        }
    }, 50);
}
function mouseout() {
    setTimeout(() => {
        $("#hoverInfo").addClass("hidden").css("left", 0).css("right", 0).css("top", 0);
    }, 50);
}

function listClick(id) {
    var flag = $("#" + id + " .item-main").hasClass("hidden");
    $("#rwList .item-head").removeClass("active");
    $("#" + id + " .item-head").addClass("active");
    if (flag) {
        $("#rwList .item-main").addClass("hidden");
        $("#rwList .item-head").removeClass("headHover");
        $("#" + id + " .item-head").addClass("headHover");
        $("#" + id + " .item-main").removeClass("hidden");
    } else {
        $("#rwList .item-head").removeClass("headHover");
        $("#rwList .item-main").addClass("hidden");
    }
}

function sublistClick(id) {
    var flag = $("#" + id + " .item-main").hasClass("hidden");
    if (flag) {
        $("#subrwList .item-main").addClass("hidden");
        $("#subrwList .item-head").removeClass("headHover");
        $("#" + id + " .item-head").addClass("headHover");
        $("#" + id + " .item-main").removeClass("hidden");
    } else {
        $("#subrwList .item-head").removeClass("headHover");
        $("#subrwList .item-main").addClass("hidden");
    }
}

init();
function init() {
    getHeader();
    // layui.use(['layer', 'laydate'], function () {
    //     var laydate = layui.laydate;
    //     laydateObj = laydate.render({
    //         elem: '#rw-date'
    //         , value: getNextDate(dateFormat('YYYY-mm-dd', new Date()), 0)
    //         , done: function () {
    //             taskList.init();
    //         }
    //     });
    // })
    layui.use(['form', 'layer', 'laydate'], function () {
        var form = layui.form;
        var layer = layui.layer;
        form.verify({
            title: function (value) {
                if (value.length < 5) {
                    return '标题至少得5个字符啊';
                }
            }
            , pass: [
                /^[\S]{6,12}$/
                , '密码必须6到12位，且不能出现空格'
            ]
            , content: function (value) {
                layedit.sync(editIndex);
            }
        });
        form.on('submit(submit-unusual)', function (data) {
            var finalData = $.extend($.extend({
                action: 1,
                screen_kind: 5,
            }, getBottomData.formData), data.field)
            $.ajax({
                url: baseURL_Utility + "UnusualHandle.ashx",
                type: "post",
                dataType: "json",
                data: finalData,
                success: function (data) {
                    console.log(data)
                    if(data.status == 200){
                        layer.msg('已录入', {icon: 0}, function(){});
                        setTimeout(() => {
                            layer.closeAll();
                        }, 1000);
                        
                    }else{
                        layer.msg(data.msg, {icon: 0}, function(){});
                    }
                },
                error: function (jqXHR) {
                    console.log("发生错误：" + jqXHR.status);
                }
            })

            return false;
        });
    })
    taskList.init();
    testCount.init();
}