73 lines
2.7 KiB
HTML
73 lines
2.7 KiB
HTML
<!doctype html>
|
||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||
<head>
|
||
<base th:href="${#request.getContextPath() + '/'} ">
|
||
<meta charset="utf-8">
|
||
<meta name="renderer" content="webkit">
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||
</head>
|
||
<body>
|
||
<div class="layui-anim layui-anim-fadein">
|
||
<div class="layui-card" style="text-align: center;">
|
||
<div class="layui-card-body" style="padding: 15px;">
|
||
<blockquote class="layui-elem-quote">第一行为表头,第二行第一列开始为数据,格式为xls或xlsx</blockquote>
|
||
<button type="button" class="layui-btn layui-btn" id="uploadExcel">
|
||
<i class="fa fa-lg fa-cloud-upload"></i> 导入数据
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||
<script>
|
||
layui.config({
|
||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||
}).extend({
|
||
index: 'lib/index' //主入口模块
|
||
}).use(['index', 'upload'], function(){
|
||
var $ = layui.$;
|
||
var form = layui.form;
|
||
|
||
function closeBox() {
|
||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||
}
|
||
|
||
// 初始化Excel上传
|
||
function initExcelUpload() {
|
||
// Excel上传
|
||
var uploadLoading;
|
||
layui.upload.render({
|
||
elem: '#uploadExcel',
|
||
url: 'api/sensitivewords/savesensitivewordsexcel',
|
||
accept: 'file',
|
||
exts: 'xls|xlsx',
|
||
field: 'excel',
|
||
before: function() {
|
||
uploadLoading = layer.msg('正在上传,请稍后...', {icon: 16, time: 0, shade: 0.3});
|
||
},
|
||
done: function(data) {
|
||
layer.close(uploadLoading);
|
||
layer.msg('导入成功', {time: 2000}, function() {
|
||
closeBox();
|
||
});
|
||
},
|
||
error: function(data, index){
|
||
layer.close(uploadLoading);
|
||
if(data != null) {
|
||
top.dialog.msg(data.msg);
|
||
}
|
||
},
|
||
});
|
||
}
|
||
initExcelUpload();
|
||
|
||
$('.close').on('click', function() {
|
||
closeBox();
|
||
});
|
||
});
|
||
</script>
|
||
</body>
|
||
</html> |