From b2966c00702cf2df1d8fa9c392a83af020c267fa Mon Sep 17 00:00:00 2001 From: 15090180611 <215509543@qq.com> Date: Wed, 26 Mar 2025 18:09:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4api=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/lang/zh-cn/auth/api/group.php | 12 + .../admin/lang/zh-cn/auth/api/rule.php | 29 +++ .../admin/view/auth/api/adminlog/detail.html | 27 +++ .../admin/view/auth/api/adminlog/index.html | 21 ++ .../admin/view/auth/api/group/add.html | 38 +++ .../admin/view/auth/api/group/edit.html | 38 +++ .../admin/view/auth/api/group/index.html | 21 ++ application/admin/view/auth/api/rule/add.html | 96 ++++++++ .../admin/view/auth/api/rule/edit.html | 99 ++++++++ .../admin/view/auth/api/rule/index.html | 35 +++ application/admin/view/auth/api/rule/tpl.html | 43 ++++ public/assets/js/backend/auth/api/adminlog.js | 64 +++++ public/assets/js/backend/auth/api/group.js | 160 +++++++++++++ public/assets/js/backend/auth/api/rule.js | 221 ++++++++++++++++++ 14 files changed, 904 insertions(+) create mode 100644 application/admin/lang/zh-cn/auth/api/group.php create mode 100644 application/admin/lang/zh-cn/auth/api/rule.php create mode 100644 application/admin/view/auth/api/adminlog/detail.html create mode 100644 application/admin/view/auth/api/adminlog/index.html create mode 100644 application/admin/view/auth/api/group/add.html create mode 100644 application/admin/view/auth/api/group/edit.html create mode 100644 application/admin/view/auth/api/group/index.html create mode 100644 application/admin/view/auth/api/rule/add.html create mode 100644 application/admin/view/auth/api/rule/edit.html create mode 100644 application/admin/view/auth/api/rule/index.html create mode 100644 application/admin/view/auth/api/rule/tpl.html create mode 100644 public/assets/js/backend/auth/api/adminlog.js create mode 100644 public/assets/js/backend/auth/api/group.js create mode 100644 public/assets/js/backend/auth/api/rule.js diff --git a/application/admin/lang/zh-cn/auth/api/group.php b/application/admin/lang/zh-cn/auth/api/group.php new file mode 100644 index 0000000..9deec57 --- /dev/null +++ b/application/admin/lang/zh-cn/auth/api/group.php @@ -0,0 +1,12 @@ + '父组别不能是自身的子组别', + 'The parent group can not found' => '父组别未找到', + 'Group not found' => '组别未找到', + 'Can not change the parent to child' => '父组别不能是它的子组别', + 'Can not change the parent to self' => '父组别不能是它自己', + 'You can not delete group that contain child group and administrators' => '你不能删除含有子组和管理员的组', + 'The parent group exceeds permission limit' => '父组别超出权限范围', + 'The parent group can not be its own child or itself' => '父组别不能是它的子组别及本身', +]; diff --git a/application/admin/lang/zh-cn/auth/api/rule.php b/application/admin/lang/zh-cn/auth/api/rule.php new file mode 100644 index 0000000..6f8f9da --- /dev/null +++ b/application/admin/lang/zh-cn/auth/api/rule.php @@ -0,0 +1,29 @@ + '显示全部', + 'Condition' => '规则条件', + 'Remark' => '备注', + 'Icon' => '图标', + 'Alert' => '警告', + 'Name' => '规则', + 'Controller/Action' => '控制器名/方法名', + 'Ismenu' => '菜单', + 'Menutype' => '菜单类型', + 'Addtabs' => '选项卡(默认)', + 'Dialog' => '弹窗', + 'Ajax' => 'Ajax请求', + 'Blank' => '链接', + 'Extend' => '扩展属性', + 'Search icon' => '搜索图标', + 'Toggle menu visible' => '点击切换菜单显示', + 'Toggle sub menu' => '点击切换子菜单', + 'Menu tips' => '父级菜单无需匹配控制器和方法,子级菜单请使用控制器名', + 'Node tips' => '控制器/方法名,如果有目录请使用 目录名/控制器名/方法名', + 'Url tips' => '一般情况下留空即可,如果是外部链接或相对链接请输入', + 'The non-menu rule must have parent' => '非菜单规则节点必须有父级', + 'Can not change the parent to child' => '父级不能是它的子级', + 'Can not change the parent to self' => '父级不能是它自己', + 'Name only supports letters, numbers, underscore and slash' => 'URL规则只能是小写字母、数字、下划线和/组成', + 'Rule_name' => '权限标识(菜单需要)', +]; diff --git a/application/admin/view/auth/api/adminlog/detail.html b/application/admin/view/auth/api/adminlog/detail.html new file mode 100644 index 0000000..49722a5 --- /dev/null +++ b/application/admin/view/auth/api/adminlog/detail.html @@ -0,0 +1,27 @@ + + + + + + + + + + {volist name="row" id="vo" } + + + + + {/volist} + +
{:__('Title')}{:__('Content')}
{:__($key)}{if $key=='createtime'}{$vo|datetime}{else/}{$vo|htmlentities}{/if}
+ diff --git a/application/admin/view/auth/api/adminlog/index.html b/application/admin/view/auth/api/adminlog/index.html new file mode 100644 index 0000000..ea09f1d --- /dev/null +++ b/application/admin/view/auth/api/adminlog/index.html @@ -0,0 +1,21 @@ +
+ {:build_heading()} + +
+
+
+
+
+ {:build_toolbar('refresh,delete')} +
+ +
+
+
+ +
+
+
diff --git a/application/admin/view/auth/api/group/add.html b/application/admin/view/auth/api/group/add.html new file mode 100644 index 0000000..3c281ee --- /dev/null +++ b/application/admin/view/auth/api/group/add.html @@ -0,0 +1,38 @@ +
+ {:token()} + +
+ +
+ {:build_select('row[pid]', $groupdata, null, ['class'=>'form-control selectpicker', 'data-rule'=>'required'])} +
+
+
+ +
+ +
+
+
+ +
+ + + +
+
+
+
+ +
+ {:build_radios('row[status]', ['normal'=>__('Normal'), 'hidden'=>__('Hidden')])} +
+
+ +
diff --git a/application/admin/view/auth/api/group/edit.html b/application/admin/view/auth/api/group/edit.html new file mode 100644 index 0000000..a062e43 --- /dev/null +++ b/application/admin/view/auth/api/group/edit.html @@ -0,0 +1,38 @@ +
+ {:token()} + +
+ +
+ {:build_select('row[pid]', $groupdata, $row['pid'], ['class'=>'form-control selectpicker', 'data-rule'=>'required', 'data-id'=>$row['id'], 'data-pid'=>$row['pid']])} +
+
+
+ +
+ +
+
+
+ +
+ + + +
+
+
+
+ +
+ {:build_radios('row[status]', ['normal'=>__('Normal'), 'hidden'=>__('Hidden')], $row['status'])} +
+
+ +
diff --git a/application/admin/view/auth/api/group/index.html b/application/admin/view/auth/api/group/index.html new file mode 100644 index 0000000..1045349 --- /dev/null +++ b/application/admin/view/auth/api/group/index.html @@ -0,0 +1,21 @@ +
+ {:build_heading()} + +
+
+
+
+
+ {:build_toolbar('refresh,add,delete')} +
+ +
+
+
+ +
+
+
diff --git a/application/admin/view/auth/api/rule/add.html b/application/admin/view/auth/api/rule/add.html new file mode 100644 index 0000000..3b904e9 --- /dev/null +++ b/application/admin/view/auth/api/rule/add.html @@ -0,0 +1,96 @@ +
+ {:token()} +
+ +
+ {:build_radios('row[ismenu]', ['1'=>__('Yes'), '0'=>__('No')])} +
+
+
+ +
+ {:build_select('row[pid]', $ruledata, null, ['class'=>'form-control', 'required'=>''])} +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+ + +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ {:build_radios('row[menutype]', $menutypeList)} +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ {:build_radios('row[status]', ['normal'=>__('Normal'), 'hidden'=>__('Hidden')])} +
+
+ +
+{include file="auth/api/rule/tpl" /} diff --git a/application/admin/view/auth/api/rule/edit.html b/application/admin/view/auth/api/rule/edit.html new file mode 100644 index 0000000..f2947e0 --- /dev/null +++ b/application/admin/view/auth/api/rule/edit.html @@ -0,0 +1,99 @@ +
+ {:token()} +
+ +
+ {:build_radios('row[ismenu]', ['1'=>__('Yes'), '0'=>__('No')], $row['ismenu'])} +
+
+
+ +
+ {:build_select('row[pid]', $ruledata, $row['pid'], ['class'=>'form-control', 'required'=>''])} +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+ + + + +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ {:build_radios('row[menutype]', $menutypeList, $row['menutype'])} +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ {:build_radios('row[status]', ['normal'=>__('Normal'), 'hidden'=>__('Hidden')], $row['status'])} +
+
+ +
+{include file="auth/api/rule/tpl" /} diff --git a/application/admin/view/auth/api/rule/index.html b/application/admin/view/auth/api/rule/index.html new file mode 100644 index 0000000..3f27ecb --- /dev/null +++ b/application/admin/view/auth/api/rule/index.html @@ -0,0 +1,35 @@ + +
+ {:build_heading()} + +
+ +
+
diff --git a/application/admin/view/auth/api/rule/tpl.html b/application/admin/view/auth/api/rule/tpl.html new file mode 100644 index 0000000..9413dde --- /dev/null +++ b/application/admin/view/auth/api/rule/tpl.html @@ -0,0 +1,43 @@ + + \ No newline at end of file diff --git a/public/assets/js/backend/auth/api/adminlog.js b/public/assets/js/backend/auth/api/adminlog.js new file mode 100644 index 0000000..bb2fcf4 --- /dev/null +++ b/public/assets/js/backend/auth/api/adminlog.js @@ -0,0 +1,64 @@ +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + index_url: 'auth/api/adminlog/index', + add_url: '', + edit_url: '', + del_url: 'auth/api/adminlog/del', + multi_url: 'auth/api/adminlog/multi', + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: $.fn.bootstrapTable.defaults.extend.index_url, + fixedColumns: true, + fixedRightNumber: 1, + columns: [ + [ + {field: 'state', checkbox: true,}, + {field: 'id', title: 'ID', operate: false}, + {field: 'admin_id', title: __('Admin_id'), formatter: Table.api.formatter.search, visible: false}, + {field: 'username', title: __('Username'), formatter: Table.api.formatter.search}, + {field: 'title', title: __('Title'), operate: 'LIKE %...%', placeholder: '模糊搜索'}, + {field: 'url', title: __('Url'), formatter: Table.api.formatter.url}, + {field: 'ip', title: __('IP'), events: Table.api.events.ip, formatter: Table.api.formatter.search}, + {field: 'createtime', title: __('Create time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true}, + { + field: 'operate', title: __('Operate'), table: table, + events: Table.api.events.operate, + buttons: [{ + name: 'detail', + text: __('Detail'), + icon: 'fa fa-list', + classname: 'btn btn-info btn-xs btn-detail btn-dialog', + url: 'auth/api/adminlog/detail' + }], + formatter: Table.api.formatter.operate + } + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + api: { + bindevent: function () { + Form.api.bindevent($("form[role=form]")); + }, + formatter: { + browser: function (value, row, index) { + return '' + row.useragent.split(" ")[0] + ''; + }, + }, + } + }; + return Controller; +}); diff --git a/public/assets/js/backend/auth/api/group.js b/public/assets/js/backend/auth/api/group.js new file mode 100644 index 0000000..fd42d90 --- /dev/null +++ b/public/assets/js/backend/auth/api/group.js @@ -0,0 +1,160 @@ +define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'jstree'], function ($, undefined, Backend, Table, Form, undefined) { + //读取选中的条目 + $.jstree.core.prototype.get_all_checked = function (full) { + var obj = this.get_selected(), i, j; + for (i = 0, j = obj.length; i < j; i++) { + obj = obj.concat(this.get_node(obj[i]).parents); + } + obj = $.grep(obj, function (v, i, a) { + return v != '#'; + }); + obj = obj.filter(function (itm, i, a) { + return i == a.indexOf(itm); + }); + return full ? $.map(obj, $.proxy(function (i) { + return this.get_node(i); + }, this)) : obj; + }; + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + "index_url": "auth/api/group/index", + "add_url": "auth/api/group/add", + "edit_url": "auth/api/group/edit", + "del_url": "auth/api/group/del", + "multi_url": "auth/api/group/multi", + } + }); + + var table = $("#table"); + + //在表格内容渲染完成后回调的事件 + table.on('post-body.bs.table', function (e, json) { + $("tbody tr[data-index]", this).each(function () { + if (Config.admin.group_ids.indexOf(parseInt(parseInt($("td:eq(1)", this).text()))) > -1) { + $("input[type=checkbox]", this).prop("disabled", true); + } + }); + }); + + // 初始化表格 + table.bootstrapTable({ + url: $.fn.bootstrapTable.defaults.extend.index_url, + columns: [ + [ + {field: 'state', checkbox: true,}, + {field: 'id', title: 'ID'}, + {field: 'pid', title: __('Parent')}, + {field: 'name', title: __('Name'), align: 'left', formatter:function (value, row, index) { + return value.toString().replace(/(&|&)nbsp;/g, ' '); + } + }, + {field: 'status', title: __('Status'), formatter: Table.api.formatter.status}, + { + field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: function (value, row, index) { + if (Config.admin.group_ids.indexOf(parseInt(row.id)) > -1) { + return ''; + } + return Table.api.formatter.operate.call(this, value, row, index); + } + } + ] + ], + pagination: false, + search: false, + commonSearch: false, + }); + + // 为表格绑定事件 + Table.api.bindevent(table);//当内容渲染完成后 + + }, + add: function () { + Controller.api.bindevent(); + }, + edit: function () { + Controller.api.bindevent(); + }, + api: { + bindevent: function () { + Form.api.bindevent($("form[role=form]"), null, null, function () { + if ($("#treeview").length > 0) { + var r = $("#treeview").jstree("get_all_checked"); + $("input[name='row[rules]']").val(r.join(',')); + } + return true; + }); + //渲染权限节点树 + //变更级别后需要重建节点树 + $(document).on("change", "select[name='row[pid]']", function () { + var pid = $(this).data("pid"); + var id = $(this).data("id"); + if ($(this).val() == id) { + $("option[value='" + pid + "']", this).prop("selected", true).change(); + Backend.api.toastr.error(__('Can not change the parent to self')); + return false; + } + $.ajax({ + url: "auth/api/group/roletree", + type: 'post', + dataType: 'json', + data: {id: id, pid: $(this).val()}, + success: function (ret) { + if (ret.hasOwnProperty("code")) { + var data = ret.hasOwnProperty("data") && ret.data != "" ? ret.data : ""; + if (ret.code === 1) { + //销毁已有的节点树 + $("#treeview").jstree("destroy"); + Controller.api.rendertree(data); + } else { + Backend.api.toastr.error(ret.msg); + } + } + }, error: function (e) { + Backend.api.toastr.error(e.message); + } + }); + }); + //全选和展开 + $(document).on("click", "#checkall", function () { + $("#treeview").jstree($(this).prop("checked") ? "check_all" : "uncheck_all"); + }); + $(document).on("click", "#expandall", function () { + $("#treeview").jstree($(this).prop("checked") ? "open_all" : "close_all"); + }); + $("select[name='row[pid]']").trigger("change"); + }, + rendertree: function (content) { + $("#treeview") + .on('redraw.jstree', function (e) { + $(".layer-footer").attr("domrefresh", Math.random()); + }) + .jstree({ + "themes": {"stripes": true}, + "checkbox": { + "keep_selected_style": false, + }, + "types": { + "root": { + "icon": "fa fa-folder-open", + }, + "menu": { + "icon": "fa fa-folder-open", + }, + "file": { + "icon": "fa fa-file-o", + } + }, + "plugins": ["checkbox", "types"], + "core": { + 'check_callback': true, + "data": content + } + }); + } + } + }; + return Controller; +}); diff --git a/public/assets/js/backend/auth/api/rule.js b/public/assets/js/backend/auth/api/rule.js new file mode 100644 index 0000000..3bd498b --- /dev/null +++ b/public/assets/js/backend/auth/api/rule.js @@ -0,0 +1,221 @@ +define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function ($, undefined, Backend, Table, Form, Template) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + "index_url": "auth/api/rule/index", + "add_url": "auth/api/rule/add", + "edit_url": "auth/api/rule/edit", + "del_url": "auth/api/rule/del", + "multi_url": "auth/api/rule/multi", + "table": "auth_rule" + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: $.fn.bootstrapTable.defaults.extend.index_url, + sortName: '', + escape: false, + columns: [ + [ + {field: 'state', checkbox: true,}, + {field: 'id', title: 'ID'}, + {field: 'title', title: __('Title'), align: 'left', formatter: Controller.api.formatter.title, clickToSelect: !false}, + {field: 'icon', title: __('Icon'), formatter: Controller.api.formatter.icon}, + {field: 'name', title: __('Name'), align: 'left', formatter: Controller.api.formatter.name}, + {field: 'weigh', title: __('Weigh')}, + {field: 'status', title: __('Status'), formatter: Table.api.formatter.status}, + { + field: 'ismenu', + title: __('Ismenu'), + align: 'center', + table: table, + formatter: Table.api.formatter.toggle + }, + { + field: 'operate', + title: __('Operate'), + table: table, + events: Table.api.events.operate, + formatter: Table.api.formatter.operate + } + ] + ], + pagination: false, + search: false, + commonSearch: false, + rowAttributes: function (row, index) { + return row.pid == 0 ? {} : {style: "display:none"}; + } + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + + var btnSuccessEvent = 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; + }; + + //表格内容渲染前 + table.on('pre-body.bs.table', function (e, data) { + var options = table.bootstrapTable("getOptions"); + options.escape = true; + }); + + //当内容渲染完成后 + table.on('post-body.bs.table', function (e, data) { + var options = table.bootstrapTable("getOptions"); + options.escape = false; + + //点击切换/排序/删除操作后刷新左侧菜单 + $(".btn-change[data-id],.btn-delone,.btn-dragsort").data("success", btnSuccessEvent); + + }); + + table.on('post-body.bs.table', function (e, settings, json, xhr) { + //显示隐藏子节点 + $(">tbody>tr[data-index] > td", this).on('click', "a.btn-node-sub", function () { + var status = $(this).data("shown") ? true : false; + $("a[data-pid='" + $(this).data("id") + "']").each(function () { + $(this).closest("tr").toggle(!status); + }); + if (status) { + $("a[data-pid='" + $(this).data("id") + "']").trigger("collapse"); + } + $(this).data("shown", !status); + $("i", this).toggleClass("fa-caret-down").toggleClass("fa-caret-right"); + return false; + }); + }); + + //隐藏子节点 + $(document).on("collapse", ".btn-node-sub", function () { + if ($("i", this).length > 0) { + $("a[data-pid='" + $(this).data("id") + "']").trigger("collapse"); + } + $("i", this).removeClass("fa-caret-down").addClass("fa-caret-right"); + $(this).data("shown", false); + $(this).closest("tr").toggle(false); + }); + + //批量删除后的回调 + $(".toolbar > .btn-del,.toolbar .btn-more~ul>li>a").data("success", function (e) { + Fast.api.refreshmenu(); + }); + + //展开隐藏一级 + $(document.body).on("click", ".btn-toggle", function (e) { + $("a[data-id][data-pid][data-pid!=0].disabled").closest("tr").hide(); + var that = this; + var show = $("i", that).hasClass("fa-chevron-down"); + $("i", that).toggleClass("fa-chevron-down", !show).toggleClass("fa-chevron-up", show); + $("a[data-id][data-pid][data-pid!=0]").not('.disabled').closest("tr").toggle(show); + $(".btn-node-sub[data-pid=0]").data("shown", show); + }); + + //展开隐藏全部 + $(document.body).on("click", ".btn-toggle-all", function (e) { + var that = this; + var show = $("i", that).hasClass("fa-plus"); + $("i", that).toggleClass("fa-plus", !show).toggleClass("fa-minus", show); + $(".btn-node-sub:not([data-pid=0])").closest("tr").toggle(show); + $(".btn-node-sub").data("shown", show); + $(".btn-node-sub > i").toggleClass("fa-caret-down", show).toggleClass("fa-caret-right", !show); + }); + }, + add: function () { + Controller.api.bindevent(); + }, + edit: function () { + Controller.api.bindevent(); + }, + api: { + formatter: { + title: function (value, row, index) { + value = value.toString().replace(/(&|&)nbsp;/g, ' '); + var caret = row.haschild == 1 || row.ismenu == 1 ? '' : ''; + value = value.indexOf(" ") > -1 ? value.replace(/(.*) /, "$1" + caret) : caret + value; + + value = !row.ismenu || row.status == 'hidden' ? "" + value + "" : value; + return '' + value + ''; + }, + name: function (value, row, index) { + return !row.ismenu || row.status == 'hidden' ? "" + value + "" : value; + }, + icon: function (value, row, index) { + return ''; + } + }, + bindevent: function () { + $(document).on('click', "input[name='row[ismenu]']", function () { + var name = $("input[name='row[name]']"); + var ismenu = $(this).val() == 1; + name.prop("placeholder", ismenu ? name.data("placeholder-menu") : name.data("placeholder-node")); + $('div[data-type="menu"]').toggleClass("hidden", !ismenu); + }); + $("input[name='row[ismenu]']:checked").trigger("click"); + + var iconlist = []; + var iconfunc = function () { + Layer.open({ + type: 1, + area: ['99%', '98%'], //宽高 + content: Template('chooseicontpl', {iconlist: iconlist}) + }); + }; + Form.api.bindevent($("form[role=form]"), function (data) { + Fast.api.refreshmenu(); + }); + $(document).on('change keyup', "#icon", function () { + $(this).prev().find("i").prop("class", $(this).val()); + }); + $(document).on('click', ".btn-search-icon", function () { + if (iconlist.length == 0) { + $.get(Config.site.cdnurl + "/assets/libs/font-awesome/less/variables.less", function (ret) { + var exp = /fa-var-(.*):/ig; + var result; + while ((result = exp.exec(ret)) != null) { + iconlist.push(result[1]); + } + iconfunc(); + }); + } else { + iconfunc(); + } + }); + $(document).on('click', '#chooseicon ul li', function () { + $("input[name='row[icon]']").val('fa fa-' + $(this).data("font")).trigger("change"); + Layer.closeAll(); + }); + $(document).on('keyup', 'input.js-icon-search', function () { + $("#chooseicon ul li").show(); + if ($(this).val() != '') { + $("#chooseicon ul li:not([data-font*='" + $(this).val() + "'])").hide(); + } + }); + } + } + }; + return Controller; +});