Commit 73d1c7cf authored by 李苏's avatar 李苏 💬

单组件自适应高度,其他调整

parent 95534740
...@@ -11,7 +11,6 @@ NProgress.configure({ showSpinner: false }) ...@@ -11,7 +11,6 @@ NProgress.configure({ showSpinner: false })
const whiteList = ['/login', '/auth-redirect', '/bind', '/register'] const whiteList = ['/login', '/auth-redirect', '/bind', '/register']
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
console.log(to,'route')
// console.log(store.state.user.token) // console.log(store.state.user.token)
// NProgress.start() // NProgress.start()
if (getToken()) { if (getToken()) {
......
...@@ -241,6 +241,7 @@ const permission = { ...@@ -241,6 +241,7 @@ const permission = {
const sidebarRoutes = filterAsyncRouter(sdata) const sidebarRoutes = filterAsyncRouter(sdata)
const rewriteRoutes = filterAsyncRouter(rdata, false, true) const rewriteRoutes = filterAsyncRouter(rdata, false, true)
const asyncRoutes = filterDynamicRoutes(dynamicRoutes); const asyncRoutes = filterDynamicRoutes(dynamicRoutes);
console.log(sidebarRoutes,'sidebarRoutes')
rewriteRoutes.push({ rewriteRoutes.push({
path: '*', path: '*',
redirect: '/404', redirect: '/404',
......
<template> <template>
<div class="min_full"> <div class="min_full" :style="{
height:full?'100vh':'calc(100vh - 84px)'
}" >
<ShowEcharts :app='this' v-if="showDialog==true&&DialogTitle!='播放控制'&&DialogTitle!='回放'" /> <ShowEcharts :app='this' v-if="showDialog==true&&DialogTitle!='播放控制'&&DialogTitle!='回放'" />
<Hf @bfsz='bfsz' :app='this' v-if="showDialog==true&&DialogTitle=='播放控制'" /> <Hf @bfsz='bfsz' :app='this' v-if="showDialog==true&&DialogTitle=='播放控制'" />
<ShowHf @bfsz='bfsz' :app='this' v-if="showDialog==true&&DialogTitle=='回放'" /> <ShowHf @bfsz='bfsz' :app='this' v-if="showDialog==true&&DialogTitle=='回放'" />
<div class="tool-bar search"> <div class="tool-bar search">
<!-- svg 工具栏--> <!-- svg 工具栏-->
<el-button icon="el-icon-video-play" @click='hf' size='mini' type="primary">回放</el-button> <!-- <el-button icon="el-icon-video-play" @click='hf' size='mini' type="primary">回放</el-button> -->
<span style="margin-left: 20px;">{{time}}</span> <span style="margin-left: 20px;line-height: 33px;">{{time}}</span>
</div> </div>
<div ref="svg" v-html="nowHtml" class="svgBody"> <div ref="svg" v-html="nowHtml" class="svgBody">
...@@ -16,32 +18,49 @@ ...@@ -16,32 +18,49 @@
<script> <script>
import { import {
realchartDown,apiLast realchartDown,
apiLast
} from './api.js' } from './api.js'
import ShowEcharts from './showEcharts.vue' import ShowEcharts from './showEcharts.vue'
import Hf from './hf.vue' import Hf from './hf.vue'
import ShowHf from './showHf.vue' import ShowHf from './showHf.vue'
/* WS 版本*/
import WebSocketClient from 'common/src/utils/ws/ws.js';
export default { export default {
components:{ components: {
ShowEcharts, ShowEcharts,
Hf, Hf,
ShowHf ShowHf
}, },
mounted() { mounted() {
this.timer01 = setInterval(() => { /* 自适应*/
this.time = new Date().Format("yyyy-MM-dd hh:mm:ss") this.$nextTick(()=>{
}, 1000) if($('#scrollPane')[0]){
this.timer02 = setInterval(() => { (this.full=false)
if(this.metrics.length>0){
this.apiLast()
}else{ }else{
console.log('dom未读取到数据') (this.full=true)
} }
})
this.timer01 = setInterval(() => {
this.time = new Date().Format("yyyy-MM-dd hh:mm:ss")
}, 1000) }, 1000)
// this.timer02 = setInterval(() => {
// if(this.metrics.length>0){
// this.apiLast()
// }else{
// console.log('dom未读取到数据')
// }
// }, 1000)
this.$nextTick(() => { this.$nextTick(() => {
const url = this.$route.meta.url const url = this.$route.meta.url
this.baseUrl = this.id = this.matchString(url)[0] this.baseUrl = this.id = this.matchString(url)[0]
this.getSvg() this.getSvg()
/* 新建ws通信 */
}) })
}, },
beforeDestroy() { beforeDestroy() {
...@@ -49,10 +68,11 @@ ...@@ -49,10 +68,11 @@
}, },
data() { data() {
return { return {
full:false,
/* 弹框相关*/ /* 弹框相关*/
DialogTitle:'', DialogTitle: '',
DialogWidth:'50vw', DialogWidth: '50vw',
showDialog:false, showDialog: false,
id: '', id: '',
baseUrl: '', baseUrl: '',
time: '', time: '',
...@@ -62,17 +82,23 @@ ...@@ -62,17 +82,23 @@
metrics: [], metrics: [],
metricName: {}, metricName: {},
/* 确定时获取最新的播放设置参数*/ /* 确定时获取最新的播放设置参数*/
bfszParams:{} bfszParams: {},
/* ws*/
wsclient: null
} }
}, },
beforeDestroy() {
this.wsclient.close()
}
,
methods: { methods: {
bfsz(bfsz){ bfsz(bfsz) {
this.bfszParams=bfsz this.bfszParams = bfsz
/* 获取后进行showHf的弹框*/ /* 获取后进行showHf的弹框*/
this.DialogWidth='60vw' this.DialogWidth = '60vw'
this.DialogTitle='回放' this.DialogTitle = '回放'
setTimeout(()=>{ setTimeout(() => {
this.showDialog=true this.showDialog = true
}) })
...@@ -110,8 +136,28 @@ ...@@ -110,8 +136,28 @@
// } // }
// }) // })
/* jq*/ /* ws 连接*/
$(this.$refs.svg).find('text[tagid]').each((i, item)=>{ this.wsclient = new WebSocketClient();
this.wsclient.on('open', () => {
this.wsclient.send('Hello Server!');
});
this.wsclient.on('message', (data) => {
let obj = JSON.parse(data)
let dataList = obj.data
// let dataMap = {}
dataList.forEach(item=>{
$(this.$refs.svg).find(`text[tagid=${item.code}]`).text(item.value||'null')
})
/* 赋值svg*/
});
this.wsclient.apiConnect({
bsid:'iot/tag/all'
});
$(this.$refs.svg).find('text[tagid]').each((i, item) => {
var sTitle = ""; var sTitle = "";
$(item).css("cursor", "pointer"); $(item).css("cursor", "pointer");
if ($(item).find("title").length > 0) { if ($(item).find("title").length > 0) {
...@@ -134,7 +180,7 @@ ...@@ -134,7 +180,7 @@
$(item).unbind().bind("click", (event) => { $(item).unbind().bind("click", (event) => {
event.preventDefault(); event.preventDefault();
// sconsole.log(sTitle) // sconsole.log(sTitle)
this.showEchart($(item).attr("tagid"),sTitle) this.showEchart($(item).attr("tagid"), sTitle)
// divElemen.show(); // divElemen.show();
// showChart(divElemen,'openlist',$(item).attr("tagid"),sTitle,$(item).attr("exp")); // showChart(divElemen,'openlist',$(item).attr("tagid"),sTitle,$(item).attr("exp"));
// this.apiLast() // this.apiLast()
...@@ -146,26 +192,26 @@ ...@@ -146,26 +192,26 @@
}) })
}, },
apiLast(){ apiLast() {
apiLast({ apiLast({
metrics:this.metrics metrics: this.metrics
}, this.id,new Date().getTime()).then(res=>{ }, this.id, new Date().getTime()).then(res => {
res.forEach(item=>{ res.forEach(item => {
$(this.$refs.svg).find(`text[tagid=${item.metric}]`).text(item.value) $(this.$refs.svg).find(`text[tagid=${item.metric}]`).text(item.value)
}) })
}) })
}, },
hf() { hf() {
this.DialogWidth='30vw' this.DialogWidth = '30vw'
this.DialogTitle='播放控制' this.DialogTitle = '播放控制'
this.showDialog=true this.showDialog = true
}, },
showEchart(tagid,title){ showEchart(tagid, title) {
this.now_tagid=tagid this.now_tagid = tagid
this.DialogWidth='70vw' this.DialogWidth = '70vw'
this.DialogTitle=title this.DialogTitle = title
this.showDialog=true this.showDialog = true
} }
} }
} }
...@@ -177,12 +223,10 @@ ...@@ -177,12 +223,10 @@
width: 100%; width: 100%;
overflow: auto; overflow: auto;
} }
</style> </style>
<style> <style>
#LOADING{ #LOADING {
display: none!important; display: none !important;
} }
</style> </style>
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
async mounted() { async mounted() {
this.$nextTick(()=>{ this.$nextTick(()=>{
/* 开始回放请求*/ /* 开始回放请求*/
/* bfszParams 的 start end 取药切割并且使用定时器进行多次请求然后时间戳满了之后需要自动关闭定时器*/
let params={ let params={
metrics:this.app.metrics, metrics:this.app.metrics,
...this.app.bfszParams ...this.app.bfszParams
......
<template> <template>
<div style=" height: calc(100vh - 84px);width: 100%;"> <div style=" height: calc(100vh - 84px);width: 100%;" :style="{
height:full?'100vh':'calc(100vh - 84px)'
}" >
<!-- 上半部分,占整个高度的一半 --> <!-- 上半部分,占整个高度的一半 -->
<div v-echartResize="()=>{ <div v-echartResize="()=>{
iotChart.resize(); iotChart.resize();
...@@ -31,6 +33,15 @@ ...@@ -31,6 +33,15 @@
mounted() { mounted() {
// 初始化echarts // 初始化echarts
this.$nextTick(() => { this.$nextTick(() => {
if($('#scrollPane')[0]){
(this.full=false)
}else{
(this.full=true)
}
this.iotChart = this.$echarts.init(this.$refs.iotChart, 'dark') this.iotChart = this.$echarts.init(this.$refs.iotChart, 'dark')
const url = this.$route.meta.url const url = this.$route.meta.url
...@@ -49,6 +60,7 @@ ...@@ -49,6 +60,7 @@
}, },
data() { data() {
return { return {
full:false,
timer: null, timer: null,
iotChart: null, iotChart: null,
id: '', id: '',
......
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