src/main/java/com/zy/crm/manager/controller/PriSalesController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/crm/manager/entity/PriSales.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/webapp/static/js/common.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/webapp/static/js/priSales/priSales.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/webapp/views/priOnline2/priOnline_more.html | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/webapp/views/priSales/priSales.html | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/webapp/views/priSales/priSales_more.html | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/zy/crm/manager/controller/PriSalesController.java
@@ -1,5 +1,6 @@ package com.zy.crm.manager.controller; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; @@ -11,9 +12,13 @@ import com.core.common.Cools; import com.core.common.R; import com.core.domain.KeyValueVo; import com.core.exception.CoolException; import com.zy.crm.common.model.SettleDto; import com.zy.crm.common.web.BaseController; import com.zy.crm.manager.entity.*; import com.zy.crm.manager.service.*; import com.zy.crm.system.entity.User; import com.zy.crm.system.service.UserService; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.beans.factory.annotation.Autowired; @@ -41,10 +46,18 @@ @Autowired private PriQuoteBudgetService priQuoteBudgetService; @Autowired private UserService userService; @RequestMapping(value = "/priSales/{id}/auth") @ManagerAuth public R get(@PathVariable("id") String id) { return R.ok(priSalesService.selectById(String.valueOf(id))); PriSales priSales = priSalesService.selectById(String.valueOf(id)); assert priSales != null; JSONObject resultObj = JSON.parseObject(JSON.toJSONString(priSales)); // 步骤条相关 resultObj.put("step", priSales.getSettle() == 4 ? 0 : priSales.getSettle() + 1); return R.ok().add(resultObj); } @RequestMapping(value = "/priSales/list/auth") @@ -56,7 +69,7 @@ @RequestParam(required = false)String condition, @RequestParam Map<String, Object> param){ EntityWrapper<PriSales> wrapper = new EntityWrapper<>(); wrapper.setSqlSelect("id,title,create_time as createTime,filepath,item_id as itemId,order_num as orderNum,template_name as templateName,user_id as userId,update_user_id as updateUserId,update_time as updateTime,in_order_num as inOrderNum,member_id as memberId"); wrapper.setSqlSelect("id,title,create_time as createTime,settle,filepath,item_id as itemId,order_num as orderNum,template_name as templateName,user_id as userId,update_user_id as updateUserId,update_time as updateTime,in_order_num as inOrderNum,member_id as memberId"); wrapper.in("member_id", getUserRoleBelongsToUserId("allopen")); excludeTrash(param); convert(param, wrapper); @@ -122,6 +135,16 @@ //业务员 Plan plan = planService.selectById(priSales.getItemId()); priSales.setMemberId(plan.getUserId()); priSales.setSettle(0); User manager = userService.getDeptManager(getHostId(), getUser().getDeptId()); // 获取部门领导 List<String> initNames = new ArrayList<>(); initNames.add("创建产品费用明细模板"); initNames.add("提交产品费用明细"); initNames.add("部门经理审核"); initNames.add("业务员确认"); priSales.setSettleMsg(JSON.toJSONString(SettleDto.initSalesPricing(manager,getUser(),initNames,3))); //设置项目流程 plan.setStep(3); @@ -415,4 +438,121 @@ } } @PostMapping(value = "/priSales/approval/auth") @ManagerAuth public R approvalBusinessTrip(@RequestParam Long priSalesId, @RequestParam(required = false) Long plannerId){ PriSales priSales = priSalesService.selectById(priSalesId); assert priSales != null; Date now = new Date(); switch (priSales.getSettle()) { case 0: User user2 = userService.selectById(priSales.getUserId()); User manager1 = userService.getDeptManager(getHostId(), user2.getDeptId()); if (Cools.isEmpty(getUser())) { return R.error("抱歉,您没有提交的权限"); } if (!getUserId().equals(getUser().getId())) { return R.error("抱歉,您没有提交的权限"); } // 修改 settle 步骤数据 List<SettleDto> list1 = JSON.parseArray(priSales.getSettleMsg(), SettleDto.class); for (SettleDto dto : list1) { switch (dto.getStep()) { case 0: dto.setCurr(Boolean.FALSE); break; case 1: dto.setCurr(Boolean.TRUE); dto.setMsg(getUser().getNickname() + "提交完成"); dto.setTime(DateUtils.convert(now)); break; default: break; } } priSales.setSettleMsg(JSON.toJSONString(list1)); // 修改规划单状态 priSales.setSettle(1); priSales.setUpdateUserId(getUserId()); priSales.setUpdateTime(now); priSales.setMemberId(manager1.getId()); if (!priSalesService.updateById(priSales)) { throw new CoolException("提交失败,请联系管理员"); } break; case 1: // 本部门经理审核 User user = userService.selectById(priSales.getUserId()); User manager = userService.getDeptManager(getHostId(), user.getDeptId()); if (manager.getId().equals(getUserId())) { // 修改 settle 步骤数据 List<SettleDto> list = JSON.parseArray(priSales.getSettleMsg(), SettleDto.class); for (SettleDto dto : list) { switch (dto.getStep()) { case 1: dto.setCurr(Boolean.FALSE); break; case 2: dto.setCurr(Boolean.TRUE); dto.setMsg("部门经理" + manager.getNickname() + "审批通过"); dto.setTime(DateUtils.convert(now)); break; default: break; } } priSales.setSettleMsg(JSON.toJSONString(list)); // 修改规划单状态 priSales.setSettle(2); // 申请通过 priSales.setUpdateTime(now); if (!priSalesService.updateById(priSales)) { throw new CoolException("审核失败,请联系管理员"); } } else { return R.error("抱歉,您没有审核的权限!!!"); } break; case 2: // 业务员 User salesman0 = userService.selectById(priSales.getUserId()); if (!getUserId().equals(salesman0.getId())) { return R.error("抱歉,您无需确认!!!"); } // 修改 settle 步骤数据 List<SettleDto> list2 = JSON.parseArray(priSales.getSettleMsg(), SettleDto.class); for (SettleDto dto : list2) { switch (dto.getStep()) { case 2: dto.setCurr(Boolean.TRUE); break; case 3: dto.setCurr(Boolean.TRUE); dto.setMsg("业务员" + salesman0.getNickname() + "以确认"); dto.setTime(DateUtils.convert(new Date())); break; default: break; } } priSales.setSettleMsg(JSON.toJSONString(list2)); // 修改规划单状态 priSales.setSettle(3); // 审批通过 priSales.setUpdateTime(new Date()); if (!priSalesService.updateById(priSales)) { throw new CoolException("确认失败,请联系管理员"); } break; default: return R.error(); } return R.ok("审批成功"); } } src/main/java/com/zy/crm/manager/entity/PriSales.java
@@ -93,6 +93,26 @@ @TableField("member_id") private Long memberId; /** * hostId */ @ApiModelProperty(value= "hostId") @TableField("host_id") private Long hostId; /** * 进度 */ @ApiModelProperty(value= "进度") private Integer settle; /** * 流程进度 */ @ApiModelProperty(value= "流程进度") @TableField("settle_msg") private String settleMsg; public PriSales() {} public PriSales(String title,String sheetData,Date createTime,String filepath) { @@ -102,6 +122,22 @@ this.filepath = filepath; } public String getSettle$(){ if (null == this.settle){ return null; } switch (this.settle){ case 0: return "等待提交"; case 1: return "等待审批"; case 2: return "等待确认"; case 3: return "审批通过"; default: return String.valueOf(this.settle); } } public Long getCstmrId$(){ CstmrService cstmrService = SpringUtils.getBean(CstmrService.class); Cstmr cstmr = cstmrService.selectByName(1L, this.templateName); src/main/webapp/static/js/common.js
@@ -237,3 +237,4 @@ } var businessTripByMore; var priOnlineByMore; var priSalesByMore; src/main/webapp/static/js/priSales/priSales.js
@@ -92,6 +92,7 @@ ,{field: 'createTime$', align: 'center',title: '创建时间'} ,{field: 'updateTime$', align: 'center',title: '更新时间'} ,{field: 'memberId$', align: 'center',title: '业务员'} ,{field: 'settle$', align: 'center',title: '进度', style: 'color: #1890ff;cursor:pointer', event: 'more',hide: false} ,{field: 'userId$', align: 'center',title: '创建人员'} ,{field: 'updateUserId$', align: 'center',title: '更新人员'} ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:250} @@ -233,6 +234,29 @@ table.on('tool(priSales)', function(obj){ var data = obj.data; switch (obj.event) { case 'approval': layer.confirm('审批通过?', { skin: 'layui-layer-admin', shade: .1, offset: '200px', title: data.name }, function (i) { layer.close(i); approval(data.id); }); break; case 'more': top.priSalesByMore = data.id; admin.popupRight({ type: 1, window: "top", area: "1250px", url: "priSales_more.html", end: function () { // $(".layui-laypage-btn")[0].click(); } }) break; case 'moreCstmr': top.cstmrByMore = data.cstmrId$; admin.popupRight({ @@ -383,6 +407,33 @@ }); } function approval(priSalesId, plannerId, dIdx) { let loadIndex = layer.load(2); $.ajax({ url: baseUrl+"/priSales/approval/auth", headers: {'token': localStorage.getItem('token')}, data: { priSalesId: priSalesId, plannerId: plannerId }, method: 'POST', success: function (res) { if (dIdx) { layer.close(dIdx); } layer.close(loadIndex); if (res.code === 200){ layer.msg(res.msg, {icon: 1}); tableReload(); } else if (res.code === 403){ top.location.href = baseUrl+"/"; } else { layer.msg(res.msg, {icon: 2}); } } }) } }); // 关闭动作 src/main/webapp/views/priOnline2/priOnline_more.html
@@ -141,23 +141,23 @@ success: function (res) { notice.destroy(); if (res.code === 200) { let priOnlineId = res.data; top.priOnlineIdByMore = null; $("#form-name").html(priOnlineId.name); let priOnline = res.data; top.priOnlineByMore = null; $("#form-name").html(priOnline.name); // 进度步骤图 let template0 = Handlebars.compile($('#stepTpl').html()); $('#stepBox').html(template0({list: JSON.parse(priOnlineId.settleMsg)})); $('#step-' + Number(priOnlineId.step)).addClass("layui-this"); $('#stepBox').html(template0({list: JSON.parse(priOnline.settleMsg)})); $('#step-' + Number(priOnline.step)).addClass("layui-this"); let template1 = Handlebars.compile($('#timelineTpl').html()); $('#timelineBox').html(template1({list: JSON.parse(priOnlineId.settleMsg)})); $('#timelineBox').html(template1({list: JSON.parse(priOnline.settleMsg)})); // 补充html $('#customizeBox').html(priOnlineId.formHtml); $('#customizeBox').html(priOnline.formHtml); // 设备明细 // form.val('formAdvForm', priOnlineId); // form.val('formAdvForm', priOnline); // top.convertDisabled($('#formAdvForm :input'), true); // 跟进人 // initFollowers(priOnlineId.id); // initFollowers(priOnline.id); layDateRender(); } else if (res.code === 403) { top.location.href = baseUrl + "/"; src/main/webapp/views/priSales/priSales.html
@@ -98,9 +98,20 @@ </script> <script type="text/html" id="operate"> <a class="layui-btn layui-btn-xs btn-edit" lay-event="priOnline">产品费用明细</a> <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="edit">编辑</a> {{# if (d.settle == 0) { }} <a class="layui-btn layui-btn-xs btn-edit" lay-event="approval">提交</a> {{# } }} {{# if (d.settle == 1) { }} <a class="layui-btn layui-btn-xs btn-edit" lay-event="approval">审批</a> {{# } }} {{# if (d.settle == 2) { }} <a class="layui-btn layui-btn-xs btn-edit" lay-event="approval">确认</a> {{# } }} {{# if (d.settle == 0 || d.settle == 1) { }} <a class="layui-btn layui-btn-danger layui-btn-xs btn-edit" lay-event="del">删除</a> <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="edit">编辑</a> {{# } }} <a class="layui-btn layui-btn-xs btn-edit" lay-event="priOnline">产品费用明细</a> </script> <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> src/main/webapp/views/priSales/priSales_more.html
New file @@ -0,0 +1,187 @@ <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <style> #formAdvForm { background-color: #f3f3f3; } #formAdvForm .layui-form-item { margin-top: 20px; margin-bottom: 0; } #formAdvForm .layui-form-item .layui-inline { margin-bottom: 25px; margin-right: 0; } .form-group-bottom { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 20px; background-color: #fff; box-shadow: 0 -1px 2px 0 rgba(0, 0, 0, .05); } </style> <!-- 正文开始 --> <form class="layui-form" id="formAdvForm" lay-filter="formAdvForm" style="height: 100%"> <div class="layui-fluid" style="padding-bottom: 75px;height: 100%; overflow: scroll;box-sizing: border-box"> <!-- 标题 --> <div class="layui-card"> <div class="layui-card-header" style="padding-top: 5px; padding-bottom: 5px"> <div> <i class="layui-icon" style="font-size: 20px;color: #1890ff;font-weight: bold"></i> <span id="form-name" style="margin: 0 6px;font-size: 18px;font-weight: bold;letter-spacing: 1px"></span> <span style="opacity: .5;font-size: small;margin-left: 5px">核价单</span> </div> </div> <div class="layui-card-body" style="padding: 30px 20px"> <div class="layui-tab layui-steps"> <ul class="layui-tab-title" id="stepBox"> </ul> </div> </div> </div> <div class="layui-row"> <!-- 数据 --> <!-- <div class="layui-col-md9">--> <!-- <div class="layui-card">--> <!-- <div class="layui-card-header">--> <!-- 基本信息--> <!-- </div>--> <!-- <div class="layui-card-body">--> <!-- </div>--> <!-- </div>--> <!-- </div>--> <!-- 动态 --> <!-- <div class="layui-col-md3" style="width: 24%;margin-left: 1%">--> <div class="layui-col-md3" style="width: 100%;"> <!-- 时间线 --> <div class="layui-card"> <div class="layui-card-header"> <span>流程动态</span> </div> <div class="layui-card-body"> <ul class="layui-timeline" id="timelineBox"> </ul> </div> </div> </div> </div> </div> <div class="form-group-bottom text-right"> <button class="layui-btn" lay-filter="refresh" lay-submit><i class="layui-icon"></i> 刷新 </button> </div> </form> <script type="text/html" id="followerTabOperate"> <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="del">删除</a> </script> <script type="text/template" id="stepTpl"> {{#each list}} <li id="step-{{step}}" style="pointer-events: none"> <i class="layui-icon layui-icon-ok">{{step}}</i> <span class="layui-steps-title">{{title}}</span> {{# if username}} <span class="layui-steps-content">{{username}}</span> {{ else }} <span class="layui-steps-content"> </span> {{/if}} </li> {{/each}} </script> <script type="text/template" id="timelineTpl"> {{#each list}} <li class="layui-timeline-item"> <i class="layui-icon layui-timeline-axis"></i> <div class="layui-timeline-content layui-text"> <h4 class="layui-timeline-title" style="display: inline;margin-right: 10px;">{{title}}</h4> <span>{{time}}</span> <p> {{msg}} </p> </div> </li> {{/each}} </script> <script> var priSalesId = top.priSalesByMore; $('.layui-layer-close').hide(); layui.config({ base: baseUrl + "/static/layui/lay/modules/" }).extend({ notice: 'notice/notice', steps: 'steps/steps', }).use(['form', 'table', 'laydate', 'notice', 'xmSelect', 'steps'], function () { var $ = layui.jquery; var form = layui.form; var table = layui.table; var laydate = layui.laydate; var notice = layui.notice; var xmSelect = layui.xmSelect; var steps = layui.steps; form.render('select'); init(); function init(){ notice.msg('正在载入数据......', {icon: 4, position: "topRight"}); $.ajax({ url: baseUrl + "/priSales/" + priSalesId + "/auth", headers: {'token': localStorage.getItem('token')}, method: 'GET', success: function (res) { notice.destroy(); if (res.code === 200) { let priSales = res.data; top.priSalesByMore = null; $("#form-name").html(priSales.name); // 进度步骤图 let template0 = Handlebars.compile($('#stepTpl').html()); $('#stepBox').html(template0({list: JSON.parse(priSales.settleMsg)})); $('#step-' + Number(priSales.step)).addClass("layui-this"); let template1 = Handlebars.compile($('#timelineTpl').html()); $('#timelineBox').html(template1({list: JSON.parse(priSales.settleMsg)})); // 补充html $('#customizeBox').html(priSales.formHtml); // 设备明细 // form.val('formAdvForm', priSales); // top.convertDisabled($('#formAdvForm :input'), true); // 跟进人 // initFollowers(priSales.id); layDateRender(); } else if (res.code === 403) { top.location.href = baseUrl + "/"; } else { layer.msg(res.msg, {icon: 2}) } } }) } /* 渲染laydate */ function layDateRender() { laydate.render({ elem: '#endTime', type: 'datetime' }); } layDateRender(); /* 监听表单提交 */ form.on('submit(refresh)', function (data) { init(); return false; }); }) </script>