作者 Karson

优化切换按钮禁用状态

优化语言包判断
优化权限管理规则管理列表逻辑
... ... @@ -90,9 +90,9 @@ class Install extends Command
$this->request = Request::instance();
define('INSTALL_PATH', APP_PATH . 'admin' . DS . 'command' . DS . 'Install' . DS);
$langSet = $this->request->langset();
if ($langSet === 'zh-cn') {
Lang::load(INSTALL_PATH . $langSet . '.php');
$langSet = strtolower($this->request->langset());
if (!$langSet || in_array($langSet, ['zh-cn', 'zh-hans-cn'])) {
Lang::load(INSTALL_PATH . 'zh-cn.php');
}
$installLockFile = INSTALL_PATH . "install.lock";
... ...
... ... @@ -34,6 +34,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
field: 'ismenu',
title: __('Ismenu'),
align: 'center',
table: table,
formatter: Table.api.formatter.toggle
},
{
... ... @@ -83,6 +84,20 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
});
//点击切换/排序/删除操作后刷新左侧菜单
$(".btn-change[data-id],.btn-delone,.btn-dragsort").data("success", function (data, ret) {
if ($(this).hasClass("btn-change")) {
var index = $(this).data("index");
var row = Table.api.getrowbyindex(table, index);
row.ismenu = $("i.fa.text-gray", this).length > 0 ? 1 : 0;
table.bootstrapTable("updateRow", {index: index, row: row});
} else if ($(this).hasClass("btn-delone")) {
if ($(this).closest("tr[data-index]").find("a.btn-node-sub.disabled").length > 0) {
$(this).closest("tr[data-index]").remove();
} else {
table.bootstrapTable('refresh');
}
} else if ($(this).hasClass("btn-dragsort")) {
table.bootstrapTable('refresh');
}
Fast.api.refreshmenu();
return false;
});
... ...
... ... @@ -454,16 +454,16 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
});
table.on("click", "[data-id].btn-change", function (e) {
e.preventDefault();
var switcher = $.proxy(function () {
var changer = $.proxy(function () {
Table.api.multi($(this).data("action") ? $(this).data("action") : '', [$(this).data("id")], table, this);
}, this);
if (typeof $(this).data("confirm") !== 'undefined') {
Layer.confirm($(this).data("confirm"), function (index) {
switcher();
changer();
Layer.close(index);
});
} else {
switcher();
changer();
}
});
table.on("click", "[data-id].btn-edit", function (e) {
... ... @@ -652,8 +652,8 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
if (typeof this.disable !== "undefined") {
disable = typeof this.disable === "function" ? this.disable.call(this, value, row, index) : this.disable;
}
return "<a href='javascript:;' data-toggle='tooltip' title='" + __('Click to toggle') + "' class='btn-change " + (disable ? 'btn disabled' : '') + "' data-id='"
+ row[pk] + "' " + (url ? "data-url='" + url + "'" : "") + (confirm ? "data-confirm='" + confirm + "'" : "") + " data-params='" + this.field + "=" + (value == yes ? no : yes) + "'><i class='fa fa-toggle-on " + (value == yes ? 'text-' + color : 'fa-flip-horizontal text-gray') + " fa-2x'></i></a>";
return "<a href='javascript:;' data-toggle='tooltip' title='" + __('Click to toggle') + "' class='btn-change " + (disable ? 'btn disabled no-padding' : '') + "' data-index='" + index + "' data-id='"
+ row[pk] + "' " + (url ? "data-url='" + url + "'" : "") + (confirm ? "data-confirm='" + confirm + "'" : "") + " data-params='" + this.field + "=" + (value == yes ? no : yes) + "'><i class='fa fa-toggle-on text-success text-" + color + " " + (value == yes ? '' : 'fa-flip-horizontal text-gray') + " fa-2x'></i></a>";
},
url: function (value, row, index) {
value = value === null ? '' : value.toString();
... ...