From 2fecaeae0ba564f990da9f41dcc0bf686e3c4bcd Mon Sep 17 00:00:00 2001 From: Karson Date: Tue, 1 Sep 2020 21:36:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=BC=80=E5=85=B3=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E7=A1=AE=E8=AE=A4=E6=8F=90=E7=A4=BA=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E6=8B=96=E6=8B=BD=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Ajax.php | 3 ++ .../admin/view/general/config/index.html | 4 ++ public/assets/js/require-backend.min.js | 53 ++++++++++++++----- public/assets/js/require-form.js | 35 +++++++----- public/assets/js/require-table.js | 18 ++++++- 5 files changed, 85 insertions(+), 28 deletions(-) diff --git a/application/admin/controller/Ajax.php b/application/admin/controller/Ajax.php index 160677ce..8ea11e04 100644 --- a/application/admin/controller/Ajax.php +++ b/application/admin/controller/Ajax.php @@ -173,6 +173,9 @@ class Ajax extends Backend $offset = isset($temp[$m - 1]) ? $temp[$m - 1] : $sour_id; } } + if (!isset($weighdata[$offset])) { + continue; + } $weighids[$n] = $weighdata[$offset]; Db::name($table)->where($prikey, $n)->update([$field => $weighdata[$offset]]); } diff --git a/application/admin/view/general/config/index.html b/application/admin/view/general/config/index.html index fea64f4a..1f7bd35c 100644 --- a/application/admin/view/general/config/index.html +++ b/application/admin/view/general/config/index.html @@ -93,14 +93,18 @@ {/case} {case checkbox} +
{foreach name="item.content" item="vo"} {/foreach} +
{/case} {case radio} +
{foreach name="item.content" item="vo"} {/foreach} +
{/case} {case value="select" break="0"}{/case} {case value="selects"} diff --git a/public/assets/js/require-backend.min.js b/public/assets/js/require-backend.min.js index 0a11419e..fcc9c794 100644 --- a/public/assets/js/require-backend.min.js +++ b/public/assets/js/require-backend.min.js @@ -10378,20 +10378,31 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef if ($(this).hasClass("disabled")) { return false; } - var input = $(this).prev("input"); - input = $(this).data("input-id") ? $("#" + $(this).data("input-id")) : input; - if (input.size() > 0) { - var yes = $(this).data("yes"); - var no = $(this).data("no"); - if (input.val() == yes) { - input.val(no); - $("i", this).addClass("fa-flip-horizontal text-gray"); - } else { - input.val(yes); - $("i", this).removeClass("fa-flip-horizontal text-gray"); + var switcher = $.proxy(function () { + var input = $(this).prev("input"); + input = $(this).data("input-id") ? $("#" + $(this).data("input-id")) : input; + if (input.size() > 0) { + var yes = $(this).data("yes"); + var no = $(this).data("no"); + if (input.val() == yes) { + input.val(no); + $("i", this).addClass("fa-flip-horizontal text-gray"); + } else { + input.val(yes); + $("i", this).removeClass("fa-flip-horizontal text-gray"); + } + input.trigger('change'); } - input.trigger('change'); + }, this); + if (typeof $(this).data("confirm") !== 'undefined') { + Layer.confirm($(this).data("confirm"), function (index) { + switcher(); + Layer.close(index); + }); + } else { + switcher(); } + return false; }); }, @@ -11951,7 +11962,17 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr }); table.on("click", "[data-id].btn-change", function (e) { e.preventDefault(); - Table.api.multi($(this).data("action") ? $(this).data("action") : '', [$(this).data("id")], table, this); + var switcher = $.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(); + Layer.close(index); + }); + } else { + switcher(); + } }); table.on("click", "[data-id].btn-edit", function (e) { e.preventDefault(); @@ -12131,12 +12152,16 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr var yes = typeof this.yes !== 'undefined' ? this.yes : 1; var no = typeof this.no !== 'undefined' ? this.no : 0; var url = typeof this.url !== 'undefined' ? this.url : ''; + var confirm = ''; var disable = false; + if (typeof this.confirm !== "undefined") { + confirm = typeof this.confirm === "function" ? this.confirm.call(this, value, row, index) : this.confirm; + } if (typeof this.disable !== "undefined") { disable = typeof this.disable === "function" ? this.disable.call(this, value, row, index) : this.disable; } return ""; + + row[pk] + "' " + (url ? "data-url='" + url + "'" : "") + (confirm ? "data-confirm='" + confirm + "'" : "") + " data-params='" + this.field + "=" + (value == yes ? no : yes) + "'>"; }, url: function (value, row, index) { value = value === null ? '' : value.toString(); diff --git a/public/assets/js/require-form.js b/public/assets/js/require-form.js index 0cbbda41..0f2bb287 100755 --- a/public/assets/js/require-form.js +++ b/public/assets/js/require-form.js @@ -382,20 +382,31 @@ define(['jquery', 'bootstrap', 'upload', 'validator'], function ($, undefined, U if ($(this).hasClass("disabled")) { return false; } - var input = $(this).prev("input"); - input = $(this).data("input-id") ? $("#" + $(this).data("input-id")) : input; - if (input.size() > 0) { - var yes = $(this).data("yes"); - var no = $(this).data("no"); - if (input.val() == yes) { - input.val(no); - $("i", this).addClass("fa-flip-horizontal text-gray"); - } else { - input.val(yes); - $("i", this).removeClass("fa-flip-horizontal text-gray"); + var switcher = $.proxy(function () { + var input = $(this).prev("input"); + input = $(this).data("input-id") ? $("#" + $(this).data("input-id")) : input; + if (input.size() > 0) { + var yes = $(this).data("yes"); + var no = $(this).data("no"); + if (input.val() == yes) { + input.val(no); + $("i", this).addClass("fa-flip-horizontal text-gray"); + } else { + input.val(yes); + $("i", this).removeClass("fa-flip-horizontal text-gray"); + } + input.trigger('change'); } - input.trigger('change'); + }, this); + if (typeof $(this).data("confirm") !== 'undefined') { + Layer.confirm($(this).data("confirm"), function (index) { + switcher(); + Layer.close(index); + }); + } else { + switcher(); } + return false; }); }, diff --git a/public/assets/js/require-table.js b/public/assets/js/require-table.js index 42e0bcbb..0903901f 100644 --- a/public/assets/js/require-table.js +++ b/public/assets/js/require-table.js @@ -435,7 +435,17 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table }); table.on("click", "[data-id].btn-change", function (e) { e.preventDefault(); - Table.api.multi($(this).data("action") ? $(this).data("action") : '', [$(this).data("id")], table, this); + var switcher = $.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(); + Layer.close(index); + }); + } else { + switcher(); + } }); table.on("click", "[data-id].btn-edit", function (e) { e.preventDefault(); @@ -615,12 +625,16 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table var yes = typeof this.yes !== 'undefined' ? this.yes : 1; var no = typeof this.no !== 'undefined' ? this.no : 0; var url = typeof this.url !== 'undefined' ? this.url : ''; + var confirm = ''; var disable = false; + if (typeof this.confirm !== "undefined") { + confirm = typeof this.confirm === "function" ? this.confirm.call(this, value, row, index) : this.confirm; + } if (typeof this.disable !== "undefined") { disable = typeof this.disable === "function" ? this.disable.call(this, value, row, index) : this.disable; } return ""; + + row[pk] + "' " + (url ? "data-url='" + url + "'" : "") + (confirm ? "data-confirm='" + confirm + "'" : "") + " data-params='" + this.field + "=" + (value == yes ? no : yes) + "'>"; }, url: function (value, row, index) { value = value === null ? '' : value.toString();