| | |
| | | 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("抱歉,您没有提交的权限"); |
| | |
| | | } |
| | | break; |
| | | case 1: |
| | | User user = userService.selectById(priOnline2.getUserId()); |
| | | |
| | | // 本部门经理审核 节点负责人 |
| | | Plan plan = planService.selectById(priOnline2.getItemId()); |
| | | PlanType planType = planTypeService.selectById(plan.getPlanType()); |
| | |
| | | if (!priOnline2Service.updateById(priOnline2)) { |
| | | throw new CoolException("确认失败,请联系管理员"); |
| | | } |
| | | try{ |
| | | priQuoteAdd(priOnline2.getId(),plannerId); |
| | | }catch (Exception e){ |
| | | return R.error("自动生成报价单失败"); |
| | | } |
| | | break; |
| | | default: |
| | | return R.error(); |
| | |
| | | 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); |
| | | } |
| | | |
| | | } |
| | |
| | | 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': |
| | |
| | | ,{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} |
| | |
| | | <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> |
| | |
| | | <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"> |
| | |
| | | </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> |
| | | |