From 34f99d106551b51bf2af3bbd40c64624a3af25eb Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期六, 09 九月 2023 09:43:57 +0800
Subject: [PATCH] #

---
 src/main/webapp/views/cstmr/cstmr_more.html |  305 ++++++++++++++++++++++++++++++++------------------
 1 files changed, 194 insertions(+), 111 deletions(-)

diff --git a/src/main/webapp/views/cstmr/cstmr_more.html b/src/main/webapp/views/cstmr/cstmr_more.html
index fc8fcc5..c1c5e3c 100644
--- a/src/main/webapp/views/cstmr/cstmr_more.html
+++ b/src/main/webapp/views/cstmr/cstmr_more.html
@@ -22,27 +22,18 @@
         background-color: #fff;
         box-shadow: 0 -1px 2px 0 rgba(0, 0, 0, .05);
     }
-    .cool-divider {
-        float: left;
-        margin: 4px 18px;
-        display: inline-block;
-        height: 32px;
-        width: 1px;
-        vertical-align: middle;
-        position: relative;
-        top: -.06em;
-        box-sizing: border-box;
-        -webkit-tap-highlight-color: transparent;
-        margin-top: 5px !important;
-        margin-bottom: 5px !important;
-        background: #c8d1dabd;
-    }
 
     .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>
@@ -51,25 +42,26 @@
     <div class="layui-fluid" style="padding-bottom: 75px;">
         <!-- 鏍囬 -->
         <div class="layui-card">
-            <div class="layui-card-header">
+            <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">&#xe68e;</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">
                 <div class="card-body-item">
                     <div class="header-sub">
-                        鐢佃瘽
+                        瀹㈡埛鐢佃瘽
                     </div>
                     <div class="header-desc" id="form-tel">
                         &nbsp;
                     </div>
                 </div>
 
-                <div class="card-body-item">
+                <div class="card-body-item" style="width: 400px">
                     <div class="header-sub">
-                        璇︾粏鍦板潃
+                        瀹㈡埛璇︾粏鍦板潃
                     </div>
                     <div class="header-desc" id="form-addr">
                         &nbsp;
@@ -86,9 +78,9 @@
                 </div>
             </div>
         </div>
-        <!-- 鍩烘湰淇℃伅 -->
         <div class="layui-row">
-            <div class="layui-col-md9">
+            <!-- 鍩烘湰淇℃伅 -->
+            <div class="layui-col-md12">
                 <div class="layui-card">
                     <div class="layui-card-header">
                         鍩烘湰淇℃伅
@@ -115,12 +107,12 @@
                                     <input name="cstmrType$" 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="rela" 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="rela" class="layui-input" disabled/>-->
+<!--                                </div>-->
+<!--                            </div>-->
                             <div class="layui-inline layui-col-md6">
                                 <label class="layui-form-label">鐪佸競鍖�:</label>
                                 <div class="layui-input-block">
@@ -139,7 +131,7 @@
                                     <input name="type$" class="layui-input" disabled />
                                 </div>
                             </div>
-                            <div class="layui-inline layui-col-md6">
+                            <div class="layui-inline layui-col-md12">
                                 <label class="layui-form-label">澶囨敞:</label>
                                 <div class="layui-input-block">
                                     <input name="remarks" class="layui-input" disabled />
@@ -178,28 +170,51 @@
                     </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 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>
+<!--            &lt;!&ndash; 璺熻繘浜� &ndash;&gt;-->
+<!--            <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>
-        <button class="layui-btn layui-btn-normal" lay-filter="save" lay-submit><i class="layui-icon">&#xe654;</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 cstmrId = top.cstmrByMore;
     $('.layui-layer-close').hide();
@@ -207,12 +222,13 @@
         base: baseUrl + "/static/layui/lay/modules/"
     }).extend({
         notice: 'notice/notice',
-    }).use(['form', 'table', 'laydate', 'notice'], function () {
+    }).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');
 
@@ -230,7 +246,7 @@
                         top.cstmrByMore = null;
                         $("#form-name").html(cstmr.name);
                         if (cstmr.tel) {$("#form-tel").html(cstmr.tel);}
-                        if (cstmr.addr) {$("#form-addr").html(cstmr.addr);}
+                        if (cstmr.addr) {$("#form-addr").html(cstmr.addr);$("#form-addr").attr("title", cstmr.addr);}
                         if (cstmr.director$) {$("#form-director").html(cstmr.director$);}
                         // 璁惧鏄庣粏
                         form.val('formAdvForm', cstmr);
@@ -260,84 +276,151 @@
             if (!cstmrId) {
                 return;
             }
-            var insTb = table.render({
-                elem: '#followersTable',
-                url: baseUrl + '/cstmr/followers/table/auth',
-                where: {
+            $.ajax({
+                url: baseUrl+"/cstmr/followers/table/auth",
+                headers: {'token': localStorage.getItem('token')},
+                data: {
                     cstmrId: cstmrId
                 },
-                height: 'full-100',
-                headers: {token: localStorage.getItem('token')},
-                request: {
-                    pageName: 'curr',
-                    pageSize: 'limit'
-                },
-                parseData: function (res) {
-                    return {
-                        'code': res.code,
-                        'msg': res.msg,
-                        'count': res.data.total,
-                        'data': res.data.records
+                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+"/cstmr/followers/remove/auth",
+                                        headers: {'token': localStorage.getItem('token')},
+                                        data: {
+                                            cstmrId: cstmrId,
+                                            userId: data.userId
+                                        },
+                                        method: 'POST',
+                                        success: function (res) {
+                                            layer.close(loadIndex);
+                                            if (res.code === 200){
+                                                initFollowers(cstmrId);
+                                            } 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})
                     }
-                },
-                response: {
-                    statusCode: 200
-                },
-                toolbar: ['<p>',
-                    '<button lay-event="add" class="layui-btn layui-btn-sm icon-btn"><i class="layui-icon">&#xe654;</i>娣诲姞</button>&nbsp;',
-                    '<button lay-event="edit" class="layui-btn layui-btn-sm layui-btn-warm icon-btn"><i class="layui-icon">&#xe642;</i>淇敼</button>&nbsp;',
-                    '<button lay-event="del" class="layui-btn layui-btn-sm layui-btn-danger icon-btn"><i class="layui-icon">&#xe640;</i>鍒犻櫎</button>',
-                    '</p>'].join(''),
-                defaultToolbar: [],
-                cols: [[
-                    {field: 'id', title: '缂栧彿', width: 70, align: 'center'},
-                    {field: 'name', title: '宸ヤ綔浜哄憳'}
-                ]],
-                done: function (res, curr, count) {
-                    console.log(res)
-                    $('#dictTable+.layui-table-view .layui-table-body tbody>tr:first').trigger('click');
                 }
-            });
+            })
         }
 
+        // 娣诲姞璺熻繘浜�
+        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+"/cstmr/followers/add/auth",
+                            headers: {'token': localStorage.getItem('token')},
+                            data: {
+                                cstmrId: cstmrId,
+                                followerIds: selectList.map(function (d) {
+                                    return d.value;
+                                })
+                            },
+                            method: 'POST',
+                            success: function (res) {
+                                if (res.code === 200){
+                                    layer.close(loadIndex);
+                                    initFollowers(cstmrId);
+                                } 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;
         });
-        form.on('submit(save)', function (elem) {
-            let data = elem.field;
-            notice.msg('姝e湪鎷煎懡淇敼鏁版嵁......', {icon: 4, position: "topRight"});
-            $.ajax({
-                url: baseUrl + "/issue/process/auth",
-                headers: {'token': localStorage.getItem('token')},
-                contentType: 'application/json;charset=UTF-8',
-                method: 'POST',
-                data: JSON.stringify({
-                    id: Number(data.id),
-                    uuid: data.uuid,
-                    dealer: data.dealer,
-                    settle: Number(data.settle),
-                    endTime: top.strToDate(data.endTime$),
-                    // lastTime: data.lastTime,
-                    reason: data.reason,
-                    deal: data.deal,
-                }),
-                success: function (res) {
-                    notice.destroy();
-                    if (res.code === 200) {
-                        notice.success({title: '娑堟伅閫氱煡', message: res.msg});
-                        $('.layui-layer-close').click();
-                    } else if (res.code === 403) {
-                        top.location.href = baseUrl + "/";
-                    } else {
-                        notice.error({title: '娑堟伅閫氱煡', message: res.msg});
-                    }
-                }
-            })
-            return false;
-        });
 
-    });
+    })
 </script>

--
Gitblit v1.9.1