中扬CRM客户关系管理系统
#
luxiaotao1123
2022-11-21 d339355ee4801f639ce67ffabf23399955f810f2
#
4个文件已修改
67 ■■■■ 已修改文件
src/main/java/com/zy/crm/manager/controller/PlanTypeController.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/crm/manager/entity/PlanType.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/plan/plan.js 39 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/plan/plan.html 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/crm/manager/controller/PlanTypeController.java
@@ -35,6 +35,19 @@
        return R.ok().add(planTypeService.selectList(new EntityWrapper<PlanType>().orderBy("id")));
    }
    @PostMapping(value = "/planType/list/radio/auth")
    public R listRadio() {
        List<PlanType> planTypes = planTypeService.selectList(new EntityWrapper<PlanType>().orderBy("id"));
        for (int i = 0; i<planTypes.size(); i++) {
            planTypes.get(i).setData("");
            planTypes.get(i).setHtml("");
            if (i == 0) {
                planTypes.get(i).setChecked("checked");
            }
        }
        return R.ok().add(planTypes);
    }
    @RequestMapping(value = "/planType/page/auth")
    @ManagerAuth
    public R page(@RequestParam(defaultValue = "1")Integer curr,
src/main/java/com/zy/crm/manager/entity/PlanType.java
@@ -24,6 +24,9 @@
    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    public String checked = "";
    /**
     * ID
     */
src/main/webapp/static/js/plan/plan.js
@@ -196,7 +196,7 @@
    $("#planAddBtn").click(function () {
        let loadIndex = layer.load(2);
        $.ajax({
            url: baseUrl+"/planType/list/auth",
            url: baseUrl+"/planType/list/radio/auth",
            headers: {'token': localStorage.getItem('token')},
            method: 'POST',
            success: function (res) {
@@ -207,10 +207,41 @@
                        title: '新建售前规划申请单',
                        content: $('#addDialogPre').html(),
                        success: function (layero, dIndex) {
                            element.init();
                            form.render();
                            let template = Handlebars.compile($('#planTypeTpl').html());
                            $('#planTypeBox').html(template({list: res.data.map(function (d) {
                                    return {
                                        id: d.id,
                                        name: d.name,
                                        checked: d.checked
                                    }
                                })})
                            );
                            element.init();form.render();
                            layer.close(loadIndex);
                            console.log(res.data);
                            form.on('submit(planTypeSubmit)', function (data) {
                                // var loadIndex = layer.load(2);
                                // $.ajax({
                                //     url: baseUrl+"/plan/"+(mData?'update':'add')+"/auth",
                                //     headers: {'token': localStorage.getItem('token')},
                                //     data: data.field,
                                //     method: 'POST',
                                //     success: function (res) {
                                //         layer.close(loadIndex);
                                //         if (res.code === 200){
                                //             layer.close(dIndex);
                                //             layer.msg(res.msg, {icon: 1});
                                //             tableReload();
                                //         } else if (res.code === 403){
                                //             top.location.href = baseUrl+"/";
                                //         }else {
                                //             layer.msg(res.msg, {icon: 2});
                                //         }
                                //     }
                                // })
                                alert(data.field.planType);
                                return false;
                            });
                        }
                    })
                } else if (res.code === 403){
src/main/webapp/views/plan/plan.html
@@ -112,6 +112,7 @@
</script>
<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.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>
<script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script>
@@ -120,10 +121,7 @@
</body>
<script type="text/html" id="addDialogPre">
    <div class="layui-form admin-form">
        <div class="layui-input-block" style="margin: 20px 0px 20px 30px">
            <input type="radio" name="gk" value="0" title="公开" checked>
            <input type="radio" name="gk" value="1" title="部分公开">
            <input type="radio" name="gk" value="2" title="不公开">
        <div id="planTypeBox" class="layui-input-block" style="margin: 20px 0px 20px 30px">
        </div>
        <hr class="layui-bg-gray">
        <div class="layui-form-item text-right" style="margin-right: 20px">
@@ -131,6 +129,11 @@
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
        </div>
    </div>
</script>
<script type="text/template" id="planTypeTpl">
    {{#each list}}
    <input type="radio" name="planType" value="{{id}}" title="{{name}}" {{checked}}>
    {{/each}}
</script>
<!-- 表单弹窗 -->
@@ -340,5 +343,6 @@
        </div>
    </form>
</script>
</html>