Commit 612535ac authored by 赵啸非's avatar 赵啸非

Merge remote-tracking branch 'origin/master'

parents 31141c90 803e6766
...@@ -10,4 +10,6 @@ VUE_APP_PORTAL_URL = http://192.168.0.98:11072 ...@@ -10,4 +10,6 @@ VUE_APP_PORTAL_URL = http://192.168.0.98:11072
# 站点请求地址 # 站点请求地址
VUE_APP_SITETREE_URL = http://192.168.0.98:11078/base/site/siteTree VUE_APP_SITETREE_URL = http://192.168.0.98:11078/base/site/siteTree
# 系统名称
VUE_APP_sysName = "设备物联网"
...@@ -2,3 +2,5 @@ ...@@ -2,3 +2,5 @@
NODE_ENV = "development" NODE_ENV = "development"
VUE_APP_BASE_API= http://192.168.0.98:11091/m VUE_APP_BASE_API= http://192.168.0.98:11091/m
#VUE_APP_BASE_API= /basics_api/m #VUE_APP_BASE_API= /basics_api/m
#图片地址拼接
VUE_APP_API_IMG_URL=http://192.168.0.98:11078/
\ No newline at end of file
...@@ -12,3 +12,5 @@ VUE_APP_PORTAL_URL =/portal_home ...@@ -12,3 +12,5 @@ VUE_APP_PORTAL_URL =/portal_home
# 站点请求地址 # 站点请求地址
VUE_APP_SITETREE_URL = /basics_api/base/site/siteTree VUE_APP_SITETREE_URL = /basics_api/base/site/siteTree
#图片地址拼接
VUE_APP_API_IMG_URL=
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" /> <meta name="viewport" content="width=device-width,initial-scale=1.0" />
<link rel="icon" href="<%= BASE_URL %>sbgl.ico" /> <link rel="icon" href="<%= BASE_URL %>sbgl.ico" />
<title>设备管理平台</title> <title></title>
<link <link
rel="stylesheet" rel="stylesheet"
href="https://unpkg.zhimg.com/element-ui@2.15.5/lib/theme-chalk/index.css" href="https://unpkg.zhimg.com/element-ui@2.15.5/lib/theme-chalk/index.css"
......
<template> <template>
<div id="app"> <div id="app">
<router-view/> <router-view />
</div> </div>
</template> </template>
<script>
export default {
data() {
return {};
},
created() {
this.readVueXData();
},
methods: {
readVueXData() {
window.addEventListener("beforeunload", () => {
sessionStorage.setItem("store", JSON.stringify(this.$store.state));
});
if (sessionStorage.getItem("store")) {
this.$store.replaceState(
Object.assign(
{},
this.$store.state,
JSON.parse(sessionStorage.getItem("store"))
)
);
sessionStorage.removeItem("store");
}
},
},
};
</script>
<style lang="less" scoped>
</style>
...@@ -6,19 +6,17 @@ ...@@ -6,19 +6,17 @@
<div class="layout-menu flex flex-1"> <div class="layout-menu flex flex-1">
<!-- logo --> <!-- logo -->
<div class="layout-logo flex"> <div class="layout-logo flex">
<i class="el-icon-menu" @click="showMobileMenu = !showMobileMenu"> <!-- <i class="el-icon-menu" @click="showMobileMenu = !showMobileMenu">
</i> </i> -->
<router-link to="/"> <img
<img class="logo"
src="../assets/images/logo2.png" :src="
style="margin-bottom: 5px" sysLogo ? api + sysLogo : require('../assets/images/logo2.png')
height="27" "
width="27" />
/> <h1 class="title">
<b style="color: white; font-size: 20px; font-weight: bold; margin-right: 20px"> {{ sysName ? sysName : systemName }}
AIOT智慧边缘物联网系统</b </h1>
>
</router-link>
</div> </div>
<!-- 站点选择 --> <!-- 站点选择 -->
<div> <div>
...@@ -96,11 +94,19 @@ ...@@ -96,11 +94,19 @@
<script> <script>
import HeaderSite from "./HeaderSite.vue"; import HeaderSite from "./HeaderSite.vue";
import { mapState } from "vuex";
export default { export default {
name: "Header", name: "Header",
components: { components: {
HeaderSite, HeaderSite,
}, },
data() {
return {
api: process.env.VUE_APP_API_IMG_URL,
systemName: process.env.VUE_APP_sysName,
showMobileMenu: false,
};
},
methods: { methods: {
handleCommand(key) { handleCommand(key) {
if (key === "update") { if (key === "update") {
...@@ -122,11 +128,10 @@ export default { ...@@ -122,11 +128,10 @@ export default {
}); });
}, },
}, },
beforeDestroy() { beforeDestroy() {},
}, mounted() {},
mounted() {
},
computed: { computed: {
...mapState(["sysName", "sysLogo"]),
activeMenu() { activeMenu() {
return this.$route.path; return this.$route.path;
}, },
...@@ -202,11 +207,6 @@ export default { ...@@ -202,11 +207,6 @@ export default {
return this.$store.state.userData; return this.$store.state.userData;
}, },
}, },
data() {
return {
showMobileMenu: false,
};
},
}; };
</script> </script>
...@@ -215,23 +215,35 @@ export default { ...@@ -215,23 +215,35 @@ export default {
.mobile-menu-list { .mobile-menu-list {
display: none; display: none;
} }
.title {
font-size: 18px;
max-width: 200px;
color: #fff;
line-height: normal;
}
.layout-menu-wrapper { .layout-menu-wrapper {
height: 66px; height: 64px;
line-height: 66px; line-height: 64px;
font-size: 14px; font-size: 14px;
color: #eee; color: #eee;
background: linear-gradient(90deg, #1845c6 0%, #2999ff 100%); background: linear-gradient(90deg, #1845c6 0%, #2999ff 100%);
.layout-menu {
align-items: center;
}
.layout-logo { .layout-logo {
height: 50px; height: 50px;
padding-left: 23px; padding-left: 23px;
align-items: center;
.el-icon-menu { .el-icon-menu {
display: none; display: none;
} }
a { a {
margin: auto; margin: auto;
} }
img { .logo {
vertical-align: middle; width: 32px;
margin-right: 10px;
} }
} }
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
class="amap-demo" class="amap-demo"
> >
<div class="tuli"><slot name="leftTop"></slot></div> <div class="tuli"><slot name="leftTop"></slot></div>
<div class="liebiao"><slot name="rightTop"></slot></div>
<!-- <el-amap-search-box :on-search-result="onSearchResult" :events='searchEvents'/> --> <!-- <el-amap-search-box :on-search-result="onSearchResult" :events='searchEvents'/> -->
...@@ -20,12 +21,28 @@ ...@@ -20,12 +21,28 @@
<el-amap-marker <el-amap-marker
v-for="(marker, index) in markers" v-for="(marker, index) in markers"
:key="'marker' + index" :key="'marker' + index"
:events="marker.events" :events="markerevents"
:position="marker.position" :position="marker.position"
:label="marker.label" :label="marker.label"
:contentRender="contentRender" :contentRender="contentRender"
:extData="marker" :extData="marker"
> >
<div class="marker-using-slot" style="positon: relative">
<img
style="width: 36px; height: 50px"
src="@/assets/images/red.png"
/>
<div
style="
color: #ffffff;
position: absolute;
top: 8px;
left: 50%;
transform: translate(-50%);
" v-if="marker.extData.level == 1">
{{ marker.extData.siteCount }}
</div>
</div>
</el-amap-marker> </el-amap-marker>
<!--信息窗体--> <!--信息窗体-->
...@@ -37,7 +54,7 @@ ...@@ -37,7 +54,7 @@
><el-row :body-style="{ padding: '0px' }"> ><el-row :body-style="{ padding: '0px' }">
<el-row type="flex" justify="space-between"> <el-row type="flex" justify="space-between">
<span style="font-size: 18px" <span style="font-size: 18px"
><b>{{ info.siteName }}</b></span ><b>{{ info.label }}</b></span
> >
<el-button <el-button
type="text" type="text"
...@@ -140,11 +157,39 @@ export default { ...@@ -140,11 +157,39 @@ export default {
}, },
created() { created() {
this.refresh(this.markersData); this.refresh(this.markersData);
this.markerevents = {
click: (e) => {
let exData = e.target.getExtData();
this.center = [exData.extData.lng, exData.extData.lat]
this.zoom = 8
this.info = exData.extData;
this.window.position = exData.position;
if(this.info.children && this.info.children.length>0){
let children = JSON.parse(JSON.stringify(exData.extData.children))
children = this.flatten(children)
children = children.map(i=> {return {
...i,
lat:i.latitude,
lng:i.longitude,
}})
exData.extData.level = ''
children.unshift(JSON.parse(JSON.stringify(exData.extData)))
children = children.filter((v) => {
return v.type == "site";
});
this.refresh(children)
}
this.window.visible = false;
this.$nextTick(() => {
this.window.visible = true; //点击点坐标,出现信息窗体
});
},
}
}, },
methods: { methods: {
formatterDate, formatterDate,
contentRender(h, params) { contentRender(h, params) {
return <img src={require("../assets/images/d.png")} />; return <img style="width: 36px;height: 50px;" src={require("../assets/images/red.png")} />;
}, },
getDeviceDetial() { getDeviceDetial() {
this.$emit("choose", this.info, (val) => { this.$emit("choose", this.info, (val) => {
...@@ -152,8 +197,9 @@ export default { ...@@ -152,8 +197,9 @@ export default {
}); });
}, },
refresh(data) { refresh(data) {
// console.log("刷新数据", data); // console.log("刷新数据", data,this.markers);
this.markersData = data; this.markersData = data;
this.markers = []
this.markersData.map((item) => { this.markersData.map((item) => {
this.setMarker(item); this.setMarker(item);
}); });
...@@ -168,27 +214,23 @@ export default { ...@@ -168,27 +214,23 @@ export default {
setMarker(item) { setMarker(item) {
if (!item.lng && !item.lat) return; if (!item.lng && !item.lat) return;
let markerLabel = { let markerLabel = {
label: { content: item.siteName, offset: [20, 38] }, label: { offset: [20, 38] },
position: [item.lng, item.lat], position: [item.lng, item.lat],
//icon: require("@/assets/images/marker-blue.png"), //icon: require("@/assets/images/marker-blue.png"),
extData: item, extData: item,
events: {
click: (e) => {
// console.log("getExtData", e.target.getExtData());
let exData = e.target.getExtData();
this.info = exData.extData;
this.window.position = exData.position;
this.window.visible = false;
this.$nextTick(() => {
this.window.visible = true; //点击点坐标,出现信息窗体
});
},
},
}; };
this.markers.push(markerLabel); this.markers.push(markerLabel);
}, },
flatten(arr) {
return arr.reduce((result, item) => {
return result.concat(
item,
Array.isArray(item.children) ? this.flatten(item.children) : []
);
}, []);
},
// 处理搜索结果,定位到中心点 // 处理搜索结果,定位到中心点
onSearchResult(pois) { onSearchResult(pois) {
let latSum = 0; let latSum = 0;
...@@ -369,6 +411,18 @@ export default { ...@@ -369,6 +411,18 @@ export default {
</script> </script>
<style lang="less"> <style lang="less">
.amap-maptypecontrol{
display: none;
}
.liebiao{
width: 400px;
top: 40px;
right: 34px;
position: absolute;
// float: right;
background-color: rgba(255, 255, 255, 0.7);
}
.tuli { .tuli {
width: 300px; width: 300px;
top: 20px; top: 20px;
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
@change="item.change" @change="item.change"
@clear="item.clear" @clear="item.clear"
v-if="item.type === 'select'" v-if="item.type === 'select'"
:placeholder="'请选择'+item.label"
> >
<el-option <el-option
label="全部" label="全部"
......
...@@ -290,6 +290,9 @@ export default { ...@@ -290,6 +290,9 @@ export default {
</script> </script>
<style lang="less"> <style lang="less">
.table-body{
margin-left: 30px;
}
@media screen and (max-width: 800px) { @media screen and (max-width: 800px) {
.layout-table { .layout-table {
.table-head { .table-head {
...@@ -313,6 +316,7 @@ export default { ...@@ -313,6 +316,7 @@ export default {
} }
.layout-table { .layout-table {
.table-head { .table-head {
margin-left: 10px;
margin-bottom: 10px; margin-bottom: 10px;
//padding-bottom: 12px; //padding-bottom: 12px;
// padding-top: 7px; // padding-top: 7px;
......
import Vue from 'vue' import Vue from "vue";
import Vuex from 'vuex' import Vuex from "vuex";
import { normalCallPost } from './assets/utils'; import { normalCallPost } from "./assets/utils";
Vue.use(Vuex) Vue.use(Vuex);
let userData = {}; let userData = {};
try { try {
userData = JSON.parse(window.sessionStorage.userData || '{}'); userData = JSON.parse(window.sessionStorage.userData || "{}");
} catch (error) { } catch (error) {
console.log('未从session中获取到userData') console.log("未从session中获取到userData");
} }
function convertTreeToList(root, array) { function convertTreeToList(root, array) {
if(!root || !root.length) return array; if (!root || !root.length) return array;
root.forEach(item=>{ root.forEach((item) => {
let data = JSON.parse(JSON.stringify(item)); let data = JSON.parse(JSON.stringify(item));
const url = data.url ? data.url : (item.childList[0] ? (item.childList[0].url || '') : ''); const url = data.url
? data.url
: item.childList[0]
? item.childList[0].url || ""
: "";
delete data.childList; delete data.childList;
array.push({ array.push({
name: data.name, name: data.name,
...@@ -25,20 +29,30 @@ function convertTreeToList(root, array) { ...@@ -25,20 +29,30 @@ function convertTreeToList(root, array) {
parentId: data.parentId, parentId: data.parentId,
icon: data.imgPath, icon: data.imgPath,
}); });
if(item.childList){ if (item.childList) {
convertTreeToList(item.childList, array); convertTreeToList(item.childList, array);
} }
}) });
return array; return array;
} }
function isPc() { function isPc() {
var userAgentInfo = navigator.userAgent; var userAgentInfo = navigator.userAgent;
var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"); var Agents = new Array(
var flag = true; "Android",
for (var v = 0; v < Agents.length; v++) { "iPhone",
if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; } "SymbianOS",
} "Windows Phone",
"iPad",
"iPod"
);
var flag = true;
for (var v = 0; v < Agents.length; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) {
flag = false;
break;
}
}
return flag; return flag;
} }
...@@ -47,7 +61,9 @@ export default new Vuex.Store({ ...@@ -47,7 +61,9 @@ export default new Vuex.Store({
isLogin: false, isLogin: false,
isMobile: !isPc(), isMobile: !isPc(),
userData, userData,
group: '', group: "",
sysName: "", // 系统名称
sysLogo: "", // 系统logo
}, },
mutations: { mutations: {
setUserData(state, data) { setUserData(state, data) {
...@@ -60,25 +76,34 @@ export default new Vuex.Store({ ...@@ -60,25 +76,34 @@ export default new Vuex.Store({
logout(state) { logout(state) {
state.userData = {}; state.userData = {};
state.isLogin = false; state.isLogin = false;
window.sessionStorage.userData = ''; window.sessionStorage.userData = "";
window.sessionStorage.token = ''; window.sessionStorage.token = "";
}, },
setGroup(state, data) { setGroup(state, data) {
state.group = data; state.group = data;
}, },
SET_sysName(state, sysName) {
state.sysName = sysName;
},
SET_sysLogo(state, sysLogo) {
state.sysLogo = sysLogo;
},
}, },
actions: { actions: {
login({commit}) { login({ commit }) {
normalCallPost('/login/index').then(({data})=>{ normalCallPost("/login/index")
commit('setUserData', data) .then(({ data }) => {
}).catch(error=>{ commit("setUserData", data);
})
}) .catch((error) => {});
}, },
logout({commit}) { logout({ commit }) {
normalCallPost('/login/logout').then(data=>{}).catch(error=>{}).then(()=>{ normalCallPost("/login/logout")
commit('logout') .then((data) => {})
}) .catch((error) => {})
.then(() => {
commit("logout");
});
}, },
} },
}) });
...@@ -16,7 +16,7 @@ import LayoutHeaderLeft from "../components/HeaderLeft"; ...@@ -16,7 +16,7 @@ import LayoutHeaderLeft from "../components/HeaderLeft";
const isPC = /(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent); const isPC = /(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent);
//菜单位置:取值: left :菜单在左面, top :菜单在上面 //菜单位置:取值: left :菜单在左面, top :菜单在上面
const MenuPage = "top"; const MenuPage = "top";
import { mapState } from "vuex";
export default { export default {
components: { components: {
LayoutHeader, LayoutHeader,
...@@ -26,9 +26,11 @@ export default { ...@@ -26,9 +26,11 @@ export default {
return { return {
isOpen: isPC, isOpen: isPC,
menuPage: MenuPage, menuPage: MenuPage,
systemName: process.env.VUE_APP_sysName,
}; };
}, },
computed: { computed: {
...mapState(["sysName", "sysLogo"]),
menuPageCss() { menuPageCss() {
//左面和顶面菜单切换时,动态计划相关css参数 //左面和顶面菜单切换时,动态计划相关css参数
return { return {
...@@ -37,6 +39,9 @@ export default { ...@@ -37,6 +39,9 @@ export default {
}; };
}, },
}, },
created() {
document.title = this.sysName ? this.sysName : this.systemName; // 设置项目标题
},
methods: { methods: {
toggle() { toggle() {
this.isOpen = !this.isOpen; this.isOpen = !this.isOpen;
......
...@@ -5,27 +5,40 @@ ...@@ -5,27 +5,40 @@
</template> </template>
<script> <script>
import { mapMutations } from "vuex";
export default { export default {
mounted() { data() {
let token = this.$route.query.token; return {};
let siteid = this.$route.query.siteid; },
if (token) { created() {
window.sessionStorage.setItem("token", token); this.getInfo();
window.sessionStorage.setItem("siteid", siteid); },
this.$router.push("/index"); // 有token直接跳转首页 mounted() {},
} else { methods: {
this.$message({ ...mapMutations(["SET_sysName", "SET_sysLogo"]),
message: "没有权限,正在跳转登录页面...", // 获取token和站点信息
center: true, async getInfo() {
}); let { token, siteid, sysName, sysLogo } = this.$route.query;
setTimeout(function () { if (token) {
window.location.href = window.sessionStorage.setItem("token", token);
process.env.VUE_APP_PORTAL_URL == "undefined" window.sessionStorage.setItem("siteid", siteid);
? "http://192.168.0.98:11072" this.SET_sysName(sysName);
: process.env.VUE_APP_PORTAL_URL; this.SET_sysLogo(sysLogo);
//this.$router.push('/login') this.$router.push("/index"); // 有token直接跳转首页
}, 1000); } else {
} this.$message({
message: "没有权限,正在跳转登录页面...",
center: true,
});
setTimeout(function () {
window.location.href =
process.env.VUE_APP_PORTAL_URL == "undefined"
? "http://192.168.0.98:11072"
: process.env.VUE_APP_PORTAL_URL;
//this.$router.push('/login')
}, 1000);
}
},
}, },
}; };
</script> </script>
......
<template> <template>
<div class="page"> <div class="page">
<LayoutTable :data="tableData" notAdd notDel :config="tableConfig"> <LayoutTable :data="tableData" notAdd notDel :config="tableConfig">
<el-button slot="table-head-left2" style="margin-left: 10px" type="primary" size="mini" @click="doExport" <el-button slot="table-head-left2" type="primary" size="mini" @click="doExport"
:disabled="isExport">导出</el-button> :disabled="isExport">导出</el-button>
</LayoutTable> </LayoutTable>
......
...@@ -49,6 +49,18 @@ ...@@ -49,6 +49,18 @@
return { return {
config: { config: {
search: [ search: [
{
name: "appCode",
type: "text",
label: "应用编码",
fuzzy: true,
},
{
name: "appName",
type: "text",
label: "应用名称",
fuzzy: true,
},
], ],
columns: [ columns: [
{type: "selection", width: 60}, {type: "selection", width: 60},
......
<template>
<!-- 弹出框表单 -->
<el-drawer
:title="title"
:visible.sync="open"
:direction="direction"
size="50%"
>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<!-- <Field
:span="22"
label="所属平台"
prop="platformId"
v-model="form.platformId"
:enumData="dict.platformId"
type="select"
placeholder="请输入产品名称,名称唯一"
/> -->
<Field
:span="22"
label="产品名称"
prop="productName"
v-model="form.productName"
placeholder="请输入产品名称,名称唯一"
/>
<Field
:span="22"
label="告警设备"
prop="deviceName"
v-model="form.deviceName"
/>
<Field
:span="22"
label="告警时间"
prop="alarmTime"
v-model="time"
/>
<Field
:span="22"
label="告警内容"
prop="alarmType"
v-model="alarmType"
/>
<Field
:span="22"
label="告警程度"
prop="alarmLevel"
v-model="alarmLevel"
/>
<Field
:span="22"
label="告警状态"
prop="alarmStatus"
v-model="alarmStatus"
/>
<Field
:span="22"
label="接收人员"
prop="alarmReceivePersonnel"
v-model="form.alarmReceivePersonnel"
/>
<Field
:span="22"
label="告警详情"
prop="alarmContent"
v-model="form.alarmContent"
type="textarea"
/>
<!-- <Field
:span="22"
label="产品编码"
prop="productCode"
v-model="form.productCode"
placeholder="请输入产品编码"
/> -->
<!-- <Field
:span="22"
label="默认首页"
prop="skinId"
v-model="form.skinId"
@change="skinSelect"
:enumData="dict.skinProductCodeMap[form.productCode]"
type="select"
placeholder="请输入产品名称,名称唯一"
/> -->
<!-- <Field
:span="22"
v-if="form.productCode == 'pjq'"
label="事件地址"
prop="eventUrl"
v-model="form.eventUrl"
placeholder="请输入事件地址"
/> -->
</el-row>
<!-- <form-buttons @submit="submitForm" noCancelBtn /> -->
</el-form>
</el-drawer>
</template>
<script>
import form from "@/assets/mixins/formdialog";
import { formatterDate } from "@/assets/utils/index";
export default {
name: "DeviceAlarmDetail",
mixins: [form],
components: {},
created() {
this.changePath("product");
},
data() {
return {
alarmLevel:'',
alarmStatus:'',
time:'',
// 遮罩层
loading: true,
// 弹出层标题
title: "产品",
// 是否显示弹出层
open: false,
direction: "rtl",
toString: ["platformId", "skinId"],
toDate: [],
// 表单校验
rules: {
productName: [
{
required: true,
message: "请输入产品名称,名称唯一",
trigger: "blur",
},
{ max: 20, message: "最多只能录入20个字符", trigger: "blur" },
],
productCode: [
{ required: true, message: "请输入产品编码", trigger: "blur" },
{ max: 256, message: "最多只能录入256个字符", trigger: "blur" },
],
homeUrl: [
{ required: true, message: "请输入首页地址", trigger: "blur" },
{ max: 512, message: "最多只能录入512个字符", trigger: "blur" },
],
},
};
},
watch:{
'form.alarmTime'(newval){
this.time = this.formatterDate(parseInt(newval))
},
"form.alarmLevel"(newval){
this.alarmLevel = this.dict.alarmLevel[newval]
},
"form.alarmStatus"(newval){
this.alarmStatus = this.dict.alarmStatus[newval]
},
"form.alarmType"(newval){
this.alarmType = this.dict.alarmType[newval]
},
},
methods: {
formatterDate,
skinSelect(val) {
this.form.skinName =
this.dict.skinProductCodeMap[this.form.productCode][val];
},
/** 编辑 */
edit(row) {
this.reset();
this.query = { id: row.id };
this.urls.currUrl = "product/edit";
this.getData();
this.pageInfo.type = "edit";
this.title = "修改产品";
},
/** 新增 */
add(row) {
this.reset();
this.urls.currUrl = "product/add";
this.getData();
this.pageInfo.type = "add";
this.title = "新增产品";
},
/** 查看*/
view(row) {
this.reset();
this.query = { id: row.id };
this.urls.currUrl = "device/alarm/info/view";
this.getData();
this.pageInfo.type = "view";
this.title = "详情";
},
/**取消按钮 */
cancel() {
this.open = false;
},
/**获取数据后弹框 */
afterRender(data) {
this.open = true;
},
afterSubmit(data) {
this.open = false;
this.$emit("ok");
},
// 表单重置
reset() {
this.form = {
platformId: null,
productName: "",
productCode: "",
productRemark: "",
};
this.resetForm("form");
},
resetForm(refName) {
if (this.$refs[refName]) {
this.$refs[refName].resetFields();
}
},
},
};
</script>
<template> <template>
<div class="page"> <div class="page">
<LayoutTable :data="tableData" notAdd notDel :config="tableConfig"> <LayoutTable :data="tableData" notAdd notDel :config="tableConfig">
<el-button slot="table-head-left2" style="margin-left: 10px" type="primary" class="addclass" size="mini" @click="doExport" <el-button slot="table-head-left2" type="primary" class="addclass" size="mini" @click="doExport"
:disabled="isExport">导出</el-button> :disabled="isExport">导出</el-button>
<el-tag slot="table-head-row2-left" size="mini" style="margin: 10px">告警次数:{{ tableData.totalCount }}</el-tag> <el-tag slot="table-head-row2-left" size="mini" style="margin: 10px">告警次数:{{ tableData.totalCount }}</el-tag>
...@@ -16,13 +16,15 @@ ...@@ -16,13 +16,15 @@
}}</el-tag> }}</el-tag>
</LayoutTable> </LayoutTable>
<dialog-show ref="dialogform" @ok="getData" /> <!-- <dialog-show ref="dialogform" @ok="getData" /> -->
<drawer-show ref="drawerform" @ok="getData" />
</div> </div>
</template> </template>
<script> <script>
/** 表单弹出框模式需引入 */ /** 表单弹出框模式需引入 */
import dialogShow from "./dialogshow"; import drawerShow from "./drawershow";
// import dialogShow from "./dialogshow";
import table from "@/assets/mixins/table"; import table from "@/assets/mixins/table";
export default { export default {
name: "DeviceAlarmInfo", name: "DeviceAlarmInfo",
...@@ -32,7 +34,7 @@ export default { ...@@ -32,7 +34,7 @@ export default {
default: null, default: null,
}, },
}, },
components: { dialogShow }, components: { drawerShow },
mixins: [table], mixins: [table],
created() { created() {
if (this.queryIn && this.queryIn.alarmDevice) { if (this.queryIn && this.queryIn.alarmDevice) {
...@@ -53,9 +55,10 @@ export default { ...@@ -53,9 +55,10 @@ export default {
this.$refs.dialogform.edit(row); this.$refs.dialogform.edit(row);
}, },
/** 重写查看方法 */ /** 重写查看方法 */
// toView(row) { toView(row) {
// this.$refs.dialogform.view(row); // this.$refs.dialogform.view(row);
// }, this.$refs.drawerform.view(row);
},
/** 导出Excel */ /** 导出Excel */
doExport() { doExport() {
this.isExport = true; this.isExport = true;
...@@ -127,6 +130,12 @@ export default { ...@@ -127,6 +130,12 @@ export default {
prop: "alarmDevice", prop: "alarmDevice",
formatter: this.formatter, formatter: this.formatter,
}, },
{
label: "设备类型",
align: "center",
prop: "productName",
formatter: this.formatter,
},
{ {
label: "告警内容", label: "告警内容",
align: "center", align: "center",
...@@ -152,6 +161,21 @@ export default { ...@@ -152,6 +161,21 @@ export default {
prop: "alarmStatus", prop: "alarmStatus",
formatter: this.formatter, formatter: this.formatter,
}, },
{
label: "操作",
align: "center",
width: 240,
formatter: (row) => {
return (
<table-buttons
row={row}
noEdit={true}
noDel={true}
onView={this.toView}
/>
);
},
},
], ],
}, },
}; };
......
...@@ -44,13 +44,13 @@ export default { ...@@ -44,13 +44,13 @@ export default {
name: "deviceCode", name: "deviceCode",
type: "text", type: "text",
label: "设备编号", label: "设备编号",
fuzzy: true, // fuzzy: true,
}, },
{ {
name: "messageHead", name: "messageHead",
type: "text", type: "text",
label: "业务标识", label: "业务标识",
fuzzy: true, // fuzzy: true,
}, },
{ {
name: "logType", name: "logType",
......
<template> <template>
<!-- 弹出框表单 --> <!-- 抽屉表单 -->
<el-dialog :title="title" :visible.sync="open" width="90%" append-to-body> <el-drawer
:title="title"
:visible.sync="open"
:direction="direction"
size="50%"
>
<el-form ref="form" :model="form" :rules="rules" label-width="160px"> <el-form ref="form" :model="form" :rules="rules" label-width="160px">
<el-row> <el-row>
<Field :span="20" label="模块名称" prop="moduleName" v-model="form.moduleName" type="textarea" placeholder="请输入模块名称"/> <Field :span="20" label="模块名称" prop="moduleName" v-model="form.moduleName" type="textarea" placeholder="请输入模块名称"/>
<Field :span="20" label="模块消息编码" prop="moduleMsgCode" v-model="form.moduleMsgCode" type="textarea" placeholder="请输入模块消息编码,与上报消息头编码一致,唯一"/> <Field :span="20" label="模块消息编码" prop="moduleMsgCode" v-model="form.moduleMsgCode" type="textarea" placeholder="请输入模块消息编码,与上报消息头编码一致,唯一"/>
</el-row> </el-row>
<form-buttons @submit="submitForm" noCancelBtn />
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> </el-drawer>
<el-button type="primary" class="addclass" v-if="pageInfo.type !== 'view'" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</template> </template>
<script> <script>
...@@ -26,6 +28,7 @@ ...@@ -26,6 +28,7 @@
}, },
data() { data() {
return { return {
direction: "rtl",
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 弹出层标题 // 弹出层标题
......
...@@ -56,7 +56,13 @@ export default { ...@@ -56,7 +56,13 @@ export default {
data() { data() {
return { return {
config: { config: {
search: [], search: [
{
name: "productName",
type: "text",
label: "产品",
fuzzy: true,
},],
columns: [ columns: [
{ type: "selection", align: "center", width: 60 }, { type: "selection", align: "center", width: 60 },
{ type: "index", align: "center", label: "序号", width: 50 }, { type: "index", align: "center", label: "序号", width: 50 },
......
...@@ -32,7 +32,11 @@ export default { ...@@ -32,7 +32,11 @@ export default {
data() { data() {
return { return {
config: { config: {
search: [], search: [{
name: "moduleName",
type: "text",
label: "模块名称",
}],
columns: [ columns: [
{ type: "selection", align: "center", width: 60 }, { type: "selection", align: "center", width: 60 },
{ type: "index", align: "center", label: "序号", width: 50 }, { type: "index", align: "center", label: "序号", width: 50 },
......
...@@ -43,7 +43,7 @@ export default { ...@@ -43,7 +43,7 @@ export default {
name: "firmName", name: "firmName",
type: "text", type: "text",
label: "设备生产厂商名称", label: "设备生产厂商名称",
fuzzy: true, // fuzzy: true,
}, },
], ],
columns: [ columns: [
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
label-width="80px" label-width="80px"
size="small" size="small"
> >
<h1>设备管理平台</h1> <h1>{{ sysName ? sysName : systemName }}</h1>
<el-form-item label="用户名"> <el-form-item label="用户名">
<el-input v-model="form.loginName"></el-input> <el-input v-model="form.loginName"></el-input>
</el-form-item> </el-form-item>
...@@ -31,18 +31,44 @@ ...@@ -31,18 +31,44 @@
</div> </div>
<div class="footer"> <div class="footer">
登陆 &copy; <a href="">信宏翔网络科技有限公司</a> 出品 <!-- 登陆 &copy; <a href="">信宏翔网络科技有限公司</a> 出品 -->
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { createSocket } from "@/assets/utils/websocket"; // import { createSocket } from "@/assets/utils/websocket";
import { mapMutations, mapState } from "vuex";
export default { export default {
name: "login", name: "login",
created() {}, data() {
return {
systemName: process.env.VUE_APP_sysName,
originData: [],
loading: false,
form: {
loginName: "",
password: "",
},
};
},
computed: {
...mapState(["sysName"]),
},
created() {
this.getInfo();
},
methods: { methods: {
...mapMutations(["SET_sysName", "SET_sysLogo"]),
// 获取token和站点信息
getInfo() {
let { sysName, sysLogo, siteid } = this.$route.query;
if (siteid && sysName && sysLogo) {
sessionStorage.setItem("siteid", siteid);
this.SET_sysName(sysName);
this.SET_sysLogo(sysLogo);
}
},
login() { login() {
this.loading = true; this.loading = true;
this.$post("/login/login", this.form) this.$post("/login/login", this.form)
...@@ -51,10 +77,9 @@ export default { ...@@ -51,10 +77,9 @@ export default {
}, },
loginSuccess({ data }) { loginSuccess({ data }) {
this.$store.commit("setUserData", data); this.$store.commit("setUserData", data);
this.$router.replace({ let { token } = data;
path: this.redirect, sessionStorage.setItem("token", token);
}); this.$router.push("/index");
//成功 创建websocket连接 process.env.VUE_WEBSOCKET_BASE_API + //成功 创建websocket连接 process.env.VUE_WEBSOCKET_BASE_API +
// createSocket("ws://"+process.env.VUE_APP_BASE_API +"/ws?accessToken="+data.id) // createSocket("ws://"+process.env.VUE_APP_BASE_API +"/ws?accessToken="+data.id)
}, },
...@@ -80,17 +105,6 @@ export default { ...@@ -80,17 +105,6 @@ export default {
this.login(); this.login();
}, },
}, },
data() {
return {
originData: [],
loading: false,
redirect: this.$route.query.redirect || "/",
form: {
loginName: "",
password: "",
},
};
},
}; };
</script> </script>
......
...@@ -32,7 +32,15 @@ export default { ...@@ -32,7 +32,15 @@ export default {
data() { data() {
return { return {
config: { config: {
search: [], search: [{
name: "platformName",
type: "text",
label: "平台名称",
},{
name: "platformSn",
type: "text",
label: "平台编码",
}],
columns: [ columns: [
{ {
type: "selection", type: "selection",
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
/> />
</el-row> </el-row>
<form-buttons @submit="submitForm" noCancelBtn /> <form-buttons @submit="submitForm" noCancelBtn v-if="pageInfo.type != 'view'"/>
</el-form> </el-form>
</el-drawer> </el-drawer>
</template> </template>
......
...@@ -50,6 +50,12 @@ ...@@ -50,6 +50,12 @@
return { return {
config: { config: {
search: [ search: [
{
name: "productName",
type: "text",
label: "产品类型",
fuzzy: true,
},
], ],
columns: [ columns: [
{type: "selection", width: 60}, {type: "selection", width: 60},
......
...@@ -27,8 +27,52 @@ ...@@ -27,8 +27,52 @@
> >
</el-tree> </el-tree>
</el-scrollbar> </el-scrollbar>
</el-card> </el-row </el-card>
></Map> </el-row>
<el-row :gutter="20" slot="rightTop" class="mytree">
<el-card>
<div slot="header">
<span><b class="cardTitle">站点列表</b></span>
</div>
<div class="listbody">
<div class="listtop">
<div class="item sbzs">
<div>{{listNum.all}}</div>
<div class="wz">设备总数(台)</div>
</div>
<div class="item zx">
<div>{{listNum.online}}</div>
<div class="wz">在线(台)</div>
</div>
<div class="item lx">
<div>{{listNum.unline}}</div>
<div class="wz">离线(台)</div>
</div>
</div>
<div class="maplist">
<div v-for="(item,index) in rightShowList" :key="index" class="deployitem">
<div class="top">
<div class="title">{{ item.label }}</div>
<div class="ckxq pointer" @click="getDetailData(item)">查看详情</div>
</div>
<div class="are">{{ item.detailAddress }}</div>
<div class="data">
<div class="sbzs dataitem">
设备总数:<span>{{ item.deviceTotal }}</span>
</div>
<div class="zx dataitem">
在线:<span>{{ item.onlineTotal }}</span>
</div>
<div class="lx dataitem">
离线:<span>{{ item.offlineTotal }}</span>
</div>
</div>
</div>
</div>
</div>
</el-card>
</el-row>
</Map>
<dialog-show ref="dialogform" @ok="getData" /> <dialog-show ref="dialogform" @ok="getData" />
</div> </div>
</template> </template>
...@@ -45,19 +89,57 @@ export default { ...@@ -45,19 +89,57 @@ export default {
mounted() { mounted() {
this.pageInfo.list = "/sitestat/list"; this.pageInfo.list = "/sitestat/list";
}, },
watch:{
originData(newval){
let val = JSON.parse(JSON.stringify(newval))
let arr = this.flatten(val).filter((v) => {
return v.type == "site";
});
this.rightShowList = arr
let all = 0;
let online = 0;
let unline = 0;
arr.forEach(v=>{
all += parseInt(v.deviceTotal)
online += parseInt(v.onlineTotal)
unline += parseInt(v.offlineTotal)
})
this.listNum.all = all
this.listNum.online = online
this.listNum.unline = unline
}
},
created() { created() {
this.pageInfo.list = "/sitestat/list"; this.pageInfo.list = "/sitestat/list";
this.$get("/sitestat/maplist", {}).then(({ data }) => { // this.$get("/sitestat/maplist", {}).then(({ data }) => {
this.originData = data; // this.originData = data;
this.$refs.map.refresh(this.originData); // this.$refs.map.refresh(this.originData);
}); // });
this.$get("/sitestat/siteTree", {}).then(({ data }) => { this.$get("/sitestat/siteTree", {}).then(({ data }) => {
this.areaData = data.data; let arr = []
data.data.forEach(i=>{
arr.push({
...i,
lat:i.latitude,
lng:i.longitude,
level:1
})
})
this.originData = arr
this.areaData = JSON.parse(JSON.stringify(arr));
this.$refs.map.refresh(this.originData);
}); });
}, },
methods: { methods: {
flatten(arr) {
return arr.reduce((result, item) => {
return result.concat(
item,
Array.isArray(item.children) ? this.flatten(item.children) : []
);
}, []);
},
/** 下载模板操作 */ /** 下载模板操作 */
downloadTemplate() { downloadTemplate() {
this.isExport = true; this.isExport = true;
...@@ -121,6 +203,7 @@ export default { ...@@ -121,6 +203,7 @@ export default {
}, },
handleNodeClick(node) { handleNodeClick(node) {
this.$refs.map.window.visible = false;
this.currentNode = node; this.currentNode = node;
if (node.type === "site") { if (node.type === "site") {
let obj = {}; let obj = {};
...@@ -128,10 +211,37 @@ export default { ...@@ -128,10 +211,37 @@ export default {
obj.lat = node.latitude; obj.lat = node.latitude;
this.$refs.map.relocate(obj); this.$refs.map.relocate(obj);
} }
if(node.level==1){
let arr = []
arr.push(JSON.parse(JSON.stringify(node)))
this.originData = arr
this.$refs.map.refresh(this.originData);
this.$refs.map.zoom = 6
}else{
let children = JSON.parse(JSON.stringify(node.children))
children = this.$refs.map.flatten(children)
children.unshift(JSON.parse(JSON.stringify(node)))
children = children.filter((v) => {
return v.type == "site";
});
children = children.map(i=> {return {
...i,
lat:i.latitude,
lng:i.longitude,
}})
this.originData = children
this.$refs.map.refresh(this.originData);
}
}, },
}, },
data() { data() {
return { return {
listNum:{
all:0,
online:0,
unline:0
},
rightShowList:[],
isExport: false, isExport: false,
originData: [], originData: [],
config: { config: {
...@@ -189,7 +299,102 @@ export default { ...@@ -189,7 +299,102 @@ export default {
}; };
</script> </script>
<style> <style lang="less" scoped>
.deployitem {
padding: 10px 0;
color: #223333;
border-bottom: 1px solid gainsboro;
.top{
display: flex;
justify-content: space-between;
}
.ckxq {
font-size: 10px;
margin-right: 20px;
margin-top: 8px;
color: #1890ff;
flex-shrink: 0;
}
.data {
display: flex;
font-size: 12px;
font-weight: 500;
color: #999999;
margin: 4px 0;
.dataitem {
margin-right: 16px;
}
.sbzs > span {
color: #223333;
}
.zx > span {
color: #0064e9;
}
.zx {
position: relative;
}
.zx::before {
content: "";
position: absolute;
width: 4px;
height: 4px;
background: #0064e9;
border-radius: 50%;
top: 6px;
left: -6px;
}
.lx > span {
color: #fa4d4c;
}
}
.title {
font-size: 14px;
font-weight: 600;
padding: 4px 0;
}
.are {
font-size: 12px;
}
}
.listbody::-webkit-scrollbar {
width: 0;
}
.listbody{
max-height: 700px;
overflow: auto;
.listtop{
display: flex;
justify-content: space-between;
padding: 20px 0 10px;
border-bottom: 1px solid #dcdcdc;
.item {
width: 120px;
height: 60px;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
color: #fff;
padding-bottom: 6px;
font-size: 8px;
.wz {
margin-left: 14px;
}
}
.sbzs {
background: url("~@/assets/images/sbzs.png") no-repeat;
background-size: 100% 100%;
}
.zx {
background: url("~@/assets/images/zx.png") no-repeat;
background-size: 100% 100%;
}
.lx {
background: url("~@/assets/images/lx.png") no-repeat;
background-size: 100% 100%;
}
}
}
.el-card__body { .el-card__body {
padding: 10px; padding: 10px;
} }
......
...@@ -18,11 +18,13 @@ export default { ...@@ -18,11 +18,13 @@ export default {
name: "loginName", name: "loginName",
type: "text", type: "text",
label: "登录名", label: "登录名",
fuzzy: true,
}, },
{ {
name: "requestUrl", name: "requestUrl",
type: "text", type: "text",
label: "请求地址", label: "请求地址",
fuzzy: true,
}, },
], ],
columns: [ columns: [
......
...@@ -150,9 +150,9 @@ export default { ...@@ -150,9 +150,9 @@ export default {
reserveSelection: true, reserveSelection: true,
width: 60, width: 60,
}, },
{ type: "index", label: "序号", align: "center", width: 50 },
{ {
width: 60, width: 60,
label: "树形展开",
align: "center", align: "center",
formatter: (row) => { formatter: (row) => {
const icon = const icon =
...@@ -170,6 +170,7 @@ export default { ...@@ -170,6 +170,7 @@ export default {
); );
}, },
}, },
{ type: "index", label: "序号", align: "center", width: 50 },
{ {
prop: "id", prop: "id",
align: "center", align: "center",
......
...@@ -33,6 +33,7 @@ export default { ...@@ -33,6 +33,7 @@ export default {
name: "name", name: "name",
type: "text", type: "text",
label: "参数名称", label: "参数名称",
fuzzy: true,
}, },
], ],
columns: [ columns: [
......
...@@ -35,6 +35,7 @@ export default { ...@@ -35,6 +35,7 @@ export default {
name: "name", name: "name",
type: "text", type: "text",
label: "资源名称", label: "资源名称",
fuzzy: true,
}, },
{ {
name: "authType", name: "authType",
......
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