新增用户数据导入导出功能,支持导入数据更新
This commit is contained in:
@@ -10,6 +10,15 @@
|
||||
<% if(hasPermi('sys:empUser:edit')){ %>
|
||||
<a href="${ctx}/sys/empUser/form?op=add" class="btn btn-default btnTool" title="${text('新增用户')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
|
||||
<% } %>
|
||||
<div class="btn-group">
|
||||
<a href="javascript:" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="fa fa-navicon"></i> <span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="javascript:" id="btnExport"><i class="glyphicon glyphicon-export"></i> 导出</a></li>
|
||||
<li><a href="javascript:" id="btnImport"><i class="glyphicon glyphicon-import"></i> 导入</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
@@ -17,7 +26,7 @@
|
||||
data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
|
||||
<div class="form-group">
|
||||
<label class="control-label">${text('账号')}:</label>
|
||||
<div class="control-inline">
|
||||
<div class="control-inline">
|
||||
<#form:input path="loginCode" maxlength="100" class="form-control width-90"/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -85,7 +94,7 @@
|
||||
<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
</#form:form>
|
||||
<table id="dataGrid"></table>
|
||||
<div id="dataGridPage"></div>
|
||||
</div>
|
||||
@@ -149,4 +158,61 @@ $('#dataGrid').dataGrid({
|
||||
|
||||
}
|
||||
});
|
||||
</script>
|
||||
$('#btnExport').click(function(){
|
||||
js.ajaxSubmitForm($('#searchForm'), {
|
||||
url:'${ctx}/sys/empUser/exportData',
|
||||
downloadFile:true
|
||||
});
|
||||
});
|
||||
$('#btnImport').click(function(){
|
||||
js.layer.open({
|
||||
type: 1,
|
||||
area: ['400px'],
|
||||
title: '导入用户数据',
|
||||
resize: false,
|
||||
scrollbar: true,
|
||||
content: js.template('importTpl'),
|
||||
success: function(layero, index){
|
||||
layero.find('input[type="checkbox"]').iCheck();
|
||||
},
|
||||
btn: ['<i class="fa fa-check"></i> 导入',
|
||||
'<i class="fa fa-remove"></i> 取消'],
|
||||
btn1: function(index, layero){
|
||||
var form = {
|
||||
inputForm: layero.find('#inputForm'),
|
||||
file: layero.find('#file').val()
|
||||
};
|
||||
if (form.file == '' || (!js.endWith(form.file, '.xls') && !js.endWith(form.file, '.xlsx'))){
|
||||
js.showMessage("${text('文件不正确,请选择后缀为 “xls”或“xlsx”的文件。')}", null, 'warning');
|
||||
return false;
|
||||
}
|
||||
js.ajaxSubmitForm(form.inputForm, function(data){
|
||||
js.showMessage(data.message);
|
||||
if(data.result == Global.TRUE){
|
||||
js.layer.closeAll();
|
||||
}
|
||||
page();
|
||||
}, "json");
|
||||
return true;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script id="importTpl" type="text/template">//<!--
|
||||
<form id="inputForm" action="${ctx}/sys/empUser/importData" method="post" enctype="multipart/form-data"
|
||||
class="form-horizontal mt20 mb10" style="overflow:auto;max-height:200px;">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-xs-offset-1">
|
||||
<input type="file" id="file" name="file" class="form-file"/>
|
||||
<div class="mt10 pt5">
|
||||
<#form:checkbox name="updateSupport" label="${text('否更新已经存在的用户数据')}" class="form-control"
|
||||
title="${text('如果用户编码已经存在,更新这条数据。')}"/>
|
||||
<a href="${ctx}/sys/empUser/importTemplate" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> ${text('下载模板')}</a>
|
||||
</div>
|
||||
<font color="red" class="pull-left mt10">
|
||||
${text('提示:仅允许导入“xls”或“xlsx”格式文件!')}
|
||||
</font>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
//--></script>
|
||||
Reference in New Issue
Block a user