mirror of https://gitee.com/karson/fastadmin.git
parent
2401cd3ba1
commit
6470a8ed74
|
|
@ -294,7 +294,7 @@ return [
|
|||
//允许跨域的域名,多个以,分隔
|
||||
'cors_request_domain' => 'localhost,127.0.0.1',
|
||||
//版本号
|
||||
'version' => '1.3.2.20220113',
|
||||
'version' => '1.3.3.20220121',
|
||||
//API接口地址
|
||||
'api_url' => 'https://api.fastadmin.net',
|
||||
],
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
"topthink/think-installer": "^1.0.14",
|
||||
"topthink/think-queue": "1.1.6",
|
||||
"topthink/think-helper": "^1.0.7",
|
||||
"karsonzhang/fastadmin-addons": "~1.3.1",
|
||||
"karsonzhang/fastadmin-addons": "~1.3.2",
|
||||
"overtrue/pinyin": "^3.0",
|
||||
"phpoffice/phpspreadsheet": "1.12",
|
||||
"overtrue/wechat": "4.2.11",
|
||||
|
|
|
|||
|
|
@ -10369,10 +10369,13 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'],
|
|||
}
|
||||
obj.attr("fieldlist-item", true);
|
||||
obj.insertAfter($(tagName + "[fieldlist-item]", container).length > 0 ? $(tagName + "[fieldlist-item]:last", container) : $(tagName + ":first", container));
|
||||
//兼容旧版本事件
|
||||
$(".btn-append,.append", container).trigger("fa.event.appendfieldlist", obj);
|
||||
//新版本事件
|
||||
container.trigger("fa.event.appendfieldlist", obj);
|
||||
if ($(".btn-append,.append", container).length > 0) {
|
||||
//兼容旧版本事件
|
||||
$(".btn-append,.append", container).trigger("fa.event.appendfieldlist", obj);
|
||||
} else {
|
||||
//新版本事件
|
||||
container.trigger("fa.event.appendfieldlist", obj);
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
var fieldlist = $(".fieldlist", form);
|
||||
|
|
@ -10502,6 +10505,89 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'],
|
|||
$("[data-role='autocomplete']").autocomplete();
|
||||
});
|
||||
}
|
||||
},
|
||||
favisible: function (form) {
|
||||
if ($("[data-favisible]", form).length == 0) {
|
||||
return;
|
||||
}
|
||||
var checkCondition = function (condition) {
|
||||
var conditionArr = condition.split(/&&/);
|
||||
var success = 0;
|
||||
var baseregex = /^([a-z0-9\_]+)([>|<|=|\!]=?)(.*)$/i, strregex = /^('|")(.*)('|")$/, regregex = /^regex:(.*)$/;
|
||||
// @formatter:off
|
||||
var operator_result = {
|
||||
'>': function(a, b) { return a > b; },
|
||||
'>=': function(a, b) { return a >= b; },
|
||||
'<': function(a, b) { return a < b; },
|
||||
'<=': function(a, b) { return a <= b; },
|
||||
'==': function(a, b) { return a == b; },
|
||||
'!=': function(a, b) { return a != b; },
|
||||
'in': function(a, b) { return b.split(/\,/).indexOf(a) > -1; },
|
||||
'regex': function(a, b) {
|
||||
var regParts = b.match(/^\/(.*?)\/([gim]*)$/);
|
||||
var regexp = regParts ? new RegExp(regParts[1], regParts[2]) : new RegExp(b);
|
||||
return regexp.test(a);
|
||||
}
|
||||
};
|
||||
// @formatter:on
|
||||
var dataArr = form.serializeArray(), dataObj = {};
|
||||
$(dataArr).each(function (i, field) {
|
||||
dataObj[field.name] = field.value;
|
||||
});
|
||||
|
||||
$.each(conditionArr, function (i, item) {
|
||||
var basematches = baseregex.exec(item);
|
||||
if (basematches) {
|
||||
var name = basematches[1], operator = basematches[2], value = basematches[3].toString();
|
||||
if (operator === '=') {
|
||||
var strmatches = strregex.exec(value);
|
||||
operator = strmatches ? '==' : 'in';
|
||||
value = strmatches ? strmatches[2] : value;
|
||||
}
|
||||
var regmatches = regregex.exec(value);
|
||||
if (regmatches) {
|
||||
operator = 'regex';
|
||||
value = regmatches[1];
|
||||
}
|
||||
var chkname = "row[" + name + "]";
|
||||
if (typeof dataObj[chkname] === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
var objvalue = dataObj[chkname];
|
||||
if (['>', '>=', '<', '<='].indexOf(operator) > -1) {
|
||||
objvalue = parseFloat(objvalue);
|
||||
value = parseFloat(value);
|
||||
}
|
||||
var result = operator_result[operator](objvalue, value);
|
||||
success += (result ? 1 : 0);
|
||||
}
|
||||
});
|
||||
return success === conditionArr.length;
|
||||
};
|
||||
form.on("keyup change click configchange", "input,select", function () {
|
||||
$("[data-favisible][data-favisible!='']", form).each(function () {
|
||||
var visible = $(this).data("favisible");
|
||||
var groupArr = visible.split(/\|\|/);
|
||||
var success = 0;
|
||||
$.each(groupArr, function (i, j) {
|
||||
if (checkCondition(j)) {
|
||||
success++;
|
||||
}
|
||||
});
|
||||
if (success > 0) {
|
||||
$(this).removeClass("hidden");
|
||||
} else {
|
||||
$(this).addClass("hidden");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//追加上忽略元素
|
||||
setTimeout(function () {
|
||||
form.data('validator').options.ignore += ((form.data('validator').options.ignore ? ',' : '') + '[data-favisible] :hidden,[data-favisible]:hidden');
|
||||
}, 0);
|
||||
|
||||
$("input,select", form).trigger("configchange");
|
||||
}
|
||||
},
|
||||
api: {
|
||||
|
|
@ -10608,6 +10694,8 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'],
|
|||
events.tagsinput(form);
|
||||
|
||||
events.autocomplete(form);
|
||||
|
||||
events.favisible(form);
|
||||
},
|
||||
custom: {}
|
||||
},
|
||||
|
|
@ -12147,16 +12235,13 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
|||
var btnGroup = $(this);
|
||||
var isPullRight = dropdownMenu.hasClass("pull-right") || dropdownMenu.hasClass("dropdown-menu-right");
|
||||
var left, top, position;
|
||||
if (dropdownMenu.outerHeight() + btnGroup.outerHeight() > tableBody.outerHeight() - 41) {
|
||||
if (true || dropdownMenu.outerHeight() + btnGroup.outerHeight() > tableBody.outerHeight() - 41) {
|
||||
position = 'fixed';
|
||||
top = btnGroup.offset().top - $(window).scrollTop() + btnGroup.outerHeight();
|
||||
left = isPullRight ? btnGroup.offset().left + btnGroup.outerWidth() - dropdownMenu.outerWidth() : btnGroup.offset().left;
|
||||
} else {
|
||||
if (btnGroup.offset().top + btnGroup.outerHeight() + dropdownMenu.outerHeight() > tableBody.offset().top + tableBody.outerHeight() - 30) {
|
||||
position = 'absolute';
|
||||
left = isPullRight ? -(dropdownMenu.outerWidth() - btnGroup.outerWidth()) : 0;
|
||||
top = -(dropdownMenu.outerHeight() + 3);
|
||||
if ((top + dropdownMenu.outerHeight()) > $(window).height()) {
|
||||
top = btnGroup.offset().top - dropdownMenu.outerHeight() - 5;
|
||||
}
|
||||
left = isPullRight ? btnGroup.offset().left + btnGroup.outerWidth() - dropdownMenu.outerWidth() : btnGroup.offset().left;
|
||||
}
|
||||
if (left || top) {
|
||||
dropdownMenu.css({
|
||||
|
|
@ -12516,7 +12601,7 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
|||
dropdown = j.dropdown ? j.dropdown : '';
|
||||
url = j.url ? j.url : '';
|
||||
url = typeof url === 'function' ? url.call(table, row, j) : (url ? Fast.api.fixurl(Table.api.replaceurl(url, row, table)) : 'javascript:;');
|
||||
classname = j.classname ? j.classname : 'btn-primary btn-' + name + 'one';
|
||||
classname = j.classname ? j.classname : (dropdown ? 'btn-' + name + 'one' : 'btn-primary btn-' + name + 'one');
|
||||
icon = j.icon ? j.icon : '';
|
||||
text = typeof j.text === 'function' ? j.text.call(table, row, j) : j.text ? j.text : '';
|
||||
title = typeof j.title === 'function' ? j.title.call(table, row, j) : j.title ? j.title : text;
|
||||
|
|
|
|||
|
|
@ -496,7 +496,7 @@ define(['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'], functio
|
|||
var conditionArr = condition.split(/&&/);
|
||||
var success = 0;
|
||||
var baseregex = /^([a-z0-9\_]+)([>|<|=|\!]=?)(.*)$/i, strregex = /^('|")(.*)('|")$/, regregex = /^regex:(.*)$/;
|
||||
<!--@formatter:off-->
|
||||
// @formatter:off
|
||||
var operator_result = {
|
||||
'>': function(a, b) { return a > b; },
|
||||
'>=': function(a, b) { return a >= b; },
|
||||
|
|
@ -511,7 +511,7 @@ define(['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'], functio
|
|||
return regexp.test(a);
|
||||
}
|
||||
};
|
||||
<!--@formatter:on-->
|
||||
// @formatter:on
|
||||
var dataArr = form.serializeArray(), dataObj = {};
|
||||
$(dataArr).each(function (i, field) {
|
||||
dataObj[field.name] = field.value;
|
||||
|
|
|
|||
|
|
@ -10218,10 +10218,13 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'],
|
|||
}
|
||||
obj.attr("fieldlist-item", true);
|
||||
obj.insertAfter($(tagName + "[fieldlist-item]", container).length > 0 ? $(tagName + "[fieldlist-item]:last", container) : $(tagName + ":first", container));
|
||||
//兼容旧版本事件
|
||||
$(".btn-append,.append", container).trigger("fa.event.appendfieldlist", obj);
|
||||
//新版本事件
|
||||
container.trigger("fa.event.appendfieldlist", obj);
|
||||
if ($(".btn-append,.append", container).length > 0) {
|
||||
//兼容旧版本事件
|
||||
$(".btn-append,.append", container).trigger("fa.event.appendfieldlist", obj);
|
||||
} else {
|
||||
//新版本事件
|
||||
container.trigger("fa.event.appendfieldlist", obj);
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
var fieldlist = $(".fieldlist", form);
|
||||
|
|
@ -10351,6 +10354,89 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'],
|
|||
$("[data-role='autocomplete']").autocomplete();
|
||||
});
|
||||
}
|
||||
},
|
||||
favisible: function (form) {
|
||||
if ($("[data-favisible]", form).length == 0) {
|
||||
return;
|
||||
}
|
||||
var checkCondition = function (condition) {
|
||||
var conditionArr = condition.split(/&&/);
|
||||
var success = 0;
|
||||
var baseregex = /^([a-z0-9\_]+)([>|<|=|\!]=?)(.*)$/i, strregex = /^('|")(.*)('|")$/, regregex = /^regex:(.*)$/;
|
||||
// @formatter:off
|
||||
var operator_result = {
|
||||
'>': function(a, b) { return a > b; },
|
||||
'>=': function(a, b) { return a >= b; },
|
||||
'<': function(a, b) { return a < b; },
|
||||
'<=': function(a, b) { return a <= b; },
|
||||
'==': function(a, b) { return a == b; },
|
||||
'!=': function(a, b) { return a != b; },
|
||||
'in': function(a, b) { return b.split(/\,/).indexOf(a) > -1; },
|
||||
'regex': function(a, b) {
|
||||
var regParts = b.match(/^\/(.*?)\/([gim]*)$/);
|
||||
var regexp = regParts ? new RegExp(regParts[1], regParts[2]) : new RegExp(b);
|
||||
return regexp.test(a);
|
||||
}
|
||||
};
|
||||
// @formatter:on
|
||||
var dataArr = form.serializeArray(), dataObj = {};
|
||||
$(dataArr).each(function (i, field) {
|
||||
dataObj[field.name] = field.value;
|
||||
});
|
||||
|
||||
$.each(conditionArr, function (i, item) {
|
||||
var basematches = baseregex.exec(item);
|
||||
if (basematches) {
|
||||
var name = basematches[1], operator = basematches[2], value = basematches[3].toString();
|
||||
if (operator === '=') {
|
||||
var strmatches = strregex.exec(value);
|
||||
operator = strmatches ? '==' : 'in';
|
||||
value = strmatches ? strmatches[2] : value;
|
||||
}
|
||||
var regmatches = regregex.exec(value);
|
||||
if (regmatches) {
|
||||
operator = 'regex';
|
||||
value = regmatches[1];
|
||||
}
|
||||
var chkname = "row[" + name + "]";
|
||||
if (typeof dataObj[chkname] === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
var objvalue = dataObj[chkname];
|
||||
if (['>', '>=', '<', '<='].indexOf(operator) > -1) {
|
||||
objvalue = parseFloat(objvalue);
|
||||
value = parseFloat(value);
|
||||
}
|
||||
var result = operator_result[operator](objvalue, value);
|
||||
success += (result ? 1 : 0);
|
||||
}
|
||||
});
|
||||
return success === conditionArr.length;
|
||||
};
|
||||
form.on("keyup change click configchange", "input,select", function () {
|
||||
$("[data-favisible][data-favisible!='']", form).each(function () {
|
||||
var visible = $(this).data("favisible");
|
||||
var groupArr = visible.split(/\|\|/);
|
||||
var success = 0;
|
||||
$.each(groupArr, function (i, j) {
|
||||
if (checkCondition(j)) {
|
||||
success++;
|
||||
}
|
||||
});
|
||||
if (success > 0) {
|
||||
$(this).removeClass("hidden");
|
||||
} else {
|
||||
$(this).addClass("hidden");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//追加上忽略元素
|
||||
setTimeout(function () {
|
||||
form.data('validator').options.ignore += ((form.data('validator').options.ignore ? ',' : '') + '[data-favisible] :hidden,[data-favisible]:hidden');
|
||||
}, 0);
|
||||
|
||||
$("input,select", form).trigger("configchange");
|
||||
}
|
||||
},
|
||||
api: {
|
||||
|
|
@ -10457,6 +10543,8 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'],
|
|||
events.tagsinput(form);
|
||||
|
||||
events.autocomplete(form);
|
||||
|
||||
events.favisible(form);
|
||||
},
|
||||
custom: {}
|
||||
},
|
||||
|
|
@ -11996,16 +12084,13 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
|||
var btnGroup = $(this);
|
||||
var isPullRight = dropdownMenu.hasClass("pull-right") || dropdownMenu.hasClass("dropdown-menu-right");
|
||||
var left, top, position;
|
||||
if (dropdownMenu.outerHeight() + btnGroup.outerHeight() > tableBody.outerHeight() - 41) {
|
||||
if (true || dropdownMenu.outerHeight() + btnGroup.outerHeight() > tableBody.outerHeight() - 41) {
|
||||
position = 'fixed';
|
||||
top = btnGroup.offset().top - $(window).scrollTop() + btnGroup.outerHeight();
|
||||
left = isPullRight ? btnGroup.offset().left + btnGroup.outerWidth() - dropdownMenu.outerWidth() : btnGroup.offset().left;
|
||||
} else {
|
||||
if (btnGroup.offset().top + btnGroup.outerHeight() + dropdownMenu.outerHeight() > tableBody.offset().top + tableBody.outerHeight() - 30) {
|
||||
position = 'absolute';
|
||||
left = isPullRight ? -(dropdownMenu.outerWidth() - btnGroup.outerWidth()) : 0;
|
||||
top = -(dropdownMenu.outerHeight() + 3);
|
||||
if ((top + dropdownMenu.outerHeight()) > $(window).height()) {
|
||||
top = btnGroup.offset().top - dropdownMenu.outerHeight() - 5;
|
||||
}
|
||||
left = isPullRight ? btnGroup.offset().left + btnGroup.outerWidth() - dropdownMenu.outerWidth() : btnGroup.offset().left;
|
||||
}
|
||||
if (left || top) {
|
||||
dropdownMenu.css({
|
||||
|
|
@ -12365,7 +12450,7 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
|||
dropdown = j.dropdown ? j.dropdown : '';
|
||||
url = j.url ? j.url : '';
|
||||
url = typeof url === 'function' ? url.call(table, row, j) : (url ? Fast.api.fixurl(Table.api.replaceurl(url, row, table)) : 'javascript:;');
|
||||
classname = j.classname ? j.classname : 'btn-primary btn-' + name + 'one';
|
||||
classname = j.classname ? j.classname : (dropdown ? 'btn-' + name + 'one' : 'btn-primary btn-' + name + 'one');
|
||||
icon = j.icon ? j.icon : '';
|
||||
text = typeof j.text === 'function' ? j.text.call(table, row, j) : j.text ? j.text : '';
|
||||
title = typeof j.title === 'function' ? j.title.call(table, row, j) : j.title ? j.title : text;
|
||||
|
|
|
|||
Loading…
Reference in New Issue