/////////////////////////////////////////////////////////////////////////// // Copyright © 2019 zhongsong. All Rights Reserved. // 模块描述:显示坐标 /////////////////////////////////////////////////////////////////////////// define([ 'dojo/_base/declare', 'dojo/_base/lang', 'dojo/_base/array', 'dojo/_base/html', 'dojo/topic', 'jimu/BaseWidget', 'jimu/utils', 'jimu/css!libs/zTree_v3/css/zTreeStyle/zTreeStyle.css', 'libs/zTree_v3/js/jquery.ztree.all' ], function (declare, lang, array, html, topic, BaseWidget, aspect, string, utils ) { return declare([BaseWidget], { baseClass: 'jimu-widget-LeftNavigationBar', name: 'LeftNavigationBar', layers: {}, startup: function () { // 暴露在外的接口 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) { }, onOpen: function () { //面板打开的时候触发 (when open this panel trigger) }, onClose: function () { //面板关闭的时候触发 (when this panel is closed trigger) }, onMinimize: function () { this.resize(); }, onMaximize: function () { this.resize(); }, resize: function () { }, begin: function (data) { var that = this; $('.left-navigation-bar-but').click(() => { that.changeImg = !that.changeImg; if (that.changeImg) { $('.l-n-b-b-img').attr("src", "../../images/addL/xzuo.png");//打开 console.log($('.jimu-widget-LeftNavigationBar')) $('.jimu-widget-LeftNavigationBar').css({'left': '0px'}); } else { $('.l-n-b-b-img').attr("src", "../../images/addL/xyou.png");//关闭 $('.jimu-widget-LeftNavigationBar').css({'left': '-250px'}); } }) layui.use(function () { var tree = layui.tree , layer = layui.layer; tree.render({ elem: '#test1' //默认是点击节点可进行收缩 , data: data , id: 'demoId1' , showCheckbox: true //是否显示复选框 , click: function (obj) { var data = obj.data; //获取当前点击的节点数据 // layer.msg('状态:' + obj.state + '
节点数据:' + JSON.stringify(data)); // console.log(obj); var ot = $('.layui-tree-iconArrow'); ot.removeClass("left-navigation-bar-main-down"); var jt = $(`[data-id='${data.id}']`).find('.layui-tree-iconArrow').eq(0); jt.addClass('left-navigation-bar-main-down'); } , showLine: false //是否开启连接线 , oncheck: function (obj) { console.log(obj.data.id, '--', obj.checked); //得到当前点击的节点数据 // console.log(obj.checked); //得到当前节点的展开状态:open、close、normal // console.log(obj.elem); //得到当前节点元素 } }); }) }, changeImg: true, // concheckData: [ // { // id: 1, // choseIt: true, // child: [ // { // id: 11, // choseIt: true, // child: [ // { // id: 111, // choseIt: true, // }, // { // id: 112, // choseIt: true, // }, // { // id: 113, // choseIt: true, // }, // { // id: 114, // choseIt: true, // }, // ] // },{ // id: 12, // choseIt: false, // child: [ // { // id: 121, // choseIt: false, // }, // { // id: 122, // choseIt: false, // }, // { // id: 123, // choseIt: false, // }, // { // id: 124, // choseIt: false, // }, // ] // },{ // id: 13, // choseIt: false, // child: [ // { // id: 131, // choseIt: false, // }, // { // id: 132, // choseIt: false, // }, // { // id: 133, // choseIt: false, // }, // { // id: 134, // choseIt: false, // }, // ] // },{ // id: 14, // choseIt: false, // child: [ // { // id: 141, // choseIt: false, // }, // { // id: 142, // choseIt: false, // }, // { // id: 143, // choseIt: false, // }, // { // id: 144, // choseIt: false, // }, // ] // }, // ] // },{ // id: 2, // choseIt: true, // child: [ // { // id: 21, // choseIt: true, // child: [ // { // id: 211, // choseIt: true, // }, // { // id: 212, // choseIt: true, // }, // { // id: 213, // choseIt: true, // }, // { // id: 214, // choseIt: true, // }, // ] // },{ // id: 22, // choseIt: false, // child: [ // { // id: 221, // choseIt: false, // }, // { // id: 222, // choseIt: false, // }, // { // id: 223, // choseIt: false, // }, // { // id: 224, // choseIt: false, // }, // ] // },{ // id: 23, // choseIt: false, // child: [ // { // id: 231, // choseIt: false, // }, // { // id: 232, // choseIt: false, // }, // { // id: 233, // choseIt: false, // }, // { // id: 234, // choseIt: false, // }, // ] // },{ // id: 24, // choseIt: false, // child: [ // { // id: 241, // choseIt: false, // }, // { // id: 242, // choseIt: false, // }, // { // id: 243, // choseIt: false, // }, // { // id: 244, // choseIt: false, // }, // ] // }, // ] // }, // { // id: 3, // choseIt: true, // child: [ // { // id: 31, // choseIt: true, // child: [ // { // id: 311, // choseIt: true, // }, // { // id: 312, // choseIt: true, // }, // { // id: 313, // choseIt: true, // }, // { // id: 314, // choseIt: true, // }, // ] // },{ // id: 32, // choseIt: false, // child: [ // { // id: 321, // choseIt: false, // }, // { // id: 322, // choseIt: false, // }, // { // id: 323, // choseIt: false, // }, // { // id: 324, // choseIt: false, // }, // ] // },{ // id: 33, // choseIt: false, // child: [ // { // id: 331, // choseIt: false, // }, // { // id: 332, // choseIt: false, // }, // { // id: 333, // choseIt: false, // }, // { // id: 334, // choseIt: false, // }, // ] // },{ // id: 34, // choseIt: false, // child: [ // { // id: 341, // choseIt: false, // }, // { // id: 342, // choseIt: false, // }, // { // id: 343, // choseIt: false, // }, // { // id: 344, // choseIt: false, // }, // ] // }, // ] // }, // ], 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 //do something before this func this.inherited(arguments); } }); });