From 50e91c53bb48e3ac1c19e29b2bc8664c7796d927 Mon Sep 17 00:00:00 2001 From: Karson Date: Tue, 19 Dec 2017 23:10:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Ebtn-ajax=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E5=90=8E=E8=87=AA=E5=8A=A8=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E7=9A=84=E5=8A=9F=E8=83=BD=20=E8=A1=A8?= =?UTF-8?q?=E6=A0=BCbuttons=E6=96=B0=E5=A2=9Erefresh=E5=8F=82=E6=95=B0=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbtn-ajax=E5=9B=9E=E8=B0=83=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E5=9C=A8=E5=A4=9A=E6=AC=A1=E8=B0=83=E7=94=A8=E6=97=B6=E7=9A=84?= =?UTF-8?q?BUG=20=E4=BF=AE=E5=A4=8D=E5=9C=A8=E5=90=AF=E7=94=A8dataLimit?= =?UTF-8?q?=E6=97=B6=E5=85=B3=E8=81=94=E6=9F=A5=E8=AF=A2=E6=97=B6=E7=9A=84?= =?UTF-8?q?BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/controller/Backend.php | 14 ++++++++------ public/assets/js/backend.js | 10 +++++++--- public/assets/js/require-backend.min.js | 13 +++++++++---- public/assets/js/require-table.js | 3 ++- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/application/common/controller/Backend.php b/application/common/controller/Backend.php index e96b65db..6533529c 100644 --- a/application/common/controller/Backend.php +++ b/application/common/controller/Backend.php @@ -170,9 +170,9 @@ class Backend extends Controller 'fastadmin' => Config::get('fastadmin'), 'referer' => Session::get("referer") ]; - + Config::set('upload', array_merge(Config::get('upload'), $upload)); - + // 配置信息后 Hook::listen("config_init", $config); //加载当前控制器语言包 @@ -232,16 +232,14 @@ class Backend extends Controller { if (!empty($this->model)) { - $class = get_class($this->model); - $name = basename(str_replace('\\', '/', $class)); - $tableName = $this->model->getQuery()->getTable($name) . "."; + $tableName = $this->model->getQuery()->getTable() . "."; } $sort = stripos($sort, ".") === false ? $tableName . $sort : $sort; } $adminIds = $this->getDataLimitAdminIds(); if (is_array($adminIds)) { - $where[] = [$this->dataLimitField, 'in', $adminIds]; + $where[] = [$tableName . $this->dataLimitField, 'in', $adminIds]; } if ($search) { @@ -363,6 +361,10 @@ class Backend extends Controller { return null; } + if ($this->auth->isSuperAdmin()) + { + return null; + } $adminIds = []; if (in_array($this->dataLimit, ['auth', 'personal'])) { diff --git a/public/assets/js/backend.js b/public/assets/js/backend.js index 7efe4d0e..8aca0a5e 100755 --- a/public/assets/js/backend.js +++ b/public/assets/js/backend.js @@ -112,7 +112,7 @@ define(['fast', 'moment'], function (Fast, Moment) { //点击包含.btn-dialog的元素时弹出dialog $(document).on('click', '.btn-dialog,.dialogit', function (e) { var that = this; - var options = $(that).data() || {}; + var options = $.extend({}, $(that).data() || {}); if (typeof options.tableId !== 'undefined' && typeof options.columnIndex !== 'undefined' && typeof options.buttonIndex !== 'undefined') { var tableOptions = $("#" + options.tableId).bootstrapTable('getOptions'); if (tableOptions) { @@ -135,7 +135,7 @@ define(['fast', 'moment'], function (Fast, Moment) { //点击包含.btn-addtabs的元素时新增选项卡 $(document).on('click', '.btn-addtabs,.addtabsit', function (e) { var that = this; - var options = $(that).data() || {}; + var options = $.extend({}, $(that).data() || {}); if (typeof options.confirm !== 'undefined') { Layer.confirm(options.confirm, function (index) { Backend.api.addtabs(Backend.api.replaceids(that, $(that).attr('href')), $(that).attr("title")); @@ -150,7 +150,7 @@ define(['fast', 'moment'], function (Fast, Moment) { //点击包含.btn-ajax的元素时发送Ajax请求 $(document).on('click', '.btn-ajax,.ajaxit', function (e) { var that = this; - var options = $(that).data() || {}; + var options = $.extend({}, $(that).data() || {}); if (typeof options.url === 'undefined' && $(that).attr("href")) { options.url = $(that).attr("href"); } @@ -171,6 +171,10 @@ define(['fast', 'moment'], function (Fast, Moment) { } } } + //如果未设备成功的回调,设定了自动刷新的情况下自动进行刷新 + if (!success && typeof options.tableId !== 'undefined' && typeof options.refresh !== 'undefined' && options.refresh) { + $("#" + options.tableId).bootstrapTable('refresh'); + } if (typeof options.confirm !== 'undefined') { Layer.confirm(options.confirm, function (index) { Backend.api.ajax(options, success, error); diff --git a/public/assets/js/require-backend.min.js b/public/assets/js/require-backend.min.js index 841c2a79..c855d813 100644 --- a/public/assets/js/require-backend.min.js +++ b/public/assets/js/require-backend.min.js @@ -6910,7 +6910,7 @@ define('backend',['fast', 'moment'], function (Fast, Moment) { //点击包含.btn-dialog的元素时弹出dialog $(document).on('click', '.btn-dialog,.dialogit', function (e) { var that = this; - var options = $(that).data() || {}; + var options = $.extend({}, $(that).data() || {}); if (typeof options.tableId !== 'undefined' && typeof options.columnIndex !== 'undefined' && typeof options.buttonIndex !== 'undefined') { var tableOptions = $("#" + options.tableId).bootstrapTable('getOptions'); if (tableOptions) { @@ -6933,7 +6933,7 @@ define('backend',['fast', 'moment'], function (Fast, Moment) { //点击包含.btn-addtabs的元素时新增选项卡 $(document).on('click', '.btn-addtabs,.addtabsit', function (e) { var that = this; - var options = $(that).data() || {}; + var options = $.extend({}, $(that).data() || {}); if (typeof options.confirm !== 'undefined') { Layer.confirm(options.confirm, function (index) { Backend.api.addtabs(Backend.api.replaceids(that, $(that).attr('href')), $(that).attr("title")); @@ -6948,7 +6948,7 @@ define('backend',['fast', 'moment'], function (Fast, Moment) { //点击包含.btn-ajax的元素时发送Ajax请求 $(document).on('click', '.btn-ajax,.ajaxit', function (e) { var that = this; - var options = $(that).data() || {}; + var options = $.extend({}, $(that).data() || {}); if (typeof options.url === 'undefined' && $(that).attr("href")) { options.url = $(that).attr("href"); } @@ -6969,6 +6969,10 @@ define('backend',['fast', 'moment'], function (Fast, Moment) { } } } + //如果未设备成功的回调,设定了自动刷新的情况下自动进行刷新 + if (!success && typeof options.tableId !== 'undefined' && typeof options.refresh !== 'undefined' && options.refresh) { + $("#" + options.tableId).bootstrapTable('refresh'); + } if (typeof options.confirm !== 'undefined') { Layer.confirm(options.confirm, function (index) { Backend.api.ajax(options, success, error); @@ -10005,9 +10009,10 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr icon = j.icon ? j.icon : ''; text = j.text ? j.text : ''; title = j.title ? j.title : text; + refresh = j.refresh ? 'data-refresh="' + j.refresh + '"' : ''; confirm = j.confirm ? 'data-confirm="' + j.confirm + '"' : ''; extend = j.extend ? j.extend : ''; - html.push('' + (text ? ' ' + text : '') + ''); + html.push('' + (text ? ' ' + text : '') + ''); } }); return html.join(' '); diff --git a/public/assets/js/require-table.js b/public/assets/js/require-table.js index 94c84cca..c93d0e8a 100644 --- a/public/assets/js/require-table.js +++ b/public/assets/js/require-table.js @@ -436,9 +436,10 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table icon = j.icon ? j.icon : ''; text = j.text ? j.text : ''; title = j.title ? j.title : text; + refresh = j.refresh ? 'data-refresh="' + j.refresh + '"' : ''; confirm = j.confirm ? 'data-confirm="' + j.confirm + '"' : ''; extend = j.extend ? j.extend : ''; - html.push('' + (text ? ' ' + text : '') + ''); + html.push('' + (text ? ' ' + text : '') + ''); } }); return html.join(' ');