完成权限管理列表页
This commit is contained in:
parent
e18693a509
commit
a8dc6cf6fa
|
@ -29,39 +29,6 @@
|
||||||
</div>
|
</div>
|
||||||
<table id="table"></table>
|
<table id="table"></table>
|
||||||
</div>
|
</div>
|
||||||
<!-- 新增 -->
|
|
||||||
<div id="createDialog" class="crudDialog" hidden>
|
|
||||||
<form>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="input1">所属系统</label>
|
|
||||||
<input id="input1" type="text" class="form-control">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="input2">所属上级</label>
|
|
||||||
<input id="input2" type="text" class="form-control">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="input3">权限名称</label>
|
|
||||||
<input id="input3" type="text" class="form-control">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="input4">类型</label>
|
|
||||||
<input id="input4" type="text" class="form-control">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="input5">权限值</label>
|
|
||||||
<input id="input5" type="text" class="form-control">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="input6">路径</label>
|
|
||||||
<input id="input6" type="text" class="form-control">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="input7">图标</label>
|
|
||||||
<input id="input7" type="text" class="form-control">
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<script src="${basePath}/resources/zheng-ui/plugins/jquery.1.12.4.min.js"></script>
|
<script src="${basePath}/resources/zheng-ui/plugins/jquery.1.12.4.min.js"></script>
|
||||||
<script src="${basePath}/resources/zheng-ui/plugins/bootstrap-3.3.0/js/bootstrap.min.js"></script>
|
<script src="${basePath}/resources/zheng-ui/plugins/bootstrap-3.3.0/js/bootstrap.min.js"></script>
|
||||||
<script src="${basePath}/resources/zheng-ui/plugins/bootstrap-table-1.11.0/bootstrap-table.min.js"></script>
|
<script src="${basePath}/resources/zheng-ui/plugins/bootstrap-table-1.11.0/bootstrap-table.min.js"></script>
|
||||||
|
@ -102,7 +69,7 @@ $(function() {
|
||||||
maintainSelected: true,
|
maintainSelected: true,
|
||||||
toolbar: '#toolbar',
|
toolbar: '#toolbar',
|
||||||
columns: [
|
columns: [
|
||||||
{field: 'state', checkbox: true},
|
{field: 'ck', checkbox: true},
|
||||||
{field: 'permissionId', title: '编号', sortable: true, align: 'center'},
|
{field: 'permissionId', title: '编号', sortable: true, align: 'center'},
|
||||||
{field: 'systemId', title: '所属系统'},
|
{field: 'systemId', title: '所属系统'},
|
||||||
{field: 'pid', title: '所属上级'},
|
{field: 'pid', title: '所属上级'},
|
||||||
|
@ -114,9 +81,6 @@ $(function() {
|
||||||
{field: 'status', title: '状态', sortable: true, align: 'center', formatter: 'statusFormatter'},
|
{field: 'status', title: '状态', sortable: true, align: 'center', formatter: 'statusFormatter'},
|
||||||
{field: 'action', title: '操作', align: 'center', formatter: 'actionFormatter', events: 'actionEvents', clickToSelect: false}
|
{field: 'action', title: '操作', align: 'center', formatter: 'actionFormatter', events: 'actionEvents', clickToSelect: false}
|
||||||
]
|
]
|
||||||
}).on('all.bs.table', function (e, name, args) {
|
|
||||||
$('[data-toggle="tooltip"]').tooltip();
|
|
||||||
$('[data-toggle="popover"]').popover();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// 格式化操作按钮
|
// 格式化操作按钮
|
||||||
|
@ -149,34 +113,22 @@ function statusFormatter(value, row, index) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 新增
|
// 新增
|
||||||
|
var createDialog;
|
||||||
function createAction() {
|
function createAction() {
|
||||||
$.confirm({
|
createDialog = $.dialog({
|
||||||
type: 'dark',
|
|
||||||
animationSpeed: 300,
|
animationSpeed: 300,
|
||||||
title: '新增权限',
|
title: '新增权限',
|
||||||
content: $('#createDialog').html(),
|
content: 'url:${basePath}/manage/permission/create'
|
||||||
buttons: {
|
|
||||||
confirm: {
|
|
||||||
text: '确认',
|
|
||||||
btnClass: 'waves-effect waves-button',
|
|
||||||
action: function () {
|
|
||||||
$.alert('确认');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
cancel: {
|
|
||||||
text: '取消',
|
|
||||||
btnClass: 'waves-effect waves-button'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// 编辑
|
// 编辑
|
||||||
|
var updateDialog;
|
||||||
function updateAction() {
|
function updateAction() {
|
||||||
var rows = $table.bootstrapTable('getSelections');
|
var rows = $table.bootstrapTable('getSelections');
|
||||||
if (rows.length == 0) {
|
if (rows.length != 1) {
|
||||||
$.confirm({
|
$.confirm({
|
||||||
title: false,
|
title: false,
|
||||||
content: '请至少选择一条记录!',
|
content: '请选择一条记录!',
|
||||||
autoClose: 'cancel|3000',
|
autoClose: 'cancel|3000',
|
||||||
backgroundDismiss: true,
|
backgroundDismiss: true,
|
||||||
buttons: {
|
buttons: {
|
||||||
|
@ -187,28 +139,15 @@ function updateAction() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$.confirm({
|
updateDialog = $.dialog({
|
||||||
type: 'blue',
|
|
||||||
animationSpeed: 300,
|
animationSpeed: 300,
|
||||||
title: '编辑权限',
|
title: '编辑权限',
|
||||||
content: $('#createDialog').html(),
|
content: 'url:${basePath}/manage/permission/update/' + rows[0].permissionId
|
||||||
buttons: {
|
|
||||||
confirm: {
|
|
||||||
text: '确认',
|
|
||||||
btnClass: 'waves-effect waves-button',
|
|
||||||
action: function () {
|
|
||||||
$.alert('确认');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
cancel: {
|
|
||||||
text: '取消',
|
|
||||||
btnClass: 'waves-effect waves-button'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 删除
|
// 删除
|
||||||
|
var deleteDialog;
|
||||||
function deleteAction() {
|
function deleteAction() {
|
||||||
var rows = $table.bootstrapTable('getSelections');
|
var rows = $table.bootstrapTable('getSelections');
|
||||||
if (rows.length == 0) {
|
if (rows.length == 0) {
|
||||||
|
@ -225,7 +164,7 @@ function deleteAction() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$.confirm({
|
deleteDialog = $.confirm({
|
||||||
type: 'red',
|
type: 'red',
|
||||||
animationSpeed: 300,
|
animationSpeed: 300,
|
||||||
title: false,
|
title: false,
|
||||||
|
@ -239,7 +178,63 @@ function deleteAction() {
|
||||||
for (var i in rows) {
|
for (var i in rows) {
|
||||||
ids.push(rows[i].permissionId);
|
ids.push(rows[i].permissionId);
|
||||||
}
|
}
|
||||||
$.alert('删除:id=' + ids.join("-"));
|
$.ajax({
|
||||||
|
type: 'get',
|
||||||
|
url: '${basePath}/manage/permission/delete/' + ids.join("-"),
|
||||||
|
success: function(result) {
|
||||||
|
if (result.code != 1) {
|
||||||
|
if (result.data instanceof Array) {
|
||||||
|
$.each(result.data, function(index, value) {
|
||||||
|
$.confirm({
|
||||||
|
theme: 'dark',
|
||||||
|
animation: 'rotateX',
|
||||||
|
closeAnimation: 'rotateX',
|
||||||
|
title: false,
|
||||||
|
content: value.errorMsg,
|
||||||
|
buttons: {
|
||||||
|
confirm: {
|
||||||
|
text: '确认',
|
||||||
|
btnClass: 'waves-effect waves-button waves-light'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$.confirm({
|
||||||
|
theme: 'dark',
|
||||||
|
animation: 'rotateX',
|
||||||
|
closeAnimation: 'rotateX',
|
||||||
|
title: false,
|
||||||
|
content: result.data.errorMsg,
|
||||||
|
buttons: {
|
||||||
|
confirm: {
|
||||||
|
text: '确认',
|
||||||
|
btnClass: 'waves-effect waves-button waves-light'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
deleteDialog.close();
|
||||||
|
$table.bootstrapTable('refresh');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||||
|
$.confirm({
|
||||||
|
theme: 'dark',
|
||||||
|
animation: 'rotateX',
|
||||||
|
closeAnimation: 'rotateX',
|
||||||
|
title: false,
|
||||||
|
content: textStatus,
|
||||||
|
buttons: {
|
||||||
|
confirm: {
|
||||||
|
text: '确认',
|
||||||
|
btnClass: 'waves-effect waves-button waves-light'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cancel: {
|
cancel: {
|
||||||
|
|
|
@ -29,39 +29,6 @@
|
||||||
</div>
|
</div>
|
||||||
<table id="table"></table>
|
<table id="table"></table>
|
||||||
</div>
|
</div>
|
||||||
<!-- 新增 -->
|
|
||||||
<div id="createDialog" class="crudDialog" hidden>
|
|
||||||
<form>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="input1">所属系统</label>
|
|
||||||
<input id="input1" type="text" class="form-control">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="input2">所属上级</label>
|
|
||||||
<input id="input2" type="text" class="form-control">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="input3">权限名称</label>
|
|
||||||
<input id="input3" type="text" class="form-control">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="input4">类型</label>
|
|
||||||
<input id="input4" type="text" class="form-control">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="input5">权限值</label>
|
|
||||||
<input id="input5" type="text" class="form-control">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="input6">路径</label>
|
|
||||||
<input id="input6" type="text" class="form-control">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="input7">图标</label>
|
|
||||||
<input id="input7" type="text" class="form-control">
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<script src="${basePath}/resources/zheng-ui/plugins/jquery.1.12.4.min.js"></script>
|
<script src="${basePath}/resources/zheng-ui/plugins/jquery.1.12.4.min.js"></script>
|
||||||
<script src="${basePath}/resources/zheng-ui/plugins/bootstrap-3.3.0/js/bootstrap.min.js"></script>
|
<script src="${basePath}/resources/zheng-ui/plugins/bootstrap-3.3.0/js/bootstrap.min.js"></script>
|
||||||
<script src="${basePath}/resources/zheng-ui/plugins/bootstrap-table-1.11.0/bootstrap-table.min.js"></script>
|
<script src="${basePath}/resources/zheng-ui/plugins/bootstrap-table-1.11.0/bootstrap-table.min.js"></script>
|
||||||
|
@ -102,7 +69,7 @@ $(function() {
|
||||||
maintainSelected: true,
|
maintainSelected: true,
|
||||||
toolbar: '#toolbar',
|
toolbar: '#toolbar',
|
||||||
columns: [
|
columns: [
|
||||||
{field: 'state', checkbox: true},
|
{field: 'ck', checkbox: true},
|
||||||
{field: 'permissionId', title: '编号', sortable: true, align: 'center'},
|
{field: 'permissionId', title: '编号', sortable: true, align: 'center'},
|
||||||
{field: 'systemId', title: '所属系统'},
|
{field: 'systemId', title: '所属系统'},
|
||||||
{field: 'pid', title: '所属上级'},
|
{field: 'pid', title: '所属上级'},
|
||||||
|
@ -114,9 +81,6 @@ $(function() {
|
||||||
{field: 'status', title: '状态', sortable: true, align: 'center', formatter: 'statusFormatter'},
|
{field: 'status', title: '状态', sortable: true, align: 'center', formatter: 'statusFormatter'},
|
||||||
{field: 'action', title: '操作', align: 'center', formatter: 'actionFormatter', events: 'actionEvents', clickToSelect: false}
|
{field: 'action', title: '操作', align: 'center', formatter: 'actionFormatter', events: 'actionEvents', clickToSelect: false}
|
||||||
]
|
]
|
||||||
}).on('all.bs.table', function (e, name, args) {
|
|
||||||
$('[data-toggle="tooltip"]').tooltip();
|
|
||||||
$('[data-toggle="popover"]').popover();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// 格式化操作按钮
|
// 格式化操作按钮
|
||||||
|
@ -149,34 +113,22 @@ function statusFormatter(value, row, index) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 新增
|
// 新增
|
||||||
|
var createDialog;
|
||||||
function createAction() {
|
function createAction() {
|
||||||
$.confirm({
|
createDialog = $.dialog({
|
||||||
type: 'dark',
|
|
||||||
animationSpeed: 300,
|
animationSpeed: 300,
|
||||||
title: '新增权限',
|
title: '新增权限',
|
||||||
content: $('#createDialog').html(),
|
content: 'url:${basePath}/manage/permission/create'
|
||||||
buttons: {
|
|
||||||
confirm: {
|
|
||||||
text: '确认',
|
|
||||||
btnClass: 'waves-effect waves-button',
|
|
||||||
action: function () {
|
|
||||||
$.alert('确认');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
cancel: {
|
|
||||||
text: '取消',
|
|
||||||
btnClass: 'waves-effect waves-button'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// 编辑
|
// 编辑
|
||||||
|
var updateDialog;
|
||||||
function updateAction() {
|
function updateAction() {
|
||||||
var rows = $table.bootstrapTable('getSelections');
|
var rows = $table.bootstrapTable('getSelections');
|
||||||
if (rows.length == 0) {
|
if (rows.length != 1) {
|
||||||
$.confirm({
|
$.confirm({
|
||||||
title: false,
|
title: false,
|
||||||
content: '请至少选择一条记录!',
|
content: '请选择一条记录!',
|
||||||
autoClose: 'cancel|3000',
|
autoClose: 'cancel|3000',
|
||||||
backgroundDismiss: true,
|
backgroundDismiss: true,
|
||||||
buttons: {
|
buttons: {
|
||||||
|
@ -187,28 +139,15 @@ function updateAction() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$.confirm({
|
updateDialog = $.dialog({
|
||||||
type: 'blue',
|
|
||||||
animationSpeed: 300,
|
animationSpeed: 300,
|
||||||
title: '编辑权限',
|
title: '编辑权限',
|
||||||
content: $('#createDialog').html(),
|
content: 'url:${basePath}/manage/permission/update/' + rows[0].permissionId
|
||||||
buttons: {
|
|
||||||
confirm: {
|
|
||||||
text: '确认',
|
|
||||||
btnClass: 'waves-effect waves-button',
|
|
||||||
action: function () {
|
|
||||||
$.alert('确认');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
cancel: {
|
|
||||||
text: '取消',
|
|
||||||
btnClass: 'waves-effect waves-button'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 删除
|
// 删除
|
||||||
|
var deleteDialog;
|
||||||
function deleteAction() {
|
function deleteAction() {
|
||||||
var rows = $table.bootstrapTable('getSelections');
|
var rows = $table.bootstrapTable('getSelections');
|
||||||
if (rows.length == 0) {
|
if (rows.length == 0) {
|
||||||
|
@ -225,7 +164,7 @@ function deleteAction() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$.confirm({
|
deleteDialog = $.confirm({
|
||||||
type: 'red',
|
type: 'red',
|
||||||
animationSpeed: 300,
|
animationSpeed: 300,
|
||||||
title: false,
|
title: false,
|
||||||
|
@ -237,9 +176,65 @@ function deleteAction() {
|
||||||
action: function () {
|
action: function () {
|
||||||
var ids = new Array();
|
var ids = new Array();
|
||||||
for (var i in rows) {
|
for (var i in rows) {
|
||||||
ids.push(rows[i].systemId);
|
ids.push(rows[i].permissionId);
|
||||||
}
|
}
|
||||||
$.alert('删除:id=' + ids.join("-"));
|
$.ajax({
|
||||||
|
type: 'get',
|
||||||
|
url: '${basePath}/manage/permission/delete/' + ids.join("-"),
|
||||||
|
success: function(result) {
|
||||||
|
if (result.code != 1) {
|
||||||
|
if (result.data instanceof Array) {
|
||||||
|
$.each(result.data, function(index, value) {
|
||||||
|
$.confirm({
|
||||||
|
theme: 'dark',
|
||||||
|
animation: 'rotateX',
|
||||||
|
closeAnimation: 'rotateX',
|
||||||
|
title: false,
|
||||||
|
content: value.errorMsg,
|
||||||
|
buttons: {
|
||||||
|
confirm: {
|
||||||
|
text: '确认',
|
||||||
|
btnClass: 'waves-effect waves-button waves-light'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$.confirm({
|
||||||
|
theme: 'dark',
|
||||||
|
animation: 'rotateX',
|
||||||
|
closeAnimation: 'rotateX',
|
||||||
|
title: false,
|
||||||
|
content: result.data.errorMsg,
|
||||||
|
buttons: {
|
||||||
|
confirm: {
|
||||||
|
text: '确认',
|
||||||
|
btnClass: 'waves-effect waves-button waves-light'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
deleteDialog.close();
|
||||||
|
$table.bootstrapTable('refresh');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||||
|
$.confirm({
|
||||||
|
theme: 'dark',
|
||||||
|
animation: 'rotateX',
|
||||||
|
closeAnimation: 'rotateX',
|
||||||
|
title: false,
|
||||||
|
content: textStatus,
|
||||||
|
buttons: {
|
||||||
|
confirm: {
|
||||||
|
text: '确认',
|
||||||
|
btnClass: 'waves-effect waves-button waves-light'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cancel: {
|
cancel: {
|
||||||
|
|
|
@ -29,39 +29,6 @@
|
||||||
</div>
|
</div>
|
||||||
<table id="table"></table>
|
<table id="table"></table>
|
||||||
</div>
|
</div>
|
||||||
<!-- 新增 -->
|
|
||||||
<div id="createDialog" class="crudDialog" hidden>
|
|
||||||
<form>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="input1">所属系统</label>
|
|
||||||
<input id="input1" type="text" class="form-control">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="input2">所属上级</label>
|
|
||||||
<input id="input2" type="text" class="form-control">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="input3">权限名称</label>
|
|
||||||
<input id="input3" type="text" class="form-control">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="input4">类型</label>
|
|
||||||
<input id="input4" type="text" class="form-control">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="input5">权限值</label>
|
|
||||||
<input id="input5" type="text" class="form-control">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="input6">路径</label>
|
|
||||||
<input id="input6" type="text" class="form-control">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="input7">图标</label>
|
|
||||||
<input id="input7" type="text" class="form-control">
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<script src="${basePath}/resources/zheng-ui/plugins/jquery.1.12.4.min.js"></script>
|
<script src="${basePath}/resources/zheng-ui/plugins/jquery.1.12.4.min.js"></script>
|
||||||
<script src="${basePath}/resources/zheng-ui/plugins/bootstrap-3.3.0/js/bootstrap.min.js"></script>
|
<script src="${basePath}/resources/zheng-ui/plugins/bootstrap-3.3.0/js/bootstrap.min.js"></script>
|
||||||
<script src="${basePath}/resources/zheng-ui/plugins/bootstrap-table-1.11.0/bootstrap-table.min.js"></script>
|
<script src="${basePath}/resources/zheng-ui/plugins/bootstrap-table-1.11.0/bootstrap-table.min.js"></script>
|
||||||
|
@ -102,7 +69,7 @@ $(function() {
|
||||||
maintainSelected: true,
|
maintainSelected: true,
|
||||||
toolbar: '#toolbar',
|
toolbar: '#toolbar',
|
||||||
columns: [
|
columns: [
|
||||||
{field: 'state', checkbox: true},
|
{field: 'ck', checkbox: true},
|
||||||
{field: 'permissionId', title: '编号', sortable: true, align: 'center'},
|
{field: 'permissionId', title: '编号', sortable: true, align: 'center'},
|
||||||
{field: 'systemId', title: '所属系统'},
|
{field: 'systemId', title: '所属系统'},
|
||||||
{field: 'pid', title: '所属上级'},
|
{field: 'pid', title: '所属上级'},
|
||||||
|
@ -114,9 +81,6 @@ $(function() {
|
||||||
{field: 'status', title: '状态', sortable: true, align: 'center', formatter: 'statusFormatter'},
|
{field: 'status', title: '状态', sortable: true, align: 'center', formatter: 'statusFormatter'},
|
||||||
{field: 'action', title: '操作', align: 'center', formatter: 'actionFormatter', events: 'actionEvents', clickToSelect: false}
|
{field: 'action', title: '操作', align: 'center', formatter: 'actionFormatter', events: 'actionEvents', clickToSelect: false}
|
||||||
]
|
]
|
||||||
}).on('all.bs.table', function (e, name, args) {
|
|
||||||
$('[data-toggle="tooltip"]').tooltip();
|
|
||||||
$('[data-toggle="popover"]').popover();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// 格式化操作按钮
|
// 格式化操作按钮
|
||||||
|
@ -149,34 +113,22 @@ function statusFormatter(value, row, index) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 新增
|
// 新增
|
||||||
|
var createDialog;
|
||||||
function createAction() {
|
function createAction() {
|
||||||
$.confirm({
|
createDialog = $.dialog({
|
||||||
type: 'dark',
|
|
||||||
animationSpeed: 300,
|
animationSpeed: 300,
|
||||||
title: '新增权限',
|
title: '新增权限',
|
||||||
content: $('#createDialog').html(),
|
content: 'url:${basePath}/manage/permission/create'
|
||||||
buttons: {
|
|
||||||
confirm: {
|
|
||||||
text: '确认',
|
|
||||||
btnClass: 'waves-effect waves-button',
|
|
||||||
action: function () {
|
|
||||||
$.alert('确认');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
cancel: {
|
|
||||||
text: '取消',
|
|
||||||
btnClass: 'waves-effect waves-button'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// 编辑
|
// 编辑
|
||||||
|
var updateDialog;
|
||||||
function updateAction() {
|
function updateAction() {
|
||||||
var rows = $table.bootstrapTable('getSelections');
|
var rows = $table.bootstrapTable('getSelections');
|
||||||
if (rows.length == 0) {
|
if (rows.length != 1) {
|
||||||
$.confirm({
|
$.confirm({
|
||||||
title: false,
|
title: false,
|
||||||
content: '请至少选择一条记录!',
|
content: '请选择一条记录!',
|
||||||
autoClose: 'cancel|3000',
|
autoClose: 'cancel|3000',
|
||||||
backgroundDismiss: true,
|
backgroundDismiss: true,
|
||||||
buttons: {
|
buttons: {
|
||||||
|
@ -187,28 +139,15 @@ function updateAction() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$.confirm({
|
updateDialog = $.dialog({
|
||||||
type: 'blue',
|
|
||||||
animationSpeed: 300,
|
animationSpeed: 300,
|
||||||
title: '编辑权限',
|
title: '编辑权限',
|
||||||
content: $('#createDialog').html(),
|
content: 'url:${basePath}/manage/permission/update/' + rows[0].permissionId
|
||||||
buttons: {
|
|
||||||
confirm: {
|
|
||||||
text: '确认',
|
|
||||||
btnClass: 'waves-effect waves-button',
|
|
||||||
action: function () {
|
|
||||||
$.alert('确认');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
cancel: {
|
|
||||||
text: '取消',
|
|
||||||
btnClass: 'waves-effect waves-button'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 删除
|
// 删除
|
||||||
|
var deleteDialog;
|
||||||
function deleteAction() {
|
function deleteAction() {
|
||||||
var rows = $table.bootstrapTable('getSelections');
|
var rows = $table.bootstrapTable('getSelections');
|
||||||
if (rows.length == 0) {
|
if (rows.length == 0) {
|
||||||
|
@ -225,7 +164,7 @@ function deleteAction() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$.confirm({
|
deleteDialog = $.confirm({
|
||||||
type: 'red',
|
type: 'red',
|
||||||
animationSpeed: 300,
|
animationSpeed: 300,
|
||||||
title: false,
|
title: false,
|
||||||
|
@ -237,9 +176,65 @@ function deleteAction() {
|
||||||
action: function () {
|
action: function () {
|
||||||
var ids = new Array();
|
var ids = new Array();
|
||||||
for (var i in rows) {
|
for (var i in rows) {
|
||||||
ids.push(rows[i].systemId);
|
ids.push(rows[i].permissionId);
|
||||||
}
|
}
|
||||||
$.alert('删除:id=' + ids.join("-"));
|
$.ajax({
|
||||||
|
type: 'get',
|
||||||
|
url: '${basePath}/manage/permission/delete/' + ids.join("-"),
|
||||||
|
success: function(result) {
|
||||||
|
if (result.code != 1) {
|
||||||
|
if (result.data instanceof Array) {
|
||||||
|
$.each(result.data, function(index, value) {
|
||||||
|
$.confirm({
|
||||||
|
theme: 'dark',
|
||||||
|
animation: 'rotateX',
|
||||||
|
closeAnimation: 'rotateX',
|
||||||
|
title: false,
|
||||||
|
content: value.errorMsg,
|
||||||
|
buttons: {
|
||||||
|
confirm: {
|
||||||
|
text: '确认',
|
||||||
|
btnClass: 'waves-effect waves-button waves-light'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$.confirm({
|
||||||
|
theme: 'dark',
|
||||||
|
animation: 'rotateX',
|
||||||
|
closeAnimation: 'rotateX',
|
||||||
|
title: false,
|
||||||
|
content: result.data.errorMsg,
|
||||||
|
buttons: {
|
||||||
|
confirm: {
|
||||||
|
text: '确认',
|
||||||
|
btnClass: 'waves-effect waves-button waves-light'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
deleteDialog.close();
|
||||||
|
$table.bootstrapTable('refresh');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||||
|
$.confirm({
|
||||||
|
theme: 'dark',
|
||||||
|
animation: 'rotateX',
|
||||||
|
closeAnimation: 'rotateX',
|
||||||
|
title: false,
|
||||||
|
content: textStatus,
|
||||||
|
buttons: {
|
||||||
|
confirm: {
|
||||||
|
text: '确认',
|
||||||
|
btnClass: 'waves-effect waves-button waves-light'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cancel: {
|
cancel: {
|
||||||
|
|
Loading…
Reference in New Issue