From f4e277eb8d3f038783d84c174d1d5f6c996e8f65 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 20 一月 2021 16:59:23 +0800
Subject: [PATCH] #
---
src/main/webapp/static/js/tag/tag.js | 228 +++++++++------------------------------------
src/main/webapp/views/tag/tag.html | 28 -----
2 files changed, 51 insertions(+), 205 deletions(-)
diff --git a/src/main/webapp/static/js/tag/tag.js b/src/main/webapp/static/js/tag/tag.js
index 0f3bfe3..046ff58 100644
--- a/src/main/webapp/static/js/tag/tag.js
+++ b/src/main/webapp/static/js/tag/tag.js
@@ -1,102 +1,61 @@
var pageCurr;
-layui.use(['table','laydate', 'form'], function(){
+var tableRender;
+
+layui.config({
+ base: baseUrl + "/static/layui/lay/modules/" // 閰嶇疆妯″潡鎵�鍦ㄧ殑鐩綍
+}).use(['table','laydate', 'form','treeTable'], function(){
var table = layui.table;
var $ = layui.jquery;
var layer = layui.layer;
var layDate = layui.laydate;
var form = layui.form;
+ var treetable = layui.treeTable;
- // 鏁版嵁娓叉煋
- tableIns = table.render({
- elem: '#tag',
- headers: {token: localStorage.getItem('token')},
- url: baseUrl+'/tag/list/auth',
- page: true,
- limit: 16,
- limits: [16, 30, 50, 100, 200, 500],
- even: true,
- toolbar: '#toolbar',
- cellMinWidth: 50,
- cols: [[
- {type: 'checkbox'}
-// ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80}
- ,{field: 'id', align: 'center',title: 'ID'}
- ,{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: 'createTime$', align: 'center',title: '娣诲姞鏃堕棿'}
- ,{field: 'createBy$', align: 'center',title: '娣诲姞浜哄憳',event: 'createBy', style: 'cursor:pointer'}
- ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿'}
- ,{field: 'updateBy$', align: 'center',title: '淇敼浜哄憳',event: 'updateBy', style: 'cursor:pointer'}
- ,{field: 'memo', align: 'center',title: '澶囨敞'}
-
- ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:150}
- ]],
- request: {
- pageName: 'curr',
- pageSize: 'limit'
- },
- parseData: function (res) {
- return {
- 'code': res.code,
- 'msg': res.msg,
- 'count': res.data.total,
- 'data': res.data.records
- }
- },
- response: {
- statusCode: 200
- },
- done: function(res, curr, count) {
- if (res.code === 403) {
- top.location.href = baseUrl+"/";
- }
- pageCurr=curr;
- limit();
- form.on('checkbox(tableCheckbox)', function (data) {
- var _index = $(data.elem).attr('table-index')||0;
- if(data.elem.checked){
- res.data[_index][data.value] = 'Y';
- }else{
- res.data[_index][data.value] = 'N';
- }
- });
- }
- });
-
- // 鐩戝惉鎺掑簭浜嬩欢
- table.on('sort(locMast)', function (obj) {
- var searchData = {};
- $.each($('#search-box [name]').serializeArray(), function() {
- searchData[this.name] = this.value;
- });
- searchData['orderByField'] = obj.field;
- searchData['orderByType'] = obj.type;
- tableIns.reload({
- where: searchData,
- page: {
- curr: 1
+ 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瀛楁鍚嶇О
},
- done: function (res, curr, count) {
- if (res.code === 403) {
- top.location.href = baseUrl+"/";
- }
- pageCurr=curr;
- limit();
+ 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}
+
+ ,{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();
+
// 鐩戝惉澶村伐鍏锋爮浜嬩欢
table.on('toolbar(tag)', function (obj) {
@@ -187,25 +146,6 @@
table.on('tool(tag)', function(obj){
var data = obj.data;
switch (obj.event) {
- // 璇︽儏
- case 'detail':
- layer.open({
- type: 2,
- title: '璇︽儏',
- maxmin: true,
- area: [top.detailWidth, top.detailHeight],
- shadeClose: true,
- content: 'tag_detail.html',
- success: function(layero, index){
- setFormVal(layer.getChildFrame('#detail', index), data, true);
- top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true);
- layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide();
- layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
- layero.find('iframe')[0].contentWindow.layui.form.render('select');
- layero.find('iframe')[0].contentWindow.layui.form.render('checkbox');
- }
- });
- break;
// 缂栬緫
case 'edit':
layer.open({
@@ -224,78 +164,6 @@
layero.find('iframe')[0].contentWindow.layui.form.render('checkbox');
}
});
- break;
- case 'createBy':
- var param = top.reObject(data).createBy;
- if (param === undefined) {
- layer.msg("鏃犳暟鎹�");
- } else {
- layer.open({
- type: 2,
- title: '娣诲姞浜哄憳璇︽儏',
- maxmin: true,
- area: [top.detailWidth, top.detailHeight],
- shadeClose: true,
- content: '../user/user_detail.html',
- success: function(layero, index){
- $.ajax({
- url: "baseUrl+/user/"+ param +"/auth",
- headers: {'token': localStorage.getItem('token')},
- method: 'GET',
- success: function (res) {
- if (res.code === 200){
- setFormVal(layer.getChildFrame('#detail', index), res.data, true);
- top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true);
- layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide();
- layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
- layero.find('iframe')[0].contentWindow.layui.form.render('select');
- layero.find('iframe')[0].contentWindow.layui.form.render('checkbox');
- } else if (res.code === 403){
- top.location.href = baseUrl+"/";
- }else {
- layer.msg(res.msg)
- }
- }
- })
- }
- });
- }
- break;
- case 'updateBy':
- var param = top.reObject(data).updateBy;
- if (param === undefined) {
- layer.msg("鏃犳暟鎹�");
- } else {
- layer.open({
- type: 2,
- title: '淇敼浜哄憳璇︽儏',
- maxmin: true,
- area: [top.detailWidth, top.detailHeight],
- shadeClose: true,
- content: '../user/user_detail.html',
- success: function(layero, index){
- $.ajax({
- url: "baseUrl+/user/"+ param +"/auth",
- headers: {'token': localStorage.getItem('token')},
- method: 'GET',
- success: function (res) {
- if (res.code === 200){
- setFormVal(layer.getChildFrame('#detail', index), res.data, true);
- top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true);
- layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide();
- layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
- layero.find('iframe')[0].contentWindow.layui.form.render('select');
- layero.find('iframe')[0].contentWindow.layui.form.render('checkbox');
- } else if (res.code === 403){
- top.location.href = baseUrl+"/";
- }else {
- layer.msg(res.msg)
- }
- }
- })
- }
- });
- }
break;
}
diff --git a/src/main/webapp/views/tag/tag.html b/src/main/webapp/views/tag/tag.html
index 185415d..542d5f2 100644
--- a/src/main/webapp/views/tag/tag.html
+++ b/src/main/webapp/views/tag/tag.html
@@ -16,29 +16,7 @@
<div id="search-box" class="layui-form layui-card-header">
<div class="layui-inline">
<div class="layui-input-inline">
- <input class="layui-input" type="text" name="id" placeholder="缂栧彿" autocomplete="off">
- </div>
- </div>
- <div class="layui-inline">
- <div class="layui-input-inline cool-auto-complete">
- <input id="createBy" class="layui-input" name="create_by" type="text" placeholder="璇疯緭鍏�" autocomplete="off" style="display: none">
- <input id="createBy$" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" placeholder="娣诲姞浜哄憳" onfocus=this.blur()>
- <div class="cool-auto-complete-window">
- <input class="cool-auto-complete-window-input" data-key="userQueryBycreateBy" onkeyup="autoLoad(this.getAttribute('data-key'))">
- <select class="cool-auto-complete-window-select" data-key="userQueryBycreateBySelect" onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple">
- </select>
- </div>
- </div>
- </div>
- <div class="layui-inline">
- <div class="layui-input-inline cool-auto-complete">
- <input id="updateBy" class="layui-input" name="update_by" type="text" placeholder="璇疯緭鍏�" autocomplete="off" style="display: none">
- <input id="updateBy$" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" placeholder="淇敼浜哄憳" onfocus=this.blur()>
- <div class="cool-auto-complete-window">
- <input class="cool-auto-complete-window-input" data-key="userQueryByupdateBy" onkeyup="autoLoad(this.getAttribute('data-key'))">
- <select class="cool-auto-complete-window-select" data-key="userQueryByupdateBySelect" onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple">
- </select>
- </div>
+ <input class="layui-input" type="text" name="uuid" placeholder="缂栧彿" autocomplete="off">
</div>
</div>
@@ -62,8 +40,8 @@
</script>
<script type="text/html" id="operate">
- <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">璇︽儏</a>
- <a class="layui-btn layui-btn-xs btn-edit" lay-event="edit">缂栬緫</a>
+ <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="edit">淇敼</a>
+ <a class="layui-btn layui-btn-danger layui-btn-xs btn-del" lay-event="del">鍒犻櫎</a>
</script>
<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
--
Gitblit v1.9.1