diff --git a/public/static/plugs/ulthon-admin/src/ulthon-admin.03-table.js b/public/static/plugs/ulthon-admin/src/ulthon-admin.03-table.js
index 17ef0d5..ab050ab 100644
--- a/public/static/plugs/ulthon-admin/src/ulthon-admin.03-table.js
+++ b/public/static/plugs/ulthon-admin/src/ulthon-admin.03-table.js
@@ -388,100 +388,180 @@
}
var formSearchHideClass = '';
- if (d.searchHide == true) {
- formSearchHideClass = ' layui-hide';
+ if (d.searchHide) {
+ formSearchHideClass = ' search-hide-item';
}
- if (d.search == true || d.search == 'text') {
- formHtml += '
\n';
- } else if (d.search == 'select') {
- formHtml += '\n';
- } else if (d.search == 'time_limit') {
- if (d.timeType == undefined) {
- d.timeType = 'datetime';
+ newCols.push(d);
+ } else {
+ formHtml += '';
}
- formHtml += '\n';
- tabSetting[tableId + '_' + d.field + '_min'] = {
- elem: '#c-' + d.elemIdName + '-min',
- type: d.timeType,
- range: false,
- };
- tabSetting[tableId + '_' + d.field + '_max'] = {
- elem: '#c-' + d.elemIdName + '-max',
- type: d.timeType,
- range: false,
- };
-
- } else if (d.search == 'number_limit') {
- formHtml += '\n';
- }
-
- if (d.search !== false) {
- newCols.push(d);
}
});
- var html = '';
- html += '\n';
+ if (tabSetting.field) {
+ var tabId = 'tabFieldset_' + tableId;
+ $(elem).before('');
+ var header = [
+ {
+ title: '全部',
+ key: '',
+ }
+ ];
+ for (const tabSettingListKey in tabSetting.list) {
+ if (Object.prototype.hasOwnProperty.call(tabSetting.list, tabSettingListKey)) {
+ const tabItem = tabSetting.list[tabSettingListKey];
+ header.push({
+ title: tabItem,
+ key: tabSettingListKey,
+ });
+ }
+ }
+ layui.tabs.render({
+ elem: '#' + tabId,
+ header: header,
+ index: tabSetting.index + 1,
+ });
+ layui.tabs.on('afterChange(' + tabId + ')', function (data) {
+ var value = $(data.thisHeaderItem).attr('lay-key');
+ $('#c-' + tabSetting.elemIdName).val(value);
+ $('[lay-filter="' + tableId + '_filter"]').trigger('click');
- var searchFieldsetId = '#searchFieldset_' + tableId;
- if ($(searchFieldsetId).length) {
- $(searchFieldsetId).remove();
+ });
}
- $(elem).before(html);
- form.render();
+ if (formHtml !== '') {
+ var html = '';
+ html += '\n';
- $.each(tabSetting, function (key, val) {
- laydate.render(val);
- });
+ var searchFieldsetId = '#searchFieldset_' + tableId;
+ if ($(searchFieldsetId).length) {
+ $(searchFieldsetId).remove();
+ }
+ $(elem).before(html);
- admin.table.listenTableSearch(tableId);
+ admin.table.listenTableSearch(tableId);
+
+ form.render();
+ $.each(newCols, function (ncI, ncV) {
+ if (ncV.search === 'range') {
+ laydate.render({ range: true, type: ncV.timeType, elem: '[name="' + ncV.fieldAlias + '"]' });
+ }
+ if (ncV.search === 'time') {
+ laydate.render({ type: ncV.timeType, elem: '[name="' + ncV.fieldAlias + '"]' });
+ }
+ if (ncV.search === 'time_limit') {
+ laydate.render({ type: ncV.timeType, elem: '[name="[' + ncV.fieldAlias + ']min_date"]' });
+ laydate.render({ type: ncV.timeType, elem: '[name="[' + ncV.fieldAlias + ']max_date"]' });
+ }
+ });
+ }
+
+ options.where = {
+ filter: JSON.stringify(formatFilter),
+ op: JSON.stringify(formatOp)
+ };
+
+ lastTableWhere[tableId] = options.where;
return options;
},
listenTableSearch: function (tableId) {
diff --git a/public/static/plugs/ulthon-admin/ulthon-admin.js b/public/static/plugs/ulthon-admin/ulthon-admin.js
index 5ca203d..0fa94c4 100644
--- a/public/static/plugs/ulthon-admin/ulthon-admin.js
+++ b/public/static/plugs/ulthon-admin/ulthon-admin.js
@@ -709,100 +709,180 @@
}
var formSearchHideClass = '';
- if (d.searchHide == true) {
- formSearchHideClass = ' layui-hide';
+ if (d.searchHide) {
+ formSearchHideClass = ' search-hide-item';
}
- if (d.search == true || d.search == 'text') {
- formHtml += '\n';
- } else if (d.search == 'select') {
- formHtml += '\n';
- } else if (d.search == 'time_limit') {
- if (d.timeType == undefined) {
- d.timeType = 'datetime';
+ newCols.push(d);
+ } else {
+ formHtml += '';
}
- formHtml += '\n';
- tabSetting[tableId + '_' + d.field + '_min'] = {
- elem: '#c-' + d.elemIdName + '-min',
- type: d.timeType,
- range: false,
- };
- tabSetting[tableId + '_' + d.field + '_max'] = {
- elem: '#c-' + d.elemIdName + '-max',
- type: d.timeType,
- range: false,
- };
-
- } else if (d.search == 'number_limit') {
- formHtml += '\n';
- }
-
- if (d.search !== false) {
- newCols.push(d);
}
});
- var html = '';
- html += '\n';
+ if (tabSetting.field) {
+ var tabId = 'tabFieldset_' + tableId;
+ $(elem).before('');
+ var header = [
+ {
+ title: '全部',
+ key: '',
+ }
+ ];
+ for (const tabSettingListKey in tabSetting.list) {
+ if (Object.prototype.hasOwnProperty.call(tabSetting.list, tabSettingListKey)) {
+ const tabItem = tabSetting.list[tabSettingListKey];
+ header.push({
+ title: tabItem,
+ key: tabSettingListKey,
+ });
+ }
+ }
+ layui.tabs.render({
+ elem: '#' + tabId,
+ header: header,
+ index: tabSetting.index + 1,
+ });
+ layui.tabs.on('afterChange(' + tabId + ')', function (data) {
+ var value = $(data.thisHeaderItem).attr('lay-key');
+ $('#c-' + tabSetting.elemIdName).val(value);
+ $('[lay-filter="' + tableId + '_filter"]').trigger('click');
- var searchFieldsetId = '#searchFieldset_' + tableId;
- if ($(searchFieldsetId).length) {
- $(searchFieldsetId).remove();
+ });
}
- $(elem).before(html);
- form.render();
+ if (formHtml !== '') {
+ var html = '';
+ html += '\n';
- $.each(tabSetting, function (key, val) {
- laydate.render(val);
- });
+ var searchFieldsetId = '#searchFieldset_' + tableId;
+ if ($(searchFieldsetId).length) {
+ $(searchFieldsetId).remove();
+ }
+ $(elem).before(html);
- admin.table.listenTableSearch(tableId);
+ admin.table.listenTableSearch(tableId);
+
+ form.render();
+ $.each(newCols, function (ncI, ncV) {
+ if (ncV.search === 'range') {
+ laydate.render({ range: true, type: ncV.timeType, elem: '[name="' + ncV.fieldAlias + '"]' });
+ }
+ if (ncV.search === 'time') {
+ laydate.render({ type: ncV.timeType, elem: '[name="' + ncV.fieldAlias + '"]' });
+ }
+ if (ncV.search === 'time_limit') {
+ laydate.render({ type: ncV.timeType, elem: '[name="[' + ncV.fieldAlias + ']min_date"]' });
+ laydate.render({ type: ncV.timeType, elem: '[name="[' + ncV.fieldAlias + ']max_date"]' });
+ }
+ });
+ }
+
+ options.where = {
+ filter: JSON.stringify(formatFilter),
+ op: JSON.stringify(formatOp)
+ };
+
+ lastTableWhere[tableId] = options.where;
return options;
},
listenTableSearch: function (tableId) {