Pre Merge pull request !518 from 还俗二师兄/1.x-dev

pull/518/MERGE
还俗二师兄 2026-05-11 02:44:06 +00:00 committed by Gitee
commit 7cdffd6a2e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 31 additions and 8 deletions

View File

@ -32,8 +32,7 @@ class Rule extends Backend
$v['remark'] = __($v['remark']);
}
unset($v);
Tree::instance()->init($ruleList)->icon = ['    ', '    ', '    '];
$this->rulelist = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0), 'title');
$this->rulelist = Tree::instance()->init($ruleList)->getTreeArrayList(0);
$ruledata = [0 => __('None')];
foreach ($this->rulelist as $k => &$v) {
if (!$v['ismenu']) {

View File

@ -479,6 +479,7 @@ class Tree
{
foreach ($data as $node) {
$node['level'] = $level;
$node['haschild'] = !empty($node['children']) ? 1 : 0;
$result[] = $node;
if (!empty($node['children'])) {
$this->getFlattenTree($node['children'], $level + 1, $result);

View File

@ -105,13 +105,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
api: {
formatter: {
title: function (value, row, index) {
value = value.toString().replace(/(&|&)nbsp;/g, ' ');
var caret = row.haschild == 1 ? '<i class="fa fa-caret-right"></i>' : '';
value = value.indexOf("&nbsp;") > -1 ? value.replace(/(.*)&nbsp;/, "$1" + caret) : caret + value;
value = !row.ismenu || row.status == 'hidden' ? "<span class='text-muted'>" + value + "</span>" : value;
return '<a href="javascript:;" data-id="' + row.id + '" data-pid="' + row.pid + '" class="'
+ (row.haschild == 1 || row.ismenu == 1 ? 'text-primary' : 'disabled') + ' btn-node-sub">' + value + '</a>';
+ (row.haschild == 1 || row.ismenu == 1 ? 'text-primary' : 'disabled') + ' btn-node-sub">' + ('&nbsp'.repeat(row.level)) + ('&nbsp;'.repeat(parseInt(row.level) * 4)) + caret + '&nbsp;' + value + '</a>';
},
name: function (value, row, index) {
return !row.ismenu || row.status == 'hidden' ? "<span class='text-muted'>" + value + "</span>" : value;

View File

@ -134,7 +134,7 @@
var createOptionList = function (searchList, vObjCol, that) {
var optionList = [];
optionList.push(sprintf('<option value="">%s</option>', that.options.formatCommonChoose()));
searchList = $.fn.bootstrapTable.utils.combineSearchList(searchList);
searchList = $.fn.bootstrapTable.utils.combineSearchList(searchList, vObjCol, that);
$.each(searchList, function (key, value) {
optionList.push(sprintf("<option value='" + Fast.api.escape(key) + "' %s>" + Fast.api.escape(value) + "</option>", key == vObjCol.defaultValue ? 'selected' : ''));
});
@ -286,7 +286,7 @@
_initSearch = BootstrapTable.prototype.initSearch;
// 定义通用searchList处理方法
$.fn.bootstrapTable.utils.combineSearchList = function (list) {
$.fn.bootstrapTable.utils.combineSearchList = function (list, vObjCol, that) {
var searchList = {};
if (typeof list !== 'undefined') {
@ -302,7 +302,19 @@
} else {
list = ret;
}
let optionList = [];
$.each(list, function (key, val) {
if (typeof val !== 'undefined' && val.constructor === Object) {
key = val.id;
val = val[vObjCol.nameKey || 'name'];
} else {
key = isArray ? val : key;
}
optionList.push(sprintf("<option value='" + Fast.api.escape(key) + "' %s>" + Fast.api.escape(val) + "</option>", key == vObjCol.defaultValue && vObjCol.defaultValue !='' ? 'selected' : ''));
});
$("form.form-commonsearch select[name='" + vObjCol.field + "']", that.$container).append(optionList.join('')).trigger("change");
});
list = '';
}
// 兼容旧版本searchList返回字符串直接渲染自定义搜索栏
if (typeof list === 'string') {
@ -438,3 +450,16 @@
}) : this.data;
};
}(jQuery);
/**
* FastAdmin通用搜索
*
* @author: pppscn <35696959@qq.com>
* @update 2017-05-07 <https://gitee.com/pp/fastadmin>
*
* @author: Karson <karson@fastadmin.net>
* @update 2018-04-05 <https://gitee.com/karson/fastadmin>
*/
return true;
}) : this.data;
};
}(jQuery);

View File

@ -450,7 +450,7 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
return;
}
var title = $(that).data('title') || $(that).attr("title") || __('Edit');
var data = $(that).data() || {};
var data = $.extend({}, $(that).data());
delete data.title;
//循环弹出多个编辑框
$.each(Table.api.selecteddata(table), function (index, row) {