From cf106d6859b7c8bce45b6c8aba97986e232af3c1 Mon Sep 17 00:00:00 2001 From: erdanergou Date: Thu, 1 Jun 2023 09:10:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=84=E5=90=88=E5=87=BA?= =?UTF-8?q?=E5=BA=93=E6=B7=BB=E5=8A=A0=E4=BB=A3=E9=A2=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application-out.html | 2 +- .../application-out_back.html | 1 + .../applicationOutForGroup.html | 288 ++++++++++++------ .../templates/pages/post/selectPost.html | 10 +- 4 files changed, 198 insertions(+), 103 deletions(-) diff --git a/src/main/resources/templates/pages/applicationForStorageCenter/application-out.html b/src/main/resources/templates/pages/applicationForStorageCenter/application-out.html index 65d54623..3a2cbcd3 100644 --- a/src/main/resources/templates/pages/applicationForStorageCenter/application-out.html +++ b/src/main/resources/templates/pages/applicationForStorageCenter/application-out.html @@ -558,7 +558,7 @@ }); selectPost = function (obj) { - let id = obj.id; + let id = obj.target.id; layer.open({ type: 2, title: '弹窗内容', diff --git a/src/main/resources/templates/pages/applicationForStorageCenter/application-out_back.html b/src/main/resources/templates/pages/applicationForStorageCenter/application-out_back.html index 60e5fda8..7d14cf0d 100644 --- a/src/main/resources/templates/pages/applicationForStorageCenter/application-out_back.html +++ b/src/main/resources/templates/pages/applicationForStorageCenter/application-out_back.html @@ -468,6 +468,7 @@ }] }); + $("#openCompanyAdminorg").on('click', selectPost); // 监听开关 form.on('switch()', function (data) { let isAgency = data.elem.checked; //开关是否开启,true或者false diff --git a/src/main/resources/templates/pages/applicationForStorageCenter/applicationOutForGroup.html b/src/main/resources/templates/pages/applicationForStorageCenter/applicationOutForGroup.html index 31d6c21b..5bedb14a 100644 --- a/src/main/resources/templates/pages/applicationForStorageCenter/applicationOutForGroup.html +++ b/src/main/resources/templates/pages/applicationForStorageCenter/applicationOutForGroup.html @@ -58,6 +58,58 @@
+ +
+
+ +
+ +
+
+ +
+ +
+ +
+ + +
+
+
+ +
+ + +
+
+
@@ -126,6 +178,10 @@ function selectCodeForGroup(obj) { } + function selectPost(obj) { + + } + // 用于标志是否为第一次提交 let flagForForm = false; @@ -152,6 +208,53 @@ }] }); + selectPost = function (obj) { + let id = obj.target.id; + layer.open({ + type: 2, + title: '弹窗内容', + skin: 'layui-layer-rim', + maxmin: true, + shadeClose: true, //点击遮罩关闭层 + area: ['70%', '70%'], + content: '/selectPost?id=' + id, + move: '.layui-layer-title', + fixed: false, + success: function (layero, index) { + var children = layero.children(); + var content = $(children[1]); + var iframeChildren = $(content.children()); + content.css('height', '100%'); + iframeChildren.css('height', '100%'); + } + }); + }; + + $("#openCompanyAdminorgForGroup").on('click', selectPost); + + + // 监听开关 + form.on('switch()', function (data) { + let isAgency = data.elem.checked; //开关是否开启,true或者false + let id = data.elem.id; + if (isAgency) { + // 如果开启了代领功能 + $("#agencyItem" + id).show(); + // 添加必填 + $("#agencyUid" + id).attr("lay-verify", "required"); + + $("#openCompanyAdminorg" + id).off("click"); + + } else { + $("#agencyItem" + id).hide(); + // 删除必填 + $("#agencyUid" + id).removeAttr("lay-verify"); + + $("#openCompanyAdminorg" + id).on('click', selectPost); + + } + }); + // 提交(组合出库) form.on('submit(formStep2)', function (data) { @@ -193,7 +296,7 @@ success: function (d) { layer.close(this.layerIndex); if (d.status >= 300) { - layer.msg(d.statusInfo.detail,{icon:0,time:500},function () { + layer.msg(d.statusInfo.detail, {icon: 0, time: 500}, function () { flagForForm = false; });//失败的表情 @@ -375,39 +478,7 @@ required lay-verify="number" onblur="groupQuantityIsTrue(this)" placeholder="请填写组合数量"/>
-
- -
- - -
-
-
- -
- - -
-
-
- -
- -
-
+ @@ -474,39 +545,6 @@ required lay-verify="number" onblur="groupQuantityIsTrue(this)" placeholder="请填写组合数量"/>
-
- -
- - -
-
-
- -
- - -
-
-
- -
- -
-
@@ -537,8 +575,8 @@ let gnameItem = gnameParent.childNodes[1].childNodes[1]; let req = {}; req.code = code; - if(code !== ""){ - let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); + if (code !== "") { + let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); $.ajax({ url: "/group/findGroupByCode", type: "post", @@ -631,7 +669,7 @@ if (gid !== '') { let req = {}; req.gid = gid; - let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); + let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); $.ajax({ url: "/group/findGroupInfoByGid", data: JSON.stringify(req), @@ -702,7 +740,7 @@ var req = {}; req.gname = gname; - let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); + let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); $.ajax({ url: "/group/findGroupByGname", @@ -795,7 +833,7 @@ var req = {}; req.gid = gid; req.quantity = val; - let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); + let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); $.ajax({ url: "/group/groupQuantityIsTrue", type: "post", @@ -814,7 +852,7 @@ layer.close(loading2); }); - }else{ + } else { layer.close(loading2); } } @@ -850,27 +888,6 @@ return result; } - selectPost = function (obj) { - let id = obj.id; - layer.open({ - type: 2, - title: '弹窗内容', - skin: 'layui-layer-rim', - maxmin: true, - shadeClose: true, //点击遮罩关闭层 - area: ['70%', '70%'], - content: '/selectPost?id=' + id, - move: '.layui-layer-title', - fixed: false, - success: function (layero, index) { - var children = layero.children(); - var content = $(children[1]); - var iframeChildren = $(content.children()); - content.css('height', '100%'); - iframeChildren.css('height', '100%'); - } - }); - }; selectConstructionUnit = function (obj) { let id = obj.id; @@ -894,10 +911,87 @@ }); }; + // 用于选择代领用户 + selectUser = function (obj) { + let id = obj.id; + if (id.indexOf("ForGroup") !== -1) { + id = "ForGroup"; + } + let name = obj.value; + if (name !== "") { + let req = {}; + req.name = name; + req.scope = "department"; + $.ajax({ + url: "/sys/findUserByName", + type: "post", + data: JSON.stringify(req), + dataType: 'json', + contentType: "application/json;charset=utf-8", + beforeSend: function () { + this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); + }, + success: function (res) { + layer.close(this.layerIndex); + let data = res.data; + let count = res.count; + if (count === 0) { + layer.msg("部门中不存在该用户,请重试", { + icon: 0, + time: 1000 + }, function () { + $("#adminorgId" + id).val(""); + $("#agencyAdminorg" + id).val(""); + $("#agencyUid" + id).val(""); + $("#agencyUser" + id).val(""); + }) + } else if (count > 1) { + + let content = ``; + $.each(data, function (index, item) { + let listItem = `
+ +
`; + content += listItem; + }); + selectUserIfame = layer.open({ + type: 1, + title: false, + area: ["70%", "70%"], + content: content + }) + } else { + let user = data[0]; + $("#adminorgId" + id).val(user.maindeparment); + $("#openCompanyAdminorg" + id).val(user.maindeparmentname); + $("#agencyUid" + id).val(user.id); + $("#agencyUser" + id).val(user.name); + } + } + }) + } + }; + + // 用于选定人员 + SelectTheUser = function (obj) { + let data = $(obj); + let isGroup = data.attr("isGroup"); + if (isGroup !== "ForGroup") { + isGroup = ""; + } + + let adminorg = data.attr("adminorg"); + let adminorgName = data.attr("adminorgname"); + let id = data.attr("id"); + let name = data.attr("name"); + $("#adminorgId" + isGroup).val(adminorg); + $("#openCompanyAdminorg" + isGroup).val(adminorgName); + $("#agencyUid" + isGroup).val(id); + $("#agencyUser" + isGroup).val(name); + layer.close(selectUserIfame) + }; + - $('body').on('click', '[data-refresh]', function () { - location.reload(); - }) }) diff --git a/src/main/resources/templates/pages/post/selectPost.html b/src/main/resources/templates/pages/post/selectPost.html index 5a1a879a..20377044 100644 --- a/src/main/resources/templates/pages/post/selectPost.html +++ b/src/main/resources/templates/pages/post/selectPost.html @@ -27,11 +27,11 @@ let id = $("#id").val(); let idNumber = id.replace(/[^\d]/g, ""); if (id.indexOf("Group") !== -1) { - $("#adminorgIdForGroup"+idNumber, window.parent.document).val(data.id); - $("#openCompanyAdminorgForGroup"+idNumber, window.parent.document).val(data.title); - }else{ - $("#adminorgId"+idNumber, window.parent.document).val(data.id); - $("#openCompanyAdminorg"+idNumber, window.parent.document).val(data.title); + $("#adminorgIdForGroup" + idNumber, window.parent.document).val(data.id); + $("#openCompanyAdminorgForGroup" + idNumber, window.parent.document).val(data.title); + } else { + $("#adminorgId" + idNumber, window.parent.document).val(data.id); + $("#openCompanyAdminorg" + idNumber, window.parent.document).val(data.title); } var index = parent.layer.getFrameIndex(window.name); parent.layer.close(index);