Compare commits

...

1 Commits

Author SHA1 Message Date
sss28072637 0a3bfbd40d commit practice file 2022-07-07 09:57:42 +08:00
11 changed files with 23039 additions and 49 deletions
+22815 -31
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -5,7 +5,7 @@
"description": "Vue.js admin template",
"author": "smartapant <smartapant@gmail.com>",
"scripts": {
"serve": "vue-cli-service serve --mode development",
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"lint:style": "stylelint --fix src/**/*.{vue,htm,html,css,sss,less,scss}",
+2 -2
View File
@@ -47,9 +47,9 @@ localforage.config({ name: 'bioprovue' })
let MqttUrl
// for developer
if (process.env.NODE_ENV === 'development') {
MqttUrl = 'ws://192.168.5.240:8083'
MqttUrl = 'ws://192.168.5.47:8083'
} else {
// for user
// // for user
MqttUrl = `ws://${location.href.split('/')[2]}:8083`
}
+135
View File
@@ -0,0 +1,135 @@
<template>
<chart :ref="'chart_ref'" :style="'width: 100%; height: 150%;'" :options="data" :auto-resize="true"></chart>
</template>
<script>
// import { taskInfo } from '../../data/task/TaskInfo'
export default {
data () {
return {
deviceData: [],
data: {
tooltip: {
trigger: 'axis',
},
dataZoom: [
{
id: 'dataZoomX',
type: 'inside',
xAxisIndex: [0],
filterMode: 'none',
},
{
id: 'dataZoomY',
type: 'inside',
yAxisIndex: [0],
filterMode: 'none',
},
],
legend: {
type: 'plain',
},
axisPointer: {
link: { xAxisIndex: 'all' },
label: {
backgroundColor: '#777',
},
},
title: {
text: 'Data Chart',
top: 'bottom',
left: 'center',
textStyle: {
color: '#333',
fontSize: '20',
},
},
xAxis: {
type: 'category',
name: 'Time',
nameTextStyle: {
color: '#573',
fontStyle: 'italic',
fontWeight: 'bold',
},
axisLabel: {
formatter: function (val) {
val = parseInt(val) / 1e6
var min = Math.round(val / 60)
var sec = Math.round(val % 60)
return min.toString() + 'm' + sec.toString() + 's'
},
},
},
yAxis: {
type: 'value',
name: 'Value',
nameTextStyle: {
color: '#573',
fontStyle: 'italic',
fontWeight: 'bold',
},
axisLabel: {
formatter: function (val) {
val = parseInt(val) / 1e3
return val.toString() + '* 10^3'
},
},
},
grid: {
top: '10%',
bottom: '45%',
},
series: [
{
type: 'line',
showSymbol: false,
data: [],
itemStyle: {
normal: {
color: '#06C880',
},
},
},
],
},
}
},
methods: {
mqttSub: function (val) {
this.$mqtt.subscribe(val)
},
},
mounted () {
this.mqttSub('+/data_server/device_data_stream/+/+')
this.data.series[0].data = this.deviceData
},
mqtt: {
'+/+/device_data_stream/+/0' (data, topic) {
const _data = String.fromCharCode.apply(null, data)
var _dataInt = _data.split(' ')
_dataInt = _dataInt.map(Number)
// console.log(_dataInt)
const sizeOfList = _dataInt.length
const startTime = _dataInt[0]
const endTime = _dataInt[sizeOfList - 1]
const deltaTime = (endTime - startTime) / (sizeOfList - 2)
var timeStamp = startTime
for (let i = 1; i <= (sizeOfList - 2); i++) {
const elements = [timeStamp, _dataInt[i]]
this.deviceData.push(elements)
timeStamp += deltaTime
}
// console.log(this.deviceData[1][1])
// console.log(deltaTime)
},
},
destroyed () {
this.pageMqttUnSub('+/data_server/device_data_stream/+/+')
},
}
</script>
<style>
</style>
View File
@@ -204,6 +204,7 @@ export default {
},
// listen datastream [ topic: controllerID/data_server/device_data_stream/deviceID/channel ]
async '+/data_server/device_data_stream/+/+' (data, topic) {
console.log(topic, String.fromCharCode.apply(null, data))
const topicSplit = topic.split('/')
const deviceID = parseInt(topicSplit[3])
const channel = parseInt(topicSplit[4])
@@ -0,0 +1,27 @@
<template>
<chart :key="taskContentChartKey" :ref="'chart_ref'" :style="'width: '+ cardwidth + '; height: ' + cardheight + ';'" :options="data" :auto-resize="true"></chart>
</template>
<script>
export default {
data () {
return {
data: null,
tabValue: 0,
resizeTimer: null,
mappingSelect: '',
// mappingOptions: taskInfo.getMappingList(),
nameCard: '',
initDone: false,
timeIntervalInput: 'auto',
threeAxisIntervalInput: 'auto',
xIntervalInput: 'auto',
yIntervalInput: 'auto',
}
},
}
</script>
<style>
</style>
@@ -25,6 +25,7 @@
</va-tab>
</va-tabs>
<div v-if="tabValue == 0" >
<!-- {{ data }} -->
<div v-if="chartData[chartID].legend.data.length != 0">
<chart :key="taskContentChartKey" :ref="'chart_ref'" :style="'width: '+ cardwidth + '; height: ' + cardheight + ';'" :options="data" :auto-resize="true"></chart>
</div>
+1
View File
@@ -108,6 +108,7 @@ export const dataStreamBuffer = {
// pop the first batch data from datastream buffer
pop: (chartID, deviceID, channel) => {
console.log(_dataStreamBuffer)
if (_dataStreamBuffer[chartID] != null && _dataStreamBuffer[chartID][deviceID] != null &&
_dataStreamBuffer[chartID][deviceID][channel] != null && _dataStreamBuffer[chartID][deviceID][channel].length > 0) {
return _dataStreamBuffer[chartID][deviceID][channel].shift()
+5
View File
@@ -122,6 +122,11 @@ export default new Router({
path: 'task-content/:taskID?',
component: () => import('../components/task/content/TaskContent.vue'),
},
{
name: 'test',
path: 'test',
component: () => import('../components/dashboard/test.vue'),
},
// {
// name: 'task-content-g-m',
// path: 'task-content-g-m/',
+51 -15
View File
@@ -846,6 +846,16 @@
"exec-sh" "^0.3.2"
"minimist" "^1.2.0"
"@fontsource/source-code-pro@^4.5.0":
"integrity" "sha512-IKB+oQfwjj9DzEM2sc5rO70BZV7+ksmZbB+1KzyiZp2VroPw7Lm1ovXBU2JYWIWXmNY+gDudvyZXZHE+6cG47Q=="
"resolved" "https://registry.npmjs.org/@fontsource/source-code-pro/-/source-code-pro-4.5.0.tgz"
"version" "4.5.0"
"@fontsource/source-sans-pro@^4.5.1":
"integrity" "sha512-JYEldSfnqxoDVUL6QgqT8Fiyjh0p7WlKcqKNevzDylpWabdejVRyFzPhTk2ZceKZd02KEOaL+K462U6u0/PQiA=="
"resolved" "https://registry.npmjs.org/@fontsource/source-sans-pro/-/source-sans-pro-4.5.1.tgz"
"version" "4.5.1"
"@hapi/address@2.x.x":
"integrity" "sha512-QD1PhQk+s31P1ixsX0H0Suoupp3VMXzIVMSwobR3F3MSUO2YCV0B7xqLcUw/Bh8yuvd3LhpyqLQWTNcRmp6IdQ=="
"resolved" "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz"
@@ -5101,6 +5111,11 @@
"loader-utils" "^1.2.3"
"schema-utils" "^2.5.0"
"file-saver@^2.0.5":
"integrity" "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA=="
"resolved" "https://registry.npmjs.org/file-saver/-/file-saver-2.0.5.tgz"
"version" "2.0.5"
"file-uri-to-path@1.0.0":
"integrity" "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw=="
"resolved" "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz"
@@ -5385,19 +5400,6 @@
"resolved" "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
"version" "1.0.0"
"fsevents@^1.2.7":
"integrity" "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw=="
"resolved" "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz"
"version" "1.2.13"
dependencies:
"bindings" "^1.5.0"
"nan" "^2.12.1"
"fsevents@~2.1.2":
"integrity" "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ=="
"resolved" "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz"
"version" "2.1.3"
"fstream@^1.0.0", "fstream@^1.0.12":
"integrity" "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg=="
"resolved" "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz"
@@ -6049,6 +6051,11 @@
"resolved" "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz"
"version" "5.1.8"
"immediate@~3.0.5":
"integrity" "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps="
"resolved" "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz"
"version" "3.0.6"
"import-cwd@^2.0.0":
"integrity" "sha1-qmzzbnInYShcs3HsZRn1PiQ1sKk="
"resolved" "https://registry.npmjs.org/import-cwd/-/import-cwd-2.1.0.tgz"
@@ -7456,6 +7463,13 @@
"prelude-ls" "~1.1.2"
"type-check" "~0.3.2"
"lie@3.1.1":
"integrity" "sha1-mkNrLMd0bKWd56QfpGmz77dr2H4="
"resolved" "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz"
"version" "3.1.1"
dependencies:
"immediate" "~3.0.5"
"lines-and-columns@^1.1.6":
"integrity" "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA="
"resolved" "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz"
@@ -7588,6 +7602,13 @@
"emojis-list" "^3.0.0"
"json5" "^1.0.1"
"localforage@^1.10.0":
"integrity" "sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg=="
"resolved" "https://registry.npmjs.org/localforage/-/localforage-1.10.0.tgz"
"version" "1.10.0"
dependencies:
"lie" "3.1.1"
"locate-path@^2.0.0":
"integrity" "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4="
"resolved" "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz"
@@ -8248,7 +8269,7 @@
"object-assign" "^4.0.1"
"thenify-all" "^1.0.0"
"nan@^2.12.1", "nan@^2.13.2":
"nan@^2.13.2":
"integrity" "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw=="
"resolved" "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz"
"version" "2.14.1"
@@ -8528,6 +8549,11 @@
"gauge" "~2.7.3"
"set-blocking" "~2.0.0"
"nprogress@^0.2.0":
"integrity" "sha1-y480xTIT2JVyP8urkH6UIq28r7E="
"resolved" "https://registry.npmjs.org/nprogress/-/nprogress-0.2.0.tgz"
"version" "0.2.0"
"nth-check@^1.0.2", "nth-check@~1.0.1":
"integrity" "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg=="
"resolved" "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz"
@@ -12299,6 +12325,11 @@
"esquery" "^1.0.1"
"lodash" "^4.17.15"
"vue-final-modal@^2.4.1":
"integrity" "sha512-tvkPaf94wzoANjNFNP8b40bXuCAk28jg0OkhRKL3oQ9VTTwhlX25gnWG5d2qyxLfnE2237E8ngwF3KNPf/bhrw=="
"resolved" "https://registry.npmjs.org/vue-final-modal/-/vue-final-modal-2.4.1.tgz"
"version" "2.4.1"
"vue-flatpickr-component@^8.0.0":
"integrity" "sha512-whrR+WM7fWyHW+1ZxCx7uVSuOlTeZXEMzhsgcILXGxIzQxr5uX5RlS5amLXdGGSSVf+zukrb6MvYit/uIkhk3Q=="
"resolved" "https://registry.npmjs.org/vue-flatpickr-component/-/vue-flatpickr-component-8.1.5.tgz"
@@ -12394,6 +12425,11 @@
"resolved" "https://registry.npmjs.org/vue-toasted/-/vue-toasted-1.1.28.tgz"
"version" "1.1.28"
"vue-toastification@^1.7.14":
"integrity" "sha512-khZR8t3NWZ/JJ2MZxXLbesHrRJ8AKa75PY5Zq8yMifF9x8lHq8ljYkC0d2PD9yahooygQB5tcFyRDkbbIPx8hw=="
"resolved" "https://registry.npmjs.org/vue-toastification/-/vue-toastification-1.7.14.tgz"
"version" "1.7.14"
"vue-worker@^1.2.1":
"integrity" "sha1-3q4UuYqdidqrsg5/xhkGQoSbbZM="
"resolved" "https://registry.npmjs.org/vue-worker/-/vue-worker-1.2.1.tgz"
@@ -12411,7 +12447,7 @@
"resolved" "https://registry.npmjs.org/vue-yandex-maps/-/vue-yandex-maps-0.9.0.tgz"
"version" "0.9.0"
"vue@^2.0", "vue@^2.0.0", "vue@^2.3.0", "vue@^2.4.0", "vue@^2.5.2", "vue@^2.6.10", "vue@^2.6.9", "vue@^2.x", "vue@>= 3.0.0", "vue@>=2", "vue@>=2.2.0", "vue@2.x":
"vue@^2.0", "vue@^2.0.0", "vue@^2.3.0", "vue@^2.4.0", "vue@^2.5.2", "vue@^2.6.10", "vue@^2.6.14", "vue@^2.6.9", "vue@^2.x", "vue@>= 3.0.0", "vue@>=2", "vue@>=2.2.0", "vue@2.x":
"integrity" "sha512-VfPwgcGABbGAue9+sfrD4PuwFar7gPb1yl1UK1MwXoQPAw0BKSqWfoYCT/ThFrdEVWoI51dBuyCoiNU9bZDZxQ=="
"resolved" "https://registry.npmjs.org/vue/-/vue-2.6.11.tgz"
"version" "2.6.11"