|
@@ -108,7 +108,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">
|
|
@@ -117,7 +117,15 @@
|
|
|
src="../assets/images/zhankai.png"
|
|
src="../assets/images/zhankai.png"
|
|
|
alt=""
|
|
alt=""
|
|
|
/>
|
|
/>
|
|
|
- <div style="font-weight: 550; font-size: 14px; margin: 0px 0px 0px 4px;">站点管理</div>
|
|
|
|
|
|
|
+ <div
|
|
|
|
|
+ style="
|
|
|
|
|
+ font-weight: 550;
|
|
|
|
|
+ font-size: 14px;
|
|
|
|
|
+ margin: 0px 0px 0px 4px;
|
|
|
|
|
+ "
|
|
|
|
|
+ >
|
|
|
|
|
+ 站点管理
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
<img
|
|
<img
|
|
|
style="
|
|
style="
|
|
@@ -132,13 +140,17 @@
|
|
|
v-if="userinfo.staff == '1'"
|
|
v-if="userinfo.staff == '1'"
|
|
|
/>
|
|
/>
|
|
|
</li>
|
|
</li>
|
|
|
-
|
|
|
|
|
<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"
|
|
|
@node-click="handleNodeClick"
|
|
@node-click="handleNodeClick"
|
|
|
@node-contextmenu="rightClick"
|
|
@node-contextmenu="rightClick"
|
|
|
|
|
+ highlight-current
|
|
|
></el-tree>
|
|
></el-tree>
|
|
|
</li>
|
|
</li>
|
|
|
</ul>
|
|
</ul>
|
|
@@ -152,7 +164,7 @@
|
|
|
</ul>
|
|
</ul>
|
|
|
</div>
|
|
</div>
|
|
|
<el-main>
|
|
<el-main>
|
|
|
- <router-view ref="mychild"></router-view>
|
|
|
|
|
|
|
+ <router-view ref="mychild" :siteId="firstItem"></router-view>
|
|
|
</el-main>
|
|
</el-main>
|
|
|
</el-container>
|
|
</el-container>
|
|
|
|
|
|
|
@@ -190,6 +202,9 @@ import city from "../components/citydata.js";
|
|
|
export default {
|
|
export default {
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
|
|
+ isTree:true,
|
|
|
|
|
+ firstItem: "",
|
|
|
|
|
+ firstShow: true,
|
|
|
isRouter: true,
|
|
isRouter: true,
|
|
|
iconObj: {
|
|
iconObj: {
|
|
|
20: "iconfont icon-jiankong",
|
|
20: "iconfont icon-jiankong",
|
|
@@ -237,9 +252,9 @@ export default {
|
|
|
menuVisible: false,
|
|
menuVisible: false,
|
|
|
operateObj: {}, // 右键点击时获取当前的数据信息
|
|
operateObj: {}, // 右键点击时获取当前的数据信息
|
|
|
|
|
|
|
|
- siteNameTitle: '全 部',
|
|
|
|
|
- req: '', // 站点列表是否显示有无设备的站点
|
|
|
|
|
- equip_type: '' //选中的设备类型
|
|
|
|
|
|
|
+ siteNameTitle: "全 部",
|
|
|
|
|
+ req: "", // 站点列表是否显示有无设备的站点
|
|
|
|
|
+ equip_type: "", //选中的设备类型
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
created: function () {
|
|
created: function () {
|
|
@@ -252,18 +267,17 @@ export default {
|
|
|
}
|
|
}
|
|
|
this.options = city;
|
|
this.options = city;
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- var url = this.$route.path
|
|
|
|
|
- url = url.split('/index', 2)
|
|
|
|
|
|
|
+ var url = this.$route.path;
|
|
|
|
|
+ url = url.split("/index", 2);
|
|
|
// 获取当前点击的设备类型
|
|
// 获取当前点击的设备类型
|
|
|
- if (url[1] == '/monitor') {
|
|
|
|
|
- // 性诱测报
|
|
|
|
|
- this.req = 'hide'
|
|
|
|
|
- this.equip_type = '6'
|
|
|
|
|
- } else {
|
|
|
|
|
- this.req = ''
|
|
|
|
|
- this.equip_type = ''
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (url[1] == "/monitor") {
|
|
|
|
|
+ // 性诱测报
|
|
|
|
|
+ this.req = "hide";
|
|
|
|
|
+ this.equip_type = "6";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.req = "";
|
|
|
|
|
+ this.equip_type = "";
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
watch: {
|
|
watch: {
|
|
|
addSite(val) {
|
|
addSite(val) {
|
|
@@ -281,14 +295,14 @@ export default {
|
|
|
// }
|
|
// }
|
|
|
},
|
|
},
|
|
|
// 监听路由变化,如果变化就将展示选中的站点名称归零为全部
|
|
// 监听路由变化,如果变化就将展示选中的站点名称归零为全部
|
|
|
- $route(to, from) {
|
|
|
|
|
- this.siteNameTitle = '全 部'
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ $route(to, from) {
|
|
|
|
|
+ this.siteNameTitle = "全 部";
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
equip_type(val) {
|
|
equip_type(val) {
|
|
|
- console.log(val)
|
|
|
|
|
- this.siteListData()
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ console.log(val);
|
|
|
|
|
+ this.siteListData();
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
hCheckFun() {
|
|
hCheckFun() {
|
|
@@ -310,6 +324,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
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
|
|
@@ -327,12 +343,11 @@ export default {
|
|
|
|
|
|
|
|
// 树形插件
|
|
// 树形插件
|
|
|
handleNodeClick(data) {
|
|
handleNodeClick(data) {
|
|
|
- console.log(data);
|
|
|
|
|
// this.operateObj = data
|
|
// this.operateObj = data
|
|
|
// this.$refs.mychild.getEquipList(data, 1)
|
|
// this.$refs.mychild.getEquipList(data, 1)
|
|
|
|
|
|
|
|
var url = this.$route.path;
|
|
var url = this.$route.path;
|
|
|
- this.siteNameTitle = data.label
|
|
|
|
|
|
|
+ this.siteNameTitle = data.label;
|
|
|
url = url.split("/index/", 2);
|
|
url = url.split("/index/", 2);
|
|
|
console.log(url);
|
|
console.log(url);
|
|
|
if (url[1] == "monitor") {
|
|
if (url[1] == "monitor") {
|
|
@@ -350,12 +365,13 @@ export default {
|
|
|
params: {
|
|
params: {
|
|
|
req: this.req,
|
|
req: this.req,
|
|
|
equip_type: this.equip_type,
|
|
equip_type: this.equip_type,
|
|
|
- jk_type: '1'
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ jk_type: "1",
|
|
|
|
|
+ },
|
|
|
})
|
|
})
|
|
|
.then((res) => {
|
|
.then((res) => {
|
|
|
if (res.data) {
|
|
if (res.data) {
|
|
|
var data = res.data;
|
|
var data = res.data;
|
|
|
|
|
+ console.log("数据数据", this.firstItem, res.data);
|
|
|
var arrList = [];
|
|
var arrList = [];
|
|
|
var list = data.forEach((item) => {
|
|
var list = data.forEach((item) => {
|
|
|
if (
|
|
if (
|
|
@@ -400,13 +416,43 @@ 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)
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
// 树形插件右键点击事件
|
|
// 树形插件右键点击事件
|
|
|
rightClick(MouseEvent, object, Node, element) {
|
|
rightClick(MouseEvent, object, Node, element) {
|
|
|
console.log(object);
|
|
console.log(object);
|
|
@@ -494,30 +540,34 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- // 获取到当前点击菜单的数据
|
|
|
|
|
- handleOpen(key, keyPath) {
|
|
|
|
|
- var data = key
|
|
|
|
|
- var typeIndex = data.split('/index/')
|
|
|
|
|
- if (typeIndex[1] == 'monitor') {
|
|
|
|
|
- // 性诱测报
|
|
|
|
|
- // this.req = 'hide'
|
|
|
|
|
- // this.equip_type = '4'
|
|
|
|
|
|
|
+ // 获取到当前点击菜单的数据userManger
|
|
|
|
|
+ handleOpen(key, keyPath) {
|
|
|
|
|
+ this.isTree = true;
|
|
|
|
|
+ var data = key;
|
|
|
|
|
+ var typeIndex = data.split("/index/");
|
|
|
|
|
+ if (typeIndex[1] == "monitor") {
|
|
|
|
|
+ // 性诱测报
|
|
|
|
|
+ // this.req = 'hide'
|
|
|
|
|
+ // this.equip_type = '4'
|
|
|
|
|
|
|
|
// 苗情
|
|
// 苗情
|
|
|
- this.req = 'hide'
|
|
|
|
|
- this.equip_type = '6'
|
|
|
|
|
- } else {
|
|
|
|
|
- this.req = ''
|
|
|
|
|
- this.equip_type = ''
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ this.req = "hide";
|
|
|
|
|
+ this.equip_type = "6";
|
|
|
|
|
+ } else if(typeIndex[1]=='userManger'){
|
|
|
|
|
+ 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>
|