|
@@ -1,34 +1,65 @@
|
|
<template>
|
|
<template>
|
|
<div class="deptListComponent">
|
|
<div class="deptListComponent">
|
|
- <p class="title-p">西北农林林大学</p>
|
|
|
|
- <div class="for-big-box" v-for="(bigItem,bigIndex) in treeList" :key="bigItem.id" v-if="bigItem.onType">
|
|
|
|
- <div class="for-big-name-box">
|
|
|
|
- <p class="border-p"></p>
|
|
|
|
- <p></p>
|
|
|
|
- <p :class="bigItem.id == deptId?'checkColor':''">{{bigItem.name}}</p>
|
|
|
|
- </div>
|
|
|
|
- <div class="for-box" v-for="(item,index) in bigItem.buildFloorVoList" :key="item.id" v-if="item.onType">
|
|
|
|
- <div class="for-name-box">
|
|
|
|
- <p class="none-p-1"></p>
|
|
|
|
- <p class="border-p"></p>
|
|
|
|
- <p></p>
|
|
|
|
- <p :class="item.id == buildId?'checkColor':''">{{item.name}}</p>
|
|
|
|
- </div>
|
|
|
|
- <div class="for-min-box" v-for="(minItem,minIndex) in item.buildFloorVoList" :key="minItem.id">
|
|
|
|
- <div class="for-min-name-box" @click="checkButton(bigItem,item,minItem)">
|
|
|
|
- <p class="none-p-1"></p>
|
|
|
|
- <p class="none-p-2"></p>
|
|
|
|
- <p class="border-p"></p>
|
|
|
|
- <p></p>
|
|
|
|
- <p :class="minItem.id == floorId?'checkColor':''">{{minItem.name}}</p>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <!--<p class="title-p">西北农林林大学</p>-->
|
|
|
|
+ <!--<div class="for-big-box" v-for="(bigItem,bigIndex) in treeList" :key="bigItem.id" v-if="bigItem.onType">-->
|
|
|
|
+ <!--<div class="for-big-name-box">-->
|
|
|
|
+ <!--<p class="border-p"></p>-->
|
|
|
|
+ <!--<p></p>-->
|
|
|
|
+ <!--<p :class="bigItem.id == deptId?'checkColor':''">{{bigItem.name}}</p>-->
|
|
|
|
+ <!--</div>-->
|
|
|
|
+ <!--<div class="for-box" v-for="(item,index) in bigItem.buildFloorVoList" :key="item.id" v-if="item.onType">-->
|
|
|
|
+ <!--<div class="for-name-box">-->
|
|
|
|
+ <!--<p class="none-p-1"></p>-->
|
|
|
|
+ <!--<p class="border-p"></p>-->
|
|
|
|
+ <!--<p></p>-->
|
|
|
|
+ <!--<p :class="item.id == buildId?'checkColor':''">{{item.name}}</p>-->
|
|
|
|
+ <!--</div>-->
|
|
|
|
+ <!--<div class="for-min-box" v-for="(minItem,minIndex) in item.buildFloorVoList" :key="minItem.id">-->
|
|
|
|
+ <!--<div class="for-min-name-box" @click="checkButton(bigItem,item,minItem)">-->
|
|
|
|
+ <!--<p class="none-p-1"></p>-->
|
|
|
|
+ <!--<p class="none-p-2"></p>-->
|
|
|
|
+ <!--<p class="border-p"></p>-->
|
|
|
|
+ <!--<p></p>-->
|
|
|
|
+ <!--<p :class="minItem.id == floorId?'checkColor':''">{{minItem.name}}</p>-->
|
|
|
|
+ <!--</div>-->
|
|
|
|
+ <!--</div>-->
|
|
|
|
+ <!--</div>-->
|
|
|
|
+ <!--</div>-->
|
|
|
|
+ <div class="tree-max-box">
|
|
|
|
+ <el-tree
|
|
|
|
+ class="tree-line"
|
|
|
|
+ @node-click="nodeClickButton"
|
|
|
|
+ :indent="0"
|
|
|
|
+ :current-node-key="treeId"
|
|
|
|
+ :check-on-click-node="false"
|
|
|
|
+ check-strictly
|
|
|
|
+ highlight-current
|
|
|
|
+ :default-expanded-keys="defaultKey"
|
|
|
|
+ node-key="treeId"
|
|
|
|
+ :data="deptOptions"
|
|
|
|
+ :props="defaultProps"
|
|
|
|
+ ref="tree"
|
|
|
|
+ :load="loadNode"
|
|
|
|
+ accordion
|
|
|
|
+ lazy>
|
|
|
|
+ <template #default="{ node, data }">
|
|
|
|
+ <span style="
|
|
|
|
+ max-width:255px;
|
|
|
|
+ display:block;
|
|
|
|
+ overflow:hidden;
|
|
|
|
+ text-overflow:ellipsis;
|
|
|
|
+ white-space:nowrap;"
|
|
|
|
+ :style="!data.level?'font-size:20px':(data.level==1?'font-size:26px':(data.level==2||data.level==3||data.level==4?'font-size:24px':(data.level==5?'font-size:20px':'')))">{{data.deptName}}</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-tree>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
- import { systemBuildingGetTreeList,} from "@/api/index";
|
|
|
|
|
|
+ import {
|
|
|
|
+ laboratoryLabDeptTreeGetTreeList,
|
|
|
|
+ laboratorySubPassOutGetCountByBuildId,
|
|
|
|
+ } from "@/api/index";
|
|
export default {
|
|
export default {
|
|
name: 'deptListComponent',
|
|
name: 'deptListComponent',
|
|
data () {
|
|
data () {
|
|
@@ -40,14 +71,25 @@
|
|
buildId:null,
|
|
buildId:null,
|
|
buildName:null,
|
|
buildName:null,
|
|
floorId:null,
|
|
floorId:null,
|
|
- floorName:null
|
|
|
|
|
|
+ floorName:null,
|
|
|
|
+ //新树
|
|
|
|
+ deptOptions: null,
|
|
|
|
+ defaultKey:null,
|
|
|
|
+ defaultProps: {
|
|
|
|
+ children: "childTreeList",
|
|
|
|
+ label: "deptName",
|
|
|
|
+ isLeaf:"leaf",
|
|
|
|
+ },
|
|
|
|
+ //当前选中ID
|
|
|
|
+ treeId:null,
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created(){
|
|
created(){
|
|
|
|
|
|
},
|
|
},
|
|
mounted(){
|
|
mounted(){
|
|
- this.systemBuildingGetTreeList()
|
|
|
|
|
|
+ // this.systemBuildingGetTreeList()
|
|
|
|
+ this.laboratoryLabDeptTreeGetTreeList()
|
|
},
|
|
},
|
|
methods:{
|
|
methods:{
|
|
//选中楼层
|
|
//选中楼层
|
|
@@ -123,6 +165,141 @@
|
|
}
|
|
}
|
|
return list
|
|
return list
|
|
},
|
|
},
|
|
|
|
+
|
|
|
|
+ //新树
|
|
|
|
+ laboratoryLabDeptTreeGetTreeList() {
|
|
|
|
+ let self = this;
|
|
|
|
+ laboratoryLabDeptTreeGetTreeList({}).then(response => {
|
|
|
|
+ let self = this;
|
|
|
|
+ let list = this.delList(response.data);
|
|
|
|
+ this.$nextTick(()=>{
|
|
|
|
+ let checkData = list[0].childTreeList[0].childTreeList[0].childTreeList[0].childTreeList[0];
|
|
|
|
+ //写入楼层下数据
|
|
|
|
+ this.$set(this,'deptOptions',list)
|
|
|
|
+ //展开列表
|
|
|
|
+ this.$set(this,'defaultKey',[list[0].treeId,list[0].childTreeList[0].treeId,list[0].childTreeList[0].childTreeList[0].treeId,list[0].childTreeList[0].childTreeList[0].childTreeList[0].treeId]);
|
|
|
|
+ setTimeout(function(){
|
|
|
|
+ //选中列表
|
|
|
|
+ self.$refs.tree.setCurrentKey(checkData.treeId);
|
|
|
|
+ self.$set(self,'treeId',checkData.treeId);
|
|
|
|
+ //当前位置展示
|
|
|
|
+ self.checkAddress(checkData.treeId);
|
|
|
|
+ //查询实验室人数
|
|
|
|
+ self.laboratorySubPassOutGetCountByBuildId(2,checkData.treeId);
|
|
|
|
+ //父级地图数据
|
|
|
|
+ self.$parent.setMapData(checkData);
|
|
|
|
+ },200);
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ //空数据处理
|
|
|
|
+ delList(list){
|
|
|
|
+ let self = this;
|
|
|
|
+ for(let i=1;i<4;i++){
|
|
|
|
+ list.forEach((item,index)=>{
|
|
|
|
+ if(item.level != 5){
|
|
|
|
+ if(item.childTreeList){
|
|
|
|
+ if(!item.childTreeList[0]){
|
|
|
|
+ list.splice(index,1)
|
|
|
|
+ }else{
|
|
|
|
+ self.delList(item.childTreeList);
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ list.splice(index,1)
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ item.leaf = true;
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ return list
|
|
|
|
+ },
|
|
|
|
+ //点击操作
|
|
|
|
+ nodeClickButton(e,data){
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ if (e.level == 5) {
|
|
|
|
+ if(this.treeId != e.treeId){
|
|
|
|
+ this.treeId = e.treeId;
|
|
|
|
+ //等待后续逻辑-面板展示-实验室信息-视屏信息
|
|
|
|
+ //当前位置展示
|
|
|
|
+ this.checkAddress(e.treeId);
|
|
|
|
+ //查询实验室人数
|
|
|
|
+ this.laboratorySubPassOutGetCountByBuildId(2,e.treeId);
|
|
|
|
+ //父级地图数据
|
|
|
|
+ this.$parent.setMapData(e);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.$refs.tree.setCurrentKey(this.treeId);
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ //手动加载
|
|
|
|
+ loadNode(node, resolve) {
|
|
|
|
+ let self = this;
|
|
|
|
+ if (node.data){
|
|
|
|
+ if(node.data.level != 5){
|
|
|
|
+ if(node.data.childTreeList){
|
|
|
|
+ if(node.data.childTreeList[0]){
|
|
|
|
+ if(node.data.level != 4){
|
|
|
|
+ node.data.childTreeList.forEach((item)=>{
|
|
|
|
+ if(item.childTreeList){
|
|
|
|
+ if(!item.childTreeList[0]){
|
|
|
|
+ item.leaf = true;
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ item.leaf = true;
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ resolve(node.data.childTreeList);
|
|
|
|
+ }else{
|
|
|
|
+ resolve([]);
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ resolve([]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ //选中位置联查
|
|
|
|
+ checkAddress(id){
|
|
|
|
+ let list = this.forAddress(this.$refs.tree._data.root.childNodes,id);
|
|
|
|
+ this.$parent.setAddress(list);
|
|
|
|
+ },
|
|
|
|
+ forAddress(list,id){
|
|
|
|
+ let self = this;
|
|
|
|
+ let nameList = [];
|
|
|
|
+ let name = []
|
|
|
|
+ for(let i=0;i<list.length;i++){
|
|
|
|
+ if(list[i].data.treeId == id){
|
|
|
|
+ return list[i].data.deptName
|
|
|
|
+ }else{
|
|
|
|
+ if(list[i].childNodes){
|
|
|
|
+ if(list[i].childNodes[0]){
|
|
|
|
+ name = self.forAddress(list[i].childNodes,id);
|
|
|
|
+ if(name){
|
|
|
|
+ nameList = [list[i].data.deptName].concat(name)
|
|
|
|
+ return nameList
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ //查询实验室在线人数
|
|
|
|
+ laboratorySubPassOutGetCountByBuildId(type,id){
|
|
|
|
+ let obj = {};
|
|
|
|
+ if(type == 1){
|
|
|
|
+ obj.buildId = id
|
|
|
|
+ }else if(type == 2){
|
|
|
|
+ obj.floorId = id
|
|
|
|
+ }else if(type == 3){
|
|
|
|
+ obj.subId = id
|
|
|
|
+ }
|
|
|
|
+ laboratorySubPassOutGetCountByBuildId(obj).then(response => {
|
|
|
|
+ this.$parent.setUserNum(response.data)
|
|
|
|
+ });
|
|
|
|
+ },
|
|
},
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
@@ -130,7 +307,9 @@
|
|
.deptListComponent{
|
|
.deptListComponent{
|
|
width:430px;
|
|
width:430px;
|
|
height:1330px;
|
|
height:1330px;
|
|
- overflow-y:scroll;
|
|
|
|
|
|
+ overflow-y:hidden;
|
|
|
|
+ display: flex;
|
|
|
|
+ flex-direction: column;
|
|
background: linear-gradient(180deg, rgba(4, 117, 129, 0.2) 0%, rgba(0, 15, 22, 0) 100%);
|
|
background: linear-gradient(180deg, rgba(4, 117, 129, 0.2) 0%, rgba(0, 15, 22, 0) 100%);
|
|
.title-p{
|
|
.title-p{
|
|
font-size:26px;
|
|
font-size:26px;
|
|
@@ -268,17 +447,116 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ //新树
|
|
|
|
+ .tree-max-box{
|
|
|
|
+ flex:1;
|
|
|
|
+ margin:30px 0 30px 9px;
|
|
|
|
+ overflow-y:scroll;
|
|
|
|
+ }
|
|
|
|
+ .el-tree{
|
|
|
|
+ background-color: transparent;
|
|
|
|
+ color:#fff;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ ::v-deep .tree-line .el-tree-node__expand-icon{
|
|
|
|
+ display: block;
|
|
|
|
+ height: 60px;
|
|
|
|
+ width: 60px;
|
|
|
|
+ padding: 0;
|
|
|
|
+ line-height: 60px;
|
|
|
|
+ text-align: center;
|
|
|
|
+ margin-right: auto;
|
|
|
|
+ font-size: 24px!important;
|
|
|
|
+ color:#15827C;
|
|
|
|
+ }
|
|
|
|
+ //选中
|
|
|
|
+ ::v-deep .is-current{
|
|
|
|
+ /*color:#03B7CA;*/
|
|
|
|
+ }
|
|
|
|
+ ::v-deep .el-tree-node:focus > .el-tree-node__content{
|
|
|
|
+ background-color: transparent;
|
|
|
|
+ }
|
|
|
|
+ ::v-deep .el-tree-node__content{
|
|
|
|
+ height:60px;
|
|
|
|
+ display: flex;
|
|
|
|
+ flex-direction: row-reverse;
|
|
|
|
+ }
|
|
|
|
+ ::v-deep .el-tree-node__content:hover{
|
|
|
|
+ background-color: transparent;
|
|
|
|
+ color:#03B7CA;
|
|
|
|
+ }
|
|
|
|
+ ::v-deep .el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content{
|
|
|
|
+ background-color: transparent;
|
|
|
|
+ color:#03B7CA;
|
|
|
|
+ }
|
|
|
|
+ //引导线
|
|
|
|
+ ::v-deep .tree-line {
|
|
|
|
+ .el-tree-node {
|
|
|
|
+ position: relative;
|
|
|
|
+ padding-left: 16px; // 缩进量
|
|
|
|
+ }
|
|
|
|
+ .el-tree-node__children {
|
|
|
|
+ padding-left: 16px; // 缩进量
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 竖线
|
|
|
|
+ .el-tree-node::before {
|
|
|
|
+ content: '';
|
|
|
|
+ height: 100%;
|
|
|
|
+ width: 1px;
|
|
|
|
+ position: absolute;
|
|
|
|
+ left: -3px;
|
|
|
|
+ top: -8px;
|
|
|
|
+ border-width: 1px;
|
|
|
|
+ border-left: 1px solid #15827C;
|
|
|
|
+ }
|
|
|
|
+ // 当前层最后一个节点的竖线高度固定
|
|
|
|
+ .el-tree-node:last-child::before {
|
|
|
|
+ height: 38px; // 可以自己调节到合适数值
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 横线
|
|
|
|
+ .el-tree-node::after {
|
|
|
|
+ content: '';
|
|
|
|
+ width: 24px;
|
|
|
|
+ height: 20px;
|
|
|
|
+ position: absolute;
|
|
|
|
+ left: 0px;
|
|
|
|
+ top: 30px;
|
|
|
|
+ border-width: 1px;
|
|
|
|
+ border-top: 1px dashed #15827C;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 去掉最顶层的虚线,放最下面样式才不会被上面的覆盖了
|
|
|
|
+ & > .el-tree-node::after {
|
|
|
|
+ border-top: none;
|
|
|
|
+ }
|
|
|
|
+ & > .el-tree-node::before {
|
|
|
|
+ border-left: none;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 展开关闭的icon
|
|
|
|
+ .el-tree-node__expand-icon {
|
|
|
|
+ font-size: 16px;
|
|
|
|
+ // 叶子节点(无子节点)
|
|
|
|
+ &.is-leaf {
|
|
|
|
+ color: transparent;
|
|
|
|
+ // display: none; // 也可以去掉
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- .deptListComponent::-webkit-scrollbar {
|
|
|
|
|
|
+ .tree-max-box::-webkit-scrollbar {
|
|
width: 6px; /*高宽分别对应横竖滚动条的尺寸*/
|
|
width: 6px; /*高宽分别对应横竖滚动条的尺寸*/
|
|
height: 6px;
|
|
height: 6px;
|
|
}
|
|
}
|
|
- .deptListComponent::-webkit-scrollbar-thumb {
|
|
|
|
|
|
+ .tree-max-box::-webkit-scrollbar-thumb {
|
|
border-radius: 5px;
|
|
border-radius: 5px;
|
|
-webkit-box-shadow: inset 0 0 5px #07B4C7;
|
|
-webkit-box-shadow: inset 0 0 5px #07B4C7;
|
|
background: #07B4C7;
|
|
background: #07B4C7;
|
|
}
|
|
}
|
|
- .deptListComponent::-webkit-scrollbar-track {
|
|
|
|
|
|
+ .tree-max-box::-webkit-scrollbar-track {
|
|
-webkit-box-shadow: inset 0 0 5px #013138;
|
|
-webkit-box-shadow: inset 0 0 5px #013138;
|
|
border-radius: 0;
|
|
border-radius: 0;
|
|
background: #013138;
|
|
background: #013138;
|