mirror of https://gitee.com/karson/fastadmin.git
新增自定义编辑删除按钮
parent
9b2ec96a03
commit
b6f2307737
|
|
@ -6638,8 +6638,8 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
|
|||
*/
|
||||
;(function(factory) {
|
||||
typeof module === 'object' && module.exports ? module.exports = factory( require( 'jquery' ) ) :
|
||||
typeof define === 'function' && define.amd ? define('validator-core',['jquery'], factory) :
|
||||
factory(jQuery);
|
||||
typeof define === 'function' && define.amd ? define('validator-core',['jquery'], factory) :
|
||||
factory(jQuery);
|
||||
}(function($, undefined) {
|
||||
'use strict';
|
||||
|
||||
|
|
@ -6746,56 +6746,56 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
|
|||
|
||||
/** jQuery Plugin
|
||||
* @param {Object} options
|
||||
debug {Boolean} 0 Whether to enable debug mode
|
||||
timely {Number} 1 Whether to enable timely validation
|
||||
theme {String} 'default' Theme name
|
||||
stopOnError {Boolean} false Whether to stop validate when found an error input
|
||||
focusCleanup {Boolean} false Whether to clean up the field message when focus the field
|
||||
focusInvalid {Boolean} true Whether to focus the field that is invalid
|
||||
ignoreBlank {Boolean} false When the field has no value, whether to ignore validation
|
||||
ignore {jqSelector} '' Ignored fields (Using jQuery selector)
|
||||
debug {Boolean} 0 Whether to enable debug mode
|
||||
timely {Number} 1 Whether to enable timely validation
|
||||
theme {String} 'default' Theme name
|
||||
stopOnError {Boolean} false Whether to stop validate when found an error input
|
||||
focusCleanup {Boolean} false Whether to clean up the field message when focus the field
|
||||
focusInvalid {Boolean} true Whether to focus the field that is invalid
|
||||
ignoreBlank {Boolean} false When the field has no value, whether to ignore validation
|
||||
ignore {jqSelector} '' Ignored fields (Using jQuery selector)
|
||||
|
||||
beforeSubmit {Function} Do something before submit form
|
||||
dataFilter {Function} Convert ajax results
|
||||
valid {Function} Triggered when the form is valid
|
||||
invalid {Function} Triggered when the form is invalid
|
||||
validClass {String} 'n-valid' Add this class name to a valid field
|
||||
invalidClass {String} 'n-invalid' Add this class name to a invalid field
|
||||
bindClassTo {jqSelector} ':verifiable' Which element should the className binding to
|
||||
beforeSubmit {Function} Do something before submit form
|
||||
dataFilter {Function} Convert ajax results
|
||||
valid {Function} Triggered when the form is valid
|
||||
invalid {Function} Triggered when the form is invalid
|
||||
validClass {String} 'n-valid' Add this class name to a valid field
|
||||
invalidClass {String} 'n-invalid' Add this class name to a invalid field
|
||||
bindClassTo {jqSelector} ':verifiable' Which element should the className binding to
|
||||
|
||||
display {Function} Callback function to get dynamic display
|
||||
target {Function} Callback function to get dynamic target
|
||||
msgShow {Function} Trigger this callback when show message
|
||||
msgHide {Function} Trigger this callback when hide message
|
||||
msgWrapper {String} 'span' Message wrapper tag name
|
||||
msgMaker {Function} Callback function to make message HTML
|
||||
msgArrow {String} Message arrow template
|
||||
msgIcon {String} Message icon template
|
||||
msgStyle {String} Custom message css style
|
||||
msgClass {String} Additional added to the message class names
|
||||
formClass {String} Additional added to the form class names
|
||||
display {Function} Callback function to get dynamic display
|
||||
target {Function} Callback function to get dynamic target
|
||||
msgShow {Function} Trigger this callback when show message
|
||||
msgHide {Function} Trigger this callback when hide message
|
||||
msgWrapper {String} 'span' Message wrapper tag name
|
||||
msgMaker {Function} Callback function to make message HTML
|
||||
msgArrow {String} Message arrow template
|
||||
msgIcon {String} Message icon template
|
||||
msgStyle {String} Custom message css style
|
||||
msgClass {String} Additional added to the message class names
|
||||
formClass {String} Additional added to the form class names
|
||||
|
||||
messages {Object} Custom messages for the current instance
|
||||
rules {Object} Custom rules for the current instance
|
||||
fields {Object} Field validation configuration
|
||||
{String} key name|#id
|
||||
{String|Object} value Rule string or an object which can pass more arguments
|
||||
messages {Object} Custom messages for the current instance
|
||||
rules {Object} Custom rules for the current instance
|
||||
fields {Object} Field validation configuration
|
||||
{String} key name|#id
|
||||
{String|Object} value Rule string or an object which can pass more arguments
|
||||
|
||||
fields[key][rule] {String} Rule string
|
||||
fields[key][display] {String|Function}
|
||||
fields[key][tip] {String} Custom tip message
|
||||
fields[key][ok] {String} Custom success message
|
||||
fields[key][msg] {Object} Custom error message
|
||||
fields[key][msgStyle] {String} Custom message style
|
||||
fields[key][msgClass] {String} A className which added to message placeholder element
|
||||
fields[key][msgWrapper] {String} Tag name of the message placeholder element
|
||||
fields[key][msgMaker] {Function} A function to custom message HTML
|
||||
fields[key][dataFilter] {Function} A function to convert ajax results
|
||||
fields[key][valid] {Function} A function triggered when field is valid
|
||||
fields[key][invalid] {Function} A function triggered when field is invalid
|
||||
fields[key][must] {Boolean} If set true, we always check the field even has remote checking
|
||||
fields[key][timely] {Boolean} Whether to enable timely validation
|
||||
fields[key][target] {jqSelector} Define placement of a message
|
||||
fields[key][rule] {String} Rule string
|
||||
fields[key][display] {String|Function}
|
||||
fields[key][tip] {String} Custom tip message
|
||||
fields[key][ok] {String} Custom success message
|
||||
fields[key][msg] {Object} Custom error message
|
||||
fields[key][msgStyle] {String} Custom message style
|
||||
fields[key][msgClass] {String} A className which added to message placeholder element
|
||||
fields[key][msgWrapper] {String} Tag name of the message placeholder element
|
||||
fields[key][msgMaker] {Function} A function to custom message HTML
|
||||
fields[key][dataFilter] {Function} A function to convert ajax results
|
||||
fields[key][valid] {Function} A function triggered when field is valid
|
||||
fields[key][invalid] {Function} A function triggered when field is invalid
|
||||
fields[key][must] {Boolean} If set true, we always check the field even has remote checking
|
||||
fields[key][timely] {Boolean} Whether to enable timely validation
|
||||
fields[key][target] {jqSelector} Define placement of a message
|
||||
*/
|
||||
$.fn.validator = function(options) {
|
||||
var that = this,
|
||||
|
|
@ -6865,10 +6865,10 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
|
|||
var name = elem.nodeName.toLowerCase();
|
||||
|
||||
return ( name === 'input' && !({submit: 1, button: 1, reset: 1, image: 1})[elem.type] ||
|
||||
name === 'select' ||
|
||||
name === 'textarea' ||
|
||||
elem.contentEditable === 'true'
|
||||
) && !elem.disabled;
|
||||
name === 'select' ||
|
||||
name === 'textarea' ||
|
||||
elem.contentEditable === 'true'
|
||||
) && !elem.disabled;
|
||||
},
|
||||
// any value, but not only whitespace
|
||||
filled: function(elem) {
|
||||
|
|
@ -7038,7 +7038,7 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
|
|||
!key ||
|
||||
// If dataRule and element are diffrent from old's, we use ID mode.
|
||||
(dataRule !== null && (field = me.fields[key]) && dataRule !== field.rule && el.id !== field.key)
|
||||
)
|
||||
)
|
||||
) {
|
||||
key = '#' + el.id;
|
||||
}
|
||||
|
|
@ -7463,7 +7463,7 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
|
|||
|
||||
// trigger event
|
||||
$(el).attr( ARIA_INVALID, isValid ? null : true )
|
||||
.trigger( callback + CLS_NS_FIELD, [ret, me] );
|
||||
.trigger( callback + CLS_NS_FIELD, [ret, me] );
|
||||
me.$el.triggerHandler('validation', [ret, me]);
|
||||
|
||||
if (me.checkOnly) return;
|
||||
|
|
@ -8285,34 +8285,34 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
|
|||
});
|
||||
|
||||
$(document)
|
||||
.on('click', ':submit', function(){
|
||||
var input = this, attrNode;
|
||||
if (!input.form) return;
|
||||
// Shim for "formnovalidate"
|
||||
attrNode = input.getAttributeNode('formnovalidate');
|
||||
if (attrNode && attrNode.nodeValue !== null || attr(input, NOVALIDATE)!== null) {
|
||||
novalidateonce = true;
|
||||
}
|
||||
})
|
||||
// Automatic initializing form validation
|
||||
.on('focusin submit validate', 'form,.'+CLS_WRAPPER, function(e) {
|
||||
if ( attr(this, NOVALIDATE) !== null ) return;
|
||||
var $form = $(this), me;
|
||||
.on('click', ':submit', function(){
|
||||
var input = this, attrNode;
|
||||
if (!input.form) return;
|
||||
// Shim for "formnovalidate"
|
||||
attrNode = input.getAttributeNode('formnovalidate');
|
||||
if (attrNode && attrNode.nodeValue !== null || attr(input, NOVALIDATE)!== null) {
|
||||
novalidateonce = true;
|
||||
}
|
||||
})
|
||||
// Automatic initializing form validation
|
||||
.on('focusin submit validate', 'form,.'+CLS_WRAPPER, function(e) {
|
||||
if ( attr(this, NOVALIDATE) !== null ) return;
|
||||
var $form = $(this), me;
|
||||
|
||||
if ( !$form.data(NS) && (me = _getInstance(this)) ) {
|
||||
if ( !$.isEmptyObject(me.fields) ) {
|
||||
// Execute event handler
|
||||
if (e.type === 'focusin') {
|
||||
me._focusin(e);
|
||||
} else {
|
||||
me._submit(e);
|
||||
}
|
||||
if ( !$form.data(NS) && (me = _getInstance(this)) ) {
|
||||
if ( !$.isEmptyObject(me.fields) ) {
|
||||
// Execute event handler
|
||||
if (e.type === 'focusin') {
|
||||
me._focusin(e);
|
||||
} else {
|
||||
attr(this, NOVALIDATE, NOVALIDATE);
|
||||
$form.off(CLS_NS).removeData(NS);
|
||||
me._submit(e);
|
||||
}
|
||||
} else {
|
||||
attr(this, NOVALIDATE, NOVALIDATE);
|
||||
$form.off(CLS_NS).removeData(NS);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
new Messages({
|
||||
fallback: 'This field is not valid.',
|
||||
|
|
@ -8327,11 +8327,11 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
|
|||
* required
|
||||
*
|
||||
* @example:
|
||||
required
|
||||
required(jqSelector)
|
||||
required(anotherRule)
|
||||
required(not, -1)
|
||||
required(from, .contact)
|
||||
required
|
||||
required(jqSelector)
|
||||
required(anotherRule)
|
||||
required(not, -1)
|
||||
required(from, .contact)
|
||||
*/
|
||||
required: function(element, params) {
|
||||
var me = this,
|
||||
|
|
@ -8391,11 +8391,11 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
|
|||
* integer
|
||||
*
|
||||
* @example:
|
||||
integer
|
||||
integer[+]
|
||||
integer[+0]
|
||||
integer[-]
|
||||
integer[-0]
|
||||
integer
|
||||
integer[+]
|
||||
integer[+0]
|
||||
integer[-]
|
||||
integer[-0]
|
||||
*/
|
||||
integer: function(element, params) {
|
||||
var re, z = '0|',
|
||||
|
|
@ -8427,15 +8427,15 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
|
|||
* match another field
|
||||
*
|
||||
* @example:
|
||||
match[password] Match the password field (two values must be the same)
|
||||
match[eq, password] Ditto
|
||||
match[neq, count] The value must be not equal to the value of the count field
|
||||
match[lt, count] The value must be less than the value of the count field
|
||||
match[lte, count] The value must be less than or equal to the value of the count field
|
||||
match[gt, count] The value must be greater than the value of the count field
|
||||
match[gte, count] The value must be greater than or equal to the value of the count field
|
||||
match[gte, startDate, date]
|
||||
match[gte, startTime, time]
|
||||
match[password] Match the password field (two values must be the same)
|
||||
match[eq, password] Ditto
|
||||
match[neq, count] The value must be not equal to the value of the count field
|
||||
match[lt, count] The value must be less than the value of the count field
|
||||
match[lte, count] The value must be less than or equal to the value of the count field
|
||||
match[gt, count] The value must be greater than the value of the count field
|
||||
match[gte, count] The value must be greater than or equal to the value of the count field
|
||||
match[gte, startDate, date]
|
||||
match[gte, startTime, time]
|
||||
**/
|
||||
match: function(element, params) {
|
||||
if (!params) return;
|
||||
|
|
@ -8514,9 +8514,9 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
|
|||
* range numbers
|
||||
*
|
||||
* @example:
|
||||
range[0~99] Number 0-99
|
||||
range[0~] Number greater than or equal to 0
|
||||
range[~100] Number less than or equal to 100
|
||||
range[0~99] Number 0-99
|
||||
range[0~] Number greater than or equal to 0
|
||||
range[~100] Number less than or equal to 100
|
||||
**/
|
||||
range: function(element, params) {
|
||||
return this.getRangeMsg(this.value, params);
|
||||
|
|
@ -8526,11 +8526,11 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
|
|||
* how many checkbox or radio inputs that checked
|
||||
*
|
||||
* @example:
|
||||
checked; no empty, same to required
|
||||
checked[1~3] 1-3 items
|
||||
checked[1~] greater than 1 item
|
||||
checked[~3] less than 3 items
|
||||
checked[3] 3 items
|
||||
checked; no empty, same to required
|
||||
checked[1~3] 1-3 items
|
||||
checked[1~] greater than 1 item
|
||||
checked[~3] less than 3 items
|
||||
checked[3] 3 items
|
||||
**/
|
||||
checked: function(element, params) {
|
||||
if ( !_checkable(element) ) return;
|
||||
|
|
@ -8560,10 +8560,10 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
|
|||
* length of a characters (You can pass the second parameter "true", will calculate the length in bytes)
|
||||
*
|
||||
* @example:
|
||||
length[6~16] 6-16 characters
|
||||
length[6~] Greater than 6 characters
|
||||
length[~16] Less than 16 characters
|
||||
length[~16, true] Less than 16 characters, non-ASCII characters calculating two-character
|
||||
length[6~16] 6-16 characters
|
||||
length[6~] Greater than 6 characters
|
||||
length[~16] Less than 16 characters
|
||||
length[~16, true] Less than 16 characters, non-ASCII characters calculating two-character
|
||||
**/
|
||||
length: function(element, params) {
|
||||
var value = this.value,
|
||||
|
|
@ -8578,20 +8578,20 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
|
|||
* @description
|
||||
* remote([get:]url [, name1, [name2 ...]]);
|
||||
* Adaptation three kinds of results (Front for the successful, followed by a failure):
|
||||
1. text:
|
||||
'' 'Error Message'
|
||||
2. json:
|
||||
{"ok": ""} {"error": "Error Message"}
|
||||
3. json wrapper:
|
||||
{"status": 1, "data": {"ok": ""}} {"status": 1, "data": {"error": "Error Message"}}
|
||||
1. text:
|
||||
'' 'Error Message'
|
||||
2. json:
|
||||
{"ok": ""} {"error": "Error Message"}
|
||||
3. json wrapper:
|
||||
{"status": 1, "data": {"ok": ""}} {"status": 1, "data": {"error": "Error Message"}}
|
||||
* @example
|
||||
The simplest: remote(path/to/server);
|
||||
With parameters: remote(path/to/server, name1, name2, ...);
|
||||
By GET: remote(get:path/to/server, name1, name2, ...);
|
||||
Name proxy: remote(path/to/server, name1, proxyname2:name2, proxyname3:#id3, ...)
|
||||
Query String remote(path/to/server, foo=1&bar=2, name1, name2, ...)
|
||||
CORS remote(cors:path/to/server)
|
||||
JSONP remote(jsonp:path/to/server)
|
||||
The simplest: remote(path/to/server);
|
||||
With parameters: remote(path/to/server, name1, name2, ...);
|
||||
By GET: remote(get:path/to/server, name1, name2, ...);
|
||||
Name proxy: remote(path/to/server, name1, proxyname2:name2, proxyname3:#id3, ...)
|
||||
Query String remote(path/to/server, foo=1&bar=2, name1, name2, ...)
|
||||
CORS remote(cors:path/to/server)
|
||||
JSONP remote(jsonp:path/to/server)
|
||||
*/
|
||||
remote: function(element, params) {
|
||||
if (!params) return;
|
||||
|
|
@ -8695,8 +8695,8 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
|
|||
* @param {String|Object} name
|
||||
* @param {Object} obj
|
||||
* @example
|
||||
.setTheme( themeName, themeOptions )
|
||||
.setTheme( multiThemes )
|
||||
.setTheme( themeName, themeOptions )
|
||||
.setTheme( multiThemes )
|
||||
*/
|
||||
Validator.setTheme = function(name, obj) {
|
||||
if ( isObject(name) ) {
|
||||
|
|
@ -8713,10 +8713,10 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
|
|||
* @static load
|
||||
* @param {String} str
|
||||
* @example
|
||||
.load('local=zh-CN') // load: local/zh-CN.js and jquery.validator.css
|
||||
.load('local=zh-CN&css=') // load: local/zh-CN.js
|
||||
.load('local&css') // load: local/en.js (set <html lang="en">) and jquery.validator.css
|
||||
.load('local') // dito
|
||||
.load('local=zh-CN') // load: local/zh-CN.js and jquery.validator.css
|
||||
.load('local=zh-CN&css=') // load: local/zh-CN.js
|
||||
.load('local&css') // load: local/en.js (set <html lang="en">) and jquery.validator.css
|
||||
.load('local') // dito
|
||||
*/
|
||||
Validator.load = function(str) {
|
||||
if (!str) return;
|
||||
|
|
@ -8772,6 +8772,7 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
|
|||
|
||||
return $[NS] = Validator;
|
||||
}));
|
||||
|
||||
/*********************************
|
||||
* Themes, rules, and i18n support
|
||||
* Locale: Chinese; 中文
|
||||
|
|
@ -9980,6 +9981,29 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
|||
destroyallbtn: '.btn-destroyall',
|
||||
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: {
|
||||
init: function (defaults, columnDefaults, locales) {
|
||||
defaults = defaults ? defaults : {};
|
||||
|
|
@ -10030,6 +10054,12 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
|||
}
|
||||
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.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);
|
||||
});
|
||||
if (options.extend.dragsort_url !== '' && names.indexOf('dragsort') === -1) {
|
||||
buttons.push({
|
||||
name: 'dragsort',
|
||||
icon: 'fa fa-arrows',
|
||||
title: __('Drag to sort'),
|
||||
extend: 'data-toggle="tooltip"',
|
||||
classname: 'btn btn-xs btn-primary btn-dragsort'
|
||||
});
|
||||
buttons.push(Table.button.dragsort);
|
||||
}
|
||||
if (options.extend.edit_url !== '' && names.indexOf('edit') === -1) {
|
||||
buttons.push({
|
||||
name: 'edit',
|
||||
icon: 'fa fa-pencil',
|
||||
title: __('Edit'),
|
||||
extend: 'data-toggle="tooltip"',
|
||||
classname: 'btn btn-xs btn-success btn-editone',
|
||||
url: options.extend.edit_url
|
||||
});
|
||||
Table.button.edit.url = options.extend.edit_url;
|
||||
buttons.push(Table.button.edit);
|
||||
}
|
||||
if (options.extend.del_url !== '' && names.indexOf('del') === -1) {
|
||||
buttons.push({
|
||||
name: 'del',
|
||||
icon: 'fa fa-trash',
|
||||
title: __('Del'),
|
||||
extend: 'data-toggle="tooltip"',
|
||||
classname: 'btn btn-xs btn-danger btn-delone'
|
||||
});
|
||||
buttons.push(Table.button.del);
|
||||
}
|
||||
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',
|
||||
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: {
|
||||
init: function (defaults, columnDefaults, locales) {
|
||||
defaults = defaults ? defaults : {};
|
||||
|
|
@ -122,6 +145,12 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
|
|||
}
|
||||
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.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);
|
||||
});
|
||||
if (options.extend.dragsort_url !== '' && names.indexOf('dragsort') === -1) {
|
||||
buttons.push({
|
||||
name: 'dragsort',
|
||||
icon: 'fa fa-arrows',
|
||||
title: __('Drag to sort'),
|
||||
extend: 'data-toggle="tooltip"',
|
||||
classname: 'btn btn-xs btn-primary btn-dragsort'
|
||||
});
|
||||
buttons.push(Table.button.dragsort);
|
||||
}
|
||||
if (options.extend.edit_url !== '' && names.indexOf('edit') === -1) {
|
||||
buttons.push({
|
||||
name: 'edit',
|
||||
icon: 'fa fa-pencil',
|
||||
title: __('Edit'),
|
||||
extend: 'data-toggle="tooltip"',
|
||||
classname: 'btn btn-xs btn-success btn-editone',
|
||||
url: options.extend.edit_url
|
||||
});
|
||||
Table.button.edit.url = options.extend.edit_url;
|
||||
buttons.push(Table.button.edit);
|
||||
}
|
||||
if (options.extend.del_url !== '' && names.indexOf('del') === -1) {
|
||||
buttons.push({
|
||||
name: 'del',
|
||||
icon: 'fa fa-trash',
|
||||
title: __('Del'),
|
||||
extend: 'data-toggle="tooltip"',
|
||||
classname: 'btn btn-xs btn-danger btn-delone'
|
||||
});
|
||||
buttons.push(Table.button.del);
|
||||
}
|
||||
return Table.api.buttonlink(this, buttons, value, row, index, 'operate');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue