Commit 6b91f4b5 authored by 纪泽龙's avatar 纪泽龙

合并jzl

parent 0841d9cd
......@@ -146,7 +146,7 @@ export default {
} else {
// 显示左侧联动菜单
path = this.activeRoutes(key);
console.log(path);
// console.log("path",this.$store.state.permission.topbarRouters);
console.log(this.$route.path);
if (this.$route.path != path[0].path) {
if (path[0].path) {
......
......@@ -51,8 +51,17 @@ router.beforeEach((to, from, next) => {
});
router.afterEach((to, from) => {
// console.log('全局后置钩子',to, from)
if (to.path == "/enterprise/mapView") {
// 查找只有一个菜单的目录
const parentPath = to.matched[0].path;
let arr = store.state.permission.topbarRouters.filter(item=>{
return item.path == parentPath;
})[0].children.filter(item=>{
return item.hidden == false
})
if (arr.length==1 ||to.path == "/enterprise/mapView") {
store.dispatch("app/toggleDevice", "mobile");
store.dispatch("app/closeSideBar", { withoutAnimation: true });
......
import { constantRoutes } from '@/router'
import { getRouters } from '@/api/menu'
import Layout from '@/layout/index'
import ParentView from '@/components/ParentView';
import { constantRoutes } from "@/router";
import { getRouters } from "@/api/menu";
import Layout from "@/layout/index";
import ParentView from "@/components/ParentView";
import router from "../../router";
const permission = {
state: {
......@@ -10,30 +11,44 @@ const permission = {
defaultRoutes: [],
topbarRouters: [],
sidebarRouters: [],
mySidebarRouters:[],
mySidebarRouters: []
},
mutations: {
SET_ROUTES: (state, routes) => {
state.addRoutes = routes
state.routes = constantRoutes.concat(routes)
state.addRoutes = routes;
state.routes = constantRoutes.concat(routes);
},
SET_DEFAULT_ROUTES: (state, routes) => {
state.defaultRoutes = constantRoutes.concat(routes)
state.defaultRoutes = constantRoutes.concat(routes);
},
SET_TOPBAR_ROUTES: (state, routes) => {
// 顶部导航菜单默认添加统计报表栏指向首页
const index = [{
path: 'index',
meta: { title: '统计报表', icon: 'dashboard'}
}]
// const index = [{
// path: 'index',
// meta: { title: '统计报表', icon: 'dashboard'}
// }]
// 首页是gis地图
const index = [
{
path: "",
meta: { title: "Gis地图", icon: "dashboard" },
children: [
{
path: "enterprise/mapView",
meta: { title: "Gis地图", icon: "dashboard" }
}
]
}
];
// state.topbarRouters = routes.concat(index);
state.topbarRouters = routes;
const arr = [...index, ...routes];
state.topbarRouters = arr;
// state.topbarRouters = routes;
},
SET_SIDEBAR_ROUTERS: (state, routes) => {
state.sidebarRouters = routes;
state.mySidebarRouters = routes;
},
}
},
actions: {
// 生成路由
......@@ -41,74 +56,75 @@ const permission = {
return new Promise(resolve => {
// 向后端请求路由数据
getRouters().then(res => {
const sdata = JSON.parse(JSON.stringify(res.data))
const rdata = JSON.parse(JSON.stringify(res.data))
const sidebarRoutes = filterAsyncRouter(sdata)
const rewriteRoutes = filterAsyncRouter(rdata, false, true)
rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true })
commit('SET_ROUTES', rewriteRoutes)
commit('SET_SIDEBAR_ROUTERS', constantRoutes.concat(sidebarRoutes))
commit('SET_DEFAULT_ROUTES', sidebarRoutes)
commit('SET_TOPBAR_ROUTES', sidebarRoutes)
resolve(rewriteRoutes)
})
})
const sdata = JSON.parse(JSON.stringify(res.data));
const rdata = JSON.parse(JSON.stringify(res.data));
const sidebarRoutes = filterAsyncRouter(sdata);
const rewriteRoutes = filterAsyncRouter(rdata, false, true);
rewriteRoutes.push({ path: "*", redirect: "/404", hidden: true });
commit("SET_ROUTES", rewriteRoutes);
commit("SET_SIDEBAR_ROUTERS", constantRoutes.concat(sidebarRoutes));
commit("SET_DEFAULT_ROUTES", sidebarRoutes);
commit("SET_TOPBAR_ROUTES", sidebarRoutes);
resolve(rewriteRoutes);
});
});
}
}
}
};
// 遍历后台传来的路由字符串,转换为组件对象
function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
return asyncRouterMap.filter(route => {
if (type && route.children) {
route.children = filterChildren(route.children)
route.children = filterChildren(route.children);
}
if (route.component) {
// Layout ParentView 组件特殊处理
if (route.component === 'Layout') {
route.component = Layout
} else if (route.component === 'ParentView') {
route.component = ParentView
if (route.component === "Layout") {
route.component = Layout;
} else if (route.component === "ParentView") {
route.component = ParentView;
} else {
route.component = loadView(route.component)
route.component = loadView(route.component);
}
}
if (route.children != null && route.children && route.children.length) {
route.children = filterAsyncRouter(route.children, route, type)
route.children = filterAsyncRouter(route.children, route, type);
} else {
delete route['children']
delete route['redirect']
delete route["children"];
delete route["redirect"];
}
return true
})
return true;
});
}
function filterChildren(childrenMap, lastRouter = false) {
var children = []
var children = [];
childrenMap.forEach((el, index) => {
if (el.children && el.children.length) {
if (el.component === 'ParentView') {
if (el.component === "ParentView") {
el.children.forEach(c => {
c.path = el.path + '/' + c.path
c.path = el.path + "/" + c.path;
if (c.children && c.children.length) {
children = children.concat(filterChildren(c.children, c))
return
children = children.concat(filterChildren(c.children, c));
return;
}
children.push(c)
})
return
children.push(c);
});
return;
}
}
if (lastRouter) {
el.path = lastRouter.path + '/' + el.path
el.path = lastRouter.path + "/" + el.path;
}
children = children.concat(el)
})
return children
children = children.concat(el);
});
return children;
}
export const loadView = (view) => { // 路由懒加载
return (resolve) => require([`@/views/${view}`], resolve)
}
export const loadView = view => {
// 路由懒加载
return resolve => require([`@/views/${view}`], resolve);
};
export default permission
export default permission;
......@@ -659,7 +659,6 @@ class gaodeMap {
const b2 = this.centerNum(b, arr1[1]);
// polyline.infoWindow.open(map, [a2, b2]);
polyline.infoWindow.open(map, e.lnglat);
} else {
console.log("windowOpen");
// 变成异步,最后执行
......
......@@ -111,7 +111,7 @@
<div class="scroll" :style="{ height: `${boxHeight}px` }">
<el-input
v-model="keyWord"
placeholder="点击输入"
placeholder="点击输入设备名称"
id="tipinput"
class="search-input"
>
......@@ -168,7 +168,7 @@
<template v-if="item.value != 9">
<div class="list-wrapper">
<div class="thead">
<div class="no">序号</div>
<div class="no"></div>
<div class="code">设备编号</div>
<div class="name">设备名称</div>
</div>
......@@ -737,9 +737,23 @@ export default {
this.pipeList();
},
panTo(item, bool) {
this.gaoMap.myMap.setZoom(12);
if (item.list.length > 0) {
if (this.leftBarNum.includes(item.value)) {
this.gaoMap.panTo(item.list[0].path);
let path;
// 线条
if (item.value == 1) {
const a =
(Number(item.list[0].lnglat[0]) + Number(item.list[0].path[0])) /
2;
const b =
(Number(item.list[0].lnglat[1]) + Number(item.list[0].path[1])) /
2;
path = [a, b - 0.06];
} else {
path = [item.list[0].path[0], item.list[0].path[1] - 0.06];
}
this.gaoMap.panTo(path);
}
}
},
......@@ -750,7 +764,7 @@ export default {
// 所有线条颜色还原
this.gaoMap.leftListClick = true;
this.gaoMap.polyLinesColorClear();
this.gaoMap.myMap.setZoom(11);
this.gaoMap.myMap.setZoom(12);
if (item.list.length > 0) {
if (this.leftBarNum.includes(item.value)) {
let path;
......@@ -758,11 +772,12 @@ export default {
const a = (Number(iten.lnglat[0]) + Number(iten.path[0])) / 2;
const b = (Number(iten.lnglat[1]) + Number(iten.path[1])) / 2;
//屏幕移动的位置
path = [a, b - 0.1];
path = [a, b - 0.06];
// 线条infowindow显示中间,保留六位转换字符串,否则有时候会出现一些问题
iten.infoPath = [a.toFixed(6), b.toFixed(6)];
} else {
path = [iten.path[0], iten.path[1] - 0.1];
path = [iten.path[0], iten.path[1] - 0.06];
}
this.gaoMap.panTo(path);
}
......@@ -793,16 +808,14 @@ export default {
// console.log(target.getOptions());
// 如果是原地不动,就直接执行
// console.log(iten.infoPath, lng, lat + 0.1);
console.log("?",iten.infoPath[0] - lng<=0.00001, iten.infoPath[1] - (lat + 0.1)<=0.00001);
console.log(iten.infoPath[0] - lng>=0, iten.infoPath[1] - (lat + 0.1)>=-0.00001);
// 因为计算问题,误差小于0.00001就没动
if (
iten.infoPath[0] - lng >= -0.00001 &&
iten.infoPath[0] - lng <= 0.00001 &&
iten.infoPath[1] - (lat + 0.1) >= -0.00001&&
iten.infoPath[1] - (lat + 0.1) <= 0.00001
iten.infoPath[1] - (lat + 0.06) >= -0.00001 &&
iten.infoPath[1] - (lat + 0.06) <= 0.00001
) {
console.log('进来了')
this.gaoMap.leftListClick = false;
target.setOptions({ strokeColor: "#F7FE38" });
this.gaoMap.polylineMouseOver(e);
......@@ -825,8 +838,7 @@ export default {
lnglat: iten.path,
};
// 如果是原地不动,就直接执行
console.log(iten.path, lng, lat);
if (iten.path[0] == lng && iten.path[1] == lat + 0.1) {
if (iten.path[0] == lng && iten.path[1] >= (lat + 0.06)-0.000001) {
console.log("9999999999");
this.gaoMap.infoOpen(e);
return;
......@@ -1212,7 +1224,8 @@ input[type="radio"] {
}
}
.no {
width: 50px;
width: 25px;
font-weight: 700;
}
.name {
// border-right: none;
......
......@@ -4,6 +4,11 @@
<div class="top">
<span>设备报警最新记录</span>
<span @click="repeatClick" class="repeat">刷新</span>
<transition name="fade">
<span v-show="repeatFinshed" class="repeat2"> 数据刷新成功</span>
</transition>
<span @click="moreClick" class="more">更多>></span>
</div>
......@@ -73,6 +78,8 @@ export default {
},
data() {
return {
timer: null,
repeatFinshed: false,
typeName: {
1: "调压箱",
2: "阀门井",
......@@ -153,10 +160,12 @@ export default {
this.$router.push("/dataMonitoring/deviceAlarm");
// route.push(`dataMonitoring/deviceAlarm`)
},
repeatClick(){
this.getList();
repeatClick() {
// this.tableData=[];
if(this.repeatFinshed) return;
this.getList(true);
},
getList() {
getList(bool) {
this.loading = true;
listDeviceAlarm({ pageNum: 1, pageSize: 10 }).then((res) => {
if (res.code == 200) {
......@@ -176,8 +185,14 @@ export default {
alarmValue,
};
});
console.log(arr);
this.tableData=arr
this.tableData = arr;
if (bool) {
this.timer = null;
this.repeatFinshed = true;
this.timer = setTimeout(() => {
this.repeatFinshed = false;
}, 1000);
}
}
});
},
......@@ -213,6 +228,7 @@ export default {
line-height: 32px;
padding-left: 12px;
// position: relative;
span {
display: inline-block;
}
......@@ -223,6 +239,10 @@ export default {
color: #2788ea;
}
}
.repeat2 {
margin-left: 20px;
color:#67c23a;
}
.more {
float: right;
margin-right: 20px;
......@@ -290,5 +310,18 @@ export default {
.iconFontSize {
font-size: 50px !important;
}
.fade-enter-to,
.fade-leave {
opacity: 1;
}
.fade-leave-active {
transition: opacity 0.5s;
}
.fade-enter-active {
transition: opacity 0s;
}
.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
opacity: 0;
}
}
</style>
\ No newline at end of file
......@@ -99,7 +99,7 @@
<div class="scroll" :style="{ height: `${boxHeight}px` }">
<el-input
v-model="keyWord"
placeholder="点击输入"
placeholder="点击输入设备名称"
id="tipinput"
class="search-input"
>
......@@ -156,7 +156,7 @@
<template v-if="item.value != 8 && item.value != 9">
<div class="list-wrapper">
<div class="thead">
<div class="no">序号</div>
<div class="no"></div>
<div class="code">设备编号</div>
<div class="name">设备名称</div>
</div>
......@@ -181,7 +181,7 @@
<template v-else-if="item.value == 8">
<div class="list-wrapper">
<div class="thead">
<div class="no">序号</div>
<div class="no"></div>
<div class="code">隐患等级</div>
<div class="name">隐患名称</div>
</div>
......@@ -206,7 +206,7 @@
<template v-else-if="item.value == 9">
<div class="list-wrapper">
<div class="thead">
<div class="no">序号</div>
<div class="no"></div>
<div class="code">人员姓名</div>
<div class="name">联系电话</div>
</div>
......@@ -737,6 +737,8 @@ export default {
// 左边的Bar修改值 左边抽屉
leftBarChange(item) {
// this.leftBarNum= this.leftBarNum != item.value ? item.value:0;
this.gaoMap.closeInfoWindow();
this.gaoMap.polyLinesColorClear();
const index = this.leftBarNum.indexOf(item.value);
if (index >= 0) {
this.leftBarNum.splice(index, 1);
......@@ -798,6 +800,7 @@ export default {
}
},
panTo(item, bool) {
this.gaoMap.myMap.setZoom(12);
if (item.list.length > 0) {
if (this.leftBarNum.includes(item.value)) {
let path;
......@@ -809,9 +812,9 @@ export default {
const b =
(Number(item.list[0].lnglat[1]) + Number(item.list[0].path[1])) /
2;
path = [a, b - 0.1];
path = [a, b - 0.08];
} else {
path = [item.list[0].path[0], item.list[0].path[1] - 0.1];
path = [item.list[0].path[0], item.list[0].path[1] - 0.08];
}
this.gaoMap.panTo(path);
}
......@@ -825,7 +828,7 @@ export default {
// 如果地图太大了就吸纳是不出来infowindow了,所以要固定缩放比例
// 所有线条颜色还原
this.gaoMap.polyLinesColorClear();
this.gaoMap.myMap.setZoom(11);
this.gaoMap.myMap.setZoom(12);
if (item.list.length > 0) {
if (this.leftBarNum.includes(item.value)) {
let path;
......@@ -833,12 +836,12 @@ export default {
const a = (Number(iten.lnglat[0]) + Number(iten.path[0])) / 2;
const b = (Number(iten.lnglat[1]) + Number(iten.path[1])) / 2;
//屏幕移动的位置
path = [a, b - 0.1];
path = [a, b - 0.08];
// 线条infowindow显示中间,保留六位转换字符串,否则有时候会出现一些问题
iten.infoPath = [a.toFixed(6), b.toFixed(6)];
console.log(path);
} else {
path = [iten.path[0], iten.path[1] - 0.1];
path = [iten.path[0], iten.path[1] - 0.08];
}
// const path =
// item.value == 1
......@@ -881,8 +884,8 @@ export default {
if (
iten.infoPath[0] - lng >= -0.00001 &&
iten.infoPath[0] - lng <= 0.00001 &&
iten.infoPath[1] - (lat + 0.1) >= -0.00001 &&
iten.infoPath[1] - (lat + 0.1) <= 0.00001
iten.infoPath[1] - (lat + 0.08) >= -0.00001 &&
iten.infoPath[1] - (lat + 0.08) <= 0.00001
) {
this.gaoMap.leftListClick = false;
this.gaoMap.polylineMouseOver(e);
......@@ -907,7 +910,8 @@ export default {
lnglat: iten.path,
};
// 如果是原地不动,就直接执行
if (iten.path[0] == lng && iten.path[1] == lat + 0.1) {
// if (iten.path[0] == lng && iten.path[1] == lat + 0.08) {
if (iten.path[0] == lng && iten.path[1] >= lat + 0.08 - 0.000001) {
this.gaoMap.leftListClick = false;
this.gaoMap.infoOpen(e);
return;
......@@ -928,7 +932,8 @@ export default {
lnglat: iten.path,
};
// 如果是原地不动,就直接执行
if (iten.path[0] == lng && iten.path[1] == lat + 0.1) {
// if (iten.path[0] == lng && iten.path[1] == lat + 0.08) {
if (iten.path[0] == lng && iten.path[1] >= lat + 0.08 - 0.000001) {
this.gaoMap.leftListClick = false;
this.gaoMap.troubleOpen(e);
return;
......@@ -948,10 +953,11 @@ export default {
const e = {
target,
lnglat: iten.path,
};
// 如果是原地不动,就直接执行
if (iten.path[0] == lng && iten.path[1] == lat + 0.1) {
// if (iten.path[0] == lng && iten.path[1] == lat + 0.08) {
// console.log(iten.path[0] , iten.path[1] ,lat+0.06,lng)
if (iten.path[0] == lng && iten.path[1] >= lat + 0.08 - 0.000001) {
this.gaoMap.leftListClick = false;
this.gaoMap.wokerManOpen(e);
return;
......@@ -1630,6 +1636,7 @@ input[type="radio"] {
color: #053b6a;
font-weight: 600;
}
}
.deviceList {
cursor: pointer;
......@@ -1660,9 +1667,11 @@ input[type="radio"] {
white-space: nowrap;
// border-right: 1px solid #cccccc;
}
}
.no {
width: 50px;
width: 25px;
font-weight: 700;
}
.name {
// border-right: none;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment