From 07c1d06340824e86be500f649146f6481eb04e75 Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Sat, 16 Feb 2019 13:44:39 +0800 Subject: [PATCH 01/28] =?UTF-8?q?=E5=BF=BD=E7=95=A5svn=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index fb8818a5a..3f2ebf8ce 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ composer.lock *.css.map !.gitkeep .env +.svn .vscode -- Gitee From d375f0c6fd1dd5929e0639c84dd597f5a63bb896 Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Sat, 16 Feb 2019 14:10:18 +0800 Subject: [PATCH 02/28] =?UTF-8?q?=E8=AF=AD=E8=A8=80=E5=8C=85=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/lang/zh-cn.php | 4 ++ .../admin/lang/zh-cn/general/attachment.php | 39 ++++++++++--------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/application/admin/lang/zh-cn.php b/application/admin/lang/zh-cn.php index 0c39e952c..a9affe71a 100755 --- a/application/admin/lang/zh-cn.php +++ b/application/admin/lang/zh-cn.php @@ -113,6 +113,7 @@ return [ '%d year%s ago' => '%d年前', 'Set to normal' => '设为正常', 'Set to hidden' => '设为隐藏', + 'Set to recommend' => '设为推荐', //提示 'Go back' => '返回首页', 'Jump now' => '立即跳转', @@ -172,4 +173,7 @@ return [ 'Admin log tips' => '管理员可以查看自己所拥有的权限的管理员日志', 'Group tips' => '角色组可以有多个,角色有上下级层级关系,如果子角色有角色组和管理员的权限则可以派生属于自己组别的下级角色组或管理员', 'Rule tips' => '规则通常对应一个控制器的方法,同时左侧的菜单栏数据也从规则中体现,通常建议通过命令行进行生成规则节点', + 'Test' => '测试', + 'Please input' => '请填写', + 'Please select' => '请选择', ]; diff --git a/application/admin/lang/zh-cn/general/attachment.php b/application/admin/lang/zh-cn/general/attachment.php index 96ea7af72..83f0fde2a 100644 --- a/application/admin/lang/zh-cn/general/attachment.php +++ b/application/admin/lang/zh-cn/general/attachment.php @@ -1,22 +1,25 @@ 'ID', - 'Admin_id' => '管理员ID', - 'User_id' => '会员ID', - 'Url' => '物理路径', - 'Imagewidth' => '宽度', - 'Imageheight' => '高度', - 'Imagetype' => '图片类型', - 'Imageframes' => '图片帧数', - 'Preview' => '预览', - 'Filesize' => '文件大小', - 'Mimetype' => 'Mime类型', - 'Extparam' => '透传数据', - 'Createtime' => '创建日期', - 'Uploadtime' => '上传时间', - 'Storage' => '存储引擎', - 'Upload to third' => '上传到第三方', - 'Upload to local' => '上传到本地', - 'Upload from editor' => '从编辑器上传' + 'Id' => 'ID', + 'Admin_id' => '管理员ID', + 'User_id' => '会员ID', + 'Url' => '物理路径', + 'Imagewidth' => '宽度', + 'Imageheight' => '高度', + 'Imagetype' => '图片类型', + 'Imageframes' => '图片帧数', + 'Preview' => '预览', + 'Filesize' => '文件大小', + 'Mimetype' => 'Mime类型', + 'Extparam' => '透传数据', + 'Createtime' => '创建日期', + 'Uploadtime' => '上传时间', + 'Storage' => '存储引擎', + 'Upload to third' => '上传到第三方', + 'Upload to local' => '上传到本地', + 'Upload from editor' => '从编辑器上传', + 'No file upload or server upload limit exceeded' => '未上传文件或超出服务器上传限制', + 'Uploaded file format is limited' => '上传文件格式受限制', + 'Upload successful' => '上传成功', ]; -- Gitee From 308d0082920677e240acda3c62c5eca9a43875b9 Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Sat, 16 Feb 2019 14:17:27 +0800 Subject: [PATCH 03/28] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E8=A7=84=E5=88=99IDS=E6=8E=92=E5=BA=8F?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/library/Menu.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/common/library/Menu.php b/application/common/library/Menu.php index 4c20818a4..e8206530d 100644 --- a/application/common/library/Menu.php +++ b/application/common/library/Menu.php @@ -134,7 +134,7 @@ class Menu if ($menu) { // 必须将结果集转换为数组 - $ruleList = collection(AuthRule::order('weigh', 'desc')->field('id,pid,name')->select())->toArray(); + $ruleList = collection(AuthRule::order('weigh', 'desc')->order('id', 'asc')->field('id,pid,name')->select())->toArray(); // 构造菜单数据 $ids = Tree::instance()->init($ruleList)->getChildrenIds($menu['id'], true); } -- Gitee From acfd4cf84e7b18e66ecd7b048591cbf088c01c18 Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Sat, 16 Feb 2019 14:36:34 +0800 Subject: [PATCH 04/28] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E9=94=AE?= =?UTF-8?q?=E7=94=9F=E6=88=90CRUD=E6=97=B6admin=5Fids=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=A4=9A=E9=80=89=E4=B8=8B=E6=8B=89=E6=A1=86bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/auth/Admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/admin/controller/auth/Admin.php b/application/admin/controller/auth/Admin.php index 40c6c8018..d4472025e 100644 --- a/application/admin/controller/auth/Admin.php +++ b/application/admin/controller/auth/Admin.php @@ -265,7 +265,7 @@ class Admin extends Backend /** * 下拉搜索 */ - protected function selectpage() + public function selectpage() { $this->dataLimit = 'auth'; $this->dataLimitField = 'id'; -- Gitee From 34fc4fbec3c13ff6dc681e693b8b09fe1d329ec8 Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Sat, 16 Feb 2019 14:38:43 +0800 Subject: [PATCH 05/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=20ajax/area=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=E4=B8=80=E9=94=AECRUD=E7=94=9F=E6=88=90=E7=9A=84row?= =?UTF-8?q?=E6=95=B0=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Ajax.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/application/admin/controller/Ajax.php b/application/admin/controller/Ajax.php index 649cc41de..50c9a7fb4 100644 --- a/application/admin/controller/Ajax.php +++ b/application/admin/controller/Ajax.php @@ -245,8 +245,14 @@ class Ajax extends Backend */ public function area() { - $province = $this->request->get('province'); - $city = $this->request->get('city'); + $params = $this->request->get("row/a"); + if (!empty($params)) { + $province = isset($params['province']) ? $params['province'] : ''; + $city = isset($params['city']) ? $params['city'] : null; + } else { + $province = $this->request->get('province'); + $city = $this->request->get('city'); + } $where = ['pid' => 0, 'level' => 1]; $provincelist = null; if ($province !== '') { -- Gitee From 3c10bb7c5f1577acabafcf7ded52f4c2041b41aa Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Sat, 16 Feb 2019 14:40:14 +0800 Subject: [PATCH 06/28] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E8=AE=B0=E5=BD=95extparam=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Ajax.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/application/admin/controller/Ajax.php b/application/admin/controller/Ajax.php index 50c9a7fb4..828e228d2 100644 --- a/application/admin/controller/Ajax.php +++ b/application/admin/controller/Ajax.php @@ -54,6 +54,7 @@ class Ajax extends Backend //判断是否已经存在附件 $sha1 = $file->hash(); + $extparam = $this->request->post(); $upload = Config::get('upload'); @@ -118,6 +119,7 @@ class Ajax extends Backend 'uploadtime' => time(), 'storage' => 'local', 'sha1' => $sha1, + 'extparam' => json_encode($extparam), ); $attachment = model("attachment"); $attachment->data(array_filter($params)); -- Gitee From 3725effc52af12f57e7de4d065ea4614c44047bd Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Sat, 16 Feb 2019 14:41:53 +0800 Subject: [PATCH 07/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=A7=84=E5=88=99ruleL?= =?UTF-8?q?ist=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/auth/Rule.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/application/admin/controller/auth/Rule.php b/application/admin/controller/auth/Rule.php index 897f66ba9..b221a90cf 100644 --- a/application/admin/controller/auth/Rule.php +++ b/application/admin/controller/auth/Rule.php @@ -27,7 +27,7 @@ class Rule extends Backend parent::_initialize(); $this->model = model('AuthRule'); // 必须将结果集转换为数组 - $ruleList = collection($this->model->order('weigh', 'desc')->select())->toArray(); + $ruleList = collection($this->model->order('weigh', 'desc')->order('id', 'asc')->select())->toArray(); foreach ($ruleList as $k => &$v) { $v['title'] = __($v['title']); @@ -43,6 +43,7 @@ class Rule extends Backend continue; $ruledata[$v['id']] = $v['title']; } + unset($v); $this->view->assign('ruledata', $ruledata); } -- Gitee From 7534d27bad332be42b4455558b0564a4cf25f1ff Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Sat, 16 Feb 2019 14:42:51 +0800 Subject: [PATCH 08/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E6=9D=83=E9=99=90=E6=A0=91=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/auth/Group.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/admin/controller/auth/Group.php b/application/admin/controller/auth/Group.php index 1f573b81e..f1d12bf4f 100644 --- a/application/admin/controller/auth/Group.php +++ b/application/admin/controller/auth/Group.php @@ -254,7 +254,7 @@ class Group extends Backend if (($pid || $parentGroupModel) && (!$id || $currentGroupModel)) { $id = $id ? $id : NULL; - $ruleList = collection(model('AuthRule')->order('weigh', 'desc')->select())->toArray(); + $ruleList = collection(model('AuthRule')->order('weigh', 'desc')->order('id', 'asc')->select())->toArray(); //读取父类角色所有节点列表 $parentRuleList = []; if (in_array('*', explode(',', $parentGroupModel->rules))) -- Gitee From 2b4c59b62922833b8d6cd54d972e3ade2a495344 Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Sat, 16 Feb 2019 14:48:16 +0800 Subject: [PATCH 09/28] =?UTF-8?q?selectpage=E6=94=AF=E6=8C=81=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E6=A0=91=E5=BD=A2=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/controller/Backend.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/application/common/controller/Backend.php b/application/common/controller/Backend.php index b8c05b5a9..421d80645 100644 --- a/application/common/controller/Backend.php +++ b/application/common/controller/Backend.php @@ -8,6 +8,7 @@ use think\Controller; use think\Hook; use think\Lang; use think\Session; +use fast\Tree; /** * 后台控制器基类 @@ -425,6 +426,13 @@ class Backend extends Controller $searchfield = (array)$this->request->request("searchField/a"); //自定义搜索条件 $custom = (array)$this->request->request("custom/a"); + //是否返回树形结构 + $istree = $this->request->request("isTree", 0); + $ishtml = $this->request->request("isHtml", 0); + if($istree) { + $word = []; + $pagesize = 99999; + } $order = []; foreach ($orderby as $k => $v) { $order[$v[0]] = $v[1]; @@ -467,9 +475,21 @@ class Backend extends Controller unset($item['password'], $item['salt']); $list[] = [ $primarykey => isset($item[$primarykey]) ? $item[$primarykey] : '', - $field => isset($item[$field]) ? $item[$field] : '' + $field => isset($item[$field]) ? $item[$field] : '', + 'pid' => isset($item['pid']) ? $item['pid'] : 0 ]; } + if($istree) { + $tree = Tree::instance(); + $tree->init(collection($list)->toArray(), 'pid'); + $list = $tree->getTreeList($tree->getTreeArray(0), $field); + if(!$ishtml){ + foreach ($list as &$item) { + $item = str_replace(' ', ' ', $item); + } + unset($item); + } + } } //这里一定要返回有list这个字段,total是可选的,如果total<=list的数量,则会隐藏分页按钮 return json(['list' => $list, 'total' => $total]); -- Gitee From ead1f12aab01f15d7666c75d28139a90c900a7a7 Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Sat, 16 Feb 2019 14:51:16 +0800 Subject: [PATCH 10/28] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E6=9C=AA=E7=99=BB=E5=BD=95=E6=97=B6=E4=B8=8D=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9B=B4=E6=8E=A5=E8=B7=B3=E8=BD=AC=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/controller/Backend.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/application/common/controller/Backend.php b/application/common/controller/Backend.php index 421d80645..ab99b3ec2 100644 --- a/application/common/controller/Backend.php +++ b/application/common/controller/Backend.php @@ -139,6 +139,10 @@ class Backend extends Controller Hook::listen('admin_nologin', $this); $url = Session::get('referer'); $url = $url ? $url : $this->request->url(); + if ($url == '/') { + $this->redirect('index/login', [], 302, ['referer' => $url]); + exit; + } $this->error(__('Please login first'), url('index/login', ['url' => $url])); } // 判断是否需要验证权限 -- Gitee From 5182cf28c9319a0e6e3f4d98cd01ebd4a416f713 Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Sat, 16 Feb 2019 17:35:24 +0800 Subject: [PATCH 11/28] =?UTF-8?q?=E6=94=B9=E8=BF=9Bbuild=5Ftoolbar?= =?UTF-8?q?=E7=9A=84import=E6=94=AF=E6=8C=81=E6=A8=A1=E7=89=88=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/common.php | 37 +++++++++++++++++++++++++++++++++--- public/template/.gitkeep | 1 + 2 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 public/template/.gitkeep diff --git a/application/admin/common.php b/application/admin/common.php index 2b61dde68..c3232f8e5 100755 --- a/application/admin/common.php +++ b/application/admin/common.php @@ -113,7 +113,7 @@ if (!function_exists('build_toolbar')) { 'add' => ['javascript:;', 'btn btn-success btn-add', 'fa fa-plus', __('Add'), __('Add')], 'edit' => ['javascript:;', 'btn btn-success btn-edit btn-disabled disabled', 'fa fa-pencil', __('Edit'), __('Edit')], 'del' => ['javascript:;', 'btn btn-danger btn-del btn-disabled disabled', 'fa fa-trash', __('Delete'), __('Delete')], - 'import' => ['javascript:;', 'btn btn-danger btn-import', 'fa fa-upload', __('Import'), __('Import')], + 'import' => ['javascript:;', 'btn btn-info btn-import', 'fa fa-upload', __('Import'), __('Import')], ]; $btnAttr = array_merge($btnAttr, $attr); $html = []; @@ -123,8 +123,39 @@ if (!function_exists('build_toolbar')) { continue; } list($href, $class, $icon, $text, $title) = $btnAttr[$v]; - $extend = $v == 'import' ? 'id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"' : ''; - $html[] = ' ' . $text . ''; + //$extend = $v == 'import' ? 'id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"' : ''; + //$html[] = ' ' . $text . ''; + if ($v == 'import') { + $template = str_replace('/', '_', $controller); + $download = ''; + if (file_exists("./template/{$template}.xlsx")) { + $download .= "\n
  • XLSX模版
  • "; + } + if (file_exists("./template/{$template}.xls")) { + $download .= "\n
  • XLS模版
  • "; + } + if (file_exists("./template/{$template}.csv")) { + $download .= empty($download) ? '' : "\n
  • "; + $download .= "\n
  • CSV模版
  • "; + } + $download .= empty($download) ? '' : "\n "; + if (!empty($download)) { + $html[] = << + + + + +EOT; + } else { + $html[] = ' ' . $text . ''; + } + } else { + $html[] = ' ' . $text . ''; + } } return implode(' ', $html); } diff --git a/public/template/.gitkeep b/public/template/.gitkeep new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/public/template/.gitkeep @@ -0,0 +1 @@ + -- Gitee From 779f5d63efb87b114072b617ed8598034c199eed Mon Sep 17 00:00:00 2001 From: PPPSCN <35696959@qq.com> Date: Sat, 16 Feb 2019 17:49:54 +0800 Subject: [PATCH 12/28] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E6=99=AE=E9=80=9A?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=8F=92=E4=BB=B6=E2=80=94=E2=80=94=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E4=BC=A0=E5=85=A5css=E6=A0=B7=E5=BC=8F=E3=80=81?= =?UTF-8?q?=E5=BB=B6=E6=97=B6=E9=9A=90=E8=97=8F=E9=81=BF=E5=85=8D=E5=AE=BD?= =?UTF-8?q?=E5=BA=A6=E4=B8=8D=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/css/backend.css | 11 ++++++-- .../assets/js/bootstrap-table-commonsearch.js | 27 ++++++++++++------- public/assets/js/require-table.js | 7 +++++ 3 files changed, 34 insertions(+), 11 deletions(-) diff --git a/public/assets/css/backend.css b/public/assets/css/backend.css index 5c9a6903a..924a01a0f 100644 --- a/public/assets/css/backend.css +++ b/public/assets/css/backend.css @@ -113,9 +113,16 @@ html.ios-fix body { table.table-template { overflow: hidden; } -.sp_container .msg-box { +.pp_container { + border: none; + margin: 0; + padding: 0; + position: relative; + vertical-align: middle; +} +.sp_container .msg-box,.pp_container .msg-box { position: absolute; - right: 0; + left: 0; top: 0; } .toast-top-right-index { diff --git a/public/assets/js/bootstrap-table-commonsearch.js b/public/assets/js/bootstrap-table-commonsearch.js index c99acb040..700ead018 100644 --- a/public/assets/js/bootstrap-table-commonsearch.js +++ b/public/assets/js/bootstrap-table-commonsearch.js @@ -6,6 +6,9 @@ * * @author: Karson * @update 2018-04-05 + * + * @author: pppscn <35696959@qq.com> + * @update 2019-02-16 */ !function ($) { @@ -18,12 +21,17 @@ var initCommonSearch = function (pColumns, that) { var vFormCommon = createFormCommon(pColumns, that); - var vModal = sprintf("
    ", that.options.searchFormVisible ? "" : "hidden"); + var vModal = "
    "; vModal += vFormCommon; vModal += "
    "; that.$container.prepend($(vModal)); that.$commonsearch = $(".commonsearch-table", that.$container); var form = $("form.form-commonsearch", that.$commonsearch); + if(!that.options.searchFormVisible){ + setTimeout(function () { + that.$commonsearch.addClass('hidden'); + },100); + } require(['form'], function (Form) { Form.api.bindevent(form); @@ -51,7 +59,7 @@ return Template(that.options.searchFormTemplate, {columns: pColumns, table: that}); } var htmlForm = []; - htmlForm.push(sprintf('
    ', that.options.actionForm)); + htmlForm.push(sprintf('', that.options.searchFormCss.form, that.options.actionForm)); htmlForm.push('
    '); if (that.options.titleForm.length > 0) htmlForm.push(sprintf("%s", that.options.titleForm)); @@ -66,9 +74,9 @@ vObjCol.operate = that.options.renderDefault && operate ? operate : (typeof vObjCol.operate === 'undefined' ? '=' : vObjCol.operate); ColumnsForSearch.push(vObjCol); - htmlForm.push('
    '); - htmlForm.push(sprintf('', vObjCol.field, vObjCol.title)); - htmlForm.push('
    '); + htmlForm.push(sprintf('
    ', that.options.searchFormCss.form_group)); + htmlForm.push(sprintf('', vObjCol.field, that.options.searchFormCss.label, vObjCol.title)); + htmlForm.push(sprintf('
    ', that.options.searchFormCss.container)); vObjCol.operate = vObjCol.operate ? vObjCol.operate.toUpperCase() : '='; htmlForm.push(sprintf('', vObjCol.field, vObjCol.field, vObjCol.operate)); @@ -120,7 +128,8 @@ htmlForm.push('
    '); } } - htmlForm.push('
    '); + htmlForm.push(sprintf('
    ', that.options.searchFormCss.form_group)); + htmlForm.push(sprintf('', that.options.searchFormCss.label_btn)); htmlForm.push(createFormBtn(that).join('')); htmlForm.push('
    '); htmlForm.push('
    '); @@ -134,7 +143,7 @@ var htmlBtn = []; var searchSubmit = that.options.formatCommonSubmitButton(); var searchReset = that.options.formatCommonResetButton(); - htmlBtn.push('
    '); + htmlBtn.push(sprintf('
    ', that.options.searchFormCss.container)); htmlBtn.push(sprintf(' ', searchSubmit)); htmlBtn.push(sprintf(' ', searchReset)); htmlBtn.push('
    '); @@ -380,8 +389,8 @@ [value, item, i], value); if (!($.inArray(key, that.header.fields) !== -1 && - (typeof value === 'string' || typeof value === 'number') && - (value + '').toLowerCase().indexOf(fval) !== -1)) { + (typeof value === 'string' || typeof value === 'number') && + (value + '').toLowerCase().indexOf(fval) !== -1)) { return false; } } diff --git a/public/assets/js/require-table.js b/public/assets/js/require-table.js index c4630558c..d865c3bf7 100644 --- a/public/assets/js/require-table.js +++ b/public/assets/js/require-table.js @@ -44,6 +44,13 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table import_url: '', multi_url: '', dragsort_url: 'ajax/weigh', + }, + searchFormCss: { + form: 'form-commonsearch', + form_group: 'form-group col-xs-12 col-sm-6 col-md-4 col-lg-3', + label: 'control-label', + label_btn: 'control-label hidden-xs', + container: 'pp_container', } }, // Bootstrap-table 列配置 -- Gitee From aac15b15653698f01902836e0560418606f85c58 Mon Sep 17 00:00:00 2001 From: PPPSCN <35696959@qq.com> Date: Sat, 16 Feb 2019 18:00:50 +0800 Subject: [PATCH 13/28] =?UTF-8?q?=E9=87=87=E7=94=A8slimScroll=E7=BE=8E?= =?UTF-8?q?=E5=8C=96=E6=BB=9A=E5=8A=A8=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/js/fast.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/public/assets/js/fast.js b/public/assets/js/fast.js index aad06de28..8469695af 100644 --- a/public/assets/js/fast.js +++ b/public/assets/js/fast.js @@ -1,4 +1,4 @@ -define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefined, Toastr, Layer, Lang) { +define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang', 'slimscroll'], function ($, undefined, Toastr, Layer, Lang, slimScroll) { var Fast = { config: { //toastr默认配置 @@ -6,7 +6,7 @@ define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefine "closeButton": true, "debug": false, "newestOnTop": false, - "progressBar": false, + "progressBar": true, "positionClass": "toast-top-center", "preventDuplicates": false, "onclick": null, @@ -114,7 +114,7 @@ define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefine }, //打开一个弹出窗口 open: function (url, title, options) { - title = title ? title : ""; + title = options.title ? options.title : (title ? title : ""); url = Fast.api.fixurl(url); url = url + (url.indexOf("?") > -1 ? "&" : "?") + "dialog=1"; var area = [$(window).width() > 800 ? '800px' : '95%', $(window).height() > 600 ? '600px' : '95%']; @@ -315,6 +315,17 @@ define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefine }); //公共代码 + $(function ($) { + if (self === top) { + $('div[role="main"]').slimScroll({height: $(window).height() + 'px'}); + } else { + var ScrollHeight = $('iframe', parent.document).height(); + if (!ScrollHeight || ScrollHeight === 100) { + ScrollHeight = $('.content-wrapper', parent.document).height(); + } + $('div[role="main"]').slimScroll({height: ScrollHeight + 'px'}); + } + }); //配置Toastr的参数 Toastr.options = Fast.config.toastr; } -- Gitee From 96192945a9dd05f9eb0d14e288f497f8f7ffce00 Mon Sep 17 00:00:00 2001 From: PPPSCN <35696959@qq.com> Date: Sat, 16 Feb 2019 18:05:18 +0800 Subject: [PATCH 14/28] =?UTF-8?q?=E9=87=87=E7=94=A8slimScroll=E7=BE=8E?= =?UTF-8?q?=E5=8C=96=E6=BB=9A=E5=8A=A8=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/css/backend.css | 14 ++++++++++++++ public/assets/js/require-table.js | 8 ++++++++ 2 files changed, 22 insertions(+) diff --git a/public/assets/css/backend.css b/public/assets/css/backend.css index 924a01a0f..f967a6a8b 100644 --- a/public/assets/css/backend.css +++ b/public/assets/css/backend.css @@ -995,6 +995,20 @@ table.table-nowrap thead > tr > th { .wipecache li a { color: #444444 !important; } +div.pre { + display: block; + padding: 5px; + margin: 0 0 5px; + font-size: 11px; + line-height: 1.42857143; + word-break: break-all; + word-wrap: break-word; + color: #333333; + background-color: #f5f5f5; + border: 1px solid #ccc; + border-radius: 3px; + text-align: left; +} /*修正开关关闭下的颜色值*/ .btn-switcher.disabled { opacity: .6; diff --git a/public/assets/js/require-table.js b/public/assets/js/require-table.js index d865c3bf7..197fcf65d 100644 --- a/public/assets/js/require-table.js +++ b/public/assets/js/require-table.js @@ -130,6 +130,9 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table } //当内容渲染完成后 table.on('post-body.bs.table', function (e, settings, json, xhr) { + var ScrollHeight = self == top ? $(window).height() : $('.content-wrapper', parent.document).height(); + table.closest('#main').height(ScrollHeight); + table.closest('.slimScrollDiv').height(ScrollHeight); $(Table.config.refreshbtn, toolbar).find(".fa").removeClass("fa-spin"); $(Table.config.disabledbtn, toolbar).toggleClass('disabled', true); if ($(Table.config.firsttd, table).find("input[type='checkbox'][data-index]").size() > 0) { @@ -159,6 +162,11 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table }); }); } + if (table.find("div.pre").size() > 0) { + require(['slimscroll'], function () { + $('div.pre').slimScroll({width: '300px', height: '50px'}); + }); + } }); // 处理选中筛选框后按钮的状态统一变更 table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table', function () { -- Gitee From 63bab7ee88172085b24872ddbd1381b4e8a04dbe Mon Sep 17 00:00:00 2001 From: PPPSCN <35696959@qq.com> Date: Sat, 16 Feb 2019 18:14:25 +0800 Subject: [PATCH 15/28] =?UTF-8?q?CRUD=E7=94=9F=E6=88=90=E7=B4=A7=E5=87=91?= =?UTF-8?q?=E5=9E=8B=E8=A1=A8=E5=8D=95=E3=80=81=E4=BC=98=E5=8C=96validator?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/command/Crud.php | 12 +- application/admin/command/Crud/stubs/add.stub | 6 +- .../admin/command/Crud/stubs/controller.stub | 14 +- .../admin/command/Crud/stubs/edit.stub | 6 +- .../admin/command/Crud/stubs/html/radio.stub | 3 +- .../admin/command/Crud/stubs/html/select.stub | 3 +- .../admin/command/Crud/stubs/javascript.stub | 1 + .../command/Crud/stubs/mixins/radio.stub | 2 +- .../command/Crud/stubs/mixins/select.stub | 2 +- .../admin/command/Crud/stubs/model.stub | 8 +- public/assets/css/backend.css | 39 +++ public/assets/js/require-form.js | 239 +++++++++++++++++- 12 files changed, 310 insertions(+), 25 deletions(-) diff --git a/application/admin/command/Crud.php b/application/admin/command/Crud.php index f207386b5..905d9a9c5 100755 --- a/application/admin/command/Crud.php +++ b/application/admin/command/Crud.php @@ -483,6 +483,7 @@ class Crud extends Command //循环所有字段,开始构造视图的HTML和JS信息 foreach ($columnList as $k => $v) { $field = $v['COLUMN_NAME']; + $langField = mb_ucfirst($field); $itemArr = []; // 这里构建Enum和Set类型的列表数据 if (in_array($v['DATA_TYPE'], ['enum', 'set', 'tinyint'])) { @@ -540,6 +541,7 @@ class Crud extends Command $formEditElement = $this->getReplacedStub('html/select', ['field' => $field, 'fieldName' => $fieldName, 'fieldList' => $this->getFieldListName($field), 'attrStr' => Form::attributes($attrArr), 'selectedValue' => "\$row.{$field}"]); } else if ($inputType == 'datetime') { $cssClassArr[] = 'datetimepicker'; + $attrArr['placeholder'] = "{:__('Please select')}{:__('{$langField}')}"; $attrArr['class'] = implode(' ', $cssClassArr); $format = "YYYY-MM-DD HH:mm:ss"; $phpFormat = "Y-m-d H:i:s"; @@ -595,6 +597,7 @@ class Crud extends Command $formEditElement = $this->getReplacedStub('html/' . $inputType, ['field' => $field, 'fieldName' => $fieldName, 'fieldList' => $this->getFieldListName($field), 'attrStr' => Form::attributes($attrArr), 'selectedValue' => "\$row.{$field}"]); } else if ($inputType == 'textarea') { $cssClassArr[] = $this->isMatchSuffix($field, $this->editorSuffix) ? $this->editorClass : ''; + $attrArr['placeholder'] = "{:__('Please input')}{:__('{$langField}')}"; $attrArr['class'] = implode(' ', $cssClassArr); $attrArr['rows'] = 5; $formAddElement = Form::textarea($fieldName, $defaultValue, $attrArr); @@ -615,17 +618,20 @@ class Crud extends Command $formAddElement = $this->getReplacedStub('html/' . $inputType, ['field' => $field, 'fieldName' => $fieldName, 'fieldYes' => $yes, 'fieldNo' => $no, 'attrStr' => Form::attributes($attrArr), 'fieldValue' => $defaultValue, 'fieldSwitchClass' => $defaultValue == $no ? $stateNoClass : '']); $formEditElement = $this->getReplacedStub('html/' . $inputType, ['field' => $field, 'fieldName' => $fieldName, 'fieldYes' => $yes, 'fieldNo' => $no, 'attrStr' => Form::attributes($attrArr), 'fieldValue' => "{\$row.{$field}}", 'fieldSwitchClass' => "{eq name=\"\$row.{$field}\" value=\"{$no}\"}fa-flip-horizontal text-gray{/eq}"]); } else if ($inputType == 'citypicker') { + $attrArr['placeholder'] = "{:__('Please select')}{:__('{$langField}')}"; $attrArr['class'] = implode(' ', $cssClassArr); $attrArr['data-toggle'] = "city-picker"; $formAddElement = sprintf("
    %s
    ", Form::input('text', $fieldName, $defaultValue, $attrArr)); $formEditElement = sprintf("
    %s
    ", Form::input('text', $fieldName, $editValue, $attrArr)); } else { + $attrArr['placeholder'] = "{:__('Please input')}{:__('{$langField}')}"; $search = $replace = ''; //特殊字段为关联搜索 if ($this->isMatchSuffix($field, $this->selectpageSuffix)) { $inputType = 'text'; $defaultValue = ''; $attrArr['data-rule'] = 'required'; + $attrArr['placeholder'] = "{:__('Please select')}{:__('{$langField}')}"; $cssClassArr[] = 'selectpage'; $selectpageController = str_replace('_', '/', substr($field, 0, strripos($field, '_'))); $attrArr['data-source'] = $selectpageController . "/index"; @@ -1243,8 +1249,8 @@ EOD; $langField = mb_ucfirst($field); return << - -
    + +
    {$content}
    @@ -1270,11 +1276,11 @@ EOD; return << {$content} +
    -
    {$previewcontainer} EOD; diff --git a/application/admin/command/Crud/stubs/add.stub b/application/admin/command/Crud/stubs/add.stub index 68d6de241..d4bd212c2 100644 --- a/application/admin/command/Crud/stubs/add.stub +++ b/application/admin/command/Crud/stubs/add.stub @@ -1,9 +1,7 @@ - - + {%addList%}