添加打印界面

master
夜笙歌 2 weeks ago
parent 52c4d94226
commit 3432f85357

@ -103,6 +103,14 @@ public class RecordInspectionController extends BaseController {
return prefix + "/add"; return prefix + "/add";
} }
/**
*
*/
@GetMapping("/printHtml")
public String print() {
return prefix + "/print";
}
/** /**
* *
*/ */

@ -0,0 +1,140 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('打印')"/>
</head>
<style>
.printList {
margin-top: 20px;
width: 1000px;
padding: 0 5px;
margin-left: 50%;
transform: translateX(-50%);
}
.printList .item {
width: calc(100% - 2px);
border: 1px solid #3333;
margin-top: 12px;
}
.printList .item .card {
display: inline-block;
width: calc(48% - 2px);
margin: 12px 1% 0 1%;
border: 1px solid #1111;
height: 206px;
}
.printList .item .card .left, .printList .item .card .right {
display: inline-block;
width: calc(50% - 2px);
height: 100%;
vertical-align: top;
}
.printList .item .card .right .image {
width: calc(50% - 2px);
display: inline-block;
height: 100%;
}
.printList .item .card .right .image1 {
width: 100%;
display: inline-block;
height: 100%;
}
.printList .item .card .right .image img, .printList .item .card .right .image1, img {
object-fit: contain;
width: 100%;
height: 100%;
}
</style>
<body>
<div class="printList" id="printList">
<div class="item">
<div style="display: flex; justify-content: space-between;">
<div>巡检时间2020-00-00 000000</div>
<div>巡检数量11</div>
<div>正常数量11</div>
<div>异常数量11</div>
<div>跳过数量11</div>
</div>
<div class="card">
<div class="left">
<div style="height: 100%;display: flex; flex-direction: column;justify-content: space-between;">
<div>机坪名称:1号坪近机位</div>
<div>机位码:111</div>
<div>完成状态:已完成</div>
</div>
</div>
<div class="right">
<div class="image">
<img src="/img/main_bg.png" alt="">
</div>
<div class="image">
<img src="/img/main_bg.png" alt="">
</div>
</div>
</div>
<div class="card">
<div class="left">
<div style="height: 100%;display: flex; flex-direction: column;justify-content: space-between;">
<div>机坪名称:1号坪近机位</div>
<div>机位码:111</div>
<div>完成状态:已完成</div>
</div>
</div>
<div class="right">
<div class="image1">
<img src="/img/main_bg.png" alt="">
</div>
</div>
</div>
</div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
var prefix = ctx + "manage/record_inspection";
let ids = location.search.split('ids=')?.[1]?.split('&')?.[0]
$.get(prefix + "/print", {ids}, (e) => {
e.data.list.forEach((i, k) => {
let cardList = e.data.infolist.filter(v => v.inspectionId === i.inspectionId)
console.log(cardList)
let card = ``
cardList.forEach(v => {
card += `
<div class="card">
<div class="left">
<div style="height: 100%;display: flex; flex-direction: column;justify-content: space-between;">
<div>机坪名称:${v.areaName || ''}</div>
<div>机位码:${v.planePosition || ''}</div>
<div>完成状态:${v.taskState || ''}</div>
</div>
</div>
<div class="right">
<div class="image1">
<img src="${v.imgPath}" alt="">
</div>
</div>
</div>`
})
let html = `
<div class="item">
<div style="display: flex; justify-content: space-between;">
<div>巡检时间:${i.inspectionTime}</div>
<div>巡检数量:${i.totalNumber || 0}</div>
<div>正常数量:${i.normalNumber || 0}</div>
<div>异常数量:${i.abnormalNumber || 0}</div>
<div>跳过数量:${i.skipNumber || 0}</div>
</div>
${card}
</div>`
$('#printList').append(html)
})
});
</script>
</body>
</html>

@ -148,7 +148,6 @@
}, },
columns: [ columns: [
{ {
title: '序号', title: '序号',
formatter: function (value, row, index) { formatter: function (value, row, index) {
@ -183,9 +182,13 @@
// 选中数据 // 选中数据
function checkItem() { function checkItem() {
var arrays = $.table.selectColumns("inspectionId"); var arrays = $.table.selectColumns("inspectionId");
$.modal.openFull('打印','/manage/record_inspection/printHtml?ids='+arrays.toString());
// alert(arrays); // alert(arrays);
var data = {"ids": arrays.toString()}; var data = {"ids": arrays.toString()};
$.operate.submit(prefix + "/print", "get", "json", data); // $.operate.submit(prefix + "/print", "get", "json", data);
// $.get(prefix + "/print",data,(e)=>{
// console.log(e)
// })
} }
</script> </script>

Loading…
Cancel
Save