diff --git a/src/main/resources/templates/pages/group/applicationOutForGroup.html b/src/main/resources/templates/pages/group/applicationOutForGroup.html index b27383cb..17cc9699 100644 --- a/src/main/resources/templates/pages/group/applicationOutForGroup.html +++ b/src/main/resources/templates/pages/group/applicationOutForGroup.html @@ -60,6 +60,44 @@
+
+
+ +
+ +
+
+ + +
+ +
@@ -128,6 +166,15 @@ function selectCodeForGroup(obj) { } + function selectUser(){ + + } + + function SelectTheUser(){ + + } + + // 用于标志是否为第一次提交 let flagForForm = false; @@ -214,6 +261,24 @@ }); + + // 监听开关 + 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"); + + } else { + $("#agencyItem" + id).hide(); + // 删除必填 + $("#agencyUid" + id).removeAttr("lay-verify"); + + } + }); $('.pre').click(function () { step.pre('#stepForm2'); }); @@ -799,11 +864,86 @@ } return result; } + // 用于选择代领用户 + 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); + $("#agencyAdminorg" + 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); + $("#agencyAdminorg" + isGroup).val(adminorgName); + $("#agencyUid" + isGroup).val(id); + $("#agencyUser" + isGroup).val(name); + layer.close(selectUserIfame) + }; - $('body').on('click', '[data-refresh]', function () { - location.reload(); - }) })