//2017-06-23
//雷玉景
//打印

var OID = "";
var OIDT = 0;
var OIDList = new Array();
var key = " MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCa4KHNwDX44gGmmIAtRu4gjVYtGWZzcm4t+1wjUD4dn7fMLPvuK7ai4UrfDeEJE1RPwudJw+lJ6crql8wSIg7/DbTlG3ihsCT6dT9H5B9OoeR7K9VWUesaW/iyVL6HXiYOANabW14pvJATDmdq91Tfgp6PSQyvdfiRdV4r07crpQIDAQAB";

$(function () {
    //扩展方法获取url参数  
    $.getUrlParam = function (name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return unescape(r[2]); return null;
    }
    OID = $.getUrlParam("OID");

    ShowMain();
});

function ShowMain() {
    var encrypt = new JSEncrypt();
    encrypt.setPublicKey(key);
    var w = encrypt.encrypt("" + uncompileStr(OID) + "");
    $.ajax({
        url: "../action/PrintIndex.ashx?OID=" + encodeURI(w).replace(/\+/g, '%2B'),
        type: "get",
        dataType: 'json',
        data: "{}",
        success: function (data) {
            if (data == true) {
                alert("登录超时,请重新登录!");
                window.top.location.href = '../htm/login.html';
            }
            else {
                if (data.s.length > 0) {
                    var liststr = "";
                    $.each(data.s, function (i, item) {
                        ShowContent();
                        $("#ShouLiBianMa").html(item.BillNo);
                        $("#sxlx").html(item.ShiXiangMingCheng);

                        $("#ZhengJianType").html(item.ZhengJianType);
                        $("#ZhengJianHao").html(item.ZhengJianHao);
                        $("#ShenQingRen").html(item.ShenQingRen);
                        $("#ShenQingRenEN").html(item.ShenQingRenEN);
                        $("#ShengRi").html(item.ShengRi);
                        $("#XingBie").html(item.XingBie);
                        $("#MinZu").html(item.MinZu);
                        $("#GuoJia").html(item.GuoJia);
                        $("#HuKouSuoZaiDi").html(item.HuKouSuoZaiDi);
                        $("#XueLi").html(item.XueLi);
                        $("#XueLiQuanRiZhi").html(item.XueLiQuanRiZhi);
                        $("#XueLiZaiZhi").html(item.XueLiZaiZhi);
                        $("#RenCaiLeiBie").html(item.RenCaiLeiBie);
                        $("#RenCaiChengHao").html(item.RenCaiChengHao);
                        $("#YouXiang").html(item.YouXiang);
                        $("#DianHua").html(item.DianHua);
                        $("#ShouJi").html(item.ShouJi);
                        $("#YuanDanWei").html(item.YuanDanWei);
                        $("#YuanZhiCheng").html(item.YuanZhiCheng);
                        $(":checkbox[name='YinJinLeiXing'][value='" + item.YinJinLeiXing + "']").attr("checked", "checked");

                        if (item.yinjinleixing == "柔性引进") {
                            $(":checkbox[name='QianYueQiXian'][value='" + item.QianYueQiXian + "']").attr("checked", "checked");
                        }
                        $("#ZhiCheng").html(item.ZhiCheng);
                        $("#DanWei").html(item.DanWei);
                        $("#BanLiBuMen").html(item.DanWei);
                        $("#DiZhi").html(item.DiZhi);
                        $("#HangYe").html(item.HangYe);
                        $("#FaRen").html(item.FaRen);
                        $("#LianXiRen").html(item.LianXiRen);
                        $("#LianXiDianHua").html(item.LianXiDianHua);

                        $("#YuanHuKou").html(item.YuanHuKou);
                        $("#YuanHuKouDiZhi").html(item.YuanHuKouDiZhi);
                        $("#HuKou").html(item.HuKou);
                        $("#HuKouDiZhi").html(item.HuKouDiZhi);
                        if (item.Img != "") {
                            $("#Img").val(item.Img);
                            $('.user_pic img').attr('src', 'data:image/jpeg;base64,' + item.Img);
                        }
                        var aa = htmlDecodeByRegExp(item.GZShiJian);
                        var bb = htmlDecodeByRegExp(item.JLMingCheng)
                        $("#GZShiJian").html(aa);
                        $("#JLMingCheng").html(bb);
                    });
                } else {
                    layer.msg('非法操作', { icon: 4 });
                }
            }
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            $('body').dialogBox({
                hasMask: true, hasClose: true, effect: 'sign', hasBtn: true, confirmValue: '确定', title: '提示', content: "数据加载失败!"
            });
        }
    });
};

/*1.用正则表达式实现html转码*/
function htmlEncodeByRegExp(str) {
    var s = "";
    if (str.length == 0) return "";
    s = str.replace(/&/g, "&amp;");
    s = s.replace(/</g, "&lt;");
    s = s.replace(/>/g, "&gt;");
    s = s.replace(/ /g, "&nbsp;");
    s = s.replace(/\'/g, "&#39;");
    s = s.replace(/\"/g, "&quot;");
    return s;
}

/*2.用正则表达式实现html解码*/
function htmlDecodeByRegExp(str) {
    var s = "";
    if (str.length == 0) return "";
    s = str.replace(/&amp;/g, "&");
    s = s.replace(/&lt;/g, "<");
    s = s.replace(/&gt;/g, ">");
    s = s.replace(/&nbsp;/g, " ");
    s = s.replace(/&#39;/g, "\'");
    s = s.replace(/&quot;/g, "\"");
    return s;
}

function dy() {
    $('a.print-preview').printPreview();
};


function ShowContent() {
    var str = '';
    //str += '<input type="button" style="background:#36b6f9;border:0;height:30px;width:80px;font-size:14px;color:#fff;margin-left:15px;" value="打印表单" onClick="Preview()">';
    str += '<div id="aside" class="grid_3 push_1"><a class="print-preview" onclick="dy()">打印表单</a></div>';

    str += ' <!-- 打印表单信息 -->';
    str += '<div id="content-main" class="grid_8">';
    str += '<div id="feature">';
    str += '             <div id="sqr" >';// style="font-size:5px;font-family:"FangSong_GB2312";"
    str += '                 <div id="div_form" style="background: rgb(255, 255, 255); width: 100%; padding-top: 10px; padding-bottom: 10px;">';

    str += '                     <div align="center"><span id="formTitle" style="color: rgb(0, 0, 0); font-size:30px; font-weight: bold;height:80px;line-height:80px;font-family:"方正小标宋简体","FZXiaoBiaoSong-B05S FZXBSJW FZXBSJW—GB1-0 7156"">燕赵英才卡（A卡）申请表</span></div>';
    str += '                        <table  class="delbor"border="0" style="border:0; border-image: none; width: 100%;">';
    str += '                            <tbody><tr>';
    str += '                              <td style="width:15%"><div align="left">填报单位：</div></td>';
    str += '                              <td style="width:50%;"><div align="left" id="BanLiBuMen"></div></td>';
    str += '                              <td style="width:10%"><div align="center">编  号：</div></td>';
    str += '                              <td style="width:20%"><div id="ShouLiBianMa"></div></td>';
    str += '                            </tr>';
    str += '                        </tbody></table>';
    str += '                      </div>';

    str += '<div class="applicant-info-bd" style="width:100%;margin:0 auto;">';
    str += '                    <table  class="table"id="TableInfo" border="1" style="border-collapse: collapse;border-color:#000;">';
    str += '                         <tbody>';
    str += '                             <tr>';
    str += '                             <td style="width:2em;border: 1px solid #000 !important;" rowspan="16" align="center">基本情况</td>';
    str += '                               <td rowspan="2" width="15%" style="border: 1px solid #000 !important;"><div align="center">姓名</div></td>';
    str += '                               <td style="border: 1px solid #000 !important;"><div align="center">中文</div></td>';
    str += '                               <td colspan="4" style="width:300px;border: 1px solid #000 !important;" class="detail"><div align="center" id="ShenQingRen"></div></td>';
    str += '                               <td style="width:15%;border: 1px solid #000 !important;" rowspan="5">';
    str += '         <div class="user_pic" style="text-align:center;" id="Img">';
    str += '           <img src="../../Content/Scripts/cropper/css/avatar.png" class="btn"  style="width:auto; height:150px; padding:0;"data-target="#avatar-modal" data-toggle="modal"/>';
    str += '         </div>';
    str += '          </td>';
    str += '        </tr>';
    str += '        <tr>';
    str += '          <td style="border: 1px solid #000 !important;"><div align="center">英文</div></td>';
    str += '          <td class="detail" colspan="4" style="border: 1px solid #000 !important;"><div align="center" id="ShenQingRenEN"></div></td>';
    str += '        </tr>';
    str += '        <tr>';
    str += '          <td style="border: 1px solid #000 !important;"><div align="center">性别</div></td>';
    str += '          <td style="border: 1px solid #000 !important;" class="detail"><div align="center" id="XingBie"></div></td>';
    str += '          <td style="width:50px;border: 1px solid #000 !important;"><div align="center">民族</div></td>';
    str += '          <td class="detail" style="width:50px;border: 1px solid #000 !important;"><div align="center" id="MinZu"></div></td>';
    str += '          <td style="width:100px;border: 1px solid #000 !important;"><div align="center">出生日期</div></td>';
    str += '          <td class="td_detail" style="width:100px;border: 1px solid #000 !important;"><div align="center" id="ShengRi"></div></td>';
    str += '        </tr>';
    str += '        <tr>';
    str += '          <td style="border: 1px solid #000 !important;"><div align="center">国籍/籍贯</div></td>';
    str += '          <td class="td_detail" style="border: 1px solid #000 !important;"><div align="center" id="GuoJia"></div></td>';
    str += '          <td colspan="2" style="border: 1px solid #000 !important;"><div align="center">本市居住地</div></td>';
    str += '          <td class="detail" colspan="2" style="border: 1px solid #000 !important;"><span class="td_detail"><div align="center" id="HuKouSuoZaiDi"></div></span></td>';
    str += '        </tr>';
    str += '        <tr>';
    str += '          <td rowspan="2" style="border: 1px solid #000 !important;"><div align="center">学历学位</div></td>';
    str += '          <td rowspan="2" style="border: 1px solid #000 !important;" class="detail"><div align="center" id="XueLi"></div></td>';
    str += '          <td rowspan="2" style="border: 1px solid #000 !important;" colspan="2"><div align="center">毕业院校及专业</div></td>';
    str += '         <td style="border: 1px solid #000 !important;"><div align="center">全日制教育</div></td>';
    str += '          <td class="detail" style="border: 1px solid #000 !important;"><div align="center" id="XueLiQuanRiZhi"></div></td>';
    str += '         </tr>';
    str += '        <tr>';
    str += '          <td colspan=""style="border: 1px solid #000 !important;"><div align="center">在职教育</div></td>';
    str += '          <td class="detail" colspan="2" style="border: 1px solid #000 !important;"><div align="center" id="XueLiZaiZhi"></div></td>';
    str += '         </tr>';
    str += '         <tr>';
    str += '             <td id="slsj_td0"  style="border: 1px solid #000 !important;">';
    str += '                 <div align="center">人才类别</div>';
    str += '             </td>';
    str += '             <td colspan="3" class="td_detail" style="border: 1px solid #000 !important;"><div align="center" id="RenCaiLeiBie"></div></td>';
    str += '           <td style="border: 1px solid #000 !important;"><div align="center">人才称号</div></td>';
    str += '           <td class="td_detail" colspan="2" style="border: 1px solid #000 !important;"><div align="center" id="RenCaiChengHao"></div></tr>';
    str += '         <tr>';
    str += '             <td  style="border: 1px solid #000 !important;">';
    str += '                 <div align="center">证件类型</div>';
    str += '             </td>';
    str += '             <td colspan="3" class="detail" style="border: 1px solid #000 !important;">';
    str += '                 <div align="center" id="ZhengJianType"></div>';
    str += '             </td>';
    str += '             <td style="border: 1px solid #000 !important;">';
    str += '                 <div align="center">证件号码</div>';
    str += '             </td>';
    str += '             <td colspan="2" class="detail" style="border: 1px solid #000 !important;"><div align="center" id="ZhengJianHao"></div></td>';
    str += '         </tr>';
    str += '         <tr>';
    str += '             <td rowspan="3" style="border: 1px solid #000 !important;">';
    str += '                 <div align="center">联系方式</div>';
    str += '             </td>';
    str += '             <td colspan="3" style="border: 1px solid #000 !important;">';
    str += '                 <div align="center">固定电话</div>';
    str += '             </td>';
    str += '             <td colspan="4" class="td_detail" style="border: 1px solid #000 !important;">';
    str += '                 <div align="center" id="DianHua"></div>';
    str += '             </td>';
    str += '         </tr>';
    str += '         <tr>';
    str += '             <td colspan="3" style="height:17px;border: 1px solid #000 !important;">';
    str += '                 <div align="center">手机号码</div>';
    str += '             </td>';
    str += '             <td colspan="4" class="td_detail" style="height:17px;border: 1px solid #000 !important;">';
    str += '                 <div align="center" id="ShouJi"></div>';
    str += '              </td>';
    str += '         </tr>';
    str += '         <tr>';
    str += '           <td colspan="3" style="height:17px;border: 1px solid #000 !important;"><div align="center">电子邮箱</div></td>';
    str += '           <td colspan="4" class="td_detail" style="height:17px;border: 1px solid #000 !important;"><div align="center" id="YouXiang"></div></td>';
    str += '         </tr>';
    str += '         <tr>';
    str += '         <td rowspan="4" style="border: 1px solid #000 !important;">引进人才（方框内划“√”）</td>';
    str += '             <td colspan="3" style="height:17px;border: 1px solid #000 !important;">';
    str += '                 <div align="center">原工作单位职务、职称</div>';
    str += '             </td>';
    str += '             <td colspan="4" class="td_detail" style="height:17px;border: 1px solid #000 !important;"><div align="center" id="YuanDanWei"></div></td>';
    str += '         </tr>';
    str += '         <tr>';
    str += '             <td colspan="3" style="height:17px;border: 1px solid #000 !important;">';
    str += '                 <div align="center">现工作单位职务</div>';
    str += '             </td>';
    str += '             <td colspan="4" class="td_detail" style="height:17px;border: 1px solid #000 !important;"><div align="center" id="YuanZhiCheng"></div></td>';
    str += '         </tr>';
    str += '         <tr>';
    str += '             <td colspan="6" style="height:17px;border: 1px solid #000 !important;">';
    str += '                     <label style="float: left;">';
    str += '                     <input style="float:left" type="checkbox" name="YinJinLeiXing" id="YinJinLeiXing1" value="刚性引进" disabled="disabled"/>刚性引进';
    str += '                     </label>';
    str += '             </td>';
    str += '         </tr>';
    str += '         <tr>';
    str += '             <td style="height:17px;border: 1px solid #000 !important;">';
    str += '                 <label style="float: left;">';
    str += '                     <input style="float:left" type="checkbox" name="YinJinLeiXing" id="YinJinLeiXing2" value="柔性引进" disabled="disabled"/>柔性引进';
    str += '                 </label>';
    str += '             </td>';
    str += '             <td colspan="2" style="border: 1px solid #000 !important;">';
    str += '                 <div align="center">签约期限</div>';
    str += '             </td>';
    str += '             <td colspan="3" style="border: 1px solid #000 !important;">';
    str += '                 <label style="float: left">';
    str += '                     <input style="float:left" type="checkbox" name="QianYueQiXian" id="QianYueQiXian1" value="三至六个月" disabled="disabled"/><span style="float:left">三至六个月</span></label>';
    str += '                                        <label style="float: left;">';
    str += '                                            <input style="float:left" type="checkbox" name="QianYueQiXian" id="QianYueQiXian2" value="一年" disabled="disabled"/>一年</label>';
    str += '                                        <label style="float: left;">';
    str += '                                            <input style="float:left" type="checkbox" name="QianYueQiXian" id="QianYueQiXian3" value="一年以上" disabled="disabled"/>一年以上</label>';
    str += '                                    </td>';
    str += '                                </tr>';
    str += '                                <tr>';
    str += '                                    <td style="border: 1px solid #000 !important;">';
    str += '                                        <div align="center">自主培养</div>';
    str += '                                    </td>';
    str += '                                    <td style="border: 1px solid #000 !important;">';
    str += '                                        <input type="checkbox" name="YinJinLeiXing" id="YinJinLeiXing3" value="自主培养" disabled="disabled">';
    str += '                                    </td>';
    str += '                                    <td colspan="2" style="border: 1px solid #000 !important;">';
    str += '                                        <div align="center">单位职务及职称</div>';
    str += '                                    </td>';
    str += '                                    <td colspan="3" class="td_detail" style="border: 1px solid #000 !important;"> <div align="center" id="ZhiCheng"></div></td>';
    str += '                                </tr>';
    str += '                                <tr style="height:330px;">';
    str += '                                    <td style="width:2em;border: 1px solid #000 !important;"> <div align="center">学习及工作经历</div></td>';
    str += '                                    <td colspan="7" class="detail" style="border: 1px solid #000 !important;">';
    str += '                                        <div id="GZShiJian"  style="height:330px;overflow:hidden; border:0px solid #000000;"></div></td>';
    //str += '                                </tr>';

    //str += '                                    <tr style="height:180px; min-height:180px;">';
    //str += '                                    <td style="width:2em;border: 1px solid #000 !important;"> <div align="center">成果和奖励情况</div></td>';
    //str += '                                    <td colspan="7" style="border: 1px solid #000 !important;"><div id="JLMingCheng"  style="height:170px;overflow:hidden; border:0px solid #000000;"></div></td>';
    //str += '                                </tr> ';

    str += '                                </tbody>';
    str += '                                 </table>';
    str += '                               <div class= "table-q" style="text-align:center;page-break-before:always; padding-top:30px;">';
    str += '                                   <table  class="table" border="1" style="border-collapse: collapse;border-color:#000;width:100%" >';


    str += '                                <tr style="height:320px;">';
    str += '                                    <td style="border: 1px solid #000 !important;width:4%;"><div align="center">成果和奖励情况</div></td>';
    str += '                                    <td colspan="7" style="border: 1px solid #000 !important;">';
    str += '                                          <div id="JLMingCheng" style="overflow:hidden; border:0px solid #000000;"></div>';
    str += '                                     </td>';
    str += '                                </tr>';

    str += '                                <tr>';
    str += '                                    <td width="4%" rowspan="3" style="border: 1px solid #000 !important;"><div align="center">用<br />人<br />单<br />位<br />情<br />况</div></td>';
    str += '                                    <td width="23%" style="border: 1px solid #000 !important;">';
    str += '                                        <div align="center">名&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;称</div>';
    str += '                                    </td>';
    str += '                                    <td width="25%" colspan="2" style="border: 1px solid #000 !important;">';
    str += '                                        <div align="center" id="DanWei"></div>';
    str += '                                    </td>';
    str += '                                    <td width="23%" colspan="2" style="border: 1px solid #000 !important;">';
    str += '                                        <div align="center">地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;址</div>';
    str += '                                    </td>';
    str += '                                    <td width="25%" colspan="2" style="border: 1px solid #000 !important;"> <div align="center" id="DiZhi"></div></td>';
    str += '                                </tr>';
    str += '                                <tr>';
    str += '                                    <td style="border: 1px solid #000 !important;">';
    str += '                                        <div align="center">性质及所属行业</div>';
    str += '                                    </td>';
    str += '                                    <td colspan="2" style="border: 1px solid #000 !important;"><div align="center" id="HangYe"></div></td>';
    str += '                                    <td colspan="2"  style="border: 1px solid #000 !important;">';
    str += '                                        <div align="center">法人代表</div>';
    str += '                                    </td>';
    str += '                                    <td colspan="2" style="border: 1px solid #000 !important;"><div align="center" id="FaRen"></div></td>';
    str += '                                </tr>';
    str += '                                 <tr>';
    str += '                                    <td style="border: 1px solid #000 !important;">';
    str += '                                        <div align="center">联 系 人</div>';
    str += '                                    </td>';
    str += '                                    <td colspan="2" style="border: 1px solid #000 !important;"><div align="center" id="LianXiRen"></div></td>';
    str += '                                    <td colspan="2" style="border: 1px solid #000 !important;">';
    str += '                                        <div align="center">联系电话</div>';
    str += '                                    </td>';
    str += '                                    <td colspan="2" style="border: 1px solid #000 !important;"><div align="center" id="LianXiDianHua"></div></td>';
    str += '                                </tr>';

    str += '                                 <tr style="height:160px;">';
    str += '                                    <td colspan="2" style="border: 1px solid #000 !important;"div align="center">用人单位意见</div></td>';
    str += '                                    <td colspan="6" style="border: 1px solid #000 !important;">';
    str += '                                    <div style="height:100px;padding:30px;"></div>';
    str += '                                    <div align="right" class="zhang">';
    str += '                                        <p>（盖章）&nbsp;&nbsp;</p>';
    str += '                                        <p>&nbsp;&nbsp;&nbsp;&nbsp;年&nbsp;&nbsp;&nbsp;&nbsp;月&nbsp;&nbsp;&nbsp;&nbsp;日</p>';
    str += '                                    </div>';
    str += '                                     </td>';
    str += '                                </tr>';
    str += '                                <tr style="height:160px;">';
    str += '                                    <td colspan="2" style="border: 1px solid #000 !important;"><div align="center">主管部门或县（市、区）委组织部意见</div></td>';
    str += '                                    <td colspan="6" style="border: 1px solid #000 !important;">';
    str += '                                     <div  style="height:100px;padding:30px;"></div>';
    str += '                                    <div align="right" class="zhang">';
    str += '                                        <p>（盖章）&nbsp;&nbsp;</p>';
    str += '                                        <p>&nbsp;&nbsp;&nbsp;&nbsp;年&nbsp;&nbsp;&nbsp;&nbsp;月&nbsp;&nbsp;&nbsp;&nbsp;日</p>';
    str += '                                    </div></td>';
    str += '                                </tr>';
    str += '                                <tr style="height:160px;border: 1px solid #000 !important;">';
    str += '                                    <td colspan="2" style="border: 1px solid #000 !important;"><div align="center">市委组织部意见</div></td>';
    str += '                                    <td colspan="6" style="border: 1px solid #000 !important;">';
    str += '                                     <div  style="height:100px;padding:30px;"></div>';
    str += '                                    <div align="right" class="zhang">';
    str += '                                        <p>（盖章）&nbsp;&nbsp;</p>';
    str += '                                        <p>&nbsp;&nbsp;&nbsp;&nbsp;年&nbsp;&nbsp;&nbsp;&nbsp;月&nbsp;&nbsp;&nbsp;&nbsp;日</p>';
    str += '                                    </div></td>';
    str += '                                </tr>';
    str += '                        </table>';
    str += '                        <p>备注：此表一式四份，用人单位、主管部门、市人才英才卡服务窗口、市委组织部各留一份。</p>';
    str += '                                  </div>';
    str += '                </div>';
    str += '                    </div>';

    str += '</div>';
    str += '</div>';

    $("#content").html(str);

    dy();
}