Commit dd2148d2 by 黄明步

完成调用记录导出

parent a7d44850
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>ocr应用能力调用记录</title> <title>ocr应用能力调用记录</title>
<link rel="stylesheet" href="layui/css/layui.css" media="all"> <link rel="stylesheet" href="layui/css/layui.css" media="all">
<script src="js/FileSaver.min.js"></script>
<style> <style>
html, body { html, body {
width: 100%; width: 100%;
...@@ -81,7 +82,7 @@ ...@@ -81,7 +82,7 @@
</script> </script>
<script> <script>
var list, table, form, condition = {}; var list, table, form, condition = {};
let courtList = []; let courtList = [], formData;
layui.use(['laydate', "table", "form"], function () { layui.use(['laydate', "table", "form"], function () {
var laydate = layui.laydate var laydate = layui.laydate
table = layui.table; table = layui.table;
...@@ -198,31 +199,49 @@ ...@@ -198,31 +199,49 @@
table.on("toolbar(recordList)", function (obj) { table.on("toolbar(recordList)", function (obj) {
if (obj.event === "exports") { if (obj.event === "exports") {
layer.confirm('由于当前数据量过大,仅支持导出10000条记录,是否继续?', {icon: 3}, function(index){
// 在确认按钮点击时关闭确认框
layer.close(index);
let loadIndex = layer.load(2);
handleFormData()
$.ajax({ $.ajax({
url: gatewayUrl + "/appAbilityRecordAll/getList", url: gatewayUrl + "/appAbilityRecordAll/exportRecord",
data: condition, data: formData,
type: "post", type: "post",
xhrFields: {
responseType: 'blob' // 设置响应类型为二进制流
},
success: function (data) { success: function (data) {
table.exportFile(list.config.id, data); let blob = new Blob([data], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'});
saveAs(blob, '应用能力调用记录.xlsx');
layer.close(loadIndex)
}, },
error: function () { error: function () {
layer.msg("导出数据失败!", {icon: 2}); layer.close(loadIndex)
layer.msg("数据量过大,导出数据失败!", {icon: 2});
} }
}) })
}, function(){
layer.msg('已取消导出');
});
} }
}); });
function search() { function search() {
let formData = form.val("searchForm") handleFormData()
list.reload({
where: formData
, page: {curr: 1}
})
}
function handleFormData() {
formData = form.val("searchForm")
formData.ipScope = "" formData.ipScope = ""
courtList.filter(item => item.courtCode === parseInt(formData.courtCode)).forEach(item => { courtList.filter(item => item.courtCode === parseInt(formData.courtCode)).forEach(item => {
// 如果法院ipScope为空的,则默认赋值为'255.255.255.255' 并添加到formData中 // 如果法院ipScope为空的,则默认赋值为'255.255.255.255' 并添加到formData中
formData.ipScope = item.ipScope ? item.ipScope : "255.255.255.255" formData.ipScope = item.ipScope ? item.ipScope : "255.255.255.255"
}) })
list.reload({
where: formData
, page: {curr: 1}
})
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment