作者 Karson

优化切换按钮禁用状态

优化语言包判断
优化权限管理规则管理列表逻辑
@@ -90,9 +90,9 @@ class Install extends Command @@ -90,9 +90,9 @@ class Install extends Command
90 $this->request = Request::instance(); 90 $this->request = Request::instance();
91 91
92 define('INSTALL_PATH', APP_PATH . 'admin' . DS . 'command' . DS . 'Install' . DS); 92 define('INSTALL_PATH', APP_PATH . 'admin' . DS . 'command' . DS . 'Install' . DS);
93 - $langSet = $this->request->langset();  
94 - if ($langSet === 'zh-cn') {  
95 - Lang::load(INSTALL_PATH . $langSet . '.php'); 93 + $langSet = strtolower($this->request->langset());
  94 + if (!$langSet || in_array($langSet, ['zh-cn', 'zh-hans-cn'])) {
  95 + Lang::load(INSTALL_PATH . 'zh-cn.php');
96 } 96 }
97 97
98 $installLockFile = INSTALL_PATH . "install.lock"; 98 $installLockFile = INSTALL_PATH . "install.lock";
@@ -34,6 +34,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function @@ -34,6 +34,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
34 field: 'ismenu', 34 field: 'ismenu',
35 title: __('Ismenu'), 35 title: __('Ismenu'),
36 align: 'center', 36 align: 'center',
  37 + table: table,
37 formatter: Table.api.formatter.toggle 38 formatter: Table.api.formatter.toggle
38 }, 39 },
39 { 40 {
@@ -83,6 +84,20 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function @@ -83,6 +84,20 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
83 }); 84 });
84 //点击切换/排序/删除操作后刷新左侧菜单 85 //点击切换/排序/删除操作后刷新左侧菜单
85 $(".btn-change[data-id],.btn-delone,.btn-dragsort").data("success", function (data, ret) { 86 $(".btn-change[data-id],.btn-delone,.btn-dragsort").data("success", function (data, ret) {
  87 + if ($(this).hasClass("btn-change")) {
  88 + var index = $(this).data("index");
  89 + var row = Table.api.getrowbyindex(table, index);
  90 + row.ismenu = $("i.fa.text-gray", this).length > 0 ? 1 : 0;
  91 + table.bootstrapTable("updateRow", {index: index, row: row});
  92 + } else if ($(this).hasClass("btn-delone")) {
  93 + if ($(this).closest("tr[data-index]").find("a.btn-node-sub.disabled").length > 0) {
  94 + $(this).closest("tr[data-index]").remove();
  95 + } else {
  96 + table.bootstrapTable('refresh');
  97 + }
  98 + } else if ($(this).hasClass("btn-dragsort")) {
  99 + table.bootstrapTable('refresh');
  100 + }
86 Fast.api.refreshmenu(); 101 Fast.api.refreshmenu();
87 return false; 102 return false;
88 }); 103 });
@@ -454,16 +454,16 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table @@ -454,16 +454,16 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
454 }); 454 });
455 table.on("click", "[data-id].btn-change", function (e) { 455 table.on("click", "[data-id].btn-change", function (e) {
456 e.preventDefault(); 456 e.preventDefault();
457 - var switcher = $.proxy(function () { 457 + var changer = $.proxy(function () {
458 Table.api.multi($(this).data("action") ? $(this).data("action") : '', [$(this).data("id")], table, this); 458 Table.api.multi($(this).data("action") ? $(this).data("action") : '', [$(this).data("id")], table, this);
459 }, this); 459 }, this);
460 if (typeof $(this).data("confirm") !== 'undefined') { 460 if (typeof $(this).data("confirm") !== 'undefined') {
461 Layer.confirm($(this).data("confirm"), function (index) { 461 Layer.confirm($(this).data("confirm"), function (index) {
462 - switcher(); 462 + changer();
463 Layer.close(index); 463 Layer.close(index);
464 }); 464 });
465 } else { 465 } else {
466 - switcher(); 466 + changer();
467 } 467 }
468 }); 468 });
469 table.on("click", "[data-id].btn-edit", function (e) { 469 table.on("click", "[data-id].btn-edit", function (e) {
@@ -652,8 +652,8 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table @@ -652,8 +652,8 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
652 if (typeof this.disable !== "undefined") { 652 if (typeof this.disable !== "undefined") {
653 disable = typeof this.disable === "function" ? this.disable.call(this, value, row, index) : this.disable; 653 disable = typeof this.disable === "function" ? this.disable.call(this, value, row, index) : this.disable;
654 } 654 }
655 - return "<a href='javascript:;' data-toggle='tooltip' title='" + __('Click to toggle') + "' class='btn-change " + (disable ? 'btn disabled' : '') + "' data-id='"  
656 - + 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>"; 655 + return "<a href='javascript:;' data-toggle='tooltip' title='" + __('Click to toggle') + "' class='btn-change " + (disable ? 'btn disabled no-padding' : '') + "' data-index='" + index + "' data-id='"
  656 + + 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>";
657 }, 657 },
658 url: function (value, row, index) { 658 url: function (value, row, index) {
659 value = value === null ? '' : value.toString(); 659 value = value === null ? '' : value.toString();