中扬CRM客户关系管理系统
LSH
2023-07-28 08c2f587b9c2ec4d1401f8e5e3904851aa380fff
#售前规划申请单需求多选完善
3个文件已修改
125 ■■■■ 已修改文件
src/main/java/com/zy/crm/manager/controller/PlanController.java 61 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/crm/manager/entity/Plan.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/plan/plan.js 61 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/crm/manager/controller/PlanController.java
@@ -148,44 +148,45 @@
    @RequestMapping(value = "/plan/update/auth")
    @ManagerAuth
    @Transactional
    public R update(@RequestParam Map<String, Object> param){
        String planNeed = null;
        Integer id = null;
        for (Map.Entry<String, Object> entry : param.entrySet()){
            String val = String.valueOf(entry.getValue());
            if (Cools.isEmpty(val)){
                continue;
            }
            if (entry.getKey().equals("planNeed")){
                planNeed = val;
            }
            if (entry.getKey().equals("id")){
                try{
                    id = Integer.parseInt(val);
                }catch (Exception e){
                    return R.error();
                }
            }
        }
//        String planNeed = null;
//        Integer id = null;
//        for (Map.Entry<String, Object> entry : param.entrySet()){
//            String val = String.valueOf(entry.getValue());
//            if (Cools.isEmpty(val)){
//                continue;
//            }
//            if (entry.getKey().equals("planNeed")){
//                planNeed = val;
//            }
//            if (entry.getKey().equals("id")){
//                try{
//                    id = Integer.parseInt(val);
//                }catch (Exception e){
//                    return R.error();
//                }
//            }
//        }
        if (Cools.isEmpty(param) || Cools.isEmpty(param.get("id"))){
            return R.error();
        }
        List<String> planNeedbs = new ArrayList<>(Arrays.asList(planNeed.split("-")));
        if (planNeedbs.get(0).equals("[object Object]")){
            planNeedbs.remove(0);
            Plan plan1 = planService.selectById(id);
            List<String> planNeedas = Arrays.asList(plan1.getPlanNeed().split("-"));
            List<String> routeIntersectionString = SetOfUtils.getRouteIntersectionString(planNeedas, planNeedbs, RouteCollectCountType.DEDUPLICATIONUNION);
            planNeed="";
            for (String planNeedss:routeIntersectionString){
                planNeed=planNeed==""? planNeedss:planNeed + "-" + planNeedss;
            }
        }
//        List<String> planNeedbs = new ArrayList<>(Arrays.asList(planNeed.split("-")));
//        if (planNeedbs.get(0).equals("[object Object]")){
//            planNeedbs.remove(0);
//            Plan plan1 = planService.selectById(id);
//            List<String> planNeedas = Arrays.asList(plan1.getPlanNeed().split("-"));
//            List<String> routeIntersectionString = SetOfUtils.getRouteIntersectionString(planNeedas, planNeedbs, RouteCollectCountType.DEDUPLICATIONUNION);
//            planNeed="";
//            for (String planNeedss:routeIntersectionString){
//                planNeed=planNeed==""? planNeedss:planNeed + "-" + planNeedss;
//            }
//        }
        // pre
        Plan plan = JSON.parseObject(JSON.toJSONString(param), Plan.class);
        plan.setPlanNeed(planNeed);
//        plan.setPlanNeed(planNeed);
        param.entrySet().removeIf(next -> this.fields.contains(next.getKey()));
        plan.setUpdateBy(getUserId());
        plan.setUpdateTime(new Date());
src/main/java/com/zy/crm/manager/entity/Plan.java
@@ -298,6 +298,9 @@
    }
    public String getPlanNeed$(){
        if (Cools.isEmpty(this.planNeed)){
            return null;
        }
        PlanNeedService service = SpringUtils.getBean(PlanNeedService.class);
        String[] planNeeds = this.planNeed.split("-");
        String name="";
src/main/webapp/static/js/plan/plan.js
@@ -2,6 +2,7 @@
var pageCount = 0;
var treeCond;
var admin;
var planNeedXmlSelData;
layui.config({
    base: baseUrl + "/static/layui/lay/modules/"
}).extend({
@@ -516,19 +517,13 @@
                            if (plan.orderId) { orderSel.setValue([{name: plan.orderId$, value: plan.orderId}]); }
                            if (plan.cstmrId) { cstmrSel.setValue([{name: plan.cstmrId$, value: plan.cstmrId}]); }
                            if (plan.userId) { userSel.setValue([{name: plan.userId$, value: plan.userId}]); }
                            // console.log(plan);
                            // console.log(plan.planNeed);
                            // console.log(plan.planNeed.split("-"));
                            // console.log(plan.planNeed.split("-").length);
                            let split = plan.planNeed.split("-");
                            // console.log(split);
                            // console.log(split.length);
                            if (plan.planNeed) {
                                var planNeedValue1=split[0];
                                for (var i=1;i<split.length;i++){
                                    planNeedValue1 = planNeedSel+"-" +split[i];
                                }
                                planNeedSel.setValue([{name: plan.planNeed$, value: planNeedValue1}]);
                                var data = []
                                split.forEach((item,idx) => {
                                    data.push(parseInt(item))
                                })
                                planNeedXmlSelData = data
                            }
                            layDateRender(plan);
                            plan['planTypeName'] = plan.planType$;
@@ -742,30 +737,34 @@
    }
    window.loadPlanNeedSel = function () {
        return xmSelect.render({
        var planNeedXmlSel = xmSelect.render({
            el: '#planNeedXmlSel',
            autoRow: true,
            filterable: true,
            remoteSearch: true,
            remoteMethod: function (val, cb, show) {
                $.ajax({
                    url: baseUrl + "/planNeed/all/get/kv",
                    headers: {'token': localStorage.getItem('token')},
                    data: {
                        condition: val
                    },
                    method: 'POST',
                    success: function (res) {
                        if (res.code === 200) {
                            cb(res.data)
                        } else {
                            cb([]);
                            layer.msg(res.msg, {icon: 2});
                        }
                    }
                });
            data: []
        });
        $.ajax({
            url: baseUrl + "/planNeed/all/get/kv",
            headers: {'token': localStorage.getItem('token')},
            data: {
                condition: ""
            },
            method: 'POST',
            success: function (res) {
                if (res.code === 200) {
                    console.log(planNeedXmlSelData)
                    planNeedXmlSel.update({
                        initValue: planNeedXmlSelData,
                        data: res.data
                    })
                } else {
                    cb([]);
                    layer.msg(res.msg, {icon: 2});
                }
            }
        });
        return planNeedXmlSel;
    }
    window.loadUserSel = function () {