From 574256babc7e7a4aa95ebe0803587eac3915c18c Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 26 一月 2021 16:44:49 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/tag/tag.js |  198 ++++++++++++++++++++-----------------------------
 1 files changed, 82 insertions(+), 116 deletions(-)

diff --git a/src/main/webapp/static/js/tag/tag.js b/src/main/webapp/static/js/tag/tag.js
index 046ff58..57ef08c 100644
--- a/src/main/webapp/static/js/tag/tag.js
+++ b/src/main/webapp/static/js/tag/tag.js
@@ -3,145 +3,111 @@
 
 layui.config({
     base: baseUrl + "/static/layui/lay/modules/"  // 閰嶇疆妯″潡鎵�鍦ㄧ殑鐩綍
-}).use(['table','laydate', 'form','treeTable'], function(){
+}).use(['table','laydate', 'form','treeTable', 'xmSelect'], function(){
     var table = layui.table;
     var $ = layui.jquery;
     var layer = layui.layer;
     var layDate = layui.laydate;
     var form = layui.form;
-    var treetable = layui.treeTable;
+    var treeTable = layui.treeTable;
+    var xmSelect = layui.xmSelect;
 
-    tableRender = function() {
-        var tableIdx = treetable.render({
-            elem: '#tag',
-            url: baseUrl+'/tag/list/auth',
-            headers: {token: localStorage.getItem('token')},
-            height: 'full-200',
-            tree: {
-                iconIndex: 1,           // 鎶樺彔鍥炬爣鏄剧ず鍦ㄧ鍑犲垪
-                isPidData: true,        // 鏄惁鏄痠d銆乸id褰㈠紡鏁版嵁
-                idName: 'id',  // id瀛楁鍚嶇О
-                pidName: 'parentId'     // pid瀛楁鍚嶇О
-            },
-            toolbar: 'default',
-            cols: [[
-                {type: 'checkbox'}
-                ,{field: 'uuid', align: 'center',title: '缂栧彿'}
-                ,{field: 'name', align: 'center',title: '鍚嶇О'}
-                ,{field: 'parentId', align: 'center',title: '鐖剁骇'}
-                ,{field: 'parentName', align: 'center',title: '鐖剁骇鍚嶇О'}
-                // ,{field: 'path', align: 'center',title: '鍏宠仈璺緞'}
-                // ,{field: 'pathName', align: 'center',title: '鍏宠仈璺緞鍚�'}
-                ,{field: 'type$', align: 'center',title: '绫诲瀷'}
-                ,{field: 'leading', align: 'center',title: '璐熻矗浜�'}
-                ,{field: 'img', align: 'center',title: '鍥剧墖'}
-                ,{field: 'brief', align: 'center',title: '绠�瑕佹弿杩�'}
-                ,{field: 'count', align: 'center',title: '鏁伴噺'}
-                ,{field: 'level', align: 'center',title: '绛夌骇'}
-                ,{field: 'sort', align: 'center',title: '鎺掑簭'}
-                ,{field: 'status$', align: 'center',title: '鐘舵��'}
-                ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿'}
-                ,{field: 'updateBy$', align: 'center',title: '淇敼浜哄憳', hide: true}
-                ,{field: 'memo', align: 'center',title: '澶囨敞', hide: true}
+    var tableIdx = treeTable.render({
+        elem: '#tag',
+        url: baseUrl+'/tag/list/auth',
+        headers: {token: localStorage.getItem('token')},
+        height: 'full-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="del" class="layui-btn layui-btn-sm layui-btn-danger icon-btn"><i class="layui-icon">&#xe640;</i>鍒犻櫎</button>',
+            '</p>'].join(''),
+        tree: {
+            iconIndex: 1,           // 鎶樺彔鍥炬爣鏄剧ず鍦ㄧ鍑犲垪
+            isPidData: true,        // 鏄惁鏄痠d銆乸id褰㈠紡鏁版嵁
+            idName: 'id',  // id瀛楁鍚嶇О
+            pidName: 'parentId'     // pid瀛楁鍚嶇О
+        },
+        cols: [[
+            {type: 'checkbox'}
+            ,{field: 'name', align: 'left',title: '鍚嶇О'}
+            ,{field: 'uuid', align: 'center',title: '缂栧彿'}
+            // ,{field: 'parentId', align: 'center',title: '鐖剁骇'}
+            ,{field: 'parentName', align: 'center',title: '鐖剁骇鍚嶇О'}
+            // ,{field: 'path', align: 'center',title: '鍏宠仈璺緞'}
+            // ,{field: 'pathName', align: 'center',title: '鍏宠仈璺緞鍚�'}
+            ,{field: 'type$', align: 'center',title: '绫诲瀷'}
+            ,{field: 'leading', align: 'center',title: '璐熻矗浜�'}
+            ,{field: 'img', align: 'center',title: '鍥剧墖'}
+            // ,{field: 'brief', align: 'center',title: '绠�瑕佹弿杩�'}
+            ,{field: 'count', align: 'center',title: '鏁伴噺'}
+            // ,{field: 'level', align: 'center',title: '绛夌骇'}
+            ,{field: 'sort', align: 'center',title: '鎺掑簭'}
+            ,{field: 'status$', align: 'center',title: '鐘舵��'}
+            ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿'}
+            ,{field: 'updateBy$', align: 'center',title: '淇敼浜哄憳', hide: true}
+            ,{field: 'memo', align: 'center',title: '澶囨敞', hide: true}
 
-                ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:150}
-            ]],
-            done: function () {
-                tableIdx.expandAll();
-                $(".ew-tree-table .ew-tree-table-tool .ew-tree-table-tool-item").css("display", "none");
-                limit()
-            }
-        });
-
-    }
-    tableRender();
+            ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:150}
+        ]],
+        done: function (data) {
+            tableIdx.expandAll();
+            // $(".ew-tree-table .ew-tree-table-tool .ew-tree-table-tool-item").css("display", "none");
+            // limit()
+        }
+    });
 
 
-    // 鐩戝惉澶村伐鍏锋爮浜嬩欢
-    table.on('toolbar(tag)', function (obj) {
-        var checkStatus = table.checkStatus(obj.config.id);
-        switch(obj.event) {
-            case 'addData':
+    // 澶撮儴宸ュ叿鏍忕偣鍑讳簨浠�
+    treeTable.on('toolbar(tag)', function (obj) {
+        switch (obj.event) {
+            case 'add':
                 layer.open({
                     type: 2,
-                    title: '鏂板',
-                    maxmin: true,
-                    area: [top.detailWidth, top.detailHeight],
+                    title: '鏂板褰掔被',
+                    offset: '100px',
+                    skin: 'layui-cool-class',
+                    area: ['35%', top.detailHeight],
                     content: 'tag_detail.html',
                     success: function(layero, index){
                         layer.getChildFrame('#data-detail-submit-edit', index).hide();
-                    	clearFormVal(layer.getChildFrame('#detail', index));
+                        clearFormVal(layer.getChildFrame('#detail', index));
                         layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
+
+                        // 娓叉煋涓嬫媺鏍�
+                        var insXmSel = xmSelect.render({
+                            el: '#tagParentSel',
+                            height: '250px',
+                            data: tableIdx.options.data,
+                            initValue: [],
+                            model: {label: {type: 'text'}},
+                            prop: {
+                                name: 'name',
+                                value: 'id'
+                            },
+                            radio: true,
+                            clickClose: true,
+                            tree: {
+                                show: true,
+                                indent: 15,
+                                strict: false,
+                                expandedKeys: true
+                            }
+                        });
+                        // 寮圭獥涓嶅嚭鐜版粴鍔ㄦ潯
+                        $(layero).children('.layui-layer-content').css('overflow', 'visible');
                     }
                 });
                 break;
-            case 'deleteData':
-                var data = checkStatus.data;
-                if (data.length === 0){
-                    layer.msg('璇烽�夋嫨鏁版嵁');
-                } else {
-                    layer.confirm('纭畾鍒犻櫎'+(data.length===1?'姝�':data.length)+'鏉℃暟鎹悧', function(){
-                        $.ajax({
-                            url: baseUrl+"/tag/delete/auth",
-                            headers: {'token': localStorage.getItem('token')},
-                            data: {param: JSON.stringify(data)},
-                            method: 'POST',
-                            traditional:true,
-                            success: function (res) {
-                                if (res.code === 200){
-                                    layer.closeAll();
-                                    tableReload(false);
-                                } else if (res.code === 403){
-                                    top.location.href = baseUrl+"/";
-                                } else {
-                                    layer.msg(res.msg)
-                                }
-                            }
-                        })
-                    });
-                }
+            case 'delete':
+                layer.msg('绂佺敤');
                 break;
-            case 'exportData':
-                layer.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 = {
-                        'tag': exportData,
-                        'fields': fields
-                    };
-                    $.ajax({
-                        url: baseUrl+"/tag/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)
-                            }
-                        }
-                    });
-                });
+            case 'update':
+                layer.msg('绂佺敤');
                 break;
         }
     });
 
+
     // 鐩戝惉琛屽伐鍏蜂簨浠�
     table.on('tool(tag)', function(obj){
         var data = obj.data;

--
Gitblit v1.9.1