4 Commits

Author SHA1 Message Date
wolfcode
8a33a4fed3 fix(easy-admin): improve select component rendering and initialization
- Update select component initialization to properly set selected values
- Modify search value comparison to use loose equality for broader compatibility
- Enhance xmSelect rendering with pre-selected values
2025-05-20 10:22:50 +08:00
wolfcode
a4e8a86045 🚀 Layui v2.11.2 2025-05-19 18:30:34 +08:00
wolfcode
61e622d2ad refactor(controller): instantiate model class instead of assigning model name
- Change {{modelFilename}}::class to new {{modelFilename}}() in controller constructor- This modification allows direct access to model properties and methods
2025-05-14 12:32:02 +08:00
wolfcode
1b3265aeb5 feat(menu): add toggle buttons for menu folding and unfolding
- Add a new button for toggling menu folding and unfolding
- Implement functionality to fold and unfold all menu items
- Update button text and icon based on current state (folded/unfolded)
2025-05-13 14:06:20 +08:00
7 changed files with 68 additions and 7 deletions

View File

@@ -24,7 +24,7 @@ class Goods extends AdminController
public function __construct(App $app)
{
parent::__construct($app);
self::$model = MallGoods::class;
self::$model = new MallGoods();
$this->assign('cate', MallCate::column('title', 'id'));
}

View File

@@ -16,7 +16,7 @@ class {{controllerName}} extends AdminController
public function __construct(App $app)
{
parent::__construct($app);
self::$model = {{modelFilename}}::class;
self::$model = new {{modelFilename}}();
$notes = self::$model::$notes;
{{constructRelation}}
$this->notes =$notes;

View File

@@ -20,4 +20,5 @@
<button class="layui-btn layui-btn-sm layuimini-btn-primary" data-treetable-refresh><i class="fa fa-refresh"></i></button>
<button class="layui-btn layui-btn-normal layui-btn-sm {if !auth('system.menu/add')}layui-hide{/if}" data-open="system.menu/add" data-title="添加"><i class="fa fa-plus"></i> 添加</button>
<button class="layui-btn layui-btn-sm layui-btn-danger {if !auth('system.menu/delete')}layui-hide{/if}" data-url="system.menu/delete" data-treetable-delete="currentTableRenderId"><i class="fa fa-trash-o"></i> 删除</button>
<button class="layui-btn layui-btn-sm" type="button" data-treetable-arrow data-arrow="up"><i class="fa fa-arrow-up"></i> 一键折叠</button>
</script>

View File

@@ -121,6 +121,22 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu
return false;
});
$('body').on('click', '[data-treetable-arrow]', function () {
const $icon = $(this).find('i');
const $textNode = $icon[0].nextSibling;
if ($icon.hasClass('fa-arrow-up')) {
treetable.foldAll(init.table_elem);
$icon.removeClass('fa-arrow-up').addClass('fa-arrow-down');
$textNode.textContent = ' 一键展开';
$(this).attr('data-arrow', 'down');
} else {
treetable.expandAll(init.table_elem);
$icon.removeClass('fa-arrow-down').addClass('fa-arrow-up');
$textNode.textContent = ' 一键折叠';
$(this).attr('data-arrow', 'up');
}
})
ea.table.listenSwitch({filter: 'status', url: init.modify_url});
ea.table.listenEdit(init, 'currentTable', init.table_render_id, true);

View File

@@ -154,4 +154,46 @@ function prettyFormat(str) {
return ''
}
return "<pre>" + result + "</pre>"
}
}
if (self === top) {
console.group('温馨提示');
console.log(`%c
▄▄ ▄▄
▀███▀▀▀███ ██ ▀███ ██ ▄█▄▀▄██▄
██ ▀█ ▄██▄ ██ ██ ██
██ █ ▄█▀██▄ ▄██▀█████▀ ▀██▀ ▄█▀██▄ ▄█▀▀███ ▀████████▄█████▄ ▀███ ▀████████▄ ▀██▄ ▄▄█
██████ ██ ██ ██ ▀▀ ██ ▄█ ▄█ ▀██ ▄██ ██ ██ ██ ██ ██ ██ ██ ▄█████▄
██ █ ▄▄█████ ▀█████▄ ██ ▄█ ████████ ███ ██ ██ ██ ██ ██ ██ ██ ██ ▀███
██ ▄██ ██ █▄ ██ ███ █▀ ██ ▀██ ██ ██ ██ ██ ██ ██ ██ ██ ▀██
▄██████████████▀██▄██████▀ ▄█ ▄███▄ ▄████▄ ▀████▀███▄████ ████ ████▄████▄████ ████▄███████
▄█
██▀
%c
官方网站https://easyadmin8.top
官方文档https://edocs.easyadmin8.top
问答社区https://meta.easyadmin8.top
%c重要事情说3遍
%c
常见问题https://easyadmin8.top/guide/question.html
常见问题https://easyadmin8.top/guide/question.html
常见问题https://easyadmin8.top/guide/question.html
%c遇到问题先把 DEBUG 模式打开然后把错误信息找出来当不能解决的时候再去社区提问或者QQ群交流
`,
"color:#4290f7;font-weight:bold;font-size:10px;",
"color:#5672cd;",
"color:#ff5722;font-weight:bold;font-size:1rem;",
"color:#5672cd;",
"color:#ff5722;font-weight:bold;font-size:1rem;background:#f9de97;",
);
console.groupEnd();
}

View File

@@ -373,7 +373,7 @@ define(["jquery", "tableSelect", "miniTheme", "xmSelect", "lazyload"], function
var selectHtml = '';
$.each(d.selectList, function (sI, sV) {
var selected = '';
if (sI === d.searchValue) {
if (sI == d.searchValue) {
selected = 'selected=""';
}
selectHtml += '<option value="' + sI + '" ' + selected + '>' + sV + '</option>/n';
@@ -396,7 +396,7 @@ define(["jquery", "tableSelect", "miniTheme", "xmSelect", "lazyload"], function
formHtml += '\t<div class="layui-form-item layui-inline">\n' +
'<label class="layui-form-label">' + d.title + '</label>\n' +
'<div class="layui-input-inline">\n' +
'<div id="c-' + d.fieldAlias + '" class="tableSearch-xmSelect xmSelect-' + d.fieldAlias + '" name="' + d.fieldAlias + '" data-search-op="' + d.searchOp + '"></div>\n' +
'<div id="c-' + d.fieldAlias + '" class="tableSearch-xmSelect xmSelect-' + d.fieldAlias + '" name="' + d.fieldAlias + '" data-search-op="' + d.searchOp + '" data-search-value="' + d.searchValue + '"></div>\n' +
'</div>\n' +
'</div>';
init.xmSelectList[d.fieldAlias] = d.selectList
@@ -874,8 +874,10 @@ define(["jquery", "tableSelect", "miniTheme", "xmSelect", "lazyload"], function
listenTableSearch: function (tableId) {
if (Object.keys(init.xmSelectList).length > 0) {
$.each(init.xmSelectList, function (index, value) {
let xmSearchValue = $('#c-' + index).data('search-value') || [];
if (!Array.isArray(xmSearchValue)) xmSearchValue = (xmSearchValue.toString()).split(',')
const keysArray = Object.keys(value).map((key) => {
return {name: value[key], value: key}
return {name: value[key], value: key, selected: xmSearchValue.indexOf(key) !== -1}
})
init.xmSelectModel[index] = xmSelect.render({
el: '.xmSelect-' + index, language: 'zn', data: keysArray, name: index,

File diff suppressed because one or more lines are too long