|
|
@@ -6774,11 +6774,24 @@ define('backend',['fast', 'moment'], function (Fast, Moment) {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ replaceids: function (elem, url) {
|
|
|
+ //如果有需要替换ids的
|
|
|
+ if (url.indexOf("{ids}") > -1) {
|
|
|
+ var ids = 0;
|
|
|
+ var tableId = $(elem).data("table-id");
|
|
|
+ if (tableId && $(tableId).size() > 0 && $(tableId).data("bootstrap.table")) {
|
|
|
+ var Table = require("table");
|
|
|
+ ids = Table.api.selectedids($(tableId)).join(",");
|
|
|
+ }
|
|
|
+ url = url.replace(/\{ids\}/g, ids);
|
|
|
+ }
|
|
|
+ return url;
|
|
|
+ }
|
|
|
},
|
|
|
init: function () {
|
|
|
//公共代码
|
|
|
//添加ios-fix兼容iOS下的iframe
|
|
|
- if(/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream){
|
|
|
+ if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
|
|
|
$("html").addClass("ios-fix");
|
|
|
}
|
|
|
//配置Toastr的参数
|
|
|
@@ -6786,28 +6799,32 @@ define('backend',['fast', 'moment'], function (Fast, Moment) {
|
|
|
//点击包含.btn-dialog的元素时弹出dialog
|
|
|
$(document).on('click', '.btn-dialog,.dialogit', function (e) {
|
|
|
e.preventDefault();
|
|
|
- var options = $(this).data();
|
|
|
- options = options ? options : {};
|
|
|
- Backend.api.open(Backend.api.fixurl($(this).attr('href')), $(this).attr('title'), options);
|
|
|
+ var options = $(this).data() || {};
|
|
|
+ Backend.api.open(Backend.api.replaceids(this, $(this).attr('href')), $(this).attr('title'), options);
|
|
|
});
|
|
|
- //点击包含.btn-addtabs的元素时事件
|
|
|
+ //点击包含.btn-addtabs的元素时新增选项卡
|
|
|
$(document).on('click', '.btn-addtabs,.addtabsit', function (e) {
|
|
|
e.preventDefault();
|
|
|
- Backend.api.addtabs($(this).attr("href"), $(this).attr("title"));
|
|
|
+ Backend.api.addtabs(Backend.api.replaceids(this, $(this).attr('href')), $(this).attr("title"));
|
|
|
});
|
|
|
- //点击包含.btn-ajax的元素时事件
|
|
|
+ //点击包含.btn-ajax的元素时发送Ajax请求
|
|
|
$(document).on('click', '.btn-ajax,.ajaxit', function (e) {
|
|
|
e.preventDefault();
|
|
|
var options = $(this).data();
|
|
|
if (typeof options.url === 'undefined' && $(this).attr("href")) {
|
|
|
options.url = $(this).attr("href");
|
|
|
}
|
|
|
+ options.url = Backend.api.replaceids(this, options.url);
|
|
|
Backend.api.ajax(options);
|
|
|
});
|
|
|
//修复含有fixed-footer类的body边距
|
|
|
if ($(".fixed-footer").size() > 0) {
|
|
|
$(document.body).css("padding-bottom", $(".fixed-footer").height());
|
|
|
}
|
|
|
+ //修复不在iframe时layer-footer隐藏的问题
|
|
|
+ if ($(".layer-footer").size() > 0 && self === top) {
|
|
|
+ $(".layer-footer").show();
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
Backend.api = $.extend(Fast.api, Backend.api);
|
|
|
@@ -7858,14 +7875,14 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
|
|
// 添加按钮事件
|
|
|
$(toolbar).on('click', Table.config.addbtn, function () {
|
|
|
var ids = Table.api.selectedids(table);
|
|
|
- Fast.api.open(options.extend.add_url + (ids.length > 0 ? (options.extend.add_url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + ids.join(",") : ''), __('Add'));
|
|
|
+ Fast.api.open(options.extend.add_url + (ids.length > 0 ? (options.extend.add_url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + ids.join(",") : ''), __('Add'), $(this).data() || {});
|
|
|
});
|
|
|
// 批量编辑按钮事件
|
|
|
$(toolbar).on('click', Table.config.editbtn, function () {
|
|
|
var ids = Table.api.selectedids(table);
|
|
|
//循环弹出多个编辑框
|
|
|
$.each(ids, function (i, j) {
|
|
|
- Fast.api.open(options.extend.edit_url + (options.extend.edit_url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + j, __('Edit'));
|
|
|
+ Fast.api.open(options.extend.edit_url + (options.extend.edit_url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + j, __('Edit'), $(this).data() || {});
|
|
|
});
|
|
|
});
|
|
|
// 批量操作按钮事件
|
|
|
@@ -7929,7 +7946,7 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
|
|
});
|
|
|
$(table).on("click", "[data-id].btn-edit", function (e) {
|
|
|
e.preventDefault();
|
|
|
- Fast.api.open(options.extend.edit_url + (options.extend.edit_url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + $(this).data("id"), __('Edit'));
|
|
|
+ Fast.api.open(options.extend.edit_url + (options.extend.edit_url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + $(this).data("id"), __('Edit'), $(this).data() || {});
|
|
|
});
|
|
|
$(table).on("click", "[data-id].btn-del", function (e) {
|
|
|
e.preventDefault();
|
|
|
@@ -7966,7 +7983,7 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
|
|
'click .btn-editone': function (e, value, row, index) {
|
|
|
e.stopPropagation();
|
|
|
var options = $(this).closest('table').bootstrapTable('getOptions');
|
|
|
- Fast.api.open(options.extend.edit_url + (options.extend.edit_url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + row[options.pk], __('Edit'));
|
|
|
+ Fast.api.open(options.extend.edit_url + (options.extend.edit_url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + row[options.pk], __('Edit'), $(this).data() || {});
|
|
|
},
|
|
|
'click .btn-delone': function (e, value, row, index) {
|
|
|
e.stopPropagation();
|
|
|
@@ -8085,11 +8102,33 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
|
|
if (j.name === 'dragsort' && typeof row[Table.config.dragsortfield] === 'undefined') {
|
|
|
return true;
|
|
|
}
|
|
|
+ if (['add', 'edit', 'del', 'multi', 'dragsort'].indexOf(j.name) > -1 && !options.extend[j.name + "_url"]) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
var attr = table.data("operate-" + j.name);
|
|
|
if (typeof attr === 'undefined' || attr) {
|
|
|
- if (['add', 'edit', 'del', 'multi'].indexOf(j.name) > -1 && !options.extend[j.name + "_url"]) {
|
|
|
- return true;
|
|
|
- }
|
|
|
+ //自动加上ids
|
|
|
+ j.url = j.url ? j.url + (j.url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + row[options.pk] : '';
|
|
|
+ url = j.url ? Fast.api.fixurl(j.url) : 'javascript:;';
|
|
|
+ classname = j.classname ? j.classname : 'btn-primary btn-' + name + 'one';
|
|
|
+ icon = j.icon ? j.icon : '';
|
|
|
+ text = j.text ? j.text : '';
|
|
|
+ title = j.title ? j.title : text;
|
|
|
+ html.push('<a href="' + url + '" class="' + classname + '" title="' + title + '"><i class="' + icon + '"></i>' + (text ? ' ' + text : '') + '</a>');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return html.join(' ');
|
|
|
+ },
|
|
|
+ buttons: function (value, row, index) {
|
|
|
+ var table = this.table;
|
|
|
+ // 操作配置
|
|
|
+ var options = table ? table.bootstrapTable('getOptions') : {};
|
|
|
+ // 默认按钮组
|
|
|
+ var buttons = $.extend([], this.buttons || []);
|
|
|
+ var html = [];
|
|
|
+ $.each(buttons, function (i, j) {
|
|
|
+ var attr = table.data("buttons-" + j.name);
|
|
|
+ if (typeof attr === 'undefined' || attr) {
|
|
|
//自动加上ids
|
|
|
j.url = j.url ? j.url + (j.url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + row[options.pk] : '';
|
|
|
url = j.url ? Fast.api.fixurl(j.url) : 'javascript:;';
|