You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
4.1 KiB

3 months ago
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<!-- <link rel="stylesheet" href="../../../lib/layui/css/layui.css"> -->
<link rel="stylesheet" href="../../../../../../component/pear/css/pear.css" />
<style>
.layui-table-tool {
position: relative;
width: 100%;
min-height: 50px;
line-height: 30px;
padding: 0;
padding-bottom: 10px;
border-width: 0;
border-bottom-width: 0px;
border-bottom-width: 1px;
}
</style>
</head>
<body>
<div class="layui-form" action="">
<div class="layui-card-body">
<table id="data-table"></table>
</div>
<script type="text/html" id="table-toolbar">
<button type="button" class="layui-btn layui-btn-sm" lay-event="print"><i
class="layui-icon layui-icon-print" style="font-size: 20px;color: #fff;"></i>&nbsp打印</button>
</script>
</div>
<!-- <script src="../../../lib/layui/layui.js"></script> -->
<script src="../../../../../../component/layui/layui.js"></script>
<script src="../../../../../../component/pear/pear.js"></script>
<script src="../../../lib/base64.js"></script>
<script>
layui.use(['form', 'jquery', 'laytpl', 'table', 'common'], function () {
var form = layui.form;
var common = layui.common;
var $ = layui.jquery;
var laytpl = layui.laytpl
var table = layui.table;
var subjectId = GetQueryString("subject_id");
table.render({
elem: '#data-table',
3 months ago
url: '/dsBase/gtzz/getAvailableDoc?subject_id=' + subjectId,
3 months ago
height: 'full-35',
page: {
limit: 15
, layout: ['count', 'prev', 'page', 'next', 'skip']
, prev: "上一页"
, next: "下一页"
},
cols: [[
{ type: 'checkbox', width: "5%", align: 'center' },
{ title: '阶段', field: 'step_name', width: "45%" },
{ title: '文件名', field: 'file_name', width: "45%" }
]],
toolbar: '#table-toolbar',
defaultToolbar: []
});
table.on('toolbar(data-table)', function (obj) {
if (obj.event === 'print') {
var loading = layer.load();
var fileIds = common.checkField(obj, 'file_id').split(",");
var suffixs = common.checkField(obj, 'suffix').split(",");
var fileSuffixArr = fileIds.map((item, index) => `${item}.${suffixs[index]}`).join(",");
$.ajax({
type: "POST",
async: false,
3 months ago
url: "/dsBase/gtzz/getAllInOnePrintPdf",
3 months ago
data: {
fileNames: fileSuffixArr
},
success: function (data) {
layer.close(loading);
var newWindow = window.open();
newWindow.location.href = data;
},
error: function () {
layer.close(loading);
alert("打印异常请稍后重试或联系管理员!");
}
});
}
});
function GetQueryString(name, istop) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (typeof (istop) != "undefined") r = top.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
}
});
</script>
</body>
</html>