From c9f87486592ffeedf218928456d72ab7511ae1bf Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Fri, 04 Jun 2021 11:41:11 +0800
Subject: [PATCH] 左侧导航
---
widgets/LeftNavigationBar/Widget.js | 342 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 339 insertions(+), 3 deletions(-)
diff --git a/widgets/LeftNavigationBar/Widget.js b/widgets/LeftNavigationBar/Widget.js
index 4ca19c8..87a0bf3 100644
--- a/widgets/LeftNavigationBar/Widget.js
+++ b/widgets/LeftNavigationBar/Widget.js
@@ -29,7 +29,16 @@
layers: {},
startup: function () {
// 暴露在外的接口
- this.begin();
+ this.begin(this.data);
+ $('#left-navigation-bar-main-search').click(()=>{
+ var val = $('#left-navigation-bar-main-input').val();
+ if(val){
+ console.log(val);
+
+ }else{
+
+ }
+ })
},
closeToolBox: function (item) {
@@ -54,14 +63,341 @@
resize: function () {
},
- begin: function () {
+ begin: function (data) {
var that = this;
$('.left-navigation-bar-but').click(() => {
that.changeImg = !that.changeImg;
- console.log(that.changeImg)
+ if (that.changeImg) {
+ $('.l-n-b-b-img').attr("src", "../../images/addL/xzuo.png");
+ } else {
+ $('.l-n-b-b-img').attr("src", "../../images/addL/xyou.png");
+ }
})
+
+ layui.use(function () {
+ var tree = layui.tree
+ , layer = layui.layer
+ , util = layui.util;
+ tree.render({
+ elem: '#test1' //默认是点击节点可进行收缩
+ , data: data
+ , showCheckbox: true //是否显示复选框
+ , click: function (obj) {
+ var data = obj.data; //获取当前点击的节点数据
+ layer.msg('状态:' + obj.state + '<br>节点数据:' + JSON.stringify(data));
+ }
+ , showLine: false //是否开启连接线
+ });
+
+ // util.event('lay-demo', {
+ // getChecked: function (othis) {
+ // var checkedData = tree.getChecked('demoId1'); //获取选中节点的数据
+
+ // layer.alert(JSON.stringify(checkedData), { shade: 0 });
+ // console.log(checkedData);
+ // }
+ // , setChecked: function () {
+ // tree.setChecked('demoId1', [12, 16]); //勾选指定节点
+ // }
+ // , reload: function () {
+ // //重载实例
+ // tree.reload('demoId1', {
+
+ // });
+
+ // }
+ // });
+ })
+
},
changeImg: true,
+ data: [{
+ title: '采集站点'
+ , id: 1
+ , field: '1'
+ // , checked: true
+ , spread: true
+ , children: [{
+ title: '南矶山保护区'
+ , id: 11
+ , field: '1-1'
+ // , checked: true
+ , spread: true
+ , children: [{
+ title: '北深渊'
+ , id: 111
+ , field: '1-1-1'
+ , checked: true
+ }, {
+ title: '东湖'
+ , id: 112
+ , field: '1-1-2'
+ , checked: true
+ }, {
+ title: '矶山'
+ , id: 113
+ , field: '1-1-3'
+ , checked: true
+ }, {
+ title: '打钟山'
+ , id: 114
+ , field: '1-1-4'
+ , checked: false
+ // , spread: true
+ }]
+ }, {
+ title: '五星白鹤保护区'
+ , id: 12
+ , field: '1-2'
+ , checked: false
+ , spread: false
+ , children: [{
+ title: '北深渊'
+ , id: 121
+ , field: '1-2-1'
+ }, {
+ title: '东湖'
+ , id: 122
+ , field: '1-2-2'
+ }, {
+ title: '矶山'
+ , id: 123
+ , field: '1-2-3'
+ }, {
+ title: '打钟山'
+ , id: 124
+ , field: '1-2-4'
+ }]
+ }, {
+ title: '都昌候鸟省级自然保护区'
+ , id: 13
+ , field: '1-3'
+ , checked: false
+ , spread: false
+ , children: [{
+ title: '北深渊'
+ , id: 131
+ , field: '1-3-1'
+ }, {
+ title: '东湖'
+ , id: 132
+ , field: '1-3-2'
+ }, {
+ title: '矶山'
+ , id: 133
+ , field: '1-3-3'
+ }, {
+ title: '打钟山'
+ , id: 134
+ , field: '1-3-4'
+ }]
+ }, {
+ title: '都昌北鄱阳湿地公园'
+ , id: 14
+ , field: '1-4'
+ , checked: false
+ , spread: false
+ , children: [{
+ title: '北深渊'
+ , id: 141
+ , field: '1-4-1'
+ }, {
+ title: '东湖'
+ , id: 142
+ , field: '1-4-2'
+ }, {
+ title: '矶山'
+ , id: 143
+ , field: '1-4-3'
+ }, {
+ title: '打钟山'
+ , id: 144
+ , field: '1-4-4'
+ }]
+ }],
+ }, {
+ title: '检测站点'
+ , id: 2
+ , field: '2'
+ , checked: true
+ , spread: false
+ , children: [{
+ title: '南矶山保护区'
+ , id: 21
+ , field: '2-1'
+ , children: [{
+ title: '北深渊'
+ , id: 211
+ , field: '2-1-1'
+ }, {
+ title: '东湖'
+ , id: 212
+ , field: '2-1-2'
+ }, {
+ title: '矶山'
+ , id: 213
+ , field: '2-1-3'
+ }, {
+ title: '打钟山'
+ , id: 214
+ , field: '2-1-4'
+ }]
+ }, {
+ title: '五星白鹤保护区'
+ , id: 22
+ , field: '2-2'
+ , children: [{
+ title: '北深渊'
+ , id: 221
+ , field: '2-2-1'
+ }, {
+ title: '东湖'
+ , id: 222
+ , field: '2-2-2'
+ }, {
+ title: '矶山'
+ , id: 223
+ , field: '2-2-3'
+ }, {
+ title: '打钟山'
+ , id: 224
+ , field: '2-2-4'
+ }]
+ }, {
+ title: '都昌候鸟省级自然保护区'
+ , id: 23
+ , field: '2-3'
+ , children: [{
+ title: '北深渊'
+ , id: 231
+ , field: '2-3-1'
+ }, {
+ title: '东湖'
+ , id: 232
+ , field: '2-3-2'
+ }, {
+ title: '矶山'
+ , id: 233
+ , field: '2-3-3'
+ }, {
+ title: '打钟山'
+ , id: 234
+ , field: '2-3-4'
+ }]
+ }, {
+ title: '都昌北鄱阳湿地公园'
+ , id: 24
+ , field: '2-4'
+ , children: [{
+ title: '北深渊'
+ , id: 241
+ , field: '2-4-1'
+ }, {
+ title: '东湖'
+ , id: 242
+ , field: '2-4-2'
+ }, {
+ title: '矶山'
+ , id: 243
+ , field: '2-4-3'
+ }, {
+ title: '打钟山'
+ , id: 244
+ , field: '2-4-4'
+ }]
+ }],
+ }, {
+ title: '监控站点'
+ , id: 3
+ , field: '3'
+ , checked: true
+ , spread: false
+ , children: [{
+ title: '南矶山保护区'
+ , id: 31
+ , field: '3-1'
+ , children: [{
+ title: '北深渊'
+ , id: 311
+ , field: '3-1-1'
+ }, {
+ title: '东湖'
+ , id: 312
+ , field: '3-1-2'
+ }, {
+ title: '矶山'
+ , id: 313
+ , field: '3-1-3'
+ }, {
+ title: '打钟山'
+ , id: 314
+ , field: '3-1-4'
+ }]
+ }, {
+ title: '五星白鹤保护区'
+ , id: 32
+ , field: '3-2'
+ , children: [{
+ title: '北深渊'
+ , id: 321
+ , field: '3-2-1'
+ }, {
+ title: '东湖'
+ , id: 322
+ , field: '3-2-2'
+ }, {
+ title: '矶山'
+ , id: 323
+ , field: '3-2-3'
+ }, {
+ title: '打钟山'
+ , id: 324
+ , field: '3-2-4'
+ }]
+ }, {
+ title: '都昌候鸟省级自然保护区'
+ , id: 33
+ , field: '3-3'
+ , children: [{
+ title: '北深渊'
+ , id: 331
+ , field: '3-3-1'
+ }, {
+ title: '东湖'
+ , id: 332
+ , field: '3-3-2'
+ }, {
+ title: '矶山'
+ , id: 333
+ , field: '3-3-3'
+ }, {
+ title: '打钟山'
+ , id: 334
+ , field: '3-3-4'
+ }]
+ }, {
+ title: '都昌北鄱阳湿地公园'
+ , id: 34
+ , field: '3-4'
+ , children: [{
+ title: '北深渊'
+ , id: 341
+ , field: '3-4-1'
+ }, {
+ title: '东湖'
+ , id: 342
+ , field: '3-4-2'
+ }, {
+ title: '矶山'
+ , id: 343
+ , field: '3-4-3'
+ }, {
+ title: '打钟山'
+ , id: 344
+ , field: '3-4-4'
+ }]
+ }],
+ }],
destroy: function () {
//销毁的时候触发
//todo
--
Gitblit v1.9.3