From b9d55fca25df817a2f47b4ca204cd15142458c76 Mon Sep 17 00:00:00 2001 From: Karson Date: Wed, 2 Sep 2020 15:48:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96JS=E5=88=86=E7=89=87=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E9=BB=98=E8=AE=A4=E9=85=8D=E7=BD=AE=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E8=8F=9C=E5=8D=95=E8=A7=84=E5=88=99=E5=92=8C=E5=88=86?= =?UTF-8?q?=E7=BB=84JS=E5=AE=89=E5=85=A8=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/view/addon/index.html | 2 +- public/assets/js/backend/auth/group.js | 8 +++++--- public/assets/js/backend/auth/rule.js | 12 ++++++++++-- public/assets/js/backend/category.js | 8 +++++--- public/assets/js/backend/user/rule.js | 8 +++++--- public/assets/js/require-backend.min.js | 3 +-- public/assets/js/require-upload.js | 3 +-- 7 files changed, 28 insertions(+), 16 deletions(-) diff --git a/application/admin/view/addon/index.html b/application/admin/view/addon/index.html index 442c8175..6f0d93a1 100644 --- a/application/admin/view/addon/index.html +++ b/application/admin/view/addon/index.html @@ -79,7 +79,7 @@
{:build_toolbar('refresh')} - {if $Think.config.fastadmin.api_url} diff --git a/public/assets/js/backend/auth/group.js b/public/assets/js/backend/auth/group.js index 94a4b4b4..1687288a 100755 --- a/public/assets/js/backend/auth/group.js +++ b/public/assets/js/backend/auth/group.js @@ -42,13 +42,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'jstree'], function ( // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, - escape: false, columns: [ [ {field: 'state', checkbox: true,}, {field: 'id', title: 'ID'}, {field: 'pid', title: __('Parent')}, - {field: 'name', title: __('Name'), align: 'left'}, + {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) { @@ -155,4 +157,4 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'jstree'], function ( } }; return Controller; -}); \ No newline at end of file +}); diff --git a/public/assets/js/backend/auth/rule.js b/public/assets/js/backend/auth/rule.js index 0e3d9f2b..5e942782 100755 --- a/public/assets/js/backend/auth/rule.js +++ b/public/assets/js/backend/auth/rule.js @@ -59,8 +59,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function // 为表格绑定事件 Table.api.bindevent(table); + //表格内容渲染前 + 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, settings, json, xhr) { + table.on('post-body.bs.table', function (e, data) { + var options = table.bootstrapTable("getOptions"); + options.escape = false; //默认隐藏所有子节点 //$("a.btn[data-id][data-pid][data-pid!=0]").closest("tr").hide(); $(".btn-node-sub.disabled").closest("tr").hide(); @@ -114,6 +121,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function api: { formatter: { title: function (value, row, index) { + value = value.toString().replace(/(&|&)nbsp;/g, ''); return !row.ismenu || row.status == 'hidden' ? "" + value + "" : value; }, name: function (value, row, index) { @@ -173,4 +181,4 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function } }; return Controller; -}); \ No newline at end of file +}); diff --git a/public/assets/js/backend/category.js b/public/assets/js/backend/category.js index 8552b0cc..7ab58f36 100644 --- a/public/assets/js/backend/category.js +++ b/public/assets/js/backend/category.js @@ -18,7 +18,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin var table = $("#table"); var tableOptions = { url: $.fn.bootstrapTable.defaults.extend.index_url, - escape: false, pk: 'id', sortName: 'weigh', pagination: false, @@ -29,7 +28,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'type', title: __('Type'), operate: false, searchList: Config.searchList, formatter: Table.api.formatter.label}, - {field: 'name', title: __('Name'), align: 'left'}, + {field: 'name', title: __('Name'), align: 'left', formatter:function (value, row, index) { + return value.toString().replace(/(&|&)nbsp;/g, ''); + } + }, {field: 'nickname', title: __('Nickname')}, {field: 'flag', title: __('Flag'), formatter: Table.api.formatter.flag}, {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, @@ -88,4 +90,4 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin } }; return Controller; -}); \ No newline at end of file +}); diff --git a/public/assets/js/backend/user/rule.js b/public/assets/js/backend/user/rule.js index 6cf3575f..7d873090 100644 --- a/public/assets/js/backend/user/rule.js +++ b/public/assets/js/backend/user/rule.js @@ -21,13 +21,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'weigh', - escape: false, columns: [ [ {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'pid', title: __('Pid'), visible: false}, - {field: 'title', title: __('Title'), align: 'left'}, + {field: 'title', title: __('Title'), align: 'left', formatter:function (value, row, index) { + return value.toString().replace(/(&|&)nbsp;/g, ''); + } + }, {field: 'name', title: __('Name'), align: 'left'}, {field: 'remark', title: __('Remark')}, {field: 'ismenu', title: __('Ismenu'), formatter: Table.api.formatter.toggle}, @@ -64,4 +66,4 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin } }; return Controller; -}); \ No newline at end of file +}); diff --git a/public/assets/js/require-backend.min.js b/public/assets/js/require-backend.min.js index fcc9c794..a569b4de 100644 --- a/public/assets/js/require-backend.min.js +++ b/public/assets/js/require-backend.min.js @@ -7411,8 +7411,7 @@ define('upload',['jquery', 'bootstrap', 'dropzone', 'template'], function ($, un //上传URL url = url ? url : Config.upload.uploadurl; url = Fast.api.fixurl(url); - var chunking = Config.upload.chunking || false, - chunkSize = Config.upload.chunksize || 2097152; + var chunking = false, chunkSize = Config.upload.chunksize || 2097152; //最大可上传文件大小 maxsize = typeof maxsize !== "undefined" ? maxsize : Config.upload.maxsize; diff --git a/public/assets/js/require-upload.js b/public/assets/js/require-upload.js index 87518045..a378167d 100755 --- a/public/assets/js/require-upload.js +++ b/public/assets/js/require-upload.js @@ -141,8 +141,7 @@ define(['jquery', 'bootstrap', 'dropzone', 'template'], function ($, undefined, //上传URL url = url ? url : Config.upload.uploadurl; url = Fast.api.fixurl(url); - var chunking = Config.upload.chunking || false, - chunkSize = Config.upload.chunksize || 2097152; + var chunking = false, chunkSize = Config.upload.chunksize || 2097152; //最大可上传文件大小 maxsize = typeof maxsize !== "undefined" ? maxsize : Config.upload.maxsize;