diff --git a/src/main/java/cn/stylefeng/guns/modular/dict/DictTypeViewController.java b/src/main/java/cn/stylefeng/guns/modular/dict/DictTypeViewController.java index 2bc05364..f00f5e56 100644 --- a/src/main/java/cn/stylefeng/guns/modular/dict/DictTypeViewController.java +++ b/src/main/java/cn/stylefeng/guns/modular/dict/DictTypeViewController.java @@ -15,37 +15,41 @@ import org.springframework.stereotype.Controller; @ApiResource(name = "字典类型管理相关的界面渲染") public class DictTypeViewController { + private String PREFIX = "/modular/system/dict/"; + /** - * 字典类型管理-字典类型-视图 + * 字典管理-视图 * - * @author huangyao - * @date 2021/1/6 21:08 + * @author chenjinlong + * @date 2021/1/22 16:09 */ @GetResource(name = "字典类型管理-列表-视图", path = "/view/dictType") public String indexView() { - return "/modular/system/dictType/dictType.html"; + return PREFIX + "dictType.html"; } /** * 字典类型管理-添加-视图 * - * @author huangyao - * @date 2021/1/6 21:25 + * @author chenjinlong + * @date 2021/1/22 16:09 */ @GetResource(name = "字典类型管理-添加-视图", path = "/view/dictType/addView") public String addView() { - return "/modular/system/dictType/dictType_add.html"; + return PREFIX + "dictType_add.html"; } + /** * 字典类型管理-编辑-视图 * - * @author huangyao - * @date 2021/1/6 21:26 + * @author chenjinlong + * @date 2021/1/22 16:09 */ @GetResource(name = "字典类型管理-编辑-视图", path = "/view/dictType/editView") public String editView() { - return "/modular/system/dictType/dictType_edit.html"; + return PREFIX + "dictType_edit.html"; } + } diff --git a/src/main/java/cn/stylefeng/guns/modular/dict/DictViewController.java b/src/main/java/cn/stylefeng/guns/modular/dict/DictViewController.java index e681591c..65826e7f 100644 --- a/src/main/java/cn/stylefeng/guns/modular/dict/DictViewController.java +++ b/src/main/java/cn/stylefeng/guns/modular/dict/DictViewController.java @@ -1,90 +1,53 @@ package cn.stylefeng.guns.modular.dict; -import cn.stylefeng.roses.kernel.dict.modular.entity.SysDict; -import cn.stylefeng.roses.kernel.dict.modular.entity.SysDictType; -import cn.stylefeng.roses.kernel.dict.modular.service.DictService; -import cn.stylefeng.roses.kernel.dict.modular.service.DictTypeService; import cn.stylefeng.roses.kernel.resource.api.annotation.ApiResource; import cn.stylefeng.roses.kernel.resource.api.annotation.GetResource; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.servlet.ModelAndView; - -import javax.annotation.Resource; /** * 字典视图控制器 * - * @author huangyao - * @date 2021/1/16 19:07 + * @author chenjinlong + * @date 2021/1/22 16:09 */ @Controller @ApiResource(name = "字典管理相关的界面渲染") public class DictViewController { - @Resource - private DictService dictService; - @Resource - private DictTypeService dictTypeService; + private String PREFIX = "/modular/system/dict/"; /** * 字典管理-列表-视图 * - * @author huangyao - * @date 2021/1/9 22:37 + * @author chenjinlong + * @date 2021/1/22 16:09 */ @GetResource(name = "字典管理-列表-视图", path = "/view/dict") - public ModelAndView indexView(ModelAndView view, @RequestParam Long dictTypeId) { - SysDictType dictType = dictTypeService.getById(dictTypeId); - - view.addObject("dictTypeId", dictType.getDictTypeId()); - view.addObject("dictTypeName", dictType.getDictTypeName()); - view.addObject("dictTypeCode", dictType.getDictTypeCode()); - view.setViewName("/modular/system/dict/dict.html"); - - return view; + public String indexView() { + return PREFIX + "dict.html"; } /** * 字典管理-添加-视图 * - * @author huangyao - * @date 2021/1/9 22:37 + * @author chenjinlong + * @date 2021/1/22 16:09 */ @GetResource(name = "字典管理-添加-视图", path = "/view/dict/addView") - public ModelAndView addView(ModelAndView view, @RequestParam Long dictTypeId) { - SysDictType dictType = dictTypeService.getById(dictTypeId); - - view.addObject("dictTypeName", dictType.getDictTypeName()); - view.addObject("dictTypeId", dictType.getDictTypeId()); - view.addObject("dictTypeCode", dictType.getDictTypeCode()); - view.setViewName("/modular/system/dict/dict_add.html"); - - return view; + public String addView() { + return PREFIX + "dict_add.html"; } /** * 字典管理-编辑-视图 * - * @author huangyao - * @date 2021/1/9 22:38 + * @author chenjinlong + * @date 2021/1/22 16:09 */ @GetResource(name = "字典管理-编辑-视图", path = "/view/dict/editView") - public ModelAndView editView(ModelAndView view, @RequestParam Long dictId) { - SysDict dict = dictService.getById(dictId); - - // 根据字典获取字典类型 - SysDictType dictType = dictTypeService.getOne(new QueryWrapper().lambda().eq(SysDictType::getDelFlag, "N") - .eq(SysDictType::getDictTypeCode, dict.getDictTypeCode())); - - view.addObject("dictTypeName", dictType.getDictTypeName()); - view.addObject("dictId", dictId); - view.addObject("dictTypeCode", dictType.getDictTypeCode()); - view.setViewName("/modular/system/dict/dict_edit.html"); - - return view; + public String editView() { + return PREFIX + "dict_edit.html"; } } diff --git a/src/main/webapp/assets/common/README.md b/src/main/webapp/assets/common/README.md new file mode 100644 index 00000000..603af746 --- /dev/null +++ b/src/main/webapp/assets/common/README.md @@ -0,0 +1,3 @@ +此目录为easyweb源代码目录 +如需升级,建议购买easyweb源码 +除common.js外其他文件可直接替换 \ No newline at end of file diff --git a/src/main/webapp/assets/common/tip.md b/src/main/webapp/assets/common/tip.md deleted file mode 100644 index 089d7737..00000000 --- a/src/main/webapp/assets/common/tip.md +++ /dev/null @@ -1,12 +0,0 @@ -assets/common目录为easyweb的源代码,为了方便升级,列出所有改动如下: - -common.js的修改: -```js -这个改动比较大,建议直接覆盖然后用git对比 -``` - -index.js的修改: -```js -//第20行开启默认的单页标签 -pageTabs: false, -``` \ No newline at end of file diff --git a/src/main/webapp/assets/expand/css/form.css b/src/main/webapp/assets/expand/css/form.css index 6ecafdcf..070b1db7 100644 --- a/src/main/webapp/assets/expand/css/form.css +++ b/src/main/webapp/assets/expand/css/form.css @@ -1,7 +1,6 @@ -/*表单页面*/ .layui-form-item { - margin-bottom: 0; margin-top: 20px; + margin-bottom: 0; } .layui-form-item .layui-inline { @@ -10,19 +9,11 @@ } .form-group-bottom { - z-index: 9999; position: fixed; - bottom: 0; left: 0; right: 0; - background-color: #F2F2F2; + bottom: 0; padding: 10px 20px; -} - -.layui-card-body { - padding-right: 55px; -} - -input[readonly]{ - background-color: #efefef; + background-color: #fff; + box-shadow: 0 -1px 2px 0 rgba(0, 0, 0, .05); } \ No newline at end of file diff --git a/src/main/webapp/assets/expand/module/func/func.js b/src/main/webapp/assets/expand/module/func/func.js index 612e7905..88912c25 100644 --- a/src/main/webapp/assets/expand/module/func/func.js +++ b/src/main/webapp/assets/expand/module/func/func.js @@ -91,6 +91,7 @@ layui.define(['jquery', 'layer', 'admin', 'table'], function (exports) { //按键监听esc关闭对话框 $(window).keydown(function (event) { if (event.keyCode === 27) { + //admin.closeThisDialog(); parent.layer.close(thisIndex) } }); diff --git a/src/main/webapp/assets/modular/api/api.js b/src/main/webapp/assets/modular/api/api.js index 1319b272..8d2372fc 100644 --- a/src/main/webapp/assets/modular/api/api.js +++ b/src/main/webapp/assets/modular/api/api.js @@ -1,10 +1,11 @@ -layui.use(['layer', 'form', 'table', 'HttpRequest', 'func', 'tree'], function () { +layui.use(['layer', 'form', 'table', 'util', 'admin', 'tree', 'dropdown', 'xmSelect', 'treeTable', 'func', 'HttpRequest'], function () { var $ = layui.jquery; var form = layui.form; var table = layui.table; - var HttpRequest = layui.HttpRequest; - var func = layui.func; var tree = layui.tree; + var HttpRequest = layui.HttpRequest; + var selObj; + /** * Api管理的参数 @@ -19,7 +20,6 @@ layui.use(['layer', 'form', 'table', 'HttpRequest', 'func', 'tree'], function () // 选择api树上的接口时 ApiManager.onClickApi = function (obj) { ApiManager.condition.resourceCode = obj.data.id; - // 如果是具体接口,则查看接口详情 if (obj.data.resourceFlag === true) { ApiManager.search(); @@ -67,22 +67,18 @@ layui.use(['layer', 'form', 'table', 'HttpRequest', 'func', 'tree'], function () }; // 初始化api树 - var request = new HttpRequest(Feng.ctxPath + '/resource/getTree', 'get', function (data) { + new HttpRequest(Feng.ctxPath + '/resource/getTree', 'get', function (data) { tree.render({ - elem: '#apiTree', + elem: '#organizationTree', + onlyIconControl: true, data: data.data, - click: ApiManager.onClickApi, - onlyIconControl: true + click: function (obj) { + selObj = obj; + $('#organizationTree').find('.ew-tree-click').removeClass('ew-tree-click'); + $(obj.elem).children('.layui-tree-entry').addClass('ew-tree-click'); + ApiManager.onClickApi(selObj) + } }); - }); - request.start(); - -}); - -$(function () { - var panehHidden = false; - if ($(this).width() < 769) { - panehHidden = true; - } - $('#myContiner').layout({initClosed: panehHidden, west__size: 330}); -}); + $('#organizationTree').find('.layui-tree-entry:first>.layui-tree-main>.layui-tree-txt').trigger('click'); + }).start(); +}); \ No newline at end of file diff --git a/src/main/webapp/assets/modular/auth/role/role.js b/src/main/webapp/assets/modular/auth/role/role.js index bb4a8277..4dc8f888 100644 --- a/src/main/webapp/assets/modular/auth/role/role.js +++ b/src/main/webapp/assets/modular/auth/role/role.js @@ -1,8 +1,9 @@ -layui.use(['layer', 'form', 'table', 'admin', 'HttpRequest', 'func'], function () { +layui.use(['layer', 'form', 'table', 'admin', 'HttpRequest', 'func', 'dropdown'], function () { var $ = layui.$; var table = layui.table; var HttpRequest = layui.HttpRequest; var func = layui.func; + var dropdown = layui.dropdown; /** * 系统管理--角色管理 @@ -27,36 +28,36 @@ layui.use(['layer', 'form', 'table', 'admin', 'HttpRequest', 'func'], function ( { field: 'dataScopeType', align: "center", sort: true, title: '数据范围类型', templet: function (data) { if (data.dataScopeType === 10) { - return "仅本人数据"; + return '仅本人数据'; } if (data.dataScopeType === 20) { - return "本部门数据"; + return '本部门数据'; } if (data.dataScopeType === 30) { - return "本部门及以下数据"; + return '本部门及以下数据'; } if (data.dataScopeType === 40) { - return "指定部门数据"; + return '指定部门数据'; } if (data.dataScopeType === 50) { - return "全部数据"; + return '全部数据'; } - return "未知"; + return '未知'; } }, { field: 'statusFlag', align: "center", sort: true, title: '状态', templet: function (data) { if (data.statusFlag === 1) { - return "启用"; + return '启用'; } if (data.statusFlag === 2) { - return "禁用"; + return '禁用'; } - return "未知"; + return '未知'; } }, {field: 'remark', align: "center", sort: true, title: '备注'}, - {align: 'center', toolbar: '#tableBar', title: '操作', minWidth: 400} + {align: 'center', toolbar: '#tableBar', title: '操作'} ]]; }; @@ -203,5 +204,6 @@ layui.use(['layer', 'form', 'table', 'admin', 'HttpRequest', 'func'], function ( } else if (layEvent === 'assignApi') { Role.assignApi(data); } + dropdown.hideAll(); }); }); diff --git a/src/main/webapp/assets/modular/system/dict/dict.js b/src/main/webapp/assets/modular/system/dict/dict.js deleted file mode 100644 index 79e3e426..00000000 --- a/src/main/webapp/assets/modular/system/dict/dict.js +++ /dev/null @@ -1,153 +0,0 @@ -layui.use(['table', 'treeTable', 'func', 'HttpRequest'], function () { - var $ = layui.$; - var treeTable = layui.treeTable; - var table = layui.table; - var func = layui.func; - var HttpRequest = layui.HttpRequest; - - //table的初始化实例 - var insTb; - - /** - * 基础字典管理 - */ - var Dict = { - tableId: "dictTable" - }; - - /** - * 初始化表格的列 - */ - Dict.initColumn = function () { - return [ - {type: 'checkbox'}, - {field: 'dictName', align: "center", title: '字典名称'}, - {field: 'dictCode', align: "center", title: '字典编码'}, - {align: 'center', toolbar: '#tableBar', title: '操作'} - ]; - }; - - /** - * 点击查询按钮 - */ - Dict.search = function () { - var queryData = {}; - queryData['dictName'] = $("#condition").val(); - queryData['dictCode'] = $("#condition").val(); - Dict.initTable(Dict.tableId, queryData); - }; - - /** - * 弹出添加对话框 - */ - Dict.openAddDlg = function () { - func.open({ - height: 680, - title: '添加字典', - content: Feng.ctxPath + '/view/dict/addView?dictTypeId=' + $("#dictTypeId").val(), - tableId: Dict.tableId, - endCallback: function () { - Dict.initTable(Dict.tableId); - } - }); - }; - - /** - * 点击编辑 - * - * @param data 点击按钮时候的行数据 - */ - Dict.openEditDlg = function (data) { - func.open({ - height: 680, - title: '修改字典', - content: Feng.ctxPath + '/view/dict/editView?dictId=' + data.dictId, - tableId: Dict.tableId, - endCallback: function () { - Dict.initTable(Dict.tableId); - } - }); - }; - - /** - * 点击删除 - * - * @param data 点击按钮时候的行数据 - */ - Dict.onDeleteItem = function (data) { - var operation = function () { - var httpRequest = new HttpRequest(Feng.ctxPath + "/dict/deleteDict", 'post', function (data) { - Feng.success("删除成功!"); - Dict.search(); - }, function (data) { - Feng.error("删除失败!" + data.message + "!"); - }); - httpRequest.set(data); - httpRequest.start(true); - }; - Feng.confirm("是否删除?", operation); - }; - - /** - * 渲染表格 - */ - Dict.initTable = function (dictId, data) { - return treeTable.render({ - elem: '#' + dictId, - tree: { - iconIndex: 1, // 折叠图标显示在第几列 - idName: 'dictId', // 自定义id字段的名称 - pidName: 'parentId', // 自定义标识是否还有子节点的字段名称 - haveChildName: 'haveChild', // 自定义标识是否还有子节点的字段名称 - isPidData: true // 是否是pid形式数据 - }, - page: true, - request: {pageName: 'pageNo', limitName: 'pageSize'}, //自定义分页参数 - height: "full-98", - cols: Dict.initColumn(), - reqData: function (d, callback) { - var httpRequest = new HttpRequest(Feng.ctxPath + '/dict/getDictTreeList?dictTypeCode=' + $("#dictTypeCode").val(), 'get', function (result) { - callback(result.data); - }, function (result) { - Feng.error("加载失败!" + result.message + "!"); - }); - httpRequest.set(data); - httpRequest.start(); - }, - }); - }; - - insTb = Dict.initTable(Dict.tableId); - - // 搜索按钮点击事件 - $('#btnSearch').click(function () { - Dict.search(); - }); - - // 添加按钮点击事件 - $('#btnAdd').click(function () { - Dict.openAddDlg(); - }); - - // 导出excel - $('#btnExp').click(function () { - Dict.exportExcel(); - }); - - // 关闭页面 - $('#btnBack').click(function () { - window.location.href = Feng.ctxPath + "/view/dictType"; - }); - - // 工具条点击事件 - treeTable.on('tool(' + Dict.tableId + ')', function (obj) { - var data = obj.data; - var layEvent = obj.event; - - if (layEvent === 'edit') { - Dict.openEditDlg(data); - } else if (layEvent === 'delete') { - Dict.onDeleteItem(data); - } - }); -}); diff --git a/src/main/webapp/assets/modular/system/dict/dictType.js b/src/main/webapp/assets/modular/system/dict/dictType.js new file mode 100644 index 00000000..9b148cc3 --- /dev/null +++ b/src/main/webapp/assets/modular/system/dict/dictType.js @@ -0,0 +1,207 @@ +layui.use(['layer', 'form', 'table', 'util', 'admin', 'func', 'HttpRequest'], function () { + var $ = layui.jquery; + var layer = layui.layer; + var form = layui.form; + var table = layui.table; + var admin = layui.admin; + var HttpRequest = layui.HttpRequest; + var func = layui.func; + var dictTypeObj; // 左表选中数据 + + var Dict = { + tableId: "dictTable", + }; + + var DictType = { + tableId: "dictTypeTable" + }; + + + /* 字典类型-点击新增对话框 */ + DictType.openAddDlg = function () { + func.open({ + height: 700, + title: '添加字典类型', + content: Feng.ctxPath + '/view/dictType/addView', + tableId: DictType.tableId + }); + }; + + /* 字典类型-点击编辑对话框 */ + DictType.openEditDlg = function (data) { + func.open({ + height: 700, + title: '修改字典类型', + content: Feng.ctxPath + '/view/dictType/editView?dictTypeId=' + data.dictTypeId, + tableId: DictType.tableId + }); + }; + + /* 字典类型-点击删除 */ + DictType.onDeleteItem = function (data) { + if (data.dictTypeClass === 2) { + Feng.error("系统类型无法删除"); + return; + } + var operation = function () { + var httpRequest = new HttpRequest(Feng.ctxPath + "/dictType/deleteDictType", 'post', function (data) { + Feng.success("删除成功!"); + table.reload(DictType.tableId); + }, function (data) { + Feng.error("删除失败!" + data.message + "!"); + }); + httpRequest.set(data); + httpRequest.start(true); + }; + Feng.confirm("是否删除?", operation); + }; + + /* 字典类型-点击搜索 */ + form.on('submit(dictTypeTbSearch)', function (data) { + dictTypeTable.reload({where: data.field}); + return false; + }); + + /* 字典类型-点击表格头工具栏 */ + table.on('toolbar(dictTypeTable)', function (obj) { + var data = dictTypeObj.data; + if (obj.event === 'add') { // 添加 + DictType.openAddDlg(); + } else if (obj.event === 'edit') { // 修改 + DictType.openEditDlg(data); + } else if (obj.event === 'del') { // 删除 + DictType.onDeleteItem(data); + } + }); + + /* 字典类型-渲染表格 */ + var dictTypeTable = table.render({ + elem: '#dictTypeTable', + url: Feng.ctxPath + '/dictType/getDictTypePageList', + height: 'full-100', + toolbar: '#dictTypeHtbBar', + defaultToolbar: [], //默认表格头部右侧工具栏 + cols: [[ + {type: 'numbers'}, + {field: 'dictTypeName', title: '类型'}, + {field: 'dictTypeCode', title: '编码'}, + ]], + done: function (res, curr, count) { + //加载后自动选中第一行并出发click事件 + $('#dictTypeTable+.layui-table-view .layui-table-body tbody>tr:first').trigger('click'); + }, + parseData: Feng.parseData //解析成 table 组件所规定的数据格式 + }); + + /* 字典类型-监听行单击事件 */ + table.on('row(dictTypeTable)', function (obj) { + dictTypeObj = obj; + obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click'); + dictTable.reload({ + where: {dictTypeCode: obj.data.dictTypeCode}, + page: {curr: 1}, + url: Feng.ctxPath + '/dict/page' + }); + }); + + /* 删除 */ + function doDel(obj) { + layer.confirm('确定要删除此字典吗?', { + skin: 'layui-layer-admin', + shade: .1 + }, function (i) { + layer.close(i); + var loadIndex = layer.load(2); + $.get('../../json/ok.json', { + id: obj.data.dictId, + }, function (res) { + layer.close(loadIndex); + if (200 === res.code) { + layer.msg(res.msg, {icon: 1}); + obj.del(); + $('#dictTypeTable+.layui-table-view .layui-table-body tbody>tr:first').trigger('click'); + } else { + layer.msg(res.msg, {icon: 2}); + } + }, 'json'); + }); + } + + /* 字典-点击新增对话框 */ + Dict.openAddDlg = function (data) { + func.open({ + height: 680, + title: '添加字典', + content: Feng.ctxPath + '/view/dict/addView?dictTypeId=' + data.dictTypeId, + tableId: Dict.tableId + }); + }; + + /* 字典-点击编辑对话框 */ + Dict.openEditDlg = function (data) { + func.open({ + height: 680, + title: '修改字典', + content: Feng.ctxPath + '/view/dict/editView?dictId=' + data.dictId, + tableId: Dict.tableId + }); + }; + + /* 字典-点击删除 */ + Dict.onDeleteItem = function (data) { + var operation = function () { + var httpRequest = new HttpRequest(Feng.ctxPath + "/dict/deleteDict", 'post', function (data) { + Feng.success("删除成功!"); + table.reload(Dict.tableId); + }, function (data) { + Feng.error("删除失败!" + data.message + "!"); + }); + httpRequest.set(data); + httpRequest.start(true); + }; + Feng.confirm("是否删除?", operation); + }; + + /* 字典-点击搜索 */ + form.on('submit(dictTbSearch)', function (data) { + //赋值左表dictTypeCode + data.field.dictTypeCode = dictTypeObj.data.dictTypeCode; + dictTable.reload({where: data.field}); + return false; + }); + + /* 字典-点击操作工具栏 */ + table.on('tool(dictTable)', function (obj) { + var data = obj.data; + if (obj.event === 'edit') { // 修改 + Dict.openEditDlg(data); + } else if (obj.event === 'del') { // 删除 + Dict.onDeleteItem(data); + } + }); + + // 添加按钮点击事件 + $('#btnAdd').click(function () { + Dict.openAddDlg(dictTypeObj.data); + return false; + }); + + /* 字典-渲染表格 */ + var dictTable = table.render({ + elem: '#dictTable', + data: [], + height: 'full-100', + page: true, + //toolbar: '#dictHtbBar', + cellMinWidth: 100, + cols: [[ + {type: 'checkbox'}, + {type: 'numbers'}, + {field: 'dictName', align: "center", sort: true, title: '字典名称'}, + {field: 'dictCode', align: "center", sort: true, title: '字典编码'}, + {field: 'dictSort', align: "center", sort: true, title: '排序号'}, + {align: 'center', toolbar: '#dictTbBar', title: '操作'} + ]], + parseData: Feng.parseData + }); +}); \ No newline at end of file diff --git a/src/main/webapp/assets/modular/system/dictType/dictType_add.js b/src/main/webapp/assets/modular/system/dict/dictType_add.js similarity index 100% rename from src/main/webapp/assets/modular/system/dictType/dictType_add.js rename to src/main/webapp/assets/modular/system/dict/dictType_add.js diff --git a/src/main/webapp/assets/modular/system/dictType/dictType_edit.js b/src/main/webapp/assets/modular/system/dict/dictType_edit.js similarity index 66% rename from src/main/webapp/assets/modular/system/dictType/dictType_edit.js rename to src/main/webapp/assets/modular/system/dict/dictType_edit.js index 7aad296d..23b50583 100644 --- a/src/main/webapp/assets/modular/system/dictType/dictType_edit.js +++ b/src/main/webapp/assets/modular/system/dict/dictType_edit.js @@ -5,27 +5,23 @@ layui.use(['form', 'admin', 'HttpRequest'], function () { var HttpRequest = layui.HttpRequest; //获取详情信息,填充表单 - var request = new HttpRequest(Feng.ctxPath + "/dictType/getDictDetail?dictTypeId=" + Feng.getUrlParam("dictTypeId"), 'get', function (result) { - if(result.data.dictTypeClass === 2){ - $('input,select,textarea').attr("disabled",true).attr('readonly',true); - } - form.val('dictTypeForm', result.data); - }, function (data) { - Feng.error("加载失败!" + data.message); - }); - request.start(); + var request = new HttpRequest(Feng.ctxPath + "/dictType/getDictDetail?dictTypeId=" + Feng.getUrlParam("dictTypeId"), 'get'); + var result = request.start(); + form.val('dictTypeForm', result.data); + if(result.data.dictTypeClass === 2){ + $('input,select,textarea').attr("disabled",true).attr('readonly',true); + } //表单提交事件 form.on('submit(btnSubmit)', function (data) { var request = new HttpRequest(Feng.ctxPath + "/dictType/updateDictType", 'post', function (data) { admin.closeThisDialog(); - Feng.success("更新成功!"); + Feng.success("修改成功!"); admin.putTempData('formOk', true); }, function (data) { admin.closeThisDialog(); - Feng.error("更新失败!" + data.message); + Feng.error("修改失败!" + data.message); }); - request.set(data.field); request.start(true); diff --git a/src/main/webapp/assets/modular/system/dict/dict_add.js b/src/main/webapp/assets/modular/system/dict/dict_add.js index b340e15f..420f6427 100644 --- a/src/main/webapp/assets/modular/system/dict/dict_add.js +++ b/src/main/webapp/assets/modular/system/dict/dict_add.js @@ -1,19 +1,14 @@ -/** - * 详情对话框 - */ -var DictInfoDlg = { - data: { - dictParentId: "-1", - parentName: "顶级" - } -}; - layui.use(['form', 'admin', 'HttpRequest'], function () { var $ = layui.jquery; var form = layui.form; var admin = layui.admin; var HttpRequest = layui.HttpRequest; + //获取信息详情填充表单 + var request = new HttpRequest(Feng.ctxPath + "/dictType/getDictDetail?dictTypeId=" + Feng.getUrlParam("dictTypeId"), 'get'); + var result = request.start(); + form.val('dictForm', result.data); + //表单提交事件 form.on('submit(btnSubmit)', function (data) { var request = new HttpRequest(Feng.ctxPath + "/dict/addDict", 'post', function (data) { @@ -24,26 +19,7 @@ layui.use(['form', 'admin', 'HttpRequest'], function () { admin.closeThisDialog(); Feng.error("添加失败!" + data.message); }); - request.set(data.field); request.start(true); }); - - //父级字典时 - $('#parentName').click(function () { - var formName = encodeURIComponent("parent.DictInfoDlg.data.parentName"); - var formId = encodeURIComponent("parent.DictInfoDlg.data.dictParentId"); - var treeUrl = encodeURIComponent("/dict/zTree?dictTypeCode=" + $("#dictTypeCode").val()); - - layer.open({ - type: 2, - title: '父级字典', - area: ['300px', '400px'], - content: Feng.ctxPath + '/view/common/tree?formName=' + formName + "&formId=" + formId + "&treeUrl=" + treeUrl, - end: function () { - $("#dictParentId").val(DictInfoDlg.data.dictParentId); - $("#parentName").val(DictInfoDlg.data.parentName); - } - }); - }); }); \ No newline at end of file diff --git a/src/main/webapp/assets/modular/system/dict/dict_edit.js b/src/main/webapp/assets/modular/system/dict/dict_edit.js index 90810a1f..b05ef983 100644 --- a/src/main/webapp/assets/modular/system/dict/dict_edit.js +++ b/src/main/webapp/assets/modular/system/dict/dict_edit.js @@ -1,57 +1,27 @@ -/** - * 详情对话框 - */ -var DictInfoDlg = { - data: { - dictParentId: "-1", - parentName: "顶级" - } -}; - layui.use(['form', 'admin', 'HttpRequest'], function () { - var $ = layui.jquery; var form = layui.form; var admin = layui.admin; var HttpRequest = layui.HttpRequest; //获取详情信息,填充表单 - var request = new HttpRequest(Feng.ctxPath + "/dict/getDictDetail?dictId=" + Feng.getUrlParam("dictId"), 'get', function (result) { - form.val('dictForm', result.data); - }, function (data) { - Feng.error("加载失败!" + data.message); - }); - request.start(); + var request = new HttpRequest(Feng.ctxPath + "/dict/getDictDetail?dictId=" + Feng.getUrlParam("dictId"), 'get'); + var result = request.start(); + form.val('dictForm', result.data); //表单提交事件 form.on('submit(btnSubmit)', function (data) { var request = new HttpRequest(Feng.ctxPath + "/dict/updateDict", 'post', function (data) { admin.closeThisDialog(); - Feng.success("更新成功!"); + Feng.success("修改成功!"); admin.putTempData('formOk', true); }, function (data) { admin.closeThisDialog(); - Feng.error("更新失败!" + data.message); + Feng.error("修改失败!" + data.message); }); request.set(data.field); request.start(true); }); - //父级字典时 - $('#parentName').click(function () { - var formName = encodeURIComponent("parent.DictInfoDlg.data.parentName"); - var formId = encodeURIComponent("parent.DictInfoDlg.data.dictParentId"); - var treeUrl = encodeURIComponent("/dict/zTree?dictTypeCode=" + $("#dictTypeCode").val() + "&dictId=" + $("#dictId").val()); - layer.open({ - type: 2, - title: '父级字典', - area: ['300px', '400px'], - content: Feng.ctxPath + '/view/common/tree?formName=' + formName + "&formId=" + formId + "&treeUrl=" + treeUrl, - end: function () { - $("#dictParentId").val(DictInfoDlg.data.dictParentId); - $("#parentName").val(DictInfoDlg.data.parentName); - } - }); - }); }); \ No newline at end of file diff --git a/src/main/webapp/assets/modular/system/dictType/dictType.js b/src/main/webapp/assets/modular/system/dictType/dictType.js deleted file mode 100644 index f51d3665..00000000 --- a/src/main/webapp/assets/modular/system/dictType/dictType.js +++ /dev/null @@ -1,164 +0,0 @@ -layui.use(['table', 'func', 'HttpRequest', 'form'], function () { - var $ = layui.$; - var table = layui.table; - var func = layui.func; - var HttpRequest = layui.HttpRequest; - var form = layui.form; - - /** - * 字典类型表管理 - */ - var DictType = { - tableId: "dictTypeTable" - }; - - /** - * 初始化表格的列 - */ - DictType.initColumn = function () { - return [[ - {type: 'checkbox'}, - {field: 'dictTypeId', hide: true, title: '字典类型id'}, - { - field: 'dictTypeName', align: "center", sort: true, title: '类型名称', templet: function (d) { - var url = Feng.ctxPath + '/view/dict?dictTypeId=' + d.dictTypeId; - return '' + d.dictTypeName + ''; - } - }, - { - field: 'dictTypeClass', align: "center", sort: true, title: '字典类型', templet: function (d) { - if (d.dictTypeClass === 1) { - return "业务类型"; - } else { - return "系统类型"; - } - } - }, - {field: 'dictTypeNamePinyin', align: "center", sort: true, title: '名词拼音'}, - {field: 'dictTypeCode', align: "center", sort: true, title: '类型编码', minWidth: 166}, - {field: 'dictTypeBusCode', align: "center", sort: true, title: '业务编码', minWidth: 166}, - {field: 'dictTypeDesc', align: "center", sort: true, title: '字典描述'}, - {field: 'statusFlag', sort: true, align: "center", title: '状态', templet: '#statusFlagTpl'}, - {align: 'center', toolbar: '#tableBar', title: '操作'} - ]]; - }; - - /** - * 点击查询按钮 - */ - DictType.search = function () { - var queryData = {}; - queryData['dictTypeName'] = $("#dictTypeName").val(); - queryData['dictTypeClass'] = $("#dictTypeClass").val(); - queryData['statusFlag'] = $("#statusFlag").val(); - table.reload(DictType.tableId, { - where: queryData, page: {curr: 1} - }); - }; - - /** - * 弹出添加对话框 - */ - DictType.openAddDlg = function () { - func.open({ - height: 700, - title: '添加字典类型', - content: Feng.ctxPath + '/view/dictType/addView', - tableId: DictType.tableId - }); - }; - - /** - * 点击编辑 - * - * @param data 点击按钮时候的行数据 - */ - DictType.openEditDlg = function (data) { - func.open({ - height: 700, - title: '修改字典类型', - content: Feng.ctxPath + '/view/dictType/editView?dictTypeId=' + data.dictTypeId, - tableId: DictType.tableId - }); - }; - - /** - * 点击删除 - * - * @param data 点击按钮时候的行数据 - */ - DictType.onDeleteItem = function (data) { - - if (data.dictTypeClass === 2) { - Feng.error("系统类型无法删除"); - return; - } - - var operation = function () { - var httpRequest = new HttpRequest(Feng.ctxPath + "/dictType/deleteDictType", 'post', function (data) { - Feng.success("删除成功!"); - table.reload(DictType.tableId); - }, function (data) { - Feng.error("删除失败!" + data.message + "!"); - }); - httpRequest.set(data); - httpRequest.start(true); - }; - - Feng.confirm("是否删除?", operation); - }; - - // 修改字典类型状态 - DictType.updateStatus = function (dictTypeId, checked) { - var httpRequest = new HttpRequest(Feng.ctxPath + "/dictType/updateStatus", 'post', function (data) { - table.reload(DictType.tableId); - Feng.success("修改成功!"); - }, function (data) { - table.reload(DictType.tableId); - Feng.error("修改失败!" + data.message); - }); - httpRequest.set({"dictTypeId": dictTypeId, "statusFlag": checked}); - httpRequest.start(true); - }; - - // 渲染表格 - var tableResult = table.render({ - elem: '#' + DictType.tableId, - url: Feng.ctxPath + '/dictType/getDictTypePageList', - page: true, - request: {pageName: 'pageNo', limitName: 'pageSize'}, //自定义分页参数 - height: "full-158", - cellMinWidth: 100, - cols: DictType.initColumn(), - parseData: Feng.parseData - }); - - // 搜索按钮点击事件 - $('#btnSearch').click(function () { - DictType.search(); - }); - - // 添加按钮点击事件 - $('#btnAdd').click(function () { - DictType.openAddDlg(); - }); - - // 工具条点击事件 - table.on('tool(' + DictType.tableId + ')', function (obj) { - var data = obj.data; - var layEvent = obj.event; - - if (layEvent === 'edit') { - DictType.openEditDlg(data); - } else if (layEvent === 'delete') { - DictType.onDeleteItem(data); - } - }); - - // 修改状态 - form.on('switch(statusFlag)', function (obj) { - var dictTypeId = obj.elem.value; - var checked = obj.elem.checked ? 1 : 2; - DictType.updateStatus(dictTypeId, checked); - }); -}); diff --git a/src/main/webapp/assets/modular/system/organization/organization.js b/src/main/webapp/assets/modular/system/organization/organization.js index 4dfa9cf2..183bc4d6 100644 --- a/src/main/webapp/assets/modular/system/organization/organization.js +++ b/src/main/webapp/assets/modular/system/organization/organization.js @@ -1,85 +1,46 @@ -layui.use(['layer', 'form', 'table', 'ztree', 'laydate', 'admin', 'HttpRequest', 'func', 'tree', 'util'], function () { +layui.use(['layer', 'form', 'table', 'util', 'admin', 'tree', 'dropdown', 'xmSelect', 'treeTable', 'func', 'HttpRequest'], function () { + var $ = layui.jquery; + var layer = layui.layer; var form = layui.form; var table = layui.table; - var HttpRequest = layui.HttpRequest; - var func = layui.func; + var admin = layui.admin; var tree = layui.tree; + var func = layui.func; + var HttpRequest = layui.HttpRequest; + var xmSelect = layui.xmSelect; + var selObj, treeData; // 左树选中数据 /** * 系统管理--用户管理 */ var Organization = { - tableId: "userTable", //表格id - condition: { - orgName: "", - orgParentId: "", - orgCode: "" - } + tableId: "organizationTable", //表格id }; - // 初始化表格的列 - Organization.initColumn = function () { - return [[ - {type: 'checkbox'}, - {field: 'orgId', hide: true, title: '主键id'}, - {field: 'orgName', sort: true, title: '机构名称'}, - {field: 'orgCode', sort: true, title: '机构编码'}, - {field: 'orgSort', sort: true, title: '排序'}, - {field: 'orgRemark', sort: true, title: '备注'}, - {field: 'statusFlag', sort: true, templet: '#statusTpl', title: '状态'}, - {align: 'center', toolbar: '#tableBar', title: '操作'} - ]]; - }; - - // 选择部门时 - Organization.onClickDept = function (obj) { - Organization.condition.orgParentId = obj.data.id; - Organization.search(); - }; - - - // 点击查询按钮 - Organization.search = function () { - var queryData = {}; - queryData['orgParentId'] = Organization.condition.orgParentId; - queryData['orgName'] = $("#orgName").val(); - queryData['orgCode'] = $("#orgCode").val(); - table.reload(Organization.tableId, { - where: queryData, page: {curr: 1} - }); - }; - - // 弹出添加对话框 + /* 点击新增对话框 */ Organization.openAddDlg = function () { func.open({ height: 800, title: '添加机构', content: Feng.ctxPath + '/view/organization/addView', - tableId: Organization.tableId + tableId: Organization.tableId, + endCallback: function () { + renderTree(); + } }); }; - // 点击编辑 + /* 点击编辑对话框 */ Organization.openEditDlg = function (data) { func.open({ height: 800, title: '修改机构', - content: Feng.ctxPath + '/view/organization/editView?orgId=' + data.orgId, + content: Feng.ctxPath + '/view/organization/editView?orgId=' + data.id, tableId: Organization.tableId }); }; - // 导出excel按钮 - Organization.exportExcel = function () { - var checkRows = table.checkStatus(Organization.tableId); - if (checkRows.data.length === 0) { - Feng.error("请选择要导出的数据"); - } else { - table.exportFile(tableResult.config.id, checkRows.data, 'xls'); - } - }; - - // 点击删除 + /* 点击删除 */ Organization.delete = function (data) { var operation = function () { var httpRequest = new HttpRequest(Feng.ctxPath + "/hrOrganization/delete", 'post', function (data) { @@ -94,80 +55,83 @@ layui.use(['layer', 'form', 'table', 'ztree', 'laydate', 'admin', 'HttpRequest', Feng.confirm("是否删除?", operation); }; - // 修改职位状态 - Organization.updateStatus = function (orgId, checked) { - var httpRequest = new HttpRequest(Feng.ctxPath + "/hrOrganization/updateStatus", 'post', function (data) { - table.reload(Organization.tableId); - Feng.success("修改成功!"); - }, function (data) { - table.reload(Organization.tableId); - Feng.error("修改失败!" + data.message); + /* 渲染树形 */ + function renderTree() { + $.get(Feng.ctxPath + '/hrOrganization/treeLayui', function (res) { + tree.render({ + elem: '#organizationTree', + onlyIconControl: true, + data: res.data, + click: function (obj) { + selObj = obj; + $('#organizationTree').find('.ew-tree-click').removeClass('ew-tree-click'); + $(obj.elem).children('.layui-tree-entry').addClass('ew-tree-click'); + + console.log(obj.data); + insTb.reload({ + where: {orgParentId: obj.data.id}, + page: {curr: 1}, + url: Feng.ctxPath + '/hrOrganization/page' + }); + } + }); + $('#organizationTree').find('.layui-tree-entry:first>.layui-tree-main>.layui-tree-txt').trigger('click'); }); - httpRequest.set({"orgId": orgId, "statusFlag": checked}); - httpRequest.start(true); - }; + } - // 渲染表格 - var tableResult = table.render({ - elem: '#' + Organization.tableId, - url: Feng.ctxPath + '/hrOrganization/page', - page: true, - height: "full-98", - cellMinWidth: 100, - cols: Organization.initColumn(), - parseData: Feng.parseData - }); + renderTree(); - // 初始化部门树 - var request = new HttpRequest(Feng.ctxPath + '/hrOrganization/treeLayui', 'get', function (data) { - tree.render({ - elem: '#deptTree', - data: data.data, - click: Organization.onClickDept, - onlyIconControl: true - }); - }); - request.start(); - - // 搜索按钮点击事件 - $('#btnSearch').click(function () { - Organization.search(); - }); - - // 添加按钮点击事件 - $('#btnAdd').click(function () { + /* 添加 */ + $('#organizationAddBtn').click(function () { Organization.openAddDlg(); }); - // 导出excel - $('#btnExp').click(function () { - Organization.exportExcel(); + /* 修改 */ + $('#organizationEditBtn').click(function () { + if (!selObj) return layer.msg('未选择机构', {icon: 2}); + Organization.openEditDlg(selObj.data) }); - // 工具条点击事件 - table.on('tool(' + Organization.tableId + ')', function (obj) { - var data = obj.data; - var event = obj.event; - if (event === 'edit') { - Organization.openEditDlg(data); - } else if (event === 'delete') { - Organization.delete(data); - } + /* 删除 */ + $('#organizationDelBtn').click(function () { + if (!selObj) return layer.msg('未选择机构', {icon: 2}); + selObj.data.orgId = selObj.data.id; + Organization.delete(selObj.data) + }); - // 修改状态 - form.on('switch(status)', function (obj) { - var orgId = obj.elem.value; - var checked = obj.elem.checked ? 1 : 2; - Organization.updateStatus(orgId, checked); + + /* 渲染表格 */ + var insTb = table.render({ + elem: '#organizationTable', + data: [], + height: 'full-100', + page: true, + //toolbar: '#organizationUserTbToolBar', + cellMinWidth: 100, + cols: [[ + {type: 'checkbox'}, + {type: 'numbers'}, + {field: 'orgId', hide: true, title: '主键id'}, + {field: 'orgName', sort: true, title: '机构名称'}, + {field: 'orgCode', sort: true, title: '机构编码'}, + {field: 'orgSort', sort: true, title: '排序'}, + {field: 'orgRemark', sort: true, title: '备注'} + ]], + done: function () { + // 表格搜索 + form.on('submit(organizationUserTbSearch)', function (data) { + insTb.reload({where: data.field, page: {curr: 1}}); + return false; + }); + }, + parseData: Feng.parseData }); -}); + /* 点击搜索 */ + form.on('submit(organizationTbSearch)', function (data) { + insTb.reload({where: data.field}); + return false; + }); -$(function () { - var panehHidden = false; - if ($(this).width() < 769) { - panehHidden = true; - } - $('#myContiner').layout({initClosed: panehHidden, west__size: 260}); }); \ No newline at end of file diff --git a/src/main/webapp/assets/modular/system/user/user.js b/src/main/webapp/assets/modular/system/user/user.js index c992e5b8..cff840d0 100644 --- a/src/main/webapp/assets/modular/system/user/user.js +++ b/src/main/webapp/assets/modular/system/user/user.js @@ -1,107 +1,59 @@ -layui.use(['layer', 'form', 'table', 'ztree', 'laydate', 'admin', 'HttpRequest', 'func', 'tree', 'util'], function () { +layui.use(['layer', 'form', 'table', 'util', 'admin', 'tree', 'dropdown', 'xmSelect', 'treeTable', 'func', 'HttpRequest'], function () { + var $ = layui.jquery; var layer = layui.layer; var form = layui.form; var table = layui.table; - var HttpRequest = layui.HttpRequest; - var laydate = layui.laydate; - var func = layui.func; + var admin = layui.admin; var tree = layui.tree; - - var util=layui.util; + var func = layui.func; + var HttpRequest = layui.HttpRequest; + var xmSelect = layui.xmSelect; + var selObj, treeData; // 左树选中数据 /** * 系统管理--用户管理 */ - var MgrUser = { + var OrganizationUser = { tableId: "userTable", //表格id - condition: { - realName: "", - orgId: "", - account: "" - } }; - /** - * 初始化表格的列 - */ - MgrUser.initColumn = function () { - - //获取多语言 - //var langs = layui.data('system').lang; - - return [[ - {type: 'checkbox'}, - {field: 'userId', hide: true, sort: true, title: '用户id'}, - {field: 'account', align: "center", sort: true, title: '账号'}, - {field: 'realName', align: "center", sort: true, title: '姓名'}, - {field: 'orgId', align: "center", sort: true, title: '机构'}, - {field: 'positionId', align: "center", sort: true, title: '职务'}, - {field: 'phone', align: "center", sort: true, title: '电话'}, - {field: 'createTime', align: "center", sort: true, title: '创建时间', minWidth: 160}, - {field: 'status', align: "center", sort: true, templet: '#statusTpl', title: '状态'}, - {align: 'center', toolbar: '#tableBar', title: '操作', minWidth: 350} - ]]; - }; - - /** - * 选择部门时 - */ - MgrUser.onClickDept = function (obj) { - MgrUser.condition.orgId = obj.data.id; - MgrUser.search(); - }; - - /** - * 点击查询按钮 - */ - MgrUser.search = function () { - var queryData = {}; - queryData['orgId'] = MgrUser.condition.orgId; - queryData['account'] = $("#account").val(); - queryData['realName'] = $("#realName").val(); - table.reload(MgrUser.tableId, { - where: queryData, page: {curr: 1} - }); - }; - - // 添加按钮 - MgrUser.openAddUser = function () { + /* 点击新增对话框 */ + OrganizationUser.openAddDlg = function () { func.open({ height: 680, title: '添加用户', content: Feng.ctxPath + '/view/user/addView', - tableId: MgrUser.tableId + tableId: OrganizationUser.tableId }); }; - // 修改按钮 - MgrUser.onEditUser = function (data) { + /* 点击编辑对话框 */ + OrganizationUser.openEditDlg = function (data) { func.open({ height: 680, title: '修改用户', content: Feng.ctxPath + '/view/user/editView?userId=' + data.userId, - tableId: MgrUser.tableId + tableId: OrganizationUser.tableId }); }; - /** - * 导出excel按钮 - */ - MgrUser.exportExcel = function () { - var checkRows = table.checkStatus(MgrUser.tableId); - if (checkRows.data.length === 0) { - Feng.error("请选择要导出的数据"); - } else { - table.exportFile(tableResult.config.id, checkRows.data, 'xls'); - } + /* 修改用户状态 */ + OrganizationUser.changeUserStatus = function (userId, checked) { + new HttpRequest(Feng.ctxPath + "/sysUser/changeStatus", 'post', function (data) { + table.reload(OrganizationUser.tableId); + Feng.success("修改成功!"); + }, function (data) { + table.reload(OrganizationUser.tableId); + Feng.error("修改失败!" + data.message); + }).set({"userId": userId, "statusFlag": checked}).start(true); }; - // 删除用户 - MgrUser.onDeleteUser = function (data) { + /* 点击删除 */ + OrganizationUser.onDeleteUser = function (data) { var operation = function () { var httpRequest = new HttpRequest(Feng.ctxPath + "/sysUser/delete", 'post', function (data) { Feng.success("删除成功!"); - table.reload(MgrUser.tableId); + table.reload(OrganizationUser.tableId); }, function (data) { Feng.error("删除失败!" + data.message + "!"); }); @@ -110,23 +62,22 @@ layui.use(['layer', 'form', 'table', 'ztree', 'laydate', 'admin', 'HttpRequest', }; Feng.confirm("是否删除用户" + data.account + "?", operation); }; - // 分配角色 - MgrUser.roleAssign = function (data) { + OrganizationUser.roleAssign = function (data) { func.open({ title: '授权角色', height: 470, content: Feng.ctxPath + '/view/user/roleView?userId=' + data.userId, - tableId: MgrUser.tableId + tableId: OrganizationUser.tableId }); }; // 重置密码 - MgrUser.resetPassword = function (data) { + OrganizationUser.resetPassword = function (data) { Feng.confirm("是否重置密码为" + $("#defaultPassword").val() + "?", function () { var httpRequest = new HttpRequest(Feng.ctxPath + "/sysUser/resetPwd", 'post', function (data) { Feng.success("重置密码成功!"); - table.reload(MgrUser.tableId); + table.reload(OrganizationUser.tableId); }, function (data) { Feng.error("重置密码失败!" + data.message + "!"); }); @@ -135,70 +86,82 @@ layui.use(['layer', 'form', 'table', 'ztree', 'laydate', 'admin', 'HttpRequest', }); }; - // 修改用户状态 - MgrUser.changeUserStatus = function (userId, checked) { - - var httpRequest = new HttpRequest(Feng.ctxPath + "/sysUser/changeStatus", 'post', function (data) { - table.reload(MgrUser.tableId); - Feng.success("修改成功!"); - }, function (data) { - table.reload(MgrUser.tableId); - Feng.error("修改失败!" + data.message); + /* 渲染树形 */ + function renderTree() { + $.get(Feng.ctxPath + '/hrOrganization/treeLayui', function (res) { + tree.render({ + elem: '#organizationTree', + onlyIconControl: true, + data: res.data, + click: function (obj) { + selObj = obj; + $('#organizationTree').find('.ew-tree-click').removeClass('ew-tree-click'); + $(obj.elem).children('.layui-tree-entry').addClass('ew-tree-click'); + insTb.reload({ + where: {orgId: obj.data.id}, + page: {curr: 1}, + url: Feng.ctxPath + '/sysUser/page', + }); + } + }); + $('#organizationTree').find('.layui-tree-entry:first>.layui-tree-main>.layui-tree-txt').trigger('click'); }); - httpRequest.set({"userId": userId, "statusFlag": checked}); - httpRequest.start(true); - }; + } - // 渲染表格 - var tableResult = table.render({ - elem: '#' + MgrUser.tableId, - url: Feng.ctxPath + '/sysUser/page', + renderTree(); + + /* 添加 */ + $('#userAddBtn').click(function () { + OrganizationUser.openAddDlg(); + return false; + }); + + + /* 渲染表格 */ + var insTb = table.render({ + elem: '#userTable', + data: [], + height: 'full-100', page: true, - height: "full-98", + //toolbar: '#organizationUserTbToolBar', cellMinWidth: 100, - cols: MgrUser.initColumn(), + cols: [[ + {type: 'checkbox'}, + {field: 'userId', hide: true, sort: true, title: '用户id'}, + {field: 'account', align: "center", sort: true, title: '账号'}, + {field: 'realName', align: "center", sort: true, title: '姓名'}, + {field: 'positionId', align: "center", sort: true, title: '职务'}, + {field: 'phone', align: "center", sort: true, title: '电话'}, + {field: 'status', align: "center", templet: '#statusTpl', title: '状态'}, + {title: '操作', toolbar: '#userTbBar'} + + ]], + done: function () { + // 表格搜索 + form.on('submit(organizationUserTbSearch)', function (data) { + insTb.reload({where: data.field, page: {curr: 1}}); + return false; + }); + }, parseData: Feng.parseData }); - // 初始化部门树 - var request = new HttpRequest(Feng.ctxPath + '/hrOrganization/treeLayui', 'get', function (data) { - tree.render({ - elem: '#deptTree', - data: data.data, - click: MgrUser.onClickDept, - onlyIconControl: true - }); - }); - request.start(); - - // 搜索按钮点击事件 - $('#btnSearch').click(function () { - MgrUser.search(); + /* 点击搜索 */ + form.on('submit(userTbSearch)', function (data) { + insTb.reload({where: data.field}); + return false; }); - // 添加按钮点击事件 - $('#btnAdd').click(function () { - MgrUser.openAddUser(); - }); - - // 导出excel - $('#btnExp').click(function () { - MgrUser.exportExcel(); - }); - - // 工具条点击事件 - table.on('tool(' + MgrUser.tableId + ')', function (obj) { - var data = obj.data; - var layEvent = obj.event; - - if (layEvent === 'edit') { - MgrUser.onEditUser(data); - } else if (layEvent === 'delete') { - MgrUser.onDeleteUser(data); - } else if (layEvent === 'roleAssign') { - MgrUser.roleAssign(data); - } else if (layEvent === 'reset') { - MgrUser.resetPassword(data); + /* 表格工具条点击事件 */ + table.on('tool(userTable)', function (obj) { + if (obj.event === 'edit') { // 修改 + OrganizationUser.openEditDlg(obj.data); + } else if (obj.event === 'delete') { // 删除 + OrganizationUser.onDeleteUser(obj.data); + } else if (obj.event === 'roleAssign') { + OrganizationUser.roleAssign(obj.data); + } else if (obj.event === 'reset') { + OrganizationUser.resetPassword(obj.data); } }); @@ -206,15 +169,7 @@ layui.use(['layer', 'form', 'table', 'ztree', 'laydate', 'admin', 'HttpRequest', form.on('switch(status)', function (obj) { var userId = obj.elem.value; var checked = obj.elem.checked ? 1 : 2; - MgrUser.changeUserStatus(userId, checked); + OrganizationUser.changeUserStatus(userId, checked); }); -}); - -$(function () { - var panehHidden = false; - if ($(this).width() < 769) { - panehHidden = true; - } - $('#myContiner').layout({initClosed: panehHidden, west__size: 260}); }); \ No newline at end of file diff --git a/src/main/webapp/assets/modular/system/user/user_chpwd.js b/src/main/webapp/assets/modular/system/user/user_chpwd.js deleted file mode 100644 index ba83b759..00000000 --- a/src/main/webapp/assets/modular/system/user/user_chpwd.js +++ /dev/null @@ -1,74 +0,0 @@ -/** - * 用户详情对话框(可用于添加和修改对话框) - */ -var UserPwdPage = { - data: { - oldPassword: "", - newPassword: "", - repeatPassword: "" - } -}; - -/** - * 重置输入框 - */ -UserPwdPage.reset = function () { - UserPwdPage.data.oldPassword = ""; - UserPwdPage.data.newPassword = ""; - UserPwdPage.data.repeatPassword = ""; -}; - -/** - * 验证表单 - */ -UserPwdPage.validateForm = function () { - - var data = UserPwdPage.data; - - if (!data.oldPassword) { - return "请输入旧密码"; - } - if (!data.newPassword) { - return "请输入新密码"; - } - if (!(data.newPassword === data.repeatPassword)) { - return "两次密码输入不一致"; - } - - return true; -}; - -/** - * 修改密码 - */ -UserPwdPage.chPwd = function () { - var ajax = new $ax(Feng.ctxPath + "/mgr/changePwd", function (data) { - Feng.success("修改成功!"); - }, function (data) { - Feng.error("修改失败!" + data.responseJSON.message + "!"); - }); - ajax.setData(UserPwdPage.data); - ajax.start(); -}; - -$(function () { - - UserPwdPage.app = new Vue({ - el: '#passwordForm', - data: UserPwdPage.data, - methods: { - ensure: function () { - var validateForm = UserPwdPage.validateForm(); - if (validateForm === true) { - UserPwdPage.chPwd(); - } else { - Feng.alert(validateForm); - } - }, - reset: function () { - UserPwdPage.reset(); - } - } - }); - -}); diff --git a/src/main/webapp/pages/index.html b/src/main/webapp/pages/index.html index e7d9e2ff..0038fb09 100644 --- a/src/main/webapp/pages/index.html +++ b/src/main/webapp/pages/index.html @@ -1,6 +1,5 @@ - @@ -9,12 +8,13 @@ ${constants.getSystemName()} + - -
- @include("/layout/_header.html"){} @@ -29,10 +29,10 @@
- + @include("/layout/loading.html"){} -@/* 加入contextPath属性和session超时的配置 */ + - -@/* js和业务用的js数组 */ - + @if(isNotEmpty(plugins)){ + @if(array.contain(plugins,"ztree")){ - - + + + @} + @if(array.contain(plugins,"ue")){ + + + + @} + @if(array.contain(plugins,"tinymce")){ + + @} + @if(array.contain(plugins,"pinyin")){ + @} @} + @if(isNotEmpty(js)){ @for(item in js){ @if(strutil.startWith(item,"/")){ diff --git a/src/main/webapp/pages/layout/_footer.html b/src/main/webapp/pages/layout/_footer.html index 0165fac0..a7ebb80c 100644 --- a/src/main/webapp/pages/layout/_footer.html +++ b/src/main/webapp/pages/layout/_footer.html @@ -1,8 +1,5 @@ -@/* 页脚 */ - - -@/* 手机屏幕遮罩层 */ -
\ No newline at end of file +@/* 底部 */ + \ No newline at end of file diff --git a/src/main/webapp/pages/layout/_form.html b/src/main/webapp/pages/layout/_form.html index 9112758a..0030f480 100644 --- a/src/main/webapp/pages/layout/_form.html +++ b/src/main/webapp/pages/layout/_form.html @@ -16,19 +16,26 @@ + ${title!"管理系统"} - + + + - + @if(isNotEmpty(plugins)){ + @if(array.contain(plugins,"ztree")){ - + @} @} - @/* 其他业务用的css */ + @if(isNotEmpty(css)){ @for(item in css){ @if(strutil.startWith(item,"/")){ @@ -41,43 +48,41 @@ -@/* 页面加载loading */ -@ include("/layout/loading.html"){} - -@/* 正文 */ + ${layoutContent} + -@/* 加入contextPath属性和session超时的配置 */ + - -@/* js和业务用的js数组 */ @if(isNotEmpty(plugins)){ + @if(array.contain(plugins,"ztree")){ - - + + @} @if(array.contain(plugins,"ue")){ - - - + + + @} @if(array.contain(plugins,"tinymce")){ - + @} @if(array.contain(plugins,"pinyin")){ - + @} @} + @if(isNotEmpty(js)){ @for(item in js){ @if(strutil.startWith(item,"/")){ diff --git a/src/main/webapp/pages/layout/_header.html b/src/main/webapp/pages/layout/_header.html index b7478d0b..2b841e91 100644 --- a/src/main/webapp/pages/layout/_header.html +++ b/src/main/webapp/pages/layout/_header.html @@ -1,4 +1,4 @@ -@/* 框架顶部 */ +@/* 头部 */