From c006303854f0e689e2aeedeea389cc91657d0503 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期六, 19 十一月 2022 09:13:58 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/crm/manager/controller/PlanFollController.java |   12 
 src/main/webapp/static/js/plan/plan.js                              |  282 +++++++++++++++++++---
 src/main/webapp/views/plan/plan_more.html                           |  395 ++++++++++++++++++++++++++++++++
 src/main/java/com/zy/crm/manager/entity/Plan.java                   |    9 
 src/main/webapp/static/js/common.js                                 |    1 
 5 files changed, 646 insertions(+), 53 deletions(-)

diff --git a/src/main/java/com/zy/crm/manager/controller/PlanFollController.java b/src/main/java/com/zy/crm/manager/controller/PlanFollController.java
index bdaeba5..18807e5 100644
--- a/src/main/java/com/zy/crm/manager/controller/PlanFollController.java
+++ b/src/main/java/com/zy/crm/manager/controller/PlanFollController.java
@@ -1,23 +1,25 @@
 package com.zy.crm.manager.controller;
 
-import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.mapper.Wrapper;
 import com.baomidou.mybatisplus.plugins.Page;
-import com.core.common.DateUtils;
-import com.zy.crm.manager.entity.PlanFoll;
-import com.zy.crm.manager.service.PlanFollService;
 import com.core.annotations.ManagerAuth;
 import com.core.common.BaseRes;
 import com.core.common.Cools;
+import com.core.common.DateUtils;
 import com.core.common.R;
 import com.core.domain.KeyValueVo;
 import com.zy.crm.common.web.BaseController;
+import com.zy.crm.manager.entity.PlanFoll;
+import com.zy.crm.manager.service.PlanFollService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 @RestController
 public class PlanFollController extends BaseController {
diff --git a/src/main/java/com/zy/crm/manager/entity/Plan.java b/src/main/java/com/zy/crm/manager/entity/Plan.java
index 355652f..142cb76 100644
--- a/src/main/java/com/zy/crm/manager/entity/Plan.java
+++ b/src/main/java/com/zy/crm/manager/entity/Plan.java
@@ -7,6 +7,7 @@
 import com.core.common.Cools;
 import com.core.common.SpringUtils;
 import com.zy.crm.manager.service.CstmrService;
+import com.zy.crm.manager.service.OrderService;
 import com.zy.crm.manager.service.PlanNeedService;
 import com.zy.crm.manager.service.PlanTypeService;
 import com.zy.crm.system.entity.Dept;
@@ -336,10 +337,10 @@
     }
 
     public String getOrderId$(){
-        UserService service = SpringUtils.getBean(UserService.class);
-        User user = service.selectById(this.orderId);
-        if (!Cools.isEmpty(user)){
-            return String.valueOf(user.getNickname());
+        OrderService service = SpringUtils.getBean(OrderService.class);
+        Order order = service.selectById(this.orderId);
+        if (!Cools.isEmpty(order)){
+            return String.valueOf(order.getName());
         }
         return null;
     }
diff --git a/src/main/webapp/static/js/common.js b/src/main/webapp/static/js/common.js
index 9285287..34aca17 100644
--- a/src/main/webapp/static/js/common.js
+++ b/src/main/webapp/static/js/common.js
@@ -263,3 +263,4 @@
 var popupRight;
 var cstmrByMore;
 var orderByMore;
+var planByMore;
diff --git a/src/main/webapp/static/js/plan/plan.js b/src/main/webapp/static/js/plan/plan.js
index d0b73ea..14ee02a 100644
--- a/src/main/webapp/static/js/plan/plan.js
+++ b/src/main/webapp/static/js/plan/plan.js
@@ -1,18 +1,125 @@
 var pageCurr;
 var pageCount = 0;
+var treeCond;
+var admin;
 layui.config({
     base: baseUrl + "/static/layui/lay/modules/"
 }).extend({
     steps: 'steps/steps',
-}).use(['table','laydate', 'form', 'admin', 'xmSelect', 'steps'], function(){
+}).use(['table','laydate', 'form', 'admin', 'xmSelect', 'steps', 'element', 'cascader', 'tree', 'dropdown'], function(){
     var table = layui.table;
     var $ = layui.jquery;
     var layer = layui.layer;
     var layDate = layui.laydate;
     var form = layui.form;
-    var admin = layui.admin;
+    admin = layui.admin;
     var xmSelect = layui.xmSelect;
     var steps = layui.steps;
+    var cascader = layui.cascader;
+    var tree = layui.tree;
+    var dropdown = layui.dropdown;
+
+    $('#organization').html(localStorage.getItem('nickname') + ' <i class="layui-icon">&#xe61a;</i>');
+
+    // 閮ㄩ棬浜哄憳 绛涢��
+    dropdown.render({
+        elem: '#organization'
+        ,content: ['<div id="organizationTree" style="height: calc(100vh - 525px);border: none"></div>'].join('')
+        ,style: 'width: 370px; height: 350px; padding: 0 15px; box-shadow: 1px 1px 30px rgb(0 0 0 / 12%);'
+        ,ready: function(){
+            loadTree();
+        }
+    });
+
+    // 鏁版嵁鍚屾
+    dropdown.render({
+        elem: '#data-btn'
+        ,align: 'right'
+        ,style: 'border-radius: 5px;'
+        ,className: 'site-dropdown-demo'
+        ,data: [
+            {
+                title: '妯℃澘涓嬭浇'
+                ,templet: '<i class="layui-icon layui-icon-template-1"></i>{{d.title}}'
+                ,id: 1
+            },
+            {
+                title: '瀵煎叆 Excel'
+                ,templet: '<i class="layui-icon layui-icon-upload"></i>{{d.title}}'
+                ,id: 2
+            },
+            {type: '-'}, //鍒嗗壊绾�
+            {
+                title: '瀵煎嚭 Excel'
+                ,templet: '<i class="layui-icon layui-icon-export"></i>{{d.title}}'
+                ,id: 3
+            }
+        ]
+        ,click: async function(item){
+            switch (item.id) {
+                case 1:
+                    // 妯℃澘涓嬭浇
+                    layer.load(1, {shade: [0.1,'#fff']});
+                    location.href = baseUrl + "/mould/璺熻釜椤圭洰瀵煎叆妯℃澘.xls";
+                    layer.closeAll('loading');
+                    break
+                case 2:
+                    // 瀵煎叆 Excel
+                    $("#importExcel").trigger("click");
+                    break
+                case 3:
+                    // 瀵煎嚭 Excel
+                    layer.msg("鏉ヤ笉鍙婂仛锛岀瓑绛�", {icon: 6});
+                    break
+                default:
+                    break
+            }
+        }
+    });
+
+    // 鏍戝舰鍥�
+    var organizationTree;
+    window.loadTree = function(condition){
+        var loadIndex = layer.load(2);
+        $.ajax({
+            url: baseUrl+"/dept/user/tree/auth",
+            headers: {'token': localStorage.getItem('token')},
+            data: {
+                'condition': condition
+            },
+            method: 'POST',
+            success: function (res) {
+                layer.close(loadIndex);
+                if (res.code === 200){
+                    organizationTree = tree.render({
+                        elem: '#organizationTree',
+                        id: 'organizationTree',
+                        onlyIconControl: true,
+                        data: res.data,
+                        click: function (obj) {
+                            treeCond = {
+                                key: obj.data.key,
+                                val: obj.data.id
+                            }
+                            $('#organization').html(obj.data.title + ' <i class="layui-icon">&#xe61a;</i>');
+                            $('#organizationTree').find('.ew-tree-click').removeClass('ew-tree-click');
+                            $(obj.elem).children('.layui-tree-entry').addClass('ew-tree-click');
+                            clearFormVal($('#search-box'));
+                            tableIns.reload({
+                                where: {[obj.data.key]: obj.data.id},
+                                page: {curr: 1}
+                            });
+                        }
+                    });
+                    treeData = res.data;
+                } else if (res.code === 403){
+                    top.location.href = baseUrl+"/";
+                } else {
+                    layer.msg(res.msg)
+                }
+            }
+        })
+    }
 
     // 鏁版嵁娓叉煋
     tableIns = table.render({
@@ -22,9 +129,10 @@
         page: true,
         limit: 15,
         limits: [15, 30, 50, 100, 200, 500],
-        toolbar: '#toolbar',
-        cellMinWidth: 50,
-        height: 'full-120',
+        // cellMinWidth: 100,
+        height: 'full-148',
+        // size: 'sm',
+        skin: 'line',
         cols: [[
             {type: 'checkbox'}
             // ,{field: 'id', align: 'center',title: 'ID'}
@@ -83,6 +191,23 @@
         }
     });
 
+    // 娣诲姞
+    $("#planAddBtn").click(function () {
+        showEditModel();
+    });
+
+    // 鍒犻櫎
+    form.on('submit(planDel)', function (data) {
+        let checkStatus = layui.table.checkStatus('plan').data;
+        if (checkStatus.length === 0) {
+            layer.msg('璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁', {icon: 2});
+            return;
+        }
+        del(checkStatus.map(function (d) {
+            return d.id;
+        }));
+    });
+
     // 鐩戝惉鎺掑簭浜嬩欢
     table.on('sort(plan)', function (obj) {
         var searchData = {};
@@ -113,44 +238,6 @@
                    return d.id;
                }));
                break;
-            case 'exportData':
-                admin.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
-                    var titles=[];
-                    var fields=[];
-                    obj.config.cols[0].map(function (col) {
-                        if (col.type === 'normal' && col.hide === false && col.toolbar == null) {
-                            titles.push(col.title);
-                            fields.push(col.field);
-                        }
-                    });
-                    var exportData = {};
-                    $.each($('#search-box [name]').serializeArray(), function() {
-                        exportData[this.name] = this.value;
-                    });
-                    var param = {
-                        'plan': exportData,
-                        'fields': fields
-                    };
-                    $.ajax({
-                        url: baseUrl+"/plan/export/auth",
-                        headers: {'token': localStorage.getItem('token')},
-                        data: JSON.stringify(param),
-                        dataType:'json',
-                        contentType:'application/json;charset=UTF-8',
-                        method: 'POST',
-                        success: function (res) {
-                            layer.closeAll();
-                            if (res.code === 200) {
-                                table.exportFile(titles,res.data,'xls');
-                            } else if (res.code === 403) {
-                                top.location.href = baseUrl+"/";
-                            } else {
-                                layer.msg(res.msg, {icon: 2})
-                            }
-                        }
-                    });
-                });
-                break;
         }
     });
 
@@ -158,6 +245,42 @@
     table.on('tool(plan)', function(obj){
         var data = obj.data;
         switch (obj.event) {
+            case 'more':
+                top.planByMore = data.id;
+                admin.popupRight({
+                    type: 1,
+                    window: "top",
+                    area: "1250px",
+                    url: "plan_more.html",
+                    end: function () {
+                        // $(".layui-laypage-btn")[0].click();
+                    }
+                })
+                break;
+            case 'cstmrMore':
+                top.cstmrByMore = data.cstmrId;
+                admin.popupRight({
+                    type: 1,
+                    window: "top",
+                    area: "1250px",
+                    url: "../cstmr/cstmr_more.html",
+                    end: function () {
+                        // $(".layui-laypage-btn")[0].click();
+                    }
+                })
+                break;
+            case 'orderMore':
+                top.orderByMore = data.orderId;
+                admin.popupRight({
+                    type: 1,
+                    window: "top",
+                    area: "1250px",
+                    url: "../order/order_more.html",
+                    end: function () {
+                        // $(".layui-laypage-btn")[0].click();
+                    }
+                })
+                break;
             case 'edit':
                 showEditModel(data);
                 break;
@@ -172,7 +295,7 @@
         admin.open({
             type: 1,
             area: '600px',
-            title: (mData ? '淇敼' : '娣诲姞') + '',
+            title: (mData ? '淇敼' : '娣诲姞') + '鍞墠瑙勫垝鐢宠鍗�',
             content: $('#editDialog').html(),
             success: function (layero, dIndex) {
                 layDateRender(mData);
@@ -335,6 +458,34 @@
         });
     }
 
+    window.loadOrderSel = function () {
+        return xmSelect.render({
+            el: '#orderXmlSel',
+            autoRow: true,
+            filterable: true,
+            remoteSearch: true,
+            radio: true,
+            remoteMethod: function (val, cb, show) {
+                $.ajax({
+                    url: baseUrl + "/order/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});
+                        }
+                    }
+                });
+            }
+        });
+    }
+
     window.loadCstmrSel = function () {
         return xmSelect.render({
             el: '#cstmrXmlSel',
@@ -441,3 +592,46 @@
         $(".layui-laypage-btn")[0].click();
     }
 }
+
+function upload(obj){
+    if(!obj.files) {
+        return;
+    }
+    var file = obj.files[0];
+    admin.confirm('纭鍚屾 [' + file.name +'] 鏂囦欢鍚楋紵', function (index) {
+        layer.load(1, {shade: [0.1,'#fff']});
+        var url = baseUrl + "/plan/excel/import/auth";
+        var form = new FormData();
+        form.append("file", file);
+        let xhr = new XMLHttpRequest();
+        xhr.open("post", url, true);
+        xhr.setRequestHeader('token', localStorage.getItem('token'));
+        xhr.onload = uploadComplete;
+        xhr.onerror =  uploadFailed;
+        xhr.onloadend = function () {
+            layer.closeAll('loading');
+        };
+        // xhr.upload.onprogress = progressFunction;
+        xhr.upload.onloadstart = function(){
+            ot = new Date().getTime();
+            oloaded = 0;
+        };
+        xhr.send(form);
+    }, function(index){
+    });
+}
+function uploadComplete(evt) {
+    let res = JSON.parse(evt.target.responseText);
+    if(res.code === 200) {
+        layer.msg(res.msg, {icon: 1});
+        tableReload();
+    } else {
+        alert(res.msg);
+        // layer.msg(res.msg, {icon: 2});
+    }
+}
+function uploadFailed(evt) {
+    let res = JSON.parse(evt.target.responseText);
+    alert(res.msg);
+    // layer.msg(res.msg, {icon: 2});
+}
diff --git a/src/main/webapp/views/plan/plan_more.html b/src/main/webapp/views/plan/plan_more.html
new file mode 100644
index 0000000..0d9891c
--- /dev/null
+++ b/src/main/webapp/views/plan/plan_more.html
@@ -0,0 +1,395 @@
+<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);
+    }
+
+    .card-body-item {
+        display: inline-block;
+        border-right: 1px solid #e0e0e0;
+        width: 250px;
+        padding: 0 30px 0 10px;
+    }
+    .header-desc {
+        overflow:hidden;
+        white-space: nowrap;
+        text-overflow: ellipsis;
+        -o-text-overflow:ellipsis;
+    }
+
+</style>
+<!-- 姝f枃寮�濮� -->
+<form class="layui-form" id="formAdvForm" lay-filter="formAdvForm" style="height: 100%">
+    <div class="layui-fluid" style="padding-bottom: 75px;">
+        <!-- 鏍囬 -->
+        <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">&#xe609;</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>
+        <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 class="layui-form-item layui-row">
+                            <input name="id" type="hidden" />
+                            <div class="layui-inline layui-col-md6">
+                                <label class="layui-form-label">椤圭洰浠e彿:</label>
+                                <div class="layui-input-block">
+                                    <input name="uuid" class="layui-input" disabled />
+                                </div>
+                            </div>
+                            <div class="layui-inline layui-col-md6">
+                                <label class="layui-form-label">鐢叉柟鍗曚綅:</label>
+                                <div class="layui-input-block">
+                                    <input name="cstmrId$" class="layui-input" disabled />
+                                </div>
+                            </div>
+                            <div class="layui-inline layui-col-md6">
+                                <label class="layui-form-label">椤圭洰鎬婚噾棰�:</label>
+                                <div class="layui-input-block">
+                                    <input name="money" class="layui-input" disabled />
+                                </div>
+                            </div>
+                            <div class="layui-inline layui-col-md6">
+                                <label class="layui-form-label">鎵�灞炲叕鍙�:</label>
+                                <div class="layui-input-block">
+                                    <input name="company$" class="layui-input" disabled/>
+                                </div>
+                            </div>
+                            <div class="layui-inline layui-col-md6">
+                                <label class="layui-form-label">鐪佸競鍖�:</label>
+                                <div class="layui-input-block">
+                                    <input name="pcd$" class="layui-input" disabled />
+                                </div>
+                            </div>
+                            <div class="layui-inline layui-col-md6">
+                                <label class="layui-form-label">椤圭洰鍦板潃:</label>
+                                <div class="layui-input-block">
+                                    <input name="addr" class="layui-input" disabled />
+                                </div>
+                            </div>
+                            <div class="layui-inline layui-col-md6">
+                                <label class="layui-form-label">璐熻矗浜�:</label>
+                                <div class="layui-input-block">
+                                    <input name="director$" class="layui-input" disabled />
+                                </div>
+                            </div>
+                            <div class="layui-inline layui-col-md6">
+                                <label class="layui-form-label">澶囨敞:</label>
+                                <div class="layui-input-block">
+                                    <input name="remarks" class="layui-input" disabled />
+                                </div>
+                            </div>
+
+                            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
+                                <legend style="font-size: 13px">鍏朵粬</legend>
+                            </fieldset>
+                            <div class="layui-inline layui-col-md6">
+                                <label class="layui-form-label">娣诲姞浜哄憳:</label>
+                                <div class="layui-input-block">
+                                    <input name="createBy$" class="layui-input" disabled/>
+                                </div>
+                            </div>
+                            <div class="layui-inline layui-col-md6">
+                                <label class="layui-form-label">淇敼浜哄憳:</label>
+                                <div class="layui-input-block">
+                                    <input name="updateBy$" class="layui-input" disabled/>
+                                </div>
+                            </div>
+                            <div class="layui-inline layui-col-md6">
+                                <label class="layui-form-label">娣诲姞鏃堕棿:</label>
+                                <div class="layui-input-block">
+                                    <input name="createTime$" class="layui-input icon-date" autocomplete="off" disabled/>
+                                </div>
+                            </div>
+                            <div class="layui-inline layui-col-md6">
+                                <label class="layui-form-label">淇敼鏃堕棿:</label>
+                                <div class="layui-input-block">
+                                    <input name="updateTime$" class="layui-input icon-date" autocomplete="off" disabled/>
+                                </div>
+                            </div>
+                        </div>
+
+                    </div>
+                </div>
+            </div>
+            <!-- 璺熻繘浜� -->
+            <div class="layui-col-md3" style="width: 24%;margin-left: 1%">
+                <div class="layui-card">
+                    <div class="layui-card-header">
+                        <span>璺熻繘浜�</span>
+                        <span lay-filter="followerAdd" lay-submit style="float: right;cursor: pointer;">
+                            <i class="layui-icon" style="font-size: 20px;color: #1890ff;">&#xe61f;</i>
+                        </span>
+                    </div>
+                    <div class="layui-card-body">
+                        <table id="followersTable" lay-filter="followersTable"></table>
+                    </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">&#xe666;</i>&emsp;鍒锋柊&emsp;</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/html" id="followerEditDialog">
+    <form id="followerEditForm" lay-filter="followerEditForm" class="layui-form model-form">
+        <input name="experimentId" type="hidden"/>
+        <div class="layui-form-item" style="float: left;clear: none;margin-right: 20px">
+            <label class="layui-form-label">閫夋嫨鎴愬憳</label>
+            <div class="layui-input-block">
+                <div id="followersBox" name="followersBox">
+                </div>
+            </div>
+        </div>
+        <div class="layui-form-item text-right" style="float: left;clear: none">
+            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">鍙栨秷</button>
+            <button class="layui-btn" lay-filter="followerSubmit" lay-submit>淇濆瓨</button>
+        </div>
+    </form>
+</script>
+
+<script>
+    var orderId = top.orderByMore;
+    $('.layui-layer-close').hide();
+    layui.config({
+        base: baseUrl + "/static/layui/lay/modules/"
+    }).extend({
+        notice: 'notice/notice',
+    }).use(['form', 'table', 'laydate', 'notice', 'xmSelect'], function () {
+        var $ = layui.jquery;
+        var form = layui.form;
+        var table = layui.table;
+        var laydate = layui.laydate;
+        var notice = layui.notice;
+        var xmSelect = layui.xmSelect;
+
+        form.render('select');
+
+        init();
+        function init(){
+            notice.msg('姝e湪杞藉叆鏁版嵁......', {icon: 4, position: "topRight"});
+            $.ajax({
+                url: baseUrl + "/order/" + orderId + "/auth",
+                headers: {'token': localStorage.getItem('token')},
+                method: 'GET',
+                success: function (res) {
+                    notice.destroy();
+                    if (res.code === 200) {
+                        let order = res.data;
+                        top.orderByMore = null;
+                        $("#form-name").html(order.name);
+                        // 璁惧鏄庣粏
+                        form.val('formAdvForm', order);
+                        // 璺熻繘浜�
+                        initFollowers(order.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();
+
+        // 娓叉煋璺熻繘浜烘ā鍧�
+        function initFollowers(orderId) {
+            if (!orderId) {
+                return;
+            }
+            $.ajax({
+                url: baseUrl+"/order/followers/table/auth",
+                headers: {'token': localStorage.getItem('token')},
+                data: {
+                    orderId: orderId
+                },
+                method: 'GET',
+                success: function (res) {
+                    if (res.code === 200){
+                        var follTab = table.render({
+                            elem: '#followersTable',
+                            data: res.data,
+                            limit: 999,
+                            height: 'full-408',
+                            cols: [[
+                                {field: 'userName', title: '宸ヤ綔浜哄憳'},
+                                {fixed: 'right', title:'', align: 'center', toolbar: '#followerTabOperate', width: 70}
+                            ]],
+                            done: function (res, curr, count) {
+                                $('#dictTable+.layui-table-view .layui-table-body tbody>tr:first').trigger('click');
+                            }
+                        });
+                        // 鐩戝惉琛屽伐鍏蜂簨浠�
+                        table.on('tool(followersTable)', function(obj){
+                            let data = obj.data;
+                            switch (obj.event) {
+                                case "del":
+                                    let loadIndex = layer.load(2);
+                                    $.ajax({
+                                        url: baseUrl+"/order/followers/remove/auth",
+                                        headers: {'token': localStorage.getItem('token')},
+                                        data: {
+                                            orderId: orderId,
+                                            userId: data.userId
+                                        },
+                                        method: 'POST',
+                                        success: function (res) {
+                                            layer.close(loadIndex);
+                                            if (res.code === 200){
+                                                initFollowers(orderId);
+                                            } else if (res.code === 403){
+                                                top.location.href = baseUrl+"/";
+                                            } else {
+                                                layer.msg(res.msg, {icon: 2});
+                                            }
+                                        }
+                                    })
+                                    break;
+                            }
+                        });
+                    } else if (res.code === 403){
+                        top.location.href = baseUrl+"/";
+                    }else {
+                        layer.msg(res.msg, {icon: 2})
+                    }
+                }
+            })
+        }
+
+        // 娣诲姞璺熻繘浜�
+        var followerLayer;
+        form.on('submit(followerAdd)', function (data) {
+            if (followerLayer) {return;}
+            followerLayer = admin.open({
+                type: 1,
+                offset: '150px',
+                area: '600px',
+                title: '娣诲姞璺熻繘浜�',
+                content: $('#followerEditDialog').html(),
+                success: function (layero, dIndex) {
+                    // 琛ㄥ崟鎻愪氦浜嬩欢
+                    form.on('submit(followerSubmit)', function (data) {
+                        let selectList = xmSelectIdx.getValue();
+                        if (selectList.length === 0) {
+                            layer.msg("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�", {icon: 3});
+                            return false;
+                        }
+                        let loadIndex = layer.load(2);
+                        $.ajax({
+                            url: baseUrl+"/order/followers/add/auth",
+                            headers: {'token': localStorage.getItem('token')},
+                            data: {
+                                orderId: orderId,
+                                followerIds: selectList.map(function (d) {
+                                    return d.value;
+                                })
+                            },
+                            method: 'POST',
+                            success: function (res) {
+                                if (res.code === 200){
+                                    layer.close(loadIndex);
+                                    initFollowers(orderId);
+                                } else if (res.code === 403){
+                                    top.location.href = baseUrl+"/";
+                                }else {
+                                    layer.msg(res.msg, {icon: 2})
+                                }
+                            }
+                        })
+                        layer.close(dIndex);
+                        return false;
+                    });
+                    let xmSelectIdx = xmSelect.render({
+                        el: '#followersBox',
+                        style: {
+                            width: '280px',
+                        },
+                        autoRow: true,
+                        toolbar: { show: true },
+                        filterable: true,
+                        remoteSearch: true,
+                        remoteMethod: function(val, cb, show){
+                            $.ajax({
+                                url: baseUrl+"/user/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});
+                                    }
+                                }
+                            });
+                        }
+                    })
+                    // 寮圭獥涓嶅嚭鐜版粴鍔ㄦ潯
+                    $(layero).children('.layui-layer-content').css('overflow', 'visible');
+                    layui.form.render('select');
+                },
+                end: function () {
+                    followerLayer = null;
+                }
+            })
+        });
+
+        /* 鐩戝惉琛ㄥ崟鎻愪氦 */
+        form.on('submit(refresh)', function (data) {
+            init();
+            return false;
+        });
+
+    })
+</script>

--
Gitblit v1.9.1