修改删除

This commit is contained in:
Argo-MacBookPro 2018-06-08 20:13:52 +08:00
parent 6113f7ff9a
commit 801943d956
9 changed files with 38 additions and 47 deletions

View File

@ -39,7 +39,7 @@ namespace Bootstrap.Admin.Controllers.Api
/// <param name="value"></param>
[HttpDelete]
[Authorize(Roles = "Administrators")]
public object Delete(IEnumerable<int> value)
public object Delete([FromBody]IEnumerable<int> value)
{
var result = DictHelper.DeleteDict(value);
return new { result, msg = result ? "成功!" : "失败" };

View File

@ -76,13 +76,13 @@
<h4 class="modal-title" id="myModalLabel">菜单编辑窗口</h4>
</div>
<div class="modal-body">
<form class="form-inline" id="dataForm" name="dataForm" role="form">
<form class="form-inline" id="dataForm" role="form">
<div class="row">
<div class="form-group col-sm-6">
<input type="text" class="form-control hidden" id="menuID" name="menuID" data-default-val="0" />
<label class="control-label" for="name">菜单名称</label>
<div class="input-group">
<input type="text" class="form-control" id="name" name="name" placeholder="不可为空50字以内" maxlength="50" />
<input type="text" class="form-control" id="name" name="name" placeholder="不可为空50字以内" maxlength="50" data-valid="true" />
<span class="input-group-btn">
<button data-method="clear" class="btn btn-default" type="button"><i class="fa fa-remove"></i></button>
<button data-method="sel" class="btn btn-default" type="button"><i class="fa fa-edit"></i>全选</button>
@ -90,7 +90,7 @@
</div>
</div>
<div class="form-group col-sm-6">
<input type="text" class="form-control hidden" id="parentId" name="parentId" />
<input type="text" class="form-control hidden" id="parentId" data-default-val="0" />
<label class="control-label" for="parentName">父级菜单</label>
<div class="input-group">
<input type="text" class="form-control" readonly id="parentName" name="parentName" placeholder="请选择...(可为空)50字以内" maxlength="50" />
@ -103,7 +103,7 @@
<div class="form-group col-sm-6">
<label class="control-label" for="order">菜单序号</label>
<div class="input-group">
<input type="text" class="form-control" id="order" name="order" data-default-val="10" placeholder="默认为10" maxlength="8" />
<input type="text" class="form-control" id="order" name="order" data-default-val="10" placeholder="默认为10" maxlength="8" data-valid="true" />
<span class="input-group-btn">
<button data-method="clear" class="btn btn-default" type="button"><i class="fa fa-remove"></i></button>
<button id="btnMenuOrder" class="btn btn-default" type="button"><i class="fa fa-list-ol"></i>调整</button>
@ -122,7 +122,7 @@
</div>
<div class="form-group col-xs-12">
<label class="control-label" for="url">路径</label>
<input type="text" class="form-control form-control-url" id="url" placeholder="不可为空4000字以内" maxlength="4000" />
<input type="text" class="form-control form-control-url" id="url" placeholder="不可为空4000字以内" maxlength="4000" data-valid="true" />
</div>
<div class="form-group col-sm-6 col-xs-12">
<label class="control-label" for="category">菜单类别</label>

View File

@ -18,6 +18,5 @@
"DbProviderFactories": {
"sql": "SQLServer"
},
"": null,
"KeyPath": "C:\\keys"
}

View File

@ -59,7 +59,7 @@
var roleIds = $dialogRole.find('input:checked').map(function (index, element) {
return $(element).val();
}).toArray().join(',');
$.bc({ id: groupId, url: Role.url, method: "PUT", data: { type: "group", roleIds: roleIds }, title: Role.title, modal: 'dialogRole' });
$.bc({ id: groupId, url: Role.url, method: "PUT", data: { type: "group", roleIds: roleIds }, title: Role.title, modal: '#dialogRole' });
}
}, {
id: 'btnSubmitUser',
@ -68,7 +68,7 @@
var userIds = $dialogUser.find(':checked').map(function (index, element) {
return $(element).val();
}).toArray().join(',');
$.bc({ id: groupId, url: User.url, method: "PUT", data: { type: "group", userIds: userIds }, title: User.title, modal: 'dialogUser' });
$.bc({ id: groupId, url: User.url, method: "PUT", data: { type: "group", userIds: userIds }, title: User.title, modal: '#dialogUser' });
}
}]
}

View File

@ -64,7 +64,7 @@
var roleIds = $dialogRole.find('input:checked').map(function (index, element) {
return $(element).val();
}).toArray().join(',');
$.bc({ id: menuId, url: Role.url, method: "PUT", data: { type: "menu", roleIds: roleIds }, title: Role.title, modal: 'dialogRole' });
$.bc({ id: menuId, url: Role.url, method: "PUT", data: { type: "menu", roleIds: roleIds }, title: Role.title, modal: '#dialogRole' });
}
}]
},
@ -143,21 +143,6 @@
$input.select();
break;
}
}).autoValidate({
name: {
required: true,
maxlength: 50
},
order: {
digits: true
},
url: {
required: true
},
category: {
required: true,
maxlength: 50
}
});
$btnPickIcon.on('click', function () {

View File

@ -85,7 +85,7 @@
var userIds = $dialogUser.find(':checked').map(function (index, element) {
return $(element).val();
}).toArray().join(',');
$.bc({ Id: roleId, url: User.url, method: "PUT", data: { type: "role", userIds: userIds }, modal: 'dialogUser', title: User.title });
$.bc({ id: roleId, url: User.url, method: "PUT", data: { type: "role", userIds: userIds }, modal: '#dialogUser', title: User.title });
}
}, {
id: 'btnSubmitGroup',
@ -94,7 +94,7 @@
var groupIds = $dialogGroup.find(':checked').map(function (index, element) {
return $(element).val();
}).toArray().join(',');
$.bc({ Id: roleId, url: Group.url, method: "PUT", data: { type: "role", groupIds: groupIds }, modal: 'dialogGroup', title: Group.title });
$.bc({ id: roleId, url: Group.url, method: "PUT", data: { type: "role", groupIds: groupIds }, modal: '#dialogGroup', title: Group.title });
}
}, {
id: 'btnSubmitMenu',
@ -110,7 +110,7 @@
default:
break;
}
$.bc({ Id: roleId, url: Menu.url, method: "PUT", data: { type: "role", menuIds: menuIds }, modal: 'dialogMenu', title: Menu.title });
$.bc({ id: roleId, url: Menu.url, method: "PUT", data: { type: "role", menuIds: menuIds }, modal: '#dialogMenu', title: Menu.title });
}
}]
}

View File

@ -61,7 +61,7 @@
var roleIds = $dialogRole.find(':checked').map(function (index, element) {
return $(element).val();
}).toArray().join(',');
$.bc({ id: userId, url: Role.url, method: 'PUT', data: { type: "user", roleIds: roleIds }, title: Role.title, modal: 'dialogRole' });
$.bc({ id: userId, url: Role.url, method: 'PUT', data: { type: "user", roleIds: roleIds }, title: Role.title, modal: '#dialogRole' });
}
}, {
id: 'btnSubmitGroup',
@ -70,7 +70,7 @@
var groupIds = $dialogGroup.find(':checked').map(function (index, element) {
return $(element).val();
}).toArray().join(',');
$.bc({ Id: userId, url: Group.url, method: 'PUT', data: { type: "user", groupIds: groupIds }, title: Group.title, modal: 'dialogGroup' });
$.bc({ id: userId, url: Group.url, method: 'PUT', data: { type: "user", groupIds: groupIds }, title: Group.title, modal: '#dialogGroup' });
}
}]
},

View File

@ -166,28 +166,30 @@
$.bc({
url: options.url, data: options.data, title: "保存数据", modal: options.modal,
callback: function (result) {
var finalData = null;
var index = 0;
if (result) {
if (options.bootstrapTable.constructor === String && options.data.Id.constructor === String) {
// 更新表格
if (options.data.Id > 0) {
var allTableData = $(options.bootstrapTable).bootstrapTable('getData');
for (index = 0; index < allTableData.length; index++) {
finalData = allTableData[index];
if (finalData.Id == options.data.Id) {
$(options.bootstrapTable).bootstrapTable('updateRow', { index: index, row: $.extend(finalData, options.data) });
break;
var finalData = null;
var index = 0;
if (result) {
if (options.bootstrapTable.constructor === String && options.data.Id.constructor === String) {
// 更新表格
if (options.data.Id > 0) {
var allTableData = $(options.bootstrapTable).bootstrapTable('getData');
for (index = 0; index < allTableData.length; index++) {
finalData = allTableData[index];
if (finalData.Id == options.data.Id) {
break;
}
}
}
}
else {
$(options.bootstrapTable).bootstrapTable('refresh');
finalData = options.data;
else {
$(options.bootstrapTable).bootstrapTable('refresh');
finalData = options.data;
}
}
}
$(options.bootstrapTable).bootstrapTable('refresh');
handlerCallback.call(that, callback, e, { oper: 'save', success: result, index: index, data: finalData });
}
handlerCallback.call(that, callback, e, { oper: 'save', success: result, index: index, data: finalData });
}
});
},

View File

@ -45,7 +45,12 @@
var log = function (url, data) {
$.extend(data, { requestUrl: window.location.pathname });
$.post(url, data);
$.post({
url: url,
data: JSON.stringify(data),
contentType: 'application/json',
dataType: 'json'
});
}
})(jQuery);