From 42c682ebad134354460b151fee73c73ecd723e28 Mon Sep 17 00:00:00 2001 From: "759675757@qq.com" Date: Wed, 25 Dec 2019 17:21:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/admin/SysUserController.java | 58 +++++----- .../src/main/resources/static/css/public.css | 53 ++++----- .../layui-config.js => layuimodule/config.js} | 2 +- .../echarts/echarts.js | 0 .../echarts/echartsTheme.js | 0 .../iconPicker/iconPickerFa.js | 0 .../layuimini/layuimini.js | 0 .../splayer/splayer.js} | 6 +- .../step-lay/step.css | 0 .../step-lay/step.js | 0 .../tableSelect/tableSelect.js | 0 .../treetable-lay/treetable.css | 0 .../treetable-lay/treetable.js | 0 .../wangEditor/fonts/w-e-icon.woff | Bin .../wangEditor/wangEditor.css | 0 .../wangEditor/wangEditor.js | 0 .../wangEditor/wangEditor.min.css | 0 .../wangEditor/wangEditor.min.js | 0 .../wangEditor/wangEditor.min.js.map | 0 .../src/main/resources/static/js/spUtil.js | 101 +++++++++++++++++- .../resources/templates/common/common.ftl | 3 +- .../templates/system/dict/addOrUpd.ftl | 20 ++-- .../templates/system/menu/addOrUpd.ftl | 22 ++-- .../templates/system/role/addOrUpd.ftl | 12 +-- .../templates/system/user/addOrUpd.ftl | 78 ++++++-------- .../resources/templates/system/user/list.ftl | 55 ++++++---- 26 files changed, 252 insertions(+), 158 deletions(-) rename sparchetype/src/main/resources/static/js/{layui-module/layui-config.js => layuimodule/config.js} (96%) rename sparchetype/src/main/resources/static/js/{layui-module => layuimodule}/echarts/echarts.js (100%) rename sparchetype/src/main/resources/static/js/{layui-module => layuimodule}/echarts/echartsTheme.js (100%) rename sparchetype/src/main/resources/static/js/{layui-module => layuimodule}/iconPicker/iconPickerFa.js (100%) rename sparchetype/src/main/resources/static/js/{layui-module => layuimodule}/layuimini/layuimini.js (100%) rename sparchetype/src/main/resources/static/js/{layui-module/spLayer/spLayer.js => layuimodule/splayer/splayer.js} (77%) rename sparchetype/src/main/resources/static/js/{layui-module => layuimodule}/step-lay/step.css (100%) rename sparchetype/src/main/resources/static/js/{layui-module => layuimodule}/step-lay/step.js (100%) rename sparchetype/src/main/resources/static/js/{layui-module => layuimodule}/tableSelect/tableSelect.js (100%) rename sparchetype/src/main/resources/static/js/{layui-module => layuimodule}/treetable-lay/treetable.css (100%) rename sparchetype/src/main/resources/static/js/{layui-module => layuimodule}/treetable-lay/treetable.js (100%) rename sparchetype/src/main/resources/static/js/{layui-module => layuimodule}/wangEditor/fonts/w-e-icon.woff (100%) rename sparchetype/src/main/resources/static/js/{layui-module => layuimodule}/wangEditor/wangEditor.css (100%) rename sparchetype/src/main/resources/static/js/{layui-module => layuimodule}/wangEditor/wangEditor.js (100%) rename sparchetype/src/main/resources/static/js/{layui-module => layuimodule}/wangEditor/wangEditor.min.css (100%) rename sparchetype/src/main/resources/static/js/{layui-module => layuimodule}/wangEditor/wangEditor.min.js (100%) rename sparchetype/src/main/resources/static/js/{layui-module => layuimodule}/wangEditor/wangEditor.min.js.map (100%) diff --git a/sparchetype/src/main/java/com/songpeng/sparchetype/system/controller/admin/SysUserController.java b/sparchetype/src/main/java/com/songpeng/sparchetype/system/controller/admin/SysUserController.java index 27bafe4..9de5f5b 100644 --- a/sparchetype/src/main/java/com/songpeng/sparchetype/system/controller/admin/SysUserController.java +++ b/sparchetype/src/main/java/com/songpeng/sparchetype/system/controller/admin/SysUserController.java @@ -33,37 +33,37 @@ import org.springframework.web.bind.annotation.ResponseBody; @Slf4j public class SysUserController extends BaseController { - @Autowired - private ISysUserService sysUserService; + @Autowired + private ISysUserService sysUserService; - @GetMapping("/list-ui") - public String listUI(Model model) { - return "system/user/list"; - } + @GetMapping("/list-ui") + public String listUI(Model model) { + return "system/user/list"; + } - @PostMapping("/page") - @ResponseBody - public Result page(Page page, SysUserPageReq req) { - Object principal = SecurityUtils.getSubject().getPrincipal(); - QueryWrapper qw = new QueryWrapper(); - qw.orderByDesc(req.getOrderBy()); - IPage result = sysUserService.page(page, qw); - return Result.success(result); - } + @PostMapping("/page") + @ResponseBody + public Result page(Page page, SysUserPageReq req) { + Object principal = SecurityUtils.getSubject().getPrincipal(); + QueryWrapper qw = new QueryWrapper(); + qw.orderByDesc(req.getOrderBy()); + IPage result = sysUserService.page(page, qw); + return Result.success(result); + } - @GetMapping("/add-or-upd-ui") - public String addOrUpdUI(Model model, SysUser record) { - if (StringUtils.isNotEmpty(record.getId())) { - SysUser result = sysUserService.getById(record.getId()); - model.addAttribute("result", result); - } - return "system/user/addOrUpd"; - } + @GetMapping("/add-or-upd-ui") + public String addOrUpdUI(SysUser record, Model model) { + if (StringUtils.isNotEmpty(record.getId())) { + SysUser result = sysUserService.getById(record.getId()); + model.addAttribute("result", result); + } + return "system/user/addOrUpd"; + } - @PostMapping("/add-or-upd") - @ResponseBody - public Result addOrUpd(SysUser record) { - sysUserService.saveOrUpdate(record); - return Result.success(record.getId()); - } + @PostMapping("/add-or-upd") + @ResponseBody + public Result addOrUpd(SysUser record) { + sysUserService.saveOrUpdate(record); + return Result.success(record.getId()); + } } diff --git a/sparchetype/src/main/resources/static/css/public.css b/sparchetype/src/main/resources/static/css/public.css index 5e2935a..c845827 100644 --- a/sparchetype/src/main/resources/static/css/public.css +++ b/sparchetype/src/main/resources/static/css/public.css @@ -1,37 +1,42 @@ body { - margin: 0 0 0 0; - background: #f2f2f2; + margin: 0 0 0 0; + background: #f2f2f2; } + .layuimini-container { - border: 1px solid #f2f2f2; - border-radius: 5px; - background-color: #ffffff; + border: 1px solid #f2f2f2; + border-radius: 5px; + background-color: #ffffff; } + .layuimini-main { - margin: 10px 10px 10px 10px; + margin: 10px 10px 10px 10px; } /**必填红点 */ -.layuimini-form > .layui-form-item > .required:after { - content: "*"; - color: red; - position: absolute; - margin-left: 4px; - font-weight: bold; - line-height: 1.8em; - top: 6px; - right: 5px; +.layuimini-form .layui-form-item > .sp-required:after { + content: "*"; + color: red; + position: absolute; + margin-left: 4px; + font-weight: bold; + line-height: 1.8em; + top: 6px; + right: 5px; } -.layuimini-form > .layui-form-item > .layui-form-label { - width: 120px !important; + +.layuimini-form .layui-form-item > .layui-form-label { + width: 120px !important; } + .layuimini-form > .layui-form-item > .layui-input-block { - margin-left: 150px !important; + margin-left: 150px !important; } -.layuimini-form > .layui-form-item > .layui-input-block > tip { - display: inline-block; - margin-top: 10px; - line-height: 10px; - font-size: 10px; - color: #a29c9c; + +.layuimini-form .layui-form-item > .layui-input-block > tip { + display: inline-block; + margin-top: 10px; + line-height: 10px; + font-size: 10px; + color: #a29c9c; } diff --git a/sparchetype/src/main/resources/static/js/layui-module/layui-config.js b/sparchetype/src/main/resources/static/js/layuimodule/config.js similarity index 96% rename from sparchetype/src/main/resources/static/js/layui-module/layui-config.js rename to sparchetype/src/main/resources/static/js/layuimodule/config.js index aacf119..ca883d4 100644 --- a/sparchetype/src/main/resources/static/js/layui-module/layui-config.js +++ b/sparchetype/src/main/resources/static/js/layuimodule/config.js @@ -29,5 +29,5 @@ layui.config({ // wangEditor富文本扩展 wangEditor: 'wangEditor/wangEditor', // 自定义layer扩展组件 - spLayer: 'spLayer/spLayer' + splayer: 'splayer/splayer' }); \ No newline at end of file diff --git a/sparchetype/src/main/resources/static/js/layui-module/echarts/echarts.js b/sparchetype/src/main/resources/static/js/layuimodule/echarts/echarts.js similarity index 100% rename from sparchetype/src/main/resources/static/js/layui-module/echarts/echarts.js rename to sparchetype/src/main/resources/static/js/layuimodule/echarts/echarts.js diff --git a/sparchetype/src/main/resources/static/js/layui-module/echarts/echartsTheme.js b/sparchetype/src/main/resources/static/js/layuimodule/echarts/echartsTheme.js similarity index 100% rename from sparchetype/src/main/resources/static/js/layui-module/echarts/echartsTheme.js rename to sparchetype/src/main/resources/static/js/layuimodule/echarts/echartsTheme.js diff --git a/sparchetype/src/main/resources/static/js/layui-module/iconPicker/iconPickerFa.js b/sparchetype/src/main/resources/static/js/layuimodule/iconPicker/iconPickerFa.js similarity index 100% rename from sparchetype/src/main/resources/static/js/layui-module/iconPicker/iconPickerFa.js rename to sparchetype/src/main/resources/static/js/layuimodule/iconPicker/iconPickerFa.js diff --git a/sparchetype/src/main/resources/static/js/layui-module/layuimini/layuimini.js b/sparchetype/src/main/resources/static/js/layuimodule/layuimini/layuimini.js similarity index 100% rename from sparchetype/src/main/resources/static/js/layui-module/layuimini/layuimini.js rename to sparchetype/src/main/resources/static/js/layuimodule/layuimini/layuimini.js diff --git a/sparchetype/src/main/resources/static/js/layui-module/spLayer/spLayer.js b/sparchetype/src/main/resources/static/js/layuimodule/splayer/splayer.js similarity index 77% rename from sparchetype/src/main/resources/static/js/layui-module/spLayer/spLayer.js rename to sparchetype/src/main/resources/static/js/layuimodule/splayer/splayer.js index 056bdc8..d16a7e5 100644 --- a/sparchetype/src/main/resources/static/js/layui-module/spLayer/spLayer.js +++ b/sparchetype/src/main/resources/static/js/layuimodule/splayer/splayer.js @@ -7,17 +7,17 @@ layui.define(['layer'], function (exports) { var $ = layui.jquery; var layer = layui.layer; - var spLayer = { + var splayer = { // 渲染弹出框 open: function (param) { - console.log(param); var config = {}; $.extend(config, param, { // 这里写默认配置,会覆盖自定义配置 param + content: param.content + '?' + spUtil.parseParam(param.spWhere) }); layer.open(config); } }; - exports('spLayer', spLayer); + exports('splayer', splayer); }); diff --git a/sparchetype/src/main/resources/static/js/layui-module/step-lay/step.css b/sparchetype/src/main/resources/static/js/layuimodule/step-lay/step.css similarity index 100% rename from sparchetype/src/main/resources/static/js/layui-module/step-lay/step.css rename to sparchetype/src/main/resources/static/js/layuimodule/step-lay/step.css diff --git a/sparchetype/src/main/resources/static/js/layui-module/step-lay/step.js b/sparchetype/src/main/resources/static/js/layuimodule/step-lay/step.js similarity index 100% rename from sparchetype/src/main/resources/static/js/layui-module/step-lay/step.js rename to sparchetype/src/main/resources/static/js/layuimodule/step-lay/step.js diff --git a/sparchetype/src/main/resources/static/js/layui-module/tableSelect/tableSelect.js b/sparchetype/src/main/resources/static/js/layuimodule/tableSelect/tableSelect.js similarity index 100% rename from sparchetype/src/main/resources/static/js/layui-module/tableSelect/tableSelect.js rename to sparchetype/src/main/resources/static/js/layuimodule/tableSelect/tableSelect.js diff --git a/sparchetype/src/main/resources/static/js/layui-module/treetable-lay/treetable.css b/sparchetype/src/main/resources/static/js/layuimodule/treetable-lay/treetable.css similarity index 100% rename from sparchetype/src/main/resources/static/js/layui-module/treetable-lay/treetable.css rename to sparchetype/src/main/resources/static/js/layuimodule/treetable-lay/treetable.css diff --git a/sparchetype/src/main/resources/static/js/layui-module/treetable-lay/treetable.js b/sparchetype/src/main/resources/static/js/layuimodule/treetable-lay/treetable.js similarity index 100% rename from sparchetype/src/main/resources/static/js/layui-module/treetable-lay/treetable.js rename to sparchetype/src/main/resources/static/js/layuimodule/treetable-lay/treetable.js diff --git a/sparchetype/src/main/resources/static/js/layui-module/wangEditor/fonts/w-e-icon.woff b/sparchetype/src/main/resources/static/js/layuimodule/wangEditor/fonts/w-e-icon.woff similarity index 100% rename from sparchetype/src/main/resources/static/js/layui-module/wangEditor/fonts/w-e-icon.woff rename to sparchetype/src/main/resources/static/js/layuimodule/wangEditor/fonts/w-e-icon.woff diff --git a/sparchetype/src/main/resources/static/js/layui-module/wangEditor/wangEditor.css b/sparchetype/src/main/resources/static/js/layuimodule/wangEditor/wangEditor.css similarity index 100% rename from sparchetype/src/main/resources/static/js/layui-module/wangEditor/wangEditor.css rename to sparchetype/src/main/resources/static/js/layuimodule/wangEditor/wangEditor.css diff --git a/sparchetype/src/main/resources/static/js/layui-module/wangEditor/wangEditor.js b/sparchetype/src/main/resources/static/js/layuimodule/wangEditor/wangEditor.js similarity index 100% rename from sparchetype/src/main/resources/static/js/layui-module/wangEditor/wangEditor.js rename to sparchetype/src/main/resources/static/js/layuimodule/wangEditor/wangEditor.js diff --git a/sparchetype/src/main/resources/static/js/layui-module/wangEditor/wangEditor.min.css b/sparchetype/src/main/resources/static/js/layuimodule/wangEditor/wangEditor.min.css similarity index 100% rename from sparchetype/src/main/resources/static/js/layui-module/wangEditor/wangEditor.min.css rename to sparchetype/src/main/resources/static/js/layuimodule/wangEditor/wangEditor.min.css diff --git a/sparchetype/src/main/resources/static/js/layui-module/wangEditor/wangEditor.min.js b/sparchetype/src/main/resources/static/js/layuimodule/wangEditor/wangEditor.min.js similarity index 100% rename from sparchetype/src/main/resources/static/js/layui-module/wangEditor/wangEditor.min.js rename to sparchetype/src/main/resources/static/js/layuimodule/wangEditor/wangEditor.min.js diff --git a/sparchetype/src/main/resources/static/js/layui-module/wangEditor/wangEditor.min.js.map b/sparchetype/src/main/resources/static/js/layuimodule/wangEditor/wangEditor.min.js.map similarity index 100% rename from sparchetype/src/main/resources/static/js/layui-module/wangEditor/wangEditor.min.js.map rename to sparchetype/src/main/resources/static/js/layuimodule/wangEditor/wangEditor.min.js.map diff --git a/sparchetype/src/main/resources/static/js/spUtil.js b/sparchetype/src/main/resources/static/js/spUtil.js index 1022876..4a5e3b5 100644 --- a/sparchetype/src/main/resources/static/js/spUtil.js +++ b/sparchetype/src/main/resources/static/js/spUtil.js @@ -1,6 +1,103 @@ // 工具类 var spUtil = {}; -spUtil.open = function () { - +/** + * 将对象转为url路径字符串参数(编码之后的字符串) + * @param param + * @param key + * @returns {string} + */ +spUtil.parseParam = function (a) { + var s = [], + rbracket = /\[\]$/, + isArray = function (obj) { + return Object.prototype.toString.call(obj) === '[object Array]'; + }, + add = function (k, v) { + v = typeof v === 'function' ? v() : v === null ? '' : v === undefined ? '' : v; + s[s.length] = encodeURIComponent(k) + '=' + encodeURIComponent(v); + }, + buildParams = function (prefix, obj) { + var i, len, key; + + if (prefix) { + if (isArray(obj)) { + for (i = 0, len = obj.length; i < len; i++) { + if (rbracket.test(prefix)) { + add(prefix, obj[i]); + } else { + buildParams(prefix + '[' + (typeof obj[i] === 'object' ? i : '') + ']', obj[i]); + } + } + } else if (obj && String(obj) === '[object Object]') { + for (key in obj) { + buildParams(prefix + '[' + key + ']', obj[key]); + } + } else { + add(prefix, obj); + } + } else if (isArray(obj)) { + for (i = 0, len = obj.length; i < len; i++) { + add(obj[i].name, obj[i].value); + } + } else { + for (key in obj) { + buildParams(key, obj[key]); + } + } + return s; + }; + + return buildParams('', a).join('&').replace(/%20/g, '+'); +}; + +/** + * 解析url路径参数为对象 + * @param url + */ +spUtil.parseQueryString = function (url) { + var obj = {}; + var keyvalue = []; + var key = "", + value = ""; + var paraString = url.substring(url.indexOf("?") + 1, url.length).split("&"); + for (var i in paraString) { + keyvalue = paraString[i].split("="); + key = keyvalue[0]; + value = decodeURIComponent(keyvalue[1]); + obj[key] = value; + } + return obj; +}; + +/** + * 去除字符串内所有的空格 + * @param str + */ +spUtil.trimAll = function (str) { + return str ? str.replace(/\s*/g, "") : str; +}; + +/** + * 去除字符串内两头的空格 + * @param str + */ +spUtil.trimBothEnds = function (str) { + return str ? str.replace(/^\s*|\s*$/g, "") : str; +}; + +/** + * 去除字符串内左侧的空格 + * @param str + */ +spUtil.trimLeft = function (str) { + return str ? str.replace(/^\s*/, "") : str; +}; + +/** + * 去除字符串内右侧的空格 + * @param str + */ +spUtil.trimRight = function (str) { + return str ? str.replace(/(\s*$)/g, "") : str; }; \ No newline at end of file diff --git a/sparchetype/src/main/resources/templates/common/common.ftl b/sparchetype/src/main/resources/templates/common/common.ftl index c704abb..6bdf13b 100644 --- a/sparchetype/src/main/resources/templates/common/common.ftl +++ b/sparchetype/src/main/resources/templates/common/common.ftl @@ -9,4 +9,5 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/sparchetype/src/main/resources/templates/system/dict/addOrUpd.ftl b/sparchetype/src/main/resources/templates/system/dict/addOrUpd.ftl index e865bfe..ede2db9 100644 --- a/sparchetype/src/main/resources/templates/system/dict/addOrUpd.ftl +++ b/sparchetype/src/main/resources/templates/system/dict/addOrUpd.ftl @@ -18,8 +18,7 @@
-