作者 Karson

新增自定义编辑删除按钮

@@ -6638,8 +6638,8 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un @@ -6638,8 +6638,8 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
6638 */ 6638 */
6639 ;(function(factory) { 6639 ;(function(factory) {
6640 typeof module === 'object' && module.exports ? module.exports = factory( require( 'jquery' ) ) : 6640 typeof module === 'object' && module.exports ? module.exports = factory( require( 'jquery' ) ) :
6641 - typeof define === 'function' && define.amd ? define('validator-core',['jquery'], factory) :  
6642 - factory(jQuery); 6641 + typeof define === 'function' && define.amd ? define('validator-core',['jquery'], factory) :
  6642 + factory(jQuery);
6643 }(function($, undefined) { 6643 }(function($, undefined) {
6644 'use strict'; 6644 'use strict';
6645 6645
@@ -6746,56 +6746,56 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un @@ -6746,56 +6746,56 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
6746 6746
6747 /** jQuery Plugin 6747 /** jQuery Plugin
6748 * @param {Object} options 6748 * @param {Object} options
6749 - debug {Boolean} 0 Whether to enable debug mode  
6750 - timely {Number} 1 Whether to enable timely validation  
6751 - theme {String} 'default' Theme name  
6752 - stopOnError {Boolean} false Whether to stop validate when found an error input  
6753 - focusCleanup {Boolean} false Whether to clean up the field message when focus the field  
6754 - focusInvalid {Boolean} true Whether to focus the field that is invalid  
6755 - ignoreBlank {Boolean} false When the field has no value, whether to ignore validation  
6756 - ignore {jqSelector} '' Ignored fields (Using jQuery selector)  
6757 -  
6758 - beforeSubmit {Function} Do something before submit form  
6759 - dataFilter {Function} Convert ajax results  
6760 - valid {Function} Triggered when the form is valid  
6761 - invalid {Function} Triggered when the form is invalid  
6762 - validClass {String} 'n-valid' Add this class name to a valid field  
6763 - invalidClass {String} 'n-invalid' Add this class name to a invalid field  
6764 - bindClassTo {jqSelector} ':verifiable' Which element should the className binding to  
6765 -  
6766 - display {Function} Callback function to get dynamic display  
6767 - target {Function} Callback function to get dynamic target  
6768 - msgShow {Function} Trigger this callback when show message  
6769 - msgHide {Function} Trigger this callback when hide message  
6770 - msgWrapper {String} 'span' Message wrapper tag name  
6771 - msgMaker {Function} Callback function to make message HTML  
6772 - msgArrow {String} Message arrow template  
6773 - msgIcon {String} Message icon template  
6774 - msgStyle {String} Custom message css style  
6775 - msgClass {String} Additional added to the message class names  
6776 - formClass {String} Additional added to the form class names  
6777 -  
6778 - messages {Object} Custom messages for the current instance  
6779 - rules {Object} Custom rules for the current instance  
6780 - fields {Object} Field validation configuration  
6781 - {String} key name|#id  
6782 - {String|Object} value Rule string or an object which can pass more arguments  
6783 -  
6784 - fields[key][rule] {String} Rule string  
6785 - fields[key][display] {String|Function}  
6786 - fields[key][tip] {String} Custom tip message  
6787 - fields[key][ok] {String} Custom success message  
6788 - fields[key][msg] {Object} Custom error message  
6789 - fields[key][msgStyle] {String} Custom message style  
6790 - fields[key][msgClass] {String} A className which added to message placeholder element  
6791 - fields[key][msgWrapper] {String} Tag name of the message placeholder element  
6792 - fields[key][msgMaker] {Function} A function to custom message HTML  
6793 - fields[key][dataFilter] {Function} A function to convert ajax results  
6794 - fields[key][valid] {Function} A function triggered when field is valid  
6795 - fields[key][invalid] {Function} A function triggered when field is invalid  
6796 - fields[key][must] {Boolean} If set true, we always check the field even has remote checking  
6797 - fields[key][timely] {Boolean} Whether to enable timely validation  
6798 - fields[key][target] {jqSelector} Define placement of a message 6749 + debug {Boolean} 0 Whether to enable debug mode
  6750 + timely {Number} 1 Whether to enable timely validation
  6751 + theme {String} 'default' Theme name
  6752 + stopOnError {Boolean} false Whether to stop validate when found an error input
  6753 + focusCleanup {Boolean} false Whether to clean up the field message when focus the field
  6754 + focusInvalid {Boolean} true Whether to focus the field that is invalid
  6755 + ignoreBlank {Boolean} false When the field has no value, whether to ignore validation
  6756 + ignore {jqSelector} '' Ignored fields (Using jQuery selector)
  6757 +
  6758 + beforeSubmit {Function} Do something before submit form
  6759 + dataFilter {Function} Convert ajax results
  6760 + valid {Function} Triggered when the form is valid
  6761 + invalid {Function} Triggered when the form is invalid
  6762 + validClass {String} 'n-valid' Add this class name to a valid field
  6763 + invalidClass {String} 'n-invalid' Add this class name to a invalid field
  6764 + bindClassTo {jqSelector} ':verifiable' Which element should the className binding to
  6765 +
  6766 + display {Function} Callback function to get dynamic display
  6767 + target {Function} Callback function to get dynamic target
  6768 + msgShow {Function} Trigger this callback when show message
  6769 + msgHide {Function} Trigger this callback when hide message
  6770 + msgWrapper {String} 'span' Message wrapper tag name
  6771 + msgMaker {Function} Callback function to make message HTML
  6772 + msgArrow {String} Message arrow template
  6773 + msgIcon {String} Message icon template
  6774 + msgStyle {String} Custom message css style
  6775 + msgClass {String} Additional added to the message class names
  6776 + formClass {String} Additional added to the form class names
  6777 +
  6778 + messages {Object} Custom messages for the current instance
  6779 + rules {Object} Custom rules for the current instance
  6780 + fields {Object} Field validation configuration
  6781 + {String} key name|#id
  6782 + {String|Object} value Rule string or an object which can pass more arguments
  6783 +
  6784 + fields[key][rule] {String} Rule string
  6785 + fields[key][display] {String|Function}
  6786 + fields[key][tip] {String} Custom tip message
  6787 + fields[key][ok] {String} Custom success message
  6788 + fields[key][msg] {Object} Custom error message
  6789 + fields[key][msgStyle] {String} Custom message style
  6790 + fields[key][msgClass] {String} A className which added to message placeholder element
  6791 + fields[key][msgWrapper] {String} Tag name of the message placeholder element
  6792 + fields[key][msgMaker] {Function} A function to custom message HTML
  6793 + fields[key][dataFilter] {Function} A function to convert ajax results
  6794 + fields[key][valid] {Function} A function triggered when field is valid
  6795 + fields[key][invalid] {Function} A function triggered when field is invalid
  6796 + fields[key][must] {Boolean} If set true, we always check the field even has remote checking
  6797 + fields[key][timely] {Boolean} Whether to enable timely validation
  6798 + fields[key][target] {jqSelector} Define placement of a message
6799 */ 6799 */
6800 $.fn.validator = function(options) { 6800 $.fn.validator = function(options) {
6801 var that = this, 6801 var that = this,
@@ -6865,10 +6865,10 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un @@ -6865,10 +6865,10 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
6865 var name = elem.nodeName.toLowerCase(); 6865 var name = elem.nodeName.toLowerCase();
6866 6866
6867 return ( name === 'input' && !({submit: 1, button: 1, reset: 1, image: 1})[elem.type] || 6867 return ( name === 'input' && !({submit: 1, button: 1, reset: 1, image: 1})[elem.type] ||
6868 - name === 'select' ||  
6869 - name === 'textarea' ||  
6870 - elem.contentEditable === 'true'  
6871 - ) && !elem.disabled; 6868 + name === 'select' ||
  6869 + name === 'textarea' ||
  6870 + elem.contentEditable === 'true'
  6871 + ) && !elem.disabled;
6872 }, 6872 },
6873 // any value, but not only whitespace 6873 // any value, but not only whitespace
6874 filled: function(elem) { 6874 filled: function(elem) {
@@ -7038,7 +7038,7 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un @@ -7038,7 +7038,7 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
7038 !key || 7038 !key ||
7039 // If dataRule and element are diffrent from old's, we use ID mode. 7039 // If dataRule and element are diffrent from old's, we use ID mode.
7040 (dataRule !== null && (field = me.fields[key]) && dataRule !== field.rule && el.id !== field.key) 7040 (dataRule !== null && (field = me.fields[key]) && dataRule !== field.rule && el.id !== field.key)
7041 - ) 7041 + )
7042 ) { 7042 ) {
7043 key = '#' + el.id; 7043 key = '#' + el.id;
7044 } 7044 }
@@ -7463,7 +7463,7 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un @@ -7463,7 +7463,7 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
7463 7463
7464 // trigger event 7464 // trigger event
7465 $(el).attr( ARIA_INVALID, isValid ? null : true ) 7465 $(el).attr( ARIA_INVALID, isValid ? null : true )
7466 - .trigger( callback + CLS_NS_FIELD, [ret, me] ); 7466 + .trigger( callback + CLS_NS_FIELD, [ret, me] );
7467 me.$el.triggerHandler('validation', [ret, me]); 7467 me.$el.triggerHandler('validation', [ret, me]);
7468 7468
7469 if (me.checkOnly) return; 7469 if (me.checkOnly) return;
@@ -8285,34 +8285,34 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un @@ -8285,34 +8285,34 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
8285 }); 8285 });
8286 8286
8287 $(document) 8287 $(document)
8288 - .on('click', ':submit', function(){  
8289 - var input = this, attrNode;  
8290 - if (!input.form) return;  
8291 - // Shim for "formnovalidate"  
8292 - attrNode = input.getAttributeNode('formnovalidate');  
8293 - if (attrNode && attrNode.nodeValue !== null || attr(input, NOVALIDATE)!== null) {  
8294 - novalidateonce = true;  
8295 - }  
8296 - })  
8297 - // Automatic initializing form validation  
8298 - .on('focusin submit validate', 'form,.'+CLS_WRAPPER, function(e) {  
8299 - if ( attr(this, NOVALIDATE) !== null ) return;  
8300 - var $form = $(this), me;  
8301 -  
8302 - if ( !$form.data(NS) && (me = _getInstance(this)) ) {  
8303 - if ( !$.isEmptyObject(me.fields) ) {  
8304 - // Execute event handler  
8305 - if (e.type === 'focusin') {  
8306 - me._focusin(e);  
8307 - } else {  
8308 - me._submit(e);  
8309 - } 8288 + .on('click', ':submit', function(){
  8289 + var input = this, attrNode;
  8290 + if (!input.form) return;
  8291 + // Shim for "formnovalidate"
  8292 + attrNode = input.getAttributeNode('formnovalidate');
  8293 + if (attrNode && attrNode.nodeValue !== null || attr(input, NOVALIDATE)!== null) {
  8294 + novalidateonce = true;
  8295 + }
  8296 + })
  8297 + // Automatic initializing form validation
  8298 + .on('focusin submit validate', 'form,.'+CLS_WRAPPER, function(e) {
  8299 + if ( attr(this, NOVALIDATE) !== null ) return;
  8300 + var $form = $(this), me;
  8301 +
  8302 + if ( !$form.data(NS) && (me = _getInstance(this)) ) {
  8303 + if ( !$.isEmptyObject(me.fields) ) {
  8304 + // Execute event handler
  8305 + if (e.type === 'focusin') {
  8306 + me._focusin(e);
8310 } else { 8307 } else {
8311 - attr(this, NOVALIDATE, NOVALIDATE);  
8312 - $form.off(CLS_NS).removeData(NS); 8308 + me._submit(e);
8313 } 8309 }
  8310 + } else {
  8311 + attr(this, NOVALIDATE, NOVALIDATE);
  8312 + $form.off(CLS_NS).removeData(NS);
8314 } 8313 }
8315 - }); 8314 + }
  8315 + });
8316 8316
8317 new Messages({ 8317 new Messages({
8318 fallback: 'This field is not valid.', 8318 fallback: 'This field is not valid.',
@@ -8327,11 +8327,11 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un @@ -8327,11 +8327,11 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
8327 * required 8327 * required
8328 * 8328 *
8329 * @example: 8329 * @example:
8330 - required  
8331 - required(jqSelector)  
8332 - required(anotherRule)  
8333 - required(not, -1)  
8334 - required(from, .contact) 8330 + required
  8331 + required(jqSelector)
  8332 + required(anotherRule)
  8333 + required(not, -1)
  8334 + required(from, .contact)
8335 */ 8335 */
8336 required: function(element, params) { 8336 required: function(element, params) {
8337 var me = this, 8337 var me = this,
@@ -8391,11 +8391,11 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un @@ -8391,11 +8391,11 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
8391 * integer 8391 * integer
8392 * 8392 *
8393 * @example: 8393 * @example:
8394 - integer  
8395 - integer[+]  
8396 - integer[+0]  
8397 - integer[-]  
8398 - integer[-0] 8394 + integer
  8395 + integer[+]
  8396 + integer[+0]
  8397 + integer[-]
  8398 + integer[-0]
8399 */ 8399 */
8400 integer: function(element, params) { 8400 integer: function(element, params) {
8401 var re, z = '0|', 8401 var re, z = '0|',
@@ -8427,15 +8427,15 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un @@ -8427,15 +8427,15 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
8427 * match another field 8427 * match another field
8428 * 8428 *
8429 * @example: 8429 * @example:
8430 - match[password] Match the password field (two values ​​must be the same)  
8431 - match[eq, password] Ditto  
8432 - match[neq, count] The value must be not equal to the value of the count field  
8433 - match[lt, count] The value must be less than the value of the count field  
8434 - match[lte, count] The value must be less than or equal to the value of the count field  
8435 - match[gt, count] The value must be greater than the value of the count field  
8436 - match[gte, count] The value must be greater than or equal to the value of the count field  
8437 - match[gte, startDate, date]  
8438 - match[gte, startTime, time] 8430 + match[password] Match the password field (two values ​​must be the same)
  8431 + match[eq, password] Ditto
  8432 + match[neq, count] The value must be not equal to the value of the count field
  8433 + match[lt, count] The value must be less than the value of the count field
  8434 + match[lte, count] The value must be less than or equal to the value of the count field
  8435 + match[gt, count] The value must be greater than the value of the count field
  8436 + match[gte, count] The value must be greater than or equal to the value of the count field
  8437 + match[gte, startDate, date]
  8438 + match[gte, startTime, time]
8439 **/ 8439 **/
8440 match: function(element, params) { 8440 match: function(element, params) {
8441 if (!params) return; 8441 if (!params) return;
@@ -8514,9 +8514,9 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un @@ -8514,9 +8514,9 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
8514 * range numbers 8514 * range numbers
8515 * 8515 *
8516 * @example: 8516 * @example:
8517 - range[0~99] Number 0-99  
8518 - range[0~] Number greater than or equal to 0  
8519 - range[~100] Number less than or equal to 100 8517 + range[0~99] Number 0-99
  8518 + range[0~] Number greater than or equal to 0
  8519 + range[~100] Number less than or equal to 100
8520 **/ 8520 **/
8521 range: function(element, params) { 8521 range: function(element, params) {
8522 return this.getRangeMsg(this.value, params); 8522 return this.getRangeMsg(this.value, params);
@@ -8526,11 +8526,11 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un @@ -8526,11 +8526,11 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
8526 * how many checkbox or radio inputs that checked 8526 * how many checkbox or radio inputs that checked
8527 * 8527 *
8528 * @example: 8528 * @example:
8529 - checked; no empty, same to required  
8530 - checked[1~3] 1-3 items  
8531 - checked[1~] greater than 1 item  
8532 - checked[~3] less than 3 items  
8533 - checked[3] 3 items 8529 + checked; no empty, same to required
  8530 + checked[1~3] 1-3 items
  8531 + checked[1~] greater than 1 item
  8532 + checked[~3] less than 3 items
  8533 + checked[3] 3 items
8534 **/ 8534 **/
8535 checked: function(element, params) { 8535 checked: function(element, params) {
8536 if ( !_checkable(element) ) return; 8536 if ( !_checkable(element) ) return;
@@ -8560,10 +8560,10 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un @@ -8560,10 +8560,10 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
8560 * length of a characters (You can pass the second parameter "true", will calculate the length in bytes) 8560 * length of a characters (You can pass the second parameter "true", will calculate the length in bytes)
8561 * 8561 *
8562 * @example: 8562 * @example:
8563 - length[6~16] 6-16 characters  
8564 - length[6~] Greater than 6 characters  
8565 - length[~16] Less than 16 characters  
8566 - length[~16, true] Less than 16 characters, non-ASCII characters calculating two-character 8563 + length[6~16] 6-16 characters
  8564 + length[6~] Greater than 6 characters
  8565 + length[~16] Less than 16 characters
  8566 + length[~16, true] Less than 16 characters, non-ASCII characters calculating two-character
8567 **/ 8567 **/
8568 length: function(element, params) { 8568 length: function(element, params) {
8569 var value = this.value, 8569 var value = this.value,
@@ -8578,20 +8578,20 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un @@ -8578,20 +8578,20 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
8578 * @description 8578 * @description
8579 * remote([get:]url [, name1, [name2 ...]]); 8579 * remote([get:]url [, name1, [name2 ...]]);
8580 * Adaptation three kinds of results (Front for the successful, followed by a failure): 8580 * Adaptation three kinds of results (Front for the successful, followed by a failure):
8581 - 1. text:  
8582 - '' 'Error Message'  
8583 - 2. json:  
8584 - {"ok": ""} {"error": "Error Message"}  
8585 - 3. json wrapper:  
8586 - {"status": 1, "data": {"ok": ""}} {"status": 1, "data": {"error": "Error Message"}} 8581 + 1. text:
  8582 + '' 'Error Message'
  8583 + 2. json:
  8584 + {"ok": ""} {"error": "Error Message"}
  8585 + 3. json wrapper:
  8586 + {"status": 1, "data": {"ok": ""}} {"status": 1, "data": {"error": "Error Message"}}
8587 * @example 8587 * @example
8588 - The simplest: remote(path/to/server);  
8589 - With parameters: remote(path/to/server, name1, name2, ...);  
8590 - By GET: remote(get:path/to/server, name1, name2, ...);  
8591 - Name proxy: remote(path/to/server, name1, proxyname2:name2, proxyname3:#id3, ...)  
8592 - Query String remote(path/to/server, foo=1&bar=2, name1, name2, ...)  
8593 - CORS remote(cors:path/to/server)  
8594 - JSONP remote(jsonp:path/to/server) 8588 + The simplest: remote(path/to/server);
  8589 + With parameters: remote(path/to/server, name1, name2, ...);
  8590 + By GET: remote(get:path/to/server, name1, name2, ...);
  8591 + Name proxy: remote(path/to/server, name1, proxyname2:name2, proxyname3:#id3, ...)
  8592 + Query String remote(path/to/server, foo=1&bar=2, name1, name2, ...)
  8593 + CORS remote(cors:path/to/server)
  8594 + JSONP remote(jsonp:path/to/server)
8595 */ 8595 */
8596 remote: function(element, params) { 8596 remote: function(element, params) {
8597 if (!params) return; 8597 if (!params) return;
@@ -8695,8 +8695,8 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un @@ -8695,8 +8695,8 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
8695 * @param {String|Object} name 8695 * @param {String|Object} name
8696 * @param {Object} obj 8696 * @param {Object} obj
8697 * @example 8697 * @example
8698 - .setTheme( themeName, themeOptions )  
8699 - .setTheme( multiThemes ) 8698 + .setTheme( themeName, themeOptions )
  8699 + .setTheme( multiThemes )
8700 */ 8700 */
8701 Validator.setTheme = function(name, obj) { 8701 Validator.setTheme = function(name, obj) {
8702 if ( isObject(name) ) { 8702 if ( isObject(name) ) {
@@ -8713,10 +8713,10 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un @@ -8713,10 +8713,10 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
8713 * @static load 8713 * @static load
8714 * @param {String} str 8714 * @param {String} str
8715 * @example 8715 * @example
8716 - .load('local=zh-CN') // load: local/zh-CN.js and jquery.validator.css  
8717 - .load('local=zh-CN&css=') // load: local/zh-CN.js  
8718 - .load('local&css') // load: local/en.js (set <html lang="en">) and jquery.validator.css  
8719 - .load('local') // dito 8716 + .load('local=zh-CN') // load: local/zh-CN.js and jquery.validator.css
  8717 + .load('local=zh-CN&css=') // load: local/zh-CN.js
  8718 + .load('local&css') // load: local/en.js (set <html lang="en">) and jquery.validator.css
  8719 + .load('local') // dito
8720 */ 8720 */
8721 Validator.load = function(str) { 8721 Validator.load = function(str) {
8722 if (!str) return; 8722 if (!str) return;
@@ -8772,6 +8772,7 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un @@ -8772,6 +8772,7 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
8772 8772
8773 return $[NS] = Validator; 8773 return $[NS] = Validator;
8774 })); 8774 }));
  8775 +
8775 /********************************* 8776 /*********************************
8776 * Themes, rules, and i18n support 8777 * Themes, rules, and i18n support
8777 * Locale: Chinese; 中文 8778 * Locale: Chinese; 中文
@@ -9980,6 +9981,29 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr @@ -9980,6 +9981,29 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
9980 destroyallbtn: '.btn-destroyall', 9981 destroyallbtn: '.btn-destroyall',
9981 dragsortfield: 'weigh', 9982 dragsortfield: 'weigh',
9982 }, 9983 },
  9984 + button: {
  9985 + edit: {
  9986 + name: 'edit',
  9987 + icon: 'fa fa-pencil',
  9988 + title: __('Edit'),
  9989 + extend: 'data-toggle="tooltip"',
  9990 + classname: 'btn btn-xs btn-success btn-editone'
  9991 + },
  9992 + del: {
  9993 + name: 'del',
  9994 + icon: 'fa fa-trash',
  9995 + title: __('Del'),
  9996 + extend: 'data-toggle="tooltip"',
  9997 + classname: 'btn btn-xs btn-danger btn-delone'
  9998 + },
  9999 + dragsort: {
  10000 + name: 'dragsort',
  10001 + icon: 'fa fa-arrows',
  10002 + title: __('Drag to sort'),
  10003 + extend: 'data-toggle="tooltip"',
  10004 + classname: 'btn btn-xs btn-primary btn-dragsort'
  10005 + }
  10006 + },
9983 api: { 10007 api: {
9984 init: function (defaults, columnDefaults, locales) { 10008 init: function (defaults, columnDefaults, locales) {
9985 defaults = defaults ? defaults : {}; 10009 defaults = defaults ? defaults : {};
@@ -10030,6 +10054,12 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr @@ -10030,6 +10054,12 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
10030 } 10054 }
10031 Toastr.error(__('Unknown data format')); 10055 Toastr.error(__('Unknown data format'));
10032 }); 10056 });
  10057 + //当加载数据成功时
  10058 + table.on('load-success.bs.table', function (e, data) {
  10059 + if (typeof data.rows === 'undefined' && typeof data.code != 'undefined') {
  10060 + Toastr.error(data.msg);
  10061 + }
  10062 + });
10033 //当刷新表格时 10063 //当刷新表格时
10034 table.on('refresh.bs.table', function (e, settings, data) { 10064 table.on('refresh.bs.table', function (e, settings, data) {
10035 $(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin"); 10065 $(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin");
@@ -10481,32 +10511,14 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr @@ -10481,32 +10511,14 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
10481 names.push(item.name); 10511 names.push(item.name);
10482 }); 10512 });
10483 if (options.extend.dragsort_url !== '' && names.indexOf('dragsort') === -1) { 10513 if (options.extend.dragsort_url !== '' && names.indexOf('dragsort') === -1) {
10484 - buttons.push({  
10485 - name: 'dragsort',  
10486 - icon: 'fa fa-arrows',  
10487 - title: __('Drag to sort'),  
10488 - extend: 'data-toggle="tooltip"',  
10489 - classname: 'btn btn-xs btn-primary btn-dragsort'  
10490 - }); 10514 + buttons.push(Table.button.dragsort);
10491 } 10515 }
10492 if (options.extend.edit_url !== '' && names.indexOf('edit') === -1) { 10516 if (options.extend.edit_url !== '' && names.indexOf('edit') === -1) {
10493 - buttons.push({  
10494 - name: 'edit',  
10495 - icon: 'fa fa-pencil',  
10496 - title: __('Edit'),  
10497 - extend: 'data-toggle="tooltip"',  
10498 - classname: 'btn btn-xs btn-success btn-editone',  
10499 - url: options.extend.edit_url  
10500 - }); 10517 + Table.button.edit.url = options.extend.edit_url;
  10518 + buttons.push(Table.button.edit);
10501 } 10519 }
10502 if (options.extend.del_url !== '' && names.indexOf('del') === -1) { 10520 if (options.extend.del_url !== '' && names.indexOf('del') === -1) {
10503 - buttons.push({  
10504 - name: 'del',  
10505 - icon: 'fa fa-trash',  
10506 - title: __('Del'),  
10507 - extend: 'data-toggle="tooltip"',  
10508 - classname: 'btn btn-xs btn-danger btn-delone'  
10509 - }); 10521 + buttons.push(Table.button.del);
10510 } 10522 }
10511 return Table.api.buttonlink(this, buttons, value, row, index, 'operate'); 10523 return Table.api.buttonlink(this, buttons, value, row, index, 'operate');
10512 } 10524 }
@@ -72,6 +72,29 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table @@ -72,6 +72,29 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
72 destroyallbtn: '.btn-destroyall', 72 destroyallbtn: '.btn-destroyall',
73 dragsortfield: 'weigh', 73 dragsortfield: 'weigh',
74 }, 74 },
  75 + button: {
  76 + edit: {
  77 + name: 'edit',
  78 + icon: 'fa fa-pencil',
  79 + title: __('Edit'),
  80 + extend: 'data-toggle="tooltip"',
  81 + classname: 'btn btn-xs btn-success btn-editone'
  82 + },
  83 + del: {
  84 + name: 'del',
  85 + icon: 'fa fa-trash',
  86 + title: __('Del'),
  87 + extend: 'data-toggle="tooltip"',
  88 + classname: 'btn btn-xs btn-danger btn-delone'
  89 + },
  90 + dragsort: {
  91 + name: 'dragsort',
  92 + icon: 'fa fa-arrows',
  93 + title: __('Drag to sort'),
  94 + extend: 'data-toggle="tooltip"',
  95 + classname: 'btn btn-xs btn-primary btn-dragsort'
  96 + }
  97 + },
75 api: { 98 api: {
76 init: function (defaults, columnDefaults, locales) { 99 init: function (defaults, columnDefaults, locales) {
77 defaults = defaults ? defaults : {}; 100 defaults = defaults ? defaults : {};
@@ -122,6 +145,12 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table @@ -122,6 +145,12 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
122 } 145 }
123 Toastr.error(__('Unknown data format')); 146 Toastr.error(__('Unknown data format'));
124 }); 147 });
  148 + //当加载数据成功时
  149 + table.on('load-success.bs.table', function (e, data) {
  150 + if (typeof data.rows === 'undefined' && typeof data.code != 'undefined') {
  151 + Toastr.error(data.msg);
  152 + }
  153 + });
125 //当刷新表格时 154 //当刷新表格时
126 table.on('refresh.bs.table', function (e, settings, data) { 155 table.on('refresh.bs.table', function (e, settings, data) {
127 $(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin"); 156 $(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin");
@@ -573,32 +602,14 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table @@ -573,32 +602,14 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
573 names.push(item.name); 602 names.push(item.name);
574 }); 603 });
575 if (options.extend.dragsort_url !== '' && names.indexOf('dragsort') === -1) { 604 if (options.extend.dragsort_url !== '' && names.indexOf('dragsort') === -1) {
576 - buttons.push({  
577 - name: 'dragsort',  
578 - icon: 'fa fa-arrows',  
579 - title: __('Drag to sort'),  
580 - extend: 'data-toggle="tooltip"',  
581 - classname: 'btn btn-xs btn-primary btn-dragsort'  
582 - }); 605 + buttons.push(Table.button.dragsort);
583 } 606 }
584 if (options.extend.edit_url !== '' && names.indexOf('edit') === -1) { 607 if (options.extend.edit_url !== '' && names.indexOf('edit') === -1) {
585 - buttons.push({  
586 - name: 'edit',  
587 - icon: 'fa fa-pencil',  
588 - title: __('Edit'),  
589 - extend: 'data-toggle="tooltip"',  
590 - classname: 'btn btn-xs btn-success btn-editone',  
591 - url: options.extend.edit_url  
592 - }); 608 + Table.button.edit.url = options.extend.edit_url;
  609 + buttons.push(Table.button.edit);
593 } 610 }
594 if (options.extend.del_url !== '' && names.indexOf('del') === -1) { 611 if (options.extend.del_url !== '' && names.indexOf('del') === -1) {
595 - buttons.push({  
596 - name: 'del',  
597 - icon: 'fa fa-trash',  
598 - title: __('Del'),  
599 - extend: 'data-toggle="tooltip"',  
600 - classname: 'btn btn-xs btn-danger btn-delone'  
601 - }); 612 + buttons.push(Table.button.del);
602 } 613 }
603 return Table.api.buttonlink(this, buttons, value, row, index, 'operate'); 614 return Table.api.buttonlink(this, buttons, value, row, index, 'operate');
604 } 615 }