mirror of https://gitee.com/karson/fastadmin.git
新增自定义编辑删除按钮
parent
9b2ec96a03
commit
b6f2307737
|
|
@ -8772,6 +8772,7 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
|
||||||
|
|
||||||
return $[NS] = Validator;
|
return $[NS] = Validator;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
/*********************************
|
/*********************************
|
||||||
* Themes, rules, and i18n support
|
* Themes, rules, and i18n support
|
||||||
* Locale: Chinese; 中文
|
* Locale: Chinese; 中文
|
||||||
|
|
@ -9980,6 +9981,29 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
||||||
destroyallbtn: '.btn-destroyall',
|
destroyallbtn: '.btn-destroyall',
|
||||||
dragsortfield: 'weigh',
|
dragsortfield: 'weigh',
|
||||||
},
|
},
|
||||||
|
button: {
|
||||||
|
edit: {
|
||||||
|
name: 'edit',
|
||||||
|
icon: 'fa fa-pencil',
|
||||||
|
title: __('Edit'),
|
||||||
|
extend: 'data-toggle="tooltip"',
|
||||||
|
classname: 'btn btn-xs btn-success btn-editone'
|
||||||
|
},
|
||||||
|
del: {
|
||||||
|
name: 'del',
|
||||||
|
icon: 'fa fa-trash',
|
||||||
|
title: __('Del'),
|
||||||
|
extend: 'data-toggle="tooltip"',
|
||||||
|
classname: 'btn btn-xs btn-danger btn-delone'
|
||||||
|
},
|
||||||
|
dragsort: {
|
||||||
|
name: 'dragsort',
|
||||||
|
icon: 'fa fa-arrows',
|
||||||
|
title: __('Drag to sort'),
|
||||||
|
extend: 'data-toggle="tooltip"',
|
||||||
|
classname: 'btn btn-xs btn-primary btn-dragsort'
|
||||||
|
}
|
||||||
|
},
|
||||||
api: {
|
api: {
|
||||||
init: function (defaults, columnDefaults, locales) {
|
init: function (defaults, columnDefaults, locales) {
|
||||||
defaults = defaults ? defaults : {};
|
defaults = defaults ? defaults : {};
|
||||||
|
|
@ -10030,6 +10054,12 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
||||||
}
|
}
|
||||||
Toastr.error(__('Unknown data format'));
|
Toastr.error(__('Unknown data format'));
|
||||||
});
|
});
|
||||||
|
//当加载数据成功时
|
||||||
|
table.on('load-success.bs.table', function (e, data) {
|
||||||
|
if (typeof data.rows === 'undefined' && typeof data.code != 'undefined') {
|
||||||
|
Toastr.error(data.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
//当刷新表格时
|
//当刷新表格时
|
||||||
table.on('refresh.bs.table', function (e, settings, data) {
|
table.on('refresh.bs.table', function (e, settings, data) {
|
||||||
$(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin");
|
$(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin");
|
||||||
|
|
@ -10481,32 +10511,14 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
||||||
names.push(item.name);
|
names.push(item.name);
|
||||||
});
|
});
|
||||||
if (options.extend.dragsort_url !== '' && names.indexOf('dragsort') === -1) {
|
if (options.extend.dragsort_url !== '' && names.indexOf('dragsort') === -1) {
|
||||||
buttons.push({
|
buttons.push(Table.button.dragsort);
|
||||||
name: 'dragsort',
|
|
||||||
icon: 'fa fa-arrows',
|
|
||||||
title: __('Drag to sort'),
|
|
||||||
extend: 'data-toggle="tooltip"',
|
|
||||||
classname: 'btn btn-xs btn-primary btn-dragsort'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
if (options.extend.edit_url !== '' && names.indexOf('edit') === -1) {
|
if (options.extend.edit_url !== '' && names.indexOf('edit') === -1) {
|
||||||
buttons.push({
|
Table.button.edit.url = options.extend.edit_url;
|
||||||
name: 'edit',
|
buttons.push(Table.button.edit);
|
||||||
icon: 'fa fa-pencil',
|
|
||||||
title: __('Edit'),
|
|
||||||
extend: 'data-toggle="tooltip"',
|
|
||||||
classname: 'btn btn-xs btn-success btn-editone',
|
|
||||||
url: options.extend.edit_url
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
if (options.extend.del_url !== '' && names.indexOf('del') === -1) {
|
if (options.extend.del_url !== '' && names.indexOf('del') === -1) {
|
||||||
buttons.push({
|
buttons.push(Table.button.del);
|
||||||
name: 'del',
|
|
||||||
icon: 'fa fa-trash',
|
|
||||||
title: __('Del'),
|
|
||||||
extend: 'data-toggle="tooltip"',
|
|
||||||
classname: 'btn btn-xs btn-danger btn-delone'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return Table.api.buttonlink(this, buttons, value, row, index, 'operate');
|
return Table.api.buttonlink(this, buttons, value, row, index, 'operate');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,29 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
|
||||||
destroyallbtn: '.btn-destroyall',
|
destroyallbtn: '.btn-destroyall',
|
||||||
dragsortfield: 'weigh',
|
dragsortfield: 'weigh',
|
||||||
},
|
},
|
||||||
|
button: {
|
||||||
|
edit: {
|
||||||
|
name: 'edit',
|
||||||
|
icon: 'fa fa-pencil',
|
||||||
|
title: __('Edit'),
|
||||||
|
extend: 'data-toggle="tooltip"',
|
||||||
|
classname: 'btn btn-xs btn-success btn-editone'
|
||||||
|
},
|
||||||
|
del: {
|
||||||
|
name: 'del',
|
||||||
|
icon: 'fa fa-trash',
|
||||||
|
title: __('Del'),
|
||||||
|
extend: 'data-toggle="tooltip"',
|
||||||
|
classname: 'btn btn-xs btn-danger btn-delone'
|
||||||
|
},
|
||||||
|
dragsort: {
|
||||||
|
name: 'dragsort',
|
||||||
|
icon: 'fa fa-arrows',
|
||||||
|
title: __('Drag to sort'),
|
||||||
|
extend: 'data-toggle="tooltip"',
|
||||||
|
classname: 'btn btn-xs btn-primary btn-dragsort'
|
||||||
|
}
|
||||||
|
},
|
||||||
api: {
|
api: {
|
||||||
init: function (defaults, columnDefaults, locales) {
|
init: function (defaults, columnDefaults, locales) {
|
||||||
defaults = defaults ? defaults : {};
|
defaults = defaults ? defaults : {};
|
||||||
|
|
@ -122,6 +145,12 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
|
||||||
}
|
}
|
||||||
Toastr.error(__('Unknown data format'));
|
Toastr.error(__('Unknown data format'));
|
||||||
});
|
});
|
||||||
|
//当加载数据成功时
|
||||||
|
table.on('load-success.bs.table', function (e, data) {
|
||||||
|
if (typeof data.rows === 'undefined' && typeof data.code != 'undefined') {
|
||||||
|
Toastr.error(data.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
//当刷新表格时
|
//当刷新表格时
|
||||||
table.on('refresh.bs.table', function (e, settings, data) {
|
table.on('refresh.bs.table', function (e, settings, data) {
|
||||||
$(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin");
|
$(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin");
|
||||||
|
|
@ -573,32 +602,14 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
|
||||||
names.push(item.name);
|
names.push(item.name);
|
||||||
});
|
});
|
||||||
if (options.extend.dragsort_url !== '' && names.indexOf('dragsort') === -1) {
|
if (options.extend.dragsort_url !== '' && names.indexOf('dragsort') === -1) {
|
||||||
buttons.push({
|
buttons.push(Table.button.dragsort);
|
||||||
name: 'dragsort',
|
|
||||||
icon: 'fa fa-arrows',
|
|
||||||
title: __('Drag to sort'),
|
|
||||||
extend: 'data-toggle="tooltip"',
|
|
||||||
classname: 'btn btn-xs btn-primary btn-dragsort'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
if (options.extend.edit_url !== '' && names.indexOf('edit') === -1) {
|
if (options.extend.edit_url !== '' && names.indexOf('edit') === -1) {
|
||||||
buttons.push({
|
Table.button.edit.url = options.extend.edit_url;
|
||||||
name: 'edit',
|
buttons.push(Table.button.edit);
|
||||||
icon: 'fa fa-pencil',
|
|
||||||
title: __('Edit'),
|
|
||||||
extend: 'data-toggle="tooltip"',
|
|
||||||
classname: 'btn btn-xs btn-success btn-editone',
|
|
||||||
url: options.extend.edit_url
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
if (options.extend.del_url !== '' && names.indexOf('del') === -1) {
|
if (options.extend.del_url !== '' && names.indexOf('del') === -1) {
|
||||||
buttons.push({
|
buttons.push(Table.button.del);
|
||||||
name: 'del',
|
|
||||||
icon: 'fa fa-trash',
|
|
||||||
title: __('Del'),
|
|
||||||
extend: 'data-toggle="tooltip"',
|
|
||||||
classname: 'btn btn-xs btn-danger btn-delone'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return Table.api.buttonlink(this, buttons, value, row, index, 'operate');
|
return Table.api.buttonlink(this, buttons, value, row, index, 'operate');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue