Compare commits
228 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8c53573857 | |||
| c8644f320a | |||
| 8b6348e77e | |||
| 48555dd793 | |||
| 02617bbb86 | |||
| e4a8f1e8d3 | |||
| 48ce6e6342 | |||
| 7f0564a3ca | |||
| aa9c8c21b7 | |||
| 0924c20e9e | |||
| a239223361 | |||
| 444663def3 | |||
| e0341356c8 | |||
| b56c753063 | |||
| 04741d8a77 | |||
| 3721e4a515 | |||
| 0afd9edd7b | |||
| 44d2ba6b41 | |||
| d567186240 | |||
| cbb81add56 | |||
| c8dded35f5 | |||
| d5dac7a9b3 | |||
| 1a183322ab | |||
| 7e401621c7 | |||
| 1485eba2b3 | |||
| e908f73857 | |||
| f587f2b689 | |||
| 12eb41fcad | |||
| 4a2b3f6a94 | |||
| 8e9dd79002 | |||
| ea2f9c6748 | |||
| 4af2178225 | |||
| cc451f53cc | |||
| 419b8e373f | |||
| ffd2b611d3 | |||
| e05fa1c26b | |||
| 98d431fac0 | |||
| c1fb4e3488 | |||
| 3239728b0d | |||
| 8941e827c1 | |||
| d2eb180381 | |||
| 01a55781dd | |||
| c2e8aaae06 | |||
| 594fc9da13 | |||
| 721bab177b | |||
| 6b7828a944 | |||
| c388474952 | |||
| 75db0a3c13 | |||
| 802d6f7d3a | |||
| 830e93d9d1 | |||
| 09c46a282b | |||
| 50693075f9 | |||
| 9d22f80c0e | |||
| 41a7991255 | |||
| 623ff914bf | |||
| 99dc8d7996 | |||
| e30416e910 | |||
| 72a9ded776 | |||
| dfbbcdedf1 | |||
| 1bcbfa953d | |||
| 282e435217 | |||
| 23d45cfa2f | |||
| da4049bf77 | |||
| 73ccc68220 | |||
| 25f36a54dd | |||
| 0bfba093fd | |||
| 5e0b14c8e0 | |||
| df6e05c8c0 | |||
| 36c72e27a6 | |||
| a141535fc9 | |||
| 50a2254d44 | |||
| 3aaefa6529 | |||
| 74d8fdb077 | |||
| 5b655b2cd0 | |||
| 8e7f0ecb71 | |||
| c8aae625e5 | |||
| a1bb7517f7 | |||
| fc65108051 | |||
| ff0be97176 | |||
| 6cdd0f772e | |||
| b61f51cab2 | |||
| b00649f03e | |||
| 755525dc28 | |||
| 91929c0a34 | |||
| 389040a98a | |||
| 2908f2c510 | |||
| 08c732ace8 | |||
| 73fbaf92ab | |||
| 80d8bdf7f9 | |||
| 40c09de1dd | |||
| 1541a57b1b | |||
| 2f5ef791e4 | |||
| cc64f62335 | |||
| 66c19ab51b | |||
| fa7b51143b | |||
| 7c300a4ce2 | |||
| e6a9a3fbd6 | |||
| f523c189dc | |||
| bc86b2f541 | |||
| 5ea023df43 | |||
| ebf912a971 | |||
| d440dfbe39 | |||
| 8257a30118 | |||
| 68cec7d482 | |||
| e61d4340a7 | |||
| 810e8c46e9 | |||
| 1c32850990 | |||
| 21bb7440f1 | |||
| 505a2a9e03 | |||
| f6a6c4101d | |||
| c4fc506f9f | |||
| 3a8315339a | |||
| 08b3904cb9 | |||
| b2ba658e6e | |||
| 76a16cae1a | |||
| 04d564afd8 | |||
| 9c42c05621 | |||
| 42925bec2d | |||
| 5be30fc910 | |||
| c26a72749e | |||
| ca41619338 | |||
| 4e119b5eaf | |||
| 468c5a2567 | |||
| 70651f55c0 | |||
| 02aff9f02c | |||
| c1dbf93d65 | |||
| 6effc08904 | |||
| f237efc430 | |||
| ab15129100 | |||
| 38f440ea67 | |||
| 6c9fb2e513 | |||
| 92e8c15308 | |||
| 7c6a05ecc4 | |||
| f63fca5fc4 | |||
| b59262643f | |||
| 2650ba10fb | |||
| 578578a312 | |||
| 6e700e7201 | |||
| 99ef7bfe04 | |||
| 0d88866001 | |||
| 0150eebb0c | |||
| f885812258 | |||
| 21f5c75836 | |||
| bf20a50107 | |||
| d72e59bb81 | |||
| 69058bd0f0 | |||
| 6639560dd4 | |||
| 3ed4253b13 | |||
| c6555cb4f3 | |||
| 62d4b634c2 | |||
| a8e2ec509e | |||
| 5c35bff99f | |||
| 2e76071ea6 | |||
| ce9cac1f02 | |||
| feb9c84488 | |||
| ac0aef6109 | |||
| 1b424bcfd2 | |||
| 05b33bd9bf | |||
| 62424e3438 | |||
| 16799a85bd | |||
| 7f295cc86e | |||
| 5651cb68a5 | |||
| 80e1841776 | |||
| af337bdde6 | |||
| 9e59da8fd1 | |||
| df2815eb0e | |||
| 70750de23d | |||
| 89f45520d3 | |||
| 8b08cd899b | |||
| e808352244 | |||
| 4e777fff1b | |||
| 3e9db25dad | |||
| 033088ddde | |||
| 47712e5ff1 | |||
| 5e883ef672 | |||
| a7591860cf | |||
| 68510b3c42 | |||
| 1f102c3816 | |||
| 1b1ee5f58a | |||
| a20f24c45f | |||
| e29e0caee6 | |||
| 715f1ef1d0 | |||
| 537b668d1e | |||
| a658203c0a | |||
| 63e00b91f6 | |||
| cc7e2adc81 | |||
| 98738bcb10 | |||
| e34605c488 | |||
| 887ebc0907 | |||
| 91e4acbcb0 | |||
| 4bb59d5c87 | |||
| ed3d8a81ff | |||
| 87c9cba03c | |||
| 1a08d7ff28 | |||
| 641b001b88 | |||
| aeb265b206 | |||
| 932b8c8025 | |||
| f040150ac3 | |||
| 956f84476f | |||
| c028d14ade | |||
| 5108c7ffd9 | |||
| 33f78b0f83 | |||
| c12ded4834 | |||
| ad3553a68e | |||
| 6608ee9e86 | |||
| 2388e82c5d | |||
| 72d87712b3 | |||
| 2e1c3237f4 | |||
| dec21dfee0 | |||
| 7bde032cf6 | |||
| f83ad1efbf | |||
| b04d9ff29e | |||
| 86e3cee7ec | |||
| 6a96620549 | |||
| 1d5813c8fa | |||
| b717bf8906 | |||
| de8fbc9bbe | |||
| 403be30139 | |||
| f88e28616e | |||
| a102567dea | |||
| 46017134d8 | |||
| e2298a6ccc | |||
| 5a61e24495 | |||
| c4007b7930 | |||
| 2fe1cd6e00 | |||
| 4cc7b9e12f | |||
| 8b4f210f95 | |||
| 0fda2141dd |
Generated
+20
@@ -1168,6 +1168,16 @@
|
||||
"minimist": "^1.2.0"
|
||||
}
|
||||
},
|
||||
"@fontsource/source-code-pro": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource/source-code-pro/-/source-code-pro-4.5.0.tgz",
|
||||
"integrity": "sha512-IKB+oQfwjj9DzEM2sc5rO70BZV7+ksmZbB+1KzyiZp2VroPw7Lm1ovXBU2JYWIWXmNY+gDudvyZXZHE+6cG47Q=="
|
||||
},
|
||||
"@fontsource/source-sans-pro": {
|
||||
"version": "4.5.1",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource/source-sans-pro/-/source-sans-pro-4.5.1.tgz",
|
||||
"integrity": "sha512-JYEldSfnqxoDVUL6QgqT8Fiyjh0p7WlKcqKNevzDylpWabdejVRyFzPhTk2ZceKZd02KEOaL+K462U6u0/PQiA=="
|
||||
},
|
||||
"@hapi/address": {
|
||||
"version": "2.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz",
|
||||
@@ -7536,6 +7546,11 @@
|
||||
"schema-utils": "^2.5.0"
|
||||
}
|
||||
},
|
||||
"file-saver": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/file-saver/-/file-saver-2.0.5.tgz",
|
||||
"integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA=="
|
||||
},
|
||||
"file-uri-to-path": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
|
||||
@@ -17255,6 +17270,11 @@
|
||||
"resolved": "https://registry.npmjs.org/vue-toasted/-/vue-toasted-1.1.28.tgz",
|
||||
"integrity": "sha512-UUzr5LX51UbbiROSGZ49GOgSzFxaMHK6L00JV8fir/CYNJCpIIvNZ5YmS4Qc8Y2+Z/4VVYRpeQL2UO0G800Raw=="
|
||||
},
|
||||
"vue-toastification": {
|
||||
"version": "1.7.14",
|
||||
"resolved": "https://registry.npmjs.org/vue-toastification/-/vue-toastification-1.7.14.tgz",
|
||||
"integrity": "sha512-khZR8t3NWZ/JJ2MZxXLbesHrRJ8AKa75PY5Zq8yMifF9x8lHq8ljYkC0d2PD9yahooygQB5tcFyRDkbbIPx8hw=="
|
||||
},
|
||||
"vue-worker": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/vue-worker/-/vue-worker-1.2.1.tgz",
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
"test:unit": "vue-cli-service test:unit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fontsource/source-code-pro": "^4.5.0",
|
||||
"@fontsource/source-sans-pro": "^4.5.1",
|
||||
"@types/jest": "^24.0.11",
|
||||
"amcharts3": "^3.21.14",
|
||||
"ammap3": "^3.21.14",
|
||||
@@ -27,6 +29,7 @@
|
||||
"element-resize-detector": "^1.1.15",
|
||||
"epic-spinners": "^1.1.0",
|
||||
"extend": "3.0.2",
|
||||
"file-saver": "^2.0.5",
|
||||
"flag-icon-css": "^3.4.5",
|
||||
"font-awesome": "^4.7.0",
|
||||
"google-maps": "^3.3.0",
|
||||
@@ -55,6 +58,7 @@
|
||||
"vue-mqtt": "^2.0.3",
|
||||
"vue-router": "^3.1.3",
|
||||
"vue-slicksort": "^1.2.0",
|
||||
"vue-toastification": "^1.7.14",
|
||||
"vue-worker": "^1.2.1",
|
||||
"vue-yandex-maps": "^0.9.0",
|
||||
"vuedraggable": "^2.24.3",
|
||||
|
||||
Binary file not shown.
@@ -3,9 +3,6 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:400" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
|
||||
<title>BioPro Scientific</title>
|
||||
|
||||
+6
-2
@@ -33,6 +33,9 @@ import axios from 'axios'
|
||||
import VueAxios from 'vue-axios'
|
||||
import 'nprogress/nprogress.css'
|
||||
|
||||
import Toast from 'vue-toastification'
|
||||
import 'vue-toastification/dist/index.css'
|
||||
|
||||
import '../metrics'
|
||||
import '../registerServiceWorker'
|
||||
|
||||
@@ -52,11 +55,12 @@ Vue.use(VueClipboard)
|
||||
Vue.component('chart', ECharts)
|
||||
Vue.use(VueWorker)
|
||||
Vue.use(VueAxios, axios)
|
||||
Vue.use(Toast)
|
||||
|
||||
// Vue.use(VueMqtt, 'ws://52.194.17.114:8083')
|
||||
// Vue.use(VueMqtt, 'ws://' + location.href.split('/')[2] + ':8083')
|
||||
Vue.use(VueMqtt, 'ws://' + location.href.split('/')[2] + ':8083')
|
||||
// Vue.use(VueMqtt, 'ws://' + '192.168.151.125' + ':8083')
|
||||
Vue.use(VueMqtt, 'ws://' + '192.168.151.125' + ':8083')
|
||||
// Vue.use(VueMqtt, 'ws://' + '192.168.3.211' + ':8083')
|
||||
|
||||
Vue.prototype.GLOBAL = global_
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="sd-card" class="svg-inline--fa fa-sd-card fa-w-12" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="#6c7fee" d="M320 0H128L0 128v320c0 35.3 28.7 64 64 64h256c35.3 0 64-28.7 64-64V64c0-35.3-28.7-64-64-64zM160 160h-48V64h48v96zm80 0h-48V64h48v96zm80 0h-48V64h48v96z"></path></svg>
|
||||
|
After Width: | Height: | Size: 380 B |
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 234 KiB |
@@ -44,15 +44,6 @@
|
||||
contact@bioproweb.com
|
||||
</a>
|
||||
</span>
|
||||
<!-- <va-button
|
||||
href="https://github.com/epicmaxco/vuestic-admin"
|
||||
color="#000000"
|
||||
class="app-navbar__button"
|
||||
icon="fa fa-github"
|
||||
target="_blank"
|
||||
>
|
||||
{{$t('navbar.repository')}}
|
||||
</va-button> -->
|
||||
</div>
|
||||
<app-navbar-actions
|
||||
class="app-navbar__actions md5 lg4"
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
<template>
|
||||
<div class="app-navbar-actions">
|
||||
<!-- <color-dropdown class="app-navbar-actions__item"/> -->
|
||||
<!-- <message-dropdown class="app-navbar-actions__item"/>
|
||||
<notification-dropdown class="app-navbar-actions__item"/> -->
|
||||
<!-- <settings-dropdown
|
||||
<!-- <color-dropdown class="app-navbar-actions__item"/>
|
||||
<message-dropdown class="app-navbar-actions__item"/>
|
||||
<notification-dropdown class="app-navbar-actions__item"/>
|
||||
<settings-dropdown
|
||||
:is-top-bar.sync="isTopBarProxy"
|
||||
class="app-navbar-actions__item"
|
||||
/> -->
|
||||
<!-- <language-dropdown class="app-navbar-actions__item"/> -->
|
||||
/>
|
||||
<language-dropdown class="app-navbar-actions__item"/> -->
|
||||
<license-check-button :ref="'license_check_button_ref'" @updateLicense="updateLicense"/>
|
||||
<license-update-modal :title="'Update'" :ref="'license_update_modal_ref'" @refresh="refresh"/>
|
||||
<profile-dropdown class="app-navbar-actions__item app-navbar-actions__item--profile">
|
||||
<span>{{userName}}</span>
|
||||
</profile-dropdown>
|
||||
@@ -16,11 +18,13 @@
|
||||
|
||||
<script>
|
||||
// import LanguageDropdown from './dropdowns/LanguageDropdown'
|
||||
import ProfileDropdown from './dropdowns/ProfileDropdown'
|
||||
// import NotificationDropdown from './dropdowns/NotificationDropdown'
|
||||
// import MessageDropdown from './dropdowns/MessageDropdown'
|
||||
// import ColorDropdown from './dropdowns/ColorDropdown'
|
||||
// import SettingsDropdown from './dropdowns/SettingsDropdown'
|
||||
import ProfileDropdown from './dropdowns/ProfileDropdown'
|
||||
import LicenseUpdateModal from './modals/LicenseUpdateModal'
|
||||
import LicenseCheckButton from './buttons/LicenseCheckButton'
|
||||
import { ColorThemeMixin } from '../../../../services/vuestic-ui'
|
||||
|
||||
export default {
|
||||
@@ -33,6 +37,8 @@ export default {
|
||||
// MessageDropdown,
|
||||
// NotificationDropdown,
|
||||
// LanguageDropdown,
|
||||
LicenseCheckButton,
|
||||
LicenseUpdateModal,
|
||||
ProfileDropdown,
|
||||
},
|
||||
props: {
|
||||
@@ -55,6 +61,16 @@ export default {
|
||||
},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
updateLicense () {
|
||||
this.$refs.license_update_modal_ref.show()
|
||||
this.$refs.license_update_modal_ref.licenseUpdate()
|
||||
},
|
||||
refresh () {
|
||||
this.$refs.license_check_button_ref.refresh()
|
||||
this.$refs.license_update_modal_ref.hide()
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
<template>
|
||||
<div v-if="!licenseCheck">
|
||||
<va-button color="warning" class="mb-2" @click="licenseUpdateModalShow" small>
|
||||
Update
|
||||
</va-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import api from '@/data/api/index'
|
||||
import { mapFields } from 'vuex-map-fields'
|
||||
|
||||
export default {
|
||||
name: 'license-check-button',
|
||||
components: {
|
||||
},
|
||||
computed: {
|
||||
...mapFields('', [
|
||||
'licenseCheck',
|
||||
]),
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
popoverShow: true,
|
||||
licenseCheckObj: {
|
||||
pass: true,
|
||||
outdated: false,
|
||||
fail: false,
|
||||
},
|
||||
authText: {
|
||||
outdated: 'New version released. Update by pressing the button above.',
|
||||
fail: 'System file is missing, contact us by following as: contact@bioproweb.com.',
|
||||
},
|
||||
toastOptions: {
|
||||
theme: 'none',
|
||||
position: 'bottom-center',
|
||||
className: 'vuestic-toast',
|
||||
iconPack: 'fontawesome',
|
||||
duration: 2500,
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
licenseUpdateModalShow () {
|
||||
this.$emit('updateLicense')
|
||||
},
|
||||
showNotify (licenseCheckResponse) {
|
||||
this.$toast(this.authText[licenseCheckResponse], {
|
||||
closeButtonClassName: 'my-button-class',
|
||||
containerClassName: 'my-container-class',
|
||||
toastClassName: 'my-custom-toast-class',
|
||||
timeout: false,
|
||||
icon: 'fa fa-exclamation',
|
||||
})
|
||||
},
|
||||
closeNotify () {
|
||||
this.$toast.clear()
|
||||
},
|
||||
async refresh () {
|
||||
this.closeNotify()
|
||||
const licenseCheckResponse = await api.auth.licenseCheck()
|
||||
this.licenseCheck = this.licenseCheckObj[licenseCheckResponse.data]
|
||||
if (this.licenseCheck === false) {
|
||||
this.showNotify(licenseCheckResponse.data)
|
||||
}
|
||||
},
|
||||
},
|
||||
async mounted () {
|
||||
await this.refresh()
|
||||
},
|
||||
destroyed () {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.Vue-Toastification__toast--default.my-custom-toast-class {
|
||||
background-color: rgba(255, 214, 82, 1);
|
||||
color: black;
|
||||
}
|
||||
|
||||
.Vue-Toastification__container.top-right {
|
||||
top: 3rem !important;
|
||||
}
|
||||
|
||||
.my-button-class {
|
||||
opacity: 1 !important;
|
||||
color: black !important;
|
||||
}
|
||||
|
||||
.custom-toast {
|
||||
background-color: rgba(255, 214, 82, 1) !important;
|
||||
transform: translateX(50px) translateY(-75px) !important;
|
||||
color: black !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,74 @@
|
||||
<template>
|
||||
<va-modal
|
||||
class="flex sm12 xl12 md12 xs12"
|
||||
v-model="showModal"
|
||||
:title="title"
|
||||
noOutsideDismiss
|
||||
hideDefaultActions
|
||||
>
|
||||
<div v-if="loading" class="row flex sm12 xl12 md12 xs12">
|
||||
<div class="flex-center spinner-box mt-4 mb-5">
|
||||
<fulfilling-bouncing-circle-spinner
|
||||
:animation-duration="3000"
|
||||
:color="'#6c7fee'"
|
||||
:size="60"
|
||||
>
|
||||
</fulfilling-bouncing-circle-spinner>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="row flex sm12 xl12 md12 xs12">
|
||||
{{ modalMessage }}
|
||||
<div class="row flex-center sm12 xl12 md12 xs12 mt-2">
|
||||
<va-button small @click="hide">close</va-button>
|
||||
</div>
|
||||
</div>
|
||||
</va-modal>
|
||||
</template>
|
||||
<script>
|
||||
import api from '@/data/api/index'
|
||||
import { FulfillingBouncingCircleSpinner } from 'epic-spinners'
|
||||
|
||||
export default {
|
||||
name: 'license-check-modal',
|
||||
components: {
|
||||
FulfillingBouncingCircleSpinner,
|
||||
},
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
showModal: false,
|
||||
hideDefaultActions: false,
|
||||
loading: true,
|
||||
modalMessage: '',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
show () {
|
||||
this.showModal = true
|
||||
},
|
||||
hide () {
|
||||
this.showModal = false
|
||||
},
|
||||
async licenseUpdate () {
|
||||
this.hideDefaultActions = true
|
||||
this.loading = true
|
||||
const updateResponse = await api.auth.licenseUpdate()
|
||||
console.log('updateResponse', updateResponse)
|
||||
setTimeout(() => {
|
||||
if (updateResponse.status === 200) {
|
||||
this.loading = false
|
||||
this.$emit('refresh')
|
||||
} else if (updateResponse.status === 202 || updateResponse.status === 203) {
|
||||
this.loading = false
|
||||
this.modalMessage = 'An unknown error occurred while updating, please contact us by following as: contact@bioproweb.com'
|
||||
}
|
||||
}, 5000)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -40,6 +40,13 @@ export const navigationRoutes = {
|
||||
// },
|
||||
// ],
|
||||
},
|
||||
// {
|
||||
// name: 'task-content-g-m',
|
||||
// displayName: 'Gimer',
|
||||
// meta: {
|
||||
// iconClass: 'vuestic-iconset vuestic-iconset-statistics',
|
||||
// },
|
||||
// },
|
||||
{
|
||||
name: 'file',
|
||||
displayName: 'File',
|
||||
|
||||
@@ -11,12 +11,26 @@
|
||||
:to="to"
|
||||
:target="target"
|
||||
>
|
||||
<va-icon
|
||||
v-if="icon"
|
||||
class="app-sidebar-link__item-icon"
|
||||
:style="computedIconStyles"
|
||||
:name="icon"
|
||||
/>
|
||||
<template v-if="title == 'Gimer'">
|
||||
<img
|
||||
v-if="this.isHovered || this.isActive"
|
||||
class="app-sidebar-link__item-icon"
|
||||
src="@/assets/img/gimer_white.png"
|
||||
>
|
||||
<img
|
||||
v-else
|
||||
class="app-sidebar-link__item-icon"
|
||||
src="@/assets/img/gimer_gray.png"
|
||||
>
|
||||
</template>
|
||||
<template v-else>
|
||||
<va-icon
|
||||
v-if="icon"
|
||||
class="app-sidebar-link__item-icon"
|
||||
:style="computedIconStyles"
|
||||
:name="icon"
|
||||
/>
|
||||
</template>
|
||||
<div class="app-sidebar-link__item-title" v-if="title">
|
||||
<slot>
|
||||
{{title}}
|
||||
@@ -140,6 +154,21 @@ export default {
|
||||
color: 'white',
|
||||
}
|
||||
},
|
||||
computedGimerIcon () {
|
||||
if (this.contextConfig.invertedColor) {
|
||||
if (this.isHovered || this.isActive) {
|
||||
return 'gimer_white.png'
|
||||
}
|
||||
|
||||
return 'gimer_gray.png'
|
||||
}
|
||||
|
||||
if (this.isHovered || this.isActive) {
|
||||
return 'gimer_white.png'
|
||||
}
|
||||
|
||||
return 'gimer_white.png'
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
updateHoverState (isHovered) {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<span slot="header">Control Panel</span>
|
||||
<div slot="body">
|
||||
<div>
|
||||
<top-control-panel :ref="'top_control_panel'" @refreshChart="setOption" @changeAxis="changeAxis"/>
|
||||
<top-control-panel :ref="'top_control_panel'" @refreshChart="setOption" @changeAxis="changeAxis" @changeOverviewDataZoom="changeOverviewDataZoom"/>
|
||||
</div>
|
||||
</div>
|
||||
</va-collapse>
|
||||
@@ -51,14 +51,27 @@ export default {
|
||||
ChangeChannelValueMinMax,
|
||||
},
|
||||
computed: {
|
||||
displayType () {
|
||||
return {
|
||||
x: this.axisXLabelScale.description === 'Log' ? 'log' : 'value',
|
||||
y: this.axisYLabelScale.description === 'Log' ? 'log' : 'value',
|
||||
}
|
||||
},
|
||||
|
||||
...mapFields('replay', [
|
||||
'metaList',
|
||||
'chartData',
|
||||
'chartOverviewData',
|
||||
'chartDetailData',
|
||||
'currentScale',
|
||||
'startTime',
|
||||
'endTime',
|
||||
'windowLength',
|
||||
'axisXDataType',
|
||||
'axisYDataType',
|
||||
'axisXLabelScale',
|
||||
'axisYLabelScale',
|
||||
'absToggleStatus',
|
||||
'startTimeCurrent',
|
||||
'endTimeCurrent',
|
||||
'sampleMethod',
|
||||
@@ -90,8 +103,6 @@ export default {
|
||||
detailchartheight: '88vh',
|
||||
dataInfo: {},
|
||||
maxTime: 0,
|
||||
startTime: 0,
|
||||
endTime: 0,
|
||||
zoomTime: 0,
|
||||
initDone: false,
|
||||
chartAreaClass: ['flex', 'xs12', 'sm12', 'md12', 'xl9', 'pa-0'],
|
||||
@@ -220,21 +231,32 @@ export default {
|
||||
e.batch.forEach(dataZoom => {
|
||||
const id = parseInt(dataZoom.dataZoomId.substr(dataZoom.dataZoomId.length - 3, dataZoom.dataZoomId.length - 1))
|
||||
if (id === 1) {
|
||||
this.startTime = this.maxTime * dataZoom.start / 100
|
||||
this.endTime = this.maxTime * dataZoom.end / 100
|
||||
this.startTime = parseInt(this.maxTime * dataZoom.start / 100)
|
||||
this.endTime = parseInt(this.maxTime * dataZoom.end / 100)
|
||||
this.windowLength = this.endTime - this.startTime
|
||||
this.chartOverviewData.dataZoom[0].start = dataZoom.start
|
||||
this.chartOverviewData.dataZoom[0].end = dataZoom.end
|
||||
// console.log(this.startTime, this.endTime)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
const id = parseInt(e.dataZoomId.substr(e.dataZoomId.length - 3, e.dataZoomId.length - 1))
|
||||
if (id === 0) {
|
||||
this.startTime = this.maxTime * e.start / 100
|
||||
this.endTime = this.maxTime * e.end / 100
|
||||
this.startTime = parseInt(this.maxTime * e.start / 100)
|
||||
this.endTime = parseInt(this.maxTime * e.end / 100)
|
||||
this.windowLength = this.endTime - this.startTime
|
||||
this.chartOverviewData.dataZoom[0].start = e.start
|
||||
this.chartOverviewData.dataZoom[0].end = e.end
|
||||
// console.log(this.startTime, this.endTime)
|
||||
}
|
||||
}
|
||||
this.zoomTime = 0
|
||||
},
|
||||
changeOverviewDataZoom () {
|
||||
this.chartOverviewData.dataZoom[0].start = this.startTime * 100 / this.maxTime
|
||||
this.chartOverviewData.dataZoom[0].end = this.endTime * 100 / this.maxTime
|
||||
this.$refs.chart_overview.mergeOptions(this.chartOverviewData)
|
||||
},
|
||||
async computeResampleScale (meta, duration) {
|
||||
const sampleRate = meta.parameter_set.SAMPLE_RATE / 10
|
||||
const dataPointNum = (parseInt(duration) / 1e6) * sampleRate // us -> s: /1e6
|
||||
@@ -313,6 +335,7 @@ export default {
|
||||
// push downloaded data to chart series
|
||||
let seriesIndex = 0
|
||||
for (const ch in this.dataInfo[meta]) {
|
||||
this.chartOverviewData.series[seriesIndex].data.length = 0
|
||||
const dataList = this.dataInfo[meta][ch][scale]
|
||||
for (let i = 0; i < dataList.length; i++) {
|
||||
this.chartOverviewData.series[seriesIndex].data.push(...dataList[i].data)
|
||||
@@ -345,6 +368,12 @@ export default {
|
||||
this.updateChartSamplingChart({ chartID: this.chartDetailData.chartID, seriesIndex: _gridNumber, method: 'lttb' })
|
||||
}
|
||||
|
||||
if (metaInfo.device.library_name === 'EliteEIS' && metaInfo.parameter_set.MODE === 0) {
|
||||
this.chartDetailData.series[this.chartDetailData.series.length - 1].showSymbol = true
|
||||
this.chartDetailData.series[this.chartDetailData.series.length - 1].showAllSymbol = true
|
||||
this.chartDetailData.series[this.chartDetailData.series.length - 1].symbolSize = 6
|
||||
}
|
||||
|
||||
this.currentScale = scale
|
||||
this.chartDetailData.series[_gridNumber].data.length = 0
|
||||
let dataListX
|
||||
@@ -356,9 +385,9 @@ export default {
|
||||
const dataListY = this.dataInfo[meta][channelY][scale]
|
||||
|
||||
const isThisModeHasCycle = this.GLOBAL.hasCycleMode(metaInfo.parameter_set.MODE, metaInfo.device.library_name)
|
||||
let startTime
|
||||
let endTime
|
||||
if (isThisModeHasCycle === true && this.axisXDataType.description !== 'Time') { // if有cycle的mode且目前x軸不為時間,抓出第一圈所在的時間段,初始化時先畫第一圈就好,加快初始時間
|
||||
let _startTime
|
||||
let _endTime
|
||||
if (isThisModeHasCycle === true) {
|
||||
const cycleDataID = 3 // recorded cycle 所在的channel index
|
||||
const dataCycleList = this.dataInfo[meta][cycleDataID][this.currentScale]
|
||||
const cycleDataList = []
|
||||
@@ -371,21 +400,21 @@ export default {
|
||||
}
|
||||
}
|
||||
const cycleDict = this.getCycleDictRec()(cycleDataList)
|
||||
startTime = cycleDict[1][0] // [1]: 第一圈
|
||||
endTime = cycleDict[1][1] // [1]: 第一圈
|
||||
_startTime = cycleDict[1][0] // [1]: 第一圈
|
||||
_endTime = cycleDict[1][1] // [1]: 第一圈
|
||||
} else {
|
||||
startTime = this.startTimeCurrent
|
||||
endTime = this.endTimeCurrent
|
||||
_startTime = this.startTimeCurrent
|
||||
_endTime = this.endTimeCurrent
|
||||
}
|
||||
|
||||
let startIndex = 0
|
||||
let endIndex = 0
|
||||
// get the subfile index
|
||||
for (let i = 0; i < dataListY.length; i++) {
|
||||
if (startTime >= parseInt(dataListY[i].start_time) && startTime <= parseInt(dataListY[i].end_time)) {
|
||||
if (_startTime >= parseInt(dataListY[i].start_time) && _startTime <= parseInt(dataListY[i].end_time)) {
|
||||
startIndex = i
|
||||
}
|
||||
if (endTime >= parseInt(dataListY[i].start_time) && endTime <= parseInt(dataListY[i].end_time)) {
|
||||
if (_endTime >= parseInt(dataListY[i].start_time) && _endTime <= parseInt(dataListY[i].end_time)) {
|
||||
endIndex = i
|
||||
}
|
||||
}
|
||||
@@ -398,20 +427,26 @@ export default {
|
||||
}
|
||||
for (let j = 0, len = data.length; j < len; j++) {
|
||||
// check which channel and push processed data (i.e. merge two channel data, now data is (time, value) format)
|
||||
if (parseInt(data[j][0]) >= startTime && parseInt(data[j][0]) <= endTime) {
|
||||
const processedData = JSON.parse(JSON.stringify(data[j]))
|
||||
if (parseInt(data[j][0]) >= _startTime && parseInt(data[j][0]) <= _endTime) {
|
||||
const processedData = data[j]
|
||||
if (dataX !== undefined) {
|
||||
processedData[0] = dataX[j][1]
|
||||
}
|
||||
// console.log(data)
|
||||
if (this.displayType.x === 'log' || this.absToggleStatus.x === true) {
|
||||
processedData[0] = Math.abs(processedData[0])
|
||||
}
|
||||
if (this.displayType.y === 'log' || this.absToggleStatus.y === true) {
|
||||
processedData[1] = Math.abs(processedData[1])
|
||||
}
|
||||
|
||||
this.chartDetailData.series[_gridNumber].data.push(processedData)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.axisXDataType.description === 'Time') {
|
||||
this.chartDetailData.xAxis[_gridNumber].min = this.startTimeCurrent
|
||||
this.chartDetailData.xAxis[_gridNumber].max = this.endTimeCurrent
|
||||
this.chartDetailData.xAxis[_gridNumber].min = _startTime
|
||||
this.chartDetailData.xAxis[_gridNumber].max = _endTime
|
||||
} else {
|
||||
this.chartDetailData.xAxis[_gridNumber].min = 'dataMin'
|
||||
this.chartDetailData.xAxis[_gridNumber].max = 'dataMax'
|
||||
@@ -430,6 +465,7 @@ export default {
|
||||
this.turnOffAxisEventHandler('click', this.showMinMaxPanel, { axis: 'x' })
|
||||
this.turnOnAxisEventHandler('click', 'yAxis.axisLabel', this.showMinMaxPanel, { axis: 'y' })
|
||||
}
|
||||
|
||||
this.hideChartLoading()
|
||||
},
|
||||
checkDataZoom: function () {
|
||||
@@ -439,7 +475,6 @@ export default {
|
||||
this.startTimeCurrent = this.startTime
|
||||
this.endTimeCurrent = this.endTime
|
||||
this.drawDetailData()
|
||||
this.$refs.top_control_panel.resetScale()
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -470,13 +505,16 @@ export default {
|
||||
channelY: this.axisYDataType.id + 1,
|
||||
})
|
||||
}
|
||||
if (this.axisXDataType.description === 'Time') {
|
||||
this.drawOverviewData()
|
||||
}
|
||||
this.drawDetailData() // reDraw
|
||||
},
|
||||
...mapActions('replay', [types.chart.init, types.chart.register, types.chart.clear, types.chart.updateGridList, types.chart.updateDataZoom]),
|
||||
...mapActions('replay', [types.chart.init, types.chart.register, types.chart.clear, types.chart.updateGridList, types.chart.updateDataZoom, types.chart.setAxisDisplay]),
|
||||
...mapActions('replay', [types.meta.init]),
|
||||
...mapActions('replay', [types.rec.init, types.rec.intoData, types.rec.initDisplaySetting, types.rec.updateDisplaySetting]),
|
||||
|
||||
...mapMutations('replay', [types.chart.updateRegistered, types.chart.updateAxisSplitNumber, types.chart.updateChartSampling]),
|
||||
...mapMutations('replay', [types.chart.updateRegistered, types.chart.updateAxisSplitNumber, types.chart.updateChartSampling, types.chart.setOverviewDataZoomStartAndEnd]),
|
||||
...mapMutations('replay', [types.meta.updateByIndex]),
|
||||
|
||||
...mapGetters('replay', [types.meta.getAll]),
|
||||
@@ -492,9 +530,9 @@ export default {
|
||||
console.log(this.metaList)
|
||||
console.log(this.dataInfo)
|
||||
await this.register()
|
||||
this.setOverviewDataZoomStartAndEndChart()
|
||||
this.$refs.top_control_panel.init() // will call changeAxis() here
|
||||
this.$refs.set_min_max.init()
|
||||
this.drawOverviewData()
|
||||
this.turnOnAxisEventHandler('click', 'yAxis.axisLabel', this.showMinMaxPanel, { axis: 'y' })
|
||||
this.updateAxisSplitNumberChart({ chartID: this.chartDetailData.chartID, axis: 'x' })
|
||||
this.updateAxisSplitNumberChart({ chartID: this.chartDetailData.chartID, axis: 'y' })
|
||||
@@ -513,6 +551,9 @@ export default {
|
||||
delete this.chartData[id]
|
||||
}
|
||||
this.clearChart({ chartAllData: this.chartData })
|
||||
this.startTime = 0
|
||||
this.endTime = 0
|
||||
this.windowLength = 0
|
||||
},
|
||||
destroyed () {
|
||||
clearInterval(this.dataZoomTimer)
|
||||
|
||||
@@ -54,6 +54,9 @@ export default {
|
||||
updateZoom: function (e) {
|
||||
this.$emit('dataZoomEvent', e)
|
||||
},
|
||||
mergeOptions (options) {
|
||||
this.$refs.chart_ref.mergeOptions(options)
|
||||
},
|
||||
showLoading (options) {
|
||||
this.$refs.chart_ref.showLoading(options)
|
||||
},
|
||||
|
||||
@@ -1,24 +1,71 @@
|
||||
<template>
|
||||
<div>
|
||||
<va-card>
|
||||
<div class="flex-container">
|
||||
<edit-file-name class="flex-child" :ref="'edit_file_name'"/>
|
||||
<download-file class="flex-child2"/>
|
||||
<delete-file class="flex-child2"/>
|
||||
<div class="flex-container mb-1">
|
||||
<div class="flex sm8 xl8 md8 xs8 px-0 py-0">
|
||||
<edit-file-name :ref="'edit_file_name'"/>
|
||||
</div>
|
||||
<div class="flex sm2 xl2 md2 xs2 px-0 py-0">
|
||||
<download-file style="float: right;" />
|
||||
</div>
|
||||
<div class="flex sm2 xl2 md2 xs2 px-0 py-0">
|
||||
<delete-file />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-container">
|
||||
<change-axis class="flex-child" :ref="'change_axis_x'" axis="x" @changeAxis="changeAxis" @changeUnit="changeUnit" @clearCycle="clearCycle" @resetScale="resetScale"/>
|
||||
<change-unit class="flex-child2" :ref="'change_unit_x'" axis="x" @refreshChart="refreshChart"/>
|
||||
<change-scale class="flex-child1" :ref="'change_scale_x'" axis="x" @refreshChart="refreshChart" @clearCycle="clearCycle"/>
|
||||
|
||||
<div class="flex-container mb-2">
|
||||
<div class="flex sm2 xl2 md2 xs2 px-0 py-0">
|
||||
<p class="display-6"> X-axis <p/>
|
||||
</div>
|
||||
<div class="flex sm5 xl5 md5 xs5 pl-1 pr-0 py-0">
|
||||
<change-axis :ref="'change_axis_x'" axis="x" @changeAxis="changeAxis" @changeUnit="changeUnit" @clearCycle="clearCycle"/>
|
||||
</div>
|
||||
<div class="flex sm5 xl5 md5 xs5 pl-1 pr-0 py-0">
|
||||
<change-unit :ref="'change_unit_x'" axis="x" @refreshChart="refreshChart"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-container">
|
||||
<change-axis class="flex-child" :ref="'change_axis_y'" axis="y" @changeAxis="changeAxis" @changeUnit="changeUnit" @clearCycle="clearCycle" @resetScale="resetScale"/>
|
||||
<change-unit class="flex-child2" :ref="'change_unit_y'" axis="y" @refreshChart="refreshChart"/>
|
||||
<change-scale class="flex-child1" :ref="'change_scale_y'" axis="y" @refreshChart="refreshChart" @clearCycle="clearCycle"/>
|
||||
<div class="flex-container mb-2">
|
||||
<div class="flex sm2 xl2 md2 xs2 px-0 py-0" />
|
||||
<div class="flex sm5 xl5 md5 xs5 pl-1 pr-0 py-0">
|
||||
<change-scale :ref="'change_scale_x'" axis="x" @refreshChart="refreshChart" @clearCycle="clearCycle" @changeAxis="changeAxis"/>
|
||||
</div>
|
||||
<div class="flex sm5 xl5 md5 xs5 px-0 py-0">
|
||||
<abs-toggle :ref="'abs_x'" axis="x" @changeAxis="changeAxis"/>
|
||||
</div>
|
||||
</div>
|
||||
<change-cycle v-show="showCyclePanel" style="margin: 3px;" :ref="'change_cycle'" @refreshChart="refreshChart"/>
|
||||
<show-resample-rate style="margin: 3px;"/>
|
||||
<show-parameter style="margin: 3px;" :ref="'show_param'"/>
|
||||
|
||||
<div class="flex-container mb-2">
|
||||
<div class="flex sm2 xl2 md2 xs2 px-0 py-0">
|
||||
<p class="display-6"> Y-axis <p/>
|
||||
</div>
|
||||
<div class="flex sm5 xl5 md5 xs5 pl-1 pr-0 py-0">
|
||||
<change-axis :ref="'change_axis_y'" axis="y" @changeAxis="changeAxis" @changeUnit="changeUnit" @clearCycle="clearCycle"/>
|
||||
</div>
|
||||
<div class="flex sm5 xl5 md5 xs5 pl-1 pr-0 py-0">
|
||||
<change-unit :ref="'change_unit_y'" axis="y" @refreshChart="refreshChart"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-container mb-2">
|
||||
<div class="flex sm2 xl2 md2 xs2 px-0 py-0" />
|
||||
<div class="flex sm5 xl5 md5 xs5 pl-1 pr-0 py-0">
|
||||
<change-scale :ref="'change_scale_y'" axis="y" @refreshChart="refreshChart" @clearCycle="clearCycle" @changeAxis="changeAxis"/>
|
||||
</div>
|
||||
<div class="flex sm5 xl5 md5 xs5 px-0 py-0">
|
||||
<abs-toggle :ref="'abs_y'" axis="y" @changeAxis="changeAxis"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex-container mb-2">
|
||||
<div class="flex sm10 xl10 md10 xs10 px-0 py-0">
|
||||
<change-window-start-and-size :ref="'change_window_start_and_size'" @changeOverviewDataZoom="changeOverviewDataZoom"/>
|
||||
</div>
|
||||
<div class="flex sm1 xl1 md1 xs1 px-0 py-0">
|
||||
<lock-data-zoom :chartID="0"/>
|
||||
</div>
|
||||
</div>
|
||||
<change-cycle v-show="showCyclePanel" :ref="'change_cycle'" @refreshChart="refreshChart"/>
|
||||
<show-resample-rate/>
|
||||
<show-parameter :ref="'show_param'"/>
|
||||
</va-card>
|
||||
</div>
|
||||
</template>
|
||||
@@ -29,10 +76,13 @@ import ChangeAxis from '@/components/analysis/replay/toolbox/ChangeAxis.vue'
|
||||
import ChangeUnit from '@/components/analysis/replay/toolbox/ChangeUnit.vue'
|
||||
import ChangeScale from '@/components/analysis/replay/toolbox/ChangeScale.vue'
|
||||
import ChangeCycle from '@/components/analysis/replay/toolbox/ChangeCycle.vue'
|
||||
import AbsToggle from '@/components/analysis/replay/toolbox/AbsToggle.vue'
|
||||
import DownloadFile from '@/components/analysis/replay/toolbox/DownloadFile.vue'
|
||||
import DeleteFile from '@/components/analysis/replay/toolbox/DeleteFile.vue'
|
||||
import EditFileName from '@/components/analysis/replay/toolbox/EditFileName.vue'
|
||||
import ShowParameter from '@/components/analysis/replay/toolbox/ShowParameter.vue'
|
||||
import LockDataZoom from '@/components/analysis/replay/toolbox/LockDataZoom.vue'
|
||||
import ChangeWindowStartAndSize from '@/components/analysis/replay/toolbox/ChangeWindowStartAndSize.vue'
|
||||
import { mapFields } from 'vuex-map-fields'
|
||||
|
||||
export default {
|
||||
@@ -43,10 +93,13 @@ export default {
|
||||
ChangeUnit,
|
||||
ChangeScale,
|
||||
ChangeCycle,
|
||||
AbsToggle,
|
||||
DownloadFile,
|
||||
DeleteFile,
|
||||
EditFileName,
|
||||
ShowParameter,
|
||||
LockDataZoom,
|
||||
ChangeWindowStartAndSize,
|
||||
},
|
||||
computed: {
|
||||
...mapFields('replay', [
|
||||
@@ -75,9 +128,15 @@ export default {
|
||||
this.$refs.change_unit_y.init(this.deviceName)
|
||||
this.$refs.change_scale_x.init(this.deviceName)
|
||||
this.$refs.change_scale_y.init(this.deviceName)
|
||||
this.$refs.abs_x.init(this.deviceName)
|
||||
this.$refs.abs_y.init(this.deviceName)
|
||||
this.$refs.change_cycle.init()
|
||||
this.$refs.edit_file_name.init()
|
||||
this.$refs.show_param.init(this.deviceName)
|
||||
this.$refs.change_window_start_and_size.init()
|
||||
},
|
||||
changeOverviewDataZoom () {
|
||||
this.$emit('changeOverviewDataZoom')
|
||||
},
|
||||
refreshChart (options) {
|
||||
this.$emit('refreshChart', options)
|
||||
@@ -95,10 +154,6 @@ export default {
|
||||
clearCycle () {
|
||||
this.$refs.change_cycle.clear()
|
||||
},
|
||||
resetScale () {
|
||||
this.$refs.change_scale_x.reset()
|
||||
this.$refs.change_scale_y.reset()
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
},
|
||||
@@ -108,21 +163,6 @@ export default {
|
||||
<style lang="scss">
|
||||
.flex-container {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.flex-child {
|
||||
flex: 2;
|
||||
}
|
||||
|
||||
.flex-child1 {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.flex-child2 {
|
||||
flex: 0;
|
||||
}
|
||||
|
||||
.flex-child:first-child {
|
||||
margin-right: 1px;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -51,6 +51,13 @@ export default {
|
||||
ChangeChannelValueMinMax,
|
||||
},
|
||||
computed: {
|
||||
displayType () {
|
||||
return {
|
||||
x: this.axisXLabelScale.description === 'Log' ? 'log' : 'value',
|
||||
y: this.axisYLabelScale.description === 'Log' ? 'log' : 'value',
|
||||
}
|
||||
},
|
||||
|
||||
...mapFields('replay', [
|
||||
'chartData',
|
||||
'chartOverviewData',
|
||||
@@ -59,6 +66,8 @@ export default {
|
||||
'startTime',
|
||||
'endTime',
|
||||
'windowLength',
|
||||
'axisXLabelScale',
|
||||
'axisYLabelScale',
|
||||
'startTimeCurrent',
|
||||
'endTimeCurrent',
|
||||
'sampleMethod',
|
||||
@@ -366,7 +375,15 @@ export default {
|
||||
const data = await this.getData(parseInt(scale), this.sampleMethod, dataList[i].id, ch, metaInfo)
|
||||
for (let j = 0, len = data.length; j < len; j++) {
|
||||
if (parseInt(data[j][0]) >= this.startTimeCurrent && parseInt(data[j][0]) <= this.endTimeCurrent) {
|
||||
this.chartDetailData.series[seriesIndex].data.push(data[j])
|
||||
const processedData = data[j]
|
||||
if (this.displayType.x === 'log') {
|
||||
processedData[0] = Math.abs(processedData[0])
|
||||
}
|
||||
if (this.displayType.y === 'log') {
|
||||
processedData[1] = Math.abs(processedData[1])
|
||||
}
|
||||
|
||||
this.chartDetailData.series[seriesIndex].data.push(processedData)
|
||||
}
|
||||
// early stop
|
||||
if (parseInt(data[j][0]) > this.endTimeCurrent) {
|
||||
@@ -395,7 +412,6 @@ export default {
|
||||
this.startTimeCurrent = this.startTime
|
||||
this.endTimeCurrent = this.endTime
|
||||
this.drawDetailData()
|
||||
this.$refs.top_control_panel.resetScale()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
<change-window-start-and-size class="flex-child" :ref="'change_window_start_and_size'" @changeOverviewDataZoom="changeOverviewDataZoom"/>
|
||||
<lock-data-zoom class="flex-child2" :chartID="0"/>
|
||||
</div>
|
||||
<change-axis v-show="showXAxis" :ref="'change_axis_x'" deviceName="neulive" axis="x"/>
|
||||
<change-axis v-show="showYAxis" :ref="'change_axis_y'" deviceName="neulive" axis="y"/>
|
||||
<change-unit v-show="showXUnit" :ref="'change_unit_x'" deviceName="neulive" axis="x" @refreshChart="refreshChart"/>
|
||||
<change-unit :ref="'change_unit_y'" class="box_inline-block" deviceName="neulive" axis="y" @refreshChart="refreshChart"/>
|
||||
<change-scale :ref="'change_scale_y'" class="box_inline-block" deviceName="neulive" axis="y"/>
|
||||
<change-axis v-show="showXAxis" :ref="'change_axis_x'" axis="x"/>
|
||||
<change-axis v-show="showYAxis" :ref="'change_axis_y'" axis="y"/>
|
||||
<change-unit v-show="showXUnit" :ref="'change_unit_x'" axis="x" @refreshChart="refreshChart"/>
|
||||
<change-unit :ref="'change_unit_y'" class="box_inline-block" axis="y" @refreshChart="refreshChart"/>
|
||||
<change-scale :ref="'change_scale_y'" class="box_inline-block" axis="y"/>
|
||||
<sd-card-toggle :ref="'sd_card_toggle'" :metaIndex="0"/>
|
||||
<show-parameter :ref="'show_param'" deviceName="neulive"/>
|
||||
<show-parameter :ref="'show_param'"/>
|
||||
</va-card>
|
||||
</div>
|
||||
</template>
|
||||
@@ -34,6 +34,7 @@ import ShowParameter from '@/components/analysis/replay/toolbox/ShowParameter.vu
|
||||
import SdCardToggle from '@/components/analysis/replay/toolbox/SdCardToggle.vue'
|
||||
import LockDataZoom from '@/components/analysis/replay/toolbox/LockDataZoom.vue'
|
||||
import ChangeWindowStartAndSize from '@/components/analysis/replay/toolbox/ChangeWindowStartAndSize.vue'
|
||||
import { mapFields } from 'vuex-map-fields'
|
||||
|
||||
export default {
|
||||
name: 'top-control-panel',
|
||||
@@ -51,11 +52,16 @@ export default {
|
||||
ChangeWindowStartAndSize,
|
||||
},
|
||||
computed: {
|
||||
...mapFields('replay', [
|
||||
'metaList',
|
||||
'showCyclePanel',
|
||||
]),
|
||||
},
|
||||
async created () {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
deviceName: '',
|
||||
showXAxis: false,
|
||||
showYAxis: false,
|
||||
showXUnit: false,
|
||||
@@ -65,13 +71,14 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
init () {
|
||||
this.$refs.change_axis_x.init()
|
||||
this.$refs.change_axis_y.init()
|
||||
this.$refs.change_unit_x.init()
|
||||
this.$refs.change_unit_y.init()
|
||||
this.$refs.change_scale_y.init()
|
||||
this.deviceName = this.metaList[0].device.library_name
|
||||
this.$refs.change_axis_x.init(this.deviceName)
|
||||
this.$refs.change_axis_y.init(this.deviceName)
|
||||
this.$refs.change_unit_x.init(this.deviceName)
|
||||
this.$refs.change_unit_y.init(this.deviceName)
|
||||
this.$refs.change_scale_y.init(this.deviceName)
|
||||
this.$refs.edit_file_name.init()
|
||||
this.$refs.show_param.init()
|
||||
this.$refs.show_param.init(this.deviceName)
|
||||
this.$refs.change_window_start_and_size.init()
|
||||
this.$refs.sd_card_toggle.init()
|
||||
},
|
||||
@@ -81,9 +88,6 @@ export default {
|
||||
refreshChart (options) {
|
||||
this.$emit('refreshChart', options)
|
||||
},
|
||||
resetScale () {
|
||||
this.$refs.change_scale_y.reset()
|
||||
},
|
||||
},
|
||||
// use watch because va-select with @change will have bug
|
||||
watch: {
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
<template>
|
||||
<div>
|
||||
<va-button
|
||||
:color="buttonColor"
|
||||
:key="clickTime"
|
||||
v-model="absToggleStatus[axis]"
|
||||
@click="performABS()"
|
||||
class="round-button px-1 py-1"
|
||||
>
|
||||
ABS
|
||||
</va-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { mapActions, mapMutations } from 'vuex'
|
||||
import { mapFields } from 'vuex-map-fields'
|
||||
import types from '@/store/modules/analysis/replay/types'
|
||||
|
||||
export default {
|
||||
name: 'AbsToggle',
|
||||
components: {
|
||||
},
|
||||
computed: {
|
||||
displayType () {
|
||||
return {
|
||||
x: this.axisXLabelScale.description === 'Log' ? 'log' : 'value',
|
||||
y: this.axisYLabelScale.description === 'Log' ? 'log' : 'value',
|
||||
}
|
||||
},
|
||||
|
||||
...mapFields('replay', [
|
||||
'chartData',
|
||||
'metaList',
|
||||
'absToggleStatus',
|
||||
]),
|
||||
},
|
||||
props: {
|
||||
chartID: {
|
||||
type: Number, // detail data
|
||||
default: 1,
|
||||
},
|
||||
axis: {
|
||||
type: String, // x or y
|
||||
},
|
||||
metaIndex: {
|
||||
type: Number, // which meta file
|
||||
default: 0,
|
||||
},
|
||||
},
|
||||
created () {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
metaID: 0,
|
||||
metaInfo: null,
|
||||
buttonColor: 'gray',
|
||||
clickTime: 0,
|
||||
}
|
||||
},
|
||||
mqtt: {
|
||||
},
|
||||
methods: {
|
||||
init (deviceName) {
|
||||
this.deviceName = deviceName
|
||||
this.metaInfo = this.metaList[this.metaIndex]
|
||||
this.metaID = this.metaInfo.id
|
||||
this.absToggleStatus[this.axis] = false
|
||||
},
|
||||
performABS () {
|
||||
this.absToggleStatus[this.axis] = !this.absToggleStatus[this.axis]
|
||||
if (this.deviceName === 'EliteZM15' || this.deviceName === 'EliteEIS') {
|
||||
this.calculateHelper(this.metaIndex) // [TODO] elite tmp use metaIndex for grid index
|
||||
}
|
||||
this.clickTime++
|
||||
this.buttonColor = this.clickTime % 2 === 1 ? 'success' : 'gray'
|
||||
},
|
||||
async calculateHelper (gridIndex) {
|
||||
let seriesData
|
||||
if (this.absToggleStatus[this.axis]) {
|
||||
seriesData = JSON.parse(JSON.stringify(this.chartData[this.chartID].series[gridIndex].data))
|
||||
for (let i = 0; i < seriesData.length; i++) {
|
||||
if (this.axis === 'x') {
|
||||
seriesData[i][0] = Math.abs(seriesData[i][0])
|
||||
} else if (this.axis === 'y') {
|
||||
seriesData[i][1] = Math.abs(seriesData[i][1])
|
||||
}
|
||||
}
|
||||
this.updateSeriesChart({
|
||||
chartID: this.chartID,
|
||||
seriesIndex: gridIndex,
|
||||
data: seriesData,
|
||||
})
|
||||
} else {
|
||||
if (this.deviceName === 'EliteZM15' || this.deviceName === 'EliteEIS') {
|
||||
this.$emit('changeAxis', this.metaIndex) // [TODO] elite tmp use metaIndex for grid index
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
...mapActions('replay', [types.chart.setAxisDisplay]),
|
||||
...mapMutations('replay', [types.chart.updateSeries]),
|
||||
},
|
||||
async mounted () {
|
||||
},
|
||||
destroyed () {
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.round-button {
|
||||
border-radius: 12px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,29 +1,48 @@
|
||||
<template>
|
||||
<div>
|
||||
<span> {{ axis }} axis: </span>
|
||||
<div v-if="axis === 'x'" style="display: inline;">
|
||||
<select v-if="deviceName!=='EliteEIS'" v-model="channelFormat" @change="changeAxis()">
|
||||
<option v-for="option in channelOptions" :key="option.id" :value="option">
|
||||
{{ option.description }}
|
||||
</option>
|
||||
</select>
|
||||
<select v-if="deviceName==='EliteEIS'" v-model="channelFormat" @change="changeAxis()">
|
||||
<option v-for="option in eisChannelOptions" :key="option.id" :value="option">
|
||||
{{ option.description }}
|
||||
</option>
|
||||
</select>
|
||||
<div v-if="axis === 'x'">
|
||||
<va-select
|
||||
@input="changeAxis()"
|
||||
:label="''"
|
||||
v-if="deviceName!=='EliteEIS'"
|
||||
v-model="channelFormat"
|
||||
textBy="description"
|
||||
class="va-select-without-margin"
|
||||
:options="channelOptions"
|
||||
:noClear='true'
|
||||
/>
|
||||
<va-select
|
||||
@input="changeAxis()"
|
||||
:label="''"
|
||||
v-if="deviceName==='EliteEIS'"
|
||||
v-model="channelFormat"
|
||||
textBy="description"
|
||||
class="va-select-without-margin"
|
||||
:options="eisChannelOptions"
|
||||
:noClear='true'
|
||||
/>
|
||||
</div>
|
||||
<div v-if="axis === 'y'" style="display: inline;">
|
||||
<select v-if="deviceName!=='EliteEIS'" v-model="channelFormat" @change="changeAxis()">
|
||||
<option v-for="option in channelYOptions" :key="option.id" :value="option">
|
||||
{{ option.description }}
|
||||
</option>
|
||||
</select>
|
||||
<select v-if="deviceName==='EliteEIS'" v-model="channelFormat" @change="changeAxis()">
|
||||
<option v-for="option in eisChannelYOptions" :key="option.id" :value="option">
|
||||
{{ option.description }}
|
||||
</option>
|
||||
</select>
|
||||
<div v-if="axis === 'y'">
|
||||
<va-select
|
||||
@input="changeAxis()"
|
||||
:label="''"
|
||||
v-if="deviceName!=='EliteEIS'"
|
||||
v-model="channelFormat"
|
||||
textBy="description"
|
||||
class="va-select-without-margin"
|
||||
:options="channelYOptions"
|
||||
:noClear='true'
|
||||
/>
|
||||
<va-select
|
||||
@input="changeAxis()"
|
||||
:label="''"
|
||||
v-if="deviceName==='EliteEIS'"
|
||||
v-model="channelFormat"
|
||||
textBy="description"
|
||||
class="va-select-without-margin"
|
||||
:options="eisChannelYOptions"
|
||||
:noClear='true'
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -58,7 +77,7 @@ export default {
|
||||
methods: {
|
||||
init (deviceName) {
|
||||
this.deviceName = deviceName
|
||||
if (this.deviceName === 'neulive') {
|
||||
if (this.deviceName.startsWith('Neulive')) {
|
||||
// now neulive only v-t
|
||||
if (this.axis === 'x') {
|
||||
this.axisXDataType = this.channelOptions[3]
|
||||
@@ -162,7 +181,7 @@ export default {
|
||||
}
|
||||
},
|
||||
changeAxis () {
|
||||
if (this.deviceName === 'neulive') {
|
||||
if (this.deviceName.startsWith('Neulive')) {
|
||||
// for elite now, cuz neulive now only have v-t graph, for future neulive replay need to adjust'
|
||||
// console.log('(Last updated: 2021/06/19)')
|
||||
} else if (this.deviceName === 'EliteZM15' || this.deviceName === 'EliteEIS') {
|
||||
@@ -171,14 +190,13 @@ export default {
|
||||
} else if (this.axis === 'y') {
|
||||
this.axisYDataType = this.channelFormat
|
||||
}
|
||||
if (this.axisXDataType.description !== 'Time' && this.metaList[this.metaIndex].parameter_set.CYCLE_NUMBER > 0) {
|
||||
if (this.metaList[this.metaIndex].parameter_set.CYCLE_NUMBER > 0) {
|
||||
this.showCyclePanel = true
|
||||
} else {
|
||||
this.showCyclePanel = false
|
||||
}
|
||||
this.$emit('changeAxis', this.metaIndex) // temporarily use metaIndex for gridIndex
|
||||
this.$emit('changeUnit', this.axis)
|
||||
this.$emit('resetScale')
|
||||
this.$emit('clearCycle')
|
||||
}
|
||||
},
|
||||
@@ -300,3 +318,11 @@ export default {
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.va-select-without-margin {
|
||||
.va-select {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -34,13 +34,28 @@ export default {
|
||||
return {
|
||||
showPanel: false,
|
||||
metaID: 0,
|
||||
showWhichCycles: '1',
|
||||
cycleNum: 0,
|
||||
cycleDataID: 3, // [TODO] manage by data type factory
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
slices: function () {
|
||||
...mapFields('replay', [
|
||||
'chartData',
|
||||
'recInfo',
|
||||
'metaList',
|
||||
'currentScale',
|
||||
'sampleMethod',
|
||||
'axisXDataType',
|
||||
'axisYDataType',
|
||||
'axisXLabelScale',
|
||||
'axisYLabelScale',
|
||||
'showWhichCycles',
|
||||
]),
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
methods: {
|
||||
slices () {
|
||||
const cycleList = this.showWhichCycles.split(',')
|
||||
if (cycleList.length === 1 && cycleList[0] === '') {
|
||||
return ''
|
||||
@@ -58,24 +73,8 @@ export default {
|
||||
}
|
||||
const cycleSet = new Set(cycleList)
|
||||
const sortedCycleList = [...cycleSet].sort() // ref: https://stackoverflow.com/questions/33089695/how-can-i-sort-an-es6-set
|
||||
// console.log(sortedCycleList)
|
||||
return sortedCycleList
|
||||
},
|
||||
...mapFields('replay', [
|
||||
'chartData',
|
||||
'recInfo',
|
||||
'metaList',
|
||||
'currentScale',
|
||||
'sampleMethod',
|
||||
'axisXDataType',
|
||||
'axisYDataType',
|
||||
'axisXLabelScale',
|
||||
'axisYLabelScale',
|
||||
]),
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
methods: {
|
||||
init () {
|
||||
this.cycleNum = this.metaList[this.metaIndex].parameter_set.CYCLE_NUMBER
|
||||
const meta = this.metaList[this.metaIndex]
|
||||
@@ -104,13 +103,18 @@ export default {
|
||||
}
|
||||
}
|
||||
const cycleDict = this.getCycleDictRec()(cycleDataList)
|
||||
|
||||
const dataXList = this.recInfo[this.metaID][this.axisXDataType.id][this.currentScale]
|
||||
this.cycleNum = Object.keys(cycleDict).length
|
||||
let dataXList
|
||||
if (this.axisXDataType.description !== 'Time') {
|
||||
dataXList = this.recInfo[this.metaID][this.axisXDataType.id][this.currentScale]
|
||||
}
|
||||
const dataYList = this.recInfo[this.metaID][this.axisYDataType.id][this.currentScale]
|
||||
const filteredData = []
|
||||
|
||||
let counter = 0
|
||||
for (let sliceIndex = 0; sliceIndex < this.cycleNum; sliceIndex++) {
|
||||
// console.log(this.slices)
|
||||
if (this.slices === '' || this.slices.includes((sliceIndex + 1).toString())) {
|
||||
if (this.slices() === '' || this.slices().includes((sliceIndex + 1).toString())) {
|
||||
// slice data
|
||||
const value = cycleDict[sliceIndex + 1]
|
||||
const startTime = value[0]
|
||||
@@ -135,12 +139,12 @@ export default {
|
||||
let x
|
||||
let y
|
||||
if (this.axisXLabelScale.description === 'Log') {
|
||||
x = Math.log10(Math.abs(dataX[j][1]))
|
||||
x = Math.abs(dataX[j][1])
|
||||
} else if (this.axisXLabelScale.description === 'Linear') {
|
||||
x = dataX[j][1]
|
||||
}
|
||||
if (this.axisYLabelScale.description === 'Log') {
|
||||
y = Math.log10(Math.abs(dataY[j][1]))
|
||||
y = Math.abs(dataY[j][1])
|
||||
} else if (this.axisYLabelScale.description === 'Linear') {
|
||||
y = dataY[j][1]
|
||||
}
|
||||
@@ -151,7 +155,7 @@ export default {
|
||||
for (let j = 0, len = dataY.length; j < len; j++) {
|
||||
if (parseInt(dataY[j][0]) >= startTime && parseInt(dataY[j][0]) <= endTime) {
|
||||
if (this.axisYLabelScale.description === 'Log') {
|
||||
dataY[j][1] = Math.log10(Math.abs(dataY[j][1]))
|
||||
dataY[j][1] = Math.abs(dataY[j][1])
|
||||
} else if (this.axisYLabelScale.description === 'Linear') {
|
||||
// do nothing
|
||||
}
|
||||
@@ -166,6 +170,13 @@ export default {
|
||||
seriesIndex: this.metaIndex,
|
||||
data: filteredData,
|
||||
})
|
||||
if (this.axisXDataType.description === 'Time') {
|
||||
if (counter === 0) {
|
||||
this.chartData[this.chartID].xAxis[this.metaIndex].min = startTime
|
||||
}
|
||||
this.chartData[this.chartID].xAxis[this.metaIndex].max = endTime
|
||||
counter++
|
||||
}
|
||||
// this.$emit('refreshChart', this.chartData[this.chartID])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
<template>
|
||||
<div>
|
||||
<select v-model="scaleFormat" @change="changeScale()">
|
||||
<option v-for="option in scaleOptions" :key="option.id" :value="option">
|
||||
{{ option.description }}
|
||||
</option>
|
||||
</select>
|
||||
<va-select
|
||||
@input="changeScale()"
|
||||
:label="''"
|
||||
v-model="scaleFormat"
|
||||
textBy="description"
|
||||
class="va-select-without-margin"
|
||||
:options="scaleOptions"
|
||||
:noClear='true'
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapMutations, mapGetters } from 'vuex'
|
||||
import { mapActions, mapMutations, mapGetters } from 'vuex'
|
||||
import { mapFields } from 'vuex-map-fields'
|
||||
import types from '@/store/modules/analysis/replay/types'
|
||||
import { download } from '@/data/download/Download'
|
||||
@@ -34,6 +38,13 @@ export default {
|
||||
created () {
|
||||
},
|
||||
computed: {
|
||||
displayType () {
|
||||
return {
|
||||
x: this.axisXLabelScale.description === 'Log' ? 'log' : 'value',
|
||||
y: this.axisYLabelScale.description === 'Log' ? 'log' : 'value',
|
||||
}
|
||||
},
|
||||
|
||||
...mapFields('replay', [
|
||||
'chartData',
|
||||
'recInfo',
|
||||
@@ -42,6 +53,7 @@ export default {
|
||||
'axisYLabelScale',
|
||||
'axisXDataType',
|
||||
'axisYDataType',
|
||||
'absToggleStatus',
|
||||
'startTimeCurrent',
|
||||
'endTimeCurrent',
|
||||
'currentScale',
|
||||
@@ -67,7 +79,7 @@ export default {
|
||||
} else if (this.axis === 'y') {
|
||||
this.axisYLabelScale = this.scaleFormat
|
||||
}
|
||||
if (this.deviceName === 'neulive') {
|
||||
if (this.deviceName.startsWith('Neulive')) {
|
||||
const keys = Object.keys(this.metaInfo.mini_data)
|
||||
for (let gridIndex = 0; gridIndex < keys.length; gridIndex++) {
|
||||
const ch = keys[gridIndex]
|
||||
@@ -85,14 +97,19 @@ export default {
|
||||
seriesData = JSON.parse(JSON.stringify(this.chartData[this.chartID].series[gridIndex].data))
|
||||
for (let i = 0; i < seriesData.length; i++) {
|
||||
if (this.axis === 'x') {
|
||||
seriesData[i][0] = Math.log10(Math.abs(seriesData[i][0])).toFixed(8)
|
||||
seriesData[i][0] = Math.abs(seriesData[i][0])
|
||||
} else if (this.axis === 'y') {
|
||||
seriesData[i][1] = Math.log10(Math.abs(seriesData[i][1])).toFixed(8)
|
||||
seriesData[i][1] = Math.abs(seriesData[i][1])
|
||||
}
|
||||
}
|
||||
this.updateSeriesChart({
|
||||
chartID: this.chartID,
|
||||
seriesIndex: gridIndex,
|
||||
data: seriesData,
|
||||
})
|
||||
} else if (this.scaleFormat.description === 'Linear') {
|
||||
// console.log(this.recInfo)
|
||||
if (this.deviceName === 'neulive') {
|
||||
if (this.deviceName.startsWith('Neulive')) {
|
||||
// [Region] get the subfile index
|
||||
seriesData = []
|
||||
const dataYList = this.recInfo[this.metaID][ch][this.currentScale]
|
||||
@@ -112,94 +129,22 @@ export default {
|
||||
for (let j = 0, len = data.length; j < len; j++) {
|
||||
if (parseInt(data[j][0]) >= this.startTimeCurrent && parseInt(data[j][0]) <= this.endTimeCurrent) {
|
||||
const processedData = data[j]
|
||||
if (this.axisXLabelScale.description === 'Log') {
|
||||
processedData[0] = Math.log10(Math.abs(processedData[0]))
|
||||
if (this.displayType.x === 'log' || this.absToggleStatus.x === true) {
|
||||
processedData[0] = Math.abs(processedData[0])
|
||||
}
|
||||
if (this.axisYLabelScale.description === 'Log') {
|
||||
processedData[1] = Math.log10(Math.abs(processedData[1]))
|
||||
if (this.displayType.y === 'log' || this.absToggleStatus.y === true) {
|
||||
processedData[1] = Math.abs(processedData[1])
|
||||
}
|
||||
seriesData.push(processedData)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (this.deviceName === 'EliteZM15' || this.deviceName === 'EliteEIS') {
|
||||
seriesData = []
|
||||
|
||||
const isThisModeHasCycle = this.GLOBAL.hasCycleMode(this.metaInfo.parameter_set.MODE, this.deviceName)
|
||||
let startTime
|
||||
let endTime
|
||||
if (isThisModeHasCycle === true && this.axisXDataType.description !== 'Time') { // if有cycle的mode且目前x軸不為時間,抓出第一圈所在的時間段,初始化時先畫第一圈就好,加快初始時間
|
||||
const cycleDataID = 3 // recorded cycle 所在的channel index
|
||||
const dataCycleList = this.recInfo[this.metaID][cycleDataID][this.currentScale]
|
||||
const cycleDataList = []
|
||||
for (let i = 0; i < dataCycleList.length; i++) {
|
||||
if (dataCycleList[i].data.length === 0) {
|
||||
const data = await this.getData(parseInt(this.currentScale), this.sampleMethod, dataCycleList[i].id, cycleDataID, this.metaInfo)
|
||||
cycleDataList.push({ data: data })
|
||||
} else {
|
||||
cycleDataList.push({ data: dataCycleList[i].data })
|
||||
}
|
||||
}
|
||||
const cycleDict = this.getCycleDictRec()(cycleDataList)
|
||||
startTime = cycleDict[1][0] // [1]: 第一圈
|
||||
endTime = cycleDict[1][1] // [1]: 第一圈
|
||||
this.$emit('clearCycle')
|
||||
} else {
|
||||
startTime = this.startTimeCurrent
|
||||
endTime = this.endTimeCurrent
|
||||
}
|
||||
|
||||
const dataYList = this.recInfo[this.metaID][this.axisYDataType.id][this.currentScale]
|
||||
let startIndex = 0
|
||||
let endIndex = 0
|
||||
for (let i = 0; i < dataYList.length; i++) {
|
||||
if (startTime >= parseInt(dataYList[i].start_time) && startTime <= parseInt(dataYList[i].end_time)) {
|
||||
startIndex = i
|
||||
}
|
||||
if (endTime >= parseInt(dataYList[i].start_time) && endTime <= parseInt(dataYList[i].end_time)) {
|
||||
endIndex = i
|
||||
}
|
||||
}
|
||||
// [EndRegion]
|
||||
for (let i = startIndex; i <= endIndex; i++) {
|
||||
const dataY = await this.getData(parseInt(this.currentScale), this.sampleMethod, dataYList[i].id, this.axisYDataType.id, this.metaInfo)
|
||||
let dataX
|
||||
if (this.axisXDataType.description !== 'Time') {
|
||||
const dataXList = this.recInfo[this.metaID][this.axisXDataType.id][this.currentScale]
|
||||
dataX = await this.getData(parseInt(this.currentScale), this.sampleMethod, dataXList[i].id, this.axisXDataType.id, this.metaInfo)
|
||||
}
|
||||
for (let j = 0, len = dataY.length; j < len; j++) {
|
||||
if (parseInt(dataY[j][0]) >= startTime && parseInt(dataY[j][0]) <= endTime) {
|
||||
const processedData = dataY[j]
|
||||
if (this.axisXDataType.description !== 'Time') {
|
||||
processedData[0] = dataX[j][1]
|
||||
}
|
||||
if (this.axisXLabelScale.description === 'Log') {
|
||||
processedData[0] = Math.log10(Math.abs(processedData[0]))
|
||||
}
|
||||
if (this.axisYLabelScale.description === 'Log') {
|
||||
processedData[1] = Math.log10(Math.abs(processedData[1]))
|
||||
}
|
||||
seriesData.push(processedData)
|
||||
}
|
||||
}
|
||||
}
|
||||
this.$emit('changeAxis', this.metaIndex)
|
||||
this.$emit('clearCycle')
|
||||
}
|
||||
}
|
||||
this.updateSeriesChart({
|
||||
chartID: this.chartID,
|
||||
seriesIndex: gridIndex,
|
||||
data: seriesData,
|
||||
})
|
||||
},
|
||||
reset () {
|
||||
if (this.axis === 'x') {
|
||||
this.axisXLabelScale = this.scaleOptions[0] // 0 mean use default unit
|
||||
this.scaleFormat = this.axisXLabelScale
|
||||
} else if (this.axis === 'y') {
|
||||
this.axisYLabelScale = this.scaleOptions[0] // 0 mean use default unit
|
||||
this.scaleFormat = this.axisYLabelScale
|
||||
}
|
||||
this.setAxisDisplayChart({ type: this.displayType[this.axis], axis: this.axis, chartID: this.chartID, gridIndex: gridIndex })
|
||||
},
|
||||
getData: async function (scale, sampleMethod, id, channel, meta) {
|
||||
if (scale === 1) {
|
||||
@@ -212,6 +157,7 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
...mapActions('replay', [types.chart.setAxisDisplay]),
|
||||
...mapMutations('replay', [types.chart.updateSeries]),
|
||||
...mapGetters('replay', [types.rec.getCycleDict]),
|
||||
},
|
||||
@@ -240,3 +186,11 @@ export default {
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.va-select-without-margin {
|
||||
.va-select {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,15 +1,25 @@
|
||||
<template>
|
||||
<div>
|
||||
<select v-if="deviceName!=='EliteEIS'" v-model="valueFormat" @change="changeUnit()">
|
||||
<option v-for="option in valueFormatOptions[dataType]" :key="option.id" :value="option">
|
||||
{{ option.unit }}
|
||||
</option>
|
||||
</select>
|
||||
<select v-if="deviceName==='EliteEIS'" v-model="valueFormat" @change="changeUnit()">
|
||||
<option v-for="option in eisValueFormatOptions[dataType]" :key="option.id" :value="option">
|
||||
{{ option.unit }}
|
||||
</option>
|
||||
</select>
|
||||
<va-select
|
||||
@input="changeUnit()"
|
||||
:label="''"
|
||||
v-if="deviceName!=='EliteEIS'"
|
||||
v-model="valueFormat"
|
||||
textBy="unit"
|
||||
class="va-select-without-margin"
|
||||
:options="valueFormatOptions[dataType]"
|
||||
:noClear='true'
|
||||
/>
|
||||
<va-select
|
||||
@input="changeUnit()"
|
||||
:label="''"
|
||||
v-if="deviceName==='EliteEIS'"
|
||||
v-model="valueFormat"
|
||||
textBy="unit"
|
||||
class="va-select-without-margin"
|
||||
:options="eisValueFormatOptions[dataType]"
|
||||
:noClear='true'
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -45,7 +55,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
initDefaultUnit (axis) {
|
||||
if (this.deviceName === 'neulive') {
|
||||
if (this.deviceName.startsWith('Neulive')) {
|
||||
if (axis === 'x') {
|
||||
return this.valueFormatOptions[this.dataType].find(function (item, index, array) {
|
||||
return item.unit === 'auto'
|
||||
@@ -63,7 +73,7 @@ export default {
|
||||
},
|
||||
init (deviceName) {
|
||||
this.deviceName = deviceName
|
||||
if (this.deviceName === 'neulive') {
|
||||
if (this.deviceName.startsWith('Neulive')) {
|
||||
// now neulive only v-t
|
||||
if (this.axis === 'x') {
|
||||
this.dataType = 'time'
|
||||
@@ -158,7 +168,7 @@ export default {
|
||||
this.valueFormatY = this.valueFormat
|
||||
}
|
||||
const chartID = 1 // detail data
|
||||
if (this.deviceName === 'neulive') {
|
||||
if (this.deviceName.startsWith('Neulive')) {
|
||||
const keys = Object.keys(this.metaList[this.metaIndex].mini_data)
|
||||
for (let axisIndex = 0; axisIndex < keys.length; axisIndex++) {
|
||||
const key = keys[axisIndex]
|
||||
@@ -394,3 +404,11 @@ export default {
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.va-select-without-margin {
|
||||
.va-select {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,30 +1,28 @@
|
||||
<template>
|
||||
<div class="row flex sm12 xl12 md12 xs12 align--center my-0 py-0">
|
||||
<div class="row flex sm12 xl12 md12 xs12 px-0 py-0 mx-0 my-0">
|
||||
<div class="flex sm6 xl6 md6 xs6 px-0 mx-0">
|
||||
Window Start
|
||||
<p class="display-6"> Window Start <p/>
|
||||
<va-input
|
||||
@mouseleave.native="itemChange(startTime)"
|
||||
@keyup.enter="itemChange(startTime)"
|
||||
@blur="itemChange(startTime)"
|
||||
v-model="startTime"
|
||||
@keyup.enter="startItemChange(startTimeInput)"
|
||||
@blur="startItemChange(startTimeInput)"
|
||||
v-model="startTimeInput"
|
||||
class="mb-0 flex-child"
|
||||
>
|
||||
<p slot="append" style="margin-right: 0;" small>
|
||||
µs
|
||||
ms
|
||||
</p>
|
||||
</va-input>
|
||||
</div>
|
||||
<div class="flex sm6 xl6 md6 xs6 px-0 mx-0">
|
||||
Window Size
|
||||
<p class="display-6"> Window Size <p/>
|
||||
<va-input
|
||||
@mouseleave.native="itemChange(windowLength)"
|
||||
@keyup.enter="itemChange(windowLength)"
|
||||
@blur="itemChange(windowLength)"
|
||||
v-model="windowLength"
|
||||
@keyup.enter="lenItemChange(windowLengthInput)"
|
||||
@blur="lenItemChange(windowLengthInput)"
|
||||
v-model="windowLengthInput"
|
||||
class="mb-0 flex-child"
|
||||
>
|
||||
<p slot="append" style="margin-right: 0;" small>
|
||||
µs
|
||||
ms
|
||||
</p>
|
||||
</va-input>
|
||||
</div>
|
||||
@@ -42,6 +40,25 @@ export default {
|
||||
props: {
|
||||
},
|
||||
computed: {
|
||||
startTimeInput: {
|
||||
get () {
|
||||
return this.startTime / 1e3
|
||||
},
|
||||
set (val) {
|
||||
this.startTime = val * 1e3
|
||||
this.endTime = this.startTime + this.windowLength
|
||||
},
|
||||
},
|
||||
windowLengthInput: {
|
||||
get () {
|
||||
return this.windowLength / 1e3
|
||||
},
|
||||
set (val) {
|
||||
this.windowLength = val * 1e3
|
||||
this.endTime = this.startTime + this.windowLength
|
||||
},
|
||||
},
|
||||
|
||||
...mapFields('replay', [
|
||||
'startTime',
|
||||
'endTime',
|
||||
@@ -60,12 +77,18 @@ export default {
|
||||
init () {
|
||||
this.windowLength = parseInt(this.endTime) - parseInt(this.startTime)
|
||||
},
|
||||
itemChange (val) {
|
||||
this.startTime = parseInt(this.startTime)
|
||||
startItemChange (val) {
|
||||
this.startTime = parseInt(val * 1e3) // us
|
||||
this.windowLength = parseInt(this.windowLength)
|
||||
this.endTime = this.startTime + this.windowLength
|
||||
this.$emit('changeOverviewDataZoom')
|
||||
},
|
||||
lenItemChange (val) {
|
||||
this.startTime = parseInt(this.startTime)
|
||||
this.windowLength = parseInt(val * 1e3) // us
|
||||
this.endTime = this.startTime + this.windowLength
|
||||
this.$emit('changeOverviewDataZoom')
|
||||
},
|
||||
},
|
||||
async mounted () {
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<va-button flat small class="resize-va-button" color="gray" icon="fa fa-trash" @click.stop="deleteFileConfirm()"/>
|
||||
<va-button flat small color="gray" icon="fa fa-trash" @click.stop="deleteFileConfirm()"/>
|
||||
<va-modal
|
||||
v-model="showModal.deleteFile"
|
||||
size="small"
|
||||
@@ -90,15 +90,3 @@ export default {
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.resize-va-button {
|
||||
.va-button {
|
||||
margin: 0.375rem 0.5rem 0.375rem 0.1px;
|
||||
}
|
||||
|
||||
.va-button--small {
|
||||
padding: 0.1px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<va-button flat small class="resize-va-button" color="gray" icon="fa fa-download" @click.stop="downloadCSV()"/>
|
||||
<va-button flat small color="gray" icon="fa fa-download" @click.stop="downloadCSV()"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -47,15 +47,3 @@ export default {
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.resize-va-button {
|
||||
.va-button {
|
||||
margin: 0.375rem 0.5rem 0.375rem 0.1px;
|
||||
}
|
||||
|
||||
.va-button--small {
|
||||
padding: 0.1px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<va-button flat small class="resize-va-button" color="gray" icon="fa fa-file-text-o" @click.stop="editFileConfirm()"> {{ filename }} </va-button>
|
||||
<va-button flat small color="gray" icon="fa fa-file-text-o" @click.stop="editFileConfirm()"> {{ filename }} </va-button>
|
||||
<va-modal
|
||||
class="flex sm12 xl12 md12 xs12"
|
||||
v-model="showModal.editFile"
|
||||
@@ -139,15 +139,3 @@ export default {
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.resize-va-button {
|
||||
.va-button {
|
||||
margin: 0.375rem 0.5rem 0.375rem 0.1px;
|
||||
}
|
||||
|
||||
.va-button--small {
|
||||
padding: 0.1px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
<script>
|
||||
import { mapFields } from 'vuex-map-fields'
|
||||
import paramTable from '@/data/param-table/index.js'
|
||||
|
||||
export default {
|
||||
name: 'show-parameter',
|
||||
@@ -25,6 +26,7 @@ export default {
|
||||
return {
|
||||
deviceName: '',
|
||||
content: '',
|
||||
showDict: {},
|
||||
// [region] for neulive
|
||||
ampGainOptions: [
|
||||
{
|
||||
@@ -279,21 +281,6 @@ export default {
|
||||
},
|
||||
],
|
||||
// [Endregion]
|
||||
// [region] for EliteEIS
|
||||
eisWorkingModeOptions: [
|
||||
{
|
||||
id: 0,
|
||||
description: 'Potentiostatic Electrochemical Impedance Spectroscopy',
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
description: 'CV',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
description: 'Dev Tools',
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -308,11 +295,11 @@ export default {
|
||||
this.deviceName = deviceName
|
||||
const meta = this.metaList[this.metaIndex]
|
||||
const params = meta.parameter_set
|
||||
this.content += 'Duration: ' + parseInt(parseInt(meta.time_duration / 1000000) / 60) + ' m ' + parseInt((meta.time_duration % 60000000) / 1000000) + ' s<br/>'
|
||||
this.content += 'Duration: ' + parseInt(parseInt(meta.time_duration / 1e6) / 60) + ' m ' + parseInt((meta.time_duration % 6e7) / 1e6) + ' s<br/>'
|
||||
this.content += '<br/>Parameter: <br/>'
|
||||
this.content += '<br/> Recording: <br/>'
|
||||
if (this.deviceName === 'neulive') {
|
||||
if (this.deviceName.startsWith('Neulive')) {
|
||||
// recording param
|
||||
this.content += '<br/> Recording: <br/>'
|
||||
for (const [key, value] of Object.entries(params)) {
|
||||
if (!(key.includes('sti') || key.includes('STI'))) {
|
||||
let showKey = ''
|
||||
@@ -446,181 +433,47 @@ export default {
|
||||
this.content += ' Frequency: ' + String(1000 / period) + ' Hz' + '<br/>' // 1000 is cuz 1s = 1000ms
|
||||
this.content += ' Period: ' + String(period) + ' ms' + '<br/>'
|
||||
}
|
||||
} else if (this.deviceName === 'EliteZM15') {
|
||||
for (const [key, value] of Object.entries(params)) {
|
||||
let showKey = ''
|
||||
let showValue = value
|
||||
if (key === 'MODE') {
|
||||
showKey = 'MODE'
|
||||
for (let i = 0; i < this.workingModeOptions.length; i++) {
|
||||
if (this.workingModeOptions[i].id === value) {
|
||||
showValue = this.workingModeOptions[i].description
|
||||
} else if (this.deviceName === 'EliteZM15' || this.deviceName === 'EliteEIS') {
|
||||
const mode = params.MODE
|
||||
const modeName = paramTable[this.deviceName].MODE[mode].name
|
||||
const showParams = paramTable[this.deviceName].MODE[mode].showParameter
|
||||
this.showDict.MODE = modeName
|
||||
if (modeName === 'Pulse Sensing') {
|
||||
const duplicateParam = ['V_initial', 't_pulse', 'CURR_REC_START', 'CURR_REC_END']
|
||||
for (let i = 0; i < 4; i++) {
|
||||
const key = 'segment_order_' + String(i)
|
||||
const order = paramTable[this.deviceName][key].rev_func(params[key])
|
||||
if (parseInt(order) !== 0) { // if === 0, 代表沒有使用這個block
|
||||
for (let key of duplicateParam) {
|
||||
key = key + '_' + String(i)
|
||||
this.fillShowDict(key, params[key])
|
||||
}
|
||||
}
|
||||
} else if (key === 'ADC_LEVEL') {
|
||||
showKey = 'Current Range'
|
||||
for (let i = 0; i < this.currentRangeOptions.length; i++) {
|
||||
if (this.currentRangeOptions[i].value === value) {
|
||||
showValue = this.currentRangeOptions[i].label
|
||||
}
|
||||
}
|
||||
} else if (key === 'VOLT_ORIGIN') {
|
||||
showKey = 'Volt start'
|
||||
showValue = (value / 5000) - 5 + 'V'
|
||||
} else if (key === 'VOLT_FINAL') {
|
||||
showKey = 'Volt stop'
|
||||
showValue = (value / 5000) - 5 + 'V'
|
||||
} else if (key === 'VOLT_STEP') {
|
||||
showKey = 'Volt step'
|
||||
showValue = ((value * 2) + 2) / 10 + 'mV'
|
||||
} else if (key === 'STEP_TIME') {
|
||||
showKey = 'Step time'
|
||||
for (let i = 0; i < this.stepTimeOptions.length; i++) {
|
||||
if (this.stepTimeOptions[i].value === value) {
|
||||
showValue = this.stepTimeOptions[i].label
|
||||
}
|
||||
}
|
||||
} else if (key === 'CYCLE_NUMBER') {
|
||||
showKey = 'Cycle number'
|
||||
showValue = value
|
||||
} else if (key === 'DAC_VOLT') {
|
||||
showKey = 'Volt out'
|
||||
showValue = (value / 5000) - 5 + 'V'
|
||||
} else if (key === 'Resister_LEVEL') {
|
||||
showKey = 'Resister Range'
|
||||
for (let i = 0; i < this.resisterRangeOptions.length; i++) {
|
||||
if (this.resisterRangeOptions[i].value === value) {
|
||||
showValue = this.resisterRangeOptions[i].label
|
||||
}
|
||||
}
|
||||
} else if (key === 'SAMPLE_RATE') {
|
||||
showKey = 'Sample rate'
|
||||
for (let i = 0; i < this.eliteSampleRateOptions.length; i++) {
|
||||
if (this.eliteSampleRateOptions[i].value === value) {
|
||||
showValue = this.eliteSampleRateOptions[i].label
|
||||
}
|
||||
}
|
||||
} else if (key === 'Const_Current_value') {
|
||||
showKey = 'Current'
|
||||
showValue = value + 'μA'
|
||||
} else if (key === 'VOLTSTOP_MAX') {
|
||||
showKey = 'Volt max stop'
|
||||
showValue = (value / 5000) - 5 + 'V'
|
||||
} else if (key === 'VOLTSTOP_MIN') {
|
||||
showKey = 'Volt min stop'
|
||||
showValue = (value / 5000) - 5 + 'V'
|
||||
} else if (key === 'Charge') {
|
||||
showKey = 'Charge'
|
||||
for (let i = 0; i < this.chargeOptions.length; i++) {
|
||||
if (this.chargeOptions[i].value === value) {
|
||||
showValue = this.chargeOptions[i].label
|
||||
}
|
||||
}
|
||||
} else if (key === 'VOLT_INITIAL') {
|
||||
showKey = 'E-Initial'
|
||||
showValue = (value / 5000) - 5 + 'V'
|
||||
} else if (key === 'VOLT_MAX') {
|
||||
showKey = 'Volt max stop'
|
||||
showValue = (value / 5000) - 5 + 'V'
|
||||
} else if (key === 'VOLT_MIN') {
|
||||
showKey = 'Volt min stop'
|
||||
showValue = (value / 5000) - 5 + 'V'
|
||||
} else if (key === 'Scan_Rate') {
|
||||
showKey = 'ScanRate'
|
||||
showValue = (value / 100) + 0.01 + 'mV/s'
|
||||
} else if (key === 'Data_Resolution_Scan') {
|
||||
showKey = 'Resolution'
|
||||
showValue = (value / 10) + 0.1 + 'sps'
|
||||
} else if (key === 'VOLT_EFINAL') {
|
||||
showKey = 'E-Final'
|
||||
showValue = (value / 5000) - 5 + 'V'
|
||||
} else if (key === 'VOLT_VSCAN') {
|
||||
showKey = 'VScan'
|
||||
showValue = (value / 5000) - 5 + 'V'
|
||||
} else {
|
||||
continue
|
||||
}
|
||||
this.content += ' ' + showKey + ': ' + showValue + '<br/>'
|
||||
}
|
||||
} else if (this.deviceName === 'EliteEIS') {
|
||||
for (const [key, value] of Object.entries(params)) {
|
||||
let showKey = ''
|
||||
let showValue = value
|
||||
if (key === 'MODE') {
|
||||
showKey = 'MODE'
|
||||
for (let i = 0; i < this.eisWorkingModeOptions.length; i++) {
|
||||
if (this.eisWorkingModeOptions[i].id === value) {
|
||||
showValue = this.eisWorkingModeOptions[i].description
|
||||
}
|
||||
}
|
||||
// EIS
|
||||
} else if (key === 'DC_BIAS') {
|
||||
showKey = 'DC Voltage'
|
||||
showValue = String(Math.round((parseInt(value) * 2200) / 4095)) + 'mV' // [TODO] unit
|
||||
} else if (key === 'AC_AMP') {
|
||||
showKey = 'AC Amplitude'
|
||||
showValue = String(Math.round(parseInt(value) / 2047 * 800)) // [TODO] unit
|
||||
} else if (key === 'FREQ_START') {
|
||||
showKey = 'Frequency Range Start'
|
||||
showValue = String(parseFloat(Math.round(parseFloat((value * 0.0149) * 100)) / 100).toFixed(1)) === '0.0' ? '0.015' : String(parseFloat(Math.round(parseFloat((value * 0.0149) * 100)) / 100).toFixed(1))
|
||||
} else if (key === 'FREQ_STOP') {
|
||||
showKey = 'Frequency Range End'
|
||||
showValue = String(parseFloat(Math.round(parseFloat((value * 0.0149) * 100)) / 100).toFixed(1)) === '0.0' ? '0.015' : String(parseFloat(Math.round(parseFloat((value * 0.0149) * 100)) / 100).toFixed(1))
|
||||
} else if (key === 'PPD') {
|
||||
showKey = 'Points Per Decades'
|
||||
showValue = value
|
||||
} else if (key === 'SCALE') {
|
||||
showKey = 'Point Spacing'
|
||||
const scaleArr = ['Logarithm', 'Linear']
|
||||
showValue = scaleArr[value]
|
||||
} else if (key === 'DELAY') {
|
||||
showKey = 'Delay'
|
||||
showValue = parseFloat((value / 10)).toFixed(1)
|
||||
} else if (key === 'AVERAGE_NUM') {
|
||||
showKey = 'Average'
|
||||
const numArr = ['2', '4', '6', '8']
|
||||
showValue = numArr[value]
|
||||
} else if (key === 'RTIA') {
|
||||
showKey = 'Current Range'
|
||||
const numArr = ['1', '2', '3', '4', 'Auto']
|
||||
showValue = numArr[value]
|
||||
// CV
|
||||
} else if (key === 'ADC_LEVEL_I_15') {
|
||||
showKey = 'Current Range'
|
||||
const currentRangeArr = ['<1.5 μA', '1-60 μA', '40-175 μA', '>120 uA', 'Auto']
|
||||
showValue = currentRangeArr[value]
|
||||
} else if (key === 'ADC_LEVEL_V_IN_15') {
|
||||
showKey = 'Voltage Range'
|
||||
const voltageInRangeArr = ['1', '2', '3', 'Auto']
|
||||
showValue = voltageInRangeArr[value]
|
||||
} else if (key === 'CTRL_HIGH_Z_15') {
|
||||
showKey = 'High Z'
|
||||
const highzArr = ['On', 'Off']
|
||||
showValue = highzArr[value]
|
||||
} else if (key === 'VOLT_INITIAL') {
|
||||
showKey = 'E Initial'
|
||||
showValue = parseInt((parseFloat(value) - 25000) / 5) / 1000 + 'V' // [TODO] unit
|
||||
} else if (key === 'VOLT_MAX') {
|
||||
showKey = 'E1'
|
||||
showValue = parseInt((parseFloat(value) - 25000) / 5) / 1000 + 'V' // [TODO] unit
|
||||
} else if (key === 'VOLT_MIN') {
|
||||
showKey = 'E2'
|
||||
showValue = parseInt((parseFloat(value) - 25000) / 5) / 1000 + 'V' // [TODO] unit
|
||||
} else if (key === 'Scan_Rate') {
|
||||
showKey = 'Voltage Scan Rate'
|
||||
showValue = parseFloat(value) / 100 // [TODO] unit
|
||||
} else if (key === 'SAMPLE_RATE') {
|
||||
showKey = 'Resolution'
|
||||
showValue = parseFloat(value) / 10 // [TODO] unit
|
||||
} else if (key === 'CYCLE_NUMBER') {
|
||||
showKey = 'Cycle'
|
||||
showValue = parseInt(value)
|
||||
} else {
|
||||
continue
|
||||
const remainParams = showParams.filter((e) => { // 差集
|
||||
return duplicateParam.indexOf(e) === -1
|
||||
})
|
||||
for (const key of remainParams) {
|
||||
this.fillShowDict(key, params[key])
|
||||
}
|
||||
} else {
|
||||
for (const key of showParams) {
|
||||
this.fillShowDict(key, params[key])
|
||||
}
|
||||
this.content += ' ' + showKey + ': ' + showValue + '<br/>'
|
||||
}
|
||||
}
|
||||
this.dump()
|
||||
},
|
||||
fillShowDict (key, value) {
|
||||
const expVal = paramTable[this.deviceName][key].rev_func(value)
|
||||
const name = paramTable[this.deviceName][key].showName
|
||||
const unit = paramTable[this.deviceName][key].defaultUnit
|
||||
this.showDict[name] = unit !== undefined ? expVal.toString() + unit : expVal.toString()
|
||||
},
|
||||
dump () {
|
||||
for (const [showKey, showValue] of Object.entries(this.showDict)) {
|
||||
this.content += ' ' + showKey + ': ' + showValue + '<br/>'
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<span> Resample: {{ currentScale }} to 1 </span>
|
||||
<p class="display-6"> Resample: {{ currentScale }} to 1 <p/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<p :style="{color: this.$themes.primary}" class="display-6"> High pass filter </p>
|
||||
<cutoff-freq/>
|
||||
<filter-order/>
|
||||
<filter-button ref="filterButtonRef" @loadFilterData="loadFilterData"/>
|
||||
<p :style="{color: this.$themes.danger}" class="display-6"> Threshold </p>
|
||||
<threshold/>
|
||||
<br/>
|
||||
@@ -14,7 +15,7 @@
|
||||
<wave-length/>
|
||||
<prethreshold/>
|
||||
<refractory-period/>
|
||||
<detect-button @loadChartData="loadChartData"/>
|
||||
<detect-button ref="detectButtonRef" @loadThresholdData="loadThresholdData"/>
|
||||
</va-card>
|
||||
</div>
|
||||
</template>
|
||||
@@ -28,6 +29,7 @@ import RefractoryPeriod from '@/components/analysis/spike/item/RefractoryPeriod.
|
||||
import Threshold from '@/components/analysis/spike/item/Threshold.vue'
|
||||
import WaveLength from '@/components/analysis/spike/item/WaveLength.vue'
|
||||
import DetectButton from '@/components/analysis/spike/item/DetectButton.vue'
|
||||
import FilterButton from '@/components/analysis/spike/item/FilterButton.vue'
|
||||
|
||||
export default {
|
||||
name: 'control-panel',
|
||||
@@ -35,6 +37,7 @@ export default {
|
||||
Channels,
|
||||
CutoffFreq,
|
||||
FilterOrder,
|
||||
FilterButton,
|
||||
Prethreshold,
|
||||
RefractoryPeriod,
|
||||
Threshold,
|
||||
@@ -53,12 +56,28 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
init () {
|
||||
this.enableFilterButton()
|
||||
},
|
||||
refreshChart (options) {
|
||||
this.$emit('refreshChart', options)
|
||||
},
|
||||
loadChartData () {
|
||||
this.$emit('loadChartData')
|
||||
loadThresholdData () {
|
||||
this.$emit('loadThresholdData')
|
||||
},
|
||||
loadFilterData () {
|
||||
this.$emit('loadFilterData')
|
||||
},
|
||||
enableFilterButton () {
|
||||
this.$refs.filterButtonRef.enableButton()
|
||||
},
|
||||
disableFilterButton () {
|
||||
this.$refs.filterButtonRef.disableButton()
|
||||
},
|
||||
enableDetectButton () {
|
||||
this.$refs.detectButtonRef.enableButton()
|
||||
},
|
||||
disableDetectButton () {
|
||||
this.$refs.detectButtonRef.disableButton()
|
||||
},
|
||||
},
|
||||
// use watch because va-select with @change will have bug
|
||||
|
||||
@@ -9,7 +9,11 @@
|
||||
<span slot="header">Control Panel</span>
|
||||
<div slot="body">
|
||||
<div>
|
||||
<control-panel :ref="'control_panel'" @loadChartData="drawSpikeData"/>
|
||||
<control-panel
|
||||
:ref="'control_panel'"
|
||||
@loadFilterData="loadFilterData"
|
||||
@loadThresholdData="loadThresholdData"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</va-collapse>
|
||||
@@ -36,6 +40,7 @@ import SpikeOverviewChart from './SpikeOverviewChart.vue'
|
||||
import SpikeChart from './SpikeChart.vue'
|
||||
import ControlPanel from './ControlPanel.vue'
|
||||
import api from '@/data/api/index'
|
||||
import { taskInfo } from '@/data/task/TaskInfo'
|
||||
import types from '@/store/modules/analysis/spike/types'
|
||||
import { mapFields } from 'vuex-map-fields'
|
||||
import newSeries from '@/factories/chart/seriesFactory'
|
||||
@@ -55,6 +60,7 @@ export default {
|
||||
'metaList',
|
||||
'selectedChannel',
|
||||
'cutoffFreq',
|
||||
'filterOrder',
|
||||
'selectedThreshold',
|
||||
'upperThreshold',
|
||||
'lowerThreshold',
|
||||
@@ -88,11 +94,63 @@ export default {
|
||||
dataInfo: {},
|
||||
maxTime: 0,
|
||||
chartAreaClass: ['flex', 'xs12', 'sm12', 'md12', 'xl9', 'pa-0'],
|
||||
randomColorArray: [],
|
||||
controllerList: [],
|
||||
}
|
||||
},
|
||||
mqtt: {
|
||||
async '+/analysis/spike_detect/+/+/+' (data, topic) {
|
||||
const topicSplitArray = topic.split('/')
|
||||
if (this.metaList.some(e => e.id === parseInt(topicSplitArray[4]))) {
|
||||
if (topicSplitArray[3] === 'data') {
|
||||
const utf8decoder = new TextDecoder()
|
||||
const dataStr = utf8decoder.decode(data)
|
||||
const dataArray = JSON.parse(dataStr)
|
||||
|
||||
this.chartOverviewData.series[0].data.push(...dataArray)
|
||||
} else if (topicSplitArray[3] === 'time_mark') {
|
||||
const utf8decoder = new TextDecoder()
|
||||
const timeMarkStr = JSON.parse(utf8decoder.decode(data))
|
||||
const timeMarkObj = timeMarkStr.split(' ')
|
||||
|
||||
this.drawTimeMark(timeMarkObj)
|
||||
} else if (topicSplitArray[3] === 'detect_signal') {
|
||||
const utf8decoder = new TextDecoder()
|
||||
const detectSignalStr = utf8decoder.decode(data)
|
||||
const detectSignalObj = Object.values(JSON.parse(detectSignalStr))
|
||||
|
||||
this.drawThresholdData(detectSignalObj)
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
getControllerList: async function () {
|
||||
const update = async () => {
|
||||
this.controllerList.push({
|
||||
id: taskInfo.getTaskInfo().controllerID,
|
||||
mac: '',
|
||||
status: 'loading',
|
||||
isScan: true,
|
||||
})
|
||||
}
|
||||
await update()
|
||||
},
|
||||
mqttSub: function (val) {
|
||||
this.$mqtt.subscribe(val)
|
||||
},
|
||||
mqttUnSub: function (val) {
|
||||
this.$mqtt.unsubscribe(val)
|
||||
},
|
||||
mqttPub: function (topic, mes) {
|
||||
this.$mqtt.publish(topic, mes)
|
||||
},
|
||||
pageMqttSub: function (id) {
|
||||
this.mqttSub(id + '/analysis/spike_detect/+/+/+')
|
||||
},
|
||||
pageMqttUnSub: function (id) {
|
||||
this.mqttUnSub(id + '/analysis/spike_detect/+/+')
|
||||
},
|
||||
showChartLoading: function (chart) {
|
||||
const loadStyle = {
|
||||
text: '',
|
||||
@@ -183,19 +241,36 @@ export default {
|
||||
this.chartOverviewData.xAxis[0].min = 0
|
||||
this.chartOverviewData.xAxis[0].max = this.maxTime
|
||||
},
|
||||
drawSpikeData: async function () {
|
||||
loadFilterData: async function () {
|
||||
this.showChartLoading('overview')
|
||||
this.showChartLoading('detail')
|
||||
for (const meta in this.dataInfo) {
|
||||
let metaInfo
|
||||
this.metaList.forEach(_meta => {
|
||||
if (parseInt(_meta.id) === parseInt(meta)) {
|
||||
metaInfo = _meta
|
||||
}
|
||||
})
|
||||
const sampleRate = metaInfo.parameter_set.SAMPLE_RATE / JSON.parse(metaInfo.channels).length // Hz
|
||||
const period = 1e6 / sampleRate
|
||||
this.$refs.chart_detail.clear()
|
||||
this.$refs.control_panel.disableDetectButton()
|
||||
|
||||
for (const meta in this.dataInfo) {
|
||||
// reset overview chart
|
||||
|
||||
this.chartOverviewData.series[0].data.length = 0
|
||||
this.chartOverviewData.series[0].markArea.data.length = 0
|
||||
this.chartOverviewData.color = ['#000000'] // black
|
||||
|
||||
await api.analysis.spikeDetect({
|
||||
controller_id: this.controllerList[0].id,
|
||||
meta_id: meta,
|
||||
channel: this.selectedChannel,
|
||||
filter_order: this.filterOrder,
|
||||
cut_off_freq: this.cutoffFreq,
|
||||
data_type: 'filter_data',
|
||||
})
|
||||
|
||||
this.hideChartLoading('overview')
|
||||
this.$refs.control_panel.enableDetectButton()
|
||||
console.log(this.chartOverviewData)
|
||||
}
|
||||
},
|
||||
loadThresholdData: async function () {
|
||||
this.showChartLoading('detail')
|
||||
|
||||
for (const meta in this.dataInfo) {
|
||||
let thresholdValue
|
||||
if (this.selectedThreshold === 'over') {
|
||||
thresholdValue = this.upperThreshold
|
||||
@@ -203,147 +278,120 @@ export default {
|
||||
thresholdValue = this.lowerThreshold
|
||||
}
|
||||
|
||||
const randomColorArray = []
|
||||
|
||||
// [Region] whole processed signal
|
||||
const allSpikeData = await api.analysis.spikeDetect({
|
||||
id: meta,
|
||||
channel: this.selectedChannel,
|
||||
cut_off_freq: this.cutoffFreq,
|
||||
threshold: [
|
||||
`'${this.selectedThreshold}'`,
|
||||
thresholdValue,
|
||||
],
|
||||
waveForm: [this.waveLength, this.preThreshold, this.refractoryPeriod],
|
||||
ret_data_type: 'all',
|
||||
})
|
||||
|
||||
this.chartOverviewData.series[0].data.length = 0
|
||||
this.chartOverviewData.color = ['#000000'] // black
|
||||
const splitData = allSpikeData.data.split('\n')
|
||||
const allTimeArray = splitData[0].split(' ')
|
||||
const allTimeArrayLength = allTimeArray.length
|
||||
const allSignalIndexArray = splitData[1].split(' ')
|
||||
const allSignalArray = splitData[2].split(' ')
|
||||
const allTimeMarkIndexArray = splitData[3].split(' ')
|
||||
for (let i = 0; i < allSignalIndexArray.length; i++) {
|
||||
const signalIndex = parseInt(allSignalIndexArray[i])
|
||||
this.chartOverviewData.series[0].data.push([parseInt(allTimeArray[signalIndex]), allSignalArray[i]])
|
||||
}
|
||||
console.log('allTimeArray', allTimeArray)
|
||||
console.log('allSignalIndexArray', allSignalIndexArray)
|
||||
console.log('allSignalArray', allSignalArray)
|
||||
console.log('allTimeMarkIndexArray', allTimeMarkIndexArray)
|
||||
this.chartOverviewData.xAxis[0].min = parseInt(allTimeArray[0])
|
||||
this.chartOverviewData.xAxis[0].max = parseInt(allTimeArray[allTimeArrayLength - 1])
|
||||
this.chartOverviewData.xAxis[0].axisLabel.show = true
|
||||
|
||||
this.chartOverviewData.series[0].markArea.data.length = 0
|
||||
const timeMarkLength = allTimeMarkIndexArray.length
|
||||
for (let i = 0; i < timeMarkLength; i++) {
|
||||
// generate color array for overview markArea and detail chart series
|
||||
const randomColor = '#' + Math.floor(Math.random() * 16777215).toString(16) // ref: https://css-tricks.com/snippets/javascript/random-hex-color/
|
||||
randomColorArray.push(randomColor)
|
||||
if (Number.isInteger(parseInt(allTimeMarkIndexArray[i]))) { // cuz maybe is '' if no any match after filtering
|
||||
const timeMarkIndex = parseInt(allTimeMarkIndexArray[i])
|
||||
|
||||
let startIndex = timeMarkIndex - parseInt(this.preThreshold / period)
|
||||
let endIndex = timeMarkIndex + parseInt(this.refractoryPeriod / period)
|
||||
if (startIndex < 0) {
|
||||
startIndex = 0
|
||||
}
|
||||
if (endIndex > allTimeArrayLength - 1) {
|
||||
endIndex = allTimeArrayLength - 1
|
||||
}
|
||||
const startTime = parseInt(allTimeArray[startIndex])
|
||||
const endTime = parseInt(allTimeArray[endIndex])
|
||||
const overviewSignal = this.chartOverviewData.series[0].data
|
||||
|
||||
for (let i = 0; i < overviewSignal.length; i++) {
|
||||
if (startTime <= overviewSignal[i][0]) {
|
||||
startIndex = i
|
||||
break
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < overviewSignal.length; i++) {
|
||||
if (endTime <= overviewSignal[i][0]) {
|
||||
endIndex = i
|
||||
break
|
||||
}
|
||||
}
|
||||
this.chartOverviewData.series[0].markArea.data.push([
|
||||
{
|
||||
itemStyle: {
|
||||
color: randomColor,
|
||||
},
|
||||
name: String(i + 1),
|
||||
xAxis: overviewSignal[startIndex][0],
|
||||
},
|
||||
{
|
||||
xAxis: overviewSignal[endIndex][0],
|
||||
},
|
||||
])
|
||||
}
|
||||
}
|
||||
// [EndRegion]
|
||||
|
||||
// [Region] each detailed signal piece
|
||||
const spikeData = await api.analysis.spikeDetect({
|
||||
id: meta,
|
||||
channel: this.selectedChannel,
|
||||
cut_off_freq: this.cutoffFreq,
|
||||
threshold: [
|
||||
`'${this.selectedThreshold}'`,
|
||||
thresholdValue,
|
||||
],
|
||||
waveForm: [this.waveLength, this.preThreshold, this.refractoryPeriod],
|
||||
ret_data_type: 'partial',
|
||||
})
|
||||
|
||||
for (let i = 0; i < this.chartDetailData.series.length; i++) {
|
||||
this.chartDetailData.series[i].name = ''
|
||||
this.chartDetailData.series[i].data.length = 0
|
||||
}
|
||||
const detailSignalArray = Object.values(spikeData.data)
|
||||
if (detailSignalArray.length <= 8) {
|
||||
this.chartDetailData.tooltip.show = true
|
||||
} else {
|
||||
this.chartDetailData.tooltip.show = false
|
||||
}
|
||||
this.chartDetailData.legend.data.length = 0
|
||||
this.chartDetailData.legend.type = 'scroll'
|
||||
this.chartDetailData.legend.top = '0.25%'
|
||||
// this.chartDetailData.legendpageButtonPosition = 'start'
|
||||
this.chartDetailData.animation = false
|
||||
this.chartDetailData.color = []
|
||||
for (let i = 0; i < detailSignalArray.length; i++) {
|
||||
const detailSignal = detailSignalArray[i].split(' ')
|
||||
const arrayLength = detailSignal.length
|
||||
const step = parseInt(this.waveLength) / (arrayLength - 1)
|
||||
const xAxisIndex = 0
|
||||
const yAxisIndex = 0
|
||||
const legendName = 'T_' + String(i + 1)
|
||||
if (this.chartDetailData.series.length <= i) {
|
||||
const _series = newSeries('line', legendName, xAxisIndex, yAxisIndex, [-1, -1], [metaInfo.name, this.selectedChannel], null, null)
|
||||
this.chartDetailData.series.push(_series)
|
||||
}
|
||||
for (let j = 0; j < arrayLength; j++) {
|
||||
this.chartDetailData.series[i].data.push([j * step, detailSignal[j]])
|
||||
}
|
||||
// push legendName
|
||||
this.chartDetailData.legend.data.push(legendName)
|
||||
this.chartDetailData.series[i].name = legendName
|
||||
// set legend and series color
|
||||
this.chartDetailData.color.push(randomColorArray[i])
|
||||
}
|
||||
this.chartDetailData.xAxis[0].min = 0
|
||||
this.chartDetailData.xAxis[0].max = parseInt(this.waveLength)
|
||||
this.chartDetailData.xAxis[0].axisLabel.show = true
|
||||
// [EndRegion]
|
||||
|
||||
await api.analysis.spikeDetect({
|
||||
controller_id: this.controllerList[0].id,
|
||||
meta_id: meta,
|
||||
channel: this.selectedChannel,
|
||||
cut_off_freq: this.cutoffFreq,
|
||||
filter_order: this.filterOrder,
|
||||
threshold: [
|
||||
`'${this.selectedThreshold}'`,
|
||||
thresholdValue,
|
||||
],
|
||||
waveForm: [this.waveLength, this.preThreshold, this.refractoryPeriod],
|
||||
ret_data_type: 'threshold_data',
|
||||
})
|
||||
}
|
||||
this.hideChartLoading('detail')
|
||||
},
|
||||
drawThresholdData (detailSignalArray) {
|
||||
if (detailSignalArray.length <= 8) {
|
||||
this.chartDetailData.tooltip.show = true
|
||||
} else {
|
||||
this.chartDetailData.tooltip.show = false
|
||||
}
|
||||
this.chartDetailData.legend.data.length = 0
|
||||
this.chartDetailData.legend.type = 'scroll'
|
||||
this.chartDetailData.legend.top = '0.25%'
|
||||
// this.chartDetailData.legendpageButtonPosition = 'start'
|
||||
this.chartDetailData.animation = false
|
||||
this.chartDetailData.color = []
|
||||
|
||||
for (let i = 0; i < detailSignalArray.length; i++) {
|
||||
const detailSignal = detailSignalArray[i].split(' ')
|
||||
const arrayLength = detailSignal.length
|
||||
const step = parseInt(this.waveLength) / (arrayLength - 1)
|
||||
const xAxisIndex = 0
|
||||
const yAxisIndex = 0
|
||||
const legendName = 'T_' + String(i + 1)
|
||||
if (this.chartDetailData.series.length <= i) {
|
||||
const _series = newSeries('line', legendName, xAxisIndex, yAxisIndex, [-1, -1], ['metaInfo.name', this.selectedChannel], null, null)
|
||||
this.chartDetailData.series.push(_series)
|
||||
}
|
||||
for (let j = 0; j < arrayLength; j++) {
|
||||
this.chartDetailData.series[i].data.push([j * step, detailSignal[j]])
|
||||
}
|
||||
// push legendName
|
||||
this.chartDetailData.legend.data.push(legendName)
|
||||
this.chartDetailData.series[i].name = legendName
|
||||
// set legend and series color
|
||||
this.chartDetailData.color.push(this.randomColorArray[i])
|
||||
}
|
||||
this.chartDetailData.xAxis[0].min = 0
|
||||
this.chartDetailData.xAxis[0].max = parseInt(this.waveLength)
|
||||
this.chartDetailData.xAxis[0].axisLabel.show = true
|
||||
},
|
||||
drawTimeMark (timeMarkArray, period) {
|
||||
// reset overview
|
||||
this.chartOverviewData.series[0].markArea.data.length = 0
|
||||
|
||||
const timeMarkLength = timeMarkArray.length
|
||||
|
||||
for (let i = 0; i < timeMarkLength; i++) {
|
||||
// generate color array for overview markArea and detail chart series
|
||||
const randomColor = '#' + Math.floor(Math.random() * 16777215).toString(16) // ref: https://css-tricks.com/snippets/javascript/random-hex-color/
|
||||
this.randomColorArray.push(randomColor)
|
||||
if (Number.isInteger(parseInt(timeMarkArray[i]))) { // cuz maybe is '' if no any match after filtering
|
||||
const timeMark = parseInt(timeMarkArray[i])
|
||||
|
||||
let startTime = timeMark - parseInt(this.preThreshold)
|
||||
let endTime = timeMark + parseInt(this.refractoryPeriod)
|
||||
if (startTime < 0) {
|
||||
startTime = 0
|
||||
}
|
||||
if (endTime > timeMark) {
|
||||
endTime = timeMark
|
||||
}
|
||||
|
||||
const overviewSignal = this.chartOverviewData.series[0].data
|
||||
|
||||
let startIndex = 0
|
||||
let endIndex = 0
|
||||
|
||||
for (let i = 0; i < overviewSignal.length; i++) {
|
||||
if (startTime <= overviewSignal[i][0]) {
|
||||
startIndex = i
|
||||
break
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < overviewSignal.length; i++) {
|
||||
if (endTime <= overviewSignal[i][0]) {
|
||||
endIndex = i
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
this.chartOverviewData.series[0].markArea.data.push([
|
||||
{
|
||||
itemStyle: {
|
||||
color: randomColor,
|
||||
borderColor: randomColor,
|
||||
borderWidth: 1,
|
||||
},
|
||||
name: String(i + 1),
|
||||
xAxis: overviewSignal[startIndex][0],
|
||||
},
|
||||
{
|
||||
xAxis: overviewSignal[endIndex][0],
|
||||
},
|
||||
])
|
||||
}
|
||||
}
|
||||
this.hideChartLoading()
|
||||
console.log(this.chartOverviewData)
|
||||
console.log(this.chartDetailData)
|
||||
},
|
||||
...mapActions('spike', [types.chart.init, types.chart.initSelectedChannel, types.chart.register, types.chart.clear, types.chart.updateGridList, types.chart.updateDataZoom]),
|
||||
...mapActions('spike', [types.meta.init]),
|
||||
@@ -359,6 +407,9 @@ export default {
|
||||
watch: {
|
||||
},
|
||||
async mounted () {
|
||||
this.getControllerList()
|
||||
this.pageMqttSub(this.controllerList[0].id)
|
||||
|
||||
const metaIDList = this.$route.params.metaList.split('-')
|
||||
await this.initMeta({ metaIDList: metaIDList, api: api })
|
||||
this.metaList = this.getAllMeta()
|
||||
@@ -371,6 +422,7 @@ export default {
|
||||
this.$refs.control_panel.init()
|
||||
},
|
||||
beforeDestroy () {
|
||||
this.pageMqttUnSub(this.controllerList[0].id)
|
||||
this.$refs.chart_detail.clear()
|
||||
for (const id in this.chartData) {
|
||||
for (const _series of this.chartData[id].series) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<va-button class="right" small @click="startDetect">
|
||||
<va-button class="right" small @click="startDetect" :disabled="isDisable">
|
||||
Start Detect
|
||||
</va-button>
|
||||
</div>
|
||||
@@ -29,13 +29,20 @@ export default {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
isDisable: true,
|
||||
}
|
||||
},
|
||||
mqtt: {
|
||||
},
|
||||
methods: {
|
||||
startDetect () {
|
||||
this.$emit('loadChartData')
|
||||
this.$emit('loadThresholdData')
|
||||
},
|
||||
enableButton () {
|
||||
this.isDisable = false
|
||||
},
|
||||
disableButton () {
|
||||
this.isDisable = true
|
||||
},
|
||||
...mapMutations('spike', [types.chart.updateAxisLabel]),
|
||||
},
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<template>
|
||||
<div class="flex xl12 md12 sm12 xs12 mb-4">
|
||||
<va-button class="right" small @click="startFilter" :disabled="isDisable">
|
||||
Start Filter
|
||||
</va-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import types from '@/store/modules/analysis/spike/types'
|
||||
import { mapFields } from 'vuex-map-fields'
|
||||
import { mapMutations } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'FilterButton',
|
||||
components: {
|
||||
},
|
||||
computed: {
|
||||
...mapFields('spike', [
|
||||
'chartDetailData',
|
||||
'selectedChannel',
|
||||
'waveLength',
|
||||
]),
|
||||
},
|
||||
props: {
|
||||
},
|
||||
created () {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
isDisable: true,
|
||||
}
|
||||
},
|
||||
mqtt: {
|
||||
},
|
||||
methods: {
|
||||
startFilter () {
|
||||
this.$emit('loadFilterData')
|
||||
},
|
||||
enableButton () {
|
||||
this.isDisable = false
|
||||
},
|
||||
disableButton () {
|
||||
this.isDisable = true
|
||||
},
|
||||
...mapMutations('spike', [types.chart.updateAxisLabel]),
|
||||
},
|
||||
async mounted () {
|
||||
},
|
||||
destroyed () {
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,37 @@
|
||||
<template>
|
||||
<!-- <va-card
|
||||
class="horizontal-bars"
|
||||
> -->
|
||||
<div class="row">
|
||||
<div class="flex md12 xs12">
|
||||
<va-progress-bar
|
||||
:value="value"
|
||||
>
|
||||
{{ value }} %
|
||||
</va-progress-bar>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </va-card> -->
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'progress-bar',
|
||||
data () {
|
||||
return {
|
||||
}
|
||||
},
|
||||
props: {
|
||||
value: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
mounted () {
|
||||
},
|
||||
destroyed () {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,56 @@
|
||||
<template>
|
||||
<va-modal
|
||||
class="flex sm12 xl12 md12 xs12"
|
||||
v-model="showProgressModal"
|
||||
size="small"
|
||||
:title="title"
|
||||
hide-default-actions
|
||||
>
|
||||
<progressBar
|
||||
:value="value"
|
||||
:ref="'progressBarRef'"
|
||||
/>
|
||||
</va-modal>
|
||||
</template>
|
||||
<script>
|
||||
import progressBar from '@/components/common/progressBarByValueModal/progressBar.vue'
|
||||
|
||||
export default {
|
||||
name: 'progress-bar-modal',
|
||||
components: {
|
||||
progressBar,
|
||||
},
|
||||
|
||||
data () {
|
||||
return {
|
||||
showProgressModal: false,
|
||||
value: 0,
|
||||
title: '',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
show () {
|
||||
this.showProgressModal = true
|
||||
},
|
||||
hide () {
|
||||
this.showProgressModal = false
|
||||
},
|
||||
setTitle (title) {
|
||||
this.title = title
|
||||
},
|
||||
setValue (value) {
|
||||
this.value = value
|
||||
},
|
||||
addValue () {
|
||||
this.value += 1
|
||||
},
|
||||
reset () {
|
||||
this.value = 0
|
||||
},
|
||||
progressDone () {
|
||||
this.$refs.progressBarRef.progressDone()
|
||||
this.hide()
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,54 @@
|
||||
<template>
|
||||
<!-- <va-card
|
||||
class="horizontal-bars"
|
||||
> -->
|
||||
<div class="row">
|
||||
<div class="flex md12 xs12 mb-2 mt-2">
|
||||
<va-progress-bar
|
||||
:value="progressValue"
|
||||
>
|
||||
{{ progressValue }} %
|
||||
</va-progress-bar>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </va-card> -->
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'progress-bar',
|
||||
data () {
|
||||
return {
|
||||
progressValue: 0,
|
||||
timeInterval: null,
|
||||
}
|
||||
},
|
||||
props: {
|
||||
// unit: sec
|
||||
time: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
animateValues () {
|
||||
this.timeInterval = setInterval(() => {
|
||||
this.progressValue += 1
|
||||
|
||||
if (this.progressValue === 99) {
|
||||
clearInterval(this.timeInterval)
|
||||
}
|
||||
}, parseInt(this.time * 10))
|
||||
},
|
||||
progressDone () {
|
||||
this.progressValue = 100
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
this.animateValues()
|
||||
},
|
||||
destroyed () {
|
||||
clearInterval(this.timeInterval)
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,56 @@
|
||||
<template>
|
||||
<va-modal
|
||||
class="flex sm12 xl12 md12 xs12"
|
||||
v-model="showProgressModal"
|
||||
size="small"
|
||||
:title="title"
|
||||
:noOutsideDismiss="true"
|
||||
hide-default-actions
|
||||
>
|
||||
<progressBar
|
||||
:time="time"
|
||||
:ref="'progressBarRef'"
|
||||
/>
|
||||
<div class="flex-center sm12 xl12 md12 xs12">
|
||||
<va-button @click="hide">Cancel</va-button>
|
||||
</div>
|
||||
</va-modal>
|
||||
</template>
|
||||
<script>
|
||||
import progressBar from '@/components/common/progressBarModal/progressBar.vue'
|
||||
|
||||
export default {
|
||||
name: 'progress-bar-modal',
|
||||
components: {
|
||||
progressBar,
|
||||
},
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
// unit: sec
|
||||
time: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
showProgressModal: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
show () {
|
||||
this.showProgressModal = true
|
||||
},
|
||||
hide () {
|
||||
this.showProgressModal = false
|
||||
},
|
||||
progressDone () {
|
||||
this.$refs.progressBarRef.progressDone()
|
||||
this.hide()
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
<div class="row flex">
|
||||
<div
|
||||
class="flex sm12 xl6 md12 xs12 ma-0"
|
||||
class="flex sm12 xl12 md12 xs12 ma-0"
|
||||
v-for="device in controller.devices" :key="device.addr"
|
||||
>
|
||||
<div v-if="!controller.isScan || device.status == 'connected'">
|
||||
@@ -94,6 +94,35 @@
|
||||
</va-card>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="flex sm12 xl6 md12 xs12 ma-0"
|
||||
v-for="trigger in triggerList" :key="trigger.mac"
|
||||
>
|
||||
<div v-if="!controller.isScan">
|
||||
<va-card
|
||||
style="background-color: #f8f8f8; box-shadow: 5px 5px 0 0 #f1f1f1;"
|
||||
class="ma-0 pa-0"
|
||||
>
|
||||
<va-item :key="trigger.mac" class="pa-0 ma-0"
|
||||
>
|
||||
<!-- <va-item-section avatar class="ml-1">
|
||||
<va-avatar style="border-radius: 0;">
|
||||
<img :src="trigger.pic" :alt="trigger.name">
|
||||
</va-avatar>
|
||||
</va-item-section> -->
|
||||
<va-item-section class="ml-3">
|
||||
<va-item-label>
|
||||
{{ trigger.name }}
|
||||
<va-badge class="px-1 py-0 ml-2 mt-0" color="success">connected</va-badge>
|
||||
</va-item-label>
|
||||
<va-item-label caption>
|
||||
{{ trigger.mac }}
|
||||
</va-item-label>
|
||||
</va-item-section>
|
||||
</va-item>
|
||||
</va-card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -138,14 +167,20 @@
|
||||
|
||||
<script>
|
||||
import api from '@/data/api/index'
|
||||
import { taskInfo } from '../../data/task/TaskInfo'
|
||||
import { taskInfo } from '@/data/task/TaskInfo'
|
||||
import { FulfillingBouncingCircleSpinner } from 'epic-spinners'
|
||||
import { mapFields } from 'vuex-map-fields'
|
||||
|
||||
export default {
|
||||
name: 'devices-overview',
|
||||
components: {
|
||||
FulfillingBouncingCircleSpinner,
|
||||
},
|
||||
computed: {
|
||||
...mapFields('device', [
|
||||
'triggerList',
|
||||
]),
|
||||
},
|
||||
created () {
|
||||
},
|
||||
data () {
|
||||
@@ -189,6 +224,7 @@ export default {
|
||||
battery: device.battery,
|
||||
library_name: device.library_name,
|
||||
library_version: device.library_version,
|
||||
record_in_sd: device.record_in_sd,
|
||||
status: device.status,
|
||||
pic: taskInfo.getDevicePic(device.device_name),
|
||||
loading: false,
|
||||
@@ -247,6 +283,44 @@ export default {
|
||||
})
|
||||
}
|
||||
},
|
||||
'+/data-server/trigger_manager/#' (data, topic) {
|
||||
const mes = new TextDecoder('utf-8').decode(data)
|
||||
const topicSplit = topic.split('/')
|
||||
const baseIndex = topicSplit.indexOf('trigger_manager')
|
||||
const actionIndex = baseIndex + 1
|
||||
const action = topicSplit[actionIndex]
|
||||
const macIndex = baseIndex + 2
|
||||
let _mac
|
||||
if (topicSplit.length - 1 >= macIndex) {
|
||||
_mac = topicSplit[macIndex]
|
||||
}
|
||||
let foundIndex
|
||||
let mesJson
|
||||
switch (action) {
|
||||
case 'info_all': // control_ID/data-server/trigger_manager/info_all
|
||||
this.triggerList = JSON.parse(mes)
|
||||
break
|
||||
case 'register': // control_ID/data-server/trigger_manager/register
|
||||
mesJson = JSON.parse(mes)
|
||||
foundIndex = this.triggerList.findIndex(o => o.mac === mesJson.mac)
|
||||
if (foundIndex < 0) { // -1: not found
|
||||
this.triggerList.push(mesJson)
|
||||
} else {
|
||||
this.triggerList[foundIndex] = mesJson
|
||||
}
|
||||
break
|
||||
case 'remove': // control_ID/data-server/trigger_manager/remove/device_mac
|
||||
foundIndex = this.triggerList.findIndex(o => o.mac === _mac)
|
||||
this.triggerList.splice(foundIndex, 1)
|
||||
break
|
||||
case 'info': // control_ID/data-server/trigger_manager/info/device_mac
|
||||
foundIndex = this.triggerList.findIndex(o => o.mac === _mac)
|
||||
this.triggerList[foundIndex] = mesJson
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
},
|
||||
async '+/broadcast' (data, topic) {
|
||||
const topicSplit = topic.split('/')
|
||||
const mes = String.fromCharCode.apply(null, data).split(':')
|
||||
@@ -287,6 +361,10 @@ export default {
|
||||
header: 'device_update_calibration/0',
|
||||
device: parseInt(mes[1]),
|
||||
}))
|
||||
this.mqttPub(topicSplit[0] + '_user', JSON.stringify({
|
||||
header: 'device_sd_card_status/0',
|
||||
device: parseInt(mes[1]),
|
||||
}))
|
||||
// this.mqttPub(topicSplit[0] + '_user', JSON.stringify({
|
||||
// header: 'device_parent/0',
|
||||
// device: parseInt(mes[1]),
|
||||
@@ -341,14 +419,14 @@ export default {
|
||||
default:
|
||||
break
|
||||
}
|
||||
console.log(String.fromCharCode.apply(null, data), topic)
|
||||
// console.log(String.fromCharCode.apply(null, data), topic)
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
getControllerList: async function () {
|
||||
const update = async () => {
|
||||
this.controllerList.push({
|
||||
id: 'tommy_test',
|
||||
id: taskInfo.getTaskInfo().controllerID,
|
||||
mac: '',
|
||||
status: 'loading',
|
||||
isScan: true,
|
||||
@@ -374,6 +452,7 @@ export default {
|
||||
this.mqttSub(controller.id + '/hardware_device_connect/+')
|
||||
this.mqttSub(controller.id + '/hardware_scan/+')
|
||||
this.mqttSub(controller.id + '/broadcast')
|
||||
this.mqttSub(controller.id + '/data-server/trigger_manager/#')
|
||||
})
|
||||
},
|
||||
pageMqttUnSub: function () {
|
||||
@@ -384,6 +463,7 @@ export default {
|
||||
this.mqttUnSub(controller.id + '/hardware_device_connect/+')
|
||||
this.mqttUnSub(controller.id + '/hardware_scan/+')
|
||||
this.mqttUnSub(controller.id + '/broadcast')
|
||||
this.mqttUnSub(controller.id + '/data-server/trigger_manager/#')
|
||||
})
|
||||
},
|
||||
pageInitPub: function () {
|
||||
@@ -398,6 +478,11 @@ export default {
|
||||
this.mqttPub(controller.id + '_user', JSON.stringify({
|
||||
header: 'hardware_info/0',
|
||||
}))
|
||||
this.mqttPub(controller.id + '/client/trigger_manager/scan', '{}')
|
||||
this.mqttPub(controller.id + '/client/trigger_manager/info_all', '{}')
|
||||
// this.mqttPub(controller.id + '_user', JSON.stringify({
|
||||
// header: 'device_update_usb/0',
|
||||
// }))
|
||||
this.createInitialCollection('admin')
|
||||
})
|
||||
},
|
||||
@@ -419,6 +504,7 @@ export default {
|
||||
this.mqttPub(controller.id + '_user', JSON.stringify({
|
||||
header: 'hardware_scan/0',
|
||||
}))
|
||||
this.mqttPub(controller.id + '/client/trigger_manager/scan', '{}')
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -508,6 +594,7 @@ export default {
|
||||
watch: {
|
||||
},
|
||||
async mounted () {
|
||||
await taskInfo.updateTaskInfo()
|
||||
await this.getControllerList()
|
||||
|
||||
this.pageMqttSub()
|
||||
|
||||
@@ -21,6 +21,7 @@ import { FulfillingBouncingCircleSpinner } from 'epic-spinners'
|
||||
import { mapFields } from 'vuex-map-fields'
|
||||
import newDownload from '@/factories/file/downloadFactory'
|
||||
import newChannel from '@/factories/file/channelFactory'
|
||||
import { taskInfo } from '@/data/task/TaskInfo'
|
||||
|
||||
export default {
|
||||
name: 'Download',
|
||||
@@ -43,7 +44,7 @@ export default {
|
||||
getControllerList: async function () {
|
||||
const update = async () => {
|
||||
this.controllerList.push({
|
||||
id: 'tommy_test',
|
||||
id: taskInfo.getTaskInfo().controllerID,
|
||||
mac: '',
|
||||
status: 'loading',
|
||||
isScan: true,
|
||||
@@ -57,21 +58,32 @@ export default {
|
||||
position: 'bottom-right',
|
||||
})
|
||||
},
|
||||
chunkArray (rawDataIDArray, chunkSize) {
|
||||
const arrayLength = rawDataIDArray.length
|
||||
const results = []
|
||||
for (let index = 0; index < arrayLength; index += chunkSize) {
|
||||
results.push(rawDataIDArray.slice(index, index + chunkSize))
|
||||
}
|
||||
return results
|
||||
},
|
||||
...mapActions('download',
|
||||
[
|
||||
types.raw.rawDataByID,
|
||||
types.raw.rawDataByIDs,
|
||||
types.raw.rawSdDataByID,
|
||||
types.export.setHeader,
|
||||
types.export.setTitle,
|
||||
types.export.setData,
|
||||
types.downloadStream.writerClose,
|
||||
types.downloadStream.setDownloadStream,
|
||||
types.download.closeWriter,
|
||||
types.download.setStream,
|
||||
types.download.setSampleRate,
|
||||
types.download.setIDList,
|
||||
types.download.clearStream,
|
||||
],
|
||||
),
|
||||
...mapMutations('download',
|
||||
[
|
||||
types.download.setSampleRate,
|
||||
types.download.setdownloadIdList,
|
||||
types.download.clearIDList,
|
||||
],
|
||||
),
|
||||
},
|
||||
@@ -97,96 +109,123 @@ export default {
|
||||
const channelArray = JSON.parse(this.metaInfo.channels)
|
||||
const channelList = []
|
||||
|
||||
// split to different subfile by channel
|
||||
if (meta.device.library_name.indexOf('Neulive') >= 0) {
|
||||
if (channelArray.some(el => el >= 256)) {
|
||||
channelList.push(channelArray.filter(el => el < 256))
|
||||
channelList.push(channelArray.filter(el => (el >= 256 && el <= 259)))
|
||||
channelList.push(channelArray.filter(el => el < 256))
|
||||
} else {
|
||||
channelList.push(channelArray)
|
||||
}
|
||||
} else if (meta.device.library_name.indexOf('Elite') >= 0) {
|
||||
channelList.push(channelArray)
|
||||
}
|
||||
|
||||
while (channelList.length > 0) {
|
||||
this.downloadInfo = newDownload()
|
||||
this.downloadInfo.channel = channelList.pop()
|
||||
const channels = channelList.pop()
|
||||
|
||||
// download format
|
||||
this.downloadInfo.format = format
|
||||
let maxSplitFiles = 1
|
||||
let fileIndex = 0
|
||||
|
||||
// download device and filename
|
||||
if (meta.device.library_name.indexOf('Neulive') >= 0) {
|
||||
this.downloadInfo.device = [meta.device.library_name.slice(0, 7), meta.device.library_name.slice(7)]
|
||||
if (this.downloadInfo.channel.some(el => el >= 256 && el <= 259)) {
|
||||
this.downloadInfo.filename = meta.name + '-accerlate-' + format
|
||||
this.downloadInfo.size = parseInt(parseInt(meta.size) / 76)
|
||||
} else {
|
||||
this.downloadInfo.filename = meta.name + '-' + format
|
||||
this.downloadInfo.size = parseInt(meta.size)
|
||||
// find max raw data need sub file
|
||||
for (const rawDataIndex of channels) {
|
||||
const dataLength = meta.raw_data[rawDataIndex].length
|
||||
|
||||
maxSplitFiles = Math.max(maxSplitFiles, Math.ceil(meta.raw_data[rawDataIndex].length / dataLength))
|
||||
meta.raw_data[rawDataIndex] = this.chunkArray(meta.raw_data[rawDataIndex], dataLength)
|
||||
}
|
||||
|
||||
while (fileIndex < maxSplitFiles) {
|
||||
// create new download info & add channel
|
||||
if (this.downloadInfo === null) {
|
||||
this.downloadInfo = newDownload()
|
||||
}
|
||||
} else if (meta.device.library_name.indexOf('Elite') >= 0) {
|
||||
this.downloadInfo.device = [meta.device.library_name.slice(0, 5), meta.device.library_name.slice(5)]
|
||||
this.downloadInfo.filename = meta.name + '-' + format
|
||||
this.downloadInfo.size = parseInt(meta.size)
|
||||
}
|
||||
this.downloadInfo.channel = channels
|
||||
|
||||
// init
|
||||
// download format
|
||||
this.downloadInfo.format = format
|
||||
|
||||
// get sampleRate && downloadList
|
||||
for (const channel of this.downloadInfo.channel) {
|
||||
this.downloadInfo.channelInfo[channel] = newChannel()
|
||||
this.setSampleRateDownload({ channel: channel })
|
||||
this.setdownloadIdListDownload({ channel: channel })
|
||||
}
|
||||
// download device and filename
|
||||
if (meta.device.library_name.indexOf('Neulive') >= 0) {
|
||||
this.downloadInfo.device = [meta.device.library_name.slice(0, 7), meta.device.library_name.slice(7)]
|
||||
if (this.downloadInfo.channel.some(el => el >= 256 && el <= 259)) {
|
||||
this.downloadInfo.filename = meta.name + '-accerlate'
|
||||
this.downloadInfo.filename += (sd !== undefined) ? '-sd' : ''
|
||||
this.downloadInfo.size = parseInt(parseInt(meta.size) / (76 * (maxSplitFiles)))
|
||||
} else {
|
||||
this.downloadInfo.filename = meta.name
|
||||
this.downloadInfo.filename += (sd !== undefined) ? '-sd' : ''
|
||||
this.downloadInfo.size = parseInt(meta.size / (maxSplitFiles))
|
||||
}
|
||||
} else if (meta.device.library_name.indexOf('Elite') >= 0) {
|
||||
this.downloadInfo.device = [meta.device.library_name.slice(0, 5), meta.device.library_name.slice(5)]
|
||||
this.downloadInfo.filename = meta.name
|
||||
this.downloadInfo.size = parseInt(meta.size / (maxSplitFiles))
|
||||
}
|
||||
|
||||
// create writer
|
||||
this.setDownloadStream()
|
||||
|
||||
console.log(this.downloadInfo)
|
||||
console.log(this.metaInfo)
|
||||
|
||||
// set Header
|
||||
if (this.downloadInfo.format !== 'csv-edf') {
|
||||
this.setHeaderExport()
|
||||
}
|
||||
this.setTitleExport()
|
||||
|
||||
// start download data
|
||||
let rowIndex = 0
|
||||
|
||||
while (rowIndex < this.downloadInfo.maxRows) {
|
||||
// create new channel info & get sample rate
|
||||
for (const channel of this.downloadInfo.channel) {
|
||||
for (const idx in this.downloadInfo.channelInfo[channel].downloadIDList) {
|
||||
const _idx = parseInt(idx)
|
||||
const rawID = this.downloadInfo.channelInfo[channel].downloadIDList[_idx][rowIndex]
|
||||
// console.log(rowIndex, _idx, rawID)
|
||||
if (rawID !== undefined) {
|
||||
if (sd === 'sd') {
|
||||
await this.rawSdDataByIDRaw({
|
||||
channel: channel,
|
||||
rawID: rawID,
|
||||
idx: _idx,
|
||||
api: api,
|
||||
})
|
||||
} else {
|
||||
await this.rawDataByIDRaw({
|
||||
channel: channel,
|
||||
rawID: rawID,
|
||||
idx: _idx,
|
||||
api: api,
|
||||
})
|
||||
if (this.downloadInfo.channelInfo[channel] === undefined) {
|
||||
this.downloadInfo.channelInfo[channel] = newChannel()
|
||||
this.setSampleRateDownload({ channel: channel })
|
||||
}
|
||||
}
|
||||
|
||||
// set download ID list
|
||||
this.clearIDListDownload()
|
||||
for (const channel of this.downloadInfo.channel) {
|
||||
this.setIDListDownload({ channel: channel, fileIndex: fileIndex })
|
||||
}
|
||||
|
||||
// if create writer
|
||||
this.clearStreamDownload()
|
||||
this.setStreamDownload()
|
||||
|
||||
// set Header
|
||||
if (this.downloadInfo.format !== 'csv-edf') {
|
||||
await this.setHeaderExport()
|
||||
}
|
||||
await this.setTitleExport()
|
||||
|
||||
// start download data
|
||||
let rowIndex = 0
|
||||
|
||||
while (rowIndex < this.downloadInfo.maxRows) {
|
||||
for (const channel of this.downloadInfo.channel) {
|
||||
for (const idx in this.downloadInfo.channelInfo[channel].downloadIDList) {
|
||||
const _idx = parseInt(idx)
|
||||
const rawID = this.downloadInfo.channelInfo[channel].downloadIDList[_idx][rowIndex]
|
||||
// const rawID = this.downloadInfo.channelInfo[channel].downloadIDList[_idx].splice(0, 10).join(',')
|
||||
// console.log(rowIndex, _idx, rawID)
|
||||
if (rawID !== undefined) {
|
||||
if (sd === 'sd') {
|
||||
await this.rawSdDataByIDRaw({
|
||||
channel: channel,
|
||||
rawID: rawID,
|
||||
idx: _idx,
|
||||
api: api,
|
||||
})
|
||||
} else {
|
||||
await this.rawDataByIDRaw({
|
||||
channel: channel,
|
||||
rawID: rawID,
|
||||
idx: _idx,
|
||||
api: api,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
await this.setDataExport({ last: (rowIndex >= this.downloadInfo.maxRows - 1) })
|
||||
rowIndex += 1
|
||||
}
|
||||
this.setDataExport({ last: (rowIndex === this.downloadInfo.maxRows - 1) })
|
||||
rowIndex += 1
|
||||
this.closeWriterDownload()
|
||||
fileIndex += 1
|
||||
}
|
||||
this.writerCloseDownloadStream()
|
||||
}
|
||||
}
|
||||
}
|
||||
await new Promise(resolve => setTimeout(resolve, 2000)) // sleep
|
||||
await new Promise(resolve => setTimeout(resolve, 2000)) // sleep 2s prevent window close
|
||||
window.close()
|
||||
},
|
||||
destroyed () {
|
||||
|
||||
@@ -0,0 +1,239 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="row flex sm12 xl12 md12 xs12" style="height: 100vh;">
|
||||
<div class="flex-center spinner-box mt-4 mb-5">
|
||||
<fulfilling-bouncing-circle-spinner
|
||||
:animation-duration="3000"
|
||||
:color="'#6c7fee'"
|
||||
:size="60"
|
||||
>
|
||||
</fulfilling-bouncing-circle-spinner>
|
||||
<progress-modal
|
||||
:ref="'progressModalRef'"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import api from '@/data/api/index'
|
||||
import types from '@/store/modules/download/types'
|
||||
import { mapActions, mapMutations } from 'vuex'
|
||||
import { FulfillingBouncingCircleSpinner } from 'epic-spinners'
|
||||
import { mapFields } from 'vuex-map-fields'
|
||||
import newDownload from '@/factories/file/downloadFactory'
|
||||
import newChannel from '@/factories/file/channelFactory'
|
||||
import progressModal from '@/components/common/progressBarByValueModal/progressModal.vue'
|
||||
import { taskInfo } from '@/data/task/TaskInfo'
|
||||
|
||||
export default {
|
||||
name: 'DownloadOffline',
|
||||
components: {
|
||||
FulfillingBouncingCircleSpinner,
|
||||
progressModal,
|
||||
},
|
||||
data: () => {
|
||||
return {
|
||||
controllerList: [],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapFields('download', [
|
||||
'metaList',
|
||||
'downloadInfo',
|
||||
'metaInfo',
|
||||
]),
|
||||
},
|
||||
methods: {
|
||||
getControllerList: async function () {
|
||||
const update = async () => {
|
||||
this.controllerList.push({
|
||||
id: taskInfo.getTaskInfo().controllerID,
|
||||
mac: '',
|
||||
status: 'loading',
|
||||
isScan: true,
|
||||
files: [],
|
||||
})
|
||||
}
|
||||
await update()
|
||||
},
|
||||
notify (name) {
|
||||
this.showToast(`done ${name}`, {
|
||||
position: 'bottom-right',
|
||||
})
|
||||
},
|
||||
chunkArray (rawDataIDArray, chunkSize) {
|
||||
const arrayLength = rawDataIDArray.length
|
||||
const results = []
|
||||
for (let index = 0; index < arrayLength; index += chunkSize) {
|
||||
results.push(rawDataIDArray.slice(index, index + chunkSize))
|
||||
}
|
||||
return results
|
||||
},
|
||||
...mapActions('download',
|
||||
[
|
||||
types.raw.rawDataByID,
|
||||
types.raw.rawDataByIDs,
|
||||
types.raw.rawSdDataByID,
|
||||
types.export.setHeader,
|
||||
types.export.setTitle,
|
||||
types.export.setData,
|
||||
types.export.setAll,
|
||||
types.download.closeWriter,
|
||||
types.download.setStream,
|
||||
types.download.setSampleRate,
|
||||
types.download.setIDList,
|
||||
],
|
||||
),
|
||||
...mapMutations('download',
|
||||
[
|
||||
types.download.clearIDList,
|
||||
],
|
||||
),
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
async mounted () {
|
||||
await this.getControllerList()
|
||||
// TODO authorization
|
||||
const format = this.$route.params.format
|
||||
this.metaList = this.$route.params.metaList.split('-')
|
||||
const sd = this.$route.params.sd
|
||||
|
||||
while (this.metaList.length !== 0) {
|
||||
let meta
|
||||
const metaID = this.metaList.pop()
|
||||
const ret = await api.meta.getByID(metaID)
|
||||
|
||||
if (ret.status === 200) {
|
||||
meta = ret.data[0]
|
||||
}
|
||||
if (meta !== undefined) {
|
||||
this.metaInfo = meta
|
||||
const channelArray = JSON.parse(this.metaInfo.channels)
|
||||
const channelList = []
|
||||
|
||||
if (meta.device.library_name.indexOf('Neulive') >= 0) {
|
||||
if (channelArray.some(el => el >= 256)) {
|
||||
channelList.push(channelArray.filter(el => (el >= 256 && el <= 259)))
|
||||
channelList.push(channelArray.filter(el => el < 256))
|
||||
} else {
|
||||
channelList.push(channelArray)
|
||||
}
|
||||
} else if (meta.device.library_name.indexOf('Elite') >= 0) {
|
||||
channelList.push(channelArray)
|
||||
}
|
||||
|
||||
this.$refs.progressModalRef.show()
|
||||
|
||||
while (channelList.length > 0) {
|
||||
const channels = channelList.pop()
|
||||
|
||||
let maxSplitFiles = 1
|
||||
let fileIndex = 0
|
||||
|
||||
// find max raw data need sub file
|
||||
for (const rawDataIndex of Object.keys(meta.raw_data)) {
|
||||
let dataLength = 0
|
||||
if (rawDataIndex >= 256) {
|
||||
dataLength = meta.raw_data[rawDataIndex].length
|
||||
} else {
|
||||
dataLength = 160
|
||||
}
|
||||
|
||||
maxSplitFiles = Math.max(maxSplitFiles, Math.ceil(meta.raw_data[rawDataIndex].length / dataLength))
|
||||
meta.raw_data[rawDataIndex] = this.chunkArray(meta.raw_data[rawDataIndex], dataLength)
|
||||
}
|
||||
|
||||
while (fileIndex < maxSplitFiles) {
|
||||
if (this.downloadInfo === null) {
|
||||
this.downloadInfo = newDownload()
|
||||
}
|
||||
this.downloadInfo.channel = channels
|
||||
// download format
|
||||
this.downloadInfo.format = format
|
||||
|
||||
// download device and filename
|
||||
if (meta.device.library_name.indexOf('Neulive') >= 0) {
|
||||
this.downloadInfo.device = [meta.device.library_name.slice(0, 7), meta.device.library_name.slice(7)]
|
||||
if (this.downloadInfo.channel.some(el => el >= 256 && el <= 259)) {
|
||||
this.downloadInfo.filename = meta.name + '-accerlate-' + format
|
||||
this.downloadInfo.filename += (sd !== undefined) ? '-sd' : ''
|
||||
this.downloadInfo.size = parseInt(parseInt(meta.size) / 76)
|
||||
} else {
|
||||
this.downloadInfo.filename = meta.name + '-' + format
|
||||
this.downloadInfo.filename += (sd !== undefined) ? '-sd' : ''
|
||||
this.downloadInfo.size = parseInt(meta.size)
|
||||
}
|
||||
} else if (meta.device.library_name.indexOf('Elite') >= 0) {
|
||||
this.downloadInfo.device = [meta.device.library_name.slice(0, 5), meta.device.library_name.slice(5)]
|
||||
this.downloadInfo.filename = meta.name + '-' + (fileIndex + 1).toString()
|
||||
this.downloadInfo.size = parseInt(meta.size)
|
||||
}
|
||||
|
||||
this.$refs.progressModalRef.setTitle(this.downloadInfo.filename)
|
||||
|
||||
// get sampleRate && downloadList
|
||||
for (const channel of this.downloadInfo.channel) {
|
||||
if (this.downloadInfo.channelInfo[channel] === undefined) {
|
||||
this.downloadInfo.channelInfo[channel] = newChannel()
|
||||
this.setSampleRateDownload({ channel: channel })
|
||||
}
|
||||
}
|
||||
|
||||
this.clearIDListDownload()
|
||||
for (const channel of this.downloadInfo.channel) {
|
||||
this.setIDListDownload({ channel: channel, fileIndex: fileIndex })
|
||||
}
|
||||
|
||||
// start download data
|
||||
fileIndex += 1
|
||||
let rowIndex = 0
|
||||
|
||||
while (rowIndex < this.downloadInfo.maxRows) {
|
||||
this.$refs.progressModalRef.setValue(parseInt((rowIndex / this.downloadInfo.maxRows) * 100))
|
||||
for (const channel of this.downloadInfo.channel) {
|
||||
for (const idx in this.downloadInfo.channelInfo[channel].downloadIDList) {
|
||||
const _idx = parseInt(idx)
|
||||
const rawID = this.downloadInfo.channelInfo[channel].downloadIDList[_idx][rowIndex]
|
||||
// console.log(rowIndex, _idx, rawID)
|
||||
if (rawID !== undefined) {
|
||||
if (sd === 'sd') {
|
||||
await this.rawSdDataByIDRaw({
|
||||
channel: channel,
|
||||
rawID: rawID,
|
||||
idx: _idx,
|
||||
api: api,
|
||||
})
|
||||
} else {
|
||||
await this.rawDataByIDRaw({
|
||||
channel: channel,
|
||||
rawID: rawID,
|
||||
idx: _idx,
|
||||
api: api,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
rowIndex += 1
|
||||
}
|
||||
await this.setAllExport({ last: (rowIndex >= this.downloadInfo.maxRows - 1) })
|
||||
this.$refs.progressModalRef.setValue(100)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
await new Promise(resolve => setTimeout(resolve, 2000)) // sleep
|
||||
window.close()
|
||||
},
|
||||
destroyed () {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.filter-button {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
@@ -1,589 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<va-modal
|
||||
class="flex sm12 xl12 md12 xs12 pa-0 ma-0"
|
||||
v-model="showDownload"
|
||||
size="small"
|
||||
:hideDefaultActions="true"
|
||||
:mobileFullscreen="false"
|
||||
>
|
||||
<template slot="header">
|
||||
<div class="row mb-2">
|
||||
<va-icon name="fa fa-download mr-3 " color="primary"/>
|
||||
<h5 class="mt-0 mb-0">{{'Download'}}</h5>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="downloadOptionsList">
|
||||
<template v-for="(downloadOptions, i) in downloadOptionsList">
|
||||
<va-accordion :key="downloadOptions.filename">
|
||||
<va-collapse>
|
||||
<va-item :key="downloadOptions.filename" slot="header" clickable>
|
||||
<va-item-section avatar>
|
||||
<va-item-label>
|
||||
{{ downloadOptions.filename }}
|
||||
</va-item-label>
|
||||
</va-item-section>
|
||||
|
||||
<va-item-section>
|
||||
<!-- <va-item-label>
|
||||
{{ downloadInfo.minTime }}
|
||||
</va-item-label>
|
||||
|
||||
<va-item-label caption>
|
||||
{{ downloadInfo.maxTime }}
|
||||
</va-item-label> -->
|
||||
</va-item-section>
|
||||
|
||||
<va-item-section v-if="downloadOptions.download.status == 'idle'" side>
|
||||
<va-icon name="fa fa-play" color="gray" @click.native.stop="confirmDownload(downloadOptions.metaPath)"/>
|
||||
</va-item-section>
|
||||
<va-item-section v-else side class="md4 offset--md8">
|
||||
<div class="row flex sm12 xl12 md12 xs12">
|
||||
<div class="flex-center spinner-box">
|
||||
<fulfilling-bouncing-circle-spinner
|
||||
:animation-duration="3000"
|
||||
:color="'#6c7fee'"
|
||||
:size="20"
|
||||
>
|
||||
</fulfilling-bouncing-circle-spinner>
|
||||
<span class="ml-3">{{loaded}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</va-item-section>
|
||||
|
||||
</va-item>
|
||||
<div slot="body">
|
||||
<div v-if="downloadOptions.download.status == 'downloading'" class="row flex sm12 xl12 md12 xs12">
|
||||
<div class="row flex sm12 xl12 md12 xs12">
|
||||
<div class="flex-center spinner-box mt-4 mb-5">
|
||||
<fulfilling-bouncing-circle-spinner
|
||||
:animation-duration="3000"
|
||||
:color="'#6c7fee'"
|
||||
:size="60"
|
||||
>
|
||||
</fulfilling-bouncing-circle-spinner>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="mb-5">
|
||||
<va-item class="flex sm12 xl12 md12 xs12 mr-1 pa-0">
|
||||
<va-icon
|
||||
class="flex sm1 xl1 md1 xs1 start "
|
||||
name="glyphicon glyphicon-filter"
|
||||
size="1.0rem"
|
||||
:fixedWidth = "Boolean('true')"
|
||||
/>
|
||||
<div class="flex sm11 xl11 md11 xs11 row">
|
||||
<div v-for="(item,index) in downloadOptions.channel" :key="item.channel" class="filter-button">
|
||||
<va-button
|
||||
class="mx-1 px-1"
|
||||
v-if="item.checked"
|
||||
@click="channelUnchecked(index,downloadOptions.metaPath)"
|
||||
small
|
||||
>
|
||||
{{item.alias}}
|
||||
</va-button>
|
||||
<va-button
|
||||
class="mx-1 px-1"
|
||||
v-else
|
||||
@click="channelChecked(index,downloadOptions.metaPath)"
|
||||
small outline
|
||||
>
|
||||
{{item.alias}}
|
||||
</va-button>
|
||||
</div>
|
||||
</div>
|
||||
</va-item>
|
||||
</div>
|
||||
<div class="mb-5">
|
||||
<va-item class="flex sm12 xl12 md12 xs12 pa-0">
|
||||
<va-icon
|
||||
class="flex sm1 xl1 md1 xs1 mr-4"
|
||||
:fixedWidth="true"
|
||||
name="va-icon glyphicon glyphicon-time"
|
||||
size="1.0rem"
|
||||
/>
|
||||
<div class="flex">
|
||||
<va-slider
|
||||
class="flex sm11 xl11 md11 xs11 filter-button"
|
||||
value-visible
|
||||
range
|
||||
v-model="downloadOptions.timeRange"
|
||||
@click.native="timeRangeChange(downloadOptions.timeRange,downloadOptions.metaPath)"
|
||||
@mouseup.native="timeRangeChange(downloadOptions.timeRange,downloadOptions.metaPath)"
|
||||
@mouseleave.native="timeRangeChange(downloadOptions.timeRange,downloadOptions.metaPath)"
|
||||
@touchend.native="timeRangeChange(downloadOptions.timeRange,downloadOptions.metaPath)"
|
||||
:min="downloadOptions.minTime"
|
||||
:max="downloadOptions.maxTime"
|
||||
/>
|
||||
<span> {{ transTime(downloadOptions.timeRange) }} </span>
|
||||
</div>
|
||||
</va-item>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</va-collapse>
|
||||
</va-accordion>
|
||||
<va-list-separator v-if="i < downloadOptionsList.length - 1" :key="'separator' + downloadOptions.filename" />
|
||||
</template>
|
||||
</div>
|
||||
</va-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { file } from '../../data/file/File'
|
||||
import { download } from '../../data/download/Download'
|
||||
import { exportData } from '../../data/export/export'
|
||||
import { FulfillingBouncingCircleSpinner } from 'epic-spinners'
|
||||
|
||||
export default {
|
||||
name: 'Download',
|
||||
components: {
|
||||
FulfillingBouncingCircleSpinner,
|
||||
},
|
||||
data: () => {
|
||||
return {
|
||||
showDownload: false,
|
||||
controllerList: [],
|
||||
downloadList: [],
|
||||
downloadListRecord: [],
|
||||
downloadOptionsList: [],
|
||||
// downloadInfo: {
|
||||
// metaPath: '',
|
||||
// previousPath: '',
|
||||
// filenameWithType: '',
|
||||
// filename: '',
|
||||
// channel: [],
|
||||
// timeRange: [0, 0],
|
||||
// minTime: 0,
|
||||
// maxTime: 0,
|
||||
// status: 'idle',
|
||||
// device: '',
|
||||
// },
|
||||
currentlyDownloadInfo: {
|
||||
metaPath: '',
|
||||
previousPath: '',
|
||||
filenameWithType: '',
|
||||
filename: '',
|
||||
channel: [],
|
||||
timeRange: [0, 0],
|
||||
minTime: 0,
|
||||
maxTime: 0,
|
||||
download: {
|
||||
status: 'idle',
|
||||
rate: 0,
|
||||
},
|
||||
device: '',
|
||||
},
|
||||
estimatedTime: 0,
|
||||
fileSegmentIndex: 0,
|
||||
fileSegmentMax: 0,
|
||||
totoalFileSize: 0,
|
||||
loadingPercent: 0,
|
||||
loadTime: 0,
|
||||
interval: null,
|
||||
data: '',
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// transTime (min,max) {
|
||||
// return this.getTimeInFormat(min) + ' - ' + this.getTimeInFormat(max)
|
||||
// },
|
||||
loaded () {
|
||||
return this.loadingPercent + '%'
|
||||
},
|
||||
},
|
||||
// mqtt: {
|
||||
// async '+/file_segment/+' (data, topic) {
|
||||
// console.log('file_segment')
|
||||
// console.log(String.fromCharCode.apply(null, data))
|
||||
// // console.log(navigator.connection.downlink)
|
||||
// // console.log(this.fileNum)
|
||||
// // console.log(this.downloadOptionsList.length)
|
||||
// // console.log(JSON.parse(String.fromCharCode.apply(null, data)).data.file_size)
|
||||
|
||||
// if (this.downloadOptionsList.length > 0) {
|
||||
// await download.updateFileSegmentInfo(String.fromCharCode.apply(null, data))
|
||||
// this.fileSegmentMax = download.getFileSegmentMaxIndex()
|
||||
// this.checkFileSegmentGetOrNot()
|
||||
// }
|
||||
// },
|
||||
// async '+/file_segment_get/+' (data, topic) {
|
||||
// console.log('file_segment_get')
|
||||
// console.log(JSON.parse(new TextDecoder('utf-8').decode(data)))
|
||||
// if (this.downloadOptionsList.length > 0) {
|
||||
// const segmentData = atob(JSON.parse(new TextDecoder('utf-8').decode(data)).data.segment)
|
||||
// this.data += segmentData
|
||||
|
||||
// this.fileSegmentIndex += 1
|
||||
// this.checkFileSegmentGetOrNot()
|
||||
// }
|
||||
// },
|
||||
// },
|
||||
methods: {
|
||||
transTime (timeRange) {
|
||||
return this.getTimeInFormat(timeRange[0]) + ' - ' + this.getTimeInFormat(timeRange[1])
|
||||
},
|
||||
notify (name) {
|
||||
this.showToast(`done ${name}`, {
|
||||
position: 'bottom-right',
|
||||
})
|
||||
},
|
||||
showDownloadModal: function () {
|
||||
this.showDownload = true
|
||||
},
|
||||
channelChecked: function (channelIndex, path) {
|
||||
download.getDownloadOptions(path).channel[channelIndex].checked = true
|
||||
this.refresh()
|
||||
},
|
||||
channelUnchecked: function (channelIndex, path) {
|
||||
download.getDownloadOptions(path).channel[channelIndex].checked = false
|
||||
this.refresh()
|
||||
},
|
||||
getTimeInFormat: function (time) {
|
||||
if (time < 60) {
|
||||
const second = time
|
||||
return `${second}s`
|
||||
} else if (time < 3600) {
|
||||
const second = time % 60
|
||||
const minute = parseInt(time / 60)
|
||||
return `${minute}m${second}s`
|
||||
} else {
|
||||
const hour = parseInt(time / 3600)
|
||||
const hourRemain = time % 3600
|
||||
const minute = parseInt(hourRemain / 60)
|
||||
const second = hourRemain % 60
|
||||
return `${hour}h${minute}m${second}s`
|
||||
}
|
||||
},
|
||||
getCurrentFullPathName: function () {
|
||||
return this.currentlyDownloadInfo.previousPath + '/' + this.currentlyDownloadInfo.filenameWithType
|
||||
},
|
||||
downloading: async function (info) {
|
||||
this.$emit('download')
|
||||
},
|
||||
addDownloadTask: async function (info) {
|
||||
this.downloading()
|
||||
/*
|
||||
** download all
|
||||
*/
|
||||
if (parseInt(info.time_duration) < 18e8) {
|
||||
const rawData = await download.getAllRawDatas(info)
|
||||
exportData.exportCSV(info, rawData)
|
||||
} else {
|
||||
for (const channelID in info.raw_data) {
|
||||
const rawDataIDList = info.raw_data[channelID]
|
||||
|
||||
while (rawDataIDList.length > 1000) {
|
||||
const _list = rawDataIDList.splice(0, 1000)
|
||||
const rawData = await download.getIndexRawDatas(info, channelID, _list)
|
||||
exportData.exportCSV(info, rawData)
|
||||
}
|
||||
const rawData = await download.getIndexRawDatas(info, channelID, rawDataIDList)
|
||||
exportData.exportCSV(info, rawData, channelID)
|
||||
rawData[channelID].length = 0
|
||||
// const rawData = await download.getAllRawDatas(info)
|
||||
// console.timeEnd('download')
|
||||
}
|
||||
}
|
||||
// console.time('download')
|
||||
// const rawData = await download.getAllRawDatas(info)
|
||||
// console.timeEnd('download')
|
||||
// exportData.exportCSV(info, rawData)
|
||||
|
||||
/*
|
||||
** download split
|
||||
*/
|
||||
this.downloading()
|
||||
},
|
||||
_addDownloadTask: function (downloadPath) {
|
||||
if (Array.isArray(downloadPath)) {
|
||||
downloadPath.forEach(path => {
|
||||
this.downloadList.push(path.path)
|
||||
this.updateDownloadInfo(path.path)
|
||||
})
|
||||
} else {
|
||||
this.downloadList.push(downloadPath)
|
||||
this.updateDownloadInfo(downloadPath)
|
||||
}
|
||||
this.confirmDownload()
|
||||
},
|
||||
refresh: function () {
|
||||
this.downloadOptionsList = download.getDownloadOptionsList()
|
||||
console.log(this.downloadOptionsList)
|
||||
},
|
||||
confirmDownload: function (path) {
|
||||
console.log('confirmDownload')
|
||||
console.log(download.getDownloadOptionsList())
|
||||
console.log(download.isFileDownloading())
|
||||
console.log(download.downloadTaskRemain())
|
||||
if (!download.isFileDownloading() && download.downloadTaskRemain()) {
|
||||
const downloadOptionsIndex = download.getDownloadOptionsList().findIndex(downloadInfo => downloadInfo.metaPath === path)
|
||||
// this.downloadBlockList[downloadInfoIndex].status = 'downloading'
|
||||
this.currentlyDownloadInfo = download.getDownloadOptionsList()[downloadOptionsIndex]
|
||||
this.currentlyDownloadInfo.download.status = 'downloading'
|
||||
console.log(this.currentlyDownloadInfo)
|
||||
console.log(download.getDownloadOptionsList())
|
||||
|
||||
download.updateDownloadSubFileList(
|
||||
this.currentlyDownloadInfo.metaPath,
|
||||
this.currentlyDownloadInfo.channel,
|
||||
this.currentlyDownloadInfo.timeRange,
|
||||
)
|
||||
this.calculateFileSize(this.currentlyDownloadInfo.metaPath)
|
||||
console.log('getactualsize')
|
||||
this.subfileListRemain()
|
||||
}
|
||||
// if (this.downloadList.length > 0 && this.currentlyDownloadInfo.status === 'idle') {
|
||||
// this.showDownload()
|
||||
// this.updateDownloadSubFileList(this.downloadList[0])
|
||||
// } else {
|
||||
// /* TODO If file downloading then waiting */
|
||||
// console.log('no download task or file downloading')
|
||||
// }
|
||||
},
|
||||
_confirmDownload: function () {
|
||||
console.log('confirmDownload')
|
||||
console.log(download.getDownloadOptionsList())
|
||||
// if (this.downloadList.length > 0 && this.currentlyDownloadInfo.status === 'idle') {
|
||||
// this.showDownload()
|
||||
// this.updateDownloadSubFileList(this.downloadList[0])
|
||||
// } else {
|
||||
// /* TODO If file downloading then waiting */
|
||||
// console.log('no download task or file downloading')
|
||||
// }
|
||||
},
|
||||
downloadAllSubFileList: async function (path) {
|
||||
this.currentlyDownloadInfo = this.downloadInfo
|
||||
download.downloadAllSubFileList(path)
|
||||
this.subfileListRemain()
|
||||
},
|
||||
// updateDownloadInfo: function (path) {
|
||||
// console.log(path)
|
||||
// const metaInfo = file.getMetaInfo(path)
|
||||
// const downloadInfoIndex = this.downloadBlockList.findIndex(downloadInfo => downloadInfo.metaPath === path)
|
||||
|
||||
// if (downloadInfoIndex === -1) {
|
||||
// this.downloadInfo.library = metaInfo.configuration._LIBRARY_
|
||||
// this.downloadInfo.channel = metaInfo.channel.map(ch => {
|
||||
// let channel = ''
|
||||
// if (this.downloadInfo.library.includes('Elite')) {
|
||||
// channel = (ch === 0) ? 'current' : (ch === 1) ? 'voltage' : (ch === 2) ? 'resistance' : ''
|
||||
// } else {
|
||||
// channel = 'channel' + ch
|
||||
// }
|
||||
// return {
|
||||
// alias: channel,
|
||||
// channel: ch,
|
||||
// checked: true,
|
||||
// }
|
||||
// })
|
||||
|
||||
// this.downloadInfo.metaPath = path
|
||||
// this.downloadInfo.previousPath = path.split('/').slice(0, -1).join('/')
|
||||
// this.downloadInfo.filename = path.split(/[\/.]+/).slice(0, -1).pop()
|
||||
// this.downloadInfo.minTime = parseInt([...new Set(metaInfo['start-time'])][0] / 1000)
|
||||
// this.downloadInfo.maxTime = parseInt(metaInfo.time_duration / 1000)
|
||||
// this.downloadInfo.timeRange = [this.downloadInfo.minTime, this.downloadInfo.maxTime]
|
||||
// this.downloadInfo.status = 'idle'
|
||||
// this.downloadBlockList.push(JSON.parse(JSON.stringify(this.downloadInfo)))
|
||||
// } else {
|
||||
// for (var item in this.downloadInfo) {
|
||||
// this.downloadInfo[item] = this.downloadBlockList[downloadInfoIndex][item]
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
updatecurrentlyDownloadInfo: function () {
|
||||
const downloadInfoIndex = this.downloadBlockList.findIndex(downloadInfo => downloadInfo.metaPath === this.currentlyDownloadInfo.metaPath)
|
||||
if (downloadInfoIndex !== -1) {
|
||||
for (var item in this.downloadBlockList[downloadInfoIndex]) {
|
||||
this.downloadBlockList[downloadInfoIndex][item] = this.currentlyDownloadInfo[item]
|
||||
}
|
||||
}
|
||||
},
|
||||
updateMetaDownloadInfo: function () {
|
||||
download.updateDownloadSubFileList(
|
||||
this.currentlyDownloadInfo.metaPath,
|
||||
this.currentlyDownloadInfo.channel,
|
||||
this.currentlyDownloadInfo.timeRange,
|
||||
)
|
||||
},
|
||||
updateDownloadSubFileList: function (path) {
|
||||
console.log('updateDownloadSubFileList')
|
||||
const downloadOptionsIndex = this.downloadBlockList.findIndex(downloadInfo => downloadInfo.metaPath === path)
|
||||
this.downloadBlockList[downloadOptionsIndex].status = 'downloading'
|
||||
this.currentlyDownloadInfo = this.downloadBlockList[downloadOptionsIndex]
|
||||
this.updatecurrentlyDownloadInfo()
|
||||
|
||||
download.updateDownloadSubFileList(
|
||||
this.currentlyDownloadInfo.metaPath,
|
||||
this.currentlyDownloadInfo.channel,
|
||||
this.currentlyDownloadInfo.timeRange,
|
||||
)
|
||||
this.subfileListRemain()
|
||||
},
|
||||
_updateDownloadSubFileList: function (path) {
|
||||
console.log(path)
|
||||
console.log(this.downloadInfo)
|
||||
const downloadOptionsIndex = this.downloadBlockList.findIndex(downloadInfo => downloadInfo.metaPath === path)
|
||||
this.downloadBlockList[downloadOptionsIndex].status = 'downloading'
|
||||
this.currentlyDownloadInfo = this.downloadBlockList[downloadOptionsIndex]
|
||||
// this.updatecurrentlyDownloadInfo()
|
||||
|
||||
download.updateDownloadSubFileList(
|
||||
this.currentlyDownloadInfo.metaPath,
|
||||
this.currentlyDownloadInfo.channel,
|
||||
this.currentlyDownloadInfo.timeRange,
|
||||
)
|
||||
this.subfileListRemain()
|
||||
},
|
||||
subfileListRemain: function () {
|
||||
console.log('subfileListRemain')
|
||||
if (download.checkDownloadSubFileList(this.currentlyDownloadInfo.metaPath)) {
|
||||
this.currentlyDownloadInfo.filenameWithType = download.getFirstSubfile(this.currentlyDownloadInfo.metaPath)
|
||||
} else {
|
||||
this.loadingPercent = 100
|
||||
console.log(this.currentlyDownloadInfo.filenameWithType + ' download complete')
|
||||
console.log(performance.now())
|
||||
this.exportCSV()
|
||||
this.test(this.downloadDone)
|
||||
// this.currentlyDownloadInfo.status = this.currentlyDownloadInfo.status = 'idle'
|
||||
// this.updatecurrentlyDownloadInfo()
|
||||
// this.loadingPercent = 0
|
||||
}
|
||||
},
|
||||
checkFileSegmentGetOrNot: function () {
|
||||
console.log('checkFileSegmentGetOrNot')
|
||||
if (this.fileSegmentIndex >= this.fileSegmentMax) {
|
||||
const subfile = file.shiftDownloadSubFileList(this.currentlyDownloadInfo.metaPath)
|
||||
file.pushDownloadData(this.currentlyDownloadInfo.metaPath, subfile, this.data)
|
||||
|
||||
this.data = ''
|
||||
this.fileSegmentIndex = 0
|
||||
this.subfileListRemain()
|
||||
} else {
|
||||
}
|
||||
},
|
||||
exportCSV: function () {
|
||||
exportData.exportCSV(this.currentlyDownloadInfo)
|
||||
},
|
||||
exportTXT: function () {
|
||||
},
|
||||
timeRangeChange: function (timeRange, path) {
|
||||
download.getDownloadOptions(path).timeRange = timeRange
|
||||
this.refresh()
|
||||
},
|
||||
calculateFileSize: function () {
|
||||
this.totoalFileSize = file.getFileSize(this.currentlyDownloadInfo.metaPath)
|
||||
// const allSubfile = download.getAllSubfile(this.currentlyDownloadInfo.metaPath)
|
||||
// this.fileNum = allSubfile.length
|
||||
const downlinkSpeed = this.getNetSpeed('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAABTVBMVEX////qQzU0qFNChfT7vAU/g/RZlPU5gPT7uQCxyPqXufn/vQDpNCLqQTMwp1D7uADpOCfqPS4fo0bpMiD8wADpLxwopUv0paD1q6b86ObpOiv4/Pn+9/b4xcH2ubX1r6rsXVIre/NwvoOf0qvO6NQzqUm/4cf5zMn739zrSz398O/sVEjvdWz2t7PvenP4ycb7wir96Lf+8tb8zFH93pj+9eH//PD92Yvw9v7+7cP80Xb95q6pxPnq9u1PsmigvvlunvaJyZiGrvjD1vvyl5HtamHoJgzwhH3zmpTtXlLvenHuYSzygCL2mxjsUzDwcSf0jx34phH8z2DxfVHX5P38x0KHvnDOtiGjsjJ0rkLhuRW4tCnS4PyMsDtZq0it2bhmmvbO5OE1noBft3U1pWA/jNc8lLk5nJNBieSSy58+j8t5wIo6mKY2o25FrmBHQXgmAAAIJUlEQVR4nO2b2V/bRhCAhbADxJLQYQvwgcE2PsAhEHK0SUxigoGkTdMj6ZXDTdw2JbT+/x9r+QDZllYra8da85vvKU/yfszszO5IEQQEQRAEQRAEQRAEQRAEQRAEQRAEQRAEQRAEQRDWpLfXSplbqysWq9n1Unk7HfaSmJFey6ycNipGwpDUAZKRSMxt7B6vl7fDXl5QyqvVHdVQk5o8N4osa0nJqDSOSzNrmc7sVlRVk8fl7J4dTbmRXQt7sf5JZ6onkkPknC3VxE52tiJZPtUMjcru0lI1dkthL5uaTMNI0kVvOJLGRnYmCmx2R/IXPpukVFnh3nG9IvkPn81R1bJhKxC5vWME8evHMRO2hitr1URQv65jospp81jRkgz8LJLaStgyDpSfqywC2ENWN7gL48rJpAXUGe3kVthKQ2w3DKZ+c9ZuPOWocZQqrHagHY4yNRuoBbqjaZyc444D90A35AQPmzFdlYD8uorht410Q4UTnJON0A3TOxA15pLE6nUXvOYRlI3wI9gAFZRCFxReQBaZufAjKBwDtgkeioyQZX4UtcFDIyz5PqrJsqYlk2oymdQ8hqhc7MHtih9Ba+4rVTaqp6fHZ2fHp7sNaxDuPk3lQVCo+iijmmQ0zjJr9ncx6e3Syq6WcBk6crAHhVXqTSirJ7sZ53l2unQsGQ6R5GAPCuUT2vCpz28RL7K3q+pIIDlo9B026EYWmlT1vuGVT1X707jYg8IKVauXjQbdDbZctd0wuYjgGtU7peTcOvUTM/KgcPFQZDqnNYo6Khu7fh6ZftENo8yHYCnhLajN+R3NZzsFh489KAg73jk6yZisXNE4EVz3boXG7iSjzrUKH4KC93EtcTzZkzmZAD9a/obsJ0tnYa8xEKm9SPxboqHEwZkrCPuLkUj8JSFRpdOwlxiQg0iH+PJ3boJqNewVBuTOYqSrGH/lLKjtcFIuJuZhz7Dj+L1jldHKYa8wIKnIJfEfHDJVoj+Kcsr+sk1xvG0kZ30T9uvMleNI25DV2fo2zYH7y5FhxZdDhgbfH/vQsL8YGVG0tw15J+z1BefHUcNIPPLqsvsbt8NeX2BSo35DbUPbCHt9wbkzFsJe2+iHkN/P0ai562gYiS9abUPeCHt5DDhwFOy3DZWT62sQ7u+5GVq3DY2bz3sm555zkvYUl38Ke3kM2F92N4wsPqJ8ytKNwLyGMnxAiGFk+T6t4WY0IJtLUIYPSYZ7tE9ZWpgPyMJNKMM3pCR9MD3D6FMgwftxUpLuT89wfh7KkMk2ZGG4CWR4j1RK49SPYWH4FYzh1yTDN1M1BGoXjwhZuvhwqobvYAxdzt09Q+pSysJw4VkIhnevvSHtmY2NIdChhnRom7Lh42tv+AQNJ4OjfRiG4XRraRiG0+2HQJWGnzMNVLcgnksPpmoI1PH5uVtAGXJ0PwQ6efNzx4e6PXEzpwG7AXMzawObYrCalwaftUWhDIkz72XqmffmAg0kwxtQhqT3FrH4z5RPeXeThiOC4cIRlCHh3VPsF0Wpsfyt14QgQh3aBPf3h7HYr6Jo5ln+FGm3QjV8wfXsHYv8Joqicsjyp46i7oZgzcLtPX7sd0W00IsMf4qwDcGG+oLLtxixt2IPpcXul95tuvuBvZixGP+eJhZ5Lw5gGMQj0jYEuv92GfsmKrb34VJQVNrMfmiBtA2Bzt1dRr9r6zQJ0YbeZPQ7pEoanYcrNMJIv+g2iSF0Rj2RVGZAt+Hwwa3XJIZQckx+hXh0Bd2GQ9V00CSGg8gkT28QduH8AtiXGD0ub1Cxtw6CIpOz2xPi7QPs2N2n3/RjsfcOft16mgr6E69JhRTwQ4wBB70M/eAs2DmeBu77xBwFT9JeSxxpEiNbsR7sB0jN3oKNBom98SYxohjokrFEOK/Ng1fSLo/GmwRDxWceEQS8V1whElI0aKI+I1aZTrsHu97bKepehqKem6yiegnCnkmvOPQMYqeiTtIXH296CEb/YO3iTME7iJ1M9n+V8qqinRDCzS+GyZkUivqFv0z9OO8pCDdGHKXmnaZWpio+wpi60D/d8FIEHEGNkqfIUyuMrQLd81J50RS3/vyLrDitXdiFotjQO9bybd16nmL+TVQEe+XkuCiqIHYdD5vk/Vi4UMzB32vrc9S9mi48nY5bH7o87TnquaKLZKpwruj2dNj67x/XMEancZyx0aKopzbJ1nmxVrN5pmq14nnL1EefoihfXBShPk9wpdam24qDlZu6Lh7mLur183r9Itc6FHXddLxDb/3rmKnA4xknaPr+WIDMHopC+PNsfXLqjNPOUYumf0U6ttrjbWNqp5kh6lCKytZo24B7ZUiG5vQ2GVuf5+2bcXrHtRFSfgqqT0V72wAecxMVD8EUTeXL5TwDfvpEUvTVM3wxaBvRKR64HRXBothpG91MhfvPeJSKcHuxd9sIW7CjmINqGt22Eb6gANgXLcWPYdt1aepA9UZRKK/Q4BREkM1otpl+hRSIWgsgUyedugKRZ52pSrD3HwDU2HZGU+RlC9rIk259/lDMOlcZOqCWY5Sq+iGHAexROGTgaJqsvssBoSgGdDTNcy4T1EYzQBwVU6nz0wPdKbbGpoR0fno7Pwt+FoW64jeQiuk+OeaSVDHnMhF10Zud8F3RkRSt2aiHXMdObDVnT69PoZlrm7qzpzUg1s12Ll+YpeR0IFUr5i9abd2iP/M2u/9ut+r5Ym3G7a5IpWqFYrOZt2g2i4VCLXVt3BAEQRAEQRAEQRAEQRAEQRAEQRAEQRAEQRAE4Yf/AZmODCZml4YgAAAAAElFTkSuQmCC', 3)
|
||||
// this.totoalFileSize = (allSubfile.length) * 1000000
|
||||
console.log(downlinkSpeed)
|
||||
console.log(this.totoalFileSize)
|
||||
this.estimatedTime = this.totoalFileSize / (downlinkSpeed * 1024)
|
||||
if (this.totoalFileSize >= 1 * 1024 * 1024) {
|
||||
console.log('size big')
|
||||
this.estimatedTime = this.estimatedTime * 10
|
||||
}
|
||||
console.log(this.estimatedTime)
|
||||
this.loadTime = parseInt((this.estimatedTime / 1000) % 60) * 100
|
||||
console.log(this.loadTime)
|
||||
this.doProgress()
|
||||
// allSubfile.forEach(subfile => {
|
||||
// console.log(subfile)
|
||||
// this.currentlyDownloadInfo.filenameWithType = subfile
|
||||
// })
|
||||
},
|
||||
doProgress () {
|
||||
const step = this.estimatedTime / 100 * 1000
|
||||
this.interval = setInterval(() => {
|
||||
if (this.loadingPercent >= 99) {
|
||||
console.log('complete')
|
||||
clearInterval(this.interval)
|
||||
this.estimatedTime = 0
|
||||
} else {
|
||||
this.loadingPercent++
|
||||
}
|
||||
}, step)
|
||||
},
|
||||
getNetSpeed (url, times) {
|
||||
const connection = window.navigator.connection
|
||||
if (connection && connection.downlink) {
|
||||
return connection.downlink * 1024 / 8
|
||||
}
|
||||
},
|
||||
test: async function (fn) {
|
||||
return await setTimeout(async function () {
|
||||
await fn()
|
||||
}, 1000)
|
||||
},
|
||||
downloadDone: function () {
|
||||
download.getDownloadOptionsList().shift()
|
||||
this.loadingPercent = 0
|
||||
this.refresh()
|
||||
this.confirmDownload()
|
||||
},
|
||||
getControllerList: async function () {
|
||||
const update = async () => {
|
||||
this.controllerList.push({
|
||||
id: 'tommy_test',
|
||||
mac: '',
|
||||
status: 'loading',
|
||||
isScan: true,
|
||||
files: [],
|
||||
})
|
||||
}
|
||||
await update()
|
||||
},
|
||||
mqttPub: function (topic, mes) {
|
||||
this.$mqtt.publish(topic, mes)
|
||||
},
|
||||
mqttSub: function (val) {
|
||||
this.$mqtt.subscribe(val)
|
||||
},
|
||||
mqttUnSub: function (val) {
|
||||
this.$mqtt.unsubscribe(val)
|
||||
},
|
||||
pageMqttSub: function () {
|
||||
this.controllerList.forEach(controller => {
|
||||
// this.mqttSub(controller.id + '/broadcast')
|
||||
this.mqttSub(controller.id + '/file_meta_info/+')
|
||||
this.mqttSub(controller.id + '/file_segment/+')
|
||||
this.mqttSub(controller.id + '/file_segment_get/+')
|
||||
})
|
||||
},
|
||||
pageMqttUnSub: function () {
|
||||
this.controllerList.forEach(controller => {
|
||||
// this.mqttUnSub(controller.id + '/broadcast')
|
||||
this.mqttUnSub(controller.id + '/file_meta_info/+')
|
||||
this.mqttUnSub(controller.id + '/file_segment/+')
|
||||
this.mqttUnSub(controller.id + '/file_segment_get/+')
|
||||
})
|
||||
},
|
||||
},
|
||||
// watch: {
|
||||
// loadingPercent(val) {
|
||||
// if (val >= 100) {
|
||||
// console.log('complete');
|
||||
// clearInterval(this.interval)
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
async mounted () {
|
||||
await this.getControllerList()
|
||||
this.pageMqttSub()
|
||||
},
|
||||
destroyed () {
|
||||
this.pageMqttUnSub()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.filter-button {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
@@ -9,6 +9,7 @@ import FileTable from './file-table/FileTable.vue'
|
||||
// import Download from '../download/Download.vue'
|
||||
import { file } from '../../data/file/File'
|
||||
import api from '../../data/api/index'
|
||||
import { taskInfo } from '@/data/task/TaskInfo'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -23,10 +24,11 @@ export default {
|
||||
getControllerList: async function () {
|
||||
const update = async () => {
|
||||
this.controllerList.push({
|
||||
id: 'tommy_test',
|
||||
id: taskInfo.getTaskInfo().controllerID,
|
||||
mac: '',
|
||||
status: 'loading',
|
||||
isScan: true,
|
||||
devices: [],
|
||||
})
|
||||
}
|
||||
await update()
|
||||
@@ -78,6 +80,7 @@ export default {
|
||||
},
|
||||
},
|
||||
async mounted () {
|
||||
await taskInfo.updateTaskInfo()
|
||||
await this.getControllerList()
|
||||
await api.auth.getJwtData()
|
||||
console.log(await api.meta.getByParentWithLimit('folder', 2, 5, 0, 'DESC'))
|
||||
|
||||
@@ -174,7 +174,14 @@
|
||||
</template>
|
||||
<template slot="actions" slot-scope="props" >
|
||||
<va-popover :message="`sdcard ${props.rowData.name}`" placement="top">
|
||||
<sd-card-button v-if="props.rowData.type !== 'folder' && props.rowData.device.library_name.indexOf('Neulive') >= 0" :meta="props.rowData" :uuidList="SDuuidList" @refreshPage="refreshPage" @downloadSdCard="downloadSdCard"/>
|
||||
<sd-card-button
|
||||
v-if="(props.rowData.type !== 'folder') && (props.rowData.device.library_name.indexOf('Neulive') >= 0) && (props.rowData.sd_data_record === true)"
|
||||
:meta="props.rowData"
|
||||
:uuidList="SDuuidList"
|
||||
:controller="controllerList[0]"
|
||||
@refreshPage="refreshPage"
|
||||
@downloadSdCard="downloadSdCard"
|
||||
/>
|
||||
</va-popover>
|
||||
<va-popover :message="`download ${props.rowData.name} in csv format`" placement="top">
|
||||
<va-button flat small color="gray" icon="fa fa-download" v-if="props.rowData.type !== 'folder' && props.rowData.device.library_name.indexOf('Neulive') >= 0" @click.stop="downloadCsv(props.rowData)"/>
|
||||
@@ -267,6 +274,7 @@ export default {
|
||||
},
|
||||
},
|
||||
SDuuidList: [],
|
||||
controllerList: [],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -653,35 +661,50 @@ export default {
|
||||
},
|
||||
downloadCsv: async function (meta) {
|
||||
const href = location.href.split('/')[2]
|
||||
if (meta.device.library_name.indexOf('Elite') >= 0) {
|
||||
window.open('http://' + href + '/#/download/csv/' + meta.id)
|
||||
} else if (meta.device.library_name.indexOf('Neulive') >= 0) {
|
||||
window.open('http://' + href + '/#/download/csv/' + meta.id)
|
||||
const connectCheck = await api.connection.check()
|
||||
if (connectCheck.status === 200) {
|
||||
window.open('http://' + href + '/#/download/online/csv/' + meta.id)
|
||||
} else {
|
||||
window.open('http://' + href + '/#/download/offline/csv/' + meta.id)
|
||||
}
|
||||
},
|
||||
downloadExcel: async function (meta) {
|
||||
const href = location.href.split('/')[2]
|
||||
const connectCheck = await api.connection.check()
|
||||
if (meta.device.library_name.indexOf('Elite') >= 0) {
|
||||
window.open('http://' + href + '/#/download/excel/' + meta.id)
|
||||
if (connectCheck.status === 200) {
|
||||
window.open('http://' + href + '/#/download/online/excel/' + meta.id)
|
||||
} else {
|
||||
window.open('http://' + href + '/#/download/offline/excel/' + meta.id)
|
||||
}
|
||||
} else if (meta.device.library_name.indexOf('Neulive') >= 0) {
|
||||
window.open('http://' + href + '/#/download/csv-edf/' + meta.id)
|
||||
if (connectCheck.status === 200) {
|
||||
window.open('http://' + href + '/#/download/online/csv-edf/' + meta.id)
|
||||
} else {
|
||||
window.open('http://' + href + '/#/download/offline/csv-edf/' + meta.id)
|
||||
}
|
||||
}
|
||||
},
|
||||
downloadSdCard: async function (meta) {
|
||||
const href = location.href.split('/')[2]
|
||||
if (meta.device.library_name.indexOf('Neulive') >= 0) {
|
||||
window.open('http://' + href + '/#/download/csv/' + meta.id + '/sd')
|
||||
if (window.navigator.onLine) {
|
||||
window.open('http://' + href + '/#/download/online/csv/' + meta.id + '/sd')
|
||||
} else {
|
||||
window.open('http://' + href + '/#/download/offline/csv/' + meta.id + '/sd')
|
||||
}
|
||||
}
|
||||
},
|
||||
async getSDuuidList () {
|
||||
// const uuidList = ['32abdb14-fc0c-11eb-9aa8-dca6326cbc6b', '940ca938-f662-11eb-8a41-dca6326cbc6b']
|
||||
let uuidList = []
|
||||
const ret = await api.sdcard.getuuidList()
|
||||
if (ret.status === 200) {
|
||||
uuidList = ret.data.split(' ')
|
||||
if (this.controllerList.length > 0) {
|
||||
if (this.controllerList[0].sd_uploading === false) {
|
||||
const ret = await api.sdcard.getuuidList()
|
||||
if (ret.status === 200) {
|
||||
this.SDuuidList = ret.data.data
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return uuidList
|
||||
},
|
||||
replay: function (meta) {
|
||||
if (meta.device.library_name.includes('Neulive') === true) {
|
||||
@@ -705,7 +728,9 @@ export default {
|
||||
},
|
||||
},
|
||||
async mounted () {
|
||||
this.SDuuidList = await this.getSDuuidList()
|
||||
const controllerList = await api.controller.getAll()
|
||||
this.controllerList = controllerList.data
|
||||
this.getSDuuidList()
|
||||
},
|
||||
destroyed () {
|
||||
},
|
||||
|
||||
@@ -24,32 +24,33 @@ export default {
|
||||
methods: {
|
||||
initMetaInfo (meta) {
|
||||
this.metaID = meta.id
|
||||
this.mac_address = meta.device.device_address.toString()
|
||||
// bytes array to hex string formamt
|
||||
this.mac_address = meta.device.device_address.map(data =>
|
||||
data.toString(16)
|
||||
.padStart(2, '0')
|
||||
.toUpperCase()).join(':')
|
||||
this.uuid = meta.uuid
|
||||
},
|
||||
async checkInSD (meta) {
|
||||
this.initMetaInfo(meta)
|
||||
this.pageToast('Start checking in SD card...')
|
||||
apiManager.startProgressBar()
|
||||
const result = await apiManager.call('Check_in_SD', this.metaID, this.mac_address, this.uuid)
|
||||
this.checkSDresult = result.data
|
||||
this.pageToast('In SD card: ' + this.checkSDresult)
|
||||
apiManager.endProgressBar()
|
||||
return result.data
|
||||
},
|
||||
async moveToDB (meta) {
|
||||
// async checkInSD (meta) {
|
||||
// this.initMetaInfo(meta)
|
||||
// this.pageToast('Start checking in SD card...')
|
||||
// apiManager.startProgressBar()
|
||||
// const result = await apiManager.call('Check_in_SD', this.metaID, this.mac_address, this.uuid)
|
||||
// this.checkSDresult = result.data
|
||||
// this.pageToast('In SD card: ' + this.checkSDresult)
|
||||
// apiManager.endProgressBar()
|
||||
// return result.data
|
||||
// },
|
||||
async moveToDB (meta, controller) {
|
||||
this.initMetaInfo(meta)
|
||||
this.pageToast('Start Moving to database...')
|
||||
apiManager.startProgressBar()
|
||||
await apiManager.call('Move_to_DB', this.metaID, this.mac_address, this.uuid)
|
||||
apiManager.endProgressBar()
|
||||
const result = await apiManager.call('Move_to_DB', controller.id, this.metaID, this.mac_address, this.uuid)
|
||||
return result
|
||||
},
|
||||
async deleteSDCard (meta) {
|
||||
async deleteSDCard (meta, controller) {
|
||||
this.initMetaInfo(meta)
|
||||
this.pageToast('Start deleting in SD card...')
|
||||
apiManager.startProgressBar()
|
||||
await apiManager.call('Delete_SD', this.metaID, this.mac_address, this.uuid)
|
||||
apiManager.endProgressBar()
|
||||
await apiManager.call('Delete_SD', controller.id, this.metaID, this.mac_address, this.uuid)
|
||||
},
|
||||
pageToast: function (mes) {
|
||||
this.showToast(
|
||||
|
||||
@@ -2,17 +2,24 @@
|
||||
<div>
|
||||
<!-- recorded = false, no icon; recorded = true, gray icon; uploaded = true, blue icon; in uuid list: gray icon + red exclam -->
|
||||
<va-button
|
||||
class="va-button--with-left-icon va-button--without-title"
|
||||
v-show="meta.sd_data_record === true"
|
||||
:icon="meta.sd_data_uploaded === true ? 'fa fa-download' : ''"
|
||||
:color="this.$themes.primary"
|
||||
@click.native.stop="performButtonAction()"
|
||||
flat
|
||||
small
|
||||
:color="meta.sd_data_uploaded === true ? this.$themes.primary : 'gray'"
|
||||
v-show="meta.sd_data_record === true"
|
||||
:icon="meta.sd_data_uploaded === true ? 'fa fa-download' : 'fa fa-usb'"
|
||||
@click.stop="performButtonAction()"
|
||||
>
|
||||
<!-- span -->
|
||||
<p :style="{color: this.$themes.danger}" class="display-6" v-show="uuidList.includes(uuid) && !meta.sd_data_uploaded">
|
||||
!
|
||||
</p>
|
||||
<va-icon
|
||||
v-if="meta.sd_data_uploaded === false"
|
||||
class="va-button__content__icon va-button__content__icon-left"
|
||||
name="material-icons"
|
||||
color="grey"
|
||||
@click.native.stop="performButtonAction()"
|
||||
small
|
||||
fixed-width
|
||||
> sd_card
|
||||
</va-icon>
|
||||
</va-button>
|
||||
|
||||
<sd-card-api-action :ref="'sd_card_api'"/>
|
||||
@@ -24,18 +31,29 @@
|
||||
:okText=" $t('modal.confirm') "
|
||||
@ok="moveToDB()"
|
||||
/>
|
||||
<progress-modal
|
||||
title="SD card data uploading"
|
||||
:time="(parseInt(meta.time_duration) / 2e6).toString()"
|
||||
:ref="'progressModalRef'"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SdCardApiAction from './SdCardApiAction.vue'
|
||||
import progressModal from '@/components/common/progressBarModal/progressModal.vue'
|
||||
|
||||
export default {
|
||||
name: 'SdCardButton',
|
||||
components: {
|
||||
SdCardApiAction,
|
||||
progressModal,
|
||||
},
|
||||
props: {
|
||||
controller: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
uuidList: {
|
||||
type: Array,
|
||||
required: true,
|
||||
@@ -61,7 +79,10 @@ export default {
|
||||
methods: {
|
||||
init () {
|
||||
this.metaID = this.meta.id
|
||||
this.mac_address = this.meta.device.device_address.toString()
|
||||
this.mac_address = this.meta.device.device_address.map(data =>
|
||||
data.toString(16)
|
||||
.padStart(2, '0')
|
||||
.toUpperCase()).join(':')
|
||||
this.uuid = this.meta.uuid
|
||||
},
|
||||
async performButtonAction () {
|
||||
@@ -69,9 +90,10 @@ export default {
|
||||
const uploaded = this.meta.sd_data_uploaded // true or false
|
||||
if (recorded === true) {
|
||||
if (uploaded !== true) {
|
||||
const checkResult = await this.executeCheckInSD()
|
||||
if (checkResult === 'True') {
|
||||
if (this.uuidList.includes(this.uuid)) {
|
||||
this.moveToDBModal = true
|
||||
} else {
|
||||
this.pageToast('Can not access data. Please connect your device to hub by usb.')
|
||||
}
|
||||
} else {
|
||||
this.executeDownload()
|
||||
@@ -82,17 +104,37 @@ export default {
|
||||
await this.executeUpload()
|
||||
this.$emit('refreshPage')
|
||||
},
|
||||
async executeCheckInSD () {
|
||||
return await this.$refs.sd_card_api.checkInSD(this.meta)
|
||||
},
|
||||
// async executeCheckInSD () {
|
||||
// return await this.$refs.sd_card_api.checkInSD(this.meta)
|
||||
// },
|
||||
async executeUpload () {
|
||||
await this.$refs.sd_card_api.moveToDB(this.meta)
|
||||
this.$refs.progressModalRef.show()
|
||||
const result = await this.$refs.sd_card_api.moveToDB(this.meta, this.controller).catch(_ => {
|
||||
this.$refs.progressModalRef.hide()
|
||||
this.pageToast('Upload SD card data error, please connect Neullive to Hub by usb or data corrupted.')
|
||||
})
|
||||
if (result.data === true) {
|
||||
this.pageToast('Upload SD card data done.')
|
||||
} else {
|
||||
this.pageToast('Upload SD card data error, please connect Neullive to Hub by usb or data corrupted.')
|
||||
}
|
||||
this.$refs.progressModalRef.progressDone()
|
||||
// remove delete sd card first, still have problem.
|
||||
// await this.$refs.sd_card_api.deleteSDCard(this.meta)
|
||||
// await this.$refs.sd_card_api.deleteSDCard(this.meta, this.controller)
|
||||
},
|
||||
executeDownload () {
|
||||
this.$emit('downloadSdCard', this.meta)
|
||||
},
|
||||
pageToast: function (mes) {
|
||||
this.showToast(
|
||||
mes,
|
||||
{
|
||||
icon: 'fa-bell',
|
||||
position: 'bottom-right',
|
||||
duration: 7000,
|
||||
},
|
||||
)
|
||||
},
|
||||
},
|
||||
async mounted () {
|
||||
this.init()
|
||||
|
||||
@@ -2,22 +2,25 @@ import api from '@/data/api/index'
|
||||
import nProgress from 'nprogress'
|
||||
|
||||
export const apiManager = {
|
||||
call: async (instruction, metaID, macAddress, uuid) => {
|
||||
call: async (instruction, controllerID, metaID, macAddress, uuid) => {
|
||||
if (instruction === 'Check_in_SD') {
|
||||
return await api.sdcard.exist({
|
||||
id: metaID,
|
||||
controllerID: controllerID,
|
||||
metaID: metaID,
|
||||
mac: macAddress,
|
||||
uuid: uuid,
|
||||
})
|
||||
} else if (instruction === 'Delete_SD') {
|
||||
return await api.sdcard.deleted({
|
||||
id: metaID,
|
||||
controllerID: controllerID,
|
||||
metaID: metaID,
|
||||
mac: macAddress,
|
||||
uuid: uuid,
|
||||
})
|
||||
} else if (instruction === 'Move_to_DB') {
|
||||
return await api.sdcard.upload({
|
||||
id: metaID,
|
||||
controllerID: controllerID,
|
||||
metaID: metaID,
|
||||
mac: macAddress,
|
||||
uuid: uuid,
|
||||
})
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<div class="flex sm12 xl12 md12 xs12" style="text-align: center;">
|
||||
<va-button v-if="device.auto_connect" color="success" @click="autoConnect(index, device)">Auto Connect</va-button>
|
||||
<va-button v-if="!device.auto_connect" color="#babfc2" @click="autoConnect(index, device)" outline>Auto Connect</va-button>
|
||||
<va-button >User Guide</va-button>
|
||||
<va-button @click="openGuide(device.library)">User Guide</va-button>
|
||||
</div>
|
||||
</va-card>
|
||||
</div>
|
||||
@@ -111,12 +111,17 @@ export default {
|
||||
},
|
||||
autoConnect: async function (index, device) {
|
||||
device.auto_connect = !device.auto_connect
|
||||
await api.device.updateByID(device.id, { auto_connect: device.auto_connect })
|
||||
await api.device.update(device.id, { auto_connect: device.auto_connect })
|
||||
},
|
||||
remove (index, device) {
|
||||
console.log('removeDevcie', index, device)
|
||||
this.removeDevice({ id: device.id, index: index, api: api })
|
||||
},
|
||||
openGuide: async function (library) {
|
||||
if (library.indexOf('3.1') !== -1) {
|
||||
window.open('http://' + location.href.split('/')[2] + '/NeuLive31_quickstart_patents.pdf')
|
||||
}
|
||||
},
|
||||
...mapActions('setting', [types.device.init, types.device.remove, types.device.reorder]),
|
||||
...mapMutations('setting', [types.device.set, types.device.updateByIndex]),
|
||||
...mapGetters('setting', [types.device.getAll]),
|
||||
|
||||
@@ -38,12 +38,13 @@
|
||||
<div class="flex sm12 xl12 md12 xs12">
|
||||
<div class="flex sm12 xl12 md12 xs12" style="text-align: center;">
|
||||
<va-card
|
||||
class="ma-0 pa-0"
|
||||
stripe="primary"
|
||||
>
|
||||
<template slot="header">
|
||||
<!-- <template slot="header">
|
||||
<va-icon name="fa fa-gears mr-3" color="primary"/>
|
||||
<h5 class="mt-0 mb-0">CONTROL</h5>
|
||||
</template>
|
||||
</template> -->
|
||||
<va-button class="no-dark-style-va-button" v-if="!showDeviceSetting" color="primary" target="_blank" @click="showDeviceSettingClick()" small>
|
||||
SHOW DEVICES
|
||||
</va-button>
|
||||
@@ -77,6 +78,15 @@
|
||||
@remove="removeChartCheck(chart.chartID)"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
v-for="trigger in triggerList"
|
||||
:key="trigger.id"
|
||||
>
|
||||
<trigger-chart
|
||||
v-show="trigger.display === true"
|
||||
:mac="trigger.mac"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="height: 150px;">
|
||||
@@ -99,7 +109,11 @@ import { chartData } from '../../../data/task/ChartsManagement'
|
||||
import { taskInfo } from '../../../data/task/TaskInfo'
|
||||
import CanvasChart from './chart/CanvasChart'
|
||||
import TaskDevices from './controller/TaskDevices'
|
||||
// import api from '../../../data/api'
|
||||
import TriggerChart from './chart/TriggerChart'
|
||||
// import api from '@/data/api'
|
||||
import { mapFields } from 'vuex-map-fields'
|
||||
import { mapActions } from 'vuex'
|
||||
import deviceTypes from '@/store/modules/device/types'
|
||||
// import TaskFormula from './formula/TaskFormula'
|
||||
|
||||
// TODO change chart data tag format
|
||||
@@ -109,11 +123,18 @@ export default {
|
||||
components: {
|
||||
CanvasChart,
|
||||
TaskDevices,
|
||||
TriggerChart,
|
||||
// TaskFormula,
|
||||
},
|
||||
// async created () {
|
||||
// await taskInfo.updateTaskInfo(this.$route.params.taskID)
|
||||
// },
|
||||
computed: {
|
||||
...mapFields('taskContent', [
|
||||
'deviceList',
|
||||
]),
|
||||
...mapFields('device', [
|
||||
'triggerList',
|
||||
'chartKey',
|
||||
]),
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
// modal
|
||||
@@ -123,27 +144,23 @@ export default {
|
||||
dataRefreshTimer: null,
|
||||
// charts data
|
||||
chartDataAll: chartData.getAllChartsData(),
|
||||
// chart refresh key
|
||||
chartKey: 0,
|
||||
chartNumber: taskInfo.getTaskInfo().chartList.length,
|
||||
selectChartID: null,
|
||||
showDeviceSetting: true,
|
||||
chartAreaClass: ['flex', 'xs12', 'sm12', 'md12', 'xl8', 'pa-0'],
|
||||
|
||||
getParmDone: false,
|
||||
|
||||
deviceList: {},
|
||||
}
|
||||
},
|
||||
mqtt: {
|
||||
async '+/get_device_info_all/+' (data, topic) {
|
||||
await taskInfo.deviceInfo(String.fromCharCode.apply(null, data))
|
||||
await taskInfo.deviceInfo(String.fromCharCode.apply(null, data), this.deviceList)
|
||||
this.refreshDevicesWindow()
|
||||
},
|
||||
async '+/get_device_info/+' (data, topic) {
|
||||
await taskInfo.deviceInfo(String.fromCharCode.apply(null, data))
|
||||
await taskInfo.deviceInfo(String.fromCharCode.apply(null, data), this.deviceList)
|
||||
this.refreshDevicesWindow()
|
||||
this.getParmDone = true
|
||||
this.checkStiStatus()
|
||||
},
|
||||
async '+/device_parameter/+' (data, topic) {
|
||||
await taskInfo.deviceParameter(String.fromCharCode.apply(null, data))
|
||||
@@ -154,7 +171,7 @@ export default {
|
||||
this.refreshDevicesWindow()
|
||||
},
|
||||
async '+/hardware_device/+' (data, topic) {
|
||||
await taskInfo.deviceInfo(String.fromCharCode.apply(null, data))
|
||||
await taskInfo.deviceInfo(String.fromCharCode.apply(null, data), this.deviceList)
|
||||
// console.log(this.deviceList)
|
||||
// for (const d1 in taskInfo.getTaskInfo().deviceList) {
|
||||
// if (taskInfo.getTaskInfo().deviceList[d1].info.device_address.length > 0) {
|
||||
@@ -163,7 +180,7 @@ export default {
|
||||
// for (const d2 in this.deviceList) {
|
||||
// const addr2 = this.deviceList[d2].info.device_address.join()
|
||||
// if (addr1 === addr2) {
|
||||
// console.log(this.deviceList[d2].parameterSet)
|
||||
// // console.log(this.deviceList[d2].parameterSet)
|
||||
// for (const p in this.deviceList[d2].parameterSet) {
|
||||
// if (p !== 'STIMULATING') {
|
||||
// if (parameter == null) {
|
||||
@@ -185,7 +202,7 @@ export default {
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// console.log('****', parameter, content)
|
||||
// // console.log('****', parameter, content)
|
||||
// // this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
// // header: 'device_parameter/0',
|
||||
// // device: parseInt(d1),
|
||||
@@ -204,19 +221,73 @@ export default {
|
||||
async '+/data_server/device_data_stream/+/+' (data, topic) {
|
||||
const topicSplit = topic.split('/')
|
||||
if (this.getParmDone & !taskInfo.getDeviceInfoByRawID(parseInt(topicSplit[3])).info.isSync) {
|
||||
if (chartData.defaultChartGenerator(taskInfo.getDeviceIDByRaw(parseInt(topicSplit[3])), null, 'device')) {
|
||||
taskInfo.deviceStart(parseInt(topicSplit[3]))
|
||||
if (chartData.defaultChartGenerator(this.deviceList, taskInfo.getDeviceIDByRaw(parseInt(topicSplit[3])), null, 'device')) {
|
||||
taskInfo.deviceStart(parseInt(topicSplit[3]), this.deviceList)
|
||||
}
|
||||
}
|
||||
dataStreamBuffer.into(String.fromCharCode.apply(null, data), parseInt(topicSplit[3]), (parseInt(topicSplit[4]) + 1))
|
||||
},
|
||||
'+/device_save_path/+' (data, topic) {
|
||||
taskInfo.deviceSavePath(String.fromCharCode.apply(null, data))
|
||||
console.log(taskInfo.getTaskInfo())
|
||||
// console.log(taskInfo.getTaskInfo())
|
||||
},
|
||||
'+/device_save_path_set/+' (data, topic) {
|
||||
taskInfo.deviceSavePath(String.fromCharCode.apply(null, data))
|
||||
console.log(taskInfo.getTaskInfo())
|
||||
// console.log(taskInfo.getTaskInfo())
|
||||
},
|
||||
async '+/device_sd_card_status/+' (data, topic) {
|
||||
const dataDecode = JSON.parse(String.fromCharCode.apply(null, data))
|
||||
for (const device of this.$refs.devices_ref.deviceList) {
|
||||
if (dataDecode.device === taskInfo.getRawDeviceID(device.id)) {
|
||||
device.sdCardStatus = dataDecode.data
|
||||
}
|
||||
}
|
||||
await taskInfo.updateSdCardStatus(String.fromCharCode.apply(null, data))
|
||||
this.refreshDevicesWindow()
|
||||
},
|
||||
'+/data-server/trigger_manager/#' (data, topic) {
|
||||
let foundIndex
|
||||
let mesJson
|
||||
const mes = new TextDecoder('utf-8').decode(data)
|
||||
const topicSplit = topic.split('/')
|
||||
const baseIndex = topicSplit.indexOf('trigger_manager')
|
||||
const actionIndex = baseIndex + 1
|
||||
const action = topicSplit[actionIndex]
|
||||
const macIndex = baseIndex + 2
|
||||
let _mac
|
||||
if (topicSplit.length - 1 >= macIndex) {
|
||||
_mac = topicSplit[macIndex]
|
||||
foundIndex = this.triggerList.findIndex(o => o.mac === _mac)
|
||||
}
|
||||
switch (action) {
|
||||
case 'info_all': // control_ID/data-server/trigger_manager/info_all
|
||||
this.triggerList = JSON.parse(mes)
|
||||
this.deviceTriggerChartSetDisplay()
|
||||
break
|
||||
case 'register': // control_ID/data-server/trigger_manager/register
|
||||
mesJson = JSON.parse(mes)
|
||||
foundIndex = this.triggerList.findIndex(o => o.mac === mesJson.mac)
|
||||
if (foundIndex < 0) { // -1: not found
|
||||
this.triggerList.push(mesJson)
|
||||
} else {
|
||||
this.triggerList[foundIndex] = mesJson
|
||||
}
|
||||
break
|
||||
case 'remove': // control_ID/data-server/trigger_manager/remove/device_mac
|
||||
this.triggerList.splice(foundIndex, 1)
|
||||
break
|
||||
case 'info': // control_ID/data-server/trigger_manager/info/device_mac
|
||||
this.triggerList[foundIndex] = JSON.parse(mes)
|
||||
this.deviceTriggerChartSetDisplay()
|
||||
break
|
||||
case 'set_parameter': // control_ID/data-server/trigger_manager/set_parameter/device_mac
|
||||
this.triggerList[foundIndex].parameter = JSON.parse(mes)
|
||||
break
|
||||
case 'runtime': // control_ID/data-server/trigger_manager/runtime/device_mac
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
},
|
||||
async '+/broadcast' (data, topic) {
|
||||
const mes = String.fromCharCode.apply(null, data).split(':')
|
||||
@@ -246,14 +317,14 @@ export default {
|
||||
taskInfo.deviceConnected(mes[1])
|
||||
break
|
||||
case 'shutdown':
|
||||
taskInfo.controllerShutdown()
|
||||
taskInfo.controllerShutdown(this.deviceList)
|
||||
this.showShutdownModal = true
|
||||
break
|
||||
case 'start':
|
||||
if (!taskInfo.getDeviceInfoByRawID(parseInt(parseInt(mes[1]))).info.isSync) {
|
||||
taskInfo.deviceStart(parseInt(mes[1]))
|
||||
if (chartData.defaultChartGenerator(taskInfo.getDeviceIDByRaw(parseInt(parseInt(mes[1]))), null, 'device')) {
|
||||
taskInfo.deviceStart(parseInt(parseInt(mes[1])))
|
||||
taskInfo.deviceStart(parseInt(mes[1]), this.deviceList)
|
||||
if (chartData.defaultChartGenerator(this.deviceList, taskInfo.getDeviceIDByRaw(parseInt(parseInt(mes[1]))), null, 'device')) {
|
||||
taskInfo.deviceStart(parseInt(parseInt(mes[1])), this.deviceList)
|
||||
}
|
||||
}
|
||||
break
|
||||
@@ -261,7 +332,7 @@ export default {
|
||||
if (mes[1] === 'all') {
|
||||
return false
|
||||
}
|
||||
taskInfo.deviceStop(parseInt(mes[1]))
|
||||
taskInfo.deviceStop(parseInt(mes[1]), this.deviceList)
|
||||
break
|
||||
case 'device_timeout':
|
||||
this.pageToast('The device [' + taskInfo.getDeviceIDByRaw(parseInt(mes[1])) + '] is timeout, please check its status or parameters.')
|
||||
@@ -277,7 +348,7 @@ export default {
|
||||
default:
|
||||
break
|
||||
}
|
||||
console.log(String.fromCharCode.apply(null, data), topic)
|
||||
// console.log(String.fromCharCode.apply(null, data), topic)
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
@@ -297,6 +368,8 @@ export default {
|
||||
this.mqttSub(id + '/get_device_info/+')
|
||||
this.mqttSub(id + '/device_parameter/+')
|
||||
this.mqttSub(id + '/device_parameter_value/+')
|
||||
this.mqttSub(id + '/device_sd_card_status/+')
|
||||
this.mqttSub(id + '/data-server/trigger_manager/#')
|
||||
},
|
||||
pageMqttUnSub: function (id) {
|
||||
for (const device in taskInfo.getTaskInfo().deviceList) {
|
||||
@@ -308,6 +381,8 @@ export default {
|
||||
this.mqttUnSub(id + '/get_device_info/+')
|
||||
this.mqttUnSub(id + '/device_parameter/+')
|
||||
this.mqttUnSub(id + '/device_parameter_value/+')
|
||||
this.mqttUnSub(id + '/device_sd_card_status/+')
|
||||
this.mqttUnSub(id + '/data-server/trigger_manager/#')
|
||||
},
|
||||
pageInit: async function () {
|
||||
if (await this.$refs.devices_ref != null) {
|
||||
@@ -321,10 +396,13 @@ export default {
|
||||
// parameter: 'RECORDING_CH|AXIS_CH',
|
||||
// content: '7|1',
|
||||
// }))
|
||||
console.log(taskInfo.getTaskInfo().controllerID)
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'hardware_device/0',
|
||||
}))
|
||||
await taskInfo.updateChartInfo()
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '/client/trigger_manager/scan', '{}')
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '/client/trigger_manager/info_all', '{}')
|
||||
this.chartNumber = taskInfo.getTaskInfo().chartNumber
|
||||
},
|
||||
pageToast: function (mes) {
|
||||
@@ -509,7 +587,7 @@ export default {
|
||||
this.pageToast('The formula [' + formulaID + '] has been removed.')
|
||||
},
|
||||
startAllClick: async function () {
|
||||
for (const device of taskInfo.getDeviceListRegister()) {
|
||||
for (const device of this.deviceList) {
|
||||
if (this.$refs.devices_ref === undefined) {
|
||||
this.startDevice(device)
|
||||
} else {
|
||||
@@ -520,7 +598,7 @@ export default {
|
||||
this.pageToast('The all devices have been started')
|
||||
},
|
||||
startDevice: async function (device) {
|
||||
chartData.defaultChartGenerator(device.id, null, 'device')
|
||||
chartData.defaultChartGenerator(this.deviceList, device.id, null, 'device')
|
||||
if (!taskInfo.getDeviceInfo(device.id).info.isSync) {
|
||||
if (taskInfo.getDeviceInfo(device.id).info.library_name.startsWith('Neulive')) {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
@@ -529,7 +607,7 @@ export default {
|
||||
instruction: 'record',
|
||||
}))
|
||||
} else if (taskInfo.getDeviceInfo(device.id).info.library_name.startsWith('Elite')) {
|
||||
console.log('elite')
|
||||
// console.log('elite')
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
device: taskInfo.getRawDeviceID(device.id),
|
||||
@@ -540,11 +618,11 @@ export default {
|
||||
device.isSync = true
|
||||
// this.$emit('refreshSetting')
|
||||
// ### show device info
|
||||
console.log(taskInfo.getDeviceInfo(device.id))
|
||||
// console.log(taskInfo.getDeviceInfo(device.id))
|
||||
}
|
||||
},
|
||||
stopAllClick: function () {
|
||||
for (const device of taskInfo.getDeviceListRegister()) {
|
||||
for (const device of this.deviceList) {
|
||||
if (this.$refs.devices_ref === undefined) {
|
||||
this.stopDevice(device)
|
||||
} else {
|
||||
@@ -572,20 +650,25 @@ export default {
|
||||
device.stopping = true
|
||||
}
|
||||
},
|
||||
checkStiStatus: function () {
|
||||
this.$refs.devices_ref.checkStiStatus()
|
||||
},
|
||||
exit: function () {
|
||||
this.$router.push({
|
||||
path: '/',
|
||||
})
|
||||
},
|
||||
|
||||
...mapActions('device', [deviceTypes.triggerChart.setDisplay]),
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
async mounted () {
|
||||
this.deviceList = await taskInfo.updateTaskInfo(this.$route.params.taskID)
|
||||
console.log(taskInfo.getTaskInfo())
|
||||
await taskInfo.updateTaskInfo(this.$route.params.taskID)
|
||||
// console.log(taskInfo.getTaskInfo())
|
||||
// this.screenHeight = document.documentElement.clientHeight
|
||||
this.pageMqttSub(taskInfo.getTaskInfo().controllerID)
|
||||
console.log(taskInfo.getTaskInfo().controllerID)
|
||||
// console.log(taskInfo.getTaskInfo().controllerID)
|
||||
await this.pageInit()
|
||||
// this.chartNumber = taskInfo.getTaskInfo().chartNumber
|
||||
|
||||
@@ -598,7 +681,7 @@ export default {
|
||||
// }
|
||||
},
|
||||
destroyed () {
|
||||
taskInfo.destroyed()
|
||||
taskInfo.destroyed(this.deviceList)
|
||||
for (const chart in chartData.getAllChartsData()) {
|
||||
this.removeChart(chart)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,595 @@
|
||||
<template>
|
||||
<div class="task-content">
|
||||
|
||||
<va-modal
|
||||
v-model="showShutdownModal"
|
||||
size="small"
|
||||
:title="'SHUTDOWN'"
|
||||
:message="'The controller shutdown.'"
|
||||
:okText=" $t('modal.confirm') "
|
||||
@ok="exit()"
|
||||
@cancel="exit()"
|
||||
/>
|
||||
|
||||
<va-modal
|
||||
v-model="showRemoveChartModal"
|
||||
size="small"
|
||||
:title="'REMOVE CHART'"
|
||||
:message="'The chart will be removed.'"
|
||||
:okText=" $t('modal.confirm') "
|
||||
@ok="removeChart(null)"
|
||||
/>
|
||||
|
||||
<div class="row row-equal">
|
||||
<div v-if="showDeviceSetting" class="flex md12 xl4 xs12 sm12">
|
||||
<div class="row">
|
||||
<div class="flex sm12 xl12 md12 xs12">
|
||||
<task-devices-g-m :ref="'devices_ref'" @add="addDevice($event)" @remove="removeDevice($event)" @refreshSetting="refreshChartSetting($event)" class="pa-0" />
|
||||
</div>
|
||||
<!-- <div class="flex sm12 xl12 md12 xs12">
|
||||
<task-formula :ref="'formula_ref'" @add="addFormula($event)" @remove="removeFormula($event)" class="pa-0" />
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div :class="chartAreaClass">
|
||||
<div class="row" >
|
||||
<div class="flex sm12 xl12 md12 xs12">
|
||||
<div class="flex sm12 xl12 md12 xs12" style="text-align: center;">
|
||||
<va-card
|
||||
stripe="primary"
|
||||
>
|
||||
<va-button class="no-dark-style-va-button" v-if="!showDeviceSetting" color="primary" target="_blank" @click="showDeviceSettingClick()" small>
|
||||
SHOW DEVICES
|
||||
</va-button>
|
||||
<va-button class="no-dark-style-va-button" v-if="showDeviceSetting" color="primary" target="_blank" @click="hideDeviceSettingClick()" small>
|
||||
HIDE DEVICES
|
||||
</va-button>
|
||||
<!-- <va-button class="" color="success" target="_blank" @click="startAllClick()" small>
|
||||
START ALL
|
||||
</va-button>
|
||||
<va-button class="no-dark-style-va-button" color="danger" target="_blank" @click="stopAllClick()" small>
|
||||
STOP ALL
|
||||
</va-button> -->
|
||||
<va-button class="no-dark-style-va-button" color="primary" target="_blank" @click.stop="addChart()" small>
|
||||
ADD CHART
|
||||
</va-button>
|
||||
</va-card>
|
||||
</div>
|
||||
|
||||
<div :key="chartKey">
|
||||
<div
|
||||
v-for="chart in chartDataAll"
|
||||
:key="chart.chartID"
|
||||
>
|
||||
<canvas-chart
|
||||
:id="'chart' + chart.chartID"
|
||||
:ref="'chart_ref'"
|
||||
:cardheight="'400px'"
|
||||
:cardwidth="'auto'"
|
||||
:chartID="chart.chartID"
|
||||
@init="initChart(chart.chartID)"
|
||||
@remove="removeChartCheck(chart.chartID)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="height: 150px;">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<task-content-modal />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { dataStreamBuffer } from '../../../data/task/DataStreamBuffer'
|
||||
import { chartData } from '../../../data/task/ChartsManagement'
|
||||
import { taskInfo } from '../../../data/task/TaskInfo'
|
||||
import CanvasChart from './chart/CanvasChart'
|
||||
import TaskContentModal from './TaskContentModal.vue'
|
||||
import { mapFields } from 'vuex-map-fields'
|
||||
import TaskDevicesGM from './controller/neulive-gimer/TaskDevicesGM.vue'
|
||||
// import api from '../../../data/api'
|
||||
// import TaskFormula from './formula/TaskFormula'
|
||||
|
||||
// TODO change chart data tag format
|
||||
|
||||
export default {
|
||||
name: 'TaskContent',
|
||||
components: {
|
||||
CanvasChart,
|
||||
TaskDevicesGM,
|
||||
TaskContentModal,
|
||||
// TaskFormula,
|
||||
},
|
||||
// async created () {
|
||||
// await taskInfo.updateTaskInfo(this.$route.params.taskID)
|
||||
// },
|
||||
computed: {
|
||||
...mapFields('taskContent', [
|
||||
'deviceList',
|
||||
'showTaskModal',
|
||||
'taskModalText',
|
||||
]),
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
// modal
|
||||
showShutdownModal: false,
|
||||
showRemoveChartModal: false,
|
||||
// refresh timer
|
||||
dataRefreshTimer: null,
|
||||
// charts data
|
||||
chartDataAll: chartData.getAllChartsData(),
|
||||
// chart refresh key
|
||||
chartKey: 0,
|
||||
chartNumber: taskInfo.getTaskInfo().chartList.length,
|
||||
selectChartID: null,
|
||||
showDeviceSetting: true,
|
||||
chartAreaClass: ['flex', 'xs12', 'sm12', 'md12', 'xl8', 'pa-0'],
|
||||
getParmDone: false,
|
||||
}
|
||||
},
|
||||
mqtt: {
|
||||
async '+/get_device_info_all/+' (data, topic) {
|
||||
await taskInfo.deviceInfo(String.fromCharCode.apply(null, data), this.deviceList)
|
||||
this.refreshDevicesWindow()
|
||||
},
|
||||
async '+/get_device_info/+' (data, topic) {
|
||||
await taskInfo.deviceInfo(String.fromCharCode.apply(null, data), this.deviceList)
|
||||
this.refreshDevicesWindow()
|
||||
this.getParmDone = true
|
||||
this.checkStiStatus()
|
||||
},
|
||||
async '+/device_parameter/+' (data, topic) {
|
||||
await taskInfo.deviceParameter(String.fromCharCode.apply(null, data))
|
||||
this.refreshDevicesWindow()
|
||||
},
|
||||
async '+/device_parameter_value/+' (data, topic) {
|
||||
await taskInfo.deviceParameter(String.fromCharCode.apply(null, data))
|
||||
this.refreshDevicesWindow()
|
||||
},
|
||||
async '+/hardware_device/+' (data, topic) {
|
||||
await taskInfo.deviceInfo(String.fromCharCode.apply(null, data), this.deviceList)
|
||||
if (this.$refs.devices_ref != null) {
|
||||
await this.$refs.devices_ref.loadingDone()
|
||||
}
|
||||
},
|
||||
// listen datastream [ topic: controllerID/data_server/device_data_stream/deviceID/channel ]
|
||||
async '+/data_server/device_data_stream/+/+' (data, topic) {
|
||||
const topicSplit = topic.split('/')
|
||||
if (this.getParmDone & !taskInfo.getDeviceInfoByRawID(parseInt(topicSplit[3])).info.isSync) {
|
||||
if (chartData.defaultChartGenerator(this.deviceList, taskInfo.getDeviceIDByRaw(parseInt(topicSplit[3])), null, 'device')) {
|
||||
taskInfo.deviceStart(parseInt(topicSplit[3]), this.deviceList)
|
||||
}
|
||||
}
|
||||
dataStreamBuffer.into(String.fromCharCode.apply(null, data), parseInt(topicSplit[3]), (parseInt(topicSplit[4]) + 1))
|
||||
},
|
||||
'+/device_save_path/+' (data, topic) {
|
||||
taskInfo.deviceSavePath(String.fromCharCode.apply(null, data))
|
||||
// console.log(taskInfo.getTaskInfo())
|
||||
},
|
||||
'+/device_save_path_set/+' (data, topic) {
|
||||
taskInfo.deviceSavePath(String.fromCharCode.apply(null, data))
|
||||
// console.log(taskInfo.getTaskInfo())
|
||||
},
|
||||
async '+/broadcast' (data, topic) {
|
||||
const mes = String.fromCharCode.apply(null, data).split(':')
|
||||
// let content
|
||||
switch (mes[0]) {
|
||||
case 'state':
|
||||
switch (mes[1]) {
|
||||
case 'device_available':
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'hardware_device/0',
|
||||
}))
|
||||
break
|
||||
}
|
||||
break
|
||||
case 'disconnected':
|
||||
taskInfo.deviceDisconnected(mes[1])
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'get_device_info/0',
|
||||
device: parseInt(mes[1]),
|
||||
}))
|
||||
break
|
||||
case 'connected':
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'get_device_info/0',
|
||||
device: parseInt(mes[1]),
|
||||
}))
|
||||
taskInfo.deviceConnected(mes[1])
|
||||
break
|
||||
case 'shutdown':
|
||||
taskInfo.controllerShutdown(this.deviceList)
|
||||
this.showShutdownModal = true
|
||||
break
|
||||
case 'start':
|
||||
if (!taskInfo.getDeviceInfoByRawID(parseInt(parseInt(mes[1]))).info.isSync) {
|
||||
taskInfo.deviceStart(parseInt(mes[1]), this.deviceList)
|
||||
if (chartData.defaultChartGenerator(this.deviceList, taskInfo.getDeviceIDByRaw(parseInt(parseInt(mes[1]))), null, 'device')) {
|
||||
taskInfo.deviceStart(parseInt(parseInt(mes[1])), this.deviceList)
|
||||
}
|
||||
}
|
||||
break
|
||||
case 'stop':
|
||||
if (mes[1] === 'all') {
|
||||
return false
|
||||
}
|
||||
taskInfo.deviceStop(parseInt(mes[1]), this.deviceList)
|
||||
break
|
||||
case 'device_timeout':
|
||||
this.pageToast('The device [' + taskInfo.getDeviceIDByRaw(parseInt(mes[1])) + '] is timeout, please check its status or parameters.')
|
||||
break
|
||||
case 'device_mission_done':
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
device: parseInt(mes[1]),
|
||||
instruction: 'interrupt',
|
||||
}))
|
||||
this.pageToast('The device [' + taskInfo.getDeviceIDByRaw(parseInt(mes[1])) + '] mission is done.')
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
// console.log(String.fromCharCode.apply(null, data), topic)
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
mqttSub: function (val) {
|
||||
this.$mqtt.subscribe(val)
|
||||
},
|
||||
mqttUnSub: function (val) {
|
||||
this.$mqtt.unsubscribe(val)
|
||||
},
|
||||
mqttPub: function (topic, mes) {
|
||||
this.$mqtt.publish(topic, mes)
|
||||
},
|
||||
pageMqttSub: function (id) {
|
||||
this.mqttSub(id + '/hardware_device/+')
|
||||
this.mqttSub(id + '/broadcast')
|
||||
this.mqttSub(id + '/get_device_info_all/+')
|
||||
this.mqttSub(id + '/get_device_info/+')
|
||||
this.mqttSub(id + '/device_parameter/+')
|
||||
this.mqttSub(id + '/device_parameter_value/+')
|
||||
},
|
||||
pageMqttUnSub: function (id) {
|
||||
for (const device in taskInfo.getTaskInfo().deviceList) {
|
||||
this.mqttUnSub(id + '/data_server/device_data_stream/' + device + '/+')
|
||||
}
|
||||
this.mqttUnSub(id + '/hardware_device/+')
|
||||
this.mqttUnSub(id + '/broadcast')
|
||||
this.mqttUnSub(id + '/get_device_info_all/+')
|
||||
this.mqttUnSub(id + '/get_device_info/+')
|
||||
this.mqttUnSub(id + '/device_parameter/+')
|
||||
this.mqttUnSub(id + '/device_parameter_value/+')
|
||||
},
|
||||
pageInit: async function () {
|
||||
if (await this.$refs.devices_ref != null) {
|
||||
await this.$refs.devices_ref.loadingStart()
|
||||
}
|
||||
// let _parameter, _content
|
||||
|
||||
// this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
// header: 'device_parameter/0',
|
||||
// device: 7,
|
||||
// parameter: 'RECORDING_CH|AXIS_CH',
|
||||
// content: '7|1',
|
||||
// }))
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'hardware_device/0',
|
||||
}))
|
||||
await taskInfo.updateChartInfo()
|
||||
this.chartNumber = taskInfo.getTaskInfo().chartNumber
|
||||
},
|
||||
pageToast: function (mes) {
|
||||
this.showToast(
|
||||
mes,
|
||||
{
|
||||
icon: 'fa-bell',
|
||||
position: 'bottom-right',
|
||||
duration: 4000,
|
||||
},
|
||||
)
|
||||
},
|
||||
refreshData: function () {
|
||||
// TODO don't need to refresh chart with stop status
|
||||
for (const chart in this.chartDataAll) {
|
||||
chartData.refresh(parseInt(chart))
|
||||
}
|
||||
},
|
||||
refreshDevicesWindow: function () {
|
||||
// console.log(taskInfo.getTaskInfo())
|
||||
if (this.$refs.devices_ref != null) {
|
||||
this.$refs.devices_ref.refresh()
|
||||
}
|
||||
},
|
||||
checkStiStatus: function () {
|
||||
this.$refs.devices_ref.checkStiStatus()
|
||||
},
|
||||
addChart: async function () {
|
||||
const defaultID = {}
|
||||
const update = async () => {
|
||||
for (const chart in chartData.getAllChartsData()) {
|
||||
defaultID[chart] = chartData.getAllChartsData()[chart].mappingID
|
||||
}
|
||||
chartData.init(this.chartNumber, 4000, 1, 1)
|
||||
this.chartNumber++
|
||||
this.chartKey++
|
||||
}
|
||||
await update()
|
||||
|
||||
for (const chart in chartData.getAllChartsData()) {
|
||||
chartData.getAllChartsData()[chart].mappingID = defaultID[chart]
|
||||
}
|
||||
|
||||
if (this.$refs.chart_ref != null) {
|
||||
this.$refs.chart_ref.forEach(ref => {
|
||||
ref.refreshMappingSelect()
|
||||
})
|
||||
}
|
||||
// this.pageToast('The chart has been added.')
|
||||
|
||||
return this.chartNumber - 1
|
||||
// chartData.updateGridList(0, 4)
|
||||
},
|
||||
refreshChartSetting: async function () {
|
||||
const defaultID = {}
|
||||
const update = async () => {
|
||||
for (const chart in chartData.getAllChartsData()) {
|
||||
defaultID[chart] = chartData.getAllChartsData()[chart].mappingID
|
||||
}
|
||||
this.chartKey++
|
||||
}
|
||||
await update()
|
||||
|
||||
for (const chart in chartData.getAllChartsData()) {
|
||||
chartData.getAllChartsData()[chart].mappingID = defaultID[chart]
|
||||
}
|
||||
|
||||
if (this.$refs.chart_ref != null) {
|
||||
this.$refs.chart_ref.forEach(ref => {
|
||||
ref.refreshMappingSelect()
|
||||
})
|
||||
}
|
||||
},
|
||||
initChart: function (chartID) {
|
||||
chartData.reset(chartID)
|
||||
// this.pageToast('The chart has been Initialized.')
|
||||
},
|
||||
removeChartCheck: function (chartID) {
|
||||
this.selectChartID = chartID
|
||||
this.showRemoveChartModal = true
|
||||
},
|
||||
removeChart: async function (chartID) {
|
||||
if (chartID == null) {
|
||||
chartID = this.selectChartID
|
||||
}
|
||||
dataStreamBuffer.removeByChart(chartID)
|
||||
if (chartData.getAllChartsData()[chartID] != null) {
|
||||
const defaultID = {}
|
||||
const update = async () => {
|
||||
for (const chart in chartData.getAllChartsData()) {
|
||||
if (chart !== chartID) {
|
||||
defaultID[chart] = chartData.getAllChartsData()[chart].mappingID
|
||||
}
|
||||
}
|
||||
delete chartData.getAllChartsData()[chartID]
|
||||
this.chartKey++
|
||||
}
|
||||
await update()
|
||||
|
||||
for (const chart in chartData.getAllChartsData()) {
|
||||
chartData.getAllChartsData()[chart].mappingID = defaultID[chart]
|
||||
}
|
||||
|
||||
if (this.$refs.chart_ref != null) {
|
||||
this.$refs.chart_ref.forEach(ref => {
|
||||
ref.refreshMappingSelect()
|
||||
})
|
||||
}
|
||||
}
|
||||
// this.pageToast('The chart has been removed.')
|
||||
},
|
||||
showDeviceSettingClick: function () {
|
||||
this.showDeviceSetting = true
|
||||
this.chartAreaClass[3] = 'md12'
|
||||
this.chartAreaClass[4] = 'xl8'
|
||||
},
|
||||
hideDeviceSettingClick: function () {
|
||||
this.showDeviceSetting = false
|
||||
this.chartAreaClass[3] = 'md12'
|
||||
this.chartAreaClass[4] = 'xl12'
|
||||
},
|
||||
addMappingChart: async function (deviceID) {
|
||||
// if have chart with device ID
|
||||
for (const chart in chartData.getAllChartsData()) {
|
||||
if (chartData.getAllChartsData()[chart].mappingID === deviceID) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
const chart = await this.addChart()
|
||||
await this.$nextTick(async () => {
|
||||
chartData.getAllChartsData()[chart].mappingID = deviceID
|
||||
if (this.$refs.chart_ref != null) {
|
||||
this.$refs.chart_ref.forEach(ref => {
|
||||
ref.refreshMappingSelect()
|
||||
})
|
||||
}
|
||||
})
|
||||
return chart
|
||||
},
|
||||
addDevice: async function (deviceID) {
|
||||
this.mqttSub(taskInfo.getTaskInfo().controllerID + '/data_server/device_data_stream/' + taskInfo.getRawDeviceID(deviceID) + '/+')
|
||||
this.addMappingChart(deviceID)
|
||||
// if (taskInfo.getDeviceInfo(deviceID).info.isSync) {
|
||||
// chartData.defaultChartGenerator(deviceID, chart, 'device')
|
||||
// }
|
||||
// console.log(chartData.getAllChartsData())
|
||||
// console.log(taskInfo.getTaskInfo())
|
||||
// await api.task.update({
|
||||
// device_config: taskInfo.getTaskInfo().deviceList,
|
||||
// })
|
||||
this.pageToast('The device [' + deviceID + '] has been registered.')
|
||||
},
|
||||
removeDevice: function (deviceID) {
|
||||
this.mqttUnSub(taskInfo.getTaskInfo().controllerID + '/data_server/device_data_stream/' + taskInfo.getRawDeviceID(deviceID) + '/+')
|
||||
for (const chart in chartData.getAllChartsData()) {
|
||||
if (chartData.getAllChartsData()[chart].mappingID === deviceID) {
|
||||
dataStreamBuffer.removeByChart(chart)
|
||||
this.removeChart(chart)
|
||||
}
|
||||
}
|
||||
this.pageToast('The device [' + deviceID + '] has been removed.')
|
||||
},
|
||||
addFormula: async function (formulaID) {
|
||||
const chart = await this.addChart()
|
||||
await this.$nextTick(async () => {
|
||||
chartData.getAllChartsData()[chart].mappingID = formulaID
|
||||
if (this.$refs.chart_ref != null) {
|
||||
this.$refs.chart_ref.forEach(ref => {
|
||||
ref.refreshMappingSelect()
|
||||
})
|
||||
}
|
||||
})
|
||||
this.pageToast('The formula [' + formulaID + '] has been registered.')
|
||||
},
|
||||
removeFormula: function (formulaID) {
|
||||
for (const chart in chartData.getAllChartsData()) {
|
||||
if (chartData.getAllChartsData()[chart].mappingID === formulaID) {
|
||||
dataStreamBuffer.removeByChart(chart)
|
||||
this.removeChart(chart)
|
||||
}
|
||||
}
|
||||
this.pageToast('The formula [' + formulaID + '] has been removed.')
|
||||
},
|
||||
startAllClick: async function () {
|
||||
for (const device of this.deviceList) {
|
||||
if (this.$refs.devices_ref === undefined) {
|
||||
this.startDevice(device)
|
||||
} else {
|
||||
await this.$refs.devices_ref.$refs.pdlist_ref.start(device)
|
||||
}
|
||||
}
|
||||
this.refreshDevicesWindow()
|
||||
this.pageToast('The all devices have been started')
|
||||
},
|
||||
startDevice: async function (device) {
|
||||
chartData.defaultChartGenerator(this.deviceList, device.id, null, 'device')
|
||||
if (!taskInfo.getDeviceInfo(device.id).info.isSync) {
|
||||
if (taskInfo.getDeviceInfo(device.id).info.library_name.startsWith('Neulive')) {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
device: taskInfo.getRawDeviceID(device.id),
|
||||
instruction: 'record',
|
||||
}))
|
||||
} else if (taskInfo.getDeviceInfo(device.id).info.library_name.startsWith('Elite')) {
|
||||
// console.log('elite')
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
device: taskInfo.getRawDeviceID(device.id),
|
||||
instruction: 'start',
|
||||
}))
|
||||
}
|
||||
device.stopping = false
|
||||
device.isSync = true
|
||||
// this.$emit('refreshSetting')
|
||||
// ### show device info
|
||||
// console.log(taskInfo.getDeviceInfo(device.id))
|
||||
}
|
||||
},
|
||||
stopAllClick: function () {
|
||||
for (const device of this.deviceList) {
|
||||
if (this.$refs.devices_ref === undefined) {
|
||||
this.stopDevice(device)
|
||||
} else {
|
||||
this.$refs.devices_ref.stopDevice(device)
|
||||
}
|
||||
}
|
||||
this.pageToast('The all devices have been stopped')
|
||||
},
|
||||
stopDevice: async function (device) {
|
||||
dataStreamBuffer.removeByDevice(taskInfo.getRawDeviceID(device.id))
|
||||
if (taskInfo.getDeviceInfo(device.id).info.isSync) {
|
||||
if (taskInfo.getDeviceInfo(device.id).info.library_name.startsWith('Neulive')) {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
device: taskInfo.getRawDeviceID(device.id),
|
||||
instruction: 'stop_record',
|
||||
}))
|
||||
} else if (taskInfo.getDeviceInfo(device.id).info.library_name.startsWith('Elite')) {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
device: taskInfo.getRawDeviceID(device.id),
|
||||
instruction: 'interrupt',
|
||||
}))
|
||||
}
|
||||
device.stopping = true
|
||||
}
|
||||
},
|
||||
exit: function () {
|
||||
this.$router.push({
|
||||
path: '/',
|
||||
})
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
async mounted () {
|
||||
await taskInfo.updateTaskInfo(this.$route.params.taskID)
|
||||
// console.log(taskInfo.getTaskInfo())
|
||||
// this.screenHeight = document.documentElement.clientHeight
|
||||
this.pageMqttSub(taskInfo.getTaskInfo().controllerID)
|
||||
// console.log(taskInfo.getTaskInfo().controllerID)
|
||||
await this.pageInit()
|
||||
// this.chartNumber = taskInfo.getTaskInfo().chartNumber
|
||||
|
||||
this.dataRefreshTimer = setInterval(this.refreshData, 100)
|
||||
|
||||
// const _this = this
|
||||
// window.onresize = function () { // define the event of window size changing
|
||||
// // _this.screenWidth = document.documentElement.clientWidth
|
||||
// _this.screenHeight = document.documentElement.clientHeight
|
||||
// }
|
||||
},
|
||||
destroyed () {
|
||||
taskInfo.destroyed(this.deviceList)
|
||||
for (const chart in chartData.getAllChartsData()) {
|
||||
this.removeChart(chart)
|
||||
}
|
||||
clearInterval(this.dataRefreshTimer)
|
||||
this.pageMqttUnSub(taskInfo.getTaskInfo().controllerID)
|
||||
},
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
// .area-style {
|
||||
// height: 100%;
|
||||
// overflow-y: hidden;
|
||||
// overflow-x: hidden;
|
||||
|
||||
// @include media-breakpoint-only(xl) {
|
||||
// height: 94vh;
|
||||
// overflow-y: scroll;
|
||||
// overflow-x: hidden;
|
||||
// }
|
||||
// }
|
||||
|
||||
.no-dark-style-va-button {
|
||||
&:focus {
|
||||
filter: brightness(100%);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<va-modal
|
||||
v-model="showTaskModal"
|
||||
size="small"
|
||||
:title="''"
|
||||
:message="taskModalText"
|
||||
:okText=" $t('modal.confirm') "
|
||||
:cancelText=" $t('modal.cancel') "
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapFields } from 'vuex-map-fields'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
},
|
||||
props: {
|
||||
},
|
||||
computed: {
|
||||
...mapFields('taskContent', [
|
||||
'showTaskModal',
|
||||
'taskModalText',
|
||||
]),
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -2,8 +2,19 @@
|
||||
<div class="flex" :class="cardclass">
|
||||
<va-card>
|
||||
<template slot="header">
|
||||
<va-icon name="fa fa-area-chart mr-3" color="primary"/>
|
||||
<h5 class="mt-0 mb-0">{{nameCard}}</h5>
|
||||
<div class="row flex sm12 xl12 md12 xs12 align--center my-0 py-0">
|
||||
<div class="flex sm5 xl5 md5 xs5 px-0 mx-0">
|
||||
<h5 class="mt-0 mb-0"><va-icon name="fa fa-area-chart mr-3" color="primary"/>{{nameCard}}</h5>
|
||||
</div>
|
||||
<div class="flex sm7 xl7 md7 xs7 pa-0 ma-0" style="text-align: right;">
|
||||
<va-button class="pa-0 ma-0 circle-button" small color="dark" @click="remove()">
|
||||
<va-icon
|
||||
name="fa fa-times"
|
||||
color="white"
|
||||
/>
|
||||
</va-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<va-tabs v-model="tabValue" class="mb-3" style="width: 100%; min-width: 100px;">
|
||||
<va-tab>
|
||||
@@ -12,97 +23,90 @@
|
||||
<va-tab>
|
||||
{{'SOURCE'}}
|
||||
</va-tab>
|
||||
<!-- <va-tab>
|
||||
{{'SETTING'}}
|
||||
</va-tab> -->
|
||||
</va-tabs>
|
||||
<div v-if="tabValue == 0" >
|
||||
<div v-if="data.legend.data.length != 0">
|
||||
<chart :ref="'chart_ref'" :style="'width: '+ cardwidth + '; height: ' + cardheight + ';'" :options="data" :auto-resize="true"></chart>
|
||||
</div>
|
||||
<div v-else>
|
||||
Please add the source from device.
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="tabValue == 1" :style="'width: '+ cardwidth + '; height: ' + cardheight + ';'" >
|
||||
<canvas-chart-source :chartID="chartID" :gridInfo="data.grid"></canvas-chart-source>
|
||||
</div>
|
||||
<div v-else :style="'width: '+ cardwidth + '; height: ' + cardheight + ';'" >
|
||||
<canvas-chart-setting></canvas-chart-setting>
|
||||
<!-- <canvas-chart-setting :chartID="chartID"></canvas-chart-setting> -->
|
||||
</div>
|
||||
<div class="flex row">
|
||||
<div class="flex row xs12 md12 xl12 sm12" style="text-align: center;" >
|
||||
<!-- <va-select
|
||||
class="ma-1"
|
||||
:on-change="mappingSelectChange()"
|
||||
small
|
||||
:label="'MAPPING'"
|
||||
v-model="mappingSelect"
|
||||
textBy="name"
|
||||
:options="mappingOptions"
|
||||
/> -->
|
||||
<va-input
|
||||
v-if="data.chartXMode === 'time'"
|
||||
class="ma-1"
|
||||
@keyup.enter="timeIntervalChange(timeIntervalInput)"
|
||||
@blur="timeIntervalChange(timeIntervalInput)"
|
||||
v-model="timeIntervalInput"
|
||||
:label="'time-interval'"
|
||||
>
|
||||
<p slot="append" style="margin-right: 0;" small>
|
||||
ms
|
||||
</p>
|
||||
</va-input>
|
||||
<va-input
|
||||
v-if="data.chartXMode === 'value'"
|
||||
class="ma-1"
|
||||
@keyup.enter="xIntervalChange(xIntervalInput)"
|
||||
@blur="xIntervalChange(xIntervalInput)"
|
||||
v-model="xIntervalInput"
|
||||
:label="'x-grid'"
|
||||
>
|
||||
<p slot="append" style="margin-right: 0;" small>
|
||||
{{data.chartXUnit}}
|
||||
</p>
|
||||
</va-input>
|
||||
<va-input
|
||||
class="ma-1"
|
||||
@keyup.enter="yIntervalChange(yIntervalInput)"
|
||||
@blur="yIntervalChange(yIntervalInput)"
|
||||
v-model="yIntervalInput"
|
||||
:label="'y-grid'"
|
||||
>
|
||||
<p slot="append" style="margin-right: 0;" small>
|
||||
{{data.chartYUnit}}
|
||||
</p>
|
||||
</va-input>
|
||||
<va-input
|
||||
v-if="data.chartDevice === 'neulive'"
|
||||
class="ma-1"
|
||||
@keyup.enter="threeAxisIntervalChange(threeAxisIntervalInput)"
|
||||
@blur="threeAxisIntervalChange(threeAxisIntervalInput)"
|
||||
v-model="threeAxisIntervalInput"
|
||||
:label="'3axis-interval'"
|
||||
>
|
||||
<p slot="append" style="margin-right: 0;" small>
|
||||
g
|
||||
</p>
|
||||
</va-input>
|
||||
<!-- <va-button class="no-dark-style-va-button" small @click="init()">INIT</va-button> -->
|
||||
<va-button small color="dark" @click="remove()">REMOVE</va-button>
|
||||
</div>
|
||||
<!-- <div class="xs2 md2 xl2 sm2" style="text-align: center;" >
|
||||
<va-button class="no-dark-style-va-button" small @click="init()">INIT</va-button>
|
||||
<va-button small color="dark" @click="remove()">REMOVE</va-button>
|
||||
</div> -->
|
||||
<div v-if="this.$refs.chart_ref != null">
|
||||
<va-button small class="mb-3" @click="selectAllSeries">
|
||||
SELECT ALL
|
||||
</va-button>
|
||||
<va-button small class="mb-3" @click="inverseSelectAllSeries">
|
||||
INVERSE SELECT
|
||||
</va-button>
|
||||
</div>
|
||||
<div class="row flex align--left ma-0 pa-0">
|
||||
<va-input
|
||||
v-if="data.chartXMode === 'time'"
|
||||
class="mx-1"
|
||||
@keyup.enter="timeIntervalChange(timeIntervalInput)"
|
||||
@blur="timeIntervalChange(timeIntervalInput)"
|
||||
v-model="timeIntervalInput"
|
||||
:label="'time-grid'"
|
||||
>
|
||||
<p slot="append" style="margin-right: 0;" small>
|
||||
ms
|
||||
</p>
|
||||
</va-input>
|
||||
<va-input
|
||||
v-if="data.chartXMode === 'value'"
|
||||
class="mx-1"
|
||||
@keyup.enter="xIntervalChange(xIntervalInput)"
|
||||
@blur="xIntervalChange(xIntervalInput)"
|
||||
v-model="xIntervalInput"
|
||||
:label="'x-grid'"
|
||||
>
|
||||
<p slot="append" style="margin-right: 0;" small>
|
||||
{{data.chartXUnit}}
|
||||
</p>
|
||||
</va-input>
|
||||
<va-input
|
||||
class="mx-1"
|
||||
@keyup.enter="yIntervalChange(yIntervalInput)"
|
||||
@blur="yIntervalChange(yIntervalInput)"
|
||||
v-model="yIntervalInput"
|
||||
:label="'y-grid'"
|
||||
>
|
||||
<p slot="append" style="margin-right: 0;" small>
|
||||
{{data.chartYUnit}}
|
||||
</p>
|
||||
</va-input>
|
||||
<va-input
|
||||
v-if="data.chartDevice === 'neulive'"
|
||||
class="mx-1"
|
||||
@keyup.enter="threeAxisIntervalChange(threeAxisIntervalInput)"
|
||||
@blur="threeAxisIntervalChange(threeAxisIntervalInput)"
|
||||
v-model="threeAxisIntervalInput"
|
||||
:label="'3axis-grid'"
|
||||
>
|
||||
<p slot="append" style="margin-right: 0;" small>
|
||||
g
|
||||
</p>
|
||||
</va-input>
|
||||
</div>
|
||||
<div class="row flex ma-0 pa-0">
|
||||
<canvas-chart-filter :chartID="chartID" :filterIndex="0" />
|
||||
<canvas-chart-filter :chartID="chartID" :filterIndex="1" />
|
||||
<canvas-chart-filter :chartID="chartID" :filterIndex="2" />
|
||||
</div>
|
||||
</va-card>
|
||||
<canvas-chart-filter-popup :ref="'filter_popup_ref'" :chartID="chartID" :chartRef="this.$refs.chart_ref" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import { InitChartsData, getChartsData } from '../../../../../data/task/ChartsManagement'
|
||||
import CanvasChartSetting from './CanvasChartSetting'
|
||||
import CanvasChartFilter from './CanvasChartFilter.vue'
|
||||
import CanvasChartFilterPopup from './CanvasChartFilterPopup.vue'
|
||||
// import CanvasChartSetting from './CanvasChartSetting'
|
||||
import CanvasChartSource from './CanvasChartSource'
|
||||
import { taskInfo } from '../../../../data/task/TaskInfo'
|
||||
import { chartData } from '../../../../data/task/ChartsManagement'
|
||||
@@ -110,8 +114,10 @@ import { chartData } from '../../../../data/task/ChartsManagement'
|
||||
export default {
|
||||
name: 'CanvasChart',
|
||||
components: {
|
||||
CanvasChartSetting,
|
||||
// CanvasChartSetting,
|
||||
CanvasChartSource,
|
||||
CanvasChartFilter,
|
||||
CanvasChartFilterPopup,
|
||||
},
|
||||
props: {
|
||||
chartID: {
|
||||
@@ -195,7 +201,7 @@ export default {
|
||||
if (parseInt(y.channel) <= 255) {
|
||||
if (chartData.getAllChartsData()[this.chartID].chartYUnit === 'uV') {
|
||||
y.interval = parseInt(val)
|
||||
console.log(y.interval)
|
||||
// console.log(y.interval)
|
||||
} else {
|
||||
y.interval = val * 1000
|
||||
}
|
||||
@@ -292,12 +298,49 @@ export default {
|
||||
this.$refs.chart_ref.resize()
|
||||
}
|
||||
},
|
||||
showFilterPopup (params) {
|
||||
this.$refs.filter_popup_ref.showPanel(params)
|
||||
},
|
||||
setCursor (params) {
|
||||
this.$refs.chart_ref.chart._zr.setCursorStyle('copy')
|
||||
},
|
||||
legendChange (params) {
|
||||
const activeLegendLen = Object.values(params.selected).filter(val => val === true).length
|
||||
let index = 0
|
||||
for (const [gridIndex, value] of Object.values(params.selected).entries()) { // [TODO] 技術債,目前real time chart一個grid只對應一條series
|
||||
if (value === true) {
|
||||
this.data.grid[gridIndex].height = (85 / activeLegendLen) + '%'
|
||||
this.data.grid[gridIndex].top = index * (85 / activeLegendLen) + 1 + '%'
|
||||
index++
|
||||
} else {
|
||||
this.data.grid[gridIndex].height = '0%'
|
||||
this.data.grid[gridIndex].top = '0%'
|
||||
}
|
||||
}
|
||||
},
|
||||
selectAllSeries () {
|
||||
this.$refs.chart_ref.dispatchAction({
|
||||
type: 'legendAllSelect',
|
||||
})
|
||||
},
|
||||
inverseSelectAllSeries () {
|
||||
this.$refs.chart_ref.dispatchAction({
|
||||
type: 'legendInverseSelect',
|
||||
})
|
||||
},
|
||||
},
|
||||
async mounted () {
|
||||
this.resizeTimer = setInterval(this.resize, 1000)
|
||||
this.nameCard = chartData.getAllChartsData()[this.chartID].cardName
|
||||
await this.refreshMappingSelect()
|
||||
this.initDone = true
|
||||
if (this.$refs.chart_ref != null) {
|
||||
this.$refs.chart_ref.chart._zr.on('click', this.showFilterPopup)
|
||||
this.$refs.chart_ref.chart._zr.on('mousemove', this.setCursor)
|
||||
this.$refs.chart_ref.chart.on('legendselectchanged', this.legendChange)
|
||||
this.$refs.chart_ref.chart.on('legendselectall', this.legendChange)
|
||||
this.$refs.chart_ref.chart.on('legendinverseselect', this.legendChange)
|
||||
}
|
||||
// this.timeIntervalInput = '500'
|
||||
// this.timeIntervalChange('500')
|
||||
},
|
||||
@@ -309,6 +352,12 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.circle-button {
|
||||
height: 25px;
|
||||
width: 25px;
|
||||
border-radius: '50%';
|
||||
}
|
||||
|
||||
.no-dark-style-va-button {
|
||||
&:focus {
|
||||
filter: brightness(100%);
|
||||
|
||||
@@ -0,0 +1,208 @@
|
||||
<template>
|
||||
<div class="row flex pa-0 ma-0">
|
||||
<div class="filter-input my-0 pa-0 mx-1">
|
||||
<va-select
|
||||
small
|
||||
noClear
|
||||
:label="'FILTER ' + (filterIndex + 1)"
|
||||
v-model="selectFilter"
|
||||
textBy="name"
|
||||
:options="optionFilter"
|
||||
/>
|
||||
</div>
|
||||
<va-input
|
||||
:label="'order'"
|
||||
class="mx-1 order-input"
|
||||
v-model="order"
|
||||
/>
|
||||
<va-input
|
||||
v-if="[1, 2, 3].indexOf(selectFilter.id) >= 0"
|
||||
:label="'FREQ'"
|
||||
class="mx-1 freq-input"
|
||||
v-model="freq2"
|
||||
>
|
||||
<p slot="append" style="margin-right: 0;" small>
|
||||
Hz
|
||||
</p>
|
||||
</va-input>
|
||||
<va-input
|
||||
v-if="selectFilter.id > 3"
|
||||
:label="'FREQ MIN'"
|
||||
class="mx-1 freq-input"
|
||||
v-model="freq0"
|
||||
>
|
||||
<p slot="append" style="margin-right: 0;" small>
|
||||
Hz
|
||||
</p>
|
||||
</va-input>
|
||||
<va-input
|
||||
v-if="selectFilter.id > 3"
|
||||
:label="'FREQ MAX'"
|
||||
class="mx-1 freq-input"
|
||||
v-model="freq1"
|
||||
>
|
||||
<p slot="append" style="margin-right: 0;" small>
|
||||
Hz
|
||||
</p>
|
||||
</va-input>
|
||||
<va-button
|
||||
flat
|
||||
small
|
||||
:color="buttonColor"
|
||||
class="circle-button pa-0 mx-0 filter-apply-button"
|
||||
:icon="buttonIcon"
|
||||
@click.stop="updateFilterInfo(filterIndex)"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { chartData } from '@/data/task/ChartsManagement'
|
||||
import { taskInfo } from '@/data/task/TaskInfo'
|
||||
import api from '@/data/api'
|
||||
import { mapFields } from 'vuex-map-fields'
|
||||
import { IIRFilter } from '@/data/task/filter/IIRFilter.js'
|
||||
|
||||
export default {
|
||||
name: 'canvas-chart-filter',
|
||||
props: {
|
||||
chartID: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
filterIndex: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapFields('taskContent', [
|
||||
'filter',
|
||||
]),
|
||||
buttonIcon () {
|
||||
if (this.data.series.length > 0 && this.data.series.every(item => item != null)) {
|
||||
return this.data.series.every(item => item.filter[this.filterIndex].filter != null) ? 'fa fa-stop' : 'fa fa-play'
|
||||
}
|
||||
return 'fa fa-play'
|
||||
},
|
||||
buttonColor () {
|
||||
if (this.data.series.length > 0 && this.data.series.every(item => item != null)) {
|
||||
return this.data.series.every(item => item.filter[this.filterIndex].filter != null) ? 'danger' : 'primary'
|
||||
}
|
||||
return 'fa fa-play'
|
||||
},
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
data: chartData.getAllChartsData()[this.chartID],
|
||||
selectFilter: {
|
||||
id: 1,
|
||||
name: 'notch',
|
||||
},
|
||||
order: 20,
|
||||
freq0: 60,
|
||||
freq1: 60,
|
||||
freq2: 60,
|
||||
optionFilter: [
|
||||
{
|
||||
id: 1,
|
||||
name: 'notch',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: 'lowpass',
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: 'highpass',
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: 'bandstop',
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: 'bandpass',
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async updateFilterInfo (index) {
|
||||
let closeFilter = false
|
||||
for (let i = 0; i < this.data.series.length; i++) {
|
||||
if (this.data.series[i].filter[this.filterIndex].filter != null) {
|
||||
this.data.series[i].filter[this.filterIndex].filter = null
|
||||
closeFilter = true
|
||||
}
|
||||
}
|
||||
if (closeFilter) {
|
||||
return false
|
||||
}
|
||||
let fs = 0
|
||||
let sos = []
|
||||
for (let i = 0; i < this.data.series.length; i++) {
|
||||
const deviceID = this.data.series[i].yAxisSource[0]
|
||||
// const _fs = taskInfo.getDeviceInfo(deviceID).parameterSet.SAMPLE_RATE
|
||||
const _fs = 1000
|
||||
const _chNum = taskInfo.getDeviceInfo(deviceID).parameterSet.CH_NUMBER
|
||||
// console.log(_fs, _chNum)
|
||||
if (fs !== _fs) {
|
||||
fs = _fs
|
||||
const ret = await api.analysis.IIRFilter({
|
||||
type: this.selectFilter.name,
|
||||
order: this.order,
|
||||
fs: parseFloat(_fs / _chNum),
|
||||
f0: parseFloat(this.freq0),
|
||||
f1: parseFloat(this.freq1),
|
||||
f2: parseFloat(this.freq2),
|
||||
})
|
||||
|
||||
if (ret.status !== 200) {
|
||||
return false
|
||||
}
|
||||
|
||||
const _sosRet = ret.data.split('/')
|
||||
const _sos = []
|
||||
_sosRet.forEach((v, vi) => {
|
||||
const _tmp = v.split(',')
|
||||
const _arr = []
|
||||
_tmp.forEach(s => {
|
||||
_arr.push(parseFloat(s))
|
||||
})
|
||||
_sos.push(_arr)
|
||||
})
|
||||
sos = _sos
|
||||
}
|
||||
this.data.series[i].filter[index].type = this.selectFilter.name
|
||||
this.data.series[i].filter[index].order = this.order
|
||||
// sampling rate changed by channel number
|
||||
this.data.series[i].filter[index].fs = parseFloat(_fs / _chNum)
|
||||
this.data.series[i].filter[index].f0 = parseFloat(this.freq0)
|
||||
this.data.series[i].filter[index].f1 = parseFloat(this.freq1)
|
||||
this.data.series[i].filter[index].f2 = parseFloat(this.freq2)
|
||||
this.data.series[i].filter[index].sos = sos
|
||||
this.data.series[i].filter[index].filter = IIRFilter.init(sos)
|
||||
}
|
||||
// console.log(this.data)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang='scss'>
|
||||
.filter-input {
|
||||
max-width: 100px;
|
||||
}
|
||||
|
||||
.freq-input {
|
||||
max-width: 80px;
|
||||
}
|
||||
|
||||
.order-input {
|
||||
max-width: 50px;
|
||||
}
|
||||
|
||||
.filter-apply-button {
|
||||
max-width: 25px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,86 @@
|
||||
<template>
|
||||
<div>
|
||||
<va-modal
|
||||
class="flex sm12 xl12 md12 xs12"
|
||||
v-model="showModal"
|
||||
:title="'Grid ' + (gridIndex + 1)"
|
||||
:position="position"
|
||||
cancelText=""
|
||||
okText=""
|
||||
size="small"
|
||||
>
|
||||
<div class="row flex ma-0 pa-0">
|
||||
<canvas-chart-individual-filter :chartID="chartID" :seriesIndex="gridIndex" :filterIndex="0" />
|
||||
<canvas-chart-individual-filter :chartID="chartID" :seriesIndex="gridIndex" :filterIndex="1" />
|
||||
<canvas-chart-individual-filter :chartID="chartID" :seriesIndex="gridIndex" :filterIndex="2" />
|
||||
</div>
|
||||
</va-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { chartData } from '@/data/task/ChartsManagement'
|
||||
import CanvasChartIndividualFilter from './CanvasChartIndividualFilter.vue'
|
||||
|
||||
export default {
|
||||
name: 'canvas-chart-filter-popup',
|
||||
components: {
|
||||
CanvasChartIndividualFilter,
|
||||
},
|
||||
props: {
|
||||
chartID: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
chartRef: {
|
||||
type: Object,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
showModal: false,
|
||||
position: 'center',
|
||||
data: chartData.getAllChartsData()[this.chartID],
|
||||
gridIndex: 0,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
showPanel (params) {
|
||||
// console.log(this.data)
|
||||
if (this.chartRef != null) {
|
||||
let _gridIndex = 0
|
||||
for (_gridIndex = 0; _gridIndex < this.data.grid.length; _gridIndex++) {
|
||||
if (this.chartRef.containPixel({ gridIndex: _gridIndex }, [params.offsetX, params.offsetY])) {
|
||||
this.position = 'left'
|
||||
this.showModal = true
|
||||
break
|
||||
}
|
||||
}
|
||||
this.gridIndex = _gridIndex
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang='scss'>
|
||||
.filter-input {
|
||||
max-width: 100px;
|
||||
}
|
||||
|
||||
.freq-input {
|
||||
max-width: 80px;
|
||||
}
|
||||
|
||||
.order-input {
|
||||
max-width: 50px;
|
||||
}
|
||||
|
||||
.filter-apply-button {
|
||||
max-width: 25px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,214 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="filter-input my-0 pa-0 mx-1">
|
||||
<va-select
|
||||
small
|
||||
noClear
|
||||
:label="'FILTER ' + (filterIndex + 1)"
|
||||
v-model="selectFilter"
|
||||
textBy="name"
|
||||
:options="optionFilter"
|
||||
/>
|
||||
</div>
|
||||
<va-input
|
||||
:label="'order'"
|
||||
class="mx-1 order-input"
|
||||
v-model="order"
|
||||
/>
|
||||
<va-input
|
||||
v-if="[1, 2, 3].indexOf(selectFilter.id) >= 0"
|
||||
:label="'FREQ'"
|
||||
class="mx-1 freq-input"
|
||||
v-model="freq2"
|
||||
>
|
||||
<p slot="append" style="margin-right: 0;" small>
|
||||
Hz
|
||||
</p>
|
||||
</va-input>
|
||||
<va-input
|
||||
v-if="selectFilter.id > 3"
|
||||
:label="'FREQ MIN'"
|
||||
class="mx-1 freq-input"
|
||||
v-model="freq0"
|
||||
>
|
||||
<p slot="append" style="margin-right: 0;" small>
|
||||
Hz
|
||||
</p>
|
||||
</va-input>
|
||||
<va-input
|
||||
v-if="selectFilter.id > 3"
|
||||
:label="'FREQ MAX'"
|
||||
class="mx-1 freq-input"
|
||||
v-model="freq1"
|
||||
>
|
||||
<p slot="append" style="margin-right: 0;" small>
|
||||
Hz
|
||||
</p>
|
||||
</va-input>
|
||||
<va-button
|
||||
flat
|
||||
small
|
||||
:color="buttonColor"
|
||||
class="circle-button pa-0 mx-0 filter-apply-button"
|
||||
:icon="buttonIcon"
|
||||
@click.stop="updateFilterInfo(filterIndex, seriesIndex)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { chartData } from '@/data/task/ChartsManagement'
|
||||
import { taskInfo } from '@/data/task/TaskInfo'
|
||||
import api from '@/data/api'
|
||||
import { mapFields } from 'vuex-map-fields'
|
||||
import { IIRFilter } from '@/data/task/filter/IIRFilter.js'
|
||||
|
||||
export default {
|
||||
name: 'canvas-chart-filter-individual-filter',
|
||||
props: {
|
||||
chartID: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
seriesIndex: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
filterIndex: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapFields('taskContent', [
|
||||
'filter',
|
||||
]),
|
||||
buttonIcon () {
|
||||
if (this.data.series[this.seriesIndex] != null) {
|
||||
return this.data.series[this.seriesIndex].filter[this.filterIndex].filter != null ? 'fa fa-stop' : 'fa fa-play'
|
||||
}
|
||||
return 'fa fa-play'
|
||||
},
|
||||
buttonColor () {
|
||||
if (this.data.series[this.seriesIndex] != null) {
|
||||
return this.data.series[this.seriesIndex].filter[this.filterIndex].filter != null ? 'danger' : 'primary'
|
||||
}
|
||||
return 'fa fa-play'
|
||||
},
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
data: chartData.getAllChartsData()[this.chartID],
|
||||
selectFilter: {
|
||||
id: 1,
|
||||
name: 'notch',
|
||||
},
|
||||
order: 20,
|
||||
freq0: 0,
|
||||
freq1: 0,
|
||||
freq2: 0,
|
||||
optionFilter: [
|
||||
{
|
||||
id: 1,
|
||||
name: 'notch',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: 'lowpass',
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: 'highpass',
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: 'bandstop',
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: 'bandpass',
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async updateFilterInfo (_filterIndex, _seriesIndex) {
|
||||
let closeFilter = false
|
||||
if (this.data.series[_seriesIndex].filter[_filterIndex].filter != null) {
|
||||
this.data.series[_seriesIndex].filter[_filterIndex].filter = null
|
||||
closeFilter = true
|
||||
}
|
||||
if (closeFilter) {
|
||||
return false
|
||||
}
|
||||
let fs = 0
|
||||
let sos = []
|
||||
const deviceID = this.data.series[_seriesIndex].yAxisSource[0]
|
||||
// const _fs = taskInfo.getDeviceInfo(deviceID).parameterSet.SAMPLE_RATE
|
||||
const _fs = 1000
|
||||
const _chNum = taskInfo.getDeviceInfo(deviceID).parameterSet.CH_NUMBER
|
||||
// console.log(_fs, _chNum)
|
||||
if (fs !== _fs) {
|
||||
fs = _fs
|
||||
const ret = await api.analysis.IIRFilter({
|
||||
type: this.selectFilter.name,
|
||||
order: this.order,
|
||||
fs: parseInt(_fs / _chNum),
|
||||
f0: parseInt(this.freq0),
|
||||
f1: parseInt(this.freq1),
|
||||
f2: parseInt(this.freq2),
|
||||
})
|
||||
|
||||
if (ret.status !== 200) {
|
||||
return false
|
||||
}
|
||||
|
||||
const _sosRet = ret.data.split('/')
|
||||
const _sos = []
|
||||
_sosRet.forEach((v, vi) => {
|
||||
const _tmp = v.split(',')
|
||||
const _arr = []
|
||||
_tmp.forEach(s => {
|
||||
_arr.push(parseFloat(s))
|
||||
})
|
||||
_sos.push(_arr)
|
||||
})
|
||||
sos = _sos
|
||||
}
|
||||
this.data.series[_seriesIndex].filter[_filterIndex].type = this.selectFilter.name
|
||||
this.data.series[_seriesIndex].filter[_filterIndex].order = this.order
|
||||
// sampling rate changed by channel number
|
||||
this.data.series[_seriesIndex].filter[_filterIndex].fs = parseInt(_fs / _chNum)
|
||||
this.data.series[_seriesIndex].filter[_filterIndex].f0 = parseInt(this.freq0)
|
||||
this.data.series[_seriesIndex].filter[_filterIndex].f1 = parseInt(this.freq1)
|
||||
this.data.series[_seriesIndex].filter[_filterIndex].f2 = parseInt(this.freq2)
|
||||
this.data.series[_seriesIndex].filter[_filterIndex].sos = sos
|
||||
this.data.series[_seriesIndex].filter[_filterIndex].filter = IIRFilter.init(sos)
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
this.selectFilter = this.optionFilter.find(item => item.name === this.data.series[this.seriesIndex].filter[this.filterIndex].type)
|
||||
this.freq0 = this.data.series[this.seriesIndex].filter[this.filterIndex].f0
|
||||
this.freq1 = this.data.series[this.seriesIndex].filter[this.filterIndex].f1
|
||||
this.freq2 = this.data.series[this.seriesIndex].filter[this.filterIndex].f2
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang='scss'>
|
||||
.filter-input {
|
||||
max-width: 100px;
|
||||
}
|
||||
|
||||
.freq-input {
|
||||
max-width: 80px;
|
||||
}
|
||||
|
||||
.order-input {
|
||||
max-width: 50px;
|
||||
}
|
||||
|
||||
.filter-apply-button {
|
||||
max-width: 25px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,90 +1,45 @@
|
||||
<template>
|
||||
<div>
|
||||
<va-tree-root>
|
||||
<va-tree-category isOpen label="Products">
|
||||
<va-tree-node
|
||||
v-for="product in products"
|
||||
:key="product.id"
|
||||
>
|
||||
<div class="flex row align--center">
|
||||
<va-input v-model="product.name" class="mb-0"/>
|
||||
<va-icon
|
||||
name="ion ion-md-close"
|
||||
color="info"
|
||||
class="ml-2 pa-1 shrink"
|
||||
style="cursor: pointer;"
|
||||
@click.native="removeProduct(product)"
|
||||
/>
|
||||
</div>
|
||||
</va-tree-node>
|
||||
<va-tree-node>
|
||||
<va-button class="mb-2" @click="addProduct()">
|
||||
Add new product
|
||||
</va-button>
|
||||
</va-tree-node>
|
||||
</va-tree-category>
|
||||
|
||||
<va-tree-category label="Electronics">
|
||||
<va-tree-node v-for="electronic in electronics" :key="electronic.id">
|
||||
<va-input v-model="electronic.name" class="mb-0"/>
|
||||
</va-tree-node>
|
||||
</va-tree-category>
|
||||
|
||||
<va-tree-category isOpen label="Products">
|
||||
<va-tree-node
|
||||
v-for="product in products"
|
||||
:key="product.id"
|
||||
>
|
||||
<div class="flex row align--center">
|
||||
<va-input v-model="product.name" class="mb-0"/>
|
||||
<va-icon
|
||||
name="ion ion-md-close"
|
||||
color="info"
|
||||
class="ml-2 pa-1 shrink"
|
||||
style="cursor: pointer;"
|
||||
@click.native="removeProduct(product)"
|
||||
/>
|
||||
</div>
|
||||
</va-tree-node>
|
||||
<va-tree-node>
|
||||
<va-button class="mb-2" @click="addProduct()">
|
||||
Add new product
|
||||
</va-button>
|
||||
</va-tree-node>
|
||||
</va-tree-category>
|
||||
|
||||
</va-tree-root>
|
||||
<div class="row flex sm12 xl12 md12 xs12 align--center my-0 py-0">
|
||||
<div class="flex sm9 xl9 md9 xs9 px-0 mx-0">
|
||||
<p class="display-6">filter<p/>
|
||||
</div>
|
||||
<div class="flex sm3 xl3 md3 xs3 pa-0 ma-0">
|
||||
<va-toggle v-model="data.filter.open" small @click.native="() => {}"/>
|
||||
</div>
|
||||
<!-- <div class="flex sm12 xl12 md12 xs12 px-0 mx-0">
|
||||
<p class="display-6">Protect recording channels<p/>
|
||||
</div>
|
||||
<div class="flex sm12 xl12 md12 xs12 px-0 mx-0">
|
||||
<va-radio-button
|
||||
v-for="(option, index) in optionProtectRec"
|
||||
:key="index"
|
||||
v-model="selectProtectRec"
|
||||
:option="optionProtectRec[index]"
|
||||
:label="optionProtectRec[index]"
|
||||
/>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { chartData } from '../../../../data/task/ChartsManagement'
|
||||
|
||||
export default {
|
||||
name: 'canvas-chart-setting',
|
||||
props: {
|
||||
chartID: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
gridNumber: 8,
|
||||
electronics: [
|
||||
{ id: 1, name: 'Cellphones' },
|
||||
{ id: 2, name: 'Camera Body Kits' },
|
||||
{ id: 3, name: 'External HDDs' },
|
||||
],
|
||||
products: [
|
||||
{ id: 4, name: 'Cables' },
|
||||
{ id: 5, name: 'Monitors' },
|
||||
{ id: 6, name: 'Keyboards' },
|
||||
],
|
||||
data: chartData.getAllChartsData()[this.chartID],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addProduct () {
|
||||
this.products.push({
|
||||
id: Math.floor(Math.random() * 100000),
|
||||
name: 'New product',
|
||||
})
|
||||
},
|
||||
removeProduct (product) {
|
||||
this.products = this.products.filter(productToFilter => productToFilter !== product)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -205,7 +205,7 @@ export default {
|
||||
this.channelSelectDisableY = true
|
||||
} else if (taskInfo.getDeviceInfo(this.deviceSelectY.id).info.library_name.indexOf('Neulive') >= 0) {
|
||||
const channelSet = taskInfo.getDeviceInfo(this.deviceSelectY.id).parameterSet.RECORDING_CH.toString(2).split('').reverse()
|
||||
console.log(channelSet)
|
||||
// console.log(channelSet)
|
||||
channelSet.forEach((element, index) => {
|
||||
if (parseInt(element) > 0) {
|
||||
channelOptions.push({
|
||||
@@ -249,7 +249,7 @@ export default {
|
||||
} else {
|
||||
channelSet = taskInfo.getDeviceInfo(this.deviceSelectY.id).parameterSet.CHANNEL_LABEL
|
||||
}
|
||||
console.log(channelSet)
|
||||
// console.log(channelSet)
|
||||
channelSet.forEach((element, index) => {
|
||||
channelOptions.push({
|
||||
id: index + 1,
|
||||
@@ -321,8 +321,8 @@ export default {
|
||||
deviceNameY = 'Time'
|
||||
}
|
||||
chartData.register(this.chartID, gridIndex, deviceNameX, deviceIDX, channelX, deviceNameY, deviceIDY, channelY, null)
|
||||
console.log(this.chartID, gridIndex, deviceNameX, deviceIDX, channelX, deviceNameY, deviceIDY, channelY, null)
|
||||
console.log(this.deviceSelectX, this.channelSelectX, this.deviceSelectY, this.channelSelectY)
|
||||
// console.log(this.chartID, gridIndex, deviceNameX, deviceIDX, channelX, deviceNameY, deviceIDY, channelY, null)
|
||||
// console.log(this.deviceSelectX, this.channelSelectX, this.deviceSelectY, this.channelSelectY)
|
||||
if (deviceNameX !== 'Time') {
|
||||
this.sourceList.push([this.deviceSelectX.name, deviceIDX, channelX].toString())
|
||||
}
|
||||
@@ -343,7 +343,7 @@ export default {
|
||||
value: String(i),
|
||||
})
|
||||
}
|
||||
console.log(chartData.getAllChartsData()[this.chartID])
|
||||
// console.log(chartData.getAllChartsData()[this.chartID])
|
||||
},
|
||||
checkSourceAddStatus () {
|
||||
if (this.sourceList.indexOf([this.deviceSelectX.name, this.deviceSelectX.id, this.channelSelectX.id].toString()) >= 0) {
|
||||
|
||||
@@ -0,0 +1,225 @@
|
||||
<template>
|
||||
<div class="flex" :class="cardclass">
|
||||
<va-card>
|
||||
<chart :ref="'chart_ref'" :style="'width: '+ cardwidth + '; height: ' + cardheight + ';'" :options="sketchmapData" :auto-resize="true"></chart>
|
||||
</va-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { mapActions } from 'vuex'
|
||||
import { taskInfo } from '@/data/task/TaskInfo'
|
||||
import { mapFields } from 'vuex-map-fields'
|
||||
import deviceTypes from '@/store/modules/device/types'
|
||||
|
||||
export default {
|
||||
name: 'TriggerChart',
|
||||
components: {
|
||||
},
|
||||
computed: {
|
||||
...mapFields('device', [
|
||||
'triggerList',
|
||||
'allChannels',
|
||||
]),
|
||||
},
|
||||
props: {
|
||||
mac: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
created () {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
timer: null,
|
||||
cardclass: ['xs12', 'md12', 'xl12', 'sm12'],
|
||||
cardheight: '400px',
|
||||
cardwidth: 'auto',
|
||||
sketchmapData: {},
|
||||
activeChannels: [],
|
||||
}
|
||||
},
|
||||
mqtt: {
|
||||
async '+/data-server/trigger_manager/#' (data, topic) {
|
||||
const mes = new TextDecoder('utf-8').decode(data)
|
||||
const topicSplit = topic.split('/')
|
||||
const baseIndex = topicSplit.indexOf('trigger_manager')
|
||||
const actionIndex = baseIndex + 1
|
||||
const action = topicSplit[actionIndex]
|
||||
const macIndex = baseIndex + 2
|
||||
let _mac
|
||||
if (topicSplit.length - 1 >= macIndex) {
|
||||
_mac = topicSplit[macIndex]
|
||||
}
|
||||
if (_mac === this.mac) {
|
||||
switch (action) {
|
||||
case 'set_parameter': // control_ID/data-server/trigger_manager/set_parameter/device_mac
|
||||
await this.initActiveChannels()
|
||||
this.initChart()
|
||||
break
|
||||
case 'runtime': // control_ID/data-server/trigger_manager/runtime/device_mac
|
||||
this.updateTimer(mes)
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
},
|
||||
'+/data-server/trigger_runtime/#' (data, topic) { // control_ID/data-server/trigger_runtime/pin_event/device_mac/channel
|
||||
const mes = new TextDecoder('utf-8').decode(data)
|
||||
const topicSplit = topic.split('/')
|
||||
const baseIndex = topicSplit.indexOf('trigger_runtime')
|
||||
const actionIndex = baseIndex + 1
|
||||
const action = topicSplit[actionIndex]
|
||||
const macIndex = baseIndex + 2
|
||||
const channelIndex = baseIndex + 3
|
||||
let _mac
|
||||
if (topicSplit.length - 1 >= macIndex) {
|
||||
_mac = topicSplit[macIndex]
|
||||
}
|
||||
let channel
|
||||
if (topicSplit.length - 1 >= channelIndex) {
|
||||
channel = parseInt(topicSplit[channelIndex])
|
||||
}
|
||||
let mesJson
|
||||
if (_mac === this.mac) {
|
||||
switch (action) {
|
||||
case 'pin_event':
|
||||
mesJson = JSON.parse(mes)
|
||||
this.addSketchMapData(mesJson.timestamp, mesJson.status === 'high' ? 3.3 : 0.0, channel)
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
addSketchMapData (timestamp, val, channel) {
|
||||
const gridIndex = this.activeChannels.indexOf(channel)
|
||||
this.sketchmapData.series[gridIndex].data.push([parseInt(timestamp), val])
|
||||
if (this.sketchmapData.series[gridIndex].data.length > 1000) {
|
||||
this.sketchmapData.series[gridIndex].data.shift()
|
||||
}
|
||||
},
|
||||
mqttSub: function (val) {
|
||||
this.$mqtt.subscribe(val)
|
||||
},
|
||||
mqttUnSub: function (val) {
|
||||
this.$mqtt.unsubscribe(val)
|
||||
},
|
||||
makeGrid (index, length) {
|
||||
const _height = (100 / length) - 2 + '%'
|
||||
const _top = index * (100 / length) + 2 + '%'
|
||||
const _left = '0%'
|
||||
const _right = '3%'
|
||||
return {
|
||||
index: index,
|
||||
top: _top,
|
||||
height: _height,
|
||||
left: _left,
|
||||
right: _right,
|
||||
containLabel: true,
|
||||
}
|
||||
},
|
||||
makeSeries (xAxisIndex, yAxisIndex) {
|
||||
return {
|
||||
type: 'line',
|
||||
step: 'start',
|
||||
data: [],
|
||||
animation: false,
|
||||
xAxisIndex: xAxisIndex,
|
||||
yAxisIndex: yAxisIndex,
|
||||
}
|
||||
},
|
||||
makeXAxis (gridIndex) {
|
||||
return {
|
||||
show: false,
|
||||
type: 'time',
|
||||
gridIndex: gridIndex,
|
||||
min: 'dataMin',
|
||||
max: 'dataMax',
|
||||
}
|
||||
},
|
||||
makeYAxis (gridIndex) {
|
||||
return {
|
||||
type: 'value',
|
||||
gridIndex: gridIndex,
|
||||
splitNumber: 1,
|
||||
splitLine: {
|
||||
show: false,
|
||||
},
|
||||
axisLabel: {
|
||||
formatter: function (value) {
|
||||
return value + 'V'
|
||||
},
|
||||
},
|
||||
min: 'dataMin',
|
||||
max: 'dataMax',
|
||||
}
|
||||
},
|
||||
async initActiveChannels () {
|
||||
this.activeChannels = await this.deviceTriggerGetActiveChannels({ mac: this.mac })
|
||||
},
|
||||
initChart () {
|
||||
this.clearChart()
|
||||
const currImplementedChannels = this.activeChannels.filter(ch => ch < 4) // [TODO] now only open 4 channels (2022/01/05)
|
||||
const gridLength = currImplementedChannels.length
|
||||
for (let gridIndex = 0; gridIndex < gridLength; gridIndex++) {
|
||||
this.sketchmapData.grid.push(this.makeGrid(gridIndex, gridLength))
|
||||
this.sketchmapData.xAxis.push(this.makeXAxis(gridIndex))
|
||||
this.sketchmapData.yAxis.push(this.makeYAxis(gridIndex))
|
||||
this.sketchmapData.series.push(this.makeSeries(gridIndex, gridIndex))
|
||||
if (gridIndex === gridLength - 1) {
|
||||
this.sketchmapData.xAxis[gridLength - 1].show = true
|
||||
}
|
||||
}
|
||||
},
|
||||
clearChart () {
|
||||
this.sketchmapData = {
|
||||
xAxis: [],
|
||||
yAxis: [],
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
},
|
||||
series: [],
|
||||
grid: [],
|
||||
}
|
||||
},
|
||||
updateTimer (status) {
|
||||
if (status === 'start') {
|
||||
if (this.timer === null) {
|
||||
this.timer = setInterval(this.updateCurrentTime, 1000)
|
||||
}
|
||||
} else {
|
||||
clearInterval(this.timer)
|
||||
this.timer = null
|
||||
}
|
||||
},
|
||||
updateCurrentTime () {
|
||||
const currTime = Date.now()
|
||||
this.sketchmapData.xAxis.forEach(axis => {
|
||||
axis.min = currTime - 10000 // 10000ms = 10s
|
||||
axis.max = currTime + 1000
|
||||
})
|
||||
},
|
||||
|
||||
...mapActions('device', [deviceTypes.trigger.getActiveChannels]),
|
||||
},
|
||||
async mounted () {
|
||||
this.mqttSub(taskInfo.getTaskInfo().controllerID + '/data-server/trigger_manager/#')
|
||||
this.mqttSub(taskInfo.getTaskInfo().controllerID + '/data-server/trigger_runtime/#')
|
||||
await this.initActiveChannels()
|
||||
this.initChart()
|
||||
this.updateTimer('start')
|
||||
},
|
||||
destroyed () {
|
||||
this.mqttUnSub(taskInfo.getTaskInfo().controllerID + '/data-server/trigger_manager/#')
|
||||
this.mqttUnSub(taskInfo.getTaskInfo().controllerID + '/data-server/trigger_runtime/#')
|
||||
this.clearChart()
|
||||
this.updateTimer('stop')
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -10,7 +10,7 @@
|
||||
@ok="remove()"
|
||||
/>
|
||||
<va-accordion v-for="device in deviceList" :key="device.id">
|
||||
<va-collapse class="mb-2">
|
||||
<va-collapse class="mb-2" :isOpenDefault='true'>
|
||||
<span slot="header" >
|
||||
<va-item :key="device.id" class="pa-0 ma-0"
|
||||
>
|
||||
@@ -28,17 +28,31 @@
|
||||
</va-avatar>
|
||||
</va-item-section>
|
||||
|
||||
<va-item-section class="ml-3">
|
||||
<va-item-section class="ml-3" caption>
|
||||
<va-item-label>
|
||||
{{ device.name }}
|
||||
</va-item-label>
|
||||
|
||||
<va-item-label caption>
|
||||
{{ device.address }}
|
||||
</va-item-label>
|
||||
|
||||
</va-item-section>
|
||||
|
||||
<va-item-section class="mr-3" v-if="device.type == 'Neulive'" side>
|
||||
<i v-if="!device.sdCardStatus" class="i-sd-card mr-3" style="width: 1rem; height: 1rem;"></i>
|
||||
<!-- <va-icon
|
||||
name="fas fa-sd-card"
|
||||
:color="(device.sdCardStatus === true) ? 'primary' : 'grey'"
|
||||
class="mr-3"
|
||||
@click.native.stop="sdCardStatus(device)"
|
||||
>
|
||||
</va-icon> -->
|
||||
<va-icon
|
||||
size="1rem"
|
||||
:name="(device.transmission_type === 0) ? 'fa fa-bluetooth-b' : 'fa fa-usb'"
|
||||
color="primary"
|
||||
>
|
||||
</va-icon>
|
||||
</va-item-section>
|
||||
</va-item>
|
||||
|
||||
<va-item class="pa-0 ma-0 mt-2">
|
||||
@@ -57,7 +71,7 @@
|
||||
</va-item>
|
||||
</span>
|
||||
<div slot="body">
|
||||
<div class="mt-0 mb-0" style="height: 350px; overflow-y: scroll; overflow-x: hidden;" :key="'detail' + device.id">
|
||||
<div class="mt-0 mb-0" style="height: 60vh; overflow-y: scroll; overflow-x: hidden;" :key="'detail' + device.id">
|
||||
<!-- <div style="text-align: center;">
|
||||
<va-button @click.stop="generateChart(device)" class="pl-2 pr-2 mr-0 no-dark-style-va-button" small>GENERATE MAPPING CHART</va-button>
|
||||
</div> -->
|
||||
@@ -108,6 +122,12 @@ export default {
|
||||
computed: {
|
||||
},
|
||||
methods: {
|
||||
sdCardStatus: function (device) {
|
||||
this.$emit('sd_card_status', {
|
||||
id: device.id,
|
||||
sdCardStatus: device.sdCardStatus,
|
||||
})
|
||||
},
|
||||
removeCheck: function (device) {
|
||||
this.selectDevice = device
|
||||
this.showDeleteModal = true
|
||||
@@ -219,7 +239,7 @@ export default {
|
||||
...mapActions('taskContent', [types.param.checkIfRecordingSetDone, types.param.checkIfStimulationSetDone, types.param.checkIfDeviceSetDone]),
|
||||
},
|
||||
destroyed () {
|
||||
this.deviceList.length = 0
|
||||
// this.deviceList.length = 0
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="flex" :class="cardclass">
|
||||
<va-card style="height: 88vh; overflow: auto;">
|
||||
<va-card>
|
||||
<template slot="header">
|
||||
<va-icon name="fa fa-bluetooth-b mr-3" color="primary"/>
|
||||
<h5 class="mt-0 mb-0">DEVICES</h5>
|
||||
@@ -22,10 +22,12 @@
|
||||
@stop="stopDevice($event)"
|
||||
@record="record($event)"
|
||||
@stopRecord="stopRecord($event)"
|
||||
@sti="sti($event)" @sti_stop="stiStop($event)"
|
||||
@sti="sti($event)"
|
||||
@sti_stop="stiStop($event)"
|
||||
@fast_settle="fastSettle($event)"
|
||||
@generate="generateChart($event)"
|
||||
@detect="detectDevice($event)"
|
||||
@sd_card_status="sdCardStatus($event)"
|
||||
/>
|
||||
|
||||
<!-- <div class="row flex xs12 md12 xl12 sm12 mt-2" style="text-align: center;">
|
||||
@@ -46,22 +48,49 @@
|
||||
</div>
|
||||
|
||||
</va-card>
|
||||
<va-card class="mt-2">
|
||||
<template slot="header">
|
||||
<va-icon name="fa fa-bluetooth-b mr-3" color="primary"/>
|
||||
<h5 class="mt-0 mb-0">TRIGGERS</h5>
|
||||
</template>
|
||||
<div v-if="state.LOADING" class="flex-center spinner-box mt-4 mb-5">
|
||||
<fulfilling-bouncing-circle-spinner
|
||||
:animation-duration="3000"
|
||||
:color="this.$themes.primary"
|
||||
:size="60"
|
||||
>
|
||||
</fulfilling-bouncing-circle-spinner>
|
||||
</div>
|
||||
|
||||
<div class="flex row align--center">
|
||||
<trigger-list
|
||||
@start="startTrigger($event)"
|
||||
@stop="stopTrigger($event)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
</va-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { FulfillingBouncingCircleSpinner } from 'epic-spinners'
|
||||
import TaskDeviceList from './TaskDeviceList'
|
||||
import TriggerList from './TriggerList'
|
||||
// import TaskDeviceListGM from './neulive-gimer/TaskDeviceListGM'
|
||||
import { taskInfo } from '../../../../data/task/TaskInfo'
|
||||
import { chartData } from '../../../../data/task/ChartsManagement'
|
||||
import { dataStreamBuffer } from '../../../../data/task/DataStreamBuffer'
|
||||
import api from '@/data/api'
|
||||
import { mapFields } from 'vuex-map-fields'
|
||||
|
||||
export default {
|
||||
name: 'TaskDevices',
|
||||
components: {
|
||||
// TaskDeviceListGM,
|
||||
FulfillingBouncingCircleSpinner,
|
||||
TaskDeviceList,
|
||||
TriggerList,
|
||||
},
|
||||
props: {
|
||||
cardclass: {
|
||||
@@ -71,16 +100,22 @@ export default {
|
||||
},
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapFields('taskContent', [
|
||||
'deviceList',
|
||||
]),
|
||||
},
|
||||
created () {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
deviceSelect: '',
|
||||
deviceOptions: taskInfo.getDeviceListNotRegister(),
|
||||
deviceList: taskInfo.getDeviceListRegister(),
|
||||
// deviceList: this.deviceList,
|
||||
state: {
|
||||
LOADING: false,
|
||||
},
|
||||
stiTimeOut: null,
|
||||
}
|
||||
},
|
||||
mqtt: {
|
||||
@@ -105,7 +140,7 @@ export default {
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
console.log(this.deviceOptions)
|
||||
// // console.log(this.deviceOptions)
|
||||
for (let i = 0; i <= 11; i++) {
|
||||
if (taskInfo.getDeviceInfoByRawID(i).info.status === 'connected') {
|
||||
const index = this.deviceList.findIndex(d => taskInfo.getRawDeviceID(d.id) === i)
|
||||
@@ -113,9 +148,7 @@ export default {
|
||||
await this.addDevice(i)
|
||||
}
|
||||
} else {
|
||||
console.log(this.deviceList)
|
||||
const index = this.deviceList.findIndex(d => taskInfo.getRawDeviceID(d.id) === i)
|
||||
console.log(index)
|
||||
if (index > 0) {
|
||||
await this.removeDevice(this.deviceList[index])
|
||||
}
|
||||
@@ -128,7 +161,7 @@ export default {
|
||||
name: 'Time',
|
||||
})
|
||||
taskInfo.getDeviceList().push(...this.deviceList)
|
||||
console.log(taskInfo.getDeviceList())
|
||||
// // console.log(taskInfo.getDeviceList())
|
||||
// for (let i = this.deviceOptions.length - 1; i >= 0; i--) {
|
||||
// this.deviceSelect = this.deviceOptions[i]
|
||||
// await this.addDevice(this.deviceOptions[i].id)
|
||||
@@ -138,9 +171,9 @@ export default {
|
||||
// }
|
||||
},
|
||||
startDevice: async function (device) {
|
||||
await chartData.defaultChartGenerator(device.id, null, 'device')
|
||||
if (!taskInfo.getDeviceInfo(device.id).info.isSync) {
|
||||
if (taskInfo.getDeviceInfo(device.id).info.library_name.startsWith('Neulive')) {
|
||||
await chartData.defaultChartGenerator(this.deviceList, device.id, null, 'device')
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
device: taskInfo.getRawDeviceID(device.id),
|
||||
@@ -161,6 +194,21 @@ export default {
|
||||
|
||||
device.isStimulate = true
|
||||
} else if (taskInfo.getDeviceInfo(device.id).info.library_name.startsWith('Elite')) {
|
||||
const e1 = parseInt((taskInfo.getDeviceInfo(device.id).parameterSet.DPV_e_1 - 25000) / 5)
|
||||
const e2 = parseInt((taskInfo.getDeviceInfo(device.id).parameterSet.DPV_e_2 - 25000) / 5)
|
||||
const eFinal = parseInt((taskInfo.getDeviceInfo(device.id).parameterSet.DPV_e_final - 25000) / 5)
|
||||
const isDPVMode = taskInfo.getDeviceInfo(device.id).parameterSet.MODE === 15
|
||||
if (isDPVMode) {
|
||||
if (e1 >= e2 && !(e1 >= eFinal && eFinal >= e2)) {
|
||||
this.pageToast('[Error] Please set E Final correctly.')
|
||||
return false
|
||||
} else if (e2 > e1 && !(e2 >= eFinal && eFinal >= e1)) {
|
||||
this.pageToast('[Error] Please set E Final correctly.')
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
await chartData.defaultChartGenerator(this.deviceList, device.id, null, 'device')
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
device: taskInfo.getRawDeviceID(device.id),
|
||||
@@ -174,7 +222,7 @@ export default {
|
||||
api.task.update({
|
||||
device_config: taskInfo.getTaskInfo().deviceList,
|
||||
})
|
||||
console.log(taskInfo.getDeviceInfo(device.id))
|
||||
// // console.log(taskInfo.getDeviceInfo(device.id))
|
||||
}
|
||||
},
|
||||
stopDevice: async function (device) {
|
||||
@@ -184,12 +232,12 @@ export default {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
device: taskInfo.getRawDeviceID(device.id),
|
||||
instruction: 'stop_record',
|
||||
instruction: 'stop_stimulate',
|
||||
}))
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
device: taskInfo.getRawDeviceID(device.id),
|
||||
instruction: 'stop_stimulate',
|
||||
instruction: 'stop_record',
|
||||
}))
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_parameter/0',
|
||||
@@ -224,7 +272,11 @@ export default {
|
||||
}, 5000)
|
||||
},
|
||||
record: async function (device) {
|
||||
await chartData.defaultChartGenerator(device.id, null, 'device')
|
||||
if (taskInfo.getDeviceInfo(device.id).parameterSet.CH_NUMBER === 0) {
|
||||
this.pageToast('[Recording] Please select recording channels.')
|
||||
return false
|
||||
}
|
||||
await chartData.defaultChartGenerator(this.deviceList, device.id, null, 'device')
|
||||
if (!taskInfo.getDeviceInfo(device.id).info.isSync) {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
@@ -239,7 +291,7 @@ export default {
|
||||
})
|
||||
|
||||
// ### show device info
|
||||
console.log(taskInfo.getDeviceInfo(device.id))
|
||||
// // console.log(taskInfo.getDeviceInfo(device.id))
|
||||
}
|
||||
},
|
||||
stopRecord: function (device) {
|
||||
@@ -272,6 +324,13 @@ export default {
|
||||
device_config: taskInfo.getTaskInfo().deviceList,
|
||||
})
|
||||
device.isStimulate = true
|
||||
const stiExTime = taskInfo.getDeviceInfo(device.id).parameterSet.REPEAT_INTERVAL_littleEndian * taskInfo.getDeviceInfo(device.id).parameterSet.REPEAT_TIME_littleEndian
|
||||
clearTimeout(this.stiTimeOut)
|
||||
if (taskInfo.getDeviceInfo(device.id).parameterSet.CONTINUOUS_STI < 0) {
|
||||
this.stiTimeOut = setTimeout(() => {
|
||||
this.stiStop(device)
|
||||
}, (stiExTime + 3000))
|
||||
}
|
||||
},
|
||||
stiStop: function (device) {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
@@ -286,6 +345,7 @@ export default {
|
||||
content: 0,
|
||||
}))
|
||||
device.isStimulate = false
|
||||
clearTimeout(this.stiTimeOut)
|
||||
},
|
||||
fastSettle: function (device) {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
@@ -294,37 +354,32 @@ export default {
|
||||
instruction: 'FAST_SET',
|
||||
}))
|
||||
},
|
||||
// addDevice: async function () {
|
||||
// if (this.deviceSelect.id == null) {
|
||||
// return false
|
||||
// }
|
||||
// await taskInfo.getTaskInfo().deviceAddrList.push(taskInfo.getDeviceInfoByRawID(this.deviceSelect.id).info.device_address)
|
||||
// await taskInfo.getTaskInfo().taskDeviceID.push(this.deviceSelect.id)
|
||||
// const _address = this.GLOBAL.transMac(taskInfo.getDeviceInfoByRawID(this.deviceSelect.id).info.device_address)
|
||||
|
||||
// const pic = taskInfo.getDevicePic(taskInfo.getDeviceInfoByRawID(this.deviceSelect.id).info.library_name)
|
||||
// let type = ''
|
||||
// if (taskInfo.getDeviceInfoByRawID(this.deviceSelect.id).info.library_name.indexOf('Elite') >= 0) {
|
||||
// type = 'Elite'
|
||||
// } else if (taskInfo.getDeviceInfoByRawID(this.deviceSelect.id).info.library_name.indexOf('Neulive') >= 0) {
|
||||
// type = 'Neulive'
|
||||
// }
|
||||
|
||||
// const _device = {
|
||||
// id: taskInfo.getTaskInfo().taskDeviceID.indexOf(this.deviceSelect.id),
|
||||
// name: '[' + taskInfo.getTaskInfo().taskDeviceID.indexOf(this.deviceSelect.id) + '] ' + taskInfo.getDeviceInfoByRawID(this.deviceSelect.id).info.device_name,
|
||||
// addr: taskInfo.getDeviceInfoByRawID(this.deviceSelect.id).info.device_address,
|
||||
// address: _address,
|
||||
// picture: pic,
|
||||
// type: type,
|
||||
// isSync: taskInfo.getDeviceInfoByRawID(this.deviceSelect.id).info.isSync,
|
||||
// stopping: false,
|
||||
// }
|
||||
// this.deviceList.push(_device)
|
||||
// this.deviceSelect = ''
|
||||
// taskInfo.updateAllList()
|
||||
// this.$emit('add', _device.id)
|
||||
// },
|
||||
sdCardStatus: function (device) {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_sd_card_status/0',
|
||||
device: taskInfo.getRawDeviceID(device.id),
|
||||
}))
|
||||
},
|
||||
startTrigger (trigger) {
|
||||
// save automatically when start
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '/client/trigger_manager/set_parameter', JSON.stringify({
|
||||
mac: trigger.mac,
|
||||
parameter_set: trigger.parameter,
|
||||
}),
|
||||
)
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '/client/trigger_manager/runtime', JSON.stringify({
|
||||
mac: trigger.mac,
|
||||
instruction: 'start',
|
||||
}),
|
||||
)
|
||||
},
|
||||
stopTrigger (trigger) {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '/client/trigger_manager/runtime', JSON.stringify({
|
||||
mac: trigger.mac,
|
||||
instruction: 'stop',
|
||||
}),
|
||||
)
|
||||
},
|
||||
addDevice: async function (selectID) {
|
||||
if (selectID == null) {
|
||||
return false
|
||||
@@ -359,6 +414,9 @@ export default {
|
||||
type: type,
|
||||
isSync: taskInfo.getDeviceInfoByRawID(selectID).info.isSync,
|
||||
isStimulate: taskInfo.getDeviceInfoByRawID(selectID).info.isStimulate,
|
||||
sdCardStatus: taskInfo.getDeviceInfoByRawID(selectID).info.sd_card_status,
|
||||
transmission_type: taskInfo.getDeviceInfoByRawID(selectID).info.transmission_type,
|
||||
stimulation_last_time: taskInfo.getDeviceInfoByRawID(selectID).info.stimulation_last_time,
|
||||
// stopping: false,
|
||||
}
|
||||
this.deviceList.push(_device)
|
||||
@@ -388,6 +446,23 @@ export default {
|
||||
this.deviceList.length = 0
|
||||
taskInfo.updateAllList()
|
||||
},
|
||||
checkStiStatus: function () {
|
||||
this.deviceList.forEach(device => {
|
||||
if (device.stimulation_last_time > 0) {
|
||||
const stiExTime = taskInfo.getDeviceInfo(device.id).parameterSet.REPEAT_INTERVAL_littleEndian * taskInfo.getDeviceInfo(device.id).parameterSet.REPEAT_TIME_littleEndian
|
||||
const now = parseInt(Date.now() / 1000)
|
||||
let stiExTimeOut = (stiExTime / 1000) - (now - parseInt(parseFloat(device.stimulation_last_time)))
|
||||
stiExTimeOut = stiExTimeOut > 0 ? stiExTimeOut : 0
|
||||
console.log(stiExTime, now, parseInt(parseFloat(device.stimulation_last_time)), stiExTimeOut)
|
||||
clearTimeout(this.stiTimeOut)
|
||||
if (taskInfo.getDeviceInfo(device.id).parameterSet.CONTINUOUS_STI < 0) {
|
||||
this.stiTimeOut = setTimeout(() => {
|
||||
this.stiStop(device)
|
||||
}, (stiExTimeOut * 1000) + 3000)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
generateChart: function (device) {
|
||||
this.$emit('add', device.id)
|
||||
},
|
||||
@@ -403,6 +478,16 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
pageToast: function (mes) {
|
||||
this.showToast(
|
||||
mes,
|
||||
{
|
||||
icon: 'fa-bell',
|
||||
position: 'bottom-right',
|
||||
duration: 4000,
|
||||
},
|
||||
)
|
||||
},
|
||||
},
|
||||
async mounted () {
|
||||
// this.pageMqttSub()
|
||||
@@ -412,7 +497,7 @@ export default {
|
||||
// }
|
||||
},
|
||||
destroyed () {
|
||||
this.loadingDone()
|
||||
// this.loadingDone()
|
||||
// this.pageMqttUnSub()
|
||||
},
|
||||
watch: {
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
<template>
|
||||
<div class="flex sm12 xl12 md12 xs12">
|
||||
<va-accordion v-for="trigger in triggerList" :key="trigger.id">
|
||||
<va-collapse class="mb-2" :isOpenDefault='true'>
|
||||
<span slot="header" >
|
||||
<va-item :key="trigger.id" class="pa-0 ma-0"
|
||||
>
|
||||
<va-item-section class="ml-3" caption>
|
||||
<va-item-label>
|
||||
{{ trigger.name }}
|
||||
</va-item-label>
|
||||
<va-item-label caption>
|
||||
{{ trigger.mac }}
|
||||
</va-item-label>
|
||||
</va-item-section>
|
||||
</va-item>
|
||||
|
||||
<va-item class="pa-0 ma-0 mt-2">
|
||||
<va-item-section class="ml-3">
|
||||
<va-item-label>
|
||||
<va-button @click.stop="start(trigger)" v-if="trigger.status !== 'RUNNING'" class="px-2 py-0 mr-0" color="success" small>START</va-button>
|
||||
<va-button @click.stop="stop(trigger)" v-if="trigger.status === 'RUNNING'" class="px-2 py-0 mr-0" color="danger" small>STOP</va-button>
|
||||
</va-item-label>
|
||||
</va-item-section>
|
||||
</va-item>
|
||||
</span>
|
||||
<div slot="body">
|
||||
<div class="mt-0 mb-0" style="height: 350px; overflow-y: scroll; overflow-x: hidden;" :key="'detail' + trigger.id">
|
||||
<div>
|
||||
<trigger-control-window :mac="trigger.mac" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</va-collapse>
|
||||
</va-accordion>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapFields } from 'vuex-map-fields'
|
||||
import TriggerControlWindow from '../trigger/TriggerControlWindow'
|
||||
|
||||
export default {
|
||||
name: 'TriggerList',
|
||||
components: {
|
||||
TriggerControlWindow,
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapFields('device', [
|
||||
'triggerList',
|
||||
'chartKey',
|
||||
]),
|
||||
},
|
||||
methods: {
|
||||
start: async function (trigger) {
|
||||
this.$emit('start', trigger)
|
||||
this.triggerList.find(o => o.mac === trigger.mac).display = true
|
||||
this.triggerList.find(o => o.mac === trigger.mac).status = 'RUNNING'
|
||||
this.chartKey++
|
||||
this.pageToast('The trigger ' + trigger.name + ' has been started.')
|
||||
},
|
||||
stop: function (trigger) {
|
||||
this.$emit('stop', trigger)
|
||||
this.triggerList.find(o => o.mac === trigger.mac).status = 'CONNTECTED'
|
||||
this.pageToast('The trigger ' + trigger.name + ' has been stopped.')
|
||||
},
|
||||
pageToast: function (mes) {
|
||||
this.showToast(
|
||||
mes,
|
||||
{
|
||||
icon: 'fa-bell',
|
||||
position: 'bottom-right',
|
||||
duration: 4000,
|
||||
},
|
||||
)
|
||||
},
|
||||
},
|
||||
destroyed () {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,183 @@
|
||||
<template>
|
||||
<div class="flex sm12 xl12 md12 xs12">
|
||||
<recording-site :ref="'elewindow_ref'" :deviceList="deviceList" />
|
||||
<va-accordion v-for="device in deviceList" :key="device.id">
|
||||
<va-collapse class="mb-2">
|
||||
<span slot="header" >
|
||||
<va-item :key="device.id" class="pa-0 ma-0"
|
||||
>
|
||||
|
||||
<va-item-section avatar class="ml-0">
|
||||
<va-avatar style="border-radius: 0;">
|
||||
<img :src="device.picture" :alt="device.name">
|
||||
</va-avatar>
|
||||
</va-item-section>
|
||||
|
||||
<va-item-section class="ml-3">
|
||||
<va-item-label>
|
||||
{{ '[' + device.id + '] ' + device.library_name }}
|
||||
</va-item-label>
|
||||
|
||||
<va-item-label caption>
|
||||
{{ device.address }}
|
||||
</va-item-label>
|
||||
|
||||
</va-item-section>
|
||||
|
||||
</va-item>
|
||||
|
||||
<va-item class="pa-0 ma-0 mt-2">
|
||||
<va-item-section class="ml-3">
|
||||
<va-item-label>
|
||||
<va-button @click.stop="record(device)" v-if="device.library_name == 'Neulive3.5-REC' && !device.isSync" color="primary" class="px-2 py-0 mr-0 no-dark-style-va-button" small>RECORD</va-button>
|
||||
<va-button @click.stop="stopRecord(device)" v-if="device.library_name == 'Neulive3.5-REC' && device.isSync" color="danger" class="px-2 py-0 mr-0 no-dark-style-va-button" small>STOP REC</va-button>
|
||||
<va-button @click.stop="stimulate(device)" v-if="device.library_name == 'Neulive3.5-STI' && !device.isStimulate" color="warning" class="px-2 py-0 mr-0 no-dark-style-va-button" small>STIMULATE</va-button>
|
||||
<va-button @click.stop="stopStimulate(device)" v-if="device.library_name == 'Neulive3.5-STI' && device.isStimulate" color="danger" class="px-2 py-0 mr-0" small>STOP STI</va-button>
|
||||
<va-button @click.stop="fastSettle(device)" v-if="device.library_name == 'Neulive3.5-REC'" color="info" class="px-2 py-0 mr-0 no-dark-style-va-button" small>R</va-button>
|
||||
</va-item-label>
|
||||
</va-item-section>
|
||||
</va-item>
|
||||
</span>
|
||||
<div slot="body">
|
||||
<div class="mt-0 mb-0" style="height: 350px; overflow-y: scroll; overflow-x: hidden;" :key="'detail' + device.id">
|
||||
<!-- <div style="text-align: center;">
|
||||
<va-button @click.stop="generateChart(device)" class="pl-2 pr-2 mr-0 no-dark-style-va-button" small>GENERATE MAPPING CHART</va-button>
|
||||
</div> -->
|
||||
<div>
|
||||
<file-control-window :ref="'fcwindow_ref'" :deviceID="device.id" class="pl-0 pr-0" />
|
||||
</div>
|
||||
<div v-if="device.type == 'Neulive'">
|
||||
<neulive-parameter-window-g-m :ref="'npwindow_ref'" :deviceID="device.id" class="pl-0 pr-0" @record="record_start(device)" @record_stop="record_stop(device)"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</va-collapse>
|
||||
</va-accordion>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import NeuliveParameterWindow from '../parameter/NeuliveParameterWindow'
|
||||
import RecordingSite from '@/components/task/content/parameter/neulive-gimer/RecordingSite.vue'
|
||||
import NeuliveParameterWindowGM from '@/components/task/content/parameter/neulive-gimer/NeuliveParameterWindowGM'
|
||||
import FileControlWindow from '../../meta/FileControlWindow'
|
||||
import { mapActions } from 'vuex'
|
||||
import types from '@/store/modules/task/content/types'
|
||||
|
||||
export default {
|
||||
name: 'TaskDeviceList',
|
||||
components: {
|
||||
RecordingSite,
|
||||
NeuliveParameterWindowGM,
|
||||
FileControlWindow,
|
||||
},
|
||||
props: {
|
||||
deviceList: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
showDeleteModal: false,
|
||||
selectDevice: null,
|
||||
deviceStopping: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
methods: {
|
||||
removeCheck: function (device) {
|
||||
this.selectDevice = device
|
||||
this.showDeleteModal = true
|
||||
},
|
||||
remove: function () {
|
||||
this.$emit('remove', this.selectDevice)
|
||||
},
|
||||
record: async function (device) {
|
||||
this.setArchiveSettings()
|
||||
setTimeout(() => {
|
||||
this.$emit('record', device)
|
||||
}, 500)
|
||||
this.pageToast('The device ' + device.name + ' has been started.')
|
||||
},
|
||||
stopRecord: function (device) {
|
||||
this.$emit('stopRecord', device)
|
||||
this.pageToast('The device ' + device.name + ' has been stopped.')
|
||||
},
|
||||
generateChart: function (device) {
|
||||
this.$emit('generate', device)
|
||||
},
|
||||
setArchiveSettings: function () {
|
||||
this.$refs.fcwindow_ref.forEach(ref => {
|
||||
ref.setArchiveSettings()
|
||||
})
|
||||
},
|
||||
refresh: function () {
|
||||
// console.log(this.deviceList)
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.elewindow_ref != null) {
|
||||
this.$refs.elewindow_ref.refresh()
|
||||
}
|
||||
if (this.$refs.fcwindow_ref != null) {
|
||||
this.$refs.fcwindow_ref.forEach(ref => {
|
||||
ref.refresh()
|
||||
})
|
||||
}
|
||||
if (this.$refs.npwindow_ref != null) {
|
||||
this.$refs.npwindow_ref.forEach(ref => {
|
||||
ref.refresh()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
pageToast: function (mes) {
|
||||
this.showToast(
|
||||
mes,
|
||||
{
|
||||
icon: 'fa-bell',
|
||||
position: 'bottom-right',
|
||||
duration: 4000,
|
||||
},
|
||||
)
|
||||
},
|
||||
detect: function (device) {
|
||||
this.$emit('detect', device)
|
||||
this.pageToast('The device ' + device.name + ' has been detect.')
|
||||
},
|
||||
stimulate: async function (device) {
|
||||
const checkParam = await this.checkIfStimulationSetDoneParam({ device: device })
|
||||
const status = checkParam.status
|
||||
const message = checkParam.message
|
||||
if (status === true) {
|
||||
this.$emit('sti', device)
|
||||
} else {
|
||||
this.pageToast('Stimulation cannot be started because:' + message)
|
||||
}
|
||||
},
|
||||
stopStimulate: function (device) {
|
||||
this.$emit('sti_stop', device)
|
||||
this.pageToast('The device ' + device.name + ' stop stimulate.')
|
||||
},
|
||||
fastSettle: function (device) {
|
||||
this.$emit('fast_settle', device)
|
||||
this.pageToast('The device ' + device.name + ' fast settle.')
|
||||
},
|
||||
recoverDetectButton () {
|
||||
document.getElementById('detectButton').className += ' no-dark-style-va-button'
|
||||
},
|
||||
...mapActions('taskContent', [types.param.checkIfRecordingSetDone, types.param.checkIfStimulationSetDone, types.param.checkIfDeviceSetDone]),
|
||||
},
|
||||
destroyed () {
|
||||
// this.deviceList.length = 0
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.no-dark-style-va-button {
|
||||
&:focus {
|
||||
filter: brightness(100%);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,395 @@
|
||||
<template>
|
||||
<div class="flex" :class="cardclass">
|
||||
<va-card>
|
||||
<template slot="header">
|
||||
<va-icon name="fa fa-bluetooth-b mr-3" color="primary"/>
|
||||
<h5 class="mt-0 mb-0">DEVICES</h5>
|
||||
</template>
|
||||
<div v-if="state.LOADING" class="flex-center spinner-box mt-4 mb-5">
|
||||
<fulfilling-bouncing-circle-spinner
|
||||
:animation-duration="3000"
|
||||
:color="this.$themes.primary"
|
||||
:size="60"
|
||||
>
|
||||
</fulfilling-bouncing-circle-spinner>
|
||||
</div>
|
||||
|
||||
<div v-else class="flex row align--center">
|
||||
<task-device-list-g-m
|
||||
:ref="'pdlist_ref'"
|
||||
:deviceList="deviceList"
|
||||
@record="record($event)"
|
||||
@stopRecord="stopRecord($event)"
|
||||
@sti="sti($event)" @sti_stop="stiStop($event)"
|
||||
@fast_settle="fastSettle($event)"
|
||||
@generate="generateChart($event)"
|
||||
@detect="detectDevice($event)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
</va-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { FulfillingBouncingCircleSpinner } from 'epic-spinners'
|
||||
// import TaskDeviceList from './TaskDeviceList'
|
||||
import TaskDeviceListGM from './TaskDeviceListGM'
|
||||
import { taskInfo } from '@/data/task/TaskInfo'
|
||||
import { chartData } from '@/data/task/ChartsManagement'
|
||||
import { dataStreamBuffer } from '@/data/task/DataStreamBuffer'
|
||||
import api from '@/data/api'
|
||||
import { mapActions } from 'vuex'
|
||||
import { mapFields } from 'vuex-map-fields'
|
||||
import types from '@/store/modules/task/content/types'
|
||||
|
||||
export default {
|
||||
name: 'TaskDevices',
|
||||
components: {
|
||||
TaskDeviceListGM,
|
||||
FulfillingBouncingCircleSpinner,
|
||||
// TaskDeviceList,
|
||||
},
|
||||
props: {
|
||||
cardclass: {
|
||||
type: Array,
|
||||
default: function () {
|
||||
return ['xs12', 'md12', 'xl12', 'sm12']
|
||||
},
|
||||
},
|
||||
},
|
||||
created () {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
deviceSelect: '',
|
||||
deviceOptions: taskInfo.getDeviceListNotRegister(),
|
||||
// deviceList: this.deviceList,
|
||||
state: {
|
||||
LOADING: false,
|
||||
},
|
||||
stiTimeOut: null,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapFields('taskContent', [
|
||||
'deviceList',
|
||||
]),
|
||||
},
|
||||
mqtt: {
|
||||
},
|
||||
methods: {
|
||||
sleep: async function (time) {
|
||||
return new Promise((resolve) => setTimeout(resolve, time))
|
||||
},
|
||||
mqttPub: function (topic, mes) {
|
||||
this.$mqtt.publish(topic, mes)
|
||||
},
|
||||
loadingStart: async function () {
|
||||
this.state.LOADING = true
|
||||
},
|
||||
loadingDone: async function () {
|
||||
this.state.LOADING = false
|
||||
// console.log(this.deviceOptions)
|
||||
for (let i = 0; i <= 11; i++) {
|
||||
if (taskInfo.getDeviceInfoByRawID(i).info.status === 'connected') {
|
||||
const index = this.deviceList.findIndex(d => taskInfo.getRawDeviceID(d.id) === i)
|
||||
if (index < 0) {
|
||||
await this.addDevice(i)
|
||||
}
|
||||
} else {
|
||||
const index = this.deviceList.findIndex(d => taskInfo.getRawDeviceID(d.id) === i)
|
||||
if (index > 0) {
|
||||
await this.removeDevice(this.deviceList[index])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
taskInfo.getDeviceList().length = 0
|
||||
taskInfo.getDeviceList().push({
|
||||
id: -1,
|
||||
name: 'Time',
|
||||
})
|
||||
taskInfo.getDeviceList().push(...this.deviceList)
|
||||
// console.log('ppp', taskInfo.getDeviceList(), this.deviceList)
|
||||
// for (let i = this.deviceOptions.length - 1; i >= 0; i--) {
|
||||
// this.deviceSelect = this.deviceOptions[i]
|
||||
// await this.addDevice(this.deviceOptions[i].id)
|
||||
// // this.sleep(500).then(() => {
|
||||
// // this.addDevice(this.deviceOptions[i].id)
|
||||
// // })
|
||||
// }
|
||||
},
|
||||
detectDevice: function (device) {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
device: taskInfo.getRawDeviceID(device.id),
|
||||
instruction: 'VIS_DEVICE_DETECT',
|
||||
}))
|
||||
setTimeout(() => {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
device: taskInfo.getRawDeviceID(device.id),
|
||||
instruction: 'VIS_DEVICE_DONE',
|
||||
}))
|
||||
this.$refs.pdlist_ref.recoverDetectButton()
|
||||
}, 5000)
|
||||
},
|
||||
record: async function (device) {
|
||||
const test = await this.taskGimerCheckDeviceStatus({
|
||||
deviceList: this.deviceList,
|
||||
type: 'allFree',
|
||||
libraryNameREC: 'Neulive3.5-REC',
|
||||
libraryNameSTI: 'Neulive3.5-STI',
|
||||
})
|
||||
if (!test) {
|
||||
this.pageToast('[Stimulation] Please connect "Neulive3.5-REC" and "Neulive3.5-STI".')
|
||||
return false
|
||||
}
|
||||
const channelSet = taskInfo.getDeviceInfo(device.id).parameterSet.RECORDING_CH.toString(2).split('')
|
||||
const channelLen = channelSet.filter(function (value) {
|
||||
return parseInt(value) > 0
|
||||
}).length
|
||||
if (channelLen === 0) {
|
||||
this.pageToast('[Recording] Please select recording channels.')
|
||||
return false
|
||||
}
|
||||
await chartData.defaultChartGenerator(this.deviceList, device.id, null, 'device')
|
||||
this.deviceList.forEach(_device => {
|
||||
if (_device.library_name === 'Neulive3.5-STI') {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
device: taskInfo.getRawDeviceID(_device.id),
|
||||
instruction: 'SET_POWER_SAVE_EN_LOW',
|
||||
}))
|
||||
}
|
||||
})
|
||||
if (!taskInfo.getDeviceInfo(device.id).info.isSync) {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
device: taskInfo.getRawDeviceID(device.id),
|
||||
instruction: 'record',
|
||||
}))
|
||||
device.isSync = true
|
||||
// device.stopping = false
|
||||
this.$emit('refreshSetting')
|
||||
api.task.update({
|
||||
device_config: taskInfo.getTaskInfo().deviceList,
|
||||
})
|
||||
|
||||
// ### show device info
|
||||
// console.log(taskInfo.getDeviceInfo(device.id))
|
||||
}
|
||||
},
|
||||
stopRecord: async function (device) {
|
||||
const test = await this.taskGimerCheckDeviceStatus({
|
||||
deviceList: this.deviceList,
|
||||
type: 'stiRun',
|
||||
libraryNameREC: 'Neulive3.5-REC',
|
||||
libraryNameSTI: 'Neulive3.5-STI',
|
||||
})
|
||||
if (test) {
|
||||
this.pageToast('[Recording] Please stop stimulation first.')
|
||||
return false
|
||||
}
|
||||
dataStreamBuffer.removeByDevice(taskInfo.getRawDeviceID(device.id))
|
||||
if (taskInfo.getDeviceInfo(device.id).info.isSync) {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
device: taskInfo.getRawDeviceID(device.id),
|
||||
instruction: 'stop_record',
|
||||
}))
|
||||
}
|
||||
device.isSync = false
|
||||
this.deviceList.forEach(_device => {
|
||||
if (_device.library_name === 'Neulive3.5-STI') {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
device: taskInfo.getRawDeviceID(_device.id),
|
||||
instruction: 'SET_POWER_SAVE',
|
||||
}))
|
||||
}
|
||||
})
|
||||
// device.stopping = true
|
||||
},
|
||||
sti: async function (device) {
|
||||
const test = await this.taskGimerCheckDeviceStatus({
|
||||
deviceList: this.deviceList,
|
||||
type: 'recRun',
|
||||
libraryNameREC: 'Neulive3.5-REC',
|
||||
libraryNameSTI: 'Neulive3.5-STI',
|
||||
})
|
||||
if (!test) {
|
||||
this.pageToast('[Stimulation] Please run recording first.')
|
||||
return false
|
||||
}
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
device: taskInfo.getRawDeviceID(device.id),
|
||||
instruction: 'stimulate',
|
||||
}))
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_parameter/0',
|
||||
device: taskInfo.getRawDeviceID(device.id),
|
||||
parameter: 'STIMULATING',
|
||||
content: 1,
|
||||
}))
|
||||
taskInfo.getTaskInfo().deviceList[(taskInfo.getRawDeviceID(device.id)).toString()].parameterSet.STIMULATING = 1
|
||||
|
||||
api.task.update({
|
||||
device_config: taskInfo.getTaskInfo().deviceList,
|
||||
})
|
||||
device.isStimulate = true
|
||||
const stiExTime = taskInfo.getDeviceInfo(device.id).parameterSet.REPEAT_INTERVAL_littleEndian * taskInfo.getDeviceInfo(device.id).parameterSet.REPEAT_TIME_littleEndian
|
||||
clearTimeout(this.stiTimeOut)
|
||||
this.stiTimeOut = setTimeout(() => {
|
||||
this.stiStop(device)
|
||||
}, (stiExTime + 3000))
|
||||
this.pageToast('The device ' + device.name + ' start stimulate.')
|
||||
},
|
||||
stiStop: function (device) {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
device: taskInfo.getRawDeviceID(device.id),
|
||||
instruction: 'stop_stimulate',
|
||||
}))
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_parameter/0',
|
||||
device: taskInfo.getRawDeviceID(device.id),
|
||||
parameter: 'STIMULATING',
|
||||
content: 0,
|
||||
}))
|
||||
device.isStimulate = false
|
||||
clearTimeout(this.stiTimeOut)
|
||||
},
|
||||
fastSettle: function (device) {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
device: taskInfo.getRawDeviceID(device.id),
|
||||
instruction: 'FAST_SET',
|
||||
}))
|
||||
},
|
||||
addDevice: async function (selectID) {
|
||||
if (selectID == null) {
|
||||
return false
|
||||
}
|
||||
const addr = taskInfo.getDeviceInfoByRawID(selectID).info.device_address
|
||||
if (addr.length === 0) {
|
||||
return false
|
||||
}
|
||||
if (taskInfo.getTaskInfo().taskDeviceID.indexOf(selectID) > 0) {
|
||||
return false
|
||||
}
|
||||
await taskInfo.getTaskInfo().deviceAddrList.push(taskInfo.getDeviceInfoByRawID(selectID).info.device_address)
|
||||
await taskInfo.getTaskInfo().taskDeviceID.push(selectID)
|
||||
const _address = this.GLOBAL.transMac(taskInfo.getDeviceInfoByRawID(selectID).info.device_address)
|
||||
|
||||
const pic = taskInfo.getDevicePic(taskInfo.getDeviceInfoByRawID(selectID).info.library_name)
|
||||
let type = ''
|
||||
if (taskInfo.getDeviceInfoByRawID(selectID).info.library_name.indexOf('Elite') >= 0) {
|
||||
type = 'Elite'
|
||||
} else if (taskInfo.getDeviceInfoByRawID(selectID).info.library_name.indexOf('Neulive') >= 0) {
|
||||
type = 'Neulive'
|
||||
}
|
||||
|
||||
const _device = {
|
||||
id: taskInfo.getTaskInfo().taskDeviceID.indexOf(selectID),
|
||||
name: '[' + taskInfo.getTaskInfo().taskDeviceID.indexOf(selectID) + '] ' + taskInfo.getDeviceInfoByRawID(selectID).info.device_name,
|
||||
addr: taskInfo.getDeviceInfoByRawID(selectID).info.device_address,
|
||||
address: _address,
|
||||
library_name: taskInfo.getDeviceInfoByRawID(selectID).info.library_name,
|
||||
library_version: taskInfo.getDeviceInfoByRawID(selectID).info.library_version,
|
||||
picture: pic,
|
||||
type: type,
|
||||
isSync: taskInfo.getDeviceInfoByRawID(selectID).info.isSync,
|
||||
isStimulate: taskInfo.getDeviceInfoByRawID(selectID).info.isStimulate,
|
||||
stimulation_last_time: taskInfo.getDeviceInfoByRawID(selectID).info.stimulation_last_time,
|
||||
sdCardStatus: taskInfo.getDeviceInfoByRawID(selectID).info.sd_card_status,
|
||||
// stopping: false,
|
||||
}
|
||||
this.deviceList.push(_device)
|
||||
// console.log('sss', this.deviceList)
|
||||
this.deviceSelect = ''
|
||||
taskInfo.updateAllList()
|
||||
this.$emit('add', _device.id)
|
||||
},
|
||||
removeDevice: async function (device) {
|
||||
taskInfo.getTaskInfo().deviceAddrList.forEach(addr => {
|
||||
if (addr === device.addr) {
|
||||
taskInfo.getTaskInfo().deviceAddrList.splice(taskInfo.getTaskInfo().deviceAddrList.indexOf(addr), 1)
|
||||
}
|
||||
})
|
||||
taskInfo.getTaskInfo().taskDeviceID.forEach(realID => {
|
||||
if (realID === device.id) {
|
||||
taskInfo.getTaskInfo().taskDeviceID.splice(taskInfo.getTaskInfo().taskDeviceID.indexOf(realID), 1)
|
||||
}
|
||||
})
|
||||
this.deviceList.splice(this.deviceList.indexOf(device), 1)
|
||||
this.deviceSelect = ''
|
||||
taskInfo.updateAllList()
|
||||
this.$emit('remove', device.id)
|
||||
},
|
||||
checkStiStatus: function () {
|
||||
this.deviceList.forEach(device => {
|
||||
if (device.stimulation_last_time > 0) {
|
||||
const stiExTime = taskInfo.getDeviceInfo(device.id).parameterSet.REPEAT_INTERVAL_littleEndian * taskInfo.getDeviceInfo(device.id).parameterSet.REPEAT_TIME_littleEndian
|
||||
const now = parseInt(Date.now() / 1000)
|
||||
let stiExTimeOut = (stiExTime / 1000) - (now - parseInt(parseFloat(device.stimulation_last_time)))
|
||||
stiExTimeOut = stiExTimeOut > 0 ? stiExTimeOut : 0
|
||||
console.log(stiExTime, now, parseInt(parseFloat(device.stimulation_last_time)), stiExTimeOut)
|
||||
clearTimeout(this.stiTimeOut)
|
||||
this.stiTimeOut = setTimeout(() => {
|
||||
this.stiStop(device)
|
||||
}, (stiExTimeOut * 1000) + 3000)
|
||||
}
|
||||
})
|
||||
},
|
||||
clearDevice: async function () {
|
||||
taskInfo.getTaskInfo().deviceAddrList.length = 0
|
||||
taskInfo.getTaskInfo().taskDeviceID.length = 0
|
||||
this.deviceList.length = 0
|
||||
taskInfo.updateAllList()
|
||||
},
|
||||
generateChart: function (device) {
|
||||
this.$emit('add', device.id)
|
||||
},
|
||||
setArchiveSettings: function () {
|
||||
if (this.$refs.pdlist_ref != null) {
|
||||
this.$refs.pdlist_ref.setArchiveSettings()
|
||||
}
|
||||
},
|
||||
refresh: function () {
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.pdlist_ref != null) {
|
||||
this.$refs.pdlist_ref.refresh()
|
||||
}
|
||||
})
|
||||
},
|
||||
pageToast: function (mes) {
|
||||
this.showToast(
|
||||
mes,
|
||||
{
|
||||
icon: 'fa-bell',
|
||||
position: 'bottom-right',
|
||||
duration: 4000,
|
||||
},
|
||||
)
|
||||
},
|
||||
...mapActions('taskContent', [types.gimer.checkDeviceStatus]),
|
||||
},
|
||||
async mounted () {
|
||||
// console.log('sss', taskInfo.getDeviceList(), this.deviceList)
|
||||
// this.pageMqttSub()
|
||||
// for (const device in this.deviceOptions) {
|
||||
// this.deviceSelect = this.deviceOptions[device]
|
||||
// await this.addDevice()
|
||||
// }
|
||||
},
|
||||
destroyed () {
|
||||
// this.loadingDone()
|
||||
// this.pageMqttUnSub()
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -122,6 +122,7 @@ export default {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
deviceList: [],
|
||||
showFormulaModal: false,
|
||||
formulaSelect: '',
|
||||
formulaOptions: [
|
||||
@@ -176,7 +177,7 @@ export default {
|
||||
switch (formula.type) {
|
||||
case 'Sheet Resistance':
|
||||
formula.dataNow = 0
|
||||
chartData.defaultChartGenerator(formula.id, null, 'formula')
|
||||
chartData.defaultChartGenerator(this.deviceList, formula.id, null, 'formula')
|
||||
break
|
||||
}
|
||||
this.pageToast('The ' + formula.name + 'has been applied.')
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<fieldset>
|
||||
<va-radio-button
|
||||
option="Auto"
|
||||
v-model="optionValue"
|
||||
label="Auto"
|
||||
/>
|
||||
<br v-if="optionValue === 'Auto'"/>
|
||||
<auto-block v-if="optionValue === 'Auto'" :ref="'AutoBlock'" :deviceID="deviceID"/>
|
||||
<va-radio-button
|
||||
option="Advanced"
|
||||
v-model="optionValue"
|
||||
label="Advanced"
|
||||
/>
|
||||
<br v-if="optionValue === 'Advanced'"/>
|
||||
<advanced-block v-if="optionValue === 'Advanced'" :ref="'AdvancedBlock'" :deviceID="deviceID"/>
|
||||
</fieldset>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { taskInfo } from '../../../../data/task/TaskInfo'
|
||||
import AutoBlock from '../parameter/item/DPV/AutoBlock'
|
||||
import AdvancedBlock from '../parameter/item/DPV/AdvancedBlock'
|
||||
|
||||
export default {
|
||||
name: 'EliteParameterRecordingEliteDPV',
|
||||
components: {
|
||||
AutoBlock,
|
||||
AdvancedBlock,
|
||||
},
|
||||
props: {
|
||||
deviceID: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
deviceName: {
|
||||
type: String,
|
||||
default: 'Elite',
|
||||
},
|
||||
},
|
||||
created () {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
optionValue: 'Auto',
|
||||
}
|
||||
},
|
||||
mqtt: {
|
||||
},
|
||||
methods: {
|
||||
mqttPub: function (topic, mes) {
|
||||
this.$mqtt.publish(topic, mes)
|
||||
},
|
||||
// Array[String of Parameter Nmae, Value]
|
||||
deviceParameterChange: function (e) {
|
||||
console.log('e[0],e[1]', e[0], ',', e[1])
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_parameter/0',
|
||||
device: taskInfo.getRawDeviceID(this.deviceID),
|
||||
parameter: e[0],
|
||||
content: e[1],
|
||||
}))
|
||||
},
|
||||
refresh () {
|
||||
if (this.$refs.AutoBlock != null) {
|
||||
this.$refs.AutoBlock.refresh()
|
||||
}
|
||||
if (this.$refs.AdvancedBlock != null) {
|
||||
this.$refs.AdvancedBlock.refresh()
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
destroyed () {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -370,7 +370,7 @@ export default {
|
||||
},
|
||||
// Array[String of Parameter Nmae, Value]
|
||||
deviceParameterChange: function (e) {
|
||||
console.log('e[0],e[1]', e[0], ',', e[1])
|
||||
// console.log('e[0],e[1]', e[0], ',', e[1])
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_parameter/0',
|
||||
device: taskInfo.getRawDeviceID(this.deviceID),
|
||||
@@ -426,11 +426,11 @@ export default {
|
||||
}
|
||||
this.FreqStart = String(parseFloat(Math.round(parseFloat((taskInfo.getDeviceInfo(this.deviceID).parameterSet.FREQ_START * 0.0149) * 100)) / 100).toFixed(1)) === '0.0' ? '0.015' : String(parseFloat(Math.round(parseFloat((taskInfo.getDeviceInfo(this.deviceID).parameterSet.FREQ_START * 0.0149) * 100)) / 100).toFixed(1))
|
||||
if (this.$refs.FreqRange != null) {
|
||||
this.$refs.FreqRange.itemChangeMin(this.FreqStart)
|
||||
this.$refs.FreqRange.itemChangeMax(this.FreqStart)
|
||||
}
|
||||
this.FreqStop = String(parseFloat(Math.round(parseFloat((taskInfo.getDeviceInfo(this.deviceID).parameterSet.FREQ_STOP * 0.0149) * 100)) / 100).toFixed(1)) === '0.0' ? '0.015' : String(parseFloat(Math.round(parseFloat((taskInfo.getDeviceInfo(this.deviceID).parameterSet.FREQ_STOP * 0.0149) * 100)) / 100).toFixed(1))
|
||||
if (this.$refs.FreqRange != null) {
|
||||
this.$refs.FreqRange.itemChangeMax(this.FreqStop)
|
||||
this.$refs.FreqRange.itemChangeMin(this.FreqStop)
|
||||
}
|
||||
this.PointsPerDecades = String(Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet.PPD)))
|
||||
if (this.$refs.PointsPerDecades != null) {
|
||||
@@ -489,7 +489,7 @@ export default {
|
||||
|
||||
if (this.workingModeSelect.id !== taskInfo.getDeviceInfo(this.deviceID).parameterSet.MODE) {
|
||||
this.deviceParameterChange(['MODE', this.workingModeSelect.id])
|
||||
console.log(this.workingModeSelect.id, this.workingModeSelect.description)
|
||||
// console.log(this.workingModeSelect.id, this.workingModeSelect.description)
|
||||
}
|
||||
},
|
||||
instruParameterChange: function (e) {
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
<template>
|
||||
<div class="flex px-0 mx-0 my-0 py-0">
|
||||
<va-tree-root class="flex sm12 xl12 md12 xs12 px-0 mx-0 my-0 py-0">
|
||||
<div class="flex sm12 xl12 md12 xs12 px-0 mx-0 my-0 py-0">
|
||||
<va-select
|
||||
@input="workingModeSelectChange(workingModeSelect)"
|
||||
:label="'WORKING MODE'"
|
||||
v-model="workingModeSelect"
|
||||
textBy="description"
|
||||
:options="workingModeOptions"
|
||||
style="width: 300px;"
|
||||
noClear
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div v-if="workingModeSelect != null && workingModeSelect.id == 0">
|
||||
<elite-parameter-recording-elite-a-c-c :ref="'CurrentControl'" :deviceID="deviceID" :deviceName="deviceName"/>
|
||||
</div>
|
||||
</va-tree-root>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { taskInfo } from '@/data/task/TaskInfo'
|
||||
import EliteParameterRecordingEliteACC from '../parameter/item/AnalogCurrentControl/EliteParameterRecordingEliteACC'
|
||||
|
||||
export default {
|
||||
name: 'EliteParameterRecordingEliteTrigger',
|
||||
components: {
|
||||
EliteParameterRecordingEliteACC,
|
||||
},
|
||||
props: {
|
||||
deviceID: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
deviceName: {
|
||||
type: String,
|
||||
default: 'Elite',
|
||||
},
|
||||
},
|
||||
created () {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
workingModeSelect: {
|
||||
id: -1,
|
||||
description: 'Init',
|
||||
},
|
||||
workingModeOptions: [
|
||||
{
|
||||
id: 0,
|
||||
description: 'Analog Current Control (ACC)',
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
mqtt: {
|
||||
},
|
||||
methods: {
|
||||
mqttPub: function (topic, mes) {
|
||||
this.$mqtt.publish(topic, mes)
|
||||
},
|
||||
// Array[String of Parameter Nmae, Value]
|
||||
deviceParameterChange: function (e) {
|
||||
console.log('e[0],e[1]', e[0], ',', e[1])
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_parameter/0',
|
||||
device: taskInfo.getRawDeviceID(this.deviceID),
|
||||
parameter: e[0],
|
||||
content: e[1],
|
||||
}))
|
||||
},
|
||||
refresh () {
|
||||
this.workingModeSelect = this.workingModeOptions[taskInfo.getDeviceInfo(this.deviceID).parameterSet.MODE]
|
||||
if (this.workingModeSelect != null) {
|
||||
this.workingModeSelectChange(this.workingModeSelect)
|
||||
}
|
||||
|
||||
if (this.$refs.CurrentControl != null) {
|
||||
this.$refs.CurrentControl.refresh()
|
||||
}
|
||||
},
|
||||
workingModeSelectChange (val) {
|
||||
if (this.workingModeSelect.id === -1) {
|
||||
return false
|
||||
}
|
||||
|
||||
this.workingModeSelect = val
|
||||
|
||||
if (this.workingModeSelect.id !== taskInfo.getDeviceInfo(this.deviceID).parameterSet.MODE) {
|
||||
this.deviceParameterChange(['MODE', this.workingModeSelect.id])
|
||||
console.log(this.workingModeSelect.id, this.workingModeSelect.description)
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
this.refresh()
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
destroyed () {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -1,34 +1,32 @@
|
||||
<template>
|
||||
<div class="flex">
|
||||
<va-tree-root>
|
||||
<div class="row pt-0 pb-0">
|
||||
<div class="flex sm12 xl12 md12 xs12">
|
||||
<va-select
|
||||
@input="workingModeSelectChange(workingModeSelect)"
|
||||
:label="'WORKING MODE'"
|
||||
v-model="workingModeSelect"
|
||||
textBy="description"
|
||||
:options="workingModeOptions"
|
||||
noClear
|
||||
style="width: 200px;"
|
||||
/>
|
||||
<va-button
|
||||
v-if="!measureEocButton.status && workingModeSelect != null && (workingModeSelect.id == 7 || workingModeSelect.id == 8 || workingModeSelect.id == 9)"
|
||||
color="primary"
|
||||
target="_blank"
|
||||
@click="measureEoc()"
|
||||
small>
|
||||
{{measureEocButton.start}}
|
||||
</va-button>
|
||||
<va-button
|
||||
v-if="measureEocButton.status && workingModeSelect != null && (workingModeSelect.id == 7 || workingModeSelect.id == 8 || workingModeSelect.id == 9)"
|
||||
color="danger"
|
||||
target="_blank"
|
||||
@click="measureEocStop()"
|
||||
small>
|
||||
{{measureEocButton.stop}}
|
||||
</va-button>
|
||||
</div>
|
||||
<div class="flex px-0 mx-0 my-0 py-0">
|
||||
<va-tree-root class="flex sm12 xl12 md12 xs12 px-0 mx-0 my-0 py-0">
|
||||
<div class="flex sm12 xl12 md12 xs12 px-0 mx-0 my-0 py-0">
|
||||
<va-select
|
||||
@input="workingModeSelectChange(workingModeSelect)"
|
||||
:label="'WORKING MODE'"
|
||||
v-model="workingModeSelect"
|
||||
textBy="description"
|
||||
:options="workingModeOptions"
|
||||
noClear
|
||||
style="width: 300px;"
|
||||
/>
|
||||
<va-button
|
||||
v-if="!measureEocButton.status && workingModeSelect != null && (workingModeSelect.id == 7 || workingModeSelect.id == 8 || workingModeSelect.id == 9)"
|
||||
color="primary"
|
||||
target="_blank"
|
||||
@click="measureEoc()"
|
||||
small>
|
||||
{{measureEocButton.start}}
|
||||
</va-button>
|
||||
<va-button
|
||||
v-if="measureEocButton.status && workingModeSelect != null && (workingModeSelect.id == 7 || workingModeSelect.id == 8 || workingModeSelect.id == 9)"
|
||||
color="danger"
|
||||
target="_blank"
|
||||
@click="measureEocStop()"
|
||||
small>
|
||||
{{measureEocButton.stop}}
|
||||
</va-button>
|
||||
</div>
|
||||
|
||||
<!-- 1.5ui -->
|
||||
@@ -239,7 +237,7 @@
|
||||
</va-tree-node>
|
||||
</va-tree-category>
|
||||
|
||||
<va-tree-category
|
||||
<!-- <va-tree-category
|
||||
v-if="workingModeSelect != null && workingModeSelect.id == 13"
|
||||
style="font-size: 20px;"
|
||||
:label="'Duration ( ' + duration + timeOptions[timeUnit].label + ' )'">
|
||||
@@ -256,7 +254,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</va-tree-node>
|
||||
</va-tree-category>
|
||||
</va-tree-category> -->
|
||||
|
||||
<va-tree-category
|
||||
v-if="workingModeSelect != null && workingModeSelect.id == 12"
|
||||
@@ -381,8 +379,8 @@ import OppLevelButton from '../parameter/item/OppLevelButton'
|
||||
import MicroAmpereRange from '../parameter/item/MicroAmpereRange'
|
||||
import ScanRateRange from '../parameter/item/ScanRateRange'
|
||||
import ResolutionRange from '../parameter/item/ResolutionRange'
|
||||
import EliteParameterRecordingElitePulseSensing from './EliteParameterRecordingElitePulseSensing'
|
||||
import EliteParameterRecordingEliteDPV from './EliteParameterRecordingEliteDPV'
|
||||
import EliteParameterRecordingElitePulseSensing from '../parameter/item/PulseSensing/EliteParameterRecordingElitePulseSensing'
|
||||
import EliteParameterRecordingEliteDPV from '../parameter/item/DPV/EliteParameterRecordingEliteDPV'
|
||||
|
||||
export default {
|
||||
name: 'EliteParameterRecordingElitezm15',
|
||||
@@ -629,7 +627,7 @@ export default {
|
||||
},
|
||||
// Array[String of Parameter Nmae, Value]
|
||||
deviceParameterChange: function (e) {
|
||||
console.log('e[0],e[1]', e[0], ',', e[1])
|
||||
// console.log('e[0],e[1]', e[0], ',', e[1])
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_parameter/0',
|
||||
device: taskInfo.getRawDeviceID(this.deviceID),
|
||||
@@ -777,7 +775,7 @@ export default {
|
||||
|
||||
if (this.workingModeSelect.id !== taskInfo.getDeviceInfo(this.deviceID).parameterSet.MODE) {
|
||||
this.deviceParameterChange(['MODE', this.workingModeSelect.id])
|
||||
console.log(this.workingModeSelect.id, this.workingModeSelect.description)
|
||||
// console.log(this.workingModeSelect.id, this.workingModeSelect.description)
|
||||
}
|
||||
},
|
||||
measureEoc () {
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<elite-parameter-recording v-if="eliteVer=='1'" :ref="'rec_ref_1'" :deviceID="deviceID"/>
|
||||
<!-- <elite-parameter-recording-elitezm15 :ref="'rec_ref'" :deviceID="deviceID"/> -->
|
||||
<!--<elite-parameter-recording :ref="'rec_ref'" :deviceID="deviceID"/>-->
|
||||
<elite-parameter-recording-elitezm15 v-else-if="eliteVer=='2'" :ref="'rec_ref_2'" :deviceID="deviceID"/>
|
||||
<elite-parameter-recording-elite-e-i-s v-else-if="eliteVer=='4'" :ref="'rec_ref_4'" :deviceID="deviceID"/>
|
||||
<elite-parameter-recording-elite-trigger v-else-if="eliteVer=='5'" :ref="'rec_ref_5'" :deviceID="deviceID"/>
|
||||
<elite-parameter-recording-elite-e-i-s v-else :ref="'rec_ref_4'" :deviceID="deviceID"/>
|
||||
<!--<elite-parameter-recording :ref="'rec_ref'" :deviceID="deviceID"/>-->
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -16,6 +13,7 @@
|
||||
import EliteParameterRecording from './EliteParameterRecording'
|
||||
import EliteParameterRecordingElitezm15 from './EliteParameterRecordingElitezm15'
|
||||
import EliteParameterRecordingEliteEIS from './EliteParameterRecordingEliteEIS'
|
||||
import EliteParameterRecordingEliteTrigger from './EliteParameterRecordingEliteTrigger'
|
||||
import { taskInfo } from '../../../../data/task/TaskInfo'
|
||||
|
||||
export default {
|
||||
@@ -24,6 +22,7 @@ export default {
|
||||
EliteParameterRecording,
|
||||
EliteParameterRecordingElitezm15,
|
||||
EliteParameterRecordingEliteEIS,
|
||||
EliteParameterRecordingEliteTrigger,
|
||||
},
|
||||
props: {
|
||||
deviceID: {
|
||||
@@ -53,6 +52,10 @@ export default {
|
||||
} else if (JSON.stringify(ver.slice(0, 4)) === JSON.stringify([0, 2, 1, 7])) {
|
||||
this.eliteVer = '3' // megafly
|
||||
// console.log('3:', JSON.stringify(ver.slice(0, 4)), ',', JSON.stringify([0, 2, 1, 7]))
|
||||
} else if (JSON.stringify(ver.slice(0, 4)) === JSON.stringify([0, 4, 1, 0])) {
|
||||
this.eliteVer = '4' // eis
|
||||
} else if (JSON.stringify(ver.slice(0, 4)) === JSON.stringify([0, 5, 1, 0])) {
|
||||
this.eliteVer = '5' // trigger
|
||||
} else {
|
||||
this.eliteVer = '4'
|
||||
}
|
||||
@@ -95,6 +98,13 @@ export default {
|
||||
}
|
||||
})
|
||||
break
|
||||
case '5':
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.rec_ref_5 != null) {
|
||||
this.$refs.rec_ref_5.refresh()
|
||||
}
|
||||
})
|
||||
break
|
||||
}
|
||||
// this.$nextTick(() => {
|
||||
// if (this.$refs.rec_ref != null) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<div class="flex" >
|
||||
<va-tree-root >
|
||||
<va-tree-category
|
||||
isOpen
|
||||
style="font-size: 20px;"
|
||||
:label="'Channels'">
|
||||
<va-tree-node>
|
||||
@@ -242,10 +243,14 @@ export default {
|
||||
},
|
||||
refresh () {
|
||||
this.channelList.length = 0
|
||||
taskInfo.getDeviceInfo(this.deviceID).parameterSet.CH_LIST = Array(16).fill(0)
|
||||
const channelSet = taskInfo.getDeviceInfo(this.deviceID).parameterSet.RECORDING_CH.toString(2).split('').reverse()
|
||||
taskInfo.getDeviceInfo(this.deviceID).parameterSet.CH_NUMBER = 0
|
||||
channelSet.forEach((element, index) => {
|
||||
if (parseInt(element) > 0) {
|
||||
this.channelList.push(index + 1)
|
||||
taskInfo.getDeviceInfo(this.deviceID).parameterSet.CH_LIST[index] = 1
|
||||
taskInfo.getDeviceInfo(this.deviceID).parameterSet.CH_NUMBER += 1
|
||||
}
|
||||
})
|
||||
this.ampGainSelect = this.ampGainOptions[(taskInfo.getDeviceInfo(this.deviceID).parameterSet.AMP_GAIN) % 4]
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
:key="channel"
|
||||
>
|
||||
<va-button
|
||||
class="mx-1 px-1"
|
||||
class="ma-1 pa-0 circle-button"
|
||||
v-if="channelList != null && channelList.indexOf(channel) >= 0"
|
||||
@click="channelClickRemove(channel)"
|
||||
small
|
||||
@@ -21,7 +21,7 @@
|
||||
{{channel}}
|
||||
</va-button>
|
||||
<va-button
|
||||
class="mx-1 px-1"
|
||||
class="ma-1 pa-0 circle-button"
|
||||
v-if="channelList == null || channelList.indexOf(channel) < 0"
|
||||
@click="channelClickAdd(channel)"
|
||||
small outline
|
||||
@@ -46,7 +46,7 @@
|
||||
:key="axisChannel"
|
||||
>
|
||||
<va-button
|
||||
class="mx-1 px-1"
|
||||
class="ma-1 pa-0 circle-button"
|
||||
v-if="axisChannelList != null && axisChannelList.indexOf(axisChannel) >= 0"
|
||||
@click="axisChannelClickRemove(axisChannel)"
|
||||
small
|
||||
@@ -54,7 +54,7 @@
|
||||
{{axisChannel}}
|
||||
</va-button>
|
||||
<va-button
|
||||
class="mx-1 px-1"
|
||||
class="ma-1 pa-0 circle-button"
|
||||
v-if="axisChannelList == null || axisChannelList.indexOf(axisChannel) < 0"
|
||||
@click="axisChannelClickAdd(axisChannel)"
|
||||
small outline
|
||||
@@ -160,12 +160,12 @@ export default {
|
||||
description: '100',
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
description: '400',
|
||||
id: 2,
|
||||
description: '300',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
description: '800',
|
||||
id: 1,
|
||||
description: '500',
|
||||
},
|
||||
],
|
||||
sampleRateSelect: null,
|
||||
@@ -284,19 +284,29 @@ export default {
|
||||
refresh () {
|
||||
this.channelList.length = 0
|
||||
// todo RECORDING_CH to RECORDING_CH_H & L
|
||||
taskInfo.getDeviceInfo(this.deviceID).parameterSet.CH_LIST = Array(32).fill(0)
|
||||
const channelSetLow = taskInfo.getDeviceInfo(this.deviceID).parameterSet.RECORDING_CH_L.toString(2).split('').reverse()
|
||||
taskInfo.getDeviceInfo(this.deviceID).parameterSet.CH_NUMBER = 0
|
||||
channelSetLow.forEach((element, index) => {
|
||||
if (parseInt(element) > 0) {
|
||||
this.channelList.push(index + 1)
|
||||
taskInfo.getDeviceInfo(this.deviceID).parameterSet.CH_LIST[index + 0] = 1
|
||||
taskInfo.getDeviceInfo(this.deviceID).parameterSet.CH_NUMBER += 1
|
||||
}
|
||||
})
|
||||
const channelSetHight = taskInfo.getDeviceInfo(this.deviceID).parameterSet.RECORDING_CH_H.toString(2).split('').reverse()
|
||||
channelSetHight.forEach((element, index) => {
|
||||
if (parseInt(element) > 0) {
|
||||
this.channelList.push(index + 17)
|
||||
taskInfo.getDeviceInfo(this.deviceID).parameterSet.CH_LIST[index + 16] = 1
|
||||
taskInfo.getDeviceInfo(this.deviceID).parameterSet.CH_NUMBER += 1
|
||||
}
|
||||
})
|
||||
this.ampGainOptions.forEach(option => {
|
||||
if (option.id === taskInfo.getDeviceInfo(this.deviceID).parameterSet.AMP_GAIN) {
|
||||
this.ampGainSelect = option
|
||||
}
|
||||
})
|
||||
this.ampGainSelect = this.ampGainOptions[(taskInfo.getDeviceInfo(this.deviceID).parameterSet.AMP_GAIN) % 4]
|
||||
this.sampleRateSelect = this.sampleRateOptions[this.sampleRateOptions.findIndex(ele => ele.value === taskInfo.getDeviceInfo(this.deviceID).parameterSet.SAMPLE_RATE)]
|
||||
this.recordOn = taskInfo.getDeviceInfo(this.deviceID).parameterSet.RECORDING
|
||||
this.axisChannelList.length = 0
|
||||
@@ -587,3 +597,11 @@ export default {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.circle-button {
|
||||
height: 25px;
|
||||
width: 25px;
|
||||
border-radius: '50%';
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,584 @@
|
||||
<template>
|
||||
<div class="flex" >
|
||||
<va-tree-root >
|
||||
<va-tree-category
|
||||
style="font-size: 20px;"
|
||||
:label="'Channels'">
|
||||
<va-tree-node>
|
||||
<div class="row">
|
||||
<div class="flex sm12 xl12 md12 xs12">
|
||||
<div
|
||||
style='display: inline-block;'
|
||||
v-for="channel in channelArray"
|
||||
:key="channel"
|
||||
>
|
||||
<va-button
|
||||
class="ma-1 pa-0 circle-button"
|
||||
v-if="channelList != null && channelList.indexOf(channel) >= 0"
|
||||
@click="channelClickRemove(channel)"
|
||||
small
|
||||
>
|
||||
{{channel}}
|
||||
</va-button>
|
||||
<va-button
|
||||
class="ma-1 pa-0 circle-button"
|
||||
v-if="channelList == null || channelList.indexOf(channel) < 0"
|
||||
@click="channelClickAdd(channel)"
|
||||
small outline
|
||||
>
|
||||
{{channel}}
|
||||
</va-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</va-tree-node>
|
||||
</va-tree-category>
|
||||
|
||||
<va-tree-category
|
||||
style="font-size: 20px;"
|
||||
:label="'3-AXIS'">
|
||||
<va-tree-node>
|
||||
<div class="row">
|
||||
<div class="flex sm12 xl12 md12 xs12">
|
||||
<div
|
||||
style='display: inline-block;'
|
||||
v-for="axisChannel in ['x','y','z','m']"
|
||||
:key="axisChannel"
|
||||
>
|
||||
<va-button
|
||||
class="ma-1 pa-0 circle-button"
|
||||
v-if="axisChannelList != null && axisChannelList.indexOf(axisChannel) >= 0"
|
||||
@click="axisChannelClickRemove(axisChannel)"
|
||||
small
|
||||
>
|
||||
{{axisChannel}}
|
||||
</va-button>
|
||||
<va-button
|
||||
class="ma-1 pa-0 circle-button"
|
||||
v-if="axisChannelList == null || axisChannelList.indexOf(axisChannel) < 0"
|
||||
@click="axisChannelClickAdd(axisChannel)"
|
||||
small outline
|
||||
>
|
||||
{{axisChannel}}
|
||||
</va-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</va-tree-node>
|
||||
</va-tree-category>
|
||||
|
||||
<va-tree-category
|
||||
style="font-size: 20px;"
|
||||
:label="'Amp gain'">
|
||||
<va-tree-node>
|
||||
<div class="row">
|
||||
<div class="flex sm12 xl12 md12 xs12">
|
||||
<va-select
|
||||
@input="ampGainSelectChange()"
|
||||
:label="''"
|
||||
v-model="ampGainSelect"
|
||||
textBy="description"
|
||||
:options="ampGainOptions"
|
||||
:noClear='true'
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</va-tree-node>
|
||||
</va-tree-category>
|
||||
|
||||
<va-tree-category
|
||||
style="font-size: 20px;"
|
||||
:label="'Sample Rate'">
|
||||
<va-tree-node>
|
||||
<div class="row">
|
||||
<div class="flex sm12 xl12 md12 xs12">
|
||||
<va-select
|
||||
@input="sampleRateSelectChange()"
|
||||
:label="''"
|
||||
v-model="sampleRateSelect"
|
||||
textBy="description"
|
||||
:options="sampleRateOptions"
|
||||
:noClear='true'
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</va-tree-node>
|
||||
</va-tree-category>
|
||||
|
||||
<va-tree-category
|
||||
style="font-size: 20px;"
|
||||
:label="'Accelerator Sensitivity'">
|
||||
<va-tree-node>
|
||||
<div class="row">
|
||||
<div class="flex sm12 xl12 md12 xs12">
|
||||
<va-select
|
||||
@input="acceleratorSensitivitySelectChange()"
|
||||
:label="''"
|
||||
v-model="acceleratorSensitivitySelect"
|
||||
textBy="description"
|
||||
:options="acceleratorSensitivityOptions"
|
||||
:noClear='true'
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</va-tree-node>
|
||||
</va-tree-category>
|
||||
</va-tree-root>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { taskInfo } from '../../../../data/task/TaskInfo'
|
||||
import { chartData } from '../../../../data/task/ChartsManagement'
|
||||
|
||||
export default {
|
||||
name: 'NeuliveParameterRecording',
|
||||
components: {
|
||||
},
|
||||
props: {
|
||||
deviceID: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
deviceName: {
|
||||
type: String,
|
||||
default: 'Neulive',
|
||||
},
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
channelArray: Array.from({ length: 64 }, (_, i) => i + 1),
|
||||
channelList: [],
|
||||
ampGainSelect: null,
|
||||
ampGainOptions: [
|
||||
// {
|
||||
// id: 0,
|
||||
// description: '25',
|
||||
// },
|
||||
{
|
||||
id: 0,
|
||||
description: '100',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
description: '300',
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
description: '500',
|
||||
},
|
||||
],
|
||||
sampleRateSelect: null,
|
||||
sampleRateOptions: [
|
||||
{
|
||||
id: 0,
|
||||
value: 1000,
|
||||
description: '1k',
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
value: 2000,
|
||||
description: '2k',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
value: 4000,
|
||||
description: '4k',
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
value: 5000,
|
||||
description: '5k',
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
value: 8000,
|
||||
description: '8k',
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
value: 10000,
|
||||
description: '10k',
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
value: 20000,
|
||||
description: '20k',
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
value: 30000,
|
||||
description: '30k',
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
value: 40000,
|
||||
description: '40k',
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
value: 50000,
|
||||
description: '50k',
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
value: 60000,
|
||||
description: '60k',
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
value: 70000,
|
||||
description: '70k',
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
value: 80000,
|
||||
description: '80k',
|
||||
},
|
||||
{
|
||||
id: 13,
|
||||
value: 90000,
|
||||
description: '90k',
|
||||
},
|
||||
{
|
||||
id: 14,
|
||||
value: 100000,
|
||||
description: '100k',
|
||||
},
|
||||
],
|
||||
acceleratorSensitivitySelect: null,
|
||||
acceleratorSensitivityOptions: [
|
||||
{
|
||||
id: 0,
|
||||
value: 3,
|
||||
description: '2G',
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
value: 5,
|
||||
description: '4G',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
value: 8,
|
||||
description: '8G',
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
value: 12,
|
||||
description: '16G',
|
||||
},
|
||||
],
|
||||
// sampleRateInput: '1000',
|
||||
// sampleRate: null,
|
||||
recordOn: false,
|
||||
axisChannelList: [],
|
||||
}
|
||||
},
|
||||
mqtt: {
|
||||
},
|
||||
methods: {
|
||||
mqttPub: function (topic, mes) {
|
||||
this.$mqtt.publish(topic, mes)
|
||||
},
|
||||
refresh () {
|
||||
this.channelList.length = 0
|
||||
taskInfo.getDeviceInfo(this.deviceID).parameterSet.CH_LIST = Array(64).fill(0)
|
||||
const channelSetLow = taskInfo.getDeviceInfo(this.deviceID).parameterSet.REC_CH_DEV00.toString(2).split('').reverse()
|
||||
taskInfo.getDeviceInfo(this.deviceID).parameterSet.CH_NUMBER = 0
|
||||
channelSetLow.forEach((element, index) => {
|
||||
if (parseInt(element) > 0) {
|
||||
this.channelList.push(index + 1)
|
||||
taskInfo.getDeviceInfo(this.deviceID).parameterSet.CH_LIST[index + 0] = 1
|
||||
taskInfo.getDeviceInfo(this.deviceID).parameterSet.CH_NUMBER += 1
|
||||
}
|
||||
})
|
||||
const channelSetHight = taskInfo.getDeviceInfo(this.deviceID).parameterSet.REC_CH_DEV01.toString(2).split('').reverse()
|
||||
channelSetHight.forEach((element, index) => {
|
||||
if (parseInt(element) > 0) {
|
||||
this.channelList.push(index + 33)
|
||||
taskInfo.getDeviceInfo(this.deviceID).parameterSet.CH_LIST[index + 32] = 1
|
||||
taskInfo.getDeviceInfo(this.deviceID).parameterSet.CH_NUMBER += 1
|
||||
}
|
||||
})
|
||||
this.ampGainOptions.forEach(option => {
|
||||
if (option.id === taskInfo.getDeviceInfo(this.deviceID).parameterSet.AMP_GAIN) {
|
||||
this.ampGainSelect = option
|
||||
}
|
||||
})
|
||||
this.sampleRateSelect = this.sampleRateOptions[this.sampleRateOptions.findIndex(ele => ele.value === taskInfo.getDeviceInfo(this.deviceID).parameterSet.SAMPLE_RATE)]
|
||||
this.recordOn = taskInfo.getDeviceInfo(this.deviceID).parameterSet.RECORDING
|
||||
this.axisChannelList.length = 0
|
||||
const axisChannelSet = taskInfo.getDeviceInfo(this.deviceID).parameterSet.AXIS_CH.toString(2).split('').reverse()
|
||||
axisChannelSet.forEach((element, index) => {
|
||||
if (parseInt(element) === 1) {
|
||||
if (index === 0) {
|
||||
this.axisChannelList.push('x')
|
||||
} else if (index === 1) {
|
||||
this.axisChannelList.push('y')
|
||||
} else if (index === 2) {
|
||||
this.axisChannelList.push('z')
|
||||
} else if (index === 3) {
|
||||
this.axisChannelList.push('m')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
this.acceleratorSensitivitySelect = this.acceleratorSensitivityOptions[taskInfo.getDeviceInfo(this.deviceID).parameterSet.ACCELERATOR_S]
|
||||
},
|
||||
channelClickAdd (val) {
|
||||
if (this.channelList.indexOf(val) < 0 && val <= 32 && val > 0) {
|
||||
this.channelList.push(val)
|
||||
|
||||
let channelSet = ''
|
||||
for (let i = 32; i >= 1; i--) {
|
||||
if (this.channelList.indexOf(i) >= 0) {
|
||||
channelSet += '1'
|
||||
} else {
|
||||
channelSet += '0'
|
||||
}
|
||||
}
|
||||
const channelValue = parseInt(channelSet, 2)
|
||||
|
||||
if (channelValue !== taskInfo.getDeviceInfo(this.deviceID).RECORDING_CH_L) {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_parameter/0',
|
||||
device: taskInfo.getRawDeviceID(this.deviceID),
|
||||
parameter: 'REC_CH_DEV00',
|
||||
content: channelValue,
|
||||
}))
|
||||
}
|
||||
} else if (this.channelList.indexOf(val) < 0 && val <= 64 && val > 32) {
|
||||
this.channelList.push(val)
|
||||
|
||||
let channelSet = ''
|
||||
for (let i = 64; i >= 33; i--) {
|
||||
if (this.channelList.indexOf(i) >= 0) {
|
||||
channelSet += '1'
|
||||
} else {
|
||||
channelSet += '0'
|
||||
}
|
||||
}
|
||||
const channelValue = parseInt(channelSet, 2)
|
||||
|
||||
if (channelValue !== taskInfo.getDeviceInfo(this.deviceID).RECORDING_CH_H) {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_parameter/0',
|
||||
device: taskInfo.getRawDeviceID(this.deviceID),
|
||||
parameter: 'REC_CH_DEV01',
|
||||
content: channelValue,
|
||||
}))
|
||||
}
|
||||
} else {
|
||||
this.pageToast('Recording channels cannot choose more than 64.')
|
||||
}
|
||||
},
|
||||
channelClickRemove (val) {
|
||||
if (this.channelList.indexOf(val) >= 0 && val <= 32 && val > 0) {
|
||||
this.channelList.splice(this.channelList.indexOf(val), 1)
|
||||
let channelSet = ''
|
||||
for (let i = 32; i >= 1; i--) {
|
||||
if (this.channelList.indexOf(i) >= 0) {
|
||||
channelSet += '1'
|
||||
} else {
|
||||
channelSet += '0'
|
||||
}
|
||||
}
|
||||
const channelValue = parseInt(channelSet, 2)
|
||||
if (channelValue !== taskInfo.getDeviceInfo(this.deviceID).RECORDING_CH_L) {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_parameter/0',
|
||||
device: taskInfo.getRawDeviceID(this.deviceID),
|
||||
parameter: 'REC_CH_DEV00',
|
||||
content: channelValue,
|
||||
}))
|
||||
}
|
||||
} else if (this.channelList.indexOf(val) >= 0 && val <= 64 && val > 32) {
|
||||
this.channelList.splice(this.channelList.indexOf(val), 1)
|
||||
let channelSet = ''
|
||||
for (let i = 64; i >= 33; i--) {
|
||||
if (this.channelList.indexOf(i) >= 0) {
|
||||
channelSet += '1'
|
||||
} else {
|
||||
channelSet += '0'
|
||||
}
|
||||
}
|
||||
const channelValue = parseInt(channelSet, 2)
|
||||
if (channelValue !== taskInfo.getDeviceInfo(this.deviceID).RECORDING_CH_H) {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_parameter/0',
|
||||
device: taskInfo.getRawDeviceID(this.deviceID),
|
||||
parameter: 'REC_CH_DEV01',
|
||||
content: channelValue,
|
||||
}))
|
||||
}
|
||||
}
|
||||
},
|
||||
ampGainSelectChange () {
|
||||
if (this.ampGainSelect != null && this.ampGainSelect.id !== ((taskInfo.getDeviceInfo(this.deviceID).parameterSet.AMP_GAIN) % 4)) {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_parameter/0',
|
||||
device: taskInfo.getRawDeviceID(this.deviceID),
|
||||
parameter: 'AMP_GAIN',
|
||||
content: ((this.ampGainSelect.id) % 4),
|
||||
}))
|
||||
}
|
||||
},
|
||||
sampleRateSelectChange () {
|
||||
if (this.sampleRateSelect != null && this.sampleRateSelect.value !== ((taskInfo.getDeviceInfo(this.deviceID).parameterSet.SAMPLE_RATE))) {
|
||||
const adcClock = 8e6 / this.sampleRateSelect.value
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_parameter/0',
|
||||
device: taskInfo.getRawDeviceID(this.deviceID),
|
||||
parameter: 'SAMPLE_RATE|ADC_CLOCK',
|
||||
content: `${this.sampleRateSelect.value}|${String(adcClock)}`,
|
||||
}))
|
||||
}
|
||||
},
|
||||
acceleratorSensitivitySelectChange () {
|
||||
if (this.acceleratorSensitivitySelect != null && this.acceleratorSensitivitySelect.id !== ((taskInfo.getDeviceInfo(this.deviceID).parameterSet.ACCELERATOR_S))) {
|
||||
let scaleRange
|
||||
switch (this.acceleratorSensitivitySelect.id) {
|
||||
case 0:
|
||||
scaleRange = 200
|
||||
break
|
||||
case 1:
|
||||
scaleRange = 400
|
||||
break
|
||||
case 2:
|
||||
scaleRange = 800
|
||||
break
|
||||
case 3:
|
||||
scaleRange = 1600
|
||||
break
|
||||
default:
|
||||
scaleRange = 0
|
||||
break
|
||||
}
|
||||
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_parameter/0',
|
||||
device: taskInfo.getRawDeviceID(this.deviceID),
|
||||
parameter: 'ACCELERATOR_S',
|
||||
content: this.acceleratorSensitivitySelect.id,
|
||||
}))
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_update_accelerator_sensitivity/0',
|
||||
device: taskInfo.getRawDeviceID(this.deviceID),
|
||||
content: this.acceleratorSensitivitySelect.value,
|
||||
}))
|
||||
const charts = chartData.getAllChartsData()
|
||||
for (const chartID in charts) {
|
||||
for (const seriesIndex in charts[chartID].series) {
|
||||
if (charts[chartID].series[seriesIndex].yAxisSource[1] >= 256 && charts[chartID].series[seriesIndex].yAxisSource[1] <= 260) {
|
||||
if (parseInt(charts[chartID].series[seriesIndex].yAxisSource[1]) === 260) {
|
||||
charts[chartID].yAxis[seriesIndex].min = 0
|
||||
charts[chartID].yAxis[seriesIndex].max = Math.ceil(Math.sqrt(Math.pow(scaleRange, 2) * 3))
|
||||
} else {
|
||||
charts[chartID].yAxis[seriesIndex].min = -scaleRange
|
||||
charts[chartID].yAxis[seriesIndex].max = scaleRange
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
recordClick () {
|
||||
this.recordOn = !this.recordOn
|
||||
if (this.recordOn) {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
device: taskInfo.getRawDeviceID(this.deviceID),
|
||||
instruction: 'record',
|
||||
}))
|
||||
this.$emit('record')
|
||||
} else {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
device: taskInfo.getRawDeviceID(this.deviceID),
|
||||
instruction: 'stop_record',
|
||||
}))
|
||||
this.$emit('record_stop')
|
||||
}
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_parameter/0',
|
||||
device: taskInfo.getRawDeviceID(this.deviceID),
|
||||
parameter: 'RECORDING',
|
||||
content: this.recordOn,
|
||||
}))
|
||||
},
|
||||
axisChannelClickAdd (val) {
|
||||
if (this.axisChannelList.indexOf(val) < 0) {
|
||||
const axisChannel = ['m', 'z', 'y', 'x']
|
||||
this.axisChannelList.push(val)
|
||||
let axisChannelSet = ''
|
||||
for (const axis of axisChannel) {
|
||||
if (this.axisChannelList.indexOf(axis) >= 0) {
|
||||
axisChannelSet += '1'
|
||||
} else {
|
||||
axisChannelSet += '0'
|
||||
}
|
||||
}
|
||||
const axisChannelValue = parseInt(axisChannelSet, 2)
|
||||
if (axisChannelValue !== taskInfo.getDeviceInfo(this.deviceID).AXIS_CH) {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_parameter/0',
|
||||
device: taskInfo.getRawDeviceID(this.deviceID),
|
||||
parameter: 'AXIS_CH',
|
||||
content: axisChannelValue,
|
||||
}))
|
||||
}
|
||||
}
|
||||
},
|
||||
axisChannelClickRemove (val) {
|
||||
if (this.axisChannelList.indexOf(val) >= 0) {
|
||||
const axisChannel = ['m', 'z', 'y', 'x']
|
||||
this.axisChannelList.splice(this.axisChannelList.indexOf(val), 1)
|
||||
let axisChannelSet = ''
|
||||
for (const axis of axisChannel) {
|
||||
if (this.axisChannelList.indexOf(axis) >= 0) {
|
||||
axisChannelSet += '1'
|
||||
} else {
|
||||
axisChannelSet += '0'
|
||||
}
|
||||
}
|
||||
const axisChannelValue = parseInt(axisChannelSet, 2)
|
||||
if (axisChannelValue !== taskInfo.getDeviceInfo(this.deviceID).AXIS_CH) {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_parameter/0',
|
||||
device: taskInfo.getRawDeviceID(this.deviceID),
|
||||
parameter: 'AXIS_CH',
|
||||
content: axisChannelValue,
|
||||
}))
|
||||
}
|
||||
}
|
||||
},
|
||||
pageToast: function (mes) {
|
||||
this.showToast(
|
||||
mes,
|
||||
{
|
||||
icon: 'fa-bell',
|
||||
position: 'bottom-right',
|
||||
duration: 4000,
|
||||
},
|
||||
)
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
this.refresh()
|
||||
},
|
||||
destroyed () {
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.circle-button {
|
||||
height: 25px;
|
||||
width: 25px;
|
||||
border-radius: '50%';
|
||||
}
|
||||
</style>
|
||||
@@ -167,6 +167,7 @@
|
||||
v-model="amplitudeNumber"
|
||||
:min="5"
|
||||
:max="4000"
|
||||
:step="5"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -292,7 +293,7 @@
|
||||
0.1
|
||||
</va-button> -->
|
||||
<va-input
|
||||
@keyup.enter="timeRangeChange(3, t3RangeInput)"
|
||||
readonly
|
||||
v-model="t3RangeInput"
|
||||
class="mb-0"
|
||||
:label="'T3 RANGE'"
|
||||
@@ -317,7 +318,6 @@
|
||||
0
|
||||
</va-button> -->
|
||||
<va-input
|
||||
@keyup.enter="timeRangeChange(4, t4RangeInput)"
|
||||
readonly
|
||||
v-model="t4RangeInput"
|
||||
class="mb-0"
|
||||
@@ -394,11 +394,11 @@ export default {
|
||||
cycleNumberSelect: null,
|
||||
cycleNumberOptions: [
|
||||
{
|
||||
label: 'limite',
|
||||
label: 'limited',
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
label: 'Unlimite',
|
||||
label: 'Unlimited',
|
||||
value: 1,
|
||||
},
|
||||
],
|
||||
@@ -637,24 +637,21 @@ export default {
|
||||
if (this.amplitudeNumber == null) {
|
||||
return false
|
||||
}
|
||||
if (typeof (val) === 'string') {
|
||||
if (isNaN(val) || parseInt(val) > 4000 || parseInt(val) < 5) {
|
||||
this.amplitudeNumberInput = '50'
|
||||
this.amplitudeNumber = 50
|
||||
}
|
||||
if (parseInt(this.amplitudeNumberInput) !== parseInt(this.amplitudeNumber)) {
|
||||
this.amplitudeNumber = parseInt(val)
|
||||
}
|
||||
|
||||
val = parseInt(val)
|
||||
const remainder = val % 5
|
||||
if (remainder >= 3) {
|
||||
val += (5 - remainder)
|
||||
} else {
|
||||
if (isNaN(val) || parseInt(val) > 4000 || parseInt(val) < 5) {
|
||||
this.amplitudeNumberInput = '50'
|
||||
this.samplitudeNumber = 50
|
||||
}
|
||||
if (parseInt(this.amplitudeNumberInput) !== parseInt(this.amplitudeNumber) || this.amplitudeNumber !== val) {
|
||||
this.amplitudeNumberInput = String(val)
|
||||
this.amplitudeNumber = val
|
||||
}
|
||||
val -= remainder
|
||||
}
|
||||
|
||||
if (isNaN(val) || val > 4000 || val < 5) {
|
||||
val = 50
|
||||
}
|
||||
this.amplitudeNumberInput = String(val)
|
||||
this.amplitudeNumber = val
|
||||
|
||||
if (parseInt(this.amplitudeNumber / 5) !== parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_AMPLITUDE)) {
|
||||
const content = parseInt(this.amplitudeNumber / 5)
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
@@ -684,7 +681,7 @@ export default {
|
||||
this.t3Range = 0
|
||||
} else if (this.patternModeSelect === 1) {
|
||||
this.t2Range = 0
|
||||
this.t3Range = 10
|
||||
this.t3Range = this.t1Range
|
||||
this.t3RangeInput = String((this.t3Range * 10) / this.unitMultiply)
|
||||
}
|
||||
|
||||
@@ -770,28 +767,30 @@ export default {
|
||||
this.updateStiTRangeCheckParam()
|
||||
},
|
||||
timeRangeChange (stiIimeSelect, inputVal) {
|
||||
inputVal = parseFloat(inputVal)
|
||||
let tRangeInput = parseFloat(inputVal * this.unitMultiply)
|
||||
const remainder = tRangeInput % 10
|
||||
if (remainder >= 5) {
|
||||
tRangeInput += (10 - remainder)
|
||||
} else {
|
||||
tRangeInput -= remainder
|
||||
}
|
||||
|
||||
switch (stiIimeSelect) {
|
||||
case 1:
|
||||
this.t1RangeInput = inputVal
|
||||
this.t1Range = parseFloat((inputVal * this.unitMultiply) / 10)
|
||||
this.t1RangeInput = String(tRangeInput / this.unitMultiply)
|
||||
this.t1Range = parseFloat(tRangeInput / 10)
|
||||
if (this.patternModeSelect === 1) { // biphasic
|
||||
this.t3RangeInput = this.t1RangeInput
|
||||
this.t3Range = this.t1Range
|
||||
}
|
||||
this.autoComputeT4()
|
||||
break
|
||||
case 2:
|
||||
this.t2RangeInput = inputVal
|
||||
this.t2Range = parseFloat((inputVal * this.unitMultiply) / 10)
|
||||
this.t2RangeInput = String(tRangeInput / this.unitMultiply)
|
||||
this.t2Range = parseFloat(tRangeInput / 10)
|
||||
this.autoComputeT4()
|
||||
break
|
||||
case 3:
|
||||
this.t3RangeInput = inputVal
|
||||
this.t3Range = parseFloat((inputVal * this.unitMultiply) / 10)
|
||||
this.autoComputeT4()
|
||||
break
|
||||
case 4:
|
||||
this.t4RangeInput = inputVal
|
||||
this.t4Range = parseFloat((inputVal * this.unitMultiply) / 10)
|
||||
break
|
||||
// T3 / T4 will be set automatically
|
||||
}
|
||||
|
||||
const status1 = this.checkIndividualTRange(1, this.t1Range)
|
||||
@@ -824,7 +823,7 @@ export default {
|
||||
this.t1RangeInput = String((this.t1Range * 10) / this.unitMultiply)
|
||||
this.t2Range = 10
|
||||
this.t2RangeInput = String((this.t2Range * 10) / this.unitMultiply)
|
||||
this.t3Range = 10
|
||||
this.t3Range = this.t1Range
|
||||
this.t3RangeInput = String((this.t3Range * 10) / this.unitMultiply)
|
||||
this.t4Range = this.periodNumber / 10 - this.t1Range - this.t2Range - this.t3Range
|
||||
this.t4RangeInput = String((this.t4Range * 10) / this.unitMultiply)
|
||||
@@ -862,8 +861,8 @@ export default {
|
||||
|
||||
switch (stiIimeSelect) {
|
||||
case 1:
|
||||
if (val < 100 || val > 10230) { // us
|
||||
this.updateTRangeErrorMsg({ stiIimeSelect: stiIimeSelect, status: true, msg: '0.1ms <= T1 <= 10.23ms' })
|
||||
if (val < 10 || val > 10230) { // us
|
||||
this.updateTRangeErrorMsg({ stiIimeSelect: stiIimeSelect, status: true, msg: '0.01ms <= T1 <= 10.23ms' })
|
||||
return false
|
||||
} else if (val > this.periodNumber) {
|
||||
this.updateTRangeErrorMsg({ stiIimeSelect: stiIimeSelect, status: true, msg: 'T1 > PERIOD' })
|
||||
@@ -890,8 +889,8 @@ export default {
|
||||
}
|
||||
case 3:
|
||||
if (this.patternModeSelect === 1) { // biphasic
|
||||
if (val < 100 || val > 10230) { // us
|
||||
this.updateTRangeErrorMsg({ stiIimeSelect: stiIimeSelect, status: true, msg: '0.1ms <= T3 <= 10.23ms' })
|
||||
if (val < 10 || val > 10230) { // us
|
||||
this.updateTRangeErrorMsg({ stiIimeSelect: stiIimeSelect, status: true, msg: '0.01ms <= T3 <= 10.23ms' })
|
||||
return false
|
||||
} else if (val > this.periodNumber) {
|
||||
this.updateTRangeErrorMsg({ stiIimeSelect: stiIimeSelect, status: true, msg: 'T3 > PERIOD' })
|
||||
|
||||
@@ -51,11 +51,11 @@
|
||||
<div class="flex sm12 xl12 md12 xs12">
|
||||
<div
|
||||
style='display: inline-block;'
|
||||
v-for="channel in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]"
|
||||
v-for="channel in [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]"
|
||||
:key="channel"
|
||||
>
|
||||
<va-button
|
||||
class="mx-1 px-2"
|
||||
class="ma-1 pa-0 circle-button"
|
||||
color="success"
|
||||
v-if="posChannelList.indexOf(channel) >= 0 && negChannelList.indexOf(channel) < 0"
|
||||
@click="channelClick(channel)"
|
||||
@@ -64,7 +64,7 @@
|
||||
{{channel}}
|
||||
</va-button>
|
||||
<va-button
|
||||
class="mx-1 px-2"
|
||||
class="ma-1 pa-0 circle-button"
|
||||
color="danger"
|
||||
v-if="posChannelList.indexOf(channel) < 0 && negChannelList.indexOf(channel) >= 0"
|
||||
@click="channelClick(channel)"
|
||||
@@ -73,7 +73,7 @@
|
||||
{{channel}}
|
||||
</va-button>
|
||||
<va-button
|
||||
class="mx-1 px-2"
|
||||
class="ma-1 pa-0 circle-button"
|
||||
v-if="posChannelList.indexOf(channel) < 0 && negChannelList.indexOf(channel) < 0"
|
||||
@click="channelClick(channel)"
|
||||
small outline
|
||||
@@ -88,6 +88,7 @@
|
||||
<div class="mt-4">
|
||||
<div class="row sm12 xl12 md12 xs12">
|
||||
<p class="display-6">CYCLE NUMBER</p>
|
||||
<va-button flat color="gray" icon="fa fa-info-circle" style="margin: 0.001rem; padding: 0.001rem;" @click.stop="toggleModal('SKETCHMAP')"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="flex sm12 xl12 md12 xs12">
|
||||
@@ -116,20 +117,65 @@
|
||||
Rounds
|
||||
</p>
|
||||
</va-input>
|
||||
<va-button slot="append" class="ml-2 pa-1 shrink" small @click="cycleNumberChange(256)">
|
||||
256
|
||||
<va-button slot="append" class="ml-2 pa-1 shrink" small @click="cycleNumberChange(255)">
|
||||
255
|
||||
</va-button>
|
||||
</div>
|
||||
<va-slider
|
||||
class="flex sm12 xl12 md12 xs12"
|
||||
@mouseup.native="cycleNumberChange(cycleNumber)"
|
||||
@mouseleave.native="cycleNumberChange(cycleNumber)"
|
||||
@touchend.native="cycleNumberChange(cycleNumber)"
|
||||
value-visible
|
||||
v-model="cycleNumber"
|
||||
:min="1"
|
||||
:max="256"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-4" v-if="cycleNumberSelect==0">
|
||||
<div class="row sm12 xl12 md12 xs12">
|
||||
<p class="display-6">REPEAT NUMBER</p>
|
||||
<va-button flat color="gray" icon="fa fa-info-circle" style="margin: 0.001rem; padding: 0.001rem;" @click.stop="toggleModal('SKETCHMAP')"/>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="flex sm12 xl12 md12 xs12">
|
||||
<div class="flex row align--center">
|
||||
<va-button slot="append" class="mr-2 pa-1 shrink" small @click="repeatNumberChange(1)">
|
||||
1
|
||||
</va-button>
|
||||
<va-input
|
||||
@keyup.enter="repeatNumberChange(repeatNumberInput)"
|
||||
v-model="repeatNumberInput"
|
||||
class="mb-0"
|
||||
>
|
||||
<p slot="append" style="margin-right: 0;" small>
|
||||
Rounds
|
||||
</p>
|
||||
</va-input>
|
||||
<va-button slot="append" class="ml-2 pa-1 shrink" small @click="repeatNumberChange(255)">
|
||||
255
|
||||
</va-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-4" v-if="cycleNumberSelect==0">
|
||||
<div class="row sm12 xl12 md12 xs12">
|
||||
<p class="display-6">REPEAT INTERVAL = Ti = (Ts + Tr)</p>
|
||||
<va-button flat color="gray" icon="fa fa-info-circle" style="margin: 0.001rem; padding: 0.001rem;" @click.stop="toggleModal('SKETCHMAP')"/>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="flex sm12 xl12 md12 xs12">
|
||||
<div class="flex row align--center">
|
||||
<va-input
|
||||
@keyup.enter="repeatIntervalChange(repeatIntervalInput)"
|
||||
v-model="repeatIntervalInput"
|
||||
class="mb-0"
|
||||
:key="repeatIntervalErrorMsg.key"
|
||||
:error="repeatIntervalErrorMsg.showError"
|
||||
:error-messages="repeatIntervalErrorMsg.errorMsg"
|
||||
>
|
||||
<p slot="append" style="margin-right: 0;" small>
|
||||
s
|
||||
</p>
|
||||
</va-input>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -158,16 +204,6 @@
|
||||
4000
|
||||
</va-button>
|
||||
</div>
|
||||
<va-slider
|
||||
class="flex sm12 xl12 md12 xs12"
|
||||
@mouseup.native="amplitudeNumberChange(amplitudeNumber.PHASE1, 'PHASE1')"
|
||||
@mouseleave.native="amplitudeNumberChange(amplitudeNumber.PHASE1, 'PHASE1')"
|
||||
@touchend.native="amplitudeNumberChange(amplitudeNumber.PHASE1, 'PHASE1')"
|
||||
value-visible
|
||||
v-model="amplitudeNumber.PHASE1"
|
||||
:min="5"
|
||||
:max="4000"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -196,7 +232,7 @@
|
||||
4000
|
||||
</va-button>
|
||||
</div>
|
||||
<va-slider
|
||||
<!-- <va-slider
|
||||
class="flex sm12 xl12 md12 xs12"
|
||||
@mouseup.native="amplitudeNumberChange(amplitudeNumber.PHASE2, 'PHASE2')"
|
||||
@mouseleave.native="amplitudeNumberChange(amplitudeNumber.PHASE2, 'PHASE2')"
|
||||
@@ -205,7 +241,7 @@
|
||||
v-model="amplitudeNumber.PHASE2"
|
||||
:min="5"
|
||||
:max="4000"
|
||||
/>
|
||||
/> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -243,7 +279,7 @@
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="flex sm12 xl12 md12 xs12">
|
||||
<div class="flex sm12 xl6 md6 xs12">
|
||||
<div class="flex row align--center">
|
||||
<va-input
|
||||
v-model="frequencyNumberInput"
|
||||
@@ -257,10 +293,7 @@
|
||||
</va-input>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="flex sm12 xl12 md12 xs12">
|
||||
<div class="flex sm12 xl6 md6 xs12">
|
||||
<div class="flex row align--center">
|
||||
<va-input
|
||||
v-model="periodNumberInput"
|
||||
@@ -286,6 +319,7 @@
|
||||
@keyup.enter="timeRangeChange(1, t1RangeInput)"
|
||||
v-model="t1RangeInput"
|
||||
class="mb-0"
|
||||
:key="TRangeErrorMsgList[0].key"
|
||||
:label="'T1 RANGE'"
|
||||
:error="TRangeErrorMsgList[0].showError"
|
||||
:error-messages="TRangeErrorMsgList[0].errorMsg"
|
||||
@@ -311,6 +345,7 @@
|
||||
@keyup.enter="timeRangeChange(2, t2RangeInput)"
|
||||
v-model="t2RangeInput"
|
||||
class="mb-0"
|
||||
:key="TRangeErrorMsgList[1].key"
|
||||
:label="'T2 RANGE'"
|
||||
:error="TRangeErrorMsgList[1].showError"
|
||||
:error-messages="TRangeErrorMsgList[1].errorMsg"
|
||||
@@ -336,6 +371,7 @@
|
||||
@keyup.enter="timeRangeChange(3, t3RangeInput)"
|
||||
v-model="t3RangeInput"
|
||||
class="mb-0"
|
||||
:key="TRangeErrorMsgList[2].key"
|
||||
:label="'T3 RANGE'"
|
||||
:error="TRangeErrorMsgList[2].showError"
|
||||
:error-messages="TRangeErrorMsgList[2].errorMsg"
|
||||
@@ -362,6 +398,7 @@
|
||||
readonly
|
||||
v-model="t4RangeInput"
|
||||
class="mb-0"
|
||||
:key="TRangeErrorMsgList[3].key"
|
||||
:label="'T4 RANGE'"
|
||||
:error="TRangeErrorMsgList[3].showError"
|
||||
:error-messages="TRangeErrorMsgList[3].errorMsg"
|
||||
@@ -394,15 +431,27 @@
|
||||
>
|
||||
<img src='@/assets/img/sti_user_guide.png' class="sti_guideline">
|
||||
</va-modal>
|
||||
<va-modal
|
||||
v-model="showGuideLineModal.SKETCHMAP"
|
||||
position="right"
|
||||
cancelText=""
|
||||
>
|
||||
<img src='@/assets/img/repeat.jpg' class="sti_guideline">
|
||||
<p class="display-6 my-2"> Pattern: </p>
|
||||
<chart :ref="'chart_ref'" :style="'width: '+ cardwidth + '; height: ' + cardheight + ';'" :options="sketchmapData" :auto-resize="true"></chart>
|
||||
<neulive-parameter-stimulation-sketchmap-param class="my-2" :deviceID="deviceID" :unitMultiply="unitMultiply" />
|
||||
</va-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { taskInfo } from '../../../../data/task/TaskInfo'
|
||||
import NeuliveParameterStimulationSketchmapParam from './NeuliveParameterStimulationSketchmapParam'
|
||||
|
||||
export default {
|
||||
name: 'NeuliveParameterStimulation',
|
||||
name: 'NeuliveParameterStimulation35',
|
||||
components: {
|
||||
NeuliveParameterStimulationSketchmapParam,
|
||||
},
|
||||
props: {
|
||||
deviceID: {
|
||||
@@ -416,7 +465,7 @@ export default {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
showGuideLineModal: { ELECTRODE: false, PATTERN: false },
|
||||
showGuideLineModal: { ELECTRODE: false, PATTERN: false, SKETCHMAP: false },
|
||||
stimulationOn: false,
|
||||
posChannelList: [2],
|
||||
negChannelList: [1],
|
||||
@@ -431,20 +480,25 @@ export default {
|
||||
value: 1,
|
||||
},
|
||||
],
|
||||
TRangeErrorMsgList: [{ id: 1, showError: false, errorMsg: [''] }, { id: 2, showError: false, errorMsg: [''] }, { id: 3, showError: false, errorMsg: [''] }, { id: 4, showError: false, errorMsg: [''] }],
|
||||
TRangeErrorMsgList: [{ id: 1, key: 0, showError: false, errorMsg: [''] }, { id: 2, key: 0, showError: false, errorMsg: [''] }, { id: 3, key: 0, showError: false, errorMsg: [''] }, { id: 4, key: 0, showError: false, errorMsg: [''] }],
|
||||
cycleNumberSelect: null,
|
||||
cycleNumberOptions: [
|
||||
{
|
||||
label: 'limite',
|
||||
label: 'limited',
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
label: 'Unlimite',
|
||||
label: 'Unlimited',
|
||||
value: 1,
|
||||
},
|
||||
],
|
||||
cycleNumberInput: '1',
|
||||
cycleNumber: 1,
|
||||
repeatIntervalErrorMsg: { id: 1, key: 0, showError: false, errorMsg: [''] },
|
||||
repeatNumberInput: '1',
|
||||
repeatNumber: 1,
|
||||
repeatIntervalInput: '65.54', // s
|
||||
repeatInterval: 65535, // ms
|
||||
// cycleNumberArray: Array(9).fill(1),
|
||||
amplitudeNumberInput: {
|
||||
PHASE1: '50',
|
||||
@@ -502,6 +556,34 @@ export default {
|
||||
t4RangeInput: '0',
|
||||
t4Range: 0,
|
||||
// t4RangeArray: Array(9).fill(0),
|
||||
cardheight: '400px',
|
||||
cardwidth: 'auto',
|
||||
sketchmapData: {
|
||||
xAxis: {
|
||||
type: 'value',
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
axisLabel: {
|
||||
},
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
},
|
||||
series: [
|
||||
{
|
||||
type: 'line',
|
||||
step: 'start',
|
||||
data: [],
|
||||
},
|
||||
],
|
||||
grid: {
|
||||
top: '2%',
|
||||
left: '10%',
|
||||
right: '2%',
|
||||
bottom: '6%',
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -514,6 +596,19 @@ export default {
|
||||
return true
|
||||
}
|
||||
},
|
||||
},
|
||||
mqtt: {
|
||||
},
|
||||
methods: {
|
||||
toggleModal (which) {
|
||||
if (which === 'ELECTRODE') {
|
||||
this.showGuideLineModal.ELECTRODE = true
|
||||
} else if (which === 'PATTERN') {
|
||||
this.showGuideLineModal.PATTERN = true
|
||||
} else if (which === 'REPEAT') {
|
||||
this.showGuideLineModal.REPEAT = true
|
||||
}
|
||||
},
|
||||
TRangeStatusCheck () {
|
||||
let flag = true
|
||||
for (let i = 0; i < this.TRangeErrorMsgList.length; i++) {
|
||||
@@ -528,23 +623,35 @@ export default {
|
||||
return false
|
||||
}
|
||||
},
|
||||
},
|
||||
mqtt: {
|
||||
},
|
||||
methods: {
|
||||
toggleModal (which) {
|
||||
if (which === 'ELECTRODE') {
|
||||
this.showGuideLineModal.ELECTRODE = true
|
||||
} else if (which === 'PATTERN') {
|
||||
this.showGuideLineModal.PATTERN = true
|
||||
repeatIntervalCheck () {
|
||||
// * 1000 -> ms to us
|
||||
if (this.repeatInterval * 1e3 > this.periodNumber * this.cycleNumber + taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_T5_CH1) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
},
|
||||
mqttPub: function (topic, mes) {
|
||||
this.$mqtt.publish(topic, mes)
|
||||
},
|
||||
deviceInstruction: function (id, instr) {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
device: taskInfo.getRawDeviceID(id),
|
||||
instruction: instr,
|
||||
}))
|
||||
},
|
||||
deviceParameterChange: async function (id, name, content) {
|
||||
taskInfo.getDeviceInfo(id).parameterSet[name] = content
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_parameter/0',
|
||||
device: taskInfo.getRawDeviceID(id),
|
||||
parameter: name,
|
||||
content: content,
|
||||
}))
|
||||
},
|
||||
refreshPattern () {
|
||||
this.patternModeSelect = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_PATTERN ? 1 : 0
|
||||
if (this.TRangeStatusCheck === true) {
|
||||
if (this.TRangeStatusCheck() === true) {
|
||||
// if t1~t4 is not valid input, not need to refresh
|
||||
this.t1Range = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_T1_CH0
|
||||
this.t1RangeInput = String((this.t1Range * 10) / this.unitMultiply)
|
||||
@@ -559,12 +666,11 @@ export default {
|
||||
this.t4RangeInput = String((this.t4Range * 10) / this.unitMultiply)
|
||||
// this.t4RangeArray.fill(this.t4Range, 0)
|
||||
}
|
||||
|
||||
this.periodNumber = (this.t1Range + this.t2Range + this.t3Range + this.t4Range) * 10
|
||||
this.periodNumberInput = String((this.periodNumber) / this.unitMultiply)
|
||||
|
||||
if (this.periodNumber !== 0) {
|
||||
this.frequencyNumber = parseInt(1 / (this.periodNumber * 1e-6))
|
||||
this.frequencyNumber = (1e6 / this.periodNumber).toFixed(2)
|
||||
this.frequencyNumberInput = String(this.frequencyNumber)
|
||||
}
|
||||
},
|
||||
@@ -581,9 +687,9 @@ export default {
|
||||
stiChannelSet.forEach((element, index) => {
|
||||
if (parseInt(element) > 0) {
|
||||
if (parseInt(stiPolaritySet[index]) > 0) {
|
||||
this.posChannelList.push(index + 1)
|
||||
this.posChannelList.push(index + 17)
|
||||
} else {
|
||||
this.negChannelList.push(index + 1)
|
||||
this.negChannelList.push(index + 17)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -591,6 +697,10 @@ export default {
|
||||
this.cycleNumberSelect = taskInfo.getDeviceInfo(this.deviceID).parameterSet.CONTINUOUS_STI ? 1 : 0
|
||||
this.cycleNumber = (taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_CYCLE_CH0 + 1)
|
||||
this.cycleNumberInput = String(this.cycleNumber)
|
||||
this.repeatNumber = (taskInfo.getDeviceInfo(this.deviceID).parameterSet.REPEAT_TIME_littleEndian)
|
||||
this.repeatNumberInput = String(this.repeatNumber)
|
||||
this.repeatInterval = (taskInfo.getDeviceInfo(this.deviceID).parameterSet.REPEAT_INTERVAL_littleEndian) // unit: ms
|
||||
this.repeatIntervalInput = String(this.repeatInterval / 1e3)
|
||||
// this.cycleNumberArray = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_CYCLE_LIST
|
||||
this.amplitudeNumber.PHASE1 = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_AMPLITUDE_L1 * 5
|
||||
this.amplitudeNumberInput.PHASE1 = String(this.amplitudeNumber.PHASE1)
|
||||
@@ -598,6 +708,12 @@ export default {
|
||||
this.amplitudeNumberInput.PHASE2 = String(this.amplitudeNumber.PHASE2)
|
||||
|
||||
this.refreshPattern()
|
||||
|
||||
// key-changing input error msg UI
|
||||
for (let i = 0; i <= 3; i++) {
|
||||
this.TRangeErrorMsgList[i].key++
|
||||
}
|
||||
this.repeatIntervalErrorMsg.key++
|
||||
},
|
||||
transUnit () {
|
||||
if (this.unitSelect === 0) { // s
|
||||
@@ -696,39 +812,61 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
repeatNumberChange (val) {
|
||||
if (isNaN(val) || parseInt(val) > 256 || parseInt(val) < 1) {
|
||||
this.repeatNumberInput = '1'
|
||||
this.repeatNumber = 1
|
||||
} else {
|
||||
this.repeatNumberInput = String(val)
|
||||
this.repeatNumber = parseInt(val)
|
||||
}
|
||||
|
||||
if (this.repeatNumber !== taskInfo.getDeviceInfo(this.deviceID).REPEAT_TIME_littleEndian) {
|
||||
this.deviceParameterChange(this.deviceID, 'REPEAT_TIME_littleEndian', String(this.repeatNumber))
|
||||
}
|
||||
},
|
||||
repeatIntervalChange (val) {
|
||||
this.repeatIntervalInput = String(parseFloat(val).toFixed(2))
|
||||
this.repeatInterval = parseFloat(this.repeatIntervalInput) * 1e3
|
||||
if (this.repeatInterval !== taskInfo.getDeviceInfo(this.deviceID).REPEAT_INTERVAL_littleEndian) {
|
||||
if (this.repeatIntervalCheck()) {
|
||||
this.deviceParameterChange(this.deviceID, 'REPEAT_INTERVAL_littleEndian', this.repeatInterval)
|
||||
this.resetRepeatIntervalErrorMsg()
|
||||
} else {
|
||||
this.updateRepeatIntervalErrorMsg({ status: true, msg: `Ti < ${this.periodNumberInput}${this.unitOptions[this.unitSelect].label} (period) * 1 (cycle)` })
|
||||
}
|
||||
}
|
||||
this.updateStiParamCheck()
|
||||
},
|
||||
updateRepeatIntervalErrorMsg (payload) {
|
||||
this.repeatIntervalErrorMsg.showError = payload.status
|
||||
this.repeatIntervalErrorMsg.errorMsg[0] = payload.msg
|
||||
},
|
||||
resetRepeatIntervalErrorMsg () {
|
||||
this.updateRepeatIntervalErrorMsg({ status: false, msg: '' })
|
||||
},
|
||||
amplitudeNumberChange (val, type) {
|
||||
if (this.amplitudeNumber[type] == null) {
|
||||
return false
|
||||
}
|
||||
if (typeof (val) === 'string') {
|
||||
if (isNaN(val) || parseInt(val) > 4000 || parseInt(val) < 5) {
|
||||
val = '50'
|
||||
this.amplitudeNumberInput[type] = '50'
|
||||
this.amplitudeNumber[type] = 50
|
||||
}
|
||||
if (parseInt(this.amplitudeNumberInput[type]) !== parseInt(this.amplitudeNumber)) {
|
||||
this.amplitudeNumber[type] = parseInt(val)
|
||||
}
|
||||
|
||||
val = parseInt(val)
|
||||
const remainder = val % 5
|
||||
if (remainder >= 3) {
|
||||
val += (5 - remainder)
|
||||
} else {
|
||||
if (isNaN(val) || parseInt(val) > 4000 || parseInt(val) < 5) {
|
||||
val = 50
|
||||
this.amplitudeNumberInput[type] = '50'
|
||||
this.amplitudeNumber[type] = 50
|
||||
}
|
||||
if (parseInt(this.amplitudeNumberInput[type]) !== parseInt(this.amplitudeNumber[type]) || this.amplitudeNumber[type] !== val) {
|
||||
this.amplitudeNumberInput[type] = String(val)
|
||||
this.amplitudeNumber[type] = val
|
||||
}
|
||||
val -= remainder
|
||||
}
|
||||
|
||||
if (isNaN(val) || val > 4000 || val < 5) {
|
||||
val = 50
|
||||
}
|
||||
this.amplitudeNumberInput[type] = String(val)
|
||||
this.amplitudeNumber[type] = val
|
||||
if (parseInt(this.amplitudeNumber[type] / 5) !== parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet['STI_AMPLITUDE_' + this.amplitudeName[type][1]])) {
|
||||
const content2 = parseInt(this.amplitudeNumber[type] / 5)
|
||||
const content1 = parseInt(this.amplitudeNumber[type] / 5 / 2)
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_parameter/0',
|
||||
device: taskInfo.getRawDeviceID(this.deviceID),
|
||||
parameter: `STI_AMPLITUDE_${this.amplitudeName[type][0]}|STI_AMPLITUDE_${this.amplitudeName[type][1]}`,
|
||||
content: `${content1}|${content2}`,
|
||||
}))
|
||||
const content1 = parseInt(this.amplitudeNumber[type] / 5)
|
||||
this.deviceParameterChange(this.deviceID, `STI_AMPLITUDE_${this.amplitudeName[type][0]}|STI_AMPLITUDE_${this.amplitudeName[type][1]}`, `${content1}|${content2}`)
|
||||
}
|
||||
},
|
||||
|
||||
@@ -755,11 +893,13 @@ export default {
|
||||
}
|
||||
|
||||
this.autoComputeT4()
|
||||
const check4 = this.checkIndividualTRange(4, this.t4Range)
|
||||
if (check4) {
|
||||
this.updateTimeRange()
|
||||
if (this.checkMultipleTRange()) {
|
||||
const check4 = this.checkIndividualTRange(4, this.t4Range)
|
||||
if (check4) {
|
||||
this.updateTimeRange()
|
||||
}
|
||||
}
|
||||
this.updateStiTRangeCheckParam()
|
||||
this.updateStiParamCheck()
|
||||
},
|
||||
frequencyNumberChange (val) {
|
||||
if (this.frequencyNumberInput == null || isNaN(val)) {
|
||||
@@ -779,31 +919,46 @@ export default {
|
||||
this.frequencyNumber = val
|
||||
}
|
||||
|
||||
this.periodNumber = (1e6 / this.frequencyNumber).toFixed(3) // us
|
||||
this.periodNumber = parseInt(1e6 / this.frequencyNumber) // us
|
||||
const remainder = this.periodNumber % 10
|
||||
if (remainder >= 5) {
|
||||
this.periodNumber += (10 - remainder)
|
||||
} else {
|
||||
this.periodNumber -= remainder
|
||||
}
|
||||
this.periodNumberInput = String(this.periodNumber / this.unitMultiply)
|
||||
|
||||
this.autoComputeT4()
|
||||
|
||||
const check1 = this.checkIndividualTRange(1, this.t1Range)
|
||||
const check2 = this.checkIndividualTRange(2, this.t2Range)
|
||||
const check3 = this.checkIndividualTRange(3, this.t3Range)
|
||||
const check4 = this.checkIndividualTRange(4, this.t4Range)
|
||||
// if pass, call this.updateTimeRange(), if any fail, call updateErrorMsg in this.checkIndividualTRange()
|
||||
if (check1 === true && check2 === true && check3 === true && check4 === true) {
|
||||
this.updateTimeRange()
|
||||
if (this.checkMultipleTRange()) {
|
||||
const check1 = this.checkIndividualTRange(1, this.t1Range)
|
||||
const check2 = this.checkIndividualTRange(2, this.t2Range)
|
||||
const check3 = this.checkIndividualTRange(3, this.t3Range)
|
||||
const check4 = this.checkIndividualTRange(4, this.t4Range)
|
||||
// if pass, call this.updateTimeRange(), if any fail, call updateErrorMsg in this.checkIndividualTRange()
|
||||
if (check1 === true && check2 === true && check3 === true && check4 === true) {
|
||||
this.updateTimeRange()
|
||||
}
|
||||
}
|
||||
this.updateStiTRangeCheckParam()
|
||||
this.updateStiParamCheck()
|
||||
},
|
||||
periodNumberChange (val) {
|
||||
const usVal = parseFloat(val * this.unitMultiply) // us
|
||||
let usVal = parseFloat(val * this.unitMultiply) // us
|
||||
const remainder = usVal % 10
|
||||
if (remainder >= 5) {
|
||||
usVal += (10 - remainder)
|
||||
} else {
|
||||
usVal -= remainder
|
||||
}
|
||||
|
||||
if (this.periodNumberInput == null || isNaN(usVal)) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (usVal < 50) { // freq: 1 to 20000Hz, so period > 50us (1e6/50=20000)
|
||||
this.periodNumber = 50
|
||||
this.periodNumberInput = String(50 / this.unitMultiply)
|
||||
this.pageToast('Reset to 50 us')
|
||||
if (usVal < 60) {
|
||||
this.periodNumber = 60
|
||||
this.periodNumberInput = String(60 / this.unitMultiply)
|
||||
this.pageToast('Reset to 60 us')
|
||||
} else if (usVal > 1e6) { // freq: 1 to 20000Hz, so period < 1e6us (1e6/1e6=1)
|
||||
this.periodNumber = 1e6
|
||||
this.periodNumberInput = String(1e6 / this.unitMultiply)
|
||||
@@ -813,64 +968,69 @@ export default {
|
||||
this.periodNumberInput = val
|
||||
}
|
||||
|
||||
this.frequencyNumber = parseInt(1e6 / this.periodNumber)
|
||||
this.frequencyNumber = (1e6 / this.periodNumber).toFixed(2)
|
||||
this.frequencyNumberInput = String(this.frequencyNumber)
|
||||
|
||||
this.autoComputeT4()
|
||||
|
||||
const check1 = this.checkIndividualTRange(1, this.t1Range)
|
||||
const check2 = this.checkIndividualTRange(2, this.t2Range)
|
||||
const check3 = this.checkIndividualTRange(3, this.t3Range)
|
||||
const check4 = this.checkIndividualTRange(4, this.t4Range)
|
||||
// if pass, call this.updateTimeRange(), if any fail, call updateErrorMsg in this.checkIndividualTRange()
|
||||
if (check1 === true && check2 === true && check3 === true && check4 === true) {
|
||||
this.updateTimeRange()
|
||||
if (this.checkMultipleTRange()) {
|
||||
const check1 = this.checkIndividualTRange(1, this.t1Range)
|
||||
const check2 = this.checkIndividualTRange(2, this.t2Range)
|
||||
const check3 = this.checkIndividualTRange(3, this.t3Range)
|
||||
const check4 = this.checkIndividualTRange(4, this.t4Range)
|
||||
// if pass, call this.updateTimeRange(), if any fail, call updateErrorMsg in this.checkIndividualTRange()
|
||||
if (check1 === true && check2 === true && check3 === true && check4 === true) {
|
||||
this.updateTimeRange()
|
||||
}
|
||||
}
|
||||
this.updateStiTRangeCheckParam()
|
||||
this.updateStiParamCheck()
|
||||
},
|
||||
timeRangeChange (stiIimeSelect, inputVal) {
|
||||
inputVal = parseFloat(inputVal)
|
||||
let tRangeInput = parseFloat(inputVal * this.unitMultiply)
|
||||
const remainder = tRangeInput % 10
|
||||
if (remainder >= 5) {
|
||||
tRangeInput += (10 - remainder)
|
||||
} else {
|
||||
tRangeInput -= remainder
|
||||
}
|
||||
|
||||
switch (stiIimeSelect) {
|
||||
case 1:
|
||||
this.t1RangeInput = inputVal
|
||||
this.t1Range = parseFloat((inputVal * this.unitMultiply) / 10)
|
||||
this.t1RangeInput = String(tRangeInput / this.unitMultiply)
|
||||
this.t1Range = parseFloat(tRangeInput / 10)
|
||||
this.autoComputeT4()
|
||||
break
|
||||
case 2:
|
||||
this.t2RangeInput = inputVal
|
||||
this.t2Range = parseFloat((inputVal * this.unitMultiply) / 10)
|
||||
this.t2RangeInput = String(tRangeInput / this.unitMultiply)
|
||||
this.t2Range = parseFloat(tRangeInput / 10)
|
||||
this.autoComputeT4()
|
||||
break
|
||||
case 3:
|
||||
this.t3RangeInput = inputVal
|
||||
this.t3Range = parseFloat((inputVal * this.unitMultiply) / 10)
|
||||
this.t3RangeInput = String(tRangeInput / this.unitMultiply)
|
||||
this.t3Range = parseFloat(tRangeInput / 10)
|
||||
this.autoComputeT4()
|
||||
break
|
||||
case 4:
|
||||
this.t4RangeInput = inputVal
|
||||
this.t4Range = parseFloat((inputVal * this.unitMultiply) / 10)
|
||||
this.t4RangeInput = String(tRangeInput / this.unitMultiply)
|
||||
this.t4Range = parseFloat(tRangeInput / 10)
|
||||
break
|
||||
}
|
||||
|
||||
const status1 = this.checkIndividualTRange(1, this.t1Range)
|
||||
const status2 = this.checkIndividualTRange(2, this.t2Range)
|
||||
const status3 = this.checkIndividualTRange(3, this.t3Range)
|
||||
const status4 = this.checkIndividualTRange(4, this.t4Range)
|
||||
if (status1 && status2 && status3 && status4) {
|
||||
this.resetAllTRangeErrorMsg({ totalT: 4 })
|
||||
this.updateTimeRange()
|
||||
if (this.checkMultipleTRange()) {
|
||||
const status1 = this.checkIndividualTRange(1, this.t1Range)
|
||||
const status2 = this.checkIndividualTRange(2, this.t2Range)
|
||||
const status3 = this.checkIndividualTRange(3, this.t3Range)
|
||||
const status4 = this.checkIndividualTRange(4, this.t4Range)
|
||||
if (status1 && status2 && status3 && status4) {
|
||||
this.resetAllTRangeErrorMsg({ totalT: 4 })
|
||||
this.updateTimeRange()
|
||||
}
|
||||
}
|
||||
this.updateStiTRangeCheckParam()
|
||||
this.updateStiParamCheck()
|
||||
},
|
||||
|
||||
updateStiTRangeCheckParam () {
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_parameter/0',
|
||||
device: taskInfo.getRawDeviceID(this.deviceID),
|
||||
parameter: 'sti_trange_set_done',
|
||||
content: this.TRangeStatusCheck,
|
||||
}))
|
||||
updateStiParamCheck () {
|
||||
this.deviceParameterChange(this.deviceID, 'sti_trange_set_done', this.TRangeStatusCheck() && this.repeatIntervalCheck())
|
||||
},
|
||||
autoResetAllTRange () {
|
||||
if (this.patternModeSelect === 0) { // Monophasic
|
||||
@@ -893,7 +1053,7 @@ export default {
|
||||
this.t4Range = (this.periodNumber / 10) - this.t1Range - this.t2Range - this.t3Range
|
||||
this.t4RangeInput = String((this.t4Range * 10) / this.unitMultiply)
|
||||
if (this.t4Range >= 0) {
|
||||
this.pageToast(`T4 = ${(this.t4Range / 100).toFixed(1)} ms`)
|
||||
this.pageToast(`T4 = ${(this.t4Range / 100).toFixed(2)} ms`)
|
||||
} else {
|
||||
this.pageToast('T4 can not be negative. Please check T1~T3 setting.')
|
||||
}
|
||||
@@ -921,8 +1081,8 @@ export default {
|
||||
|
||||
switch (stiIimeSelect) {
|
||||
case 1:
|
||||
if (val < 100 || val > 10230) { // us
|
||||
this.updateTRangeErrorMsg({ stiIimeSelect: stiIimeSelect, status: true, msg: '0.1ms <= T1 <= 10.23ms' })
|
||||
if (val < 10 || val > 655350) { // us
|
||||
this.updateTRangeErrorMsg({ stiIimeSelect: stiIimeSelect, status: true, msg: '0.01ms <= T1 <= 655.35ms' })
|
||||
return false
|
||||
} else if (val > this.periodNumber) {
|
||||
this.updateTRangeErrorMsg({ stiIimeSelect: stiIimeSelect, status: true, msg: 'T1 > PERIOD' })
|
||||
@@ -933,8 +1093,8 @@ export default {
|
||||
}
|
||||
case 2:
|
||||
if (this.patternModeSelect === 1) { // biphasic
|
||||
if (val < 0 || val > 10230) { // us
|
||||
this.updateTRangeErrorMsg({ stiIimeSelect: stiIimeSelect, status: true, msg: '0ms <= T2 <= 10.23ms' })
|
||||
if (val < 0 || val > 655350) { // us
|
||||
this.updateTRangeErrorMsg({ stiIimeSelect: stiIimeSelect, status: true, msg: '0ms <= T2 <= 655.35ms' })
|
||||
return false
|
||||
} else if (val > this.periodNumber) {
|
||||
this.updateTRangeErrorMsg({ stiIimeSelect: stiIimeSelect, status: true, msg: 'T2 > PERIOD' })
|
||||
@@ -949,8 +1109,8 @@ export default {
|
||||
}
|
||||
case 3:
|
||||
if (this.patternModeSelect === 1) { // biphasic
|
||||
if (val < 100 || val > 10230) { // us
|
||||
this.updateTRangeErrorMsg({ stiIimeSelect: stiIimeSelect, status: true, msg: '0.1ms <= T3 <= 10.23ms' })
|
||||
if (val < 0 || val > 655350) { // us
|
||||
this.updateTRangeErrorMsg({ stiIimeSelect: stiIimeSelect, status: true, msg: '0ms <= T3 <= 655.35ms' })
|
||||
return false
|
||||
} else if (val > this.periodNumber) {
|
||||
this.updateTRangeErrorMsg({ stiIimeSelect: stiIimeSelect, status: true, msg: 'T3 > PERIOD' })
|
||||
@@ -964,8 +1124,8 @@ export default {
|
||||
return true
|
||||
}
|
||||
case 4:
|
||||
if (val < 0 || val > 1310710) { // us
|
||||
this.updateTRangeErrorMsg({ stiIimeSelect: stiIimeSelect, status: true, msg: '0ms <= T4 <= 1310.71ms' })
|
||||
if (val < 0 || val > 655350) { // us
|
||||
this.updateTRangeErrorMsg({ stiIimeSelect: stiIimeSelect, status: true, msg: '0ms <= T4 <= 655.35ms' })
|
||||
return false
|
||||
} else {
|
||||
this.updateTRangeErrorMsg({ stiIimeSelect: stiIimeSelect, status: false, msg: '' })
|
||||
@@ -973,6 +1133,22 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
checkMultipleTRange () {
|
||||
// val unit: us
|
||||
const val = (this.t1Range + this.t2Range + this.t3Range + this.t4Range) * 10 // UI us
|
||||
|
||||
if (val < 80) { // us
|
||||
for (const tRange of [1, 2, 3, 4]) {
|
||||
this.updateTRangeErrorMsg({ stiIimeSelect: tRange, status: true, msg: 'Period < 0.08ms' })
|
||||
}
|
||||
return false
|
||||
} else {
|
||||
for (const tRange of [1, 2, 3, 4]) {
|
||||
this.updateTRangeErrorMsg({ stiIimeSelect: tRange, status: false, msg: '' })
|
||||
}
|
||||
return true
|
||||
}
|
||||
},
|
||||
// [EndSubRegion]
|
||||
// [EndRegion]
|
||||
|
||||
@@ -981,7 +1157,7 @@ export default {
|
||||
let stiChannelSet = ''
|
||||
let stiPolaritySet = ''
|
||||
|
||||
for (let i = 16; i >= 1; i--) {
|
||||
for (let i = 32; i >= 17; i--) {
|
||||
if (this.posChannelList.indexOf(i) >= 0) {
|
||||
stiChannelSet += '1'
|
||||
stiPolaritySet += '1'
|
||||
@@ -1097,4 +1273,10 @@ export default {
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.circle-button {
|
||||
height: 25px;
|
||||
width: 25px;
|
||||
border-radius: '50%';
|
||||
}
|
||||
</style>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,139 @@
|
||||
<template>
|
||||
<div>
|
||||
<p class="display-6">
|
||||
Frequency: {{ frequencyNumberInput }} Hz
|
||||
</p>
|
||||
<p class="display-6">
|
||||
Period: {{ periodNumberInput + unit }}
|
||||
</p>
|
||||
<p class="display-6">
|
||||
T1: {{ t1RangeInput + unit }}
|
||||
</p>
|
||||
<p class="display-6">
|
||||
T2: {{ t2RangeInput + unit }}
|
||||
</p>
|
||||
<p class="display-6">
|
||||
T3: {{ t3RangeInput + unit }}
|
||||
</p>
|
||||
<p class="display-6">
|
||||
T4: {{ t4RangeInput + unit }}
|
||||
</p>
|
||||
<p class="display-6">
|
||||
Cycle: {{ cycleNumberInput }}
|
||||
</p>
|
||||
<p class="display-6">
|
||||
Repeat: {{ repeatNumberInput }}
|
||||
</p>
|
||||
<p class="display-6" v-if="cycleNumberSelect === 0">
|
||||
Ts: {{ periodNumberInput * cycleNumberInput + unit }}
|
||||
</p>
|
||||
<p class="display-6" v-if="cycleNumberSelect === 1">
|
||||
Ts: ∞
|
||||
</p>
|
||||
<p class="display-6">
|
||||
Tr: {{ repeatIntervalInput + unit }}
|
||||
</p>
|
||||
<p class="display-6" v-if="cycleNumberSelect === 0">
|
||||
Ti: {{ String(parseFloat(periodNumberInput * cycleNumberInput) + parseFloat(repeatIntervalInput)) + unit }}
|
||||
</p>
|
||||
<p class="display-6" v-if="cycleNumberSelect === 1">
|
||||
Ti: ∞
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { taskInfo } from '../../../../data/task/TaskInfo'
|
||||
|
||||
export default {
|
||||
name: 'NeuliveParameterStimulationSketchmapParam',
|
||||
components: {
|
||||
},
|
||||
props: {
|
||||
deviceID: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
unitMultiply: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
unit: 'ms',
|
||||
cycleNumberSelect: null,
|
||||
cycleNumberInput: '1',
|
||||
repeatNumberInput: '1',
|
||||
repeatInterval: 65535, // ms
|
||||
repeatIntervalInput: '65.54', // s
|
||||
// cycleNumberArray: Array(9).fill(1),
|
||||
amplitudeNumberInput: {
|
||||
PHASE1: '50',
|
||||
PHASE2: '50',
|
||||
},
|
||||
amplitudeNumber: {
|
||||
PHASE1: 50,
|
||||
PHASE2: 50,
|
||||
},
|
||||
frequencyNumberInput: '0',
|
||||
frequencyNumber: 0,
|
||||
periodNumberInput: '0',
|
||||
periodNumber: 0,
|
||||
t1RangeInput: '0',
|
||||
t1Range: 0,
|
||||
t2RangeInput: '0',
|
||||
t2Range: 0,
|
||||
t3RangeInput: '0',
|
||||
t3Range: 0,
|
||||
t4RangeInput: '0',
|
||||
t4Range: 0,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getUnit () {
|
||||
if (this.unitMultiply === 1e6) {
|
||||
return 's'
|
||||
} else if (this.unitMultiply === 1e3) {
|
||||
return 'ms'
|
||||
} else {
|
||||
return 'us'
|
||||
}
|
||||
},
|
||||
refresh () {
|
||||
this.unit = this.getUnit()
|
||||
this.cycleNumberSelect = taskInfo.getDeviceInfo(this.deviceID).parameterSet.CONTINUOUS_STI ? 1 : 0
|
||||
this.cycleNumberInput = this.cycleNumberSelect === 1 ? '∞' : String(taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_CYCLE_CH0 + 1)
|
||||
this.repeatNumberInput = String(taskInfo.getDeviceInfo(this.deviceID).parameterSet.REPEAT_TIME_littleEndian)
|
||||
this.repeatInterval = (taskInfo.getDeviceInfo(this.deviceID).parameterSet.REPEAT_INTERVAL_littleEndian) // unit: ms
|
||||
this.repeatIntervalInput = String(this.repeatInterval * 1e3 / this.unitMultiply)
|
||||
this.amplitudeNumber.PHASE1 = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_AMPLITUDE_L1 * 5
|
||||
this.amplitudeNumberInput.PHASE1 = String(this.amplitudeNumber.PHASE1)
|
||||
this.amplitudeNumber.PHASE2 = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_AMPLITUDE_H3 * 5
|
||||
this.amplitudeNumberInput.PHASE2 = String(this.amplitudeNumber.PHASE2)
|
||||
|
||||
this.t1Range = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_T1_CH0
|
||||
this.t1RangeInput = String((this.t1Range * 10) / this.unitMultiply)
|
||||
this.t2Range = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_T2_CH0
|
||||
this.t2RangeInput = String((this.t2Range * 10) / this.unitMultiply)
|
||||
this.t3Range = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_T3_CH0
|
||||
this.t3RangeInput = String((this.t3Range * 10) / this.unitMultiply)
|
||||
this.t4Range = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_T4_CH0
|
||||
this.t4RangeInput = String((this.t4Range * 10) / this.unitMultiply)
|
||||
|
||||
this.periodNumber = (this.t1Range + this.t2Range + this.t3Range + this.t4Range) * 10
|
||||
this.periodNumberInput = String(this.periodNumber / this.unitMultiply)
|
||||
|
||||
if (this.periodNumber !== 0) {
|
||||
this.frequencyNumber = (1e6 / this.periodNumber).toFixed(2)
|
||||
this.frequencyNumberInput = String(this.frequencyNumber)
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
this.refresh()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -3,15 +3,15 @@
|
||||
|
||||
<va-tree-root>
|
||||
<va-tree-category
|
||||
v-if="device != null"
|
||||
isOpen
|
||||
style="font-size: 20px;"
|
||||
:label="'RECORDING'"
|
||||
>
|
||||
<va-tree-node>
|
||||
<neulive-parameter-recording
|
||||
v-if="
|
||||
(device)
|
||||
? (device.info.library_name.indexOf('3.0') !== -1 || device.info.library_name.indexOf('3.1') !== -1)
|
||||
: false
|
||||
(device.info.library_name == 'Neulive3.0' || device.info.library_name == 'Neulive3.1')
|
||||
"
|
||||
:ref="'rec_ref'" :deviceID="deviceID"
|
||||
@record="start()"
|
||||
@@ -19,9 +19,16 @@
|
||||
/>
|
||||
<neulive-parameter-recording35
|
||||
v-if="
|
||||
(device)
|
||||
? (device.info.library_name.indexOf('3.5') !== -1)
|
||||
: false
|
||||
(device.info.library_name == 'Neulive3.5')
|
||||
"
|
||||
:ref="'rec_ref'"
|
||||
:deviceID="deviceID"
|
||||
@record="start()"
|
||||
@record_stop="stop()"
|
||||
/>
|
||||
<neulive-parameter-recording35-ex
|
||||
v-if="
|
||||
(device.info.library_name == 'Neulive3.5ex')
|
||||
"
|
||||
:ref="'rec_ref'"
|
||||
:deviceID="deviceID"
|
||||
@@ -31,24 +38,28 @@
|
||||
</va-tree-node>
|
||||
</va-tree-category>
|
||||
<va-tree-category
|
||||
v-if="device != null"
|
||||
style="font-size: 20px;"
|
||||
:label="'STIMULATION'"
|
||||
>
|
||||
<va-tree-node>
|
||||
<neulive-parameter-stimulation
|
||||
v-if="
|
||||
(device)
|
||||
? (device.info.library_name.indexOf('3.0') !== -1 || device.info.library_name.indexOf('3.1') !== -1)
|
||||
: false
|
||||
(device.info.library_name == 'Neulive3.0' || device.info.library_name == 'Neulive3.1')
|
||||
"
|
||||
:ref="'sti_ref'"
|
||||
:deviceID="deviceID"
|
||||
/>
|
||||
<neulive-parameter-stimulation35
|
||||
v-if="
|
||||
(device)
|
||||
? (device.info.library_name.indexOf('3.5') !== -1)
|
||||
: false
|
||||
(device.info.library_name == 'Neulive3.5')
|
||||
"
|
||||
:ref="'sti_ref'"
|
||||
:deviceID="deviceID"
|
||||
/>
|
||||
<neulive-parameter-stimulation35-ex
|
||||
v-if="
|
||||
(device.info.library_name == 'Neulive3.5ex')
|
||||
"
|
||||
:ref="'sti_ref'"
|
||||
:deviceID="deviceID"
|
||||
@@ -76,6 +87,8 @@ import NeuliveParameterRecording from './NeuliveParameterRecording'
|
||||
import NeuliveParameterStimulation from './NeuliveParameterStimulation'
|
||||
import NeuliveParameterRecording35 from './NeuliveParameterRecording35'
|
||||
import NeuliveParameterStimulation35 from './NeuliveParameterStimulation35'
|
||||
import NeuliveParameterRecording35Ex from './NeuliveParameterRecording35Ex'
|
||||
import NeuliveParameterStimulation35Ex from './NeuliveParameterStimulation35Ex'
|
||||
import NeuliveParameterSetting from './NeuliveParameterSetting'
|
||||
|
||||
export default {
|
||||
@@ -85,6 +98,8 @@ export default {
|
||||
NeuliveParameterStimulation,
|
||||
NeuliveParameterRecording35,
|
||||
NeuliveParameterStimulation35,
|
||||
NeuliveParameterRecording35Ex,
|
||||
NeuliveParameterStimulation35Ex,
|
||||
NeuliveParameterSetting,
|
||||
},
|
||||
props: {
|
||||
@@ -140,7 +155,7 @@ export default {
|
||||
mounted () {
|
||||
this.pageInit()
|
||||
this.device = taskInfo.getDeviceInfo(this.deviceID)
|
||||
console.log(taskInfo.getDeviceInfo(this.deviceID).info)
|
||||
// console.log(taskInfo.getDeviceInfo(this.deviceID).info)
|
||||
},
|
||||
watch: {
|
||||
deviceID: function (val) {
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
<template>
|
||||
<div class="row flex sm12 xl12 md12 xs12 mb-2 pb-1 align--center">
|
||||
<div class="flex sm4 xl4 md4 xs4 px-0 mx-0 my-0 py-0">
|
||||
<p class="display-6"> CHANNEL {{ channel }} <p/>
|
||||
</div>
|
||||
<div class="flex sm3 xl3 md3 xs3 px-0 mx-0 my-0 py-0">
|
||||
<va-input
|
||||
@mouseleave.native="itemChange(currentNumberInput)"
|
||||
@keyup.enter="itemChange(currentNumberInput)"
|
||||
@blur="itemChange(currentNumberInput)"
|
||||
v-model="currentNumberInput"
|
||||
:disabled="!channelToggle"
|
||||
class="mb-0 small-va-input"
|
||||
>
|
||||
<p slot="append" style="margin-right: 0;" small>
|
||||
mA
|
||||
</p>
|
||||
</va-input>
|
||||
</div>
|
||||
<div class="flex sm5 xl5 md5 xs5 px-0 mx-0 my-0 py-0">
|
||||
<va-toggle v-model="channelToggle" color="success" style="float: right;" small @click.native="switchToggle()"/>
|
||||
</div>
|
||||
<div class="flex sm12 xl12 md12 xs12 my-1 py-1" :key="inputeKey">
|
||||
<va-slider
|
||||
@mouseleave.native="itemChange(currentNumber)"
|
||||
@touchend.native="itemChange(currentNumber)"
|
||||
pins
|
||||
:min="0"
|
||||
:max="200"
|
||||
value-visible
|
||||
:step="10"
|
||||
:color="channelToggle === true ? 'primary' : 'gray'"
|
||||
:disabled="!channelToggle"
|
||||
v-model="currentNumber"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { taskInfo } from '@/data/task/TaskInfo'
|
||||
|
||||
export default {
|
||||
name: 'ChannelBlock',
|
||||
components: {
|
||||
},
|
||||
props: {
|
||||
deviceID: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
channel: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
parameterName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
created () {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
inputeKey: 0,
|
||||
channelToggle: taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.channel - 1)] === 1,
|
||||
currentNumberInput: '0',
|
||||
currentNumber: 0,
|
||||
}
|
||||
},
|
||||
mqtt: {
|
||||
},
|
||||
methods: {
|
||||
mqttPub: function (topic, mes) {
|
||||
this.$mqtt.publish(topic, mes)
|
||||
},
|
||||
itemChange (val) {
|
||||
this.currentNumberInput = parseFloat(parseFloat(val).toFixed(1))
|
||||
this.currentNumber = this.currentNumberInput
|
||||
if (this.currentNumber !== parseFloat(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.channel - 1) + '_current']) / 250) {
|
||||
this.$emit('parameterChange', [this.parameterName + String(this.channel - 1) + '_current', String(this.currentNumberInput * 250)])
|
||||
}
|
||||
this.inputeKey++
|
||||
},
|
||||
switchToggle () {
|
||||
if (this.channelToggle !== (taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.channel - 1)] === 1)) {
|
||||
this.$emit('parameterChange', [this.parameterName + String(this.channel - 1), this.channelToggle])
|
||||
}
|
||||
this.inputeKey++
|
||||
},
|
||||
refresh () {
|
||||
this.channelToggle = taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.channel - 1)] === 1
|
||||
this.currentNumber = parseFloat(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.channel - 1) + '_current']) / 250
|
||||
this.currentNumberInput = this.currentNumber
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
this.refresh()
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
destroyed () {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.small-va-input {
|
||||
.va-input {
|
||||
&__container {
|
||||
min-height: 1rem;
|
||||
}
|
||||
|
||||
&__container__input {
|
||||
margin-bottom: 0.001rem;
|
||||
padding: 0.8rem 0.5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
<template>
|
||||
<div>
|
||||
<div v-for="channel in channelList" :key="channel">
|
||||
<channel-block :ref="'ChannelBlock'" :deviceID="deviceID" :channel="channel" :parameterName="'ACC_a_out'" @parameterChange="deviceParameterChange($event)"/>
|
||||
</div>
|
||||
|
||||
<div class="row px-0 mx-0">
|
||||
<p class="display-6"> ADVANCED SETTING </p>
|
||||
<va-toggle flat small color="success" v-model="openAdvanced"/>
|
||||
</div>
|
||||
<div v-if="openAdvanced">
|
||||
<div v-for="triggerIndex in triggerList" :key="'trigger_' + triggerIndex">
|
||||
<trigger-block :ref="'TriggerBlock'" :deviceID="deviceID" :triggerIndex="triggerIndex" @parameterChange="deviceParameterChange($event)"/>
|
||||
</div>
|
||||
<!-- <div v-for="timerIndex in timerList" :key="'timer_' + timerIndex">
|
||||
<timer-block :ref="'TimerBlock'" :deviceID="deviceID" :timerIndex="timerIndex" :channelList="channelList" @parameterChange="deviceParameterChange($event)"/>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { taskInfo } from '@/data/task/TaskInfo'
|
||||
import ChannelBlock from './ChannelBlock'
|
||||
import TriggerBlock from './TriggerBlock'
|
||||
// import TimerBlock from './TimerBlock'
|
||||
|
||||
export default {
|
||||
name: 'EliteParameterRecordingEliteACC',
|
||||
components: {
|
||||
ChannelBlock,
|
||||
TriggerBlock,
|
||||
// TimerBlock,
|
||||
},
|
||||
props: {
|
||||
deviceID: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
deviceName: {
|
||||
type: String,
|
||||
default: 'Elite',
|
||||
},
|
||||
},
|
||||
created () {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
channelList: [1, 2, 3, 4],
|
||||
triggerList: [1, 2],
|
||||
timerList: [1, 2],
|
||||
openAdvanced: false,
|
||||
}
|
||||
},
|
||||
mqtt: {
|
||||
},
|
||||
methods: {
|
||||
mqttPub: function (topic, mes) {
|
||||
this.$mqtt.publish(topic, mes)
|
||||
},
|
||||
// Array[String of Parameter Nmae, Value]
|
||||
deviceParameterChange: function (e) {
|
||||
console.log('e[0],e[1]', e[0], ',', e[1])
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_parameter/0',
|
||||
device: taskInfo.getRawDeviceID(this.deviceID),
|
||||
parameter: e[0],
|
||||
content: e[1],
|
||||
}))
|
||||
},
|
||||
refresh () {
|
||||
if (this.$refs.ChannelBlock != null) {
|
||||
for (let i = 0; i < this.$refs.ChannelBlock.length; i++) {
|
||||
this.$refs.ChannelBlock[i].refresh()
|
||||
}
|
||||
}
|
||||
if (this.$refs.TriggerBlock != null) {
|
||||
for (let i = 0; i < this.$refs.TriggerBlock.length; i++) {
|
||||
this.$refs.TriggerBlock[i].refresh()
|
||||
}
|
||||
}
|
||||
// if (this.$refs.TimerBlock != null) {
|
||||
// for (let i = 0; i < this.$refs.TimerBlock.length; i++) {
|
||||
// this.$refs.TimerBlock[i].refresh()
|
||||
// }
|
||||
// }
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
destroyed () {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.long-list {
|
||||
max-height: 300px;
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,88 @@
|
||||
<template>
|
||||
<div class="row flex sm12 xl12 md12 xs12 my-0 py-0 align--center">
|
||||
<div class="flex sm3 xl3 md3 xs3 px-0 mx-0 my-0 py-0">
|
||||
<p class="display-6"> TIMER {{ timerIndex }} <p/>
|
||||
</div>
|
||||
<div class="flex sm7 xl7 md7 xs7 px-0 mx-0 my-0 py-0">
|
||||
<va-select
|
||||
v-model="selectMultipleTimer"
|
||||
textBy="name"
|
||||
:options="timerOptions"
|
||||
:disabled="!timerToggle"
|
||||
multiple
|
||||
/>
|
||||
</div>
|
||||
<div class="flex sm2 xl2 md2 xs2 px-0 mx-0 my-0 py-0">
|
||||
<va-toggle v-model="timerToggle" style="float: right;" small @click.native="switchToggle()"/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
// import { taskInfo } from '@/data/task/TaskInfo'
|
||||
|
||||
export default {
|
||||
name: 'TimerBlock',
|
||||
components: {
|
||||
},
|
||||
props: {
|
||||
deviceID: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
timerIndex: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
parameterName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
channelList: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
created () {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
inputeKey: 0,
|
||||
selectMultipleTimer: [],
|
||||
timerOptions: [],
|
||||
timerToggle: false,
|
||||
}
|
||||
},
|
||||
mqtt: {
|
||||
},
|
||||
methods: {
|
||||
mqttPub: function (topic, mes) {
|
||||
this.$mqtt.publish(topic, mes)
|
||||
},
|
||||
switchToggle () {
|
||||
// const serverStatus = taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.channel - 1)] ? true : false
|
||||
// if (this.channelToggle !== serverStatus) {
|
||||
// this.$emit('parameterChange', [this.parameterName + String(this.channel - 1), this.channelToggle])
|
||||
// }
|
||||
// this.inputeKey++
|
||||
},
|
||||
refresh () {
|
||||
// this.selectMultipleTimer
|
||||
this.timerToggle = false
|
||||
// this.timerToggle = taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.channel - 1) + '_current']
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
this.timerOptions = []
|
||||
this.channelList.forEach(channel => {
|
||||
this.timerOptions.push({ id: channel, name: 'CH' + channel })
|
||||
})
|
||||
this.refresh()
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
destroyed () {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,87 @@
|
||||
<template>
|
||||
<div class="row flex sm12 xl12 md12 xs12 my-0 py-0">
|
||||
<div class="flex sm3 xl3 md3 xs3 pl-0 mr-0 my-0 py-0">
|
||||
<p class="display-6"> TRIGGER {{ triggerIndex }} <p/>
|
||||
</div>
|
||||
<div class="flex sm9 xl9 md9 xs9 px-0 mx-0 my-0 py-0" :key="inputeKey">
|
||||
<va-radio-button
|
||||
v-for="(option, index) in optionTrigger"
|
||||
:key="index"
|
||||
style="float: left;"
|
||||
v-model="selectTrigger"
|
||||
:option="optionTrigger[index]"
|
||||
:label="optionTrigger[index]"
|
||||
:disabled="!triggerToggle"
|
||||
@click.native.stop="itemChange(index)"
|
||||
/>
|
||||
<va-toggle v-model="triggerToggle" color="success" small @click.native="switchToggle()"/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { taskInfo } from '@/data/task/TaskInfo'
|
||||
|
||||
export default {
|
||||
name: 'TriggerBlock',
|
||||
components: {
|
||||
},
|
||||
props: {
|
||||
deviceID: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
triggerIndex: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
created () {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
inputeKey: 0,
|
||||
selectTrigger: 'RISING',
|
||||
optionTrigger: [
|
||||
'RISING',
|
||||
'FALLING',
|
||||
'BOTH',
|
||||
],
|
||||
triggerToggle: false,
|
||||
}
|
||||
},
|
||||
mqtt: {
|
||||
},
|
||||
methods: {
|
||||
mqttPub: function (topic, mes) {
|
||||
this.$mqtt.publish(topic, mes)
|
||||
},
|
||||
itemChange (val) {
|
||||
const paramName = `TRIG${this.triggerIndex - 1}_edge_type`
|
||||
if (val !== taskInfo.getDeviceInfo(this.deviceID).parameterSet[paramName]) {
|
||||
this.$emit('parameterChange', [paramName, val])
|
||||
}
|
||||
this.inputeKey++
|
||||
},
|
||||
switchToggle () {
|
||||
const paramName = `TRIG${this.triggerIndex - 1}_en`
|
||||
if (this.triggerToggle !== (taskInfo.getDeviceInfo(this.deviceID).parameterSet[paramName] === 1)) {
|
||||
this.$emit('parameterChange', [paramName, this.triggerToggle])
|
||||
}
|
||||
this.inputeKey++
|
||||
},
|
||||
refresh () {
|
||||
this.selectTrigger = this.optionTrigger[taskInfo.getDeviceInfo(this.deviceID).parameterSet[`TRIG${this.triggerIndex - 1}_edge_type`]]
|
||||
this.triggerToggle = (taskInfo.getDeviceInfo(this.deviceID).parameterSet[`TRIG${this.triggerIndex - 1}_en`] === 1)
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
this.refresh()
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
destroyed () {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -1,14 +1,16 @@
|
||||
<template>
|
||||
<div>
|
||||
<e-initial :ref="'EInitial'" :deviceID="deviceID" :parameterName="'E_initial'" @parameterChange="deviceParameterChange($event)" />
|
||||
<e-1 :ref="'E1'" :deviceID="deviceID" :parameterName="'E1'" @parameterChange="deviceParameterChange($event)" />
|
||||
<e-2 :ref="'E2'" :deviceID="deviceID" :parameterName="'E1'" @parameterChange="deviceParameterChange($event)" />
|
||||
<e-final :ref="'EFinal'" :deviceID="deviceID" :parameterName="'E_final'" @parameterChange="deviceParameterChange($event)" />
|
||||
<pulse-amp :ref="'PulseAmp'" :deviceID="deviceID" :parameterName="'Pulse_Amp'" @parameterChange="deviceParameterChange($event)" />
|
||||
<pulse-width :ref="'PulseWidth'" :deviceID="deviceID" :parameterName="'Pulse_Width'" @parameterChange="deviceParameterChange($event)" />
|
||||
<increment :ref="'Increment'" :deviceID="deviceID" :parameterName="'Increment'" @parameterChange="deviceParameterChange($event)" />
|
||||
<step-time :ref="'StepTime'" :deviceID="deviceID" :parameterName="'Step_time'" @parameterChange="deviceParameterChange($event)" />
|
||||
<current-recording-period :ref="'CURR_REC'" :deviceID="deviceID" :parameterName="'CURR_REC_'" @parameterChange="deviceParameterChange($event)" />
|
||||
<e-initial :ref="'EInitial'" class="my-2" :deviceID="deviceID" :parameterName="'DPV_e_init'" @parameterChange="deviceParameterChange($event)" />
|
||||
<e-1 :ref="'E1'" class="my-2" :deviceID="deviceID" :parameterName="'DPV_e_1'" :disabled="false" @parameterChange="deviceParameterChange($event)" />
|
||||
<e-2 :ref="'E2'" class="my-2" :deviceID="deviceID" :parameterName="'DPV_e_2'" :disabled="false" @parameterChange="deviceParameterChange($event)" />
|
||||
<e-final :ref="'EFinal'" class="my-2" :deviceID="deviceID" :parameterName="'DPV_e_final'" @parameterChange="deviceParameterChange($event)" />
|
||||
<increment :ref="'Increment'" class="my-2" :deviceID="deviceID" :parameterName="'DPV_increment'" @parameterChange="deviceParameterChange($event)" />
|
||||
<pulse-amp :ref="'PulseAmp'" class="my-2" :deviceID="deviceID" :parameterName="'DPV_amp'" @parameterChange="deviceParameterChange($event)" />
|
||||
<pulse-width :ref="'PulseWidth'" class="my-2" :deviceID="deviceID" :parameterName="'DPV_pul_width'" @parameterChange="deviceParameterChange($event)" />
|
||||
<period :ref="'Period'" class="my-2" :deviceID="deviceID" :parameterName="'DPV_step_time'" @parameterChange="deviceParameterChange($event)" />
|
||||
<cycle :ref="'Cycle'" class="my-2" :deviceID="deviceID" :parameterName="'CYCLE_NUMBER'" @parameterChange="deviceParameterChange($event)" />
|
||||
<pulse-option :ref="'PulseOption'" class="my-2" :deviceID="deviceID" :parameterName="'DPV_pulse_option'" :disabled="false" @parameterChange="deviceParameterChange($event)" />
|
||||
<current-recording-period :ref="'CURR_REC'" :deviceID="deviceID" :parameterName="'DPV_curr_rec_'" @parameterChange="deviceParameterChange($event)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -22,11 +24,13 @@ import EFinal from './EFinal'
|
||||
import PulseAmp from './PulseAmp'
|
||||
import PulseWidth from './PulseWidth'
|
||||
import Increment from './Increment'
|
||||
import StepTime from './StepTime'
|
||||
import Period from './Period'
|
||||
import PulseOption from './PulseOption'
|
||||
import Cycle from './Cycle'
|
||||
import CurrentRecordingPeriod from './CurrentRecordingPeriod'
|
||||
|
||||
export default {
|
||||
name: 'SegmentBlock',
|
||||
name: 'AdvancedBlock',
|
||||
components: {
|
||||
EInitial,
|
||||
E1,
|
||||
@@ -35,7 +39,9 @@ export default {
|
||||
PulseAmp,
|
||||
PulseWidth,
|
||||
Increment,
|
||||
StepTime,
|
||||
Period,
|
||||
PulseOption,
|
||||
Cycle,
|
||||
CurrentRecordingPeriod,
|
||||
},
|
||||
props: {
|
||||
@@ -70,6 +76,12 @@ export default {
|
||||
if (this.$refs.EInitial != null) {
|
||||
this.$refs.EInitial.refresh()
|
||||
}
|
||||
if (this.$refs.DPV_e_1 != null) {
|
||||
this.$refs.DPV_e_1.refresh()
|
||||
}
|
||||
if (this.$refs.DPV_e_2 != null) {
|
||||
this.$refs.DPV_e_2.refresh()
|
||||
}
|
||||
if (this.$refs.EFinal != null) {
|
||||
this.$refs.EFinal.refresh()
|
||||
}
|
||||
@@ -82,8 +94,17 @@ export default {
|
||||
if (this.$refs.Increment != null) {
|
||||
this.$refs.Increment.refresh()
|
||||
}
|
||||
if (this.$refs.StepTime != null) {
|
||||
this.$refs.StepTime.refresh()
|
||||
if (this.$refs.Period != null) {
|
||||
this.$refs.Period.refresh()
|
||||
}
|
||||
if (this.$refs.PulseOption != null) {
|
||||
this.$refs.PulseOption.refresh()
|
||||
}
|
||||
if (this.$refs.Cycle != null) {
|
||||
this.$refs.Cycle.refresh()
|
||||
}
|
||||
if (this.$refs.CURR_REC != null) {
|
||||
this.$refs.CURR_REC.refresh()
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<div>
|
||||
<e-initial :ref="'EInitial'" :deviceID="deviceID" :parameterName="'E_initial'" @parameterChange="deviceParameterChange($event)" />
|
||||
<e-final :ref="'EFinal'" :deviceID="deviceID" :parameterName="'E_final'" @parameterChange="deviceParameterChange($event)" />
|
||||
<pulse-amp :ref="'PulseAmp'" :deviceID="deviceID" :parameterName="'Pulse_Amp'" @parameterChange="deviceParameterChange($event)" />
|
||||
<pulse-width :ref="'PulseWidth'" :deviceID="deviceID" :parameterName="'Pulse_Width'" @parameterChange="deviceParameterChange($event)" />
|
||||
<increment :ref="'Increment'" :deviceID="deviceID" :parameterName="'Increment'" @parameterChange="deviceParameterChange($event)" />
|
||||
<step-time :ref="'StepTime'" :deviceID="deviceID" :parameterName="'Step_time'" @parameterChange="deviceParameterChange($event)" />
|
||||
<e-initial :ref="'EInitial'" class="my-2" :deviceID="deviceID" :parameterName="'DPV_e_init'" @parameterChange="deviceParameterChange($event)" />
|
||||
<e-final :ref="'EFinal'" class="my-2" :deviceID="deviceID" :parameterName="'DPV_e_final'" @parameterChange="deviceParameterChange($event)" />
|
||||
<increment :ref="'Increment'" class="my-2" :deviceID="deviceID" :parameterName="'DPV_increment'" @parameterChange="deviceParameterChange($event)" />
|
||||
<pulse-amp :ref="'PulseAmp'" class="my-2" :deviceID="deviceID" :parameterName="'DPV_amp'" @parameterChange="deviceParameterChange($event)" />
|
||||
<pulse-width :ref="'PulseWidth'" class="my-2" :deviceID="deviceID" :parameterName="'DPV_pul_width'" @parameterChange="deviceParameterChange($event)" />
|
||||
<period :ref="'Period'" class="my-2" :deviceID="deviceID" :parameterName="'DPV_step_time'" @parameterChange="deviceParameterChange($event)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -17,17 +17,17 @@ import EFinal from './EFinal'
|
||||
import PulseAmp from './PulseAmp'
|
||||
import PulseWidth from './PulseWidth'
|
||||
import Increment from './Increment'
|
||||
import StepTime from './StepTime'
|
||||
import Period from './Period'
|
||||
|
||||
export default {
|
||||
name: 'SegmentBlock',
|
||||
name: 'AutoBlock',
|
||||
components: {
|
||||
EInitial,
|
||||
EFinal,
|
||||
PulseAmp,
|
||||
PulseWidth,
|
||||
Increment,
|
||||
StepTime,
|
||||
Period,
|
||||
},
|
||||
props: {
|
||||
deviceID: {
|
||||
@@ -73,12 +73,15 @@ export default {
|
||||
if (this.$refs.Increment != null) {
|
||||
this.$refs.Increment.refresh()
|
||||
}
|
||||
if (this.$refs.StepTime != null) {
|
||||
this.$refs.StepTime.refresh()
|
||||
if (this.$refs.Period != null) {
|
||||
this.$refs.Period.refresh()
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
// switch to auto mode, set slider min = 50 & max = 100
|
||||
this.deviceParameterChange(['DPV_curr_rec_min', 50])
|
||||
this.deviceParameterChange(['DPV_curr_rec_max', 100])
|
||||
this.refresh()
|
||||
},
|
||||
watch: {
|
||||
|
||||
@@ -1,35 +1,36 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="row flex sm12 xl12 md12 xs12 align--center">
|
||||
<div class="flex sm9 xl9 md9 xs9 px-0 mx-0">
|
||||
<p class="display-6">Current Recording Period<p/>
|
||||
</div>
|
||||
<div class="flex sm3 xl3 md3 xs3 px-0 mx-0">
|
||||
<p small> {{ itemInput }} ~ 100% </p>
|
||||
<!-- <va-input
|
||||
@mouseleave.native="itemChange(itemInput)"
|
||||
@keyup.enter="itemChange(itemInput)"
|
||||
@blur="itemChange(itemInput)"
|
||||
v-model="itemInput"
|
||||
class="mb-0"
|
||||
>
|
||||
<p slot="append" style="margin-right: 0;" small>
|
||||
%
|
||||
</p>
|
||||
</va-input> -->
|
||||
</div>
|
||||
<div class="row flex">
|
||||
<div class="flex sm12 xl12 md12 xs12 px-0 mx-0 my-0 py-1">
|
||||
<p class="display-6">Current Recording -<p/>
|
||||
</div>
|
||||
<div class="flex sm12 xl12 md12 xs12" :key="inputeKey">
|
||||
<div class="flex sm6 xl6 md6 xs6 px-0 mx-0 mt-2 py-3">
|
||||
<p class="display-6">Pre- / Post-Pulse Width<p/>
|
||||
</div>
|
||||
<div class="flex sm2 xl2 md2 xs2 px-0 mx-0 mt-2 py-3" :key="inputeKey">
|
||||
<va-input
|
||||
@mouseleave.native="inputItemMinChange(itemInputMin)"
|
||||
@keyup.enter="inputItemMinChange(itemInputMin)"
|
||||
@blur="inputItemMinChange(itemInputMin)"
|
||||
v-model="itemInputMin"
|
||||
class="mb-0"
|
||||
>
|
||||
<p slot="append" style="margin-right: 0;" small>
|
||||
%
|
||||
</p>
|
||||
</va-input>
|
||||
</div>
|
||||
<div class="flex sm12 xl12 md12 xs12 py-0 my-0" :key="inputeKey+1">
|
||||
<va-slider
|
||||
@mouseup.native="itemChange(itemInput)"
|
||||
@mouseleave.native="itemChange(itemInput)"
|
||||
@touchend.native="itemChange(itemInput)"
|
||||
@mouseup.native="itemChange(currentRange)"
|
||||
@mouseleave.native="itemChange(currentRange)"
|
||||
@touchend.native="itemChange(currentRange)"
|
||||
range
|
||||
pins
|
||||
:min="0"
|
||||
:max="90"
|
||||
:max="100"
|
||||
value-visible
|
||||
:step="10"
|
||||
v-model="itemInput"
|
||||
:step="25"
|
||||
v-model="currentRange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -57,41 +58,51 @@ export default {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
disableSlider: false,
|
||||
inputeKey: 0,
|
||||
itemInput: Math.round(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName]),
|
||||
// duration: Math.round(taskInfo.getDeviceInfo(this.deviceID).parameterSet['t_pulse_' + String(this.segmentID)]) / 10,
|
||||
currentRange: [],
|
||||
itemInputMin: parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + 'min']),
|
||||
itemInputMax: parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + 'max']),
|
||||
}
|
||||
},
|
||||
mqtt: {
|
||||
},
|
||||
methods: {
|
||||
itemChange (val) {
|
||||
this.itemInput = val
|
||||
this.$emit('parameterChange', [this.parameterName, val])
|
||||
},
|
||||
checkSliderRange (duration) {
|
||||
if (duration <= 10) {
|
||||
this.disableSlider = true
|
||||
inputItemMinChange (val) {
|
||||
val = parseInt(val)
|
||||
const remainder = val % 25
|
||||
if (remainder > 13) {
|
||||
val += (25 - remainder)
|
||||
} else {
|
||||
this.disableSlider = false
|
||||
const percent = parseFloat((5 / duration) * 100)
|
||||
if (percent > 5) {
|
||||
this.itemChange([this.itemInputMin, this.itemInputMax])
|
||||
} else if (percent >= 1.1 && percent <= 5) {
|
||||
this.itemChange([this.itemInputMin, this.itemInputMax])
|
||||
} else if (percent < 1.1) {
|
||||
this.itemChange([this.itemInputMin, this.itemInputMax])
|
||||
}
|
||||
val -= remainder
|
||||
}
|
||||
if (val < 0 || isNaN(val)) {
|
||||
val = 0
|
||||
} else if (val > 75) {
|
||||
val = 75
|
||||
}
|
||||
this.itemInputMin = val
|
||||
if (val !== parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + 'min'])) {
|
||||
this.$emit('parameterChange', [this.parameterName + 'min', this.itemInputMin])
|
||||
}
|
||||
this.currentRange = [this.itemInputMin, this.itemInputMax]
|
||||
},
|
||||
itemChange (val) {
|
||||
this.itemInputMax = 100 // [2021/10/28] max val is fixed to 100 now
|
||||
if (val[0] < this.itemInputMax) { // [2021/10/28] min can't equal 100 now
|
||||
this.itemInputMin = val[0]
|
||||
}
|
||||
if (parseInt(this.itemInputMin) !== parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + 'min'])) {
|
||||
this.$emit('parameterChange', [this.parameterName + 'min', this.itemInputMin])
|
||||
}
|
||||
this.currentRange = [this.itemInputMin, this.itemInputMax]
|
||||
},
|
||||
refresh () {
|
||||
// this.itemInput
|
||||
// this.duration = Math.round(taskInfo.getDeviceInfo(this.deviceID).parameterSet['t_pulse_' + String(this.segmentID)]) / 10
|
||||
this.itemInputMin = parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + 'min'])
|
||||
this.itemInputMax = parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + 'max'])
|
||||
},
|
||||
},
|
||||
async mounted () {
|
||||
// this.checkSliderRange(this.duration)
|
||||
this.currentRange = [this.itemInputMin, this.itemInputMax]
|
||||
},
|
||||
destroyed () {
|
||||
},
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
<template>
|
||||
<div class="row flex px-0 mx-0 my-0 py-0">
|
||||
<div class="flex sm4 xl4 md4 xs4 px-0 mx-0 my-0 py-2">
|
||||
<p class="display-6">Cycle Number<p/>
|
||||
</div>
|
||||
<div class="flex sm3 xl3 md3 xs3 px-0 mx-0 my-0 py-0">
|
||||
<va-input
|
||||
@mouseleave.native="itemChange(itemInput)"
|
||||
@keyup.enter="itemChange(itemInput)"
|
||||
@blur="itemChange(itemInput)"
|
||||
:key="inputeKey"
|
||||
v-model="itemInput"
|
||||
class="mb-0"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { taskInfo } from '@/data/task/TaskInfo'
|
||||
|
||||
export default {
|
||||
name: 'Cycle',
|
||||
components: {
|
||||
},
|
||||
props: {
|
||||
deviceID: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
parameterName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
created () {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
inputeKey: 0,
|
||||
itemInput: taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName],
|
||||
minValue: 1,
|
||||
maxValue: 50000,
|
||||
}
|
||||
},
|
||||
mqtt: {
|
||||
},
|
||||
methods: {
|
||||
itemChange (val) {
|
||||
this.inputeKey++
|
||||
this.itemInput = parseInt(val)
|
||||
if (isNaN(val) || parseInt(val) > this.maxValue || parseInt(val) < this.minValue) {
|
||||
this.itemInput = this.minValue
|
||||
}
|
||||
if (this.itemInput !== taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName]) {
|
||||
this.$emit('parameterChange', [this.parameterName, this.itemInput])
|
||||
}
|
||||
},
|
||||
refresh () {
|
||||
this.itemInput = taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName]
|
||||
},
|
||||
},
|
||||
async mounted () {
|
||||
},
|
||||
destroyed () {
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -1,23 +1,33 @@
|
||||
<template>
|
||||
<div class="flex-container">
|
||||
<p class="display-6 flex-child">E 1<p/>
|
||||
<va-input
|
||||
@mouseleave.native="itemChange(itemInput)"
|
||||
@keyup.enter="itemChange(itemInput)"
|
||||
@blur="itemChange(itemInput)"
|
||||
v-model="itemInput"
|
||||
class="mb-0 flex-child1"
|
||||
:error="showError"
|
||||
:error-messages="errorMsg"
|
||||
>
|
||||
</va-input>
|
||||
<va-button
|
||||
@click="unitChange()"
|
||||
v-model="unitSelect"
|
||||
class="px-2 py-0 mr-0 flex-child2"
|
||||
>
|
||||
{{ unitSelect }}
|
||||
</va-button>
|
||||
<div class="row flex px-0 mx-0 my-0 py-0">
|
||||
<div class="flex sm4 xl4 md4 xs4 px-0 mx-0 my-0 py-2">
|
||||
<p :style="disabled !== true ? '' : {color: this.$themes.gray}" class="display-6">E 1<p/>
|
||||
</div>
|
||||
<div class="flex sm3 xl3 md3 xs3 px-0 mx-0 my-0 py-0">
|
||||
<va-input
|
||||
@mouseleave.native="itemChange(itemInput)"
|
||||
@keyup.enter="itemChange(itemInput)"
|
||||
@blur="itemChange(itemInput)"
|
||||
:key="inputeKey"
|
||||
v-model="itemInput"
|
||||
class="mb-0"
|
||||
:error="showError"
|
||||
:error-messages="errorMsg"
|
||||
:disabled="disabled"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex sm5 xl5 md5 xs5 px-0 mx-0 my-0 py-0">
|
||||
<va-button
|
||||
@click="unitChange()"
|
||||
v-model="unitSelect"
|
||||
class="px-3 py-1"
|
||||
style="border-radius: 12px;"
|
||||
:color="disabled !== true ? 'primary' : 'gray'"
|
||||
:disabled="disabled"
|
||||
>
|
||||
{{ unitSelect }}
|
||||
</va-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -38,13 +48,17 @@ export default {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
created () {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
inputeKey: 0,
|
||||
itemInput: String(Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)),
|
||||
itemInput: String(parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)),
|
||||
unitSelect: 'mV',
|
||||
unitClickTime: 0,
|
||||
showError: false,
|
||||
@@ -62,13 +76,14 @@ export default {
|
||||
if (this.unitSelect === 'V') {
|
||||
val = parseFloat(val) * 1000
|
||||
}
|
||||
if (parseInt(val) < -5000 || parseInt(val) > 5000) {
|
||||
val = parseInt(val) // each step: 1mV
|
||||
if (val < -5000 || val > 5000) {
|
||||
this.showError = true
|
||||
this.errorMsg[0] = '-5 ~ 5V'
|
||||
return
|
||||
}
|
||||
if (parseFloat(val) !== Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)) {
|
||||
this.$emit('parameterChange', [this.parameterName + String(this.segmentID), parseFloat(val) * 5 + 25000])
|
||||
if (val !== parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)) {
|
||||
this.$emit('parameterChange', [this.parameterName, val * 5 + 25000])
|
||||
}
|
||||
},
|
||||
unitChange () {
|
||||
@@ -82,7 +97,7 @@ export default {
|
||||
}
|
||||
},
|
||||
refresh () {
|
||||
let volt = Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)
|
||||
let volt = parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)
|
||||
if (this.unitSelect === 'V') {
|
||||
volt /= 1000
|
||||
}
|
||||
@@ -97,25 +112,3 @@ export default {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.flex-container {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.flex-child {
|
||||
flex: 2;
|
||||
}
|
||||
|
||||
.flex-child1 {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.flex-child2 {
|
||||
flex: 0;
|
||||
}
|
||||
|
||||
.flex-child:first-child {
|
||||
margin-right: 1px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,23 +1,33 @@
|
||||
<template>
|
||||
<div class="flex-container">
|
||||
<p class="display-6 flex-child">E 2<p/>
|
||||
<va-input
|
||||
@mouseleave.native="itemChange(itemInput)"
|
||||
@keyup.enter="itemChange(itemInput)"
|
||||
@blur="itemChange(itemInput)"
|
||||
v-model="itemInput"
|
||||
class="mb-0 flex-child1"
|
||||
:error="showError"
|
||||
:error-messages="errorMsg"
|
||||
>
|
||||
</va-input>
|
||||
<va-button
|
||||
@click="unitChange()"
|
||||
v-model="unitSelect"
|
||||
class="px-2 py-0 mr-0 flex-child2"
|
||||
>
|
||||
{{ unitSelect }}
|
||||
</va-button>
|
||||
<div class="row flex px-0 mx-0 my-0 py-0">
|
||||
<div class="flex sm4 xl4 md4 xs4 px-0 mx-0 my-0 py-2">
|
||||
<p :style="disabled !== true ? '' : {color: this.$themes.gray}" class="display-6">E 2<p/>
|
||||
</div>
|
||||
<div class="flex sm3 xl3 md3 xs3 px-0 mx-0 my-0 py-0">
|
||||
<va-input
|
||||
@mouseleave.native="itemChange(itemInput)"
|
||||
@keyup.enter="itemChange(itemInput)"
|
||||
@blur="itemChange(itemInput)"
|
||||
:key="inputeKey"
|
||||
v-model="itemInput"
|
||||
class="mb-0"
|
||||
:error="showError"
|
||||
:error-messages="errorMsg"
|
||||
:disabled="disabled"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex sm5 xl5 md5 xs5 px-0 mx-0 my-0 py-0">
|
||||
<va-button
|
||||
@click="unitChange()"
|
||||
v-model="unitSelect"
|
||||
class="px-3 py-1"
|
||||
style="border-radius: 12px;"
|
||||
:color="disabled !== true ? 'primary' : 'gray'"
|
||||
:disabled="disabled"
|
||||
>
|
||||
{{ unitSelect }}
|
||||
</va-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -38,13 +48,17 @@ export default {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
created () {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
inputeKey: 0,
|
||||
itemInput: String(Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)),
|
||||
itemInput: String(parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)),
|
||||
unitSelect: 'mV',
|
||||
unitClickTime: 0,
|
||||
showError: false,
|
||||
@@ -62,13 +76,14 @@ export default {
|
||||
if (this.unitSelect === 'V') {
|
||||
val = parseFloat(val) * 1000
|
||||
}
|
||||
if (parseInt(val) < -5000 || parseInt(val) > 5000) {
|
||||
val = parseInt(val) // each step: 1mV
|
||||
if (val < -5000 || val > 5000) {
|
||||
this.showError = true
|
||||
this.errorMsg[0] = '-5 ~ 5V'
|
||||
return
|
||||
}
|
||||
if (parseFloat(val) !== Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)) {
|
||||
this.$emit('parameterChange', [this.parameterName + String(this.segmentID), parseFloat(val) * 5 + 25000])
|
||||
if (val !== parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)) {
|
||||
this.$emit('parameterChange', [this.parameterName, val * 5 + 25000])
|
||||
}
|
||||
},
|
||||
unitChange () {
|
||||
@@ -82,7 +97,7 @@ export default {
|
||||
}
|
||||
},
|
||||
refresh () {
|
||||
let volt = Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)
|
||||
let volt = parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)
|
||||
if (this.unitSelect === 'V') {
|
||||
volt /= 1000
|
||||
}
|
||||
@@ -97,25 +112,3 @@ export default {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.flex-container {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.flex-child {
|
||||
flex: 2;
|
||||
}
|
||||
|
||||
.flex-child1 {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.flex-child2 {
|
||||
flex: 0;
|
||||
}
|
||||
|
||||
.flex-child:first-child {
|
||||
margin-right: 1px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,23 +1,30 @@
|
||||
<template>
|
||||
<div class="flex-container">
|
||||
<p class="display-6 flex-child">E Final<p/>
|
||||
<va-input
|
||||
@mouseleave.native="itemChange(itemInput)"
|
||||
@keyup.enter="itemChange(itemInput)"
|
||||
@blur="itemChange(itemInput)"
|
||||
v-model="itemInput"
|
||||
class="mb-0 flex-child1"
|
||||
:error="showError"
|
||||
:error-messages="errorMsg"
|
||||
>
|
||||
</va-input>
|
||||
<va-button
|
||||
@click="unitChange()"
|
||||
v-model="unitSelect"
|
||||
class="px-2 py-0 mr-0 flex-child2"
|
||||
>
|
||||
{{ unitSelect }}
|
||||
</va-button>
|
||||
<div class="row flex px-0 mx-0 my-0 py-0">
|
||||
<div class="flex sm4 xl4 md4 xs4 px-0 mx-0 my-0 py-2">
|
||||
<p class="display-6">E Final<p/>
|
||||
</div>
|
||||
<div class="flex sm3 xl3 md3 xs3 px-0 mx-0 my-0 py-0">
|
||||
<va-input
|
||||
@mouseleave.native="itemChange(itemInput)"
|
||||
@keyup.enter="itemChange(itemInput)"
|
||||
@blur="itemChange(itemInput)"
|
||||
:key="inputeKey"
|
||||
v-model="itemInput"
|
||||
class="mb-0"
|
||||
:error="showError"
|
||||
:error-messages="errorMsg"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex sm5 xl5 md5 xs5 px-0 mx-0 my-0 py-0">
|
||||
<va-button
|
||||
@click="unitChange()"
|
||||
v-model="unitSelect"
|
||||
class="px-3 py-1"
|
||||
style="border-radius: 12px;"
|
||||
>
|
||||
{{ unitSelect }}
|
||||
</va-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -49,6 +56,8 @@ export default {
|
||||
unitClickTime: 0,
|
||||
showError: false,
|
||||
errorMsg: [''],
|
||||
e1: parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet.DPV_e_1 - 25000) / 5),
|
||||
e2: parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet.DPV_e_2 - 25000) / 5),
|
||||
}
|
||||
},
|
||||
mqtt: {
|
||||
@@ -56,19 +65,19 @@ export default {
|
||||
methods: {
|
||||
itemChange (val) {
|
||||
this.itemInput = val
|
||||
this.inputeKey++
|
||||
this.showError = false
|
||||
this.errorMsg[0] = ''
|
||||
if (this.unitSelect === 'V') {
|
||||
val = parseFloat(val) * 1000
|
||||
}
|
||||
if (parseInt(val) < -5000 || parseInt(val) > 5000) {
|
||||
val = parseInt(val) // each step: 1mV
|
||||
if (val < -5000 || val > 5000) {
|
||||
this.showError = true
|
||||
this.errorMsg[0] = '-5 ~ 5V'
|
||||
return
|
||||
}
|
||||
if (parseFloat(val) !== Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)) {
|
||||
this.$emit('parameterChange', [this.parameterName + String(this.segmentID), parseFloat(val) * 5 + 25000])
|
||||
if (this.checkE1E2(val) && val !== parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)) {
|
||||
this.$emit('parameterChange', [this.parameterName, val * 5 + 25000])
|
||||
}
|
||||
},
|
||||
unitChange () {
|
||||
@@ -81,12 +90,29 @@ export default {
|
||||
this.itemInput = String(parseFloat(this.itemInput) / 1000)
|
||||
}
|
||||
},
|
||||
checkE1E2 (val) {
|
||||
let flag = true
|
||||
if ((this.e1 >= this.e2) && !(this.e1 >= val && val >= this.e2)) {
|
||||
this.showError = true
|
||||
this.errorMsg[0] = 'Ef should be a value between E1 and E2'
|
||||
flag = false
|
||||
} else if ((this.e2 > this.e1) && !(this.e2 >= val && val >= this.e1)) {
|
||||
this.showError = true
|
||||
this.errorMsg[0] = 'Ef should be a value between E1 and E2'
|
||||
flag = false
|
||||
}
|
||||
this.inputeKey++
|
||||
return flag
|
||||
},
|
||||
refresh () {
|
||||
let volt = Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)
|
||||
let volt = parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)
|
||||
if (this.unitSelect === 'V') {
|
||||
volt /= 1000
|
||||
}
|
||||
this.itemInput = String(volt)
|
||||
this.e1 = parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet.DPV_e_1 - 25000) / 5)
|
||||
this.e2 = parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet.DPV_e_2 - 25000) / 5)
|
||||
this.checkE1E2(this.itemInput)
|
||||
},
|
||||
},
|
||||
async mounted () {
|
||||
@@ -97,25 +123,3 @@ export default {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.flex-container {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.flex-child {
|
||||
flex: 2;
|
||||
}
|
||||
|
||||
.flex-child1 {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.flex-child2 {
|
||||
flex: 0;
|
||||
}
|
||||
|
||||
.flex-child:first-child {
|
||||
margin-right: 1px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,23 +1,30 @@
|
||||
<template>
|
||||
<div class="flex-container">
|
||||
<p class="display-6 flex-child">E Initial<p/>
|
||||
<va-input
|
||||
@mouseleave.native="itemChange(itemInput)"
|
||||
@keyup.enter="itemChange(itemInput)"
|
||||
@blur="itemChange(itemInput)"
|
||||
v-model="itemInput"
|
||||
class="mb-0 flex-child1"
|
||||
:error="showError"
|
||||
:error-messages="errorMsg"
|
||||
>
|
||||
</va-input>
|
||||
<va-button
|
||||
@click="unitChange()"
|
||||
v-model="unitSelect"
|
||||
class="px-2 py-0 mr-0 flex-child2"
|
||||
>
|
||||
{{ unitSelect }}
|
||||
</va-button>
|
||||
<div class="row flex px-0 mx-0 my-0 py-0">
|
||||
<div class="flex sm4 xl4 md4 xs4 px-0 mx-0 my-0 py-2">
|
||||
<p class="display-6">E Initial<p/>
|
||||
</div>
|
||||
<div class="flex sm3 xl3 md3 xs3 px-0 mx-0 my-0 py-0">
|
||||
<va-input
|
||||
@mouseleave.native="itemChange(itemInput)"
|
||||
@keyup.enter="itemChange(itemInput)"
|
||||
@blur="itemChange(itemInput)"
|
||||
:key="inputeKey"
|
||||
v-model="itemInput"
|
||||
class="mb-0"
|
||||
:error="showError"
|
||||
:error-messages="errorMsg"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex sm5 xl5 md5 xs5 px-0 mx-0 my-0 py-0">
|
||||
<va-button
|
||||
@click="unitChange()"
|
||||
v-model="unitSelect"
|
||||
class="px-3 py-1"
|
||||
style="border-radius: 12px;"
|
||||
>
|
||||
{{ unitSelect }}
|
||||
</va-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -44,7 +51,7 @@ export default {
|
||||
data () {
|
||||
return {
|
||||
inputeKey: 0,
|
||||
itemInput: String(Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)),
|
||||
itemInput: String(parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)),
|
||||
unitSelect: 'mV',
|
||||
unitClickTime: 0,
|
||||
showError: false,
|
||||
@@ -62,13 +69,14 @@ export default {
|
||||
if (this.unitSelect === 'V') {
|
||||
val = parseFloat(val) * 1000
|
||||
}
|
||||
if (parseInt(val) < -5000 || parseInt(val) > 5000) {
|
||||
val = parseInt(val) // each step: 1mV
|
||||
if (val < -5000 || val > 5000) {
|
||||
this.showError = true
|
||||
this.errorMsg[0] = '-5 ~ 5V'
|
||||
return
|
||||
}
|
||||
if (parseFloat(val) !== Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)) {
|
||||
this.$emit('parameterChange', [this.parameterName + String(this.segmentID), parseFloat(val) * 5 + 25000])
|
||||
if (val !== parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)) {
|
||||
this.$emit('parameterChange', [this.parameterName, val * 5 + 25000])
|
||||
}
|
||||
},
|
||||
unitChange () {
|
||||
@@ -82,7 +90,7 @@ export default {
|
||||
}
|
||||
},
|
||||
refresh () {
|
||||
let volt = Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)
|
||||
let volt = parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)
|
||||
if (this.unitSelect === 'V') {
|
||||
volt /= 1000
|
||||
}
|
||||
@@ -97,25 +105,3 @@ export default {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.flex-container {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.flex-child {
|
||||
flex: 2;
|
||||
}
|
||||
|
||||
.flex-child1 {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.flex-child2 {
|
||||
flex: 0;
|
||||
}
|
||||
|
||||
.flex-child:first-child {
|
||||
margin-right: 1px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
<template>
|
||||
<div>
|
||||
<fieldset>
|
||||
<va-radio-button
|
||||
option="0"
|
||||
v-model="optionValue"
|
||||
label="AUTO"
|
||||
@click.native.stop="switchMode(optionValue)"
|
||||
/>
|
||||
<auto-block v-if="optionValue === '0'" class="ml-4 pl-2" :ref="'AutoBlock'" :deviceID="deviceID"/>
|
||||
<va-radio-button
|
||||
option="1"
|
||||
v-model="optionValue"
|
||||
label="ADVANCED"
|
||||
@click.native.stop="switchMode(optionValue)"
|
||||
/>
|
||||
<advanced-block v-if="optionValue === '1'" class="ml-4 pl-2" :ref="'AdvancedBlock'" :deviceID="deviceID"/>
|
||||
<va-radio-button
|
||||
option="2"
|
||||
v-model="optionValue"
|
||||
label="ENGINEERING"
|
||||
@click.native.stop="switchMode(optionValue)"
|
||||
/>
|
||||
<engineering-block v-if="optionValue === '2'" class="ml-4 pl-2" :ref="'EngineeringBlock'" :deviceID="deviceID" :devMode="engineerMode"/>
|
||||
</fieldset>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { taskInfo } from '@/data/task/TaskInfo'
|
||||
import AutoBlock from './AutoBlock'
|
||||
import AdvancedBlock from './AdvancedBlock'
|
||||
import EngineeringBlock from './EngineeringBlock'
|
||||
|
||||
export default {
|
||||
name: 'EliteParameterRecordingEliteDPV',
|
||||
components: {
|
||||
AutoBlock,
|
||||
AdvancedBlock,
|
||||
EngineeringBlock,
|
||||
},
|
||||
props: {
|
||||
deviceID: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
deviceName: {
|
||||
type: String,
|
||||
default: 'Elite',
|
||||
},
|
||||
},
|
||||
created () {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
engineerMode: false,
|
||||
optionValue: '0',
|
||||
}
|
||||
},
|
||||
mqtt: {
|
||||
},
|
||||
methods: {
|
||||
mqttPub: function (topic, mes) {
|
||||
this.$mqtt.publish(topic, mes)
|
||||
},
|
||||
// Array[String of Parameter Nmae, Value]
|
||||
deviceParameterChange: function (e) {
|
||||
// console.log('e[0],e[1]', e[0], ',', e[1])
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_parameter/0',
|
||||
device: taskInfo.getRawDeviceID(this.deviceID),
|
||||
parameter: e[0],
|
||||
content: e[1],
|
||||
}))
|
||||
},
|
||||
switchMode (val) {
|
||||
if (parseInt(val) !== taskInfo.getDeviceInfo(this.deviceID).parameterSet.DPV_mode) {
|
||||
this.deviceParameterChange(['DPV_mode', parseInt(val)])
|
||||
}
|
||||
},
|
||||
refresh () {
|
||||
this.optionValue = String(taskInfo.getDeviceInfo(this.deviceID).parameterSet.DPV_mode)
|
||||
if (this.$refs.AutoBlock != null) {
|
||||
this.$refs.AutoBlock.refresh()
|
||||
}
|
||||
if (this.$refs.AdvancedBlock != null) {
|
||||
this.$refs.AdvancedBlock.refresh()
|
||||
}
|
||||
if (this.$refs.EngineeringBlock != null) {
|
||||
this.$refs.EngineeringBlock.refresh()
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
destroyed () {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,104 @@
|
||||
<template>
|
||||
<div>
|
||||
<e-initial :ref="'EInitial'" class="my-2" :deviceID="deviceID" :parameterName="'DPV_e_init'" @parameterChange="deviceParameterChange($event)" />
|
||||
<e-final :ref="'EFinal'" class="my-2" :deviceID="deviceID" :parameterName="'DPV_e_final'" @parameterChange="deviceParameterChange($event)" />
|
||||
<increment :ref="'Increment'" class="my-2" :deviceID="deviceID" :parameterName="'DPV_increment'" @parameterChange="deviceParameterChange($event)" />
|
||||
<pulse-amp :ref="'PulseAmp'" class="my-2" :deviceID="deviceID" :parameterName="'DPV_amp'" @parameterChange="deviceParameterChange($event)" />
|
||||
<pulse-width :ref="'PulseWidth'" class="my-2" :deviceID="deviceID" :parameterName="'DPV_pul_width'" @parameterChange="deviceParameterChange($event)" />
|
||||
<period :ref="'Period'" class="my-2" :deviceID="deviceID" :parameterName="'DPV_step_time'" @parameterChange="deviceParameterChange($event)" />
|
||||
<sample-rate :ref="'SampleRate'" class="my-2" :deviceID="deviceID" :parameterName="'DPV_notify_rate'" @parameterChange="deviceParameterChange($event)" />
|
||||
<cycle :ref="'Cycle'" class="my-2" :deviceID="deviceID" :parameterName="'CYCLE_NUMBER'" @parameterChange="deviceParameterChange($event)" />
|
||||
<engineering-switch :ref="'EngineeringSwitch'" class="my-2" :deviceID="deviceID" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { taskInfo } from '@/data/task/TaskInfo'
|
||||
import EInitial from './EInitial'
|
||||
import EFinal from './EFinal'
|
||||
import PulseAmp from './PulseAmp'
|
||||
import PulseWidth from './PulseWidth'
|
||||
import Increment from './Increment'
|
||||
import Period from './Period'
|
||||
import SampleRate from './SampleRate'
|
||||
import Cycle from './Cycle'
|
||||
import EngineeringSwitch from './EngineeringSwitch.vue'
|
||||
|
||||
export default {
|
||||
name: 'EngineerBlock',
|
||||
components: {
|
||||
EInitial,
|
||||
EFinal,
|
||||
Increment,
|
||||
PulseAmp,
|
||||
PulseWidth,
|
||||
Period,
|
||||
SampleRate,
|
||||
Cycle,
|
||||
EngineeringSwitch,
|
||||
},
|
||||
props: {
|
||||
deviceID: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
created () {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
}
|
||||
},
|
||||
mqtt: {
|
||||
},
|
||||
methods: {
|
||||
mqttPub: function (topic, mes) {
|
||||
this.$mqtt.publish(topic, mes)
|
||||
},
|
||||
// Array[String of Parameter Name, Value]
|
||||
deviceParameterChange: function (e) {
|
||||
console.log('e[0],e[1]', e[0], ',', e[1])
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_parameter/0',
|
||||
device: taskInfo.getRawDeviceID(this.deviceID),
|
||||
parameter: e[0],
|
||||
content: e[1],
|
||||
}))
|
||||
},
|
||||
refresh () {
|
||||
if (this.$refs.EInitial != null) {
|
||||
this.$refs.EInitial.refresh()
|
||||
}
|
||||
if (this.$refs.EFinal != null) {
|
||||
this.$refs.EFinal.refresh()
|
||||
}
|
||||
if (this.$refs.Increment != null) {
|
||||
this.$refs.Increment.refresh()
|
||||
}
|
||||
if (this.$refs.PulseAmp != null) {
|
||||
this.$refs.PulseAmp.refresh()
|
||||
}
|
||||
if (this.$refs.PulseWidth != null) {
|
||||
this.$refs.PulseWidth.refresh()
|
||||
}
|
||||
if (this.$refs.Period != null) {
|
||||
this.$refs.Period.refresh()
|
||||
}
|
||||
if (this.$refs.SampleRate != null) {
|
||||
this.$refs.SampleRate.refresh()
|
||||
}
|
||||
if (this.$refs.EngineeringSwitch != null) {
|
||||
this.$refs.EngineeringSwitch.refresh()
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
this.refresh()
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
destroyed () {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,88 @@
|
||||
<template>
|
||||
<div class="row flex px-0 mx-0 my-0 py-0">
|
||||
<div class="flex sm7 xl7 md7 xs7 px-0 mx-0 my-0 py-0" />
|
||||
<div class="flex sm5 xl5 md5 xs5 px-0 mx-0 my-0 py-0">
|
||||
<va-toggle class="mt-1" v-model="engineerEnable" small color="success" @click.native="engineerModeChange(engineerEnable)"/>
|
||||
</div>
|
||||
<div class="flex sm12 xl12 md12 xs12 px-0 mx-0 my-0 py-0">
|
||||
<e-1 :ref="'E1'" class="my-2" :deviceID="deviceID" :parameterName="'DPV_e_1'" :disabled="!engineerEnable" @parameterChange="deviceParameterChange($event)" />
|
||||
</div>
|
||||
<div class="flex sm12 xl12 md12 xs12 px-0 mx-0 my-0 py-0">
|
||||
<e-2 :ref="'E2'" class="my-2" :deviceID="deviceID" :parameterName="'DPV_e_2'" :disabled="!engineerEnable" @parameterChange="deviceParameterChange($event)" />
|
||||
</div>
|
||||
<div class="flex sm12 xl12 md12 xs12 px-0 mx-0 my-0 py-0">
|
||||
<pulse-option :ref="'PulseOption'" class="my-2" :deviceID="deviceID" :parameterName="'DPV_pulse_option'" :disabled="!engineerEnable" @parameterChange="deviceParameterChange($event)" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { taskInfo } from '@/data/task/TaskInfo'
|
||||
import E1 from './E1'
|
||||
import E2 from './E2'
|
||||
import PulseOption from './PulseOption'
|
||||
|
||||
export default {
|
||||
name: 'EngineeringSwitch',
|
||||
components: {
|
||||
E1,
|
||||
E2,
|
||||
PulseOption,
|
||||
},
|
||||
props: {
|
||||
deviceID: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
created () {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
engineerEnable: false,
|
||||
}
|
||||
},
|
||||
mqtt: {
|
||||
},
|
||||
methods: {
|
||||
mqttPub: function (topic, mes) {
|
||||
this.$mqtt.publish(topic, mes)
|
||||
},
|
||||
// Array[String of Parameter Name, Value]
|
||||
deviceParameterChange: function (e) {
|
||||
console.log('e[0],e[1]', e[0], ',', e[1])
|
||||
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_parameter/0',
|
||||
device: taskInfo.getRawDeviceID(this.deviceID),
|
||||
parameter: e[0],
|
||||
content: e[1],
|
||||
}))
|
||||
},
|
||||
engineerModeChange (val) {
|
||||
if (val !== (taskInfo.getDeviceInfo(this.deviceID).parameterSet.DPV_engineering_enable === 1)) {
|
||||
this.deviceParameterChange(['DPV_engineering_enable', val])
|
||||
}
|
||||
},
|
||||
refresh () {
|
||||
this.engineerEnable = (taskInfo.getDeviceInfo(this.deviceID).parameterSet.DPV_engineering_enable === 1)
|
||||
if (this.$refs.DPV_e_1 != null) {
|
||||
this.$refs.DPV_e_1.refresh()
|
||||
}
|
||||
if (this.$refs.DPV_e_2 != null) {
|
||||
this.$refs.DPV_e_2.refresh()
|
||||
}
|
||||
if (this.$refs.PulseOption != null) {
|
||||
this.$refs.PulseOption.refresh()
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
this.refresh()
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
destroyed () {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -1,23 +1,30 @@
|
||||
<template>
|
||||
<div class="flex-container">
|
||||
<p class="display-6 flex-child">Increment<p/>
|
||||
<va-input
|
||||
@mouseleave.native="itemChange(itemInput)"
|
||||
@keyup.enter="itemChange(itemInput)"
|
||||
@blur="itemChange(itemInput)"
|
||||
v-model="itemInput"
|
||||
class="mb-0 flex-child1"
|
||||
:error="showError"
|
||||
:error-messages="errorMsg"
|
||||
>
|
||||
</va-input>
|
||||
<va-button
|
||||
@click="unitChange()"
|
||||
v-model="unitSelect"
|
||||
class="px-2 py-0 mr-0 flex-child2"
|
||||
>
|
||||
{{ unitSelect }}
|
||||
</va-button>
|
||||
<div class="row flex px-0 mx-0 my-0 py-0">
|
||||
<div class="flex sm4 xl4 md4 xs4 px-0 mx-0 my-0 py-2">
|
||||
<p class="display-6">Increment<p/>
|
||||
</div>
|
||||
<div class="flex sm3 xl3 md3 xs3 px-0 mx-0 my-0 py-0">
|
||||
<va-input
|
||||
@mouseleave.native="itemChange(itemInput)"
|
||||
@keyup.enter="itemChange(itemInput)"
|
||||
@blur="itemChange(itemInput)"
|
||||
:key="inputeKey"
|
||||
v-model="itemInput"
|
||||
class="mb-0"
|
||||
:error="showError"
|
||||
:error-messages="errorMsg"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex sm5 xl5 md5 xs5 px-0 mx-0 my-0 py-0">
|
||||
<va-button
|
||||
@click="unitChange()"
|
||||
v-model="unitSelect"
|
||||
class="px-3 py-1"
|
||||
style="border-radius: 12px;"
|
||||
>
|
||||
{{ unitSelect }}
|
||||
</va-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -44,7 +51,7 @@ export default {
|
||||
data () {
|
||||
return {
|
||||
inputeKey: 0,
|
||||
itemInput: String(Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)),
|
||||
itemInput: String(parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)),
|
||||
unitSelect: 'mV',
|
||||
unitClickTime: 0,
|
||||
showError: false,
|
||||
@@ -62,13 +69,14 @@ export default {
|
||||
if (this.unitSelect === 'V') {
|
||||
val = parseFloat(val) * 1000
|
||||
}
|
||||
if (parseInt(val) < -5000 || parseInt(val) > 5000) {
|
||||
val = parseInt(val) // each step: 1mV
|
||||
if (val < -5000 || val > 5000) {
|
||||
this.showError = true
|
||||
this.errorMsg[0] = '-5 ~ 5V'
|
||||
return
|
||||
}
|
||||
if (parseFloat(val) !== Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)) {
|
||||
this.$emit('parameterChange', [this.parameterName + String(this.segmentID), parseFloat(val) * 5 + 25000])
|
||||
if (val !== parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)) {
|
||||
this.$emit('parameterChange', [this.parameterName, val * 5 + 25000])
|
||||
}
|
||||
},
|
||||
unitChange () {
|
||||
@@ -82,7 +90,7 @@ export default {
|
||||
}
|
||||
},
|
||||
refresh () {
|
||||
let volt = Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)
|
||||
let volt = parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)
|
||||
if (this.unitSelect === 'V') {
|
||||
volt /= 1000
|
||||
}
|
||||
@@ -97,25 +105,3 @@ export default {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.flex-container {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.flex-child {
|
||||
flex: 2;
|
||||
}
|
||||
|
||||
.flex-child1 {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.flex-child2 {
|
||||
flex: 0;
|
||||
}
|
||||
|
||||
.flex-child:first-child {
|
||||
margin-right: 1px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
<template>
|
||||
<div class="row flex px-0 mx-0 my-0 py-0">
|
||||
<div class="flex sm4 xl4 md4 xs4 px-0 mx-0 my-0 py-2">
|
||||
<p class="display-6">Period<p/>
|
||||
</div>
|
||||
<div class="flex sm3 xl3 md3 xs3 px-0 mx-0 my-0 py-0">
|
||||
<va-input
|
||||
@mouseleave.native="itemChange(itemInput)"
|
||||
@keyup.enter="itemChange(itemInput)"
|
||||
@blur="itemChange(itemInput)"
|
||||
:key="inputeKey"
|
||||
v-model="itemInput"
|
||||
class="mb-0"
|
||||
:error="showError"
|
||||
:error-messages="errorMsg"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex sm5 xl5 md5 xs5 px-0 mx-0 my-0 py-0">
|
||||
<va-button
|
||||
@click="unitChange()"
|
||||
v-model="unitSelect"
|
||||
class="px-3 py-1"
|
||||
style="border-radius: 12px;"
|
||||
>
|
||||
{{ unitSelect }}
|
||||
</va-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { taskInfo } from '@/data/task/TaskInfo'
|
||||
|
||||
export default {
|
||||
name: 'Period',
|
||||
components: {
|
||||
},
|
||||
props: {
|
||||
deviceID: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
parameterName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
created () {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
inputeKey: 0,
|
||||
itemInput: String(parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName])),
|
||||
unitSelect: 'ms',
|
||||
unitClickTime: 0,
|
||||
showError: false,
|
||||
errorMsg: [''],
|
||||
}
|
||||
},
|
||||
mqtt: {
|
||||
},
|
||||
methods: {
|
||||
itemChange (val) {
|
||||
this.itemInput = val
|
||||
this.inputeKey++
|
||||
this.showError = false
|
||||
this.errorMsg[0] = ''
|
||||
if (this.unitSelect === 's') {
|
||||
val = parseFloat(val) * 1000
|
||||
}
|
||||
val = parseInt(val) // each step: 1ms
|
||||
|
||||
if (val < 0 || val > 1e6) {
|
||||
this.showError = true
|
||||
this.errorMsg[0] = '0 ~ 1000s'
|
||||
return
|
||||
}
|
||||
if (val !== parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName])) {
|
||||
this.$emit('parameterChange', [this.parameterName, val])
|
||||
}
|
||||
},
|
||||
unitChange () {
|
||||
this.unitClickTime += 1
|
||||
if (this.unitClickTime % 2 === 0) {
|
||||
this.unitSelect = 'ms'
|
||||
this.itemInput = String(parseFloat(this.itemInput) * 1000)
|
||||
} else {
|
||||
this.unitSelect = 's'
|
||||
this.itemInput = String(parseFloat(this.itemInput) / 1000)
|
||||
}
|
||||
},
|
||||
refresh () {
|
||||
if (this.showError === false) {
|
||||
let duration = parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName])
|
||||
if (this.unitSelect === 's') {
|
||||
duration /= 1000
|
||||
}
|
||||
this.itemInput = String(duration)
|
||||
}
|
||||
},
|
||||
},
|
||||
async mounted () {
|
||||
},
|
||||
destroyed () {
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -1,23 +1,30 @@
|
||||
<template>
|
||||
<div class="flex-container">
|
||||
<p class="display-6 flex-child">Pulse Amplitude<p/>
|
||||
<va-input
|
||||
@mouseleave.native="itemChange(itemInput)"
|
||||
@keyup.enter="itemChange(itemInput)"
|
||||
@blur="itemChange(itemInput)"
|
||||
v-model="itemInput"
|
||||
class="mb-0 flex-child1"
|
||||
:error="showError"
|
||||
:error-messages="errorMsg"
|
||||
>
|
||||
</va-input>
|
||||
<va-button
|
||||
@click="unitChange()"
|
||||
v-model="unitSelect"
|
||||
class="px-2 py-0 mr-0 flex-child2"
|
||||
>
|
||||
{{ unitSelect }}
|
||||
</va-button>
|
||||
<div class="row flex px-0 mx-0 my-0 py-0">
|
||||
<div class="flex sm4 xl4 md4 xs4 px-0 mx-0 my-0 py-2">
|
||||
<p class="display-6">Pulse Amplitude<p/>
|
||||
</div>
|
||||
<div class="flex sm3 xl3 md3 xs3 px-0 mx-0 my-0 py-0">
|
||||
<va-input
|
||||
@mouseleave.native="itemChange(itemInput)"
|
||||
@keyup.enter="itemChange(itemInput)"
|
||||
@blur="itemChange(itemInput)"
|
||||
:key="inputeKey"
|
||||
v-model="itemInput"
|
||||
class="mb-0"
|
||||
:error="showError"
|
||||
:error-messages="errorMsg"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex sm5 xl5 md5 xs5 px-0 mx-0 my-0 py-0">
|
||||
<va-button
|
||||
@click="unitChange()"
|
||||
v-model="unitSelect"
|
||||
class="px-3 py-1"
|
||||
style="border-radius: 12px;"
|
||||
>
|
||||
{{ unitSelect }}
|
||||
</va-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -44,7 +51,7 @@ export default {
|
||||
data () {
|
||||
return {
|
||||
inputeKey: 0,
|
||||
itemInput: String(Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)),
|
||||
itemInput: String(parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)),
|
||||
unitSelect: 'mV',
|
||||
unitClickTime: 0,
|
||||
showError: false,
|
||||
@@ -62,13 +69,14 @@ export default {
|
||||
if (this.unitSelect === 'V') {
|
||||
val = parseFloat(val) * 1000
|
||||
}
|
||||
if (parseInt(val) < -5000 || parseInt(val) > 5000) {
|
||||
val = parseInt(val) // each step: 1mV
|
||||
if (val < -5000 || val > 5000) {
|
||||
this.showError = true
|
||||
this.errorMsg[0] = '-5 ~ 5V'
|
||||
return
|
||||
}
|
||||
if (parseFloat(val) !== Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)) {
|
||||
this.$emit('parameterChange', [this.parameterName + String(this.segmentID), parseFloat(val) * 5 + 25000])
|
||||
if (val !== parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)) {
|
||||
this.$emit('parameterChange', [this.parameterName, val * 5 + 25000])
|
||||
}
|
||||
},
|
||||
unitChange () {
|
||||
@@ -82,7 +90,7 @@ export default {
|
||||
}
|
||||
},
|
||||
refresh () {
|
||||
let volt = Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)
|
||||
let volt = parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)
|
||||
if (this.unitSelect === 'V') {
|
||||
volt /= 1000
|
||||
}
|
||||
@@ -97,25 +105,3 @@ export default {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.flex-container {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.flex-child {
|
||||
flex: 2;
|
||||
}
|
||||
|
||||
.flex-child1 {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.flex-child2 {
|
||||
flex: 0;
|
||||
}
|
||||
|
||||
.flex-child:first-child {
|
||||
margin-right: 1px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<div class="row flex px-0 mx-0 my-0 py-0">
|
||||
<div class="flex sm4 xl4 md4 xs4 px-0 mx-0 my-0 py-2">
|
||||
<p :style="disabled !== true ? '' : {color: this.$themes.gray}" class="display-6">Pulse Option<p/>
|
||||
</div>
|
||||
<div class="flex sm1 xl1 md1 xs1 px-0 mx-0 my-0 py-0">
|
||||
<va-checkbox v-model="itemInput" @input="itemChange(itemInput)" :disabled="disabled"/>
|
||||
</div>
|
||||
<div class="flex sm7 xl7 md7 xs7 px-0 mx-0 my-0 py-1">
|
||||
<p :style="{color: this.$themes.gray}" style="font-weight: bold;"> Invert pulses during E1 to E2 </p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { taskInfo } from '@/data/task/TaskInfo'
|
||||
|
||||
export default {
|
||||
name: 'PulseOption',
|
||||
components: {
|
||||
},
|
||||
props: {
|
||||
deviceID: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
parameterName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
created () {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
inputeKey: 0,
|
||||
itemInput: parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName]) === 1,
|
||||
}
|
||||
},
|
||||
mqtt: {
|
||||
},
|
||||
methods: {
|
||||
itemChange (val) {
|
||||
if (val !== (parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName]) === 1)) {
|
||||
this.$emit('parameterChange', [this.parameterName, val])
|
||||
}
|
||||
},
|
||||
refresh () {
|
||||
this.itemInput = parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName]) === 1
|
||||
},
|
||||
},
|
||||
async mounted () {
|
||||
},
|
||||
destroyed () {
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -1,23 +1,30 @@
|
||||
<template>
|
||||
<div class="flex-container">
|
||||
<p class="display-6 flex-child">Pulse Width<p/>
|
||||
<va-input
|
||||
@mouseleave.native="itemChange(itemInput)"
|
||||
@keyup.enter="itemChange(itemInput)"
|
||||
@blur="itemChange(itemInput)"
|
||||
v-model="itemInput"
|
||||
class="mb-0 flex-child1"
|
||||
:error="showError"
|
||||
:error-messages="errorMsg"
|
||||
>
|
||||
</va-input>
|
||||
<va-button
|
||||
@click="unitChange()"
|
||||
v-model="unitSelect"
|
||||
class="px-2 py-0 mr-0 flex-child2"
|
||||
>
|
||||
{{ unitSelect }}
|
||||
</va-button>
|
||||
<div class="row flex px-0 mx-0 my-0 py-0">
|
||||
<div class="flex sm4 xl4 md4 xs4 px-0 mx-0 my-0 py-2">
|
||||
<p class="display-6">Pulse Width<p/>
|
||||
</div>
|
||||
<div class="flex sm3 xl3 md3 xs3 px-0 mx-0 my-0 py-0">
|
||||
<va-input
|
||||
@mouseleave.native="itemChange(itemInput)"
|
||||
@keyup.enter="itemChange(itemInput)"
|
||||
@blur="itemChange(itemInput)"
|
||||
:key="inputeKey"
|
||||
v-model="itemInput"
|
||||
class="mb-0"
|
||||
:error="showError"
|
||||
:error-messages="errorMsg"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex sm5 xl5 md5 xs5 px-0 mx-0 my-0 py-0">
|
||||
<va-button
|
||||
@click="unitChange()"
|
||||
v-model="unitSelect"
|
||||
class="px-3 py-1"
|
||||
style="border-radius: 12px;"
|
||||
>
|
||||
{{ unitSelect }}
|
||||
</va-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -44,8 +51,8 @@ export default {
|
||||
data () {
|
||||
return {
|
||||
inputeKey: 0,
|
||||
itemInput: String(Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)]) / 10)),
|
||||
unitSelect: 'msec',
|
||||
itemInput: String(parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName])),
|
||||
unitSelect: 'ms',
|
||||
unitClickTime: 0,
|
||||
showError: false,
|
||||
errorMsg: [''],
|
||||
@@ -59,39 +66,34 @@ export default {
|
||||
this.inputeKey++
|
||||
this.showError = false
|
||||
this.errorMsg[0] = ''
|
||||
if (this.unitSelect === 'sec') {
|
||||
val = parseInt(val) * 1000
|
||||
if (this.unitSelect === 's') {
|
||||
val = parseFloat(val) * 1000
|
||||
}
|
||||
val = parseInt(val) // each step: 1ms
|
||||
|
||||
// 5 ms a step
|
||||
const remainder = parseInt(val) % 5
|
||||
if (remainder !== 0) {
|
||||
val = parseInt(val) + (5 - remainder)
|
||||
}
|
||||
if (parseInt(val) < 1 || parseInt(val) > 100000) {
|
||||
if (val < 0 || val > 1e6) {
|
||||
this.showError = true
|
||||
this.errorMsg[0] = '1ms ~ 100s'
|
||||
this.errorMsg[0] = '0 ~ 1000s'
|
||||
return
|
||||
}
|
||||
if (parseFloat(val) !== Math.round(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] / 10)) {
|
||||
this.$emit('parameterChange', [this.parameterName + String(this.segmentID), parseInt(val) * 10])
|
||||
this.$emit('checkCurrentRecording', val)
|
||||
if (val !== parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName])) {
|
||||
this.$emit('parameterChange', [this.parameterName, val])
|
||||
}
|
||||
},
|
||||
unitChange () {
|
||||
this.unitClickTime += 1
|
||||
if (this.unitClickTime % 2 === 0) {
|
||||
this.unitSelect = 'msec'
|
||||
this.unitSelect = 'ms'
|
||||
this.itemInput = String(parseFloat(this.itemInput) * 1000)
|
||||
} else {
|
||||
this.unitSelect = 'sec'
|
||||
this.unitSelect = 's'
|
||||
this.itemInput = String(parseFloat(this.itemInput) / 1000)
|
||||
}
|
||||
},
|
||||
refresh () {
|
||||
if (this.showError === false) {
|
||||
let duration = Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)]) / 10)
|
||||
if (this.unitSelect === 'sec') {
|
||||
let duration = parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName])
|
||||
if (this.unitSelect === 's') {
|
||||
duration /= 1000
|
||||
}
|
||||
this.itemInput = String(duration)
|
||||
@@ -106,25 +108,3 @@ export default {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.flex-container {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.flex-child {
|
||||
flex: 2;
|
||||
}
|
||||
|
||||
.flex-child1 {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.flex-child2 {
|
||||
flex: 0;
|
||||
}
|
||||
|
||||
.flex-child:first-child {
|
||||
margin-right: 1px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
<template>
|
||||
<div class="row flex px-0 mx-0 my-0 py-0">
|
||||
<div class="flex sm4 xl4 md4 xs4 px-0 mx-0 my-0 py-2">
|
||||
<p class="display-6">Sample Rate<p/>
|
||||
</div>
|
||||
<div class="flex sm3 xl3 md3 xs3 px-0 mx-0 my-0 py-0">
|
||||
<va-input
|
||||
@mouseleave.native="itemChange(itemInput)"
|
||||
@keyup.enter="itemChange(itemInput)"
|
||||
@blur="itemChange(itemInput)"
|
||||
:key="inputeKey"
|
||||
v-model="itemInput"
|
||||
class="mb-0"
|
||||
:error="showError"
|
||||
:error-messages="errorMsg"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex sm5 xl5 md5 xs5 px-0 mx-0 my-0 py-0">
|
||||
<va-button
|
||||
flat
|
||||
color="gray"
|
||||
class="px-3 py-1"
|
||||
style="border-radius: 12px; opacity: 1;"
|
||||
disabled
|
||||
>
|
||||
{{ unitSelect }}
|
||||
</va-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { taskInfo } from '@/data/task/TaskInfo'
|
||||
|
||||
export default {
|
||||
name: 'SampleRate',
|
||||
components: {
|
||||
},
|
||||
props: {
|
||||
deviceID: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
parameterName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
created () {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
inputeKey: 0,
|
||||
itemInput: taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] / 10,
|
||||
unitSelect: 'sps',
|
||||
showError: false,
|
||||
errorMsg: [''],
|
||||
}
|
||||
},
|
||||
mqtt: {
|
||||
},
|
||||
methods: {
|
||||
itemChange (val) {
|
||||
val = parseFloat(val).toFixed(1) // 一個間距最小為0.1sps
|
||||
this.itemInput = val
|
||||
if (val < 0.1 || val > 100) {
|
||||
this.showError = true
|
||||
this.errorMsg[0] = '0.1 ~ 100sps'
|
||||
return
|
||||
} else {
|
||||
this.showError = false
|
||||
this.errorMsg[0] = ''
|
||||
}
|
||||
this.inputeKey++
|
||||
|
||||
if (parseFloat(val) !== taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] / 10) {
|
||||
this.$emit('parameterChange', [this.parameterName, val * 10])
|
||||
}
|
||||
},
|
||||
refresh () {
|
||||
this.itemInput = taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] / 10
|
||||
},
|
||||
},
|
||||
async mounted () {
|
||||
},
|
||||
destroyed () {
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -1,130 +0,0 @@
|
||||
<template>
|
||||
<div class="flex-container">
|
||||
<p class="display-6 flex-child">Step Time<p/>
|
||||
<va-input
|
||||
@mouseleave.native="itemChange(itemInput)"
|
||||
@keyup.enter="itemChange(itemInput)"
|
||||
@blur="itemChange(itemInput)"
|
||||
v-model="itemInput"
|
||||
class="mb-0 flex-child1"
|
||||
:error="showError"
|
||||
:error-messages="errorMsg"
|
||||
>
|
||||
</va-input>
|
||||
<va-button
|
||||
@click="unitChange()"
|
||||
v-model="unitSelect"
|
||||
class="px-2 py-0 mr-0 flex-child2"
|
||||
>
|
||||
{{ unitSelect }}
|
||||
</va-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { taskInfo } from '@/data/task/TaskInfo'
|
||||
|
||||
export default {
|
||||
name: 'StepTime',
|
||||
components: {
|
||||
},
|
||||
props: {
|
||||
deviceID: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
parameterName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
created () {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
inputeKey: 0,
|
||||
itemInput: String(Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)]) / 10)),
|
||||
unitSelect: 'msec',
|
||||
unitClickTime: 0,
|
||||
showError: false,
|
||||
errorMsg: [''],
|
||||
}
|
||||
},
|
||||
mqtt: {
|
||||
},
|
||||
methods: {
|
||||
itemChange (val) {
|
||||
this.itemInput = val
|
||||
this.inputeKey++
|
||||
this.showError = false
|
||||
this.errorMsg[0] = ''
|
||||
if (this.unitSelect === 'sec') {
|
||||
val = parseInt(val) * 1000
|
||||
}
|
||||
|
||||
// 5 ms a step
|
||||
const remainder = parseInt(val) % 5
|
||||
if (remainder !== 0) {
|
||||
val = parseInt(val) + (5 - remainder)
|
||||
}
|
||||
if (parseInt(val) < 1 || parseInt(val) > 100000) {
|
||||
this.showError = true
|
||||
this.errorMsg[0] = '1ms ~ 100s'
|
||||
return
|
||||
}
|
||||
if (parseFloat(val) !== Math.round(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] / 10)) {
|
||||
this.$emit('parameterChange', [this.parameterName + String(this.segmentID), parseInt(val) * 10])
|
||||
this.$emit('checkCurrentRecording', val)
|
||||
}
|
||||
},
|
||||
unitChange () {
|
||||
this.unitClickTime += 1
|
||||
if (this.unitClickTime % 2 === 0) {
|
||||
this.unitSelect = 'msec'
|
||||
this.itemInput = String(parseFloat(this.itemInput) * 1000)
|
||||
} else {
|
||||
this.unitSelect = 'sec'
|
||||
this.itemInput = String(parseFloat(this.itemInput) / 1000)
|
||||
}
|
||||
},
|
||||
refresh () {
|
||||
if (this.showError === false) {
|
||||
let duration = Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)]) / 10)
|
||||
if (this.unitSelect === 'sec') {
|
||||
duration /= 1000
|
||||
}
|
||||
this.itemInput = String(duration)
|
||||
}
|
||||
},
|
||||
},
|
||||
async mounted () {
|
||||
},
|
||||
destroyed () {
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.flex-container {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.flex-child {
|
||||
flex: 2;
|
||||
}
|
||||
|
||||
.flex-child1 {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.flex-child2 {
|
||||
flex: 0;
|
||||
}
|
||||
|
||||
.flex-child:first-child {
|
||||
margin-right: 1px;
|
||||
}
|
||||
</style>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user