From 99b0ac99d6bf44a47c41545abc05756bb1ccdea0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E9=94=A6=E5=B3=B0?= <498533950@qq,com> Date: Fri, 19 Mar 2021 00:00:53 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=87=8C=E9=9D=A2=E7=9A=84=E6=9C=BA=E6=9E=84=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=9A=201.=E4=B8=8D=E8=83=BD=E9=80=89=E6=8B=A9=E8=87=AA?= =?UTF-8?q?=E5=B7=B1=E6=9C=BA=E6=9E=84=E4=BD=9C=E4=B8=BA=E4=B8=8A=E7=BA=A7?= =?UTF-8?q?=E6=9C=BA=E6=9E=84=202.=E9=A1=B6=E7=BA=A7=E7=9A=84=E8=AF=9D?= =?UTF-8?q?=E4=B8=8D=E9=9C=80=E8=A6=81=E9=80=89=E6=8B=A9=E4=B8=8A=E7=BA=A7?= =?UTF-8?q?=E6=9C=BA=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/organization/organization_edit.js | 17 ++++++++++++++--- .../system/organization/organization_edit.html | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/main/webapp/assets/modular/system/organization/organization_edit.js b/src/main/webapp/assets/modular/system/organization/organization_edit.js index aef0c5eb..cb8c6059 100644 --- a/src/main/webapp/assets/modular/system/organization/organization_edit.js +++ b/src/main/webapp/assets/modular/system/organization/organization_edit.js @@ -14,7 +14,6 @@ layui.use(['form', 'admin', 'HttpRequest', 'xmSelect'], function () { // 初始化组织树 new HttpRequest(Feng.ctxPath + "/hrOrganization/treeLayui", 'get', function (data) { - console.log(result.data); organizationXmSel = xmSelect.render({ el: '#organization', data: data.data, @@ -33,11 +32,23 @@ layui.use(['form', 'admin', 'HttpRequest', 'xmSelect'], function () { }); }).start(); + var pId = organizationXmSel.getValue('valueStr'); + if (!pId) { + $("#parentId").remove(); + } + //表单提交事件 form.on('submit(btnSubmit)', function (data) { //获取机构id - data.field.orgParentId = organizationXmSel.getValue('valueStr'); - + if (!pId) { + data.field.orgParentId = "-1"; + }else { + data.field.orgParentId = organizationXmSel.getValue('valueStr'); + } + var orgId = $("[name = 'orgId']").val(); + if (orgId == data.field.orgParentId) { + return Feng.error("不能选择本机构作为上级机构!"); + } var request = new HttpRequest(Feng.ctxPath + "/hrOrganization/edit", 'post', function (data) { admin.closeThisDialog(); Feng.success("修改成功!"); diff --git a/src/main/webapp/pages/modular/system/organization/organization_edit.html b/src/main/webapp/pages/modular/system/organization/organization_edit.html index d85ae23e..784441d2 100644 --- a/src/main/webapp/pages/modular/system/organization/organization_edit.html +++ b/src/main/webapp/pages/modular/system/organization/organization_edit.html @@ -7,7 +7,7 @@
-
+
From 92ed0a5020611148d6fcc636abce6b7177f64e37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E9=94=A6=E5=B3=B0?= <498533950@qq,com> Date: Thu, 25 Mar 2021 09:27:16 +0800 Subject: [PATCH 2/2] =?UTF-8?q?1=E3=80=81=E6=96=B0=E5=A2=9E=E5=B8=90?= =?UTF-8?q?=E5=8F=B7=E7=9A=84=E6=97=B6=E5=80=99=E4=B8=80=E4=BA=9B=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E9=9D=9E=E5=BF=85=E5=A1=AB=E5=8F=8A=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=E7=9A=84=E9=AA=8C=E8=AF=81=E6=96=B9=E5=BC=8F=E7=9A=84=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=202=E3=80=81=E5=B8=90=E5=8F=B7=E5=88=B7=E8=A1=A8?= =?UTF-8?q?=E7=9A=84=E8=81=8C=E4=BD=8D=E7=9A=84=E6=98=BE=E7=A4=BA=203?= =?UTF-8?q?=E3=80=81=E6=9C=BA=E6=9E=84=E9=87=8C=E7=9A=84=E8=81=8C=E4=BD=8D?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E9=9D=9E=E5=BF=85=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../db/migration/V1.0_20210214_1017__init.sql | 2 +- .../webapp/assets/modular/system/user/user.js | 2 +- .../assets/modular/system/user/user_add.js | 3 +- .../assets/modular/system/user/user_edit.js | 28 +++++++++++++------ .../pages/modular/system/user/user_add.html | 25 ++++++++++------- .../pages/modular/system/user/user_edit.html | 24 ++++++++++------ 6 files changed, 52 insertions(+), 32 deletions(-) diff --git a/src/main/resources/db/migration/V1.0_20210214_1017__init.sql b/src/main/resources/db/migration/V1.0_20210214_1017__init.sql index eabc5a0d..d60b4f9b 100644 --- a/src/main/resources/db/migration/V1.0_20210214_1017__init.sql +++ b/src/main/resources/db/migration/V1.0_20210214_1017__init.sql @@ -1380,7 +1380,7 @@ CREATE TABLE `sys_user_org` ( `user_org_id` bigint(20) NOT NULL COMMENT '企业员工主键id', `user_id` bigint(20) NOT NULL COMMENT '用户id', `org_id` bigint(20) NOT NULL COMMENT '所属机构id', - `position_id` bigint(20) NOT NULL COMMENT '职位id', + `position_id` bigint(20) NULL COMMENT '职位id', `create_time` datetime(0) NULL DEFAULT NULL COMMENT '添加时间', `create_user` bigint(20) NULL DEFAULT NULL COMMENT '添加人', `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', diff --git a/src/main/webapp/assets/modular/system/user/user.js b/src/main/webapp/assets/modular/system/user/user.js index 26c5c641..60bd87c5 100644 --- a/src/main/webapp/assets/modular/system/user/user.js +++ b/src/main/webapp/assets/modular/system/user/user.js @@ -174,7 +174,7 @@ layui.use(['layer', 'form', 'table', 'util', 'admin', 'tree', 'dropdown', 'xmSel {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: 'positionName', align: "center", sort: true, title: '职务'}, {field: 'phone', align: "center", sort: true, title: '电话'}, {field: 'status', align: "center", templet: '#statusTpl', title: '状态'}, {title: '操作', toolbar: '#userTbBar', width: 300} diff --git a/src/main/webapp/assets/modular/system/user/user_add.js b/src/main/webapp/assets/modular/system/user/user_add.js index 4f3865cb..12d181d8 100644 --- a/src/main/webapp/assets/modular/system/user/user_add.js +++ b/src/main/webapp/assets/modular/system/user/user_add.js @@ -31,7 +31,6 @@ layui.use(['layer', 'form', 'admin', 'laydate', 'HttpRequest', 'xmSelect'], func positionXmSel = xmSelect.render({ el: '#position', radio: true, - layVerify: 'required', clickClose: true, data: data.data }); @@ -65,10 +64,10 @@ layui.use(['layer', 'form', 'admin', 'laydate', 'HttpRequest', 'xmSelect'], func Feng.success("添加成功!"); admin.putTempData('formOk', true); }, function (data) { - admin.closeThisDialog(); Feng.error("添加失败!" + data.message); }); request.set(data.field); request.start(true); + return false; }); }); diff --git a/src/main/webapp/assets/modular/system/user/user_edit.js b/src/main/webapp/assets/modular/system/user/user_edit.js index 056d7a94..b325e1d4 100644 --- a/src/main/webapp/assets/modular/system/user/user_edit.js +++ b/src/main/webapp/assets/modular/system/user/user_edit.js @@ -15,14 +15,24 @@ layui.use(['layer', 'form', 'admin', 'laydate', 'HttpRequest', 'xmSelect'], func // 初始化职位 new HttpRequest(Feng.ctxPath + "/hrPosition/list", 'get', function (data) { - positionXmSel = xmSelect.render({ - el: '#position', - radio: true, - clickClose: true, - layVerify: 'required', - data: data.data, - initValue: [result.data.positionId] - }); + let positionId = result.data.positionId; + if (positionId) { + positionXmSel = xmSelect.render({ + el: '#position', + radio: true, + clickClose: true, + data: data.data, + initValue: [positionId] + }); + } else { + positionXmSel = xmSelect.render({ + el: '#position', + radio: true, + clickClose: true, + data: data.data, + }); + } + }).start(); // 初始化组织树 @@ -71,11 +81,11 @@ layui.use(['layer', 'form', 'admin', 'laydate', 'HttpRequest', 'xmSelect'], func Feng.success("修改成功!"); admin.putTempData('formOk', true); }, function (data) { - admin.closeThisDialog(); Feng.error("修改失败!" + data.message); }); request.set(data.field); request.start(true); + return false; }); diff --git a/src/main/webapp/pages/modular/system/user/user_add.html b/src/main/webapp/pages/modular/system/user/user_add.html index 2c2d7864..7a4bc378 100644 --- a/src/main/webapp/pages/modular/system/user/user_add.html +++ b/src/main/webapp/pages/modular/system/user/user_add.html @@ -33,9 +33,9 @@
- +
- +
@@ -45,23 +45,28 @@
- +
- +
- +
- +
-
- +
- + +
+
+
+ +
+
@@ -78,7 +83,7 @@
- +
diff --git a/src/main/webapp/pages/modular/system/user/user_edit.html b/src/main/webapp/pages/modular/system/user/user_edit.html index 39c05be1..3189c170 100644 --- a/src/main/webapp/pages/modular/system/user/user_edit.html +++ b/src/main/webapp/pages/modular/system/user/user_edit.html @@ -17,9 +17,9 @@
- +
- +
@@ -29,22 +29,28 @@
- +
- +
- +
- +
- +
- + +
+
+
+ +
+
@@ -61,7 +67,7 @@
- +