mirror of https://gitee.com/karson/fastadmin.git
Pre Merge pull request !518 from 还俗二师兄/1.x-dev
commit
e505392735
|
|
@ -32,8 +32,7 @@ class Rule extends Backend
|
||||||
$v['remark'] = __($v['remark']);
|
$v['remark'] = __($v['remark']);
|
||||||
}
|
}
|
||||||
unset($v);
|
unset($v);
|
||||||
Tree::instance()->init($ruleList)->icon = [' ', ' ', ' '];
|
$this->rulelist = Tree::instance()->init($ruleList)->getTreeArrayList(0);
|
||||||
$this->rulelist = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0), 'title');
|
|
||||||
$ruledata = [0 => __('None')];
|
$ruledata = [0 => __('None')];
|
||||||
foreach ($this->rulelist as $k => &$v) {
|
foreach ($this->rulelist as $k => &$v) {
|
||||||
if (!$v['ismenu']) {
|
if (!$v['ismenu']) {
|
||||||
|
|
|
||||||
|
|
@ -479,6 +479,7 @@ class Tree
|
||||||
{
|
{
|
||||||
foreach ($data as $node) {
|
foreach ($data as $node) {
|
||||||
$node['level'] = $level;
|
$node['level'] = $level;
|
||||||
|
$node['haschild'] = !empty($node['children']) ? 1 : 0;
|
||||||
$result[] = $node;
|
$result[] = $node;
|
||||||
if (!empty($node['children'])) {
|
if (!empty($node['children'])) {
|
||||||
$this->getFlattenTree($node['children'], $level + 1, $result);
|
$this->getFlattenTree($node['children'], $level + 1, $result);
|
||||||
|
|
|
||||||
|
|
@ -105,13 +105,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||||
api: {
|
api: {
|
||||||
formatter: {
|
formatter: {
|
||||||
title: function (value, row, index) {
|
title: function (value, row, index) {
|
||||||
value = value.toString().replace(/(&|&)nbsp;/g, ' ');
|
|
||||||
var caret = row.haschild == 1 ? '<i class="fa fa-caret-right"></i>' : '';
|
var caret = row.haschild == 1 ? '<i class="fa fa-caret-right"></i>' : '';
|
||||||
value = value.indexOf(" ") > -1 ? value.replace(/(.*) /, "$1" + caret) : caret + value;
|
|
||||||
|
|
||||||
value = !row.ismenu || row.status == 'hidden' ? "<span class='text-muted'>" + value + "</span>" : 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="'
|
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">' + (' '.repeat(row.level)) + (' '.repeat(parseInt(row.level) * 4)) + caret + ' ' + value + '</a>';
|
||||||
},
|
},
|
||||||
name: function (value, row, index) {
|
name: function (value, row, index) {
|
||||||
return !row.ismenu || row.status == 'hidden' ? "<span class='text-muted'>" + value + "</span>" : value;
|
return !row.ismenu || row.status == 'hidden' ? "<span class='text-muted'>" + value + "</span>" : value;
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@
|
||||||
var createOptionList = function (searchList, vObjCol, that) {
|
var createOptionList = function (searchList, vObjCol, that) {
|
||||||
var optionList = [];
|
var optionList = [];
|
||||||
optionList.push(sprintf('<option value="">%s</option>', that.options.formatCommonChoose()));
|
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) {
|
$.each(searchList, function (key, value) {
|
||||||
optionList.push(sprintf("<option value='" + Fast.api.escape(key) + "' %s>" + Fast.api.escape(value) + "</option>", key == vObjCol.defaultValue ? 'selected' : ''));
|
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;
|
_initSearch = BootstrapTable.prototype.initSearch;
|
||||||
|
|
||||||
// 定义通用searchList处理方法
|
// 定义通用searchList处理方法
|
||||||
$.fn.bootstrapTable.utils.combineSearchList = function (list) {
|
$.fn.bootstrapTable.utils.combineSearchList = function (list, vObjCol, that) {
|
||||||
var searchList = {};
|
var searchList = {};
|
||||||
|
|
||||||
if (typeof list !== 'undefined') {
|
if (typeof list !== 'undefined') {
|
||||||
|
|
@ -302,7 +302,19 @@
|
||||||
} else {
|
} else {
|
||||||
list = ret;
|
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返回字符串直接渲染自定义搜索栏
|
// 兼容旧版本searchList返回字符串直接渲染自定义搜索栏
|
||||||
if (typeof list === 'string') {
|
if (typeof list === 'string') {
|
||||||
|
|
@ -438,3 +450,16 @@
|
||||||
}) : this.data;
|
}) : this.data;
|
||||||
};
|
};
|
||||||
}(jQuery);
|
}(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);
|
||||||
|
|
|
||||||
|
|
@ -450,7 +450,7 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var title = $(that).data('title') || $(that).attr("title") || __('Edit');
|
var title = $(that).data('title') || $(that).attr("title") || __('Edit');
|
||||||
var data = $(that).data() || {};
|
var data = $.extend({}, $(that).data());
|
||||||
delete data.title;
|
delete data.title;
|
||||||
//循环弹出多个编辑框
|
//循环弹出多个编辑框
|
||||||
$.each(Table.api.selecteddata(table), function (index, row) {
|
$.each(Table.api.selecteddata(table), function (index, row) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue