ZhiYeJianKang/职业健康平台后端/target/dzzyb/webpage/modules/sys/officeList.jsp
2025-02-20 15:25:59 +08:00

144 lines
5.3 KiB
Plaintext

<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
<title>组织管理</title>
<meta name="decorator" content="default"/>
<%@include file="/webpage/include/treetable.jsp" %>
<script type="text/javascript">
$(document).ready(function() {
var tpl = $("#treeTableTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
var data = ${fns:toJson(list)}, ids = [], rootIds = [];
for (var i=0; i<data.length; i++){
ids.push(data[i].id);
}
ids = ',' + ids.join(',') + ',';
for (var i=0; i<data.length; i++){
if (ids.indexOf(','+data[i].parentId+',') == -1){
if ((','+rootIds.join(',')+',').indexOf(','+data[i].parentId+',') == -1){
rootIds.push(data[i].parentId);
}
}
}
for (var i=0; i<rootIds.length; i++){
addRow("#treeTableList", tpl, data, rootIds[i], true);
}
$("#treeTable").treeTable({expandLevel : 5});
});
function addRow(list, tpl, data, pid, root){
for (var i=0; i<data.length; i++){
var row = data[i];
var officeTypeNm=getOfTypeLabel(row.type);
var isdrusNm=getDrusLabel(row.isdrus);
if ((${fns:jsGetVal('row.parentId')}) == pid){
$(list).append(Mustache.render(tpl, {
dict: {type:officeTypeNm,isdrus:isdrusNm,
blank123:0}, pid: (root?0:pid), row: row
}));
addRow(list, tpl, data, row.id);
}
}
}
function getOfTypeLabel(strval){
var strNm="";
if(strval=='0'){
strNm="${fns:getDictLabel('0','sys_office_type','0')}";
}else if(strval=='1'){
strNm="${fns:getDictLabel('1','sys_office_type','0')}";
}else if(strval=='2'){
strNm="${fns:getDictLabel('2','sys_office_type','0')}";
}else if(strval=='3'){
strNm="${fns:getDictLabel('3','sys_office_type','0')}";
}else if(strval=='4'){
strNm="${fns:getDictLabel('4','sys_office_type','0')}";
}else if(strval=='5'){
strNm="${fns:getDictLabel('5','sys_office_type','0')}";
}else if(strval=='6'){
strNm="${fns:getDictLabel('6','sys_office_type','0')}";
}else if(strval=='7'){
strNm="${fns:getDictLabel('7','sys_office_type','0')}";
}else if(strval=='8'){
strNm="${fns:getDictLabel('8','sys_office_type','0')}";
}else if(strval=='9'){
strNm="${fns:getDictLabel('9','sys_office_type','0')}";
}else if(strval=='10'){
strNm="${fns:getDictLabel('10','sys_office_type','0')}";
}
return strNm;
}
function getDrusLabel(drusval){
var strNm="";
if(drusval=='0'){
strNm="${fns:getDictLabel('0','is_drus','0')}";
}else if(drusval=='1'){
strNm="${fns:getDictLabel('1','is_drus','0')}";
}else if(drusval=='2'){
strNm="${fns:getDictLabel('2','is_drus','0')}";
}else if(drusval=='3'){
strNm="${fns:getDictLabel('3','is_drus','0')}";
}else if(drusval=='4'){
strNm="${fns:getDictLabel('4','is_drus','0')}";
}
return strNm;
}
function refresh(){//刷新或者排序,页码不清零
window.location="${ctx}/sys/office/list";
}
</script>
</head>
<body>
<sys:message content="${message}"/>
<!-- 工具栏 -->
<div class="row">
<div class="col-sm-12">
<div class="pull-left">
<shiro:hasPermission name="sys:office:add">
<table:addRow url="${ctx}/sys/office/form?parent.id=${office.id}" title="组织" width="800px" height="620px" target="officeContent"></table:addRow><!-- 增加按钮 -->
</shiro:hasPermission>
<button class="btn btn-white btn-sm " data-toggle="tooltip" data-placement="left" onclick="refresh()" title="刷新"><i class="glyphicon glyphicon-repeat"></i> 刷新</button>
</div>
</div>
</div>
<table id="treeTable" class="table table-striped table-bordered table-hover table-condensed dataTables-example dataTable">
<thead>
<tr>
<th>组织名称</th>
<th>归属区域</th>
<th>组织编码</th>
<th>组织类型</th>
<th>是否直属</th>
<shiro:hasPermission name="sys:office:edit">
<th>操作</th></shiro:hasPermission>
</tr>
</thead>
<tbody id="treeTableList"></tbody>
</table>
<script type="text/template" id="treeTableTpl">
<tr id="{{row.id}}" pId="{{pid}}">
<td><a href="#" onclick="openDialogView('查看组织', '${ctx}/sys/office/form?id={{row.id}}','800px', '620px')">{{row.name}}</a></td>
<td>{{row.area.name}}</td>
<td>{{row.code}}</td>
<td>{{dict.type}}</td>
<td>{{dict.isdrus}}</td>
<td>
<shiro:hasPermission name="sys:office:view">
<a href="#" onclick="openDialogView('查看组织', '${ctx}/sys/office/form?id={{row.id}}','800px', '620px')" class="btn btn-info btn-xs" ><i class="fa fa-search-plus"></i> 查看</a>
</shiro:hasPermission>
<shiro:hasPermission name="sys:office:edit">
<a href="#" onclick="openDialog('修改组织', '${ctx}/sys/office/form?id={{row.id}}','800px', '620px', 'officeContent')" class="btn btn-success btn-xs" ><i class="fa fa-edit"></i> 修改</a>
</shiro:hasPermission>
<shiro:hasPermission name="sys:office:del">
<a href="${ctx}/sys/office/delete?id={{row.id}}" onclick="return confirmx('要删除该组织及所有子组织项吗?', this.href)" class="btn btn-danger btn-xs"><i class="fa fa-trash"></i> 删除</a>
</shiro:hasPermission>
<shiro:hasPermission name="sys:office:add">
<a href="#" onclick="openDialog('添加下级组织', '${ctx}/sys/office/form?parent.id={{row.id}}','800px', '620px', 'officeContent')" class="btn btn-primary btn-xs"><i class="fa fa-plus"></i> 添加下级组织</a>
</shiro:hasPermission>
</td>
</tr>
</script>
</body>
</html>