
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page language="java" contentType="text/html; charset=utf-8"
        pageEncoding="utf-8" %>
<%@ include file="header.jsp" %>


<link rel="stylesheet" type="text/css" href="<%=webpath%>/css/printOut.css"/>
<script type="text/javascript" src="<%=webpath%>/js/business/cases.js"></script>
<script type="text/javascript" src="<%=webpath%>/js/DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="<%=webpath%>/js/jquery.jqprint-0.3.js"></script>
<script src="http://www.jq22.com/jquery/jquery-migrate-1.2.1.min.js"></script>
<style media="print">
    .Noprint {
        display: none;
    }

    .PageNext {
        page-break-after: always;
    }
    table.searchTable td:nth-last-child(1){
        width:40%;
    }
</style>
<script type="text/javascript">
    function query() {
        var queryParams = {};
        var license = $("#license").val();
        var frame_code = $("#frame_code").val();
        var caseCode = $("#caseCode").val();
        var createTime = $("#createTime").val();
        var finishTime = $("#finishTime").val();
        var companyName = $("#companyName").val();
        var rescueState = $("#rescueState").val();
        var state = parseInt(${state});

        if ((license == null || license == '') && (frame_code == null || frame_code == '') && (caseCode == null || caseCode == '') &&
                (finishTime == null || finishTime == '') && (createTime == null || createTime == '') && (companyName == null || companyName == '') && rescueState == '0') {
            alert("查询条件不能为空");
            return;
        }
        queryParams['state'] = state;
        queryParams['license'] = license;
        queryParams['frame_code'] = frame_code;
        queryParams['caseCode'] = caseCode;
        queryParams['createTime'] = createTime;
        queryParams['finishTime'] = finishTime;
        queryParams['companyName'] = companyName;
        queryParams['rescueState'] = rescueState;
        queryCouponList("<%=path%>/casesInfo/caseFirstQuery.do", queryParams);;

    }
    function clearVal() {
        $("#frame_code").val("");
        $("#license").val("");
        $("#caseCode").val("");
        $("#createTime").val("");
        $("#finishTime").val("");
    }

    function clearValState1() {
        $("#license").val("");
        $("#frame_code").val("");
        $("#caseCode").val("");
        $("#createTime").val("");
        $("#finishTime").val("");
        $("#companyName").val("");
        $("#rescueState").val("0");
    }

    $(window).ready(function () {
        var frame_code = $("#frame_code").val();
        var caseCode = $("#caseCode").val();
        var createTime = $("#createTime").val();
        var finishTime = $("#finishTime").val();
        var companyName = $("#companyName").val();
        var rescueState = $("#rescueState").val();
        var queryParams = {};
        queryParams['frame_code'] = frame_code;
        queryParams['caseCode'] = caseCode;
        queryParams['createTime'] = createTime;
        queryParams['finishTime'] = finishTime;
        queryParams['companyName'] = companyName;
        queryParams['rescueState'] = rescueState;
        var state = parseInt(${state});
        queryParams['state'] = state;
        queryCouponList("<%=path%>/casesInfo/caseFirstQuery.do", queryParams);

        // 日期格式
        /*  $('#createTime').datebox({
         formatter: function (date) {
         var y = date.getFullYear();
         var m = date.getMonth() + 1;
         var d = date.getDate();
         return y+'/'+m + '/' + d;
         },

         editable:false
         }); */

// 日期格式
        /* $('#finishTime').datebox({
         formatter: function (date) {
         var y = date.getFullYear();
         var m = date.getMonth() + 1;
         var d = date.getDate();
         return y+'/'+m + '/' + d ;
         },
         editable:false
         }); */
    })

    //导出数据
    function expordata() {
        var frame_code = $("#frame_code").val();
        var caseCode = $("#caseCode").val();
        var createTime = $("#createTime").val();
        var finishTime = $("#finishTime").val();
        var params = {};
        params["frame_code"] = frame_code;
        params["caseCode"] = caseCode;
        params["createTime"] = createTime;
        params["finishTime"] = finishTime;
        var checkurl = $("#paths").val() + "/casesInfo/exportData.do";
        //刷新列表
        var data = ajaxgetresultpost(checkurl, params);
        if (data.result == 1) {
            $.messager.alert("提示", data.msg);
        } else {
//            var regex =/[\u4E00-\u9FA5]+/;
//            var str = data.webUrl;
//            var tempUserName = decodeURIComponent(decodeURIComponent(str.match(regex)));
//            alert(tempUserName);
//            var ss = {};
//            ss = str.split(regex);
//            var newPath = ss[0] + tempUserName + ss[1];
//            alert(newPath);
            window.open(data.webUrl);
        }

    }

    //导出数据
    function expordataCSV() {
        var frame_code = $("#frame_code").val();
        var caseCode = $("#caseCode").val();
        var createTime = $("#createTime").val();
        var finishTime = $("#finishTime").val();
        var params = {};
        params["frame_code"] = frame_code;
        params["caseCode"] = caseCode;
        params["createTime"] = createTime;
        params["finishTime"] = finishTime;
        var checkurl = $("#paths").val() + "/casesInfo/exportDataCSV.do";
        //刷新列表
        var data = ajaxgetresultpost(checkurl, params);
        if (data.result == 1) {
            $.messager.alert("提示", data.msg);
        } else {
            window.open(data.webUrl);
        }

    }

</script>
<input type="hidden" id="paths" value="<%=path%>"/>
<!--希望打印时不显示的内容设置class="Noprint"样式-->
<!--IE内置打印控件IEWebBrowser-->
<OBJECT id="wb" height="0" width="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" name="wb"></OBJECT>
<div id="main" class="Noprint">
    <div class="search">
            <table class="searchTable">
                <tbody>
                <tr>
                    <td style="position:relative;">
                        <span class="inputTitle"> 案件编号:</span>
                        <span id="input34Wrap">
                    <input id="caseCode" name="endSubmitDate"
                           type="text" value=""
                           class="mc-ipt-text hasDatepicker"
                           style=""/><span class="mc-ipt"
                                           style="width:90%;"><span
                                id="input33Tip" class="mc-ipt-tip-query"
                                style="font-size: 11px; line-height: 40px; height: 40px;"></span></span></span></td>

                    <!-- <td><b><font><font>VIN码</font></font></b></td> -->
                    <td style="position:relative;">
                        <span class="inputTitle"> VIN码: </span>
                        <span id="input34Wrap">
                    <input id="frame_code" name="endSubmitDate"
                           type="text" value=""
                           class="mc-ipt-text hasDatepicker"
                           style=""/><span class="mc-ipt"
                                           style="width:90%;"><span
                                id="input33Tip" class="mc-ipt-tip-query"
                                style="font-size: 11px; line-height: 40px; height: 40px;"></span></span></span></td>

                    <!-- <td><b><font><font>客户手机号</font></font></b></td> -->
                    <td style="position:relative;">
                        <span class="inputTitle"> 救援状态: </span>
                        <span id="input34Wrap">
                     <select id="rescueState"
                             class="selector" tabindex="-1" aria-hidden="true">
                                    <option value="0">---请选择---</option>
                                    <option value="1">救援中</option>
                                    <option value="2">救援完成</option>
                                    <option value="3">取消服务</option>
                            </select><span style="width:90%;"><span
                                id="input33Tip" class="mc-ipt-tip-query"
                                style="font-size: 11px; line-height: 40px; height: 40px;"></span></span></span></td>

                    <td>
                        <button class="t-button searchBtn" id="CaseInfoList2btnCtClear" type="button"
                                onclick="clearValState1();"><img class="searchIcon" src="../images/clear.png">清空
                        </button>
                        <button class="t-button searchBtn" style="margin-right:10px;" id="CaseInfoList2btnCtSearch"
                                type="button" onclick="query();"><img class="searchIcon" src="../images/search.png">搜索
                        </button>

                        <!--
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <button class="t-button" id="CaseInfoList2btnCtSearch" type="button" onclick="query();">
                                <font><font>
                                    &nbsp;&nbsp;搜 索&nbsp;&nbsp;</font></font></button> -->
                    </td>

                </tr>
                <tr>
                    <td style="position:relative;">
                        <span class="inputTitle">  服务商名称:</span>
                        <span id="input34Wrap">
	                    <input id="companyName" name="endSubmitDate"
                               type="text" value=""
                               class="mc-ipt-text hasDatepicker"
                               style=""/><span class="mc-ipt"
                                               style="width:90%;"><span
                                id="input33Tip" class="mc-ipt-tip-query"
                                style="font-size: 11px; line-height: 40px; height: 40px;"></span></span></span>
                    </td>
                    <td>
                        <span class="inputTitle"> 开始日期: </span>
                        <input type="text" id="createTime" class="Wdate" readonly="readonly"
                               onfocus="WdatePicker({errDealMode:2,readOnly:true,startDate:'%y-%M-%d %H:%m:%s',dateFmt:'yyyy/MM/dd',maxDate:'#F{$dp.$D(\'finishTime\')||\'%y-%M-%d\'}'})"
                               style="cursor:pointer;"/>
                    </td>

                    <td>
                        <span class="inputTitle"> 结束日期: </span>
                        <input type="text" id="finishTime" class="Wdate" readonly="readonly"
                               onfocus="WdatePicker({errDealMode:2,readOnly:true,startDate:'%y-%M-%d %H:%m:%s',dateFmt:'yyyy/MM/dd',maxDate:'%y-%M-%d',minDate:'#F{$dp.$D(\'createTime\')}'})"
                               style="cursor:pointer;"/>
                    </td>

                    <!-- <td><b><font><font>经销商名称</font></font></b></td> -->


                </tr>
                </tbody>
            </table>
    </div>
    <table id="datatable"></table>
</div>
<div class="order_print" style="display: none">
    <div class="printWrap">
        <div class="printTitle Noprint">
            救援完成确认
            <a class="printBtn" onclick="printOut()">打印</a>
            <a class="printClose"><img src="<%=path%>/images/close.png" alt=""></a>
        </div>
        <div class="printCon">
            <form>
                <table class="PrintCase"></table>
                <hr/>
                <table class="saveDetail"></table>
                <table class="sign"></table>
            </form>
        </div>
    </div>
</div>
<script>
    $(".printClose").on("click", function () {
        $(".order_print").hide();
    })

    //    function  print(){
    //        $(".printCon").jqprint();
    //    }
    // 打印
    function printOut() {
        var explorer = window.navigator.userAgent;
// //firefox 浏览器
//         else if (explorer.indexOf("Firefox") >= 0) {
//             alert("Firefox浏览器");
//         }
//Chrome浏览器
        if (explorer.indexOf("Chrome") >= 0) {
            $(".printCon").jqprint();
        } else {
            $("#menucontainer").addClass("Noprint");
            $("#header").addClass("Noprint");
            wb.execwb(8, 1);
            wb.execwb(6, 1);
        }
    }
</script>
<%@ include file="footer.jsp" %>