| | |
| | | const debug = true; |
| | | |
| | | let ip1 = 'http://47.100.191.150:9029/'; |
| | | let ws = `47.100.191.150:9030`; |
| | | // console.log(import.meta.env); |
| | | if (import.meta.env.VITE_DATA_MODE == 'jingan') { |
| | | ip1 = 'http://114.215.109.124:8805/'; |
| | | ws = `114.215.109.124:9030`; |
| | | } |
| | | |
| | | if (debug) { |
| | | ip1 = 'http://192.168.0.110:8084/'; |
| | | // ip1 = 'http://locahost:8084/'; |
| | | ws = `192.168.0.110:9030`; |
| | | } |
| | | |
| | | const $http = axios.create({ |
| | |
| | | ); |
| | | }); |
| | | |
| | | // const $http = { |
| | | // get(url) { |
| | | // const controller = new AbortController(); |
| | | // return { |
| | | // con: controller, |
| | | // resp: axiosInstance.get(url, { signal: controller.signal }) |
| | | // }; |
| | | // }, |
| | | // put(url, data) { |
| | | // const controller = new AbortController(); |
| | | // return { |
| | | // con: controller, |
| | | // resp: axiosInstance.put(url, data, { signal: controller.signal }) |
| | | // }; |
| | | // }, |
| | | // post(url, data) { |
| | | // const controller = new AbortController(); |
| | | // return { |
| | | // con: controller, |
| | | // resp: axiosInstance.post(url, data, { signal: controller.signal }) |
| | | // }; |
| | | // }, |
| | | // delete(url) { |
| | | // const controller = new AbortController(); |
| | | // return { |
| | | // con: controller, |
| | | // resp: axiosInstance.delete(url, { signal: controller.signal }) |
| | | // }; |
| | | // } |
| | | // }; |
| | | |
| | | function resToData(res) { |
| | | res.resp = res.resp.then((res) => res.data); |
| | | return res; |
| | | } |
| | | |
| | | export { $http, resToData }; |
| | | export { $http, resToData, ws }; |
| | |
| | | :factor="factorDatas.factor[factorType]" |
| | | @change="handleLegendTypeChange" |
| | | ></FactorLegend> |
| | | <SourceTrace></SourceTrace> |
| | | </el-row> |
| | | <el-row class="historical" justify="center"> |
| | | <HistoricalTrajectory |
| | |
| | | import { FactorDatas } from '@/model/FactorDatas'; |
| | | import TrendAnalysis from './component/TrendAnalysis.vue'; |
| | | import DataSheet from './component/DataSheet.vue'; |
| | | import SourceTrace from '@/views/sourcetrace/SourceTrace.vue'; |
| | | import { ElMessage } from 'element-plus'; |
| | | import { fetchHistoryData } from '@/utils/factor/data'; |
| | | import dataAnalysisApi from '@/api/dataAnalysisApi'; |
| | |
| | | import { useSceneStore } from '@/stores/scene'; |
| | | |
| | | export default { |
| | | components: { TrendAnalysis, DataSheet }, |
| | | components: { TrendAnalysis, DataSheet, SourceTrace }, |
| | | setup() { |
| | | // éå®åé¡µæ°æ®é为10000 |
| | | const { loading, fetchData } = useFetchData(10000); |
| | |
| | | class="m-t-2" |
| | | :factor="factorDatas.factor[factorType]" |
| | | ></FactorLegend> |
| | | <!-- <SourceTrace></SourceTrace> --> |
| | | </el-row> |
| | | <DashBoard class="dash-board" :factor-datas="factorDatas"></DashBoard> |
| | | <RealTimeTrend |
| | |
| | | import DashBoard from './component/DashBoard.vue'; |
| | | import RealTimeTrend from './component/RealTimeTrend.vue'; |
| | | import DeviceChange from './component/DeviceChange.vue'; |
| | | import SourceTrace from '@/views/sourcetrace/SourceTrace.vue'; |
| | | import { realTimeMapAnimation } from '@/utils/map/animation'; |
| | | import { |
| | | fetchHistoryData, |
| | |
| | | // const mapAnimation = new MapAnimation(); |
| | | |
| | | export default { |
| | | components: { DashBoard, RealTimeTrend, DeviceChange }, |
| | | components: { DashBoard, RealTimeTrend, DeviceChange, SourceTrace }, |
| | | setup() { |
| | | const { loading, fetchData } = useFetchData(10000); |
| | | return { loading, fetchData }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <BaseCard> |
| | | <template #content> |
| | | <div> |
| | | <el-input type="text" v-model="inputVal" /> |
| | | <button @click="handleSend">send</button> |
| | | <button @click="handleLink">link</button> |
| | | </div> |
| | | <div>ä¸å¡ç¶æä¸æ§</div> |
| | | <el-scrollbar ref="scrollbarRef" :height="height"> |
| | | <div ref="scrollContentRef"> |
| | | <div v-for="(item, index) in streams" :key="index"> |
| | | <el-text type="primary">[{{ item }}]: </el-text> |
| | | </div> |
| | | </div> |
| | | </el-scrollbar> |
| | | </template> |
| | | </BaseCard> |
| | | </template> |
| | | <script setup> |
| | | import { reactive, ref, onMounted, onUnmounted, inject } from 'vue'; |
| | | import { ws } from '@/api/index'; |
| | | |
| | | const height = `60vh`; |
| | | |
| | | const scrollContentRef = ref(); |
| | | const scrollbarRef = ref(); |
| | | |
| | | function scrollToBottom() { |
| | | const h1 = scrollContentRef.value.clientHeight + 100; |
| | | setTimeout(() => { |
| | | scrollbarRef.value.setScrollTop(h1); |
| | | }, 100); |
| | | } |
| | | |
| | | const streams = reactive([]); |
| | | |
| | | let socket; |
| | | |
| | | const inputVal = ref(''); |
| | | const handleSend = () => { |
| | | if (socket) { |
| | | socket.send(inputVal.value); |
| | | } |
| | | }; |
| | | |
| | | const handleLink = () => { |
| | | if (socket) { |
| | | socket.close(); |
| | | } |
| | | const url = 'ws://' + ws + '/ws'; |
| | | // socket = new WebSocket(`ws://192.168.0.138:8080/workstream`) |
| | | socket = new WebSocket(url); |
| | | // 䏿å¡å¨å»ºç«è¿æ¥ï¼åéæ¶æ¯å°æå¡å¨ |
| | | socket.onopen = () => { |
| | | console.log('connect: '); |
| | | }; |
| | | // æ¶å°æå¡å¨åéçæ¶æ¯ï¼eventå¤çæå¡å¨è¿åçæ°æ® |
| | | socket.onmessage = (event) => { |
| | | console.log('receive: ', event.data); |
| | | putWorkStream(event.data); |
| | | }; |
| | | // è¿æ¥æéä¿¡è¿ç¨ä¸åçé误 |
| | | socket.onerror = (event) => { |
| | | console.log('errror: ', event); |
| | | }; |
| | | // 䏿å¡å¨æå¼è¿æ¥ |
| | | socket.onclose = (event) => { |
| | | console.log('close: ', event.code); |
| | | }; |
| | | }; |
| | | |
| | | /** |
| | | * æ·»å 䏿¡å·¥ä½æµä¿¡æ¯ |
| | | * @param {*} data |
| | | */ |
| | | function putWorkStream(data) { |
| | | const obj = JSON.parse(data); |
| | | streams.push(obj); |
| | | scrollToBottom(); |
| | | } |
| | | </script> |