|
@@ -3,13 +3,17 @@
|
|
|
<div id="tree-box">
|
|
|
<el-form :model="queryParams" class="form-box" ref="queryForm"
|
|
|
:inline="true" style="width:100%;">
|
|
|
- <el-form-item label="" prop="state">
|
|
|
+ <el-form-item label="" prop="state" class="input-searchValue">
|
|
|
<el-input
|
|
|
v-model="queryParams.searchValue"
|
|
|
placeholder="实验室"
|
|
|
clearable
|
|
|
- style="width:178px;"
|
|
|
- />
|
|
|
+ style="width:237px;">
|
|
|
+ <el-select v-model="inputType" class="input-select" slot="prepend" placeholder="请选择">
|
|
|
+ <el-option label="实验室名称" value="1"></el-option>
|
|
|
+ <el-option label="房号" value="2"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-input>
|
|
|
</el-form-item>
|
|
|
<p class="form-inquire-common-style-button" @click="handleQuery">查询</p>
|
|
|
<p class="form-reset-common-style-button" @click="resetQuery">重置</p>
|
|
@@ -46,7 +50,7 @@
|
|
|
overflow:hidden;
|
|
|
text-overflow:ellipsis;
|
|
|
white-space:nowrap;"
|
|
|
- :style="!data.level?'font-size:14px':(data.level==1?'font-size:16px':(data.level==2||data.level==3||data.level==4?'font-size:14px':(data.level==5?'font-size:14px':'')))">{{data.deptName}}</span>
|
|
|
+ :style="!data.level?'font-size:14px':(data.level==1?'font-size:16px':(data.level==2?'font-size:14px':(data.level==3?'font-size:14px':'')))">{{data.deptName}}</span>
|
|
|
</template>
|
|
|
</el-tree>
|
|
|
</div>
|
|
@@ -56,8 +60,8 @@
|
|
|
<script>
|
|
|
import {
|
|
|
laboratoryLevelConfigGetLevelTitleList,
|
|
|
- laboratoryLabDeptTreeGetTreeList,
|
|
|
- laboratoryLabDeptTreeGetRoomList,
|
|
|
+ laboratoryLabDeptTreeLargeTree,
|
|
|
+ laboratoryLabDeptTreeLargeRooms,
|
|
|
laboratorySubPassOutGetCountByBuildId,
|
|
|
} from "@/api/index";
|
|
|
export default {
|
|
@@ -75,6 +79,7 @@
|
|
|
//新树
|
|
|
deptOptions: null,
|
|
|
defaultKey:null,
|
|
|
+ inputType:'1',
|
|
|
defaultProps: {
|
|
|
children: "childTreeList",
|
|
|
label: "deptName",
|
|
@@ -94,23 +99,25 @@
|
|
|
},
|
|
|
mounted(){
|
|
|
this.laboratoryLevelConfigGetLevelTitleList();
|
|
|
- this.laboratoryLabDeptTreeGetTreeList()
|
|
|
+ this.laboratoryLabDeptTreeLargeTree()
|
|
|
},
|
|
|
methods:{
|
|
|
//查询按钮
|
|
|
handleQuery(){
|
|
|
- this.laboratoryLabDeptTreeGetTreeList();
|
|
|
+ this.laboratoryLabDeptTreeLargeTree();
|
|
|
},
|
|
|
//重置按钮
|
|
|
resetQuery(){
|
|
|
let self = this;
|
|
|
+ this.$set(this,'inputType','1');
|
|
|
this.$set(this,'queryParams',{
|
|
|
searchValue: '',
|
|
|
+ deptId:localStorage.getItem('deptId'),
|
|
|
});
|
|
|
for(let i=0;i<self.checkLeveList.length;i++){
|
|
|
self.checkLeveList[i].type = false;
|
|
|
}
|
|
|
- this.laboratoryLabDeptTreeGetTreeList();
|
|
|
+ this.laboratoryLabDeptTreeLargeTree();
|
|
|
},
|
|
|
//选中级别
|
|
|
checkLevelButton(item,index){
|
|
@@ -131,95 +138,90 @@
|
|
|
});
|
|
|
},
|
|
|
//新树
|
|
|
- laboratoryLabDeptTreeGetTreeList() {
|
|
|
+ laboratoryLabDeptTreeLargeTree() {
|
|
|
let self = this;
|
|
|
let obj = {
|
|
|
- deptId:localStorage.getItem('deptId'),
|
|
|
- searchValue:this.searchValue,
|
|
|
- levelIds:[],
|
|
|
+ deptId:localStorage.getItem('deptId'),
|
|
|
+ levelIds:[],
|
|
|
+ };
|
|
|
+ if (this.inputType == 1){
|
|
|
+ obj.subName = this.queryParams.searchValue;
|
|
|
+ } else if(this.inputType == 2){
|
|
|
+ obj.roomNum = this.queryParams.searchValue;
|
|
|
}
|
|
|
for(let i=0;i<self.checkLeveList.length;i++){
|
|
|
if(self.checkLeveList[i].type){
|
|
|
obj.levelIds.push(self.checkLeveList[i].levelId)
|
|
|
}
|
|
|
}
|
|
|
- laboratoryLabDeptTreeGetTreeList(obj).then(response => {
|
|
|
+ laboratoryLabDeptTreeLargeTree(obj).then(response => {
|
|
|
+ if(!response.data[0]){
|
|
|
+ this.msgSuccess('未找到相关数据')
|
|
|
+ return
|
|
|
+ }
|
|
|
let self = this;
|
|
|
- let list = this.delList(response.data);
|
|
|
+ let list = this.forTreeId(response.data);
|
|
|
+ //写入楼层下数据
|
|
|
+ self.$set(self,'deptOptions',list)
|
|
|
this.$nextTick(()=>{
|
|
|
- let checkData = list[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(1,checkData.treeId);
|
|
|
- //父级视屏数据
|
|
|
- self.$parent.setVideoData(checkData);
|
|
|
- },200);
|
|
|
- // let minObj = JSON.parse(JSON.stringify(obj))
|
|
|
- // minObj.floorId = list[0].childTreeList[0].childTreeList[0].childTreeList[0].treeId;
|
|
|
- // laboratoryLabDeptTreeGetRoomList(minObj).then(minResponse => {
|
|
|
- // for(let i=0;i<minResponse.data.length;i++){
|
|
|
- // minResponse.data[i].leaf = true;
|
|
|
- // }
|
|
|
- // list[0].childTreeList[0].childTreeList[0].childTreeList[0].childTreeList[0].childTreeList = minResponse.data[0]?minResponse.data:[];
|
|
|
- // //选中逻辑
|
|
|
- // 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,list[0].childTreeList[0].childTreeList[0].childTreeList[0].childTreeList[0].treeId]
|
|
|
- // this.$nextTick(()=>{
|
|
|
- // this.$refs.tree.setCurrentKey(list[0].childTreeList[0].childTreeList[0].childTreeList[0].childTreeList[0].treeId);
|
|
|
- // this.$nextTick(()=>{
|
|
|
- // setTimeout(function(){
|
|
|
- // self.$refs.tree.setCurrentKey(list[0].childTreeList[0].childTreeList[0].childTreeList[0].childTreeList[0].childTreeList[0].treeId);
|
|
|
- // self.$set(self,'treeId',list[0].childTreeList[0].childTreeList[0].childTreeList[0].childTreeList[0].childTreeList[0].treeId);
|
|
|
- // },200);
|
|
|
- // })
|
|
|
- // })
|
|
|
- // this.$set(this,'deptOptions',list)
|
|
|
- // })
|
|
|
+ let checkData = []
|
|
|
+ if(obj.subName || obj.roomNum){
|
|
|
+ checkData = list[0].childTreeList[0].childTreeList[0];
|
|
|
+ //展开列表
|
|
|
+ self.$set(self,'defaultKey',[list[0].treeId,list[0].childTreeList[0].treeId]);
|
|
|
+ setTimeout(function(){
|
|
|
+ self.$set(self,'defaultKey',[list[0].treeId,list[0].childTreeList[0].childTreeList[0].treeId]);
|
|
|
+ },200)
|
|
|
+ }else{
|
|
|
+ checkData = list[0].childTreeList[0];
|
|
|
+ //展开列表
|
|
|
+ self.$set(self,'defaultKey',[list[0].treeId,list[0].childTreeList[0].treeId]);
|
|
|
+ }
|
|
|
+ setTimeout(function(){
|
|
|
+ //选中列表
|
|
|
+ self.$refs.tree.setCurrentKey(checkData.treeId);
|
|
|
+ self.$set(self,'treeId',checkData.treeId);
|
|
|
+ //当前位置展示
|
|
|
+ self.checkAddress(checkData.treeId);
|
|
|
+ //查询实验室人数
|
|
|
+ self.laboratorySubPassOutGetCountByBuildId(1,checkData.treeId);
|
|
|
+ //父级视屏数据
|
|
|
+ self.getSubId(checkData);
|
|
|
+ },600);
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
- //空数据处理
|
|
|
- delList(list){
|
|
|
- let self = this;
|
|
|
- for(let i=1;i<4;i++){
|
|
|
+ forTreeId(list){
|
|
|
+ let self = this;
|
|
|
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)
|
|
|
+ item.treeId = item.id;
|
|
|
+ item.deptName = item.name;
|
|
|
+ item.level = item.type;
|
|
|
+ item.childTreeList = item.buildFloorVoList;
|
|
|
+ delete item.id
|
|
|
+ delete item.name
|
|
|
+ delete item.type
|
|
|
+ delete item.buildFloorVoList
|
|
|
+ if(item.childTreeList[0]){
|
|
|
+ self.forTreeId(item.childTreeList);
|
|
|
}
|
|
|
- }
|
|
|
})
|
|
|
- }
|
|
|
- return list
|
|
|
+ return list
|
|
|
},
|
|
|
//点击操作
|
|
|
nodeClickButton(e,data){
|
|
|
this.$nextTick(() => {
|
|
|
- if (!e.level||e.level == 4||e.level == 5) {
|
|
|
+ if (!e.level||e.level == 2||e.level == 3) {
|
|
|
if(this.treeId != e.treeId){
|
|
|
this.treeId = e.treeId;
|
|
|
//等待后续逻辑-面板展示-实验室信息-视屏信息
|
|
|
//当前位置展示
|
|
|
this.checkAddress(e.treeId);
|
|
|
//查询实验室人数
|
|
|
- let type = !e.subId&&!e.level?3:(e.level == 4 ?1:(e.level == 5?2:''))
|
|
|
+ let type = !e.subId&&!e.level?3:(e.level == 2 ?1:(e.level == 3?2:''))
|
|
|
this.laboratorySubPassOutGetCountByBuildId(type,e.treeId);
|
|
|
- //父级视屏数据
|
|
|
- this.$parent.setVideoData(e);
|
|
|
+ //查询楼栋/楼层下所有实验室ID
|
|
|
+ this.getSubId(e);
|
|
|
}
|
|
|
}
|
|
|
this.$refs.tree.setCurrentKey(this.treeId);
|
|
@@ -229,10 +231,15 @@
|
|
|
loadNode(node, resolve) {
|
|
|
let self = this;
|
|
|
if (node.data){
|
|
|
- if(node.data.level == 5){
|
|
|
+ if(node.data.level == 3){
|
|
|
let obj = {
|
|
|
- searchValue:this.searchValue,
|
|
|
- levelIds:[],
|
|
|
+ deptId:localStorage.getItem('deptId'),
|
|
|
+ levelIds:[],
|
|
|
+ };
|
|
|
+ if (this.inputType == 1){
|
|
|
+ obj.subName = this.queryParams.searchValue;
|
|
|
+ } else if(this.inputType == 2){
|
|
|
+ obj.roomNum = this.queryParams.searchValue;
|
|
|
}
|
|
|
for(let i=0;i<self.checkLeveList.length;i++){
|
|
|
if(self.checkLeveList[i].type){
|
|
@@ -240,16 +247,17 @@
|
|
|
}
|
|
|
}
|
|
|
obj.floorId = node.data.treeId;
|
|
|
- laboratoryLabDeptTreeGetRoomList(obj).then(response => {
|
|
|
+ laboratoryLabDeptTreeLargeRooms(obj).then(response => {
|
|
|
for(let i=0;i<response.data.length;i++){
|
|
|
- response.data[i].leaf = true;
|
|
|
+ response.data[i].deptName = response.data[i].formatRoomName;
|
|
|
+ response.data[i].leaf = true;
|
|
|
}
|
|
|
resolve(response.data[0]?response.data:[]);
|
|
|
})
|
|
|
}else{
|
|
|
if(node.data.childTreeList){
|
|
|
if(node.data.childTreeList[0]){
|
|
|
- if(node.data.level != 4){
|
|
|
+ if(node.data.level != 2){
|
|
|
node.data.childTreeList.forEach((item)=>{
|
|
|
if(item.childTreeList){
|
|
|
if(!item.childTreeList[0]){
|
|
@@ -271,6 +279,48 @@
|
|
|
}
|
|
|
|
|
|
},
|
|
|
+ //实验室ID查询
|
|
|
+ getSubId(e){
|
|
|
+ let self = this;
|
|
|
+ let obj = {
|
|
|
+ deptId:this.queryParams.deptId,
|
|
|
+ levelIds:[],
|
|
|
+ }
|
|
|
+ if (this.inputType == 1){
|
|
|
+ obj.subName = this.queryParams.searchValue;
|
|
|
+ } else if(this.inputType == 2){
|
|
|
+ obj.roomNum = this.queryParams.searchValue;
|
|
|
+ }
|
|
|
+ for(let i=0;i<self.checkLeveList.length;i++){
|
|
|
+ if(self.checkLeveList[i].type){
|
|
|
+ obj.levelIds.push(self.checkLeveList[i].levelId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!e.level){
|
|
|
+ //实验室
|
|
|
+ this.$parent.setVideoData([e.treeId]);
|
|
|
+ }else if(e.level == 2){
|
|
|
+ //楼栋
|
|
|
+ obj.buildingId = e.treeId;
|
|
|
+ laboratoryLabDeptTreeLargeRooms(obj).then(response => {
|
|
|
+ let list = [];
|
|
|
+ for(let i=0;i<response.data.length;i++){
|
|
|
+ list.push(response.data[i].treeId)
|
|
|
+ }
|
|
|
+ this.$parent.setVideoData(list);
|
|
|
+ })
|
|
|
+ }else if(e.level == 3){
|
|
|
+ //楼层
|
|
|
+ obj.floorId = e.treeId;
|
|
|
+ laboratoryLabDeptTreeLargeRooms(obj).then(response => {
|
|
|
+ let list = [];
|
|
|
+ for(let i=0;i<response.data.length;i++){
|
|
|
+ list.push(response.data[i].treeId)
|
|
|
+ }
|
|
|
+ this.$parent.setVideoData(list);
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
//选中位置联查
|
|
|
checkAddress(id){
|
|
|
let list = this.forAddress(this.$refs.tree._data.root.childNodes,id);
|
|
@@ -329,10 +379,33 @@
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
//检索
|
|
|
- .form-box{
|
|
|
+ ::v-deep .form-box{
|
|
|
display: flex;
|
|
|
padding:0 0 0 29px;
|
|
|
- .el-input__inner{
|
|
|
+ .input-searchValue{
|
|
|
+ .el-input-group__prepend{
|
|
|
+ padding: 0 !important;
|
|
|
+ background-color: rgba(0,0,0,0);
|
|
|
+ border:none;
|
|
|
+ .input-select{
|
|
|
+ width:110px;
|
|
|
+ margin:0;
|
|
|
+ }
|
|
|
+ .el-input--suffix{
|
|
|
+ background-color: rgba(0,0,0,0);
|
|
|
+ }
|
|
|
+ .el-input__inner{
|
|
|
+ border:1px solid #06DEFF;
|
|
|
+ border-top-right-radius: 0;
|
|
|
+ border-bottom-right-radius: 0;
|
|
|
+ border-right:none;
|
|
|
+ border-top-left-radius: 4px;
|
|
|
+ border-bottom-left-radius: 4px;
|
|
|
+ padding: 0 25px 0 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ :v-deep .el-input__inner{
|
|
|
height: 40px;
|
|
|
line-height: 38px;
|
|
|
font-size: 14px;
|
|
@@ -344,7 +417,7 @@
|
|
|
height:40px;
|
|
|
}
|
|
|
.form-reset-common-style-button{
|
|
|
- width:80px;
|
|
|
+ width:60px;
|
|
|
height:40px;
|
|
|
line-height:40px;
|
|
|
font-size:14px;
|
|
@@ -357,14 +430,14 @@
|
|
|
border-radius:4px;
|
|
|
}
|
|
|
.form-inquire-common-style-button{
|
|
|
- width:80px;
|
|
|
+ width:60px;
|
|
|
height:40px;
|
|
|
line-height:40px;
|
|
|
font-size:14px;
|
|
|
font-weight:500;
|
|
|
color:#fff;
|
|
|
background-color: #06DEFF;
|
|
|
- margin:0 17px;
|
|
|
+ margin:0 10px 0 0;
|
|
|
text-align: center;
|
|
|
cursor: pointer;
|
|
|
border-radius:4px;
|
|
@@ -524,4 +597,7 @@
|
|
|
border-radius: 0;
|
|
|
background: #013138;
|
|
|
}
|
|
|
+
|
|
|
+</style>
|
|
|
+<style lang="scss">
|
|
|
</style>
|