From 997581ca056e2173ba738a6e065cc20aa29a5d05 Mon Sep 17 00:00:00 2001 From: CoolAbc <13836962@qq.com> Date: Sun, 31 Mar 2019 09:47:14 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E6=89=80=E6=9C=89=E5=AD=97=E6=AE=B5=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E7=9A=84=E5=8F=82=E6=95=B0,=E5=9B=A0=E4=B8=BA?= =?UTF-8?q?=E6=9C=89=E6=97=B6=E5=80=99=E4=BC=9A=E9=9C=80=E8=A6=81=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E4=BA=86=E6=9F=90=E4=B8=AA=E5=AD=97=E6=AE=B5=E5=86=85?= =?UTF-8?q?=E5=AE=B9,=E5=BE=97=E5=88=B0=E5=85=B6=E4=BB=96=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E5=AD=97=E6=AE=B5=E5=86=85=E5=AE=B9,=E7=84=B6?= =?UTF-8?q?=E5=90=8E=E5=86=8D=E8=B5=8B=E7=BB=99=E5=85=B6=E4=BB=96=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6,=E6=88=96=E5=81=9A=E5=85=B6=E4=BB=96=E6=93=8D?= =?UTF-8?q?=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/controller/Backend.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/application/common/controller/Backend.php b/application/common/controller/Backend.php index 59b37c06e..55a452230 100644 --- a/application/common/controller/Backend.php +++ b/application/common/controller/Backend.php @@ -431,6 +431,11 @@ class Backend extends Controller $searchfield = (array)$this->request->request("searchField/a"); //自定义搜索条件 $custom = (array)$this->request->request("custom/a"); + // 返回哪些字段的内容 + // 0 id name 字段 + // 1 全部字段 + $returnAllField = $this->request->request("returnAllField/d"); + //是否返回树形结构 $istree = $this->request->request("isTree", 0); $ishtml = $this->request->request("isHtml", 0); @@ -482,11 +487,13 @@ class Backend extends Controller ->select(); foreach ($datalist as $index => $item) { unset($item['password'], $item['salt']); - $list[] = [ - $primarykey => isset($item[$primarykey]) ? $item[$primarykey] : '', - $field => isset($item[$field]) ? $item[$field] : '', - 'pid' => isset($item['pid']) ? $item['pid'] : 0 - ]; + if($returnAllField == 0) { + $list[] = [ + $primarykey => isset($item[$primarykey]) ? $item[$primarykey] : '', + $field => isset($item[$field]) ? $item[$field] : '', + 'pid' => isset($item['pid']) ? $item['pid'] : 0 + ]; + } } if($istree) { $tree = Tree::instance(); @@ -501,7 +508,7 @@ class Backend extends Controller } } //这里一定要返回有list这个字段,total是可选的,如果total<=list的数量,则会隐藏分页按钮 - return json(['list' => $list, 'total' => $total]); + return json(['list' => $returnAllField==0?$list:$datalist, 'total' => $total]); } } -- Gitee From 004b990308bbdbdd23aa22950ad1d6b2ce11ff50 Mon Sep 17 00:00:00 2001 From: CoolAbc <13836962@qq.com> Date: Mon, 8 Apr 2019 13:52:51 +0800 Subject: [PATCH 2/2] =?UTF-8?q?1=20=E8=A1=A8=E5=8D=95=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=B9=8B=E5=89=8D,=E5=8E=BB=E6=8E=89input=E7=9A=84disabled?= =?UTF-8?q?=E5=B1=9E=E6=80=A7.=E5=90=A6=E5=88=99=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E5=80=BC=E4=B8=8D=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/js/require-form.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/public/assets/js/require-form.js b/public/assets/js/require-form.js index 27433d8d8..841a9858b 100755 --- a/public/assets/js/require-form.js +++ b/public/assets/js/require-form.js @@ -386,6 +386,12 @@ define(['jquery', 'bootstrap', 'upload', 'validator'], function ($, undefined, U }, api: { submit: function (form, success, error, submit) { + // input 为 disabled 属性的控件去掉只读,否则控件值提交不上去 + var disabled_obj = $('input:disabled'); + $.each(disabled_obj, function(i, j) { + $(this).removeAttr('disabled'); + }); + if (form.size() === 0) { Toastr.error("表单未初始化完成,无法提交"); return false; -- Gitee