<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org"
xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('用户列表')" />
<th:block th:include="include :: layout-latest-css" />
<th:block th:include="include :: ztree-css" />
</head>
<body class="gray-bg">
<div class="ui-layout-west">
<div class="box box-main">
<div class="box-header">
<div class="box-title">
<i class="fa icon-grid"></i> 组织机构
</div>
<div class="box-tools pull-right">
<a type="button" class="btn btn-box-tool" href="#" onclick="dept()"
title="管理部门"><i class="fa fa-edit"></i></a>
<button type="button" class="btn btn-box-tool" id="btnExpand"
title="展开" style="display: none;">
<i class="fa fa-chevron-up"></i>
</button>
<button type="button" class="btn btn-box-tool" id="btnCollapse"
title="折叠">
<i class="fa fa-chevron-down"></i>
</button>
<button type="button" class="btn btn-box-tool" id="btnRefresh"
title="刷新部门">
<i class="fa fa-refresh"></i>
</button>
</div>
</div>
<div class="ui-layout-content">
<div id="tree" class="ztree"></div>
</div>
</div>
</div>
<div class="ui-layout-center">
<div class="container-div">
<div class="row">
<div class="ibox-content">
<form id="formId">
<input type="hidden" id="parentId" name="parentId">
</form>
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" aria-expanded="true"
onclick="querylocationList()">功能位置列表</a></li>
<li><a data-toggle="tab" aria-expanded="false"
onclick="location_equitment()">关联设备</a></li>
<li><a data-toggle="tab" aria-expanded="false"
onclick="location_history()">安装历史</a></li>
</ul>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()"
shiro:hasPermission="system:location:add"> <i
class="fa fa-plus"></i> 添加
</a> <a class="btn btn-primary single disabled"
onclick="$.operate.edit()"
shiro:hasPermission="system:location:edit"> <i
class="fa fa-edit"></i> 修改
</a> <a class="btn btn-danger multiple disabled"
onclick="$.operate.removeAll()"
shiro:hasPermission="system:location:remove"> <i
class="fa fa-remove"></i> 删除
</a> <a class="btn btn-warning" onclick="$.table.exportExcel()"
shiro:hasPermission="system:location:export"> <i
class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: layout-latest-js" />
<th:block th:include="include :: ztree-js" />
<script th:inline="javascript">
var addFlag = [[${@permission.hasPermi('system:location:add')}]];
var editFlag = [[${@permission.hasPermi('system:location:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:location:remove')}]];
var prefix = ctx + "system/location";
$(function() {
var panehHidden = false;
if ($(this).width() < 769) {
panehHidden = true;
}
$('body').layout({ initClosed: panehHidden, west__size: 185 });
querylocationList();
queryLocationTree();
});
var ButtonManager = {
templates: {
location: `
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:location:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:location:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:location:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:location:export">
<i class="fa fa-download"></i> 导出
</a>
`,
equit: `
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:base:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:base:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:base:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:base:export">
<i class="fa fa-download"></i> 导出
</a>
`,
history: `
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:location:export">
<i class="fa fa-download"></i> 导出
</a>
`
},
change: function(buttonType) {
if (this.templates[buttonType]) {
$('#toolbar').html(this.templates[buttonType]);
return true;
}
return false;
},
// 切换到安装位置按钮
toLocation: function() {
return this.change('location');
},
// 切换到关联设备按钮
toEquit: function() {
return this.change('equit');
},
// 切换到安装历史按钮
toHistory: function() {
return this.change('history');
}
};
function location_equitment(){
prefix = ctx + "system/base";
debugger;
var options2 = {
id:'bootstrap-table',
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "设备基础信息",
columns: [{
checkbox: true
},
{
field: 'devId',
title: '设备ID',
visible: false
},
{
field: 'devCode',
title: '设备编码'
},
{
field: 'devName',
title: '设备名称'
},
{
field: 'professionName',
title: '专业名称'
},
{
field: 'devSpecksId',
title: '设备型号'
},
{
field: 'measurementFlag',
title: '计量标志'
},
{
field: 'maintenanceFlag',
title: '养护标志'
},
{
field: 'devStatus',
title: '设备状态'
},
{
field: 'statuDate',
title: '当前状态日期'
},
{
field: 'userDevFlag',
title: '是否用户设备'
},
{
field: 'factory',
title: '生产厂家'
},
{
field: 'zclb',
title: '管理分类'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.devId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.devId + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
debugger;
reinitializeTable(options2);
//$.table.init(options2);
ButtonManager.toEquit(); // 切换回新增按钮
$.table.search();
}
function location_history(){
ButtonManager.toHistory();
}
//销毁table
function reinitializeTable(newOptions) {
var tableId = 'bootstrap-table'; // 你的表格ID
// 方法1:销毁后重新初始化
try {
// 销毁现有表格
$('#' + tableId).bootstrapTable('destroy');
} catch (e) {
console.log('表格销毁失败或表格不存在:', e);
}
// 清空表格容器(可选)
$('#' + tableId).empty();
// 重新初始化
$.table.init(newOptions || options);
}
function querylocationList() {
prefix = ctx + "system/location";
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "设备位置管理",
columns: [{
checkbox: true
},
{
field: 'locationId',
title: '部门主键seq_gk_equipment_type',
visible: false
},
{
field: 'parentId',
title: '上级功能位置编码'
},
{
field: 'locationName',
title: '功能位置名称'
},
{
field: 'status',
title: '使用标志'
},
{
field: 'repairdept',
title: '维护计划部门'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.locationId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.locationId + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
ButtonManager.toLocation();
}
function queryHistoryList() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "安装历史",
columns: [{
checkbox: true
},
{
field: 'locationId',
title: '部门主键seq_gk_equipment_type',
visible: false
},
{
field: 'parentId',
title: '父层级id'
},
{
field: 'locationName',
title: '设备类型名称'
},
{
field: 'status',
title: '设备类型状态'
},
{
field: 'repairdept',
title: '维护部门'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.locationId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.locationId + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
$.table.search();
}
function queryLocationTree()
{
var url = ctx + "system/location/treeData";
var options = {
url: url,
expandLevel: 2,
onClick : zOnClick
};
$.tree.init(options);
function zOnClick(event, treeId, treeNode) {
$("#parentId").val(treeNode.id);
$.table.search();
}
}
$('#btnExpand').click(function() {
$._tree.expandAll(true);
$(this).hide();
$('#btnCollapse').show();
});
$('#btnCollapse').click(function() {
$._tree.expandAll(false);
$(this).hide();
$('#btnExpand').show();
});
$('#btnRefresh').click(function() {
queryLocationTree();
});
/* 用户管理-部门 */
function dept() {
var url = ctx + "system/type";
$.modal.openTab("设备类型管理", url);
}
</script>
</body>
<!-- 导入区域 -->
<script id="importTpl" type="text/template">
<form enctype="multipart/form-data" class="mt20 mb10">
<div class="col-xs-offset-1">
<input type="file" id="file" name="file"/>
<div class="mt10 pt5">
<input type="checkbox" id="updateSupport" name="updateSupport" title="如果登录账户已经存在,更新这条数据。"> 是否更新已经存在的用户数据
<a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
</div>
<font color="red" class="pull-left mt10">
提示:仅允许导入“xls”或“xlsx”格式文件!
</font>
</div>
</form>
</script>
</html>不同的tab页添加不同的查询条件
最新发布