|
@@ -759,7 +759,7 @@ define('fast',['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, u
|
|
|
}
|
|
|
name = name.replace(/[\[\]]/g, "\\$&");
|
|
|
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
|
|
|
- results = regex.exec(url);
|
|
|
+ results = regex.exec(url);
|
|
|
if (!results)
|
|
|
return null;
|
|
|
if (!results[2])
|
|
@@ -788,31 +788,42 @@ define('fast',['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, u
|
|
|
$(layero).data("callback", that.callback);
|
|
|
//$(layero).removeClass("layui-layer-border");
|
|
|
Layer.setTop(layero);
|
|
|
- var frame = Layer.getChildFrame('html', index);
|
|
|
- var layerfooter = frame.find(".layer-footer");
|
|
|
- Fast.api.layerfooter(layero, index, that);
|
|
|
-
|
|
|
- //绑定事件
|
|
|
- if (layerfooter.size() > 0) {
|
|
|
- // 监听窗口内的元素及属性变化
|
|
|
- // Firefox和Chrome早期版本中带有前缀
|
|
|
- var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
|
|
|
- if (MutationObserver) {
|
|
|
- // 选择目标节点
|
|
|
- var target = layerfooter[0];
|
|
|
- // 创建观察者对象
|
|
|
- var observer = new MutationObserver(function (mutations) {
|
|
|
- Fast.api.layerfooter(layero, index, that);
|
|
|
- mutations.forEach(function (mutation) {
|
|
|
+ try {
|
|
|
+ var frame = Layer.getChildFrame('html', index);
|
|
|
+ var layerfooter = frame.find(".layer-footer");
|
|
|
+ Fast.api.layerfooter(layero, index, that);
|
|
|
+
|
|
|
+ //绑定事件
|
|
|
+ if (layerfooter.size() > 0) {
|
|
|
+ // 监听窗口内的元素及属性变化
|
|
|
+ // Firefox和Chrome早期版本中带有前缀
|
|
|
+ var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
|
|
|
+ if (MutationObserver) {
|
|
|
+ // 选择目标节点
|
|
|
+ var target = layerfooter[0];
|
|
|
+ // 创建观察者对象
|
|
|
+ var observer = new MutationObserver(function (mutations) {
|
|
|
+ Fast.api.layerfooter(layero, index, that);
|
|
|
+ mutations.forEach(function (mutation) {
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
- // 配置观察选项:
|
|
|
- var config = {attributes: true, childList: true, characterData: true, subtree: true}
|
|
|
- // 传入目标节点和观察选项
|
|
|
- observer.observe(target, config);
|
|
|
- // 随后,你还可以停止观察
|
|
|
- // observer.disconnect();
|
|
|
+ // 配置观察选项:
|
|
|
+ var config = {attributes: true, childList: true, characterData: true, subtree: true}
|
|
|
+ // 传入目标节点和观察选项
|
|
|
+ observer.observe(target, config);
|
|
|
+ // 随后,你还可以停止观察
|
|
|
+ // observer.disconnect();
|
|
|
+ }
|
|
|
}
|
|
|
+ } catch (e) {
|
|
|
+
|
|
|
+ }
|
|
|
+ if ($(layero).height() > $(window).height()) {
|
|
|
+ //当弹出窗口大于浏览器可视高度时,重定位
|
|
|
+ Layer.style(index, {
|
|
|
+ top: 0,
|
|
|
+ height: $(window).height()
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
}, options ? options : {});
|
|
@@ -888,8 +899,8 @@ define('fast',['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, u
|
|
|
},
|
|
|
lang: function () {
|
|
|
var args = arguments,
|
|
|
- string = args[0],
|
|
|
- i = 1;
|
|
|
+ string = args[0],
|
|
|
+ i = 1;
|
|
|
string = string.toLowerCase();
|
|
|
//string = typeof Lang[string] != 'undefined' ? Lang[string] : string;
|
|
|
if (typeof Lang[string] != 'undefined') {
|
|
@@ -5318,20 +5329,8 @@ define('backend',['fast', 'template', 'moment'], function (Fast, Template, Momen
|
|
|
},
|
|
|
refreshmenu: function () {
|
|
|
top.window.$(".sidebar-menu").trigger("refresh");
|
|
|
- }
|
|
|
- },
|
|
|
- init: function () {
|
|
|
- //公共代码
|
|
|
- //添加ios-fix兼容iOS下的iframe
|
|
|
- if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
|
|
|
- $("html").addClass("ios-fix");
|
|
|
- }
|
|
|
- //配置Toastr的参数
|
|
|
- Toastr.options.positionClass = Config.controllername === 'index' ? "toast-top-right-index" : "toast-top-right";
|
|
|
- //点击包含.btn-dialog的元素时弹出dialog
|
|
|
- $(document).on('click', '.btn-dialog,.dialogit', function (e) {
|
|
|
- var that = this;
|
|
|
- var options = $.extend({}, $(that).data() || {});
|
|
|
+ },
|
|
|
+ gettablecolumnbutton: function(options){
|
|
|
if (typeof options.tableId !== 'undefined' && typeof options.fieldIndex !== 'undefined' && typeof options.buttonIndex !== 'undefined') {
|
|
|
var tableOptions = $("#" + options.tableId).bootstrapTable('getOptions');
|
|
|
if (tableOptions) {
|
|
@@ -5348,20 +5347,38 @@ define('backend',['fast', 'template', 'moment'], function (Fast, Template, Momen
|
|
|
}
|
|
|
});
|
|
|
if (columnObj) {
|
|
|
- var button = columnObj['buttons'][options.buttonIndex];
|
|
|
- if (button && typeof button.callback === 'function') {
|
|
|
- options.callback = button.callback;
|
|
|
- }
|
|
|
+ return columnObj['buttons'][options.buttonIndex];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ return null;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ init: function () {
|
|
|
+ //公共代码
|
|
|
+ //添加ios-fix兼容iOS下的iframe
|
|
|
+ if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
|
|
|
+ $("html").addClass("ios-fix");
|
|
|
+ }
|
|
|
+ //配置Toastr的参数
|
|
|
+ Toastr.options.positionClass = Config.controllername === 'index' ? "toast-top-right-index" : "toast-top-right";
|
|
|
+ //点击包含.btn-dialog的元素时弹出dialog
|
|
|
+ $(document).on('click', '.btn-dialog,.dialogit', function (e) {
|
|
|
+ var that = this;
|
|
|
+ var options = $.extend({}, $(that).data() || {});
|
|
|
+ var url = Backend.api.replaceids(that, $(that).attr('href'));
|
|
|
+ var title = $(that).attr("title") || $(that).data("title") || $(that).data('original-title');
|
|
|
+ var button = Backend.api.gettablecolumnbutton(options);
|
|
|
+ if (button && typeof button.callback === 'function') {
|
|
|
+ options.callback = button.callback;
|
|
|
+ }
|
|
|
if (typeof options.confirm !== 'undefined') {
|
|
|
Layer.confirm(options.confirm, function (index) {
|
|
|
- Backend.api.open(Backend.api.replaceids(that, $(that).attr('href')), $(that).attr('title'), options);
|
|
|
+ Backend.api.open(url, title, options);
|
|
|
Layer.close(index);
|
|
|
});
|
|
|
} else {
|
|
|
- Backend.api.open(Backend.api.replaceids(that, $(that).attr('href')), $(that).attr('title'), options);
|
|
|
+ Backend.api.open(url, title, options);
|
|
|
}
|
|
|
return false;
|
|
|
});
|
|
@@ -5369,15 +5386,16 @@ define('backend',['fast', 'template', 'moment'], function (Fast, Template, Momen
|
|
|
$(document).on('click', '.btn-addtabs,.addtabsit', function (e) {
|
|
|
var that = this;
|
|
|
var options = $.extend({}, $(that).data() || {});
|
|
|
+ var url = Backend.api.replaceids(that, $(that).attr('href'));
|
|
|
+ var title = $(that).attr("title") || $(that).data("title") || $(that).data('original-title');
|
|
|
if (typeof options.confirm !== 'undefined') {
|
|
|
Layer.confirm(options.confirm, function (index) {
|
|
|
- Backend.api.addtabs(Backend.api.replaceids(that, $(that).attr('href')), $(that).attr("title"));
|
|
|
+ Backend.api.addtabs(url, title);
|
|
|
Layer.close(index);
|
|
|
});
|
|
|
} else {
|
|
|
- Backend.api.addtabs(Backend.api.replaceids(that, $(that).attr('href')), $(that).attr("title"));
|
|
|
+ Backend.api.addtabs(url, title);
|
|
|
}
|
|
|
-
|
|
|
return false;
|
|
|
});
|
|
|
//点击包含.btn-ajax的元素时发送Ajax请求
|
|
@@ -5392,30 +5410,13 @@ define('backend',['fast', 'template', 'moment'], function (Fast, Template, Momen
|
|
|
var error = typeof options.error === 'function' ? options.error : null;
|
|
|
delete options.success;
|
|
|
delete options.error;
|
|
|
- if (typeof options.tableId !== 'undefined' && typeof options.fieldIndex !== 'undefined' && typeof options.buttonIndex !== 'undefined') {
|
|
|
- var tableOptions = $("#" + options.tableId).bootstrapTable('getOptions');
|
|
|
- if (tableOptions) {
|
|
|
- var columnObj = null;
|
|
|
- $.each(tableOptions.columns, function (i, columns) {
|
|
|
- $.each(columns, function (j, column) {
|
|
|
- if (typeof column.fieldIndex !== 'undefined' && column.fieldIndex === options.fieldIndex) {
|
|
|
- columnObj = column;
|
|
|
- return false;
|
|
|
- }
|
|
|
- });
|
|
|
- if (columnObj) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- });
|
|
|
- if (columnObj) {
|
|
|
- var button = columnObj['buttons'][options.buttonIndex];
|
|
|
- if (button && typeof button.success === 'function') {
|
|
|
- success = button.success;
|
|
|
- }
|
|
|
- if (button && typeof button.error === 'function') {
|
|
|
- error = button.error;
|
|
|
- }
|
|
|
- }
|
|
|
+ var button = Backend.api.gettablecolumnbutton(options);
|
|
|
+ if (button) {
|
|
|
+ if (typeof button.success === 'function') {
|
|
|
+ success = button.success;
|
|
|
+ }
|
|
|
+ if (typeof button.error === 'function') {
|
|
|
+ error = button.error;
|
|
|
}
|
|
|
}
|
|
|
//如果未设备成功的回调,设定了自动刷新的情况下自动进行刷新
|
|
@@ -5440,6 +5441,19 @@ define('backend',['fast', 'template', 'moment'], function (Fast, Template, Momen
|
|
|
if ($(".layer-footer").size() > 0 && self === top) {
|
|
|
$(".layer-footer").show();
|
|
|
}
|
|
|
+ //优化在多个弹窗下点击不能切换的操作体验
|
|
|
+ if (Fast.api.query("dialog") == "1" && self != top && self.frameElement && self.frameElement.tagName == "IFRAME") {
|
|
|
+ $(window).on('click', function () {
|
|
|
+ var layero = self.frameElement.parentNode.parentElement;
|
|
|
+ if (parent.Layer.zIndex != parseInt(parent.window.$(layero).css("z-index"))) {
|
|
|
+ parent.window.$(layero).trigger("mousedown");
|
|
|
+ parent.Layer.zIndex = parseInt(parent.window.$(layero).css("z-index"));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //tooltip和popover
|
|
|
+ $('body').tooltip({selector: '[data-toggle="tooltip"]'});
|
|
|
+ $('body').tooltip({selector: '[data-toggle="popover"]'});
|
|
|
}
|
|
|
};
|
|
|
Backend.api = $.extend(Fast.api, Backend.api);
|
|
@@ -8434,10 +8448,10 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef
|
|
|
},
|
|
|
valid: function (ret) {
|
|
|
var that = this, submitBtn = $(".layer-footer [type=submit]", form);
|
|
|
- that.holdSubmit();
|
|
|
- $(".layer-footer [type=submit]", form).addClass("disabled");
|
|
|
+ that.holdSubmit(true);
|
|
|
+ submitBtn.addClass("disabled");
|
|
|
//验证通过提交表单
|
|
|
- Form.api.submit($(ret), function (data, ret) {
|
|
|
+ var submitResult = Form.api.submit($(ret), function (data, ret) {
|
|
|
that.holdSubmit(false);
|
|
|
submitBtn.removeClass("disabled");
|
|
|
if (false === $(this).triggerHandler("success.form", [data, ret])) {
|
|
@@ -8467,6 +8481,11 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef
|
|
|
}
|
|
|
}
|
|
|
}, submit);
|
|
|
+ //如果提交失败则释放锁定
|
|
|
+ if (!submitResult) {
|
|
|
+ that.holdSubmit(false);
|
|
|
+ submitBtn.removeClass("disabled");
|
|
|
+ }
|
|
|
return false;
|
|
|
}
|
|
|
}, form.data("validator-options") || {}));
|
|
@@ -8650,7 +8669,6 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef
|
|
|
var textarea = $("textarea[name='" + name + "']", form);
|
|
|
var container = textarea.closest("dl");
|
|
|
var template = container.data("template");
|
|
|
- console.log(name, container);
|
|
|
$.each($("input,select", container).serializeArray(), function (i, j) {
|
|
|
var reg = /\[(\w+)\]\[(\w+)\]$/g;
|
|
|
var match = reg.exec(j.name);
|
|
@@ -8739,10 +8757,12 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef
|
|
|
},
|
|
|
api: {
|
|
|
submit: function (form, success, error, submit) {
|
|
|
- if (form.size() === 0)
|
|
|
- return Toastr.error("表单未初始化完成,无法提交");
|
|
|
+ if (form.size() === 0) {
|
|
|
+ Toastr.error("表单未初始化完成,无法提交");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
if (typeof submit === 'function') {
|
|
|
- if (false === submit.call(form)) {
|
|
|
+ if (false === submit.call(form, success, error)) {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -8802,7 +8822,7 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
- return false;
|
|
|
+ return true;
|
|
|
},
|
|
|
bindevent: function (form, success, error, submit) {
|
|
|
|
|
@@ -9326,6 +9346,7 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
|
|
pageList: [10, 25, 50, 'All'],
|
|
|
pagination: true,
|
|
|
clickToSelect: true, //是否启用点击选中
|
|
|
+ dblClickToEdit: true, //是否启用双击编辑
|
|
|
singleSelect: false, //是否启用单选
|
|
|
showRefresh: false,
|
|
|
locale: 'zh-CN',
|
|
@@ -9420,10 +9441,12 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
|
|
table.on('refresh.bs.table', function (e, settings, data) {
|
|
|
$(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin");
|
|
|
});
|
|
|
- //当双击单元格时
|
|
|
- table.on('dbl-click-row.bs.table', function (e, row, element, field) {
|
|
|
- $(Table.config.editonebtn, element).trigger("click");
|
|
|
- });
|
|
|
+ if (options.dblClickToEdit) {
|
|
|
+ //当双击单元格时
|
|
|
+ table.on('dbl-click-row.bs.table', function (e, row, element, field) {
|
|
|
+ $(Table.config.editonebtn, element).trigger("click");
|
|
|
+ });
|
|
|
+ }
|
|
|
//当内容渲染完成后
|
|
|
table.on('post-body.bs.table', function (e, settings, json, xhr) {
|
|
|
$(Table.config.refreshbtn, toolbar).find(".fa").removeClass("fa-spin");
|
|
@@ -9706,7 +9729,7 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
|
|
return '<div class="input-group input-group-sm" style="width:250px;margin:0 auto;"><input type="text" class="form-control input-sm" value="' + value + '"><span class="input-group-btn input-group-sm"><a href="' + value + '" target="_blank" class="btn btn-default btn-sm"><i class="fa fa-link"></i></a></span></div>';
|
|
|
},
|
|
|
search: function (value, row, index) {
|
|
|
- return '<a href="javascript:;" class="searchit" data-field="' + this.field + '" data-value="' + value + '">' + value + '</a>';
|
|
|
+ return '<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', value) + '" data-field="' + this.field + '" data-value="' + value + '">' + value + '</a>';
|
|
|
},
|
|
|
addtabs: function (value, row, index) {
|
|
|
var url = Table.api.replaceurl(this.url, row, this.table);
|
|
@@ -9759,6 +9782,7 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
|
|
name: 'dragsort',
|
|
|
icon: 'fa fa-arrows',
|
|
|
title: __('Drag to sort'),
|
|
|
+ extend: 'data-toggle="tooltip"',
|
|
|
classname: 'btn btn-xs btn-primary btn-dragsort'
|
|
|
});
|
|
|
}
|
|
@@ -9767,6 +9791,7 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
|
|
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
|
|
|
});
|
|
@@ -9776,6 +9801,7 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
|
|
name: 'del',
|
|
|
icon: 'fa fa-trash',
|
|
|
title: __('Del'),
|
|
|
+ extend: 'data-toggle="tooltip"',
|
|
|
classname: 'btn btn-xs btn-danger btn-delone'
|
|
|
});
|
|
|
}
|
|
@@ -10338,7 +10364,11 @@ $.fn.addtabs = function (options) {
|
|
|
document.title = title;
|
|
|
if (history.pushState && !$(this).data("pushstate")) {
|
|
|
var pushurl = url.indexOf("ref=addtabs") == -1 ? (url + (url.indexOf("?") > -1 ? "&" : "?") + "ref=addtabs") : url;
|
|
|
- window.history.pushState(state, title, pushurl);
|
|
|
+ try {
|
|
|
+ window.history.pushState(state, title, pushurl);
|
|
|
+ }catch(e){
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
$(this).data("pushstate", null);
|
|
|
_add.call(this, {
|