From 064e2b95e2a88f9679a1834e4dec95038c0482ff Mon Sep 17 00:00:00 2001 From: LSH Date: 星期一, 09 十月 2023 15:31:34 +0800 Subject: [PATCH] #流程相关 --- src/main/java/com/zy/crm/manager/controller/PriOnline2Controller.java | 86 +++++++++++++++++++++++++--- src/main/webapp/static/js/priQuote/priQuote.js | 2 src/main/webapp/views/priOnline2/priOnline.html | 13 ++++ src/main/webapp/static/js/priOnline2/priOnline.js | 54 +++++++++++++++++ src/main/webapp/views/priQuote/priQuote.html | 14 ++-- 5 files changed, 151 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/zy/crm/manager/controller/PriOnline2Controller.java b/src/main/java/com/zy/crm/manager/controller/PriOnline2Controller.java index ea85bb5..42d337b 100644 --- a/src/main/java/com/zy/crm/manager/controller/PriOnline2Controller.java +++ b/src/main/java/com/zy/crm/manager/controller/PriOnline2Controller.java @@ -438,13 +438,12 @@ Date now = new Date(); switch (priOnline2.getSettle()) { case 0: - User user2 = userService.selectById(priOnline2.getUserId()); - User manager1 = new User(); - try{ - manager1 = userService.getDeptManager(getHostId(), user2.getDeptId()); // 鑾峰彇閮ㄩ棬棰嗗 - }catch (Exception e){ - manager1 = user2; - } + // 鏈儴闂ㄧ粡鐞嗗鏍� 鑺傜偣璐熻矗浜� + Plan plan1 = planService.selectById(priOnline2.getItemId()); + PlanType planType1 = planTypeService.selectById(plan1.getPlanType()); + + ProcessPermissions processPermissions1 = processPermissionsService.selectOne(new EntityWrapper<ProcessPermissions>().eq("process_memo", 5).eq("process", "2-"+planType1.getType()));//2锛氭姤浠锋祦绋� + User manager1 = userService.selectById(processPermissions1.getUserId()); // 鑾峰彇鎶ヤ环娴佺▼鑺傜偣2纭浜� if (Cools.isEmpty(getUser())) { return R.error("鎶辨瓑锛屾偍娌℃湁鎻愪氦鐨勬潈闄�"); @@ -480,8 +479,6 @@ } break; case 1: - User user = userService.selectById(priOnline2.getUserId()); - // 鏈儴闂ㄧ粡鐞嗗鏍� 鑺傜偣璐熻矗浜� Plan plan = planService.selectById(priOnline2.getItemId()); PlanType planType = planTypeService.selectById(plan.getPlanType()); @@ -556,6 +553,11 @@ if (!priOnline2Service.updateById(priOnline2)) { throw new CoolException("纭澶辫触锛岃鑱旂郴绠$悊鍛�"); } + try{ + priQuoteAdd(priOnline2.getId(),plannerId); + }catch (Exception e){ + return R.error("鑷姩鐢熸垚鎶ヤ环鍗曞け璐�"); + } break; default: return R.error(); @@ -563,4 +565,70 @@ return R.ok("瀹℃壒鎴愬姛"); } + public void priQuoteAdd(Long priOnlineId,Long priType){ + Pri pri = null; + if (priType==1L){ + pri = priService.selectById(114); + }else { + pri = priService.selectById(115); + } + + PriOnline2 priOnline2 = priOnline2Service.selectById(priOnlineId); + + PriQuote priQuote = new PriQuote(); + priQuote.setCreateTime(new Date()); + priQuote.setTitle(pri.getTitle()); + priQuote.setTemplateName(priOnline2.getTemplateName()); + priQuote.setSheetData(pri.getSheetData()); + priQuote.setPriOnlineId(priOnlineId); + priQuote.setItemId(priOnline2.getItemId()); + priQuote.setOrderNum(priOnline2.getOrderNum()); + SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss"); + priQuote.setInOrderNum(format.format(new Date())); + + //鍒涘缓浜哄憳 + priQuote.setUserId(getUserId()); + //鏇存柊浜哄憳 + priQuote.setUpdateUserId(getUserId()); + //鎵�灞為儴闂� + priQuote.setDeptId(getDeptId()); + //鏇存柊鏃堕棿 + priQuote.setUpdateTime(new Date()); + //妯℃澘 + Integer i = priType == 1L ? 1 : 2; + priQuote.setTemplate(i.toString()); + + //涓氬姟鍛� + Plan plan = planService.selectById(priQuote.getItemId()); + priQuote.setMemberId(plan.getUserId()); + + //璁剧疆椤圭洰娴佺▼ + plan.setStep(5); + +// priQuote.setForm(JSON.toJSONString(map)); // 鑷畾涔夎〃鍗曞唴瀹� + priQuote.setSettle(1); // 1.寮�濮� + User manager = new User(); + try{ + manager = userService.getDeptManager(getHostId(), getUser().getDeptId()); // 鑾峰彇閮ㄩ棬棰嗗 + }catch (Exception e){ + manager = getUser(); + } + ProcessPermissions processPermissions = processPermissionsService.selectOne(new EntityWrapper<ProcessPermissions>().eq("process_memo", 2).eq("process", "3-1"));//2锛氭姤浠锋祦绋� + User president = userService.selectById(processPermissions.getUserId()); // 鑾峰彇鎶ヤ环娴佺▼鑺傜偣3-1纭浜� + priQuote.setSettleMsg(JSON.toJSONString(SettleDto.initPriQuote(plan, manager,president,getUser()))); + + planService.updateById(plan); + + priQuoteService.insert(priQuote); + } + + @PostMapping(value = "/priOnline2/priQuoteAdd/list/auth") + @ManagerAuth + public R priOnline2priQuoteAdd(@RequestParam Long planId){ + List<KeyValueVo> vos = new ArrayList<>(); + vos.add(new KeyValueVo("鎶ヤ环妯℃澘1", 1L)); + vos.add(new KeyValueVo("鎶ヤ环妯℃澘2", 2L)); + return R.ok().add(vos); + } + } diff --git a/src/main/webapp/static/js/priOnline2/priOnline.js b/src/main/webapp/static/js/priOnline2/priOnline.js index 925d0e5..dc60a55 100644 --- a/src/main/webapp/static/js/priOnline2/priOnline.js +++ b/src/main/webapp/static/js/priOnline2/priOnline.js @@ -244,7 +244,59 @@ title: data.name }, function (i) { layer.close(i); - approval(data.id); + // 鎸囧畾瑙勫垝鍛� + if (data.settle === 2) { + admin.open({ + type: 1, + area: '300px', + title: '閫夋嫨瑙勫垝鍛�', + content: $('#plannerListDialog').html(), + success: function (layero, dIndex) { + let plannerSel = xmSelect.render({ + el: '#plannerXmlSel', + autoRow: true, + filterable: true, + remoteSearch: true, + clickClose: true, + radio: true, + remoteMethod: function (val, cb, show) { + let loadIndex = layer.load(2); + $.ajax({ + url: baseUrl+"/priOnline2/priQuoteAdd/list/auth", + headers: {'token': localStorage.getItem('token')}, + data: { + planId: data.id + }, + method: 'POST', + success: function (res) { + layer.close(loadIndex); + if (res.code === 200) { + cb(res.data) + } else { + layer.close(dIndex); + layer.msg(res.msg, {icon: 2}); + } + } + }) + } + }); + + form.on('submit(editSubmit)', function () { + let plannerId = plannerSel.getValue()[0] ? plannerSel.getValue()[0].value : null; + if (!plannerId) { + layer.msg("璇烽�夋嫨瑙勫垝鍛�", {icon: 2}); + top.requireTip($('#plannerXmlSel')); + return false; + } + approval(data.id, plannerId, dIndex); + }); + + $(layero).children('.layui-layer-content').css('overflow', 'visible'); + } + }) + } else { + approval(data.id); + } }); break; case 'moreCstmr': diff --git a/src/main/webapp/static/js/priQuote/priQuote.js b/src/main/webapp/static/js/priQuote/priQuote.js index 2a2b58b..14cebe8 100644 --- a/src/main/webapp/static/js/priQuote/priQuote.js +++ b/src/main/webapp/static/js/priQuote/priQuote.js @@ -92,7 +92,7 @@ ,{field: 'templateName', align: 'center',title: '瀹㈡埛鍚嶇О', style: 'color: #1890ff;cursor:pointer', event: 'moreCstmr', width: 350,hide: false} ,{field: 'cstmrId$', align: 'center',title: '瀹㈡埛id',hide: true} ,{field: 'inOrderNum', align: 'center',title: '鎶ヤ环缂栧彿',hide: false} - ,{field: 'orderNum', align: 'center',title: '鎶ヤ环棰勭畻鍗曞彿',hide: false} + // ,{field: 'orderNum', align: 'center',title: '鎶ヤ环棰勭畻鍗曞彿',hide: false} ,{field: 'planId$', align: 'center',title: '瑙勫垝鍗曞彿', style: 'color: #1890ff;cursor:pointer', event: 'morePlan'} ,{field: 'itemId', align: 'center',title: '瑙勫垝鍗曞彿', hide: true} ,{field: 'planName$', align: 'center',title: '瑙勫垝鍗曞悕绉�',hide: false} diff --git a/src/main/webapp/views/priOnline2/priOnline.html b/src/main/webapp/views/priOnline2/priOnline.html index 26ab3f6..d142faa 100644 --- a/src/main/webapp/views/priOnline2/priOnline.html +++ b/src/main/webapp/views/priOnline2/priOnline.html @@ -91,6 +91,19 @@ <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="viewCheck">鏌ョ湅璇环</a> </script> +<script type="text/html" id="plannerListDialog"> + <div class="layui-form admin-form"> + <div class="model-form" style="padding: 30px"> + <div id="plannerXmlSel"></div> + </div> + <hr class="layui-bg-gray"> + <div class="layui-form-item text-right" style="padding-right: 30px"> + <button class="layui-btn" lay-filter="editSubmit" lay-submit="">淇濆瓨</button> + <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">鍙栨秷</button> + </div> + </div> +</script> + <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> diff --git a/src/main/webapp/views/priQuote/priQuote.html b/src/main/webapp/views/priQuote/priQuote.html index ec9b704..2a34be1 100644 --- a/src/main/webapp/views/priQuote/priQuote.html +++ b/src/main/webapp/views/priQuote/priQuote.html @@ -125,10 +125,10 @@ <div class="layui-row"> <div class="layui-col-md12"> <div class="layui-form-item"> - <label class="layui-form-label layui-form-required">鎶ヤ环棰勭畻鍗曞彿: </label> + <label class="layui-form-label layui-form-required">椤圭洰: </label> <div class="layui-input-block cool-auto-complete"> - <input class="layui-input" name="id" placeholder="璇疯緭鍏ユ姤浠烽绠楀崟鍙�" style="display: none" lay-verify="required"> - <input id="orderNum" name="orderNum" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" placeholder="璇疯緭鍏ユ姤浠烽绠楀崟鍙�" onfocus=this.blur()> + <input class="layui-input" name="id" placeholder="璇烽�夋嫨椤圭洰" style="display: none" lay-verify="required"> + <input id="orderNum" name="orderNum" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" placeholder="璇烽�夋嫨椤圭洰" onfocus=this.blur()> <div class="cool-auto-complete-window"> <input class="cool-auto-complete-window-input" data-key="priOnline2Query2Bydirector" onkeyup="autoLoad(this.getAttribute('data-key'))"> <select class="cool-auto-complete-window-select" data-key="priOnline2Query2BydirectorSelect" onchange="confirmed(this.getAttribute('data-key'),getItemInfo)" multiple="multiple"> @@ -138,16 +138,16 @@ </div> <div class="layui-form-item"> - <label class="layui-form-label">椤圭洰鍚�: </label> + <label class="layui-form-label">瑙勫垝鍗曞彿: </label> <div class="layui-input-block"> - <input class="layui-input" id="planId" disabled placeholder="璇疯緭鍏ラ」鐩悕" autocomplete="off" lay-verify="required"> + <input class="layui-input" id="planId" disabled placeholder="璇疯緭鍏ヨ鍒掑崟鍙�" autocomplete="off" lay-verify="required"> </div> </div> <div class="layui-form-item"> - <label class="layui-form-label">浜у搧璐圭敤鏄庣粏鍗曞彿: </label> + <label class="layui-form-label">鏍镐环鍗曞彿: </label> <div class="layui-input-block"> - <input class="layui-input" id="priSalesNum" disabled placeholder="璇疯緭鍏ヤ骇鍝佽垂鐢ㄦ槑缁嗗崟鍙�" autocomplete="off" lay-verify="required"> + <input class="layui-input" id="priSalesNum" disabled placeholder="璇疯緭鍏ユ牳浠峰崟鍙�" autocomplete="off" lay-verify="required"> </div> </div> -- Gitblit v1.9.1