[增加]form增加data-search行为处理

This commit is contained in:
邹景立 2017-03-29 18:28:23 +08:00
parent cc30c1a713
commit 93f97cd78e

View File

@ -30,6 +30,16 @@ define(['jquery', 'admin.plugs'], function () {
return _goLoad.call(this); return _goLoad.call(this);
}); });
/*! 注册 data-serach 表单搜索行为 */
this.$body.on('submit', 'form[data-serach]', function () {
var split = this.action.indexOf('?') === -1 ? '?' : '&';
if ((this.method || 'get').toLowerCase() === 'get') {
window.location.href = '#' + parseUri(this.action + split + $(this).serialize());
} else {
$.form.load(this.action, this, 'post');
}
});
/*! 注册 data-modal 事件行为 */ /*! 注册 data-modal 事件行为 */
this.$body.on('click', '[data-modal]', function () { this.$body.on('click', '[data-modal]', function () {
return $.form.modal($(this).attr('data-modal'), 'open_type=modal', $(this).attr('data-title') || '编辑'); return $.form.modal($(this).attr('data-modal'), 'open_type=modal', $(this).attr('data-title') || '编辑');
@ -57,11 +67,11 @@ define(['jquery', 'admin.plugs'], function () {
/*! 注册 data-update 事件行为 */ /*! 注册 data-update 事件行为 */
this.$body.on('click', '[data-update]', function () { this.$body.on('click', '[data-update]', function () {
var id = $(this).attr('data-update') || (function () { var id = $(this).attr('data-update') || (function () {
var data = []; var data = [];
return $($(this).attr('data-list-target') || 'input.list-check-box').map(function () { return $($(this).attr('data-list-target') || 'input.list-check-box').map(function () {
(this.checked) && data.push(this.value); (this.checked) && data.push(this.value);
}), data.join(','); }), data.join(',');
}).call(this); }).call(this);
if (id.length < 1) { if (id.length < 1) {
return $.msg.tips('请选择需要操作的数据!'); return $.msg.tips('请选择需要操作的数据!');
} }