Merge pull request !10 from Argo-QQ/dev

This commit is contained in:
Argo-QQ 2019-03-20 14:39:37 +08:00 committed by Argo
commit 809efa3029
2 changed files with 31 additions and 5 deletions

View File

@ -1,4 +1,4 @@
(function ($) {
(function ($) {
// 增加Array扩展
if (!$.isFunction(Array.prototype.filter)) {
Array.prototype.filter = function (callback, thisObject) {
@ -285,7 +285,7 @@
url: options.url,
checkbox: true,
edit: true,
editTitle: "编辑",
editTitle: "操作",
editField: "Id",
queryButton: false
}, options.smartTable);
@ -294,7 +294,7 @@
field: settings.editField,
events: bsa.idEvents(),
formatter: function (value, row, index) {
return "<a class='edit' title='" + value + "' href='javascript:void(0)'>" + this.title + "</a>";
return "<div class='btn-group'><button class='edit btn btn-sm btn-success'><i class='fa fa-edit'></i><span>编辑</span></button><button class='del btn btn-sm btn-danger'><i class='fa fa-remove'></i><span>删除</span></button></div>";
}
});
if (settings.checkbox) settings.columns.unshift({ checkbox: true });

View File

@ -1,4 +1,4 @@
(function ($) {
(function ($) {
DataEntity = function (options) {
this.options = options;
};
@ -179,7 +179,8 @@
dataEntity: this.dataEntity,
table: this.options.bootstrapTable,
modal: this.options.modal,
src: this
src: this,
url: this.options.url
};
return {
'click .edit': function (e, value, row, index) {
@ -188,6 +189,31 @@
$(op.table).bootstrapTable('check', index);
handlerCallback.call(op.src, null, e, { oper: 'edit', data: row });
$(op.modal).modal("show");
},
'click .del': function (e, value, row, index) {
swal({
html: true,
title: "删除数据",
text: "您确定要删除 <span class='text-danger font-weight-bold'>" + row.Name + "</span> 吗?",
type: "warning",
showCancelButton: true,
cancelButtonClass: 'btn-secondary',
confirmButtonText: "我要删除",
confirmButtonClass: "btn-danger ml-2",
cancelButtonText: "取消"
}, function () {
$.logData.push({ url: op.url, data: $.extend({}, row, { _nodes: null }) });
setTimeout(function () {
var iDs = [value];
$.bc({
url: op.url, data: iDs, method: 'delete', title: '删除数据',
callback: function (result) {
if (result) $(op.table).bootstrapTable('refresh');
handlerCallback.call(op.src, null, e, { oper: 'del', success: result });
}
});
}, 100);
});
}
};
}