From ce9175f83e2a61adcd6292f7855742a23fbabd79 Mon Sep 17 00:00:00 2001 From: erdanergou Date: Wed, 31 May 2023 14:58:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=AE=A1=E7=90=86=E5=91=98?= =?UTF-8?q?=E7=BA=A7=E5=88=AB=E7=9A=84=E5=87=BA=E5=BA=93=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/QyWxOperationService.java | 7 +- .../pages/application/application-out.html | 5 + .../application/application-out_back.html | 141 ++++++++++++- .../application-out.html | 182 +++++++++++++--- .../application-out_back.html | 199 ++++++++++++++---- 5 files changed, 464 insertions(+), 70 deletions(-) diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java index d576a8c6..c346e808 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java @@ -1491,7 +1491,12 @@ public class QyWxOperationService { Map members_initiator = new HashMap<>(); Map contact_user = new HashMap<>(); List> membersMap_initiator = new ArrayList<>(); - contact_user.put("userid", workwechat); + // 获取发起的userId + String workwechatForCreateUser = userToken.getWorkwechat(); + if (workwechatForCreateUser == null || "".equals(workwechatForCreateUser)) { + workwechatForCreateUser = userToken.getWechat(); + } + contact_user.put("userid", workwechatForCreateUser); contact_user.put("name", userToken.getName()); membersMap_initiator.add(contact_user); members_initiator.put("members", membersMap_initiator); diff --git a/src/main/resources/templates/pages/application/application-out.html b/src/main/resources/templates/pages/application/application-out.html index 53b6911b..302841d5 100644 --- a/src/main/resources/templates/pages/application/application-out.html +++ b/src/main/resources/templates/pages/application/application-out.html @@ -1803,6 +1803,11 @@ layer.msg("部门中不存在该用户,请重试", { icon: 0, time: 1000 + },function () { + $("#adminorgId").val(""); + $("#agencyAdminorg").val(""); + $("#agencyUid").val(""); + $("#agencyUser").val(""); }) } else if (count > 1) { diff --git a/src/main/resources/templates/pages/application/application-out_back.html b/src/main/resources/templates/pages/application/application-out_back.html index c21bebb6..6173354d 100644 --- a/src/main/resources/templates/pages/application/application-out_back.html +++ b/src/main/resources/templates/pages/application/application-out_back.html @@ -47,6 +47,41 @@
+
+
+ +
+ +
+
+ + +
@@ -137,6 +172,16 @@ function selectMaterial() { } + + function selectUser() { + + } + + function SelectTheUser() { + + } + + // 用于标志是否为第一次提交 let flagForForm = false; @@ -280,7 +325,7 @@ }, end: function () { var mid = $("#mid").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: "/material/findMatrialById?mid=" + mid, type: "get", @@ -362,6 +407,23 @@ return false; }); + // 监听开关 + form.on('switch()', function (data) { + let isAgency = data.elem.checked; //开关是否开启,true或者false + if (isAgency) { + // 如果开启了代领功能 + $("#agencyItem").show(); + // 添加必填 + $("#agencyUid").attr("lay-verify", "required"); + + } else { + $("#agencyItem").hide(); + // 删除必填 + $("#agencyUid").removeAttr("lay-verify"); + + } + }); + $('.pre').click(function () { step.pre('#stepForm'); }); @@ -386,7 +448,7 @@ req.quantity = val; req.unit = unit; req.placeId = -1; - 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: "/material/MaterialQuantityIsTrue", type: "post", @@ -400,7 +462,7 @@ $("#quantity").val(""); layer.close(loading2); }); - }else{ + } else { layer.close(loading2); } } @@ -409,9 +471,76 @@ } }; - $('body').on('click', '[data-refresh]', function () { - location.reload(); - }) + // 用于选择代领用户 + selectUser = function (obj) { + 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").val(""); + $("#agencyAdminorg").val(""); + $("#agencyUid").val(""); + $("#agencyUser").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").val(user.maindeparment); + $("#agencyAdminorg").val(user.maindeparmentname); + $("#agencyUid").val(user.id); + $("#agencyUser").val(user.name); + } + } + }) + } + }; + + // 用于选定人员 + SelectTheUser = function (obj) { + let data = $(obj); + let adminorg = data.attr("adminorg"); + let adminorgName = data.attr("adminorgname"); + let id = data.attr("id"); + let name = data.attr("name"); + $("#adminorgId").val(adminorg); + $("#agencyAdminorg").val(adminorgName); + $("#agencyUid").val(id); + $("#agencyUser").val(name); + layer.close(selectUserIfame) + }; }) diff --git a/src/main/resources/templates/pages/applicationForStorageCenter/application-out.html b/src/main/resources/templates/pages/applicationForStorageCenter/application-out.html index c84259fe..c2d7cf5d 100644 --- a/src/main/resources/templates/pages/applicationForStorageCenter/application-out.html +++ b/src/main/resources/templates/pages/applicationForStorageCenter/application-out.html @@ -61,13 +61,38 @@
+ +
+
+ +
+ +
+
+ +
+ +
+

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").val(user.maindeparment); + $("#openCompanyAdminorg").val(user.maindeparmentname); + $("#agencyUid").val(user.id); + $("#agencyUser").val(user.name); + } + } + }) + } + }; + + // 用于选定人员 + SelectTheUser = function (obj) { + let data = $(obj); + let adminorg = data.attr("adminorg"); + let adminorgName = data.attr("adminorgname"); + let id = data.attr("id"); + let name = data.attr("name"); + $("#adminorgId").val(adminorg); + $("#openCompanyAdminorg").val(adminorgName); + $("#agencyUid").val(id); + $("#agencyUser").val(name); + layer.close(selectUserIfame) + }; + }) 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 9451394c..60e5fda8 100644 --- a/src/main/resources/templates/pages/applicationForStorageCenter/application-out_back.html +++ b/src/main/resources/templates/pages/applicationForStorageCenter/application-out_back.html @@ -48,13 +48,33 @@ style="margin: 0 auto;max-width: 460px;padding-top: 40px;">
+
+ +
+ +
+
+
1) { - layer.msg("请点击右侧搜索确定物品",{icon:0,time:500},function () { + layer.msg("请点击右侧搜索确定物品", {icon: 0, time: 500}, function () { $("#mid").val(""); $("#code").val(""); layer.close(loading2); @@ -288,7 +339,7 @@ return false; } else if (d.count === 0) { - layer.msg("没有该物品,请确认输入是否正确",{icon:5,time:500},function() { + layer.msg("没有该物品,请确认输入是否正确", {icon: 5, time: 500}, function () { $("#mid").val(""); $("#code").val(""); layer.close(loading2); @@ -306,11 +357,11 @@ $("#unit").append(new Option(item.newUnit, item.newUnit)); }); if (depositoryDisplay !== "none") { - $("#showDepository" ).empty(); + $("#showDepository").empty(); let depositoryList = material.depositoryList; - if(depositoryList !== null){ + if (depositoryList !== null) { for (let i = 0; i < depositoryList.length; i++) { - $("#showDepository" ).append(new Option(depositoryList[i].dname, depositoryList[i].id)); + $("#showDepository").append(new Option(depositoryList[i].dname, depositoryList[i].id)); } } @@ -368,7 +419,7 @@ }, end: function () { var mid = $("#mid").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: "/material/findMatrialById?mid=" + mid, type: "get", @@ -389,7 +440,7 @@ if (depositoryDisplay !== "none") { $("#showDepository").empty(); let depositoryList = material.depositoryList; - if(depositoryList !== null) { + if (depositoryList !== null) { for (let i = 0; i < depositoryList.length; i++) { $("#showDepository").append(new Option(depositoryList[i].dname, depositoryList[i].id)); } @@ -409,7 +460,7 @@ elem: '#stepForm', filter: 'stepForm', width: '100%', //设置容器宽度 - height: '600px', + height: '750px', stepItems: [{ title: '填写信息' }, { @@ -417,6 +468,28 @@ }] }); + // 监听开关 + form.on('switch()', function (data) { + let isAgency = data.elem.checked; //开关是否开启,true或者false + if (isAgency) { + // 如果开启了代领功能 + $("#agencyItem").show(); + // 添加必填 + $("#agencyUid").attr("lay-verify", "required"); + + $("#openCompanyAdminorg").off("click"); + + } else { + $("#agencyItem").hide(); + // 删除必填 + $("#agencyUid").removeAttr("lay-verify"); + + + $("#openCompanyAdminorg").on('click', selectPost); + + } + }); + form.on('submit(formStep)', function (data) { if (!flagForForm) { @@ -529,13 +602,13 @@ unit = $("#unit").val(); } - mcode = $("#code" ).val(); + mcode = $("#code").val(); if (mcode === "" || mcode === undefined || mcode === null) { layer.msg("请输入物料的正确编码!", {icon: 0, time: 500}, function () { - $("#quantity" ).val("") + $("#quantity").val("") }); } else { - let val = $("#quantity" ).val(); + let val = $("#quantity").val(); if (val !== null && val !== undefined && val !== '') { var req = {}; req.mcode = mcode; @@ -557,7 +630,7 @@ if (!flag) { // 如果当前数目不合适 layer.msg("当前单个仓库中物料数量不足", {icon: 0, time: 500}, function () { layer.close(loading2); - $("#quantity" ).val(""); + $("#quantity").val(""); }, ); } else { @@ -573,28 +646,6 @@ }); - 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; layer.open({ @@ -617,6 +668,78 @@ }); }; + + // 用于选择代领用户 + selectUser = function (obj) { + 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").val(""); + $("#openCompanyAdminorg").val(""); + $("#agencyUid").val(""); + $("#agencyUser").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").val(user.maindeparment); + $("#openCompanyAdminorg").val(user.maindeparmentname); + $("#agencyUid").val(user.id); + $("#agencyUser").val(user.name); + } + } + }) + } + }; + + // 用于选定人员 + SelectTheUser = function (obj) { + let data = $(obj); + let adminorg = data.attr("adminorg"); + let adminorgName = data.attr("adminorgname"); + let id = data.attr("id"); + let name = data.attr("name"); + $("#adminorgId").val(adminorg); + $("#openCompanyAdminorg").val(adminorgName); + $("#agencyUid").val(id); + $("#agencyUser").val(name); + layer.close(selectUserIfame) + }; + })