From 1a78b34d3112f558d69bf7fa5256d01467edd970 Mon Sep 17 00:00:00 2001
From: chenjinlong <22208488@qq.com>
Date: Mon, 25 Jan 2021 11:03:20 +0800
Subject: [PATCH 1/9] =?UTF-8?q?=E3=80=90organization.js=E3=80=91=E4=BF=AE?=
=?UTF-8?q?=E5=A4=8D=E5=88=A0=E9=99=A4=E4=B8=8D=E5=88=B7=E6=96=B0=E6=A0=91?=
=?UTF-8?q?BUG?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../assets/modular/system/organization/organization.js | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/main/webapp/assets/modular/system/organization/organization.js b/src/main/webapp/assets/modular/system/organization/organization.js
index 183bc4d6..c5c12696 100644
--- a/src/main/webapp/assets/modular/system/organization/organization.js
+++ b/src/main/webapp/assets/modular/system/organization/organization.js
@@ -36,7 +36,10 @@ layui.use(['layer', 'form', 'table', 'util', 'admin', 'tree', 'dropdown', 'xmSel
height: 800,
title: '修改机构',
content: Feng.ctxPath + '/view/organization/editView?orgId=' + data.id,
- tableId: Organization.tableId
+ tableId: Organization.tableId,
+ endCallback: function () {
+ renderTree();
+ }
});
};
@@ -45,7 +48,10 @@ layui.use(['layer', 'form', 'table', 'util', 'admin', 'tree', 'dropdown', 'xmSel
var operation = function () {
var httpRequest = new HttpRequest(Feng.ctxPath + "/hrOrganization/delete", 'post', function (data) {
Feng.success("删除成功!");
+ //刷新表格
table.reload(Organization.tableId);
+ //刷新树
+ renderTree();
}, function (data) {
Feng.error("删除失败!" + data.message + "!");
});
@@ -66,8 +72,6 @@ layui.use(['layer', 'form', 'table', 'util', 'admin', 'tree', 'dropdown', 'xmSel
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},
From b897ccd5260cca97ddc769b59da3af27dfecc85b Mon Sep 17 00:00:00 2001
From: chenjinlong <22208488@qq.com>
Date: Mon, 25 Jan 2021 11:04:18 +0800
Subject: [PATCH 2/9] =?UTF-8?q?=E3=80=90user=E3=80=91=E5=A2=9E=E5=8A=A0?=
=?UTF-8?q?=E5=B7=A6=E4=BE=A7=E6=9C=BA=E6=9E=84=E6=A0=91=E7=9A=84=E7=AE=A1?=
=?UTF-8?q?=E7=90=86=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../webapp/assets/modular/system/user/user.js | 68 +++++++++++++++++++
.../pages/modular/system/user/user.html | 8 ++-
2 files changed, 74 insertions(+), 2 deletions(-)
diff --git a/src/main/webapp/assets/modular/system/user/user.js b/src/main/webapp/assets/modular/system/user/user.js
index cff840d0..a1fec553 100644
--- a/src/main/webapp/assets/modular/system/user/user.js
+++ b/src/main/webapp/assets/modular/system/user/user.js
@@ -17,6 +17,55 @@ layui.use(['layer', 'form', 'table', 'util', 'admin', 'tree', 'dropdown', 'xmSel
tableId: "userTable", //表格id
};
+
+ var Organization = {
+
+ };
+
+
+ /* 点击新增对话框 */
+ Organization.openAddDlg = function () {
+ func.open({
+ height: 800,
+ title: '添加机构',
+ content: Feng.ctxPath + '/view/organization/addView',
+ tableId: OrganizationUser.tableId,
+ endCallback: function () {
+ renderTree();
+ }
+ });
+ };
+
+ /* 点击编辑对话框 */
+ Organization.openEditDlg = function (data) {
+ func.open({
+ height: 800,
+ title: '修改机构',
+ content: Feng.ctxPath + '/view/organization/editView?orgId=' + data.id,
+ tableId: OrganizationUser.tableId,
+ endCallback: function () {
+ renderTree();
+ }
+ });
+ };
+
+ /* 点击删除 */
+ Organization.delete = function (data) {
+ var operation = function () {
+ var httpRequest = new HttpRequest(Feng.ctxPath + "/hrOrganization/delete", 'post', function (data) {
+ Feng.success("删除成功!");
+ table.reload(OrganizationUser.tableId);
+ //刷新树
+ renderTree();
+ }, function (data) {
+ Feng.error("删除失败!" + data.message + "!");
+ });
+ httpRequest.set(data);
+ httpRequest.start(true);
+ };
+ Feng.confirm("是否删除?", operation);
+ };
+
/* 点击新增对话框 */
OrganizationUser.openAddDlg = function () {
func.open({
@@ -152,6 +201,25 @@ layui.use(['layer', 'form', 'table', 'util', 'admin', 'tree', 'dropdown', 'xmSel
return false;
});
+ /* 添加 */
+ $('#organizationAddBtn').click(function () {
+ Organization.openAddDlg();
+ });
+
+ /* 修改 */
+ $('#organizationEditBtn').click(function () {
+ if (!selObj) return layer.msg('未选择机构', {icon: 2});
+ Organization.openEditDlg(selObj.data)
+ });
+
+ /* 删除 */
+ $('#organizationDelBtn').click(function () {
+ if (!selObj) return layer.msg('未选择机构', {icon: 2});
+ selObj.data.orgId = selObj.data.id;
+ Organization.delete(selObj.data)
+
+ });
+
/* 表格工具条点击事件 */
table.on('tool(userTable)', function (obj) {
if (obj.event === 'edit') { // 修改
diff --git a/src/main/webapp/pages/modular/system/user/user.html b/src/main/webapp/pages/modular/system/user/user.html
index fdf85adb..e2e61445 100644
--- a/src/main/webapp/pages/modular/system/user/user.html
+++ b/src/main/webapp/pages/modular/system/user/user.html
@@ -48,11 +48,15 @@
-
+
+
From 84b76be5831f8b60fa31e84e93e444168b24d4b4 Mon Sep 17 00:00:00 2001
From: chenjinlong <22208488@qq.com>
Date: Mon, 25 Jan 2021 15:45:42 +0800
Subject: [PATCH 3/9] =?UTF-8?q?=E3=80=90common.js=E3=80=91=E5=A2=9E?=
=?UTF-8?q?=E5=8A=A0=E5=85=A8=E5=B1=80=E5=88=86=E9=A1=B5=E5=8F=82=E6=95=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/main/webapp/assets/common/js/common.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/main/webapp/assets/common/js/common.js b/src/main/webapp/assets/common/js/common.js
index 5d4eb963..9e392c75 100644
--- a/src/main/webapp/assets/common/js/common.js
+++ b/src/main/webapp/assets/common/js/common.js
@@ -11,6 +11,9 @@ Feng.parseData = function (res) {
"data": res.data.rows //解析数据列表
};
};
+/* 设置分页请求参数 */
+Feng.pageRequest = {pageName: 'pageNo', limitName: 'pageSize'};
+
Feng.info = function (info) {
top.layer.msg(info, {icon: 6});
};
From fafc516262f79b38be2d0cc6279857bddc64479b Mon Sep 17 00:00:00 2001
From: chenjinlong <22208488@qq.com>
Date: Mon, 25 Jan 2021 15:46:37 +0800
Subject: [PATCH 4/9] =?UTF-8?q?=E3=80=90config=E3=80=91=E4=BF=AE=E6=94=B9?=
=?UTF-8?q?=E7=B3=BB=E7=BB=9F=E5=8F=82=E6=95=B0=E9=85=8D=E7=BD=AE=E5=88=97?=
=?UTF-8?q?=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../system/config/ConfigViewController.java | 14 +-
.../assets/modular/system/config/config.js | 186 ++++++++++++++++++
.../modular/system/config/config_add.js | 25 +++
.../modular/system/config/sysConfig_add.js | 33 +---
.../modular/system/config/sysConfig_edit.js | 51 +----
.../pages/modular/system/config/config.html | 109 ++++++++++
.../modular/system/config/config_add.html | 57 ++++++
.../modular/system/config/sysConfig_add.html | 19 +-
.../modular/system/config/sysConfig_edit.html | 18 +-
9 files changed, 399 insertions(+), 113 deletions(-)
create mode 100644 src/main/webapp/assets/modular/system/config/config.js
create mode 100644 src/main/webapp/assets/modular/system/config/config_add.js
create mode 100644 src/main/webapp/pages/modular/system/config/config.html
create mode 100644 src/main/webapp/pages/modular/system/config/config_add.html
diff --git a/src/main/java/cn/stylefeng/guns/modular/system/config/ConfigViewController.java b/src/main/java/cn/stylefeng/guns/modular/system/config/ConfigViewController.java
index ad8a2f6e..ef87ad8d 100644
--- a/src/main/java/cn/stylefeng/guns/modular/system/config/ConfigViewController.java
+++ b/src/main/java/cn/stylefeng/guns/modular/system/config/ConfigViewController.java
@@ -22,7 +22,8 @@ public class ConfigViewController {
*/
@GetResource(name = "系统配置-列表-视图", path = "/view/config")
public String indexView() {
- return "/modular/system/config/sysConfig.html";
+ return "/modular/system/config/config.html";
+ //return "/modular/system/config/sysConfig.html";
}
/**
@@ -36,6 +37,17 @@ public class ConfigViewController {
return "/modular/system/config/sysConfig_add.html";
}
+ /**
+ * 系统配置—新增-视图
+ *
+ * @author jiawei
+ * @date 2021/1/4 13:34
+ */
+ @GetResource(name = "系统配置—新增-视图", path = "/view/config/addConfigDictView")
+ public String addConfigDictView() {
+ return "/modular/system/config/config_add.html";
+ }
+
/**
* 系统配置-修改-视图
*
diff --git a/src/main/webapp/assets/modular/system/config/config.js b/src/main/webapp/assets/modular/system/config/config.js
new file mode 100644
index 00000000..dc8a2ad0
--- /dev/null
+++ b/src/main/webapp/assets/modular/system/config/config.js
@@ -0,0 +1,186 @@
+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 (data) {
+ console.log(data);
+ func.open({
+ height: 680,
+ title: '添加系统配置',
+ content: Feng.ctxPath + '/view/config/addView?groupCode=' + data.dictCode,
+ tableId: Dict.tableId
+ });
+ };
+
+ /* 字典类型-点击编辑对话框 */
+ DictType.openEditDlg = function (data) {
+ func.open({
+ height: 680,
+ title: '修改系统配置',
+ content: Feng.ctxPath + '/view/config/editView?configId=' + data.configId,
+ tableId: Dict.tableId
+ });
+ };
+
+ /* 字典类型-点击删除 */
+ DictType.onDeleteItem = function (data) {
+ var operation = function () {
+ var httpRequest = new HttpRequest(Feng.ctxPath + "/sysConfig/delete", '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(dictTypeTbSearch)', function (data) {
+ dictTypeTable.reload({where: data.field});
+ return false;
+ });
+
+ /* 字典类型-点击表格头工具栏 */
+ table.on('toolbar(dictTypeTable)', function (obj) {
+ var data = dictTypeObj.data;
+ if (obj.event === 'add') { // 添加
+ Dict.openAddDlg();
+ } else if (obj.event === 'edit') { // 修改
+ DictType.openEditDlg(data);
+ } else if (obj.event === 'del') { // 删除
+ Dict.onDeleteItem(data);
+ }
+ });
+
+ /* 字典类型-渲染表格 */
+ var dictTypeTable = table.render({
+ elem: '#dictTypeTable',
+ url: Feng.ctxPath + '/dict/getConfigGroupPage',
+ height: 'full-100',
+ toolbar: '#dictTypeHtbBar',
+ defaultToolbar: [], //默认表格头部右侧工具栏
+ cols: [[
+ {type: 'numbers'},
+ {field: 'dictName', title: '类型'},
+ {field: 'dictCode', 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: {groupCode: obj.data.dictCode},
+ page: {curr: 1},
+ url: Feng.ctxPath + '/sysConfig/page'
+ });
+ });
+
+
+ /* 字典-点击新增对话框 */
+ Dict.openAddDlg = function (data) {
+ func.open({
+ height: 680,
+ title: '添加字典',
+ content: Feng.ctxPath + '/view/config/addConfigDictView',
+ tableId: DictType.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(DictType.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') { // 修改
+ DictType.openEditDlg(data);
+ } else if (obj.event === 'del') { // 删除
+ DictType.onDeleteItem(data);
+ }
+ });
+
+ // 添加按钮点击事件
+ $('#btnAdd').click(function () {
+ console.log(dictTypeObj.data);
+ DictType.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: 'configId', hide: true, title: '主键'},
+ {field: 'configName', sort: true, align: "center", title: '名称'},
+ {field: 'configCode', sort: true, align: "center", title: '属性编码'},
+ {field: 'configValue', sort: true, align: "center", title: '属性值'},
+ {field: 'remark', sort: true, align: "center", title: '备注'},
+ {align: 'center', toolbar: '#dictTbBar', title: '操作'}
+ ]],
+ parseData: Feng.parseData,
+ request: Feng.pageRequest
+ });
+});
\ No newline at end of file
diff --git a/src/main/webapp/assets/modular/system/config/config_add.js b/src/main/webapp/assets/modular/system/config/config_add.js
new file mode 100644
index 00000000..340f4847
--- /dev/null
+++ b/src/main/webapp/assets/modular/system/config/config_add.js
@@ -0,0 +1,25 @@
+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/getConfigDictTypeDetail', '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) {
+ admin.closeThisDialog();
+ Feng.success("添加成功!");
+ admin.putTempData('formOk', true);
+ }, function (data) {
+ admin.closeThisDialog();
+ Feng.error("添加失败!" + data.message);
+ });
+ request.set(data.field);
+ request.start(true);
+ });
+});
\ No newline at end of file
diff --git a/src/main/webapp/assets/modular/system/config/sysConfig_add.js b/src/main/webapp/assets/modular/system/config/sysConfig_add.js
index 38a8f54d..78cb7cc4 100644
--- a/src/main/webapp/assets/modular/system/config/sysConfig_add.js
+++ b/src/main/webapp/assets/modular/system/config/sysConfig_add.js
@@ -1,39 +1,14 @@
-/**
- * 修改
- */
-var SysConfigInfoDlg = {
- data: {}
-};
-
layui.use(['form', 'admin', 'HttpRequest'], function () {
var $ = layui.jquery;
var form = layui.form;
var admin = layui.admin;
var HttpRequest = layui.HttpRequest;
- // 初始化所属分类字典下拉
- var activeDictSelect = function () {
- $("#groupCode").html('
');
-
- //要删掉
- $("#groupCode").append('
');
-
- form.render();
- };
+ $("#groupCode").val(Feng.getUrlParam("groupCode"));
//表单提交事件
form.on('submit(btnSubmit)', function (data) {
-
- SysConfigInfoDlg.data = $.extend({"sysFlag": data.field.sysFlag ? data.field.sysFlag : 'N'}, data.field)
-
- var groupCode = $("#groupCode").find("option:selected").val()
- if (!groupCode) {
- Feng.error("所属分类不能为空")
- return false;
- }
- SysConfigInfoDlg.data = $.extend({"groupCode": groupCode}, data.field)
-
var httpRequest = new HttpRequest(Feng.ctxPath + "/sysConfig/add", 'post', function (data) {
admin.closeThisDialog();
Feng.success("添加成功!");
@@ -42,11 +17,7 @@ layui.use(['form', 'admin', 'HttpRequest'], function () {
admin.closeThisDialog();
Feng.error("添加失败!" + data.message)
});
- httpRequest.set(SysConfigInfoDlg.data);
+ httpRequest.set(data.field);
httpRequest.start(true);
});
-
- // 常量所属分类动态赋值
- activeDictSelect();
-
});
diff --git a/src/main/webapp/assets/modular/system/config/sysConfig_edit.js b/src/main/webapp/assets/modular/system/config/sysConfig_edit.js
index 5a1c35f4..dbc8e929 100644
--- a/src/main/webapp/assets/modular/system/config/sysConfig_edit.js
+++ b/src/main/webapp/assets/modular/system/config/sysConfig_edit.js
@@ -1,15 +1,7 @@
-/**
- * 详情对话框
- */
-var SysConfigInfoDlg = {
- data: {}
-};
-
-layui.use(['form', 'admin', 'selectPlus', 'HttpRequest'], function () {
+layui.use(['form', 'admin', 'HttpRequest'], function () {
var $ = layui.jquery;
var form = layui.form;
var admin = layui.admin;
- var selectPlus = layui.selectPlus;
var HttpRequest = layui.HttpRequest;
// 获取详情信息,填充表单
@@ -18,45 +10,9 @@ layui.use(['form', 'admin', 'selectPlus', 'HttpRequest'], function () {
form.val('sysConfigForm', result.data);
- // 系统参数样式
- if (result.data) {
- var mData = result.data;
- if (mData.sysFlag == 'Y') {
- $('input[name="sysFlag"]').attr('checked', 'checked'); //改变开关为 开
- } else {
- $('input[name="sysFlag"]').removeAttr('checked'); //改变开关为 关
- }
- /*改变是否系统参数样式*/
- $("input[name='sysFlag']").attr("disabled", "true");
- form.render(); //系统参数禁用
- $("input[name='sysFlag']").next().removeClass("layui-form-onswitch"); // 系统参数去掉样式
- }
-
- // 初始化所属分类字典下拉
- var activeDictSelect = function () {
-
- $("#groupCode").html('
');
-
- //要删掉
- $("#groupCode").append('
');
- $("#groupCode").val(result.data.groupCode);
- form.render();
-
- };
-
//表单提交事件
form.on('submit(btnSubmit)', function (data) {
-
- SysConfigInfoDlg.data = $.extend({"sysFlag": data.field.sysFlag ? data.field.sysFlag : 'N'}, data.field)
-
- var groupCode = $("#groupCode").find("option:selected").val()
- if (!groupCode) {
- Feng.error("所属分类不能为空")
- return false;
- }
- SysConfigInfoDlg.data = $.extend({"groupCode": groupCode}, data.field)
-
var httpRequest = new HttpRequest(Feng.ctxPath + "/sysConfig/edit", 'post', function (data) {
admin.closeThisDialog();
Feng.success("修改成功!");
@@ -65,11 +21,8 @@ layui.use(['form', 'admin', 'selectPlus', 'HttpRequest'], function () {
admin.closeThisDialog();
Feng.error("修改失败!" + data.message)
});
- httpRequest.set(SysConfigInfoDlg.data);
+ httpRequest.set(data.field);
httpRequest.start(true);
});
- // 常量所属分类动态赋值
- activeDictSelect();
-
});
diff --git a/src/main/webapp/pages/modular/system/config/config.html b/src/main/webapp/pages/modular/system/config/config.html
new file mode 100644
index 00000000..49ebdb68
--- /dev/null
+++ b/src/main/webapp/pages/modular/system/config/config.html
@@ -0,0 +1,109 @@
+@layout("/layout/_container.html",{js:["/assets/modular/system/config/config.js"]}){
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+@}
\ No newline at end of file
diff --git a/src/main/webapp/pages/modular/system/config/config_add.html b/src/main/webapp/pages/modular/system/config/config_add.html
new file mode 100644
index 00000000..c4d48a3e
--- /dev/null
+++ b/src/main/webapp/pages/modular/system/config/config_add.html
@@ -0,0 +1,57 @@
+@layout("/layout/_form.html",{js:["/assets/modular/system/config/config_add.js"]}){
+
+
+
+@}
\ No newline at end of file
diff --git a/src/main/webapp/pages/modular/system/config/sysConfig_add.html b/src/main/webapp/pages/modular/system/config/sysConfig_add.html
index 232372b2..d4cf0962 100644
--- a/src/main/webapp/pages/modular/system/config/sysConfig_add.html
+++ b/src/main/webapp/pages/modular/system/config/sysConfig_add.html
@@ -2,42 +2,27 @@