|
@@ -101,7 +101,7 @@
|
|
|
</el-menu-item>
|
|
</el-menu-item>
|
|
|
</el-menu>
|
|
</el-menu>
|
|
|
|
|
|
|
|
- <div style="margin: 13px 0 0 0; width: 95%">
|
|
|
|
|
|
|
+ <div v-if="isTree" style="margin: 13px 0 0 0; width: 95%">
|
|
|
<ul>
|
|
<ul>
|
|
|
<li style="display: flex; justify-content: space-between">
|
|
<li style="display: flex; justify-content: space-between">
|
|
|
<div style="display: flex; margin: 0 0 0 5px">
|
|
<div style="display: flex; margin: 0 0 0 5px">
|
|
@@ -137,11 +137,15 @@
|
|
|
|
|
|
|
|
<li id="tree">
|
|
<li id="tree">
|
|
|
<el-tree
|
|
<el-tree
|
|
|
|
|
+ ref="treeRef"
|
|
|
:data="data"
|
|
:data="data"
|
|
|
:props="defaultProps"
|
|
:props="defaultProps"
|
|
|
|
|
+ node-key="id"
|
|
|
|
|
+ :current-node-key="firstItem"
|
|
|
:default-expand-all="true"
|
|
:default-expand-all="true"
|
|
|
@node-click="handleNodeClick"
|
|
@node-click="handleNodeClick"
|
|
|
@node-contextmenu="rightClick"
|
|
@node-contextmenu="rightClick"
|
|
|
|
|
+ highlight-current
|
|
|
></el-tree>
|
|
></el-tree>
|
|
|
</li>
|
|
</li>
|
|
|
</ul>
|
|
</ul>
|
|
@@ -193,6 +197,10 @@ import city from "../components/citydata.js";
|
|
|
export default {
|
|
export default {
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
|
|
+ siteId: "",
|
|
|
|
|
+ isTree: true,
|
|
|
|
|
+ firstItem: "",
|
|
|
|
|
+ firstShow: true,
|
|
|
isRouter: true,
|
|
isRouter: true,
|
|
|
iconObj: {
|
|
iconObj: {
|
|
|
20: "iconfont icon-jiankong",
|
|
20: "iconfont icon-jiankong",
|
|
@@ -239,14 +247,15 @@ export default {
|
|
|
menuVisible: false,
|
|
menuVisible: false,
|
|
|
|
|
|
|
|
siteNameTitle: "全 部",
|
|
siteNameTitle: "全 部",
|
|
|
- req: '', // 站点列表是否显示有无设备的站点
|
|
|
|
|
- equip_type: '', //选中的设备类型
|
|
|
|
|
|
|
+ req: "", // 站点列表是否显示有无设备的站点
|
|
|
|
|
+ equip_type: "", //选中的设备类型
|
|
|
|
|
|
|
|
dataObj: {
|
|
dataObj: {
|
|
|
- flag: true,
|
|
|
|
|
- siteID: null,
|
|
|
|
|
- allList: []
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ flag: true,
|
|
|
|
|
+ siteID: null,
|
|
|
|
|
+ allList: [],
|
|
|
|
|
+ cid :null
|
|
|
|
|
+ },
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
created: function () {
|
|
created: function () {
|
|
@@ -269,6 +278,9 @@ export default {
|
|
|
},
|
|
},
|
|
|
// 监听路由变化,如果变化就将展示选中的站点名称归零为全部
|
|
// 监听路由变化,如果变化就将展示选中的站点名称归零为全部
|
|
|
$route(to, from) {
|
|
$route(to, from) {
|
|
|
|
|
+ if (to.path == "/index/monitor1") {
|
|
|
|
|
+ console.log(this.$refs.mychild);
|
|
|
|
|
+ }
|
|
|
this.siteNameTitle = "全 部";
|
|
this.siteNameTitle = "全 部";
|
|
|
},
|
|
},
|
|
|
|
|
|
|
@@ -305,7 +317,7 @@ export default {
|
|
|
methods: {
|
|
methods: {
|
|
|
hCheckFun() {
|
|
hCheckFun() {
|
|
|
this.flag = !this.flag;
|
|
this.flag = !this.flag;
|
|
|
- this.dataObj.flag = this.flag
|
|
|
|
|
|
|
+ this.dataObj.flag = this.flag;
|
|
|
},
|
|
},
|
|
|
getuserinfo() {
|
|
getuserinfo() {
|
|
|
this.$axios({
|
|
this.$axios({
|
|
@@ -323,6 +335,8 @@ export default {
|
|
|
this.userinfo = res.data;
|
|
this.userinfo = res.data;
|
|
|
localStorage.setItem("have_type", this.userinfo.have_type); // 0管理员 1用户
|
|
localStorage.setItem("have_type", this.userinfo.have_type); // 0管理员 1用户
|
|
|
localStorage.setItem("staff", this.userinfo.staff); // 1是admin
|
|
localStorage.setItem("staff", this.userinfo.staff); // 1是admin
|
|
|
|
|
+ localStorage.setItem('site_id', this.userinfo.site_id) // 站点id
|
|
|
|
|
+ localStorage.setItem('siteName', this.userinfo.site) // 站点name
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
|
|
@@ -347,7 +361,7 @@ export default {
|
|
|
params: {
|
|
params: {
|
|
|
req: this.req,
|
|
req: this.req,
|
|
|
equip_type: this.equip_type,
|
|
equip_type: this.equip_type,
|
|
|
- jk_type: '2',
|
|
|
|
|
|
|
+ jk_type: "2",
|
|
|
},
|
|
},
|
|
|
})
|
|
})
|
|
|
.then((res) => {
|
|
.then((res) => {
|
|
@@ -398,24 +412,53 @@ export default {
|
|
|
});
|
|
});
|
|
|
this.data = arrList;
|
|
this.data = arrList;
|
|
|
console.log(arrList);
|
|
console.log(arrList);
|
|
|
|
|
+ // 默认选中第一个站点
|
|
|
|
|
+ // this.siteNameTitle = data[0].child[0].site_name;
|
|
|
|
|
+ // this.firstItem = data[0].child[0].site_id;
|
|
|
|
|
+ if(localStorage.getItem('siteName')=='超级管理员'){
|
|
|
|
|
+ this.siteNameTitle = "瑞通集团总站"
|
|
|
|
|
+ }else{
|
|
|
|
|
+ this.siteNameTitle = localStorage.getItem('siteName');
|
|
|
|
|
+ }
|
|
|
|
|
+ this.firstItem = localStorage.getItem('site_id');
|
|
|
|
|
+ let data = {};
|
|
|
|
|
+ this.treeIterator(arrList,res => {
|
|
|
|
|
+ if(res.id==this.firstItem){
|
|
|
|
|
+ data = res
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ this.$refs.treeRef.setCurrentKey(this.firstItem);
|
|
|
|
|
+ // const childrenItem = arrList[0].children[0];
|
|
|
|
|
+ const childrenItem = data;
|
|
|
|
|
+ if (this.firstShow) {
|
|
|
|
|
+ this.handleNodeClick(childrenItem);
|
|
|
|
|
+ this.firstShow = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
.catch((err) => {
|
|
.catch((err) => {
|
|
|
console.log(err);
|
|
console.log(err);
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
|
|
+ treeIterator(tree, func) {
|
|
|
|
|
+ let node, curTree = [...tree]
|
|
|
|
|
+ while ((node = curTree.shift())) {
|
|
|
|
|
+ func(node)
|
|
|
|
|
+ node.children && curTree.push(...node.children)
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
// 树形插件
|
|
// 树形插件
|
|
|
handleNodeClick(data) {
|
|
handleNodeClick(data) {
|
|
|
- console.log(data);
|
|
|
|
|
// this.operateObj = data
|
|
// this.operateObj = data
|
|
|
-
|
|
|
|
|
var url = this.$route.path;
|
|
var url = this.$route.path;
|
|
|
|
|
+ this.siteId = data.id;
|
|
|
this.siteNameTitle = data.label;
|
|
this.siteNameTitle = data.label;
|
|
|
url = url.split("/index/", 2);
|
|
url = url.split("/index/", 2);
|
|
|
if (url[1] == "monitor1") {
|
|
if (url[1] == "monitor1") {
|
|
|
this.$refs.mychild.getJkList(data, 1);
|
|
this.$refs.mychild.getJkList(data, 1);
|
|
|
- this.$refs.mychild.$data.siteVal = ''
|
|
|
|
|
|
|
+ this.$refs.mychild.$data.siteVal = "";
|
|
|
this.$refs.mychild.plotList(data, 1);
|
|
this.$refs.mychild.plotList(data, 1);
|
|
|
} else {
|
|
} else {
|
|
|
this.$refs.mychild.getList(data, 1);
|
|
this.$refs.mychild.getList(data, 1);
|
|
@@ -512,25 +555,37 @@ export default {
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
// 获取到当前点击菜单的数据
|
|
// 获取到当前点击菜单的数据
|
|
|
- handleOpen(key, keyPath) {
|
|
|
|
|
- var data = key
|
|
|
|
|
- var typeIndex = data.split('/index/')
|
|
|
|
|
- if (typeIndex[1] == 'monitor1') {
|
|
|
|
|
- // 性诱测报
|
|
|
|
|
- this.req = 'hide'
|
|
|
|
|
- this.equip_type = '6'
|
|
|
|
|
- } else {
|
|
|
|
|
- this.req = ''
|
|
|
|
|
- this.equip_type = ''
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ handleOpen(key, keyPath) {
|
|
|
|
|
+ this.isTree = true;
|
|
|
|
|
+ var data = key;
|
|
|
|
|
+ var typeIndex = data.split("/index/");
|
|
|
|
|
+ if (typeIndex[1] == "monitor1") {
|
|
|
|
|
+ // 性诱测报
|
|
|
|
|
+ this.req = "hide";
|
|
|
|
|
+ this.equip_type = "6";
|
|
|
|
|
+ this.siteId = this.firstItem;
|
|
|
|
|
+ console.log(localStorage.getItem('site_id')=="0");
|
|
|
|
|
+ if(localStorage.getItem('site_id')=="0"){
|
|
|
|
|
+ this.dataObj.cid = '';
|
|
|
|
|
+ }else{
|
|
|
|
|
+ this.dataObj.cid = this.siteId;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ } else if (typeIndex[1] == "userManger1") {
|
|
|
|
|
+ console.log(this.$refs.mychild);
|
|
|
|
|
+ this.isTree = false;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.req = "";
|
|
|
|
|
+ this.equip_type = "";
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
- // 点击获取全部站点名称列表
|
|
|
|
|
- allSiteListData() {
|
|
|
|
|
- this.req = ''
|
|
|
|
|
- this.equip_type = ''
|
|
|
|
|
- this.siteListData()
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ // 点击获取全部站点名称列表
|
|
|
|
|
+ allSiteListData() {
|
|
|
|
|
+ this.req = "";
|
|
|
|
|
+ this.equip_type = "";
|
|
|
|
|
+ this.siteListData();
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
};
|
|
};
|
|
|
</script>
|
|
</script>
|