diff --git a/application/admin/controller/user/Rule.php b/application/admin/controller/user/Rule.php
index 9302dfec245ffe2845ff09f9475862a5e463bc3e..f3b755eb8042f1061c415e05473506dc711368a2 100644
--- a/application/admin/controller/user/Rule.php
+++ b/application/admin/controller/user/Rule.php
@@ -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']) {
diff --git a/extend/fast/Tree.php b/extend/fast/Tree.php
index 656c87c301e7f55461efab0d27b7d2d5594a1686..98ad0f888522f93e756e32715dc47d7ede785026 100644
--- a/extend/fast/Tree.php
+++ b/extend/fast/Tree.php
@@ -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);
diff --git a/public/assets/js/backend/user/rule.js b/public/assets/js/backend/user/rule.js
index 7f2aa693afa2ec5122ba1c96c8d3da298e4f4e71..a39af3134c721eaf694f2ee649d887a645568bc3 100644
--- a/public/assets/js/backend/user/rule.js
+++ b/public/assets/js/backend/user/rule.js
@@ -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 ? '' : '';
- value = value.indexOf(" ") > -1 ? value.replace(/(.*) /, "$1" + caret) : caret + value;
value = !row.ismenu || row.status == 'hidden' ? "" + value + "" : value;
return '';
+ + (row.haschild == 1 || row.ismenu == 1 ? 'text-primary' : 'disabled') + ' btn-node-sub">' + (' '.repeat(row.level)) + (' '.repeat(parseInt(row.level) * 4)) + caret + ' ' + value + '';
},
name: function (value, row, index) {
return !row.ismenu || row.status == 'hidden' ? "" + value + "" : value;
diff --git a/public/assets/js/bootstrap-table-commonsearch.js b/public/assets/js/bootstrap-table-commonsearch.js
index 428f707fe08b12626e4daf4fac07dd1cb48a4d62..42f20c0708d984fb36dd891930ddcf17264dadf1 100644
--- a/public/assets/js/bootstrap-table-commonsearch.js
+++ b/public/assets/js/bootstrap-table-commonsearch.js
@@ -134,7 +134,7 @@
var createOptionList = function (searchList, vObjCol, that) {
var optionList = [];
optionList.push(sprintf('', 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("", 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("", 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
+ *
+ * @author: Karson
+ * @update 2018-04-05
+ */
+… return true;
+ }) : this.data;
+ };
+}(jQuery);
diff --git a/public/assets/js/require-table.js b/public/assets/js/require-table.js
index cb52c49ad4b3afc3e9d9562f4c031985e633bf85..287b507753c7f7120600624a52473f0275d63e5b 100644
--- a/public/assets/js/require-table.js
+++ b/public/assets/js/require-table.js
@@ -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) {