8 Commits 5e7dce2cf0 ... d19d5e60b9

Author SHA1 Message Date
  yanym d19d5e60b9 首页弹窗修改 1 year ago
  yanym 952f94091f Merge remote-tracking branch 'origin/alert' into alert 1 year ago
  yanym 5d4f766de2 Merge remote-tracking branch 'origin/alert' into alert 1 year ago
  yanym 1991ef0adb Merge remote-tracking branch 'origin/alert' into alert 1 year ago
  yanym c0a7de6dac Merge remote-tracking branch 'origin/alert' into alert 1 year ago
  yanym 9710a09b8c Merge remote-tracking branch 'origin/alert' into alert 1 year ago
  yanym ecc7ce49a0 Merge branch 'alert' of http://git.dgtis.com/qxp/suishenbang-oneportal into alert 1 year ago
  yanym d1e3decafa 首页弹窗修改 1 year ago

+ 163 - 18
suishenbang-admin/src/main/resources/templates/system/alertConfiguration/add.html

@@ -11,7 +11,7 @@
         <div class="form-group">
             <label class="col-sm-3 control-label">弹框内容:</label>
             <div class="col-sm-8">
-                <textarea name="alertContent" class="form-control"></textarea>
+                <textarea id="alertContent" name="alertContent" class="form-control"></textarea>
             </div>
         </div>
         <div class="form-group">
@@ -19,7 +19,7 @@
             <div class="col-sm-8">
                 <div class="input-group date">
                     <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
-                    <input name="alertStartTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
+                    <input id="alertStartTime" name="alertStartTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
                 </div>
             </div>
         </div>
@@ -28,14 +28,14 @@
             <div class="col-sm-8">
                 <div class="input-group date">
                     <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
-                    <input name="alertEndTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
+                    <input id="alertEndTime" name="alertEndTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
                 </div>
             </div>
         </div>
         <div class="form-group">
             <label class="col-sm-3 control-label">弹框每日可弹次数:</label>
             <div class="col-sm-8">
-                <input name="alertNum" class="form-control" type="text">
+                <input id="alertNum" name="alertNum" class="form-control" type="text">
             </div>
         </div>
         <div class="form-group">
@@ -46,6 +46,21 @@
                 </select>
             </div>
         </div>
+        <div class="form-group">
+            <label class="col-sm-3 control-label">部门类型:</label>
+            <div class="col-sm-3">
+                <select title="请选择公司" id="deptType1" class="form-control m-b selectpicker">
+                </select>
+            </div>
+            <div class="col-sm-3">
+                <select title="请选择大区" id="deptType2" class="form-control m-b selectpicker">
+                </select>
+            </div>
+            <div class="col-sm-3">
+                <select title="请选择销售部" id="deptType3" class="form-control m-b selectpicker">
+                </select>
+            </div>
+        </div>
 <!--        <div class="form-group">
             <label class="col-sm-3 control-label">是否启动:</label>
             <div class="col-sm-8">
@@ -56,18 +71,6 @@
                 </div>
             </div>
         </div>-->
-        <!--<div class="form-group">-->
-            <!--<label class="col-sm-3 control-label">是否启动</label>-->
-            <!--<div class="col-sm-8">-->
-                <!--<label class="radio-box">-->
-                    <!--<input type="radio" name="alertStatus" value="0">未启动-->
-                <!--</label>-->
-                <!--<label class="radio-box">-->
-                    <!--<input type="radio" name="alertStatus" value="1">启动-->
-                <!--</label>-->
-                <!--<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>-->
-            <!--</div>-->
-        <!--</div>-->
     </form>
 </div>
 <th:block th:include="include :: footer" />
@@ -75,13 +78,112 @@
 <th:block th:include="include :: bootstrap-select-js" />
 <script type="text/javascript">
     var prefix = ctx + "system/configuration"
+    var getCompanyListPrefix = "http://localhost:10001/wxportal-api/sysuser/searchOrg";
+    // var getCompanyListPrefix = "http://suishenbangtest.nipponpaint.com.cn/wxportal-api/sysuser/searchOrg";
+
+    $(document).ready(function () {
+        var obj = {
+            parType: "diy_level",
+            parValue: ""
+        }
+        getCompanyList(obj);
+        console.log('ctx',ctx);
+    })
+
+    $("#deptType1").on('change',function () {
+        if ($(this).val() != -1){
+            var obj1 = {
+                parType: "company_level",
+                parValue: $(this).val()
+            }
+            $("#deptType2").empty().append("");
+            $("#deptType2").selectpicker('refresh');
+            getCompanyList(obj1);
+        }
+    })
+
+    $("#deptType2").on('change',function () {
+        if ($(this).val() != -1){
+            var obj2 = {
+                parType: "office_level",
+                parValue: $(this).val()
+            }
+            $("#deptType3").empty().append("");
+            $("#deptType3").selectpicker('refresh');
+            getCompanyList(obj2);
+        }
+    })
+
     $("#form-configuration-add").validate({
-        focusCleanup: true
+        focusCleanup: true,
+        rules:{
+            alertContent:{
+                required:true
+            },
+            alertStartTime:{
+                required:true
+            },
+            alertEndTime:{
+                required:true
+            },
+            alertNum: {
+                required:true
+            },
+            userType: {
+                required:true
+            }
+        },
     });
 
     function submitHandler() {
         if ($.validate.form()) {
-            $.operate.save(prefix + "/add", $('#form-configuration-add').serialize());
+            var contentVal = $('#alertContent').val();
+            var startTime = $('#alertStartTime').val();
+            var endTime = $('#alertEndTime').val();
+            var alertNum = $('#alertNum').val();
+            var userType = $('#userType').val().join();
+            var objSubmit = {
+                alertContent:contentVal,
+                alertStartTime:startTime,
+                alertEndTime:endTime,
+                alertNum:alertNum,
+                userType:userType,
+                alertStatus:'0'
+            }
+            if ($('#deptType3').val() != "") {
+                objSubmit.salesLevel = 'suboffice_level';
+                objSubmit.orgCode = $('#deptType3').val();
+                objSubmit.orgName = $('#deptType3').find("option:selected")[0].label
+            }
+            if ($('#deptType2').val() != "" && $('#deptType3').val() == "") {
+                objSubmit.salesLevel = 'office_level';
+                objSubmit.orgCode = $('#deptType2').val();
+                objSubmit.orgName = $('#deptType2').find("option:selected")[0].label
+            }
+            if ($('#deptType1').val() != "" && $('#deptType2').val() == "" && $('#deptType3').val() == "") {
+                objSubmit.salesLevel = 'company_level';
+                objSubmit.orgCode = $('#deptType1').val();
+                objSubmit.orgName = $('#deptType1').find("option:selected")[0].label
+            }
+            if ($('#deptType1').val() == "" && $('#deptType2').val() == "" && $('#deptType3').val() == "") {
+                objSubmit.salesLevel = 'diy_level';
+            }
+            console.log('objSubmit', objSubmit);
+            var configSubmit = {
+                url: prefix + "/add",
+                type: "post",
+                dataType: "json",
+                data: objSubmit,
+                beforeSend: function () {
+                    $.modal.loading("正在处理中,请稍后...");
+                },
+                success:function (result) {
+                    $.modal.closeLoading();
+                    $.operate.successCallback(result);
+                }
+            }
+            $.ajax(configSubmit)
+            // $.operate.save(prefix + "/add", $('#form-configuration-add').serialize());
         }
     }
 
@@ -94,6 +196,49 @@
         format: "yyyy-mm-dd hh:ii",
         autoclose: true
     });
+
+    /* 获取公司列表 */
+    function getCompanyList(obj) {
+        var config = {
+            url: getCompanyListPrefix,
+            type: "post",
+            dataType: "json",
+            data: obj,
+            beforeSend: function () {
+                $.modal.loading("正在处理中,请稍后...");
+            },
+            success: function(result) {
+                $.modal.closeLoading();
+                var companyList = result.dataList;
+                if (companyList && companyList.length != 0){
+                    var options = '';
+                    if (obj.parType == 'diy_level'){
+                        companyList.forEach(item=>{
+                            options += "<option value='" + item.company_code + "'>" + item.company_name + "</option>"
+                        })
+                        $("#deptType1").append(options);
+                        $("#deptType1").selectpicker('refresh');
+                        $("#deptType1").selectpicker('render');
+                    } else if (obj.parType == 'company_level') {
+                        companyList.forEach(item=>{
+                            options += "<option value='" + item.office_code + "'>" + item.office_name + "</option>"
+                        })
+                        $("#deptType2").append(options);
+                        $("#deptType2").selectpicker('refresh');
+                        $("#deptType2").selectpicker('render');
+                    }else {
+                        companyList.forEach(item=>{
+                            options += "<option value='" + item.suboffice_code + "'>" + item.suboffice_name + "</option>"
+                        })
+                        $("#deptType3").append(options);
+                        $("#deptType3").selectpicker('refresh');
+                        $("#deptType3").selectpicker('render');
+                    }
+                }
+            }
+        };
+        $.ajax(config)
+    }
 </script>
 </body>
 </html>

+ 26 - 17
suishenbang-admin/src/main/resources/templates/system/alertConfiguration/configuration.html

@@ -51,15 +51,15 @@
                 <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:configuration:add">
                     <i class="fa fa-plus"></i> 添加
                 </a>
-                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:configuration:edit">
-                    <i class="fa fa-edit"></i> 修改
-                </a>
-                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:configuration:remove">
-                    <i class="fa fa-remove"></i> 删除
-                </a>
-                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:configuration:export">
-                    <i class="fa fa-download"></i> 导出
-                 </a>
+                <!--<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:configuration:edit">-->
+                    <!--<i class="fa fa-edit"></i> 修改-->
+                <!--</a>-->
+                <!--<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:configuration:remove">-->
+                    <!--<i class="fa fa-remove"></i> 删除-->
+                <!--</a>-->
+                <!--<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:configuration:export">-->
+                    <!--<i class="fa fa-download"></i> 导出-->
+                 <!--</a>-->
             </div>
             <div class="col-sm-12 select-table table-striped">
                 <table id="bootstrap-table"></table>
@@ -89,23 +89,27 @@
                 {
                     field : 'alertContent', 
                     title : '弹框内容',
-                    width : '300px',
+                    width : '200px',
                     formatter: function(value, row, index) {
                         return $.table.tooltip(value);
                     }
                 },
                 {
                     field : 'alertStartTime', 
-                    title : '弹框开始时间'
+                    title : '开始时间'
                 },
                 {
                     field : 'alertEndTime', 
-                    title : '弹框结束时间'
+                    title : '结束时间'
                 },
                 {
                     field : 'alertNum', 
-                    title : '弹框每日可弹次数'
+                    title : '次数'
                 },
+                    {
+                        field : 'orgName',
+                        title : '通知部门'
+                    },
                 {
                     field : 'userType',
                     title : '用户类型',
@@ -134,8 +138,13 @@
                     align: 'center',
                     formatter: function(value, row, index) {
                         var actions = [];
-                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.alertId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
-                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.alertId + '\')"><i class="fa fa-remove"></i>删除</a>');
+                        if (row.alertStatus == 1) {
+                            actions.push('<a class="btn btn-default btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>编辑</a> ');
+                            actions.push('<a class="btn btn-default btn-xs ' + removeFlag + '" href="javascript:void(0)"><i class="fa fa-remove"></i>删除</a>');
+                        } else {
+                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.alertId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
+                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.alertId + '\')"><i class="fa fa-remove"></i>删除</a>');
+                        }
                         return actions.join('');
                     }
                 }]
@@ -155,14 +164,14 @@
         /* 停用 */
         function disable(roleId) {
             $.modal.confirm("确认关闭该通知吗?", function() {
-                $.operate.post(prefix + "/edit", { "alertId": roleId, "alertStatus": 0 });
+                $.operate.post(prefix + "/release", { "alertId": roleId, "alertStatus": 0 });
             })
         }
 
         /* 启用 */
         function enable(roleId) {
             $.modal.confirm("确认启用该通知吗?", function() {
-                $.operate.post(prefix + "/edit", { "alertId": roleId, "alertStatus": 1 });
+                $.operate.post(prefix + "/release", { "alertId": roleId, "alertStatus": 1 });
             })
         }
     </script>

+ 270 - 16
suishenbang-admin/src/main/resources/templates/system/alertConfiguration/edit.html

@@ -12,7 +12,7 @@
             <div class="form-group">
                 <label class="col-sm-3 control-label">弹框内容:</label>
                 <div class="col-sm-8">
-                    <textarea name="alertContent" class="form-control">[[*{alertContent}]]</textarea>
+                    <textarea id="alertContent" name="alertContent" class="form-control">[[*{alertContent}]]</textarea>
                 </div>
             </div>
 
@@ -21,7 +21,7 @@
                 <div class="col-sm-8">
                     <div class="input-group date">
                         <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
-                        <input name="alertStartTime" th:value="${#dates.format(alertConfiguration.alertStartTime, 'yyyy-MM-dd hh:mm')}" class="form-control" placeholder="yyyy-MM-dd hh:mm" type="text">
+                        <input id="alertStartTime" name="alertStartTime" th:value="${#dates.format(alertConfiguration.alertStartTime, 'yyyy-MM-dd hh:mm')}" class="form-control" placeholder="yyyy-MM-dd hh:mm" type="text">
                     </div>
                 </div>
             </div>
@@ -30,7 +30,7 @@
                 <div class="col-sm-8">
                     <div class="input-group date">
                         <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
-                        <input name="alertEndTime" th:value="${#dates.format(alertConfiguration.alertEndTime, 'yyyy-MM-dd hh:mm')}" class="form-control" placeholder="yyyy-MM-dd hh:mm" type="text">
+                        <input id="alertEndTime" name="alertEndTime" th:value="${#dates.format(alertConfiguration.alertEndTime, 'yyyy-MM-dd hh:mm')}" class="form-control" placeholder="yyyy-MM-dd hh:mm" type="text">
                     </div>
                 </div>
             </div>
@@ -48,6 +48,28 @@
                     </select>
                 </div>
             </div>
+            <div class="form-group">
+                <input name="alertId" th:field="*{alertId}" style="display: none;">
+                <input name="salesLevel" th:field="*{salesLevel}" style="display: none;">
+                <input name="orgCode" th:field="*{orgCode}" style="display: none;">
+                <input name="orgName" th:field="*{orgName}" style="display: none;">
+                <input name="userTypeStr" th:field="*{userType}" style="display: none;">
+            </div>
+            <div class="form-group">
+                <label class="col-sm-3 control-label">部门类型:</label>
+                <div class="col-sm-3">
+                    <select title="请选择公司" id="deptType1" class="form-control m-b selectpicker">
+                    </select>
+                </div>
+                <div class="col-sm-3">
+                    <select title="请选择大区" id="deptType2" class="form-control m-b selectpicker">
+                    </select>
+                </div>
+                <div class="col-sm-3">
+                    <select title="请选择销售部" id="deptType3" class="form-control m-b selectpicker">
+                    </select>
+                </div>
+            </div>
        <!--     <div class="form-group">
                 <label class="col-sm-3 control-label">是否启动:</label>
                 <div class="col-sm-8">
@@ -58,17 +80,6 @@
                     </div>
                 </div>
             </div>-->
-            <!--<div class="form-group">    -->
-                <!--<label class="col-sm-3 control-label">是否启动:</label>-->
-                <!--<div class="col-sm-8">-->
-                    <!--<label class="radio-box">-->
-                        <!--<input type="radio" name="alertStatus" value="0">未启动-->
-                    <!--</label>-->
-                    <!--<label class="radio-box">-->
-                        <!--<input type="radio" name="alertStatus" value="1">启动-->
-                    <!--</label>-->
-                <!--</div>-->
-            <!--</div>-->
         </form>
     </div>
     <th:block th:include="include :: footer" />
@@ -76,14 +87,176 @@
     <th:block th:include="include :: bootstrap-select-js" />
     <script type="text/javascript">
         var prefix = ctx + "system/configuration";
+        var getCompanyListPrefix = "http://localhost:10001/wxportal-api/sysuser/searchOrg";
+        // var getCompanyListPrefix = "http://suishenbangtest.nipponpaint.com.cn/wxportal-api/sysuser/searchOrg";
+
+        $(document).ready(function () {
+            var formArray = $('#form-configuration-edit').serializeArray();
+            var formData = {};
+            $(formArray ).each(function(index, obj){
+                formData[obj.name] = obj.value;
+            });
+            $("#userType").selectpicker('val',formData.userType.split(','));
+            if (formData.salesLevel == 'company_level'){
+                var objhx1 = {
+                    parType: 'company_level',
+                    parValue: formData.orgCode
+                }
+                var confighuixian1 = {
+                    url: getCompanyListPrefix,
+                    type: "post",
+                    dataType: "json",
+                    data: objhx1,
+                    beforeSend: function () {
+                        $.modal.loading("正在处理中,请稍后...");
+                    },
+                    success: function(result) {
+                        $.modal.closeLoading();
+                        var objList = {
+                            parType: 'diy_level',
+                            parValue: ''
+                        }
+                        getCompanyList(objList,result.levelInfo.company_code);
+                    }
+                }
+                $.ajax(confighuixian1)
+            }else if (formData.salesLevel == 'office_level') {
+                var objhx1 = {
+                    parType: 'office_level',
+                    parValue: formData.orgCode
+                }
+                var confighuixian1 = {
+                    url: getCompanyListPrefix,
+                    type: "post",
+                    dataType: "json",
+                    data: objhx1,
+                    beforeSend: function () {
+                        $.modal.loading("正在处理中,请稍后...");
+                    },
+                    success: function(result) {
+                        $.modal.closeLoading();
+                        var objList = {
+                            parType: 'diy_level',
+                            parValue: ''
+                        }
+                        getCompanyList(objList,result.levelInfo.company_code);
+                        var objList1 = {
+                            parType: 'company_level',
+                            parValue: result.levelInfo.company_code
+                        }
+                        getCompanyList(objList1,result.levelInfo.office_code);
+                    }
+                }
+                $.ajax(confighuixian1)
+            }else if (formData.salesLevel == 'suboffice_level') {
+                var objhx1 = {
+                    parType: 'suboffice_level',
+                    parValue: formData.orgCode
+                }
+                var confighuixian1 = {
+                    url: getCompanyListPrefix,
+                    type: "post",
+                    dataType: "json",
+                    data: objhx1,
+                    beforeSend: function () {
+                        $.modal.loading("正在处理中,请稍后...");
+                    },
+                    success: function(result) {
+                        $.modal.closeLoading();
+                        var objList = {
+                            parType: 'diy_level',
+                            parValue: ''
+                        }
+                        getCompanyList(objList,result.levelInfo.company_code);
+                        var objList1 = {
+                            parType: 'company_level',
+                            parValue: result.levelInfo.company_code
+                        }
+                        getCompanyList(objList1,result.levelInfo.office_code);
+                        var objList2 = {
+                            parType: 'office_level',
+                            parValue: result.levelInfo.office_code
+                        }
+                        getCompanyList(objList2,result.levelInfo.suboffice_code);
+                    }
+                }
+                $.ajax(confighuixian1)
+            }
+        })
+
         $("#form-configuration-edit").validate({
-            focusCleanup: true
+            focusCleanup: true,
+            rules:{
+                alertContent:{
+                    required:true
+                },
+                alertStartTime:{
+                    required:true
+                },
+                alertEndTime:{
+                    required:true
+                },
+                alertNum: {
+                    required:true
+                },
+                userType: {
+                    required:true
+                }
+            }
         });
 
         function submitHandler() {
             if ($.validate.form()) {
-                $.operate.save(prefix + "/edit", $('#form-configuration-edit').serialize());
+                var alertId = $('#alertId').val();
+                var contentVal = $('#alertContent').val();
+                var startTime = $('#alertStartTime').val();
+                var endTime = $('#alertEndTime').val();
+                var alertNum = $('#alertNum').val();
+                var userType = $('#userType').val().join();
+                var objSubmit = {
+                    alertId:alertId,
+                    alertContent:contentVal,
+                    alertStartTime:startTime,
+                    alertEndTime:endTime,
+                    alertNum:alertNum,
+                    userType:userType,
+                    alertStatus:'0'
+                }
+                if ($('#deptType3').val() != "") {
+                    objSubmit.salesLevel = 'suboffice_level';
+                    objSubmit.orgCode = $('#deptType3').val();
+                    objSubmit.orgName = $('#deptType3').find("option:selected")[0].label
+                }
+                if ($('#deptType2').val() != "" && $('#deptType3').val() == "") {
+                    objSubmit.salesLevel = 'office_level';
+                    objSubmit.orgCode = $('#deptType2').val();
+                    objSubmit.orgName = $('#deptType2').find("option:selected")[0].label
+                }
+                if ($('#deptType1').val() != "" && $('#deptType2').val() == "" && $('#deptType3').val() == "") {
+                    objSubmit.salesLevel = 'company_level';
+                    objSubmit.orgCode = $('#deptType1').val();
+                    objSubmit.orgName = $('#deptType1').find("option:selected")[0].label
+                }
+                if ($('#deptType1').val() == "" && $('#deptType2').val() == "" && $('#deptType3').val() == "") {
+                    objSubmit.salesLevel = 'diy_level';
+                }
+                console.log('objSubmit', objSubmit);
+                var configSubmit = {
+                    url: prefix + "/edit",
+                    type: "post",
+                    dataType: "json",
+                    data: objSubmit,
+                    beforeSend: function () {
+                        $.modal.loading("正在处理中,请稍后...");
+                    },
+                    success:function (result) {
+                        $.modal.closeLoading();
+                        $.operate.successCallback(result);
+                    }
+                }
+                $.ajax(configSubmit)
             }
+            // $.operate.save(prefix + "/edit", $('#form-configuration-edit').serialize());
         }
 
         $("input[name='alertStartTime']").datetimepicker({
@@ -95,6 +268,87 @@
             format: "yyyy-mm-dd hh:ii",
             autoclose: true
         });
+
+        $("#deptType1").on('change',function () {
+            if ($(this).val() != -1){
+                var obj1 = {
+                    parType: "company_level",
+                    parValue: $(this).val()
+                }
+                $("#deptType2").empty().append("");
+                $("#deptType2").selectpicker('refresh');
+                $("#deptType3").empty().append("");
+                $("#deptType3").selectpicker('refresh');
+                getCompanyList(obj1,"");
+            }
+        })
+
+        $("#deptType2").on('change',function () {
+            if ($(this).val() != -1){
+                var obj2 = {
+                    parType: "office_level",
+                    parValue: $(this).val()
+                }
+                $("#deptType3").empty().append("");
+                $("#deptType3").selectpicker('refresh');
+                getCompanyList(obj2,"");
+            }
+        })
+
+        /* 获取公司列表 */
+        function getCompanyList(obj,chooseId) {
+            var config = {
+                url: getCompanyListPrefix,
+                type: "post",
+                dataType: "json",
+                data: obj,
+                beforeSend: function () {
+                    $.modal.loading("正在处理中,请稍后...");
+                },
+                success: function(result) {
+                    $.modal.closeLoading();
+                    var companyList = result.dataList;
+                    if (companyList && companyList.length != 0){
+                        var options = '';
+                        if (obj.parType == 'diy_level'){
+                            companyList.forEach(item=>{
+                                if(item.company_code == chooseId){
+                                    options += "<option value='" + item.company_code + "' selected='selected'>" + item.company_name + "</option>"
+                                }else{
+                                    options += "<option value='" + item.company_code + "'>" + item.company_name + "</option>"
+                                }
+                            })
+                            $("#deptType1").append(options);
+                            $("#deptType1").selectpicker('refresh');
+                            $("#deptType1").selectpicker('render');
+                        } else if (obj.parType == 'company_level') {
+                            companyList.forEach(item=>{
+                                if(item.office_code == chooseId){
+                                    options += "<option value='" + item.office_code + "' selected='selected'>" + item.office_name + "</option>"
+                                }else{
+                                    options += "<option value='" + item.office_code + "'>" + item.office_name + "</option>"
+                                }
+                            })
+                            $("#deptType2").append(options);
+                            $("#deptType2").selectpicker('refresh');
+                            $("#deptType2").selectpicker('render');
+                        }else {
+                            companyList.forEach(item=>{
+                                if(item.suboffice_code == chooseId){
+                                    options += "<option value='" + item.suboffice_code + "' selected='selected'>" + item.suboffice_name + "</option>"
+                                }else{
+                                    options += "<option value='" + item.suboffice_code + "'>" + item.suboffice_name + "</option>"
+                                }
+                            })
+                            $("#deptType3").append(options);
+                            $("#deptType3").selectpicker('refresh');
+                            $("#deptType3").selectpicker('render');
+                        }
+                    }
+                }
+            };
+            $.ajax(config)
+        }
     </script>
 </body>
 </html>

+ 42 - 14
suishenbang-api/src/main/java/com/dgtly/api/controller/SysUserController.java

@@ -170,21 +170,49 @@ public class SysUserController extends ApiBaseController {
         return list.size()>0?AjaxResult.success().putKV("list",list):AjaxResult.error(ResultType.NUll);
     }
 
+//    @PostMapping("/searchOrg")
+//    @ApiOperation(value = "查询组织架构",notes = "参数:{'parType':'1','parValue':'xxx'}" )
+//    @ApiImplicitParams({
+//            @ApiImplicitParam(name = "params" , paramType = "body")
+//    })
+//    public Map searchProductParamByCustomerCode() {
+//        ParameterObject obj =  getParameterObject();
+//        OrderSalesParameter salesManager =new OrderSalesParameter();
+//        String payType = obj.getString("parType");
+//        String payValue = obj.getString("parValue");
+//        if("".equals(payType) ||payType ==null){
+//            salesManager.setParType("diy_level");
+//        }else{
+//            salesManager.setParType(payType);
+//            salesManager.setParValue(payValue);
+//        }
+//        Map map = new HashMap();
+//        List<Map<String,Object>> dataList = alertConfigurationService.searchProductParamByCustomerCode(
+//                salesManager.getParType(),salesManager.getParValue());
+//        if(dataList != null && dataList.size() > 0){
+//            map.put("levelInfo",dataList.get(0));
+//            if ("suboffice_level".equals(salesManager.getParType()) ||
+//                    "customer_level".equals(salesManager.getParType()) ||
+//                    "emp_level".equals(salesManager.getParType()) ||
+//                    "saledept_level".equals(salesManager.getParType())
+//            ){
+//                map.put("dataList",new ArrayList());
+//            }else{
+//                map.put("dataList",dataList);
+//            }
+//            return map;
+//        } else {
+//            Map mapnull = new HashMap();
+//            map.put("levelInfo",mapnull);
+//            map.put("dataList",dataList);
+//            return map;
+//        }
+//    }
+
     @PostMapping("/searchOrg")
-    @ApiOperation(value = "查询组织架构",notes = "参数:{'parType':'1','parValue':'xxx'}" )
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "params" , paramType = "body")
-    })
-    public Map searchProductParamByCustomerCode() {
-        ParameterObject obj =  getParameterObject();
-        OrderSalesParameter salesManager =new OrderSalesParameter();
-        String payType = obj.getString("parType");
-        String payValue = obj.getString("parValue");
-        if("".equals(payType) ||payType ==null){
-            salesManager.setParType("diy_level");
-        }else{
-            salesManager.setParType(payType);
-            salesManager.setParValue(payValue);
+    public Map searchProductParamByCustomerCode(OrderSalesParameter salesManager) {
+        if("".equals(salesManager.getParType()) || salesManager.getParType() ==null){
+            salesManager.setParType("div_level");
         }
         Map map = new HashMap();
         List<Map<String,Object>> dataList = alertConfigurationService.searchProductParamByCustomerCode(