代码优化

This commit is contained in:
thinkgem
2019-05-13 23:36:28 +08:00
parent 5da0520832
commit a2d9c846bf
6 changed files with 8 additions and 312 deletions

View File

@@ -1,69 +0,0 @@
<% layout('/layouts/default.html', {title: '附属机构管理', libs: ['validate']}){ %>
<div class="main-content">
<div class="box box-main">
<div class="box-header with-border">
<div class="box-title">
<i class="fa fa-list-alt"></i> ${text(employeeOffice.isNewRecord ? '新增附属机构' : '编辑附属机构')}
</div>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
</div>
</div>
<#form:form id="inputForm" model="${employeeOffice}" action="${ctx}/sys/empOffice/save" method="post" class="form-horizontal">
<#form:hidden path="empCode"/>
<#form:hidden path="isNewRecord"/>
<div class="box-body"><br/>
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label col-sm-2" title="">
<span class="required hide">*</span> ${text('附属机构')}<i class="fa icon-question hide"></i></label>
<div class="col-sm-5">
<#form:treeselect id="office" title="${text('机构选择')}"
path="officeCode" labelPath="officeName" readonly="${!employeeOffice.isNewRecord}"
url="${ctx}/sys/office/treeData?ctrlPermi=${@Global.getConfig('user.adminCtrlPermi', '2')}" class="required" allowClear="false"/>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label col-sm-2" title="">
<span class="required hide">*</span> ${text('岗位编码')}<i class="fa icon-question hide"></i></label>
<div class="col-sm-5">
<#form:select name="postCode" items="${postList}"
itemLabel="postName" itemValue="postCode" class="form-control"/>
</div>
</div>
</div>
</div>
</div>
<div class="box-footer">
<div class="row">
<div class="col-sm-offset-2 col-sm-10">
<% if (hasPermi('sys:empUser:view')){ %>
<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('保 存')}</button>&nbsp;
<% } %>
<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
</div>
</div>
</div>
</#form:form>
</div>
</div>
<% } %>
<script>
$("#inputForm").validate({
submitHandler: function(form){
js.ajaxSubmitForm($(form), function(data){
js.showMessage(data.message);
if(data.result == Global.TRUE){
js.closeCurrentTabPage(function(contentWindow){
contentWindow.page();
});
}
}, "json");
}
});
</script>

View File

@@ -1,53 +0,0 @@
<% layout('/layouts/default.html', {title: '附属机构管理', libs: ['dataGrid']}){ %>
<div class="main-content">
<div class="box box-main">
<div class="box-header">
<div class="box-title">
<i class="fa fa-list-alt"></i> ${text('附属机构管理')}
</div>
<div class="box-tools pull-right">
<a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>
<% if(hasPermi('sys:empUser:view')){ %>
<a href="${ctx}/sys/empOffice/form?empCode=1&isNewRecord=true" class="btn btn-default btnTool" title="${text('新增附属机构')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
<% } %>
</div>
</div>
<div class="box-body">
<#form:form id="searchForm" model="${employeeOffice}" action="${ctx}/sys/empOffice/listData" method="post" class="form-inline hide"
data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
<#form:hidden path="empCode"/>
<div class="form-group">
<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>
<table id="dataGrid"></table>
<div id="dataGridPage"></div>
</div>
</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
searchForm: $("#searchForm"),
columnModel: [
{header:'${text("附属机构")}', name:'officeCode', index:'a.office_code', width:200, align:"center", frozen:true, formatter: function(val, obj, row, act){
return '<a href="${ctx}/sys/empOffice/form?empCode='+row.empCode+'&officeCode='+row.officeCode+'" class="btnList" data-title="${text("编辑附属机构")}">'+(val||row.id)+'</a>';
}},
{header:'${text("岗位编码")}', name:'postCode', index:'a.post_code', width:200, align:"center"},
{header:'${text("操作")}', name:'actions', width:120, sortable:false, title:false, formatter: function(val, obj, row, act){
var actions = [];
<% if(hasPermi('sys:empUser:view')){ %>
actions.push('<a href="${ctx}/sys/empOffice/form?empCode='+row.empCode+'&officeCode='+row.officeCode+'" class="btnList" title="${text("编辑附属机构")}"><i class="fa fa-pencil"></i></a>&nbsp;');
actions.push('<a href="${ctx}/sys/empOffice/delete?empCode='+row.empCode+'&officeCode='+row.officeCode+'" class="btnList" title="${text("删除附属机构")}" data-confirm="${text("确认要删除该附属机构吗?")}"><i class="fa fa-trash-o"></i></a>&nbsp;');
<% } %>
return actions.join('');
}}
],
// 加载成功后执行事件
ajaxSuccess: function(data){
}
});
</script>