@await RenderSectionAsync("cardbody", false)
-
+
diff --git a/src/admin/Bootstrap.Admin/wwwroot/css/site.css b/src/admin/Bootstrap.Admin/wwwroot/css/site.css
index 8eb90e28..6cc439ca 100644
--- a/src/admin/Bootstrap.Admin/wwwroot/css/site.css
+++ b/src/admin/Bootstrap.Admin/wwwroot/css/site.css
@@ -534,4 +534,8 @@ pre {
.modal-query .form-group input.form-control {
flex: 1 1 auto;
- }
\ No newline at end of file
+ }
+
+ .bootstrap-table .fixed-table-toolbar .bs-bars, .bootstrap-table .fixed-table-toolbar .columns {
+ margin-bottom: 0;
+}
diff --git a/src/admin/Bootstrap.Admin/wwwroot/js/settings.js b/src/admin/Bootstrap.Admin/wwwroot/js/settings.js
index 8c81dc07..816b065e 100644
--- a/src/admin/Bootstrap.Admin/wwwroot/js/settings.js
+++ b/src/admin/Bootstrap.Admin/wwwroot/js/settings.js
@@ -11,7 +11,7 @@ $(function () {
case 'footer':
data = dataBinder.get();
$.bc({
- url: Settings.url, data: { name: '网站页脚', code: data.Footer, category: '网站设置' }, title: '保存网站页脚', method: "post",
+ url: Settings.url, data: [{ name: '网站页脚', code: data.Footer, category: '网站设置' }], title: '保存网站页脚', method: "post",
callback: function (result) {
if (result) $('#websiteFooter').text(data.Footer);
}
@@ -20,7 +20,7 @@ $(function () {
case 'title':
data = dataBinder.get();
$.bc({
- url: Settings.url, data: { name: '网站标题', code: data.Title, category: '网站设置' }, title: '保存网站标题', method: "post",
+ url: Settings.url, data: [{ name: '网站标题', code: data.Title, category: '网站设置' }], title: '保存网站标题', method: "post",
callback: function (result) {
if (result) $('#websiteTitle').text(data.Title);
}
@@ -29,7 +29,7 @@ $(function () {
case 'css':
var cssDefine = $css.val();
$.bc({
- url: Settings.url, data: { name: '使用样式', code: cssDefine, category: '当前样式' }, title: '保存网站样式', method: "post",
+ url: Settings.url, data: [{ name: '使用样式', code: cssDefine, category: '当前样式' }], title: '保存网站样式', method: "post",
callback: function (result) {
if (result) {
window.setTimeout(function () { window.location.reload(true); }, 1000);
@@ -39,12 +39,14 @@ $(function () {
break;
case 'UISettings':
var uiSettings = $('#sider').prop('checked') ? "1" : "0";
- $.bc({
- url: Settings.url, data: { name: '侧边栏状态', code: uiSettings, category: '网站设置' }, method: "post"
- });
var cardTitle = $('#cardTitle').prop('checked') ? "1" : "0";
+ var fixedTableHeader = $('#tableHeader').prop('checked') ? "1" : "0";
$.bc({
- url: Settings.url, data: { name: '卡片标题状态', code: cardTitle, category: '网站设置' }, title: '保存网站设置', method: "post",
+ url: Settings.url, data: [
+ { name: '卡片标题状态', code: cardTitle, category: '网站设置' },
+ { name: '侧边栏状态', code: uiSettings, category: '网站设置' },
+ { name: '固定表头', code: fixedTableHeader, category: '网站设置' }
+ ], title: '保存网站设置', method: "post",
callback: function (result) {
if (result) {
window.setTimeout(function () { window.location.reload(true); }, 1000);
@@ -54,21 +56,15 @@ $(function () {
break;
case 'loginSettings':
var mobile = $('#mobile').prop('checked') ? "1" : "0";
- $.bc({
- url: Settings.url, data: { name: '短信验证码登录', code: mobile, category: '网站设置' }, method: "post"
- });
var oauth = $('#oauth').prop('checked') ? "1" : "0";
$.bc({
- url: Settings.url, data: { name: 'OAuth 认证登录', code: oauth, category: '网站设置' }, title: '登录设置', method: "post"
+ url: Settings.url, data: [{ name: 'OAuth 认证登录', code: oauth, category: '网站设置' }, { name: '短信验证码登录', code: mobile, category: '网站设置' }], title: '登录设置', method: "post"
});
break;
case 'saveAutoLock':
var autoLock = $('#lockScreen').prop('checked') ? "1" : "0";
$.bc({
- url: Settings.url, data: { name: '自动锁屏', code: autoLock, category: '网站设置' }, method: "post"
- });
- $.bc({
- url: Settings.url, data: { name: '自动锁屏时长', code: $('#lockPeriod').val(), category: '网站设置' }, title: '保存自动锁屏设置', method: "post",
+ url: Settings.url, data: [{ name: '自动锁屏', code: autoLock, category: '网站设置' }, { name: '自动锁屏时长', code: $('#lockPeriod').val(), category: '网站设置' }], title: '保存自动锁屏设置', method: "post",
callback: function (result) {
if (result) {
window.setTimeout(function () { window.location.reload(true); }, 1000);
@@ -79,13 +75,13 @@ $(function () {
case 'saveDefaultApp':
var defaultApp = $('#defaultApp').prop('checked') ? "1" : "0";
$.bc({
- url: Settings.url, data: { name: '默认应用程序', code: defaultApp, category: '网站设置' }, title: '保存默认应用程序设置', method: "post"
+ url: Settings.url, data: [{ name: '默认应用程序', code: defaultApp, category: '网站设置' }], title: '保存默认应用程序设置', method: "post"
});
break;
case 'saveBlazor':
var blazor = $('#blazor').prop('checked') ? "1" : "0";
$.bc({
- url: Settings.url, data: { name: 'Blazor', code: blazor, category: '网站设置' }, title: 'Blazor 设置', method: "post",
+ url: Settings.url, data: [{ name: 'Blazor', code: blazor, category: '网站设置' }], title: 'Blazor 设置', method: "post",
callback: function (result) {
if (result) {
// 导航到 Blazor 页面
diff --git a/src/admin/Bootstrap.Admin/wwwroot/lib/longbow/longbow.common.js b/src/admin/Bootstrap.Admin/wwwroot/lib/longbow/longbow.common.js
index 75366526..c549bd57 100644
--- a/src/admin/Bootstrap.Admin/wwwroot/lib/longbow/longbow.common.js
+++ b/src/admin/Bootstrap.Admin/wwwroot/lib/longbow/longbow.common.js
@@ -90,7 +90,7 @@
};
$.extend({
- "format": function (source, params) {
+ format: function (source, params) {
if (params === undefined || params === null) {
return null;
}
@@ -354,7 +354,11 @@
showExport: true,
exportTypes: ['csv', 'txt', 'excel'],
advancedSearchModal: '#dialogAdvancedSearch',
+ minHeight: 400,
+ height: undefined,
+ calcHeight: undefined,
search: true,
+ tableContainer: '.main-content',
searchOnEnterKey: false,
searchTimeOut: 0,
showSearchClearButton: true,
@@ -367,6 +371,16 @@
cardView: $(window).width() < 768, //是否显示详细视图
queryButton: '#btn_query',
onLoadSuccess: function (data) {
+ // 设置 数据库 滚动条
+ if (settings.height !== undefined) {
+ $('.bootstrap-table .fixed-table-body').overlayScrollbars({
+ className: 'os-theme-dark',
+ scrollbars: {
+ autoHide: 'leave',
+ autoHideDelay: 100
+ }
+ });
+ }
$.footer();
if (data.IsSuccess === false) {
toastr.error(data.HttpResult.Message, data.HttpResult.Name);
@@ -420,7 +434,41 @@
}
});
}
+
+ // 判断是否固定表头
+ var fixHeader = this.attr('data-fixedHeader') === '';
+ var $tabContainer = $(settings.tableContainer);
+ if (fixHeader && settings.height === undefined) {
+ if (settings.calcHeight === undefined) {
+ settings.calcHeight = function () {
+ var marginHeight = 0;
+ if ($tabContainer.length === 1) {
+ marginHeight = $tabContainer.outerHeight() - $tabContainer.height();
+ }
+
+ // 38: card-header
+ return Math.max(settings.minHeight, $(window).height() - $('header').height() - $('footer').height() - (marginHeight * 2) - 38 - 32 - 10);
+ };
+ }
+
+ // 设置最小高度为
+ settings.height = settings.calcHeight();
+
+ // 设置 onresize 事件
+ $(window).on('resize', this, function (event) {
+ event.data.bootstrapTable('resetView', { height: settings.calcHeight() });
+ });
+ }
+
+ // 加载数据
this.bootstrapTable(settings);
+
+ // 如果固定表头 禁止容器滚动条出现
+ if (fixHeader && $tabContainer.length > 0) {
+ $tabContainer.addClass('overflow-hidden');
+ }
+
+ // 格式化工具栏
$('.bootstrap-table .fixed-table-toolbar .columns .export .dropdown-menu').addClass("dropdown-menu-right");
var $gear = $(settings.toolbar).removeClass('d-none').find('.gear');
if ($gear.find('.dropdown-menu > a').length === 0) $gear.addClass('d-none');
diff --git a/src/admin/Bootstrap.DataAccess.MongoDB/Dict.cs b/src/admin/Bootstrap.DataAccess.MongoDB/Dict.cs
index 3ad15531..a0fd4056 100644
--- a/src/admin/Bootstrap.DataAccess.MongoDB/Dict.cs
+++ b/src/admin/Bootstrap.DataAccess.MongoDB/Dict.cs
@@ -56,13 +56,13 @@ namespace Bootstrap.DataAccess.MongoDB
}
///
- ///
+ /// 保存网站设置方法
///
- ///
+ ///
///
- public override bool SaveSettings(BootstrapDict dict)
+ public override bool SaveSettings(IEnumerable
dicts)
{
- DbManager.Dicts.FindOneAndUpdate(md => md.Category == dict.Category && md.Name == dict.Name, Builders.Update.Set(md => md.Code, dict.Code));
+ dicts.ToList().ForEach(dict => DbManager.Dicts.FindOneAndUpdate(md => md.Category == dict.Category && md.Name == dict.Name, Builders.Update.Set(md => md.Code, dict.Code)));
return true;
}
diff --git a/src/admin/Bootstrap.DataAccess/Dict.cs b/src/admin/Bootstrap.DataAccess/Dict.cs
index aa247b6e..1ff3eece 100644
--- a/src/admin/Bootstrap.DataAccess/Dict.cs
+++ b/src/admin/Bootstrap.DataAccess/Dict.cs
@@ -48,12 +48,12 @@ namespace Bootstrap.DataAccess
///
/// 保存网站个性化设置
///
- ///
+ ///
///
- public virtual bool SaveSettings(BootstrapDict dict)
+ public virtual bool SaveSettings(IEnumerable dicts)
{
using var db = DbManager.Create();
- db.Update("set Code = @Code where Category = @Category and Name = @Name", dict);
+ dicts.ToList().ForEach(dict => db.Update("set Code = @Code where Category = @Category and Name = @Name", dict));
return true;
}
@@ -290,5 +290,11 @@ namespace Bootstrap.DataAccess
///
///
public bool RetrieveEnableBlazor() => (DictHelper.RetrieveDicts().FirstOrDefault(d => d.Category == "网站设置" && d.Name == "Blazor" && d.Define == 0)?.Code ?? "0") == "1";
+
+ ///
+ /// 获得是否开启 固定表头 功能 默认开启
+ ///
+ ///
+ public bool RetrieveFixedTableHeader() => (DictHelper.RetrieveDicts().FirstOrDefault(d => d.Category == "网站设置" && d.Name == "固定表头" && d.Define == 0)?.Code ?? "1") == "1";
}
}
diff --git a/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs b/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs
index 15dc1bf1..b6216c13 100644
--- a/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs
+++ b/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs
@@ -106,11 +106,11 @@ namespace Bootstrap.DataAccess
///
/// 保存网站个性化设置
///
- ///
+ ///
///
- public static bool SaveSettings(BootstrapDict dict)
+ public static bool SaveSettings(IEnumerable dicts)
{
- var ret = DbContextManager.Create()?.SaveSettings(dict) ?? false;
+ var ret = DbContextManager.Create()?.SaveSettings(dicts) ?? false;
if (ret) CacheCleanUtility.ClearCache(dictIds: new List());
return ret;
}
@@ -275,5 +275,11 @@ namespace Bootstrap.DataAccess
///
///
public static bool RetrieveEnableBlazor() => DbContextManager.Create()?.RetrieveEnableBlazor() ?? false;
+
+ ///
+ /// 获得是否开启 固定表头 默认开启
+ ///
+ ///
+ public static bool RetrieveFixedTableHeader() => DbContextManager.Create()?.RetrieveFixedTableHeader() ?? false;
}
}