<!DOCTYPE html>
|
<html lang="en">
|
|
<head>
|
<meta charset="UTF-8">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<style>
|
#table {
|
color: #000;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
flex-direction: column;
|
}
|
|
.excelPrint {
|
width: 100%;
|
text-align: center;
|
margin-top: 50px;
|
}
|
|
.print {
|
/* position: absolute;
|
left: 47%;
|
top: 58%; */
|
width: 7%;
|
height: 30px;
|
border: 0px;
|
border-radius: 6px;
|
color: #fff;
|
background-color: #1D5CE4;
|
letter-spacing: 4px;
|
}
|
|
.user-info-table {
|
margin-top: 30px;
|
width: 90%;
|
height: 90%;
|
border: 1px solid #000;
|
background-color: #fff;
|
}
|
|
.user-info-tr {
|
height: 50px;
|
font-size: 14px;
|
}
|
|
.avatar {
|
width: 140px;
|
height: 190px;
|
}
|
|
.title {
|
margin-top: 20px;
|
font-size: 28px;
|
font-weight: 500;
|
}
|
|
.avatar {
|
width: 140px;
|
height: 190px;
|
}
|
|
.my-picture {
|
width: 150px;
|
/* height: 200px; */
|
}
|
</style>
|
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
|
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
|
</head>
|
|
|
<body>
|
<div>
|
|
<!--startprint-->
|
<div id="table">
|
<!-- <span class="title">准考证信息</span>
|
<table class="user-info-table" border="1px" align="center" cellspacing="0" cellpadding="10">
|
</table> -->
|
</div>
|
<!--endprint-->
|
<div class="excelPrint">
|
<button onclick="preview(1)" class="print">打印</button>
|
</div>
|
</div>
|
<script>
|
var getData = 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;
|
};
|
var id = JSON.parse(getData("data")).examId;
|
var name = JSON.parse(getData("data")).name;
|
// console.log(JSON.parse(getData("data")), 111);
|
|
axios.get('http://223.82.109.183:2080/api/apply/getApplyDetailList?examId=' + id).then(function(res) {
|
// axios.get('http://localhost:81/apply/getApplyDetailList?examId=' + id).then(function(res) {
|
var data = res.data;
|
var list = data.applyList;
|
console.log(data, 123);
|
var str = `<span class="title">${data.examName}</span>
|
<table class="user-info-table" border="1px" align="center" cellspacing="0" cellpadding="10">
|
<tr class="user-info-tr">
|
<td width="80px">姓名</td>
|
<td width="60px">性别</td>
|
<td width="120px">准考证号</td>
|
<td width="160px">身份证号</td>
|
<td width="300px">单位名称</td>
|
<td width="100px">报考证件</td>
|
<td width="200px">报名时间</td>
|
</tr>`
|
|
for (var k in list) {
|
str += `
|
<tr class="user-info-tr">
|
<td>${list[k].realName}</td>
|
<td>${list[k].sex==1?"男":(data.sex==2?"女":"")}</td>
|
<td>${list[k].candidateNo}</td>
|
<td>${list[k].idCardNo}</td>
|
<td>${list[k].deptName}</td>
|
<td>${list[k].applyCard}</td>
|
<td>${list[k].applyTime}</td>
|
</tr>
|
`
|
}
|
|
// <tr class="user-info-tr">
|
// <td></td>
|
// <td></td>
|
// <td></td>
|
// <td></td>
|
// <td></td>
|
// <td></td>
|
// <td></td>
|
// </tr>
|
|
str += ` <tr class="user-info-tr">
|
<td>总人数</td>
|
<td colspan="6">${data.num}人</td>
|
</tr>
|
|
</table>`
|
|
var dom = $('#table');
|
dom.empty();
|
dom.append(str);
|
})
|
|
function preview(oper) {
|
if (oper < 10) {
|
bdhtml = window.document.body.innerHTML;
|
// 打印开始的标志
|
sprnstr = "<!--startprint-->";
|
// 打印结束的标志
|
eprnstr = "<!--endprint-->";
|
// 从打印开始的位置截取到末尾
|
prnhtml = bdhtml.substr(bdhtml.indexOf(sprnstr));
|
// 从开始截取到打印结束的位置
|
prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr));
|
// 替换html
|
window.document.body.innerHTML = prnhtml;
|
// 打印
|
window.print();
|
window.document.body.innerHTML = bdhtml;
|
} else {
|
window.print();
|
}
|
}
|
</script>
|
</body>
|
|
</html>
|