Compare commits

...

6 Commits

Author SHA1 Message Date
Jordan Hsu 95bb4afa49 [fix] replay cycle bug 2021-08-05 13:51:06 +08:00
Jordan Hsu 6c5c832fde [add] neulive sti T range check point 2021-08-05 12:25:52 +08:00
Jordan Hsu 256070ae76 [fix] typo 2021-08-04 18:44:07 +08:00
Jordan Hsu e82d17ab4f [add] pulse sensing mode segment hover effect, [remove] replay exp display 2021-08-04 16:43:53 +08:00
Jordan Hsu fecbd4e4da [modify] neulive sti time range rule 2021-07-31 22:22:09 +08:00
Jordan Hsu e4da226a03 [init] DPV UI 2021-07-27 21:08:33 +08:00
29 changed files with 1719 additions and 236 deletions
@@ -41,7 +41,6 @@ import api from '@/data/api/index'
import { download } from '@/data/download/Download'
import types from '@/store/modules/analysis/replay/types'
import { mapFields } from 'vuex-map-fields'
import { newChartMode } from '@/factories/chart/chartFactory'
export default {
name: 'elite-data-replay',
@@ -155,7 +154,7 @@ export default {
})
let _gridNumber = 0
const register = this.metaList.map(meta => {
const setting = newChartMode(meta.parameter_set.MODE)
const setting = this.GLOBAL.getDefaultChartTypeByMode(meta.parameter_set.MODE)
const xType = setting[0] // Elite or Time
const yType = setting[2] // Elite or Time
const xValue = setting[1] // 1: I, 2: V, 3: R
@@ -246,7 +245,9 @@ export default {
let scale = '100'
if (this.axisXDataType.description === 'Time') {
const sampleRate = metaInfo.parameter_set.SAMPLE_RATE / 10
scale = (((metaInfo.time_duration / 100000) * sampleRate) / 4000) * 0.1
scale = (((parseInt(metaInfo.time_duration) / 100000) * sampleRate) / 4000) * 0.1
console.log(scale)
// console.log(metaInfo.time_duration)
if (scale > 500) {
scale = '1000'
} else if (scale > 200) {
@@ -306,6 +307,8 @@ export default {
if (this.axisXDataType.description === 'Time') {
const sampleRate = metaInfo.parameter_set.SAMPLE_RATE / 10
scale = (((timeDur / 100000) * sampleRate) / 4000) * 0.1
console.log(scale)
// console.log(timeDur)
if (scale > 500) {
scale = '1000'
} else if (scale > 200) {
@@ -20,7 +20,6 @@
<script>
import { mapFields } from 'vuex-map-fields'
import { newChartMode } from '@/factories/chart/chartFactory'
export default {
name: 'change-axis',
@@ -59,7 +58,7 @@ export default {
}
} else if (this.deviceName === 'elite') {
// use state meta to decide which default unit need to be used (like check I-V mode...)
const setting = newChartMode(this.metaList[this.metaIndex].parameter_set.MODE)
const setting = this.GLOBAL.getDefaultChartTypeByMode(this.metaList[this.metaIndex].parameter_set.MODE)
const xType = setting[0]
const xValue = setting[1]
const yType = setting[2]
@@ -31,7 +31,7 @@ export default {
},
data () {
return {
showPanel: true,
showPanel: false,
metaID: 0,
showWhichCycles: '',
cycleNum: 0,
@@ -71,10 +71,11 @@ export default {
},
methods: {
init () {
this.isThisModeHasCycle = this.GLOBAL.hasCycleMode(this.metaList[this.metaIndex].parameter_set.MODE)
this.cycleNum = this.metaList[this.metaIndex].parameter_set.CYCLE_NUMBER
this.metaID = this.metaList[this.metaIndex].id
if (this.cycleNum === 0) {
this.showPanel = false
if (this.isThisModeHasCycle === true) {
this.showPanel = true
}
},
clear () {
@@ -82,7 +83,7 @@ export default {
},
setCycle () {
console.log('setCycle')
if (this.cycleNum !== 0) {
if (this.isThisModeHasCycle === true) {
// get cycle data
const scaleDataNum = this.recInfo[this.metaID][this.cycleDataID][this.currentScale].length
// console.log(scaleDataNum)
@@ -12,7 +12,6 @@
import { mapMutations } from 'vuex'
import { mapFields } from 'vuex-map-fields'
import types from '@/store/modules/analysis/replay/types'
import { newChartMode } from '@/factories/chart/chartFactory'
export default {
name: 'change-unit',
@@ -53,7 +52,7 @@ export default {
}
} else if (this.deviceName === 'elite') {
// use state meta to decide which default unit need to be used (like check I-V mode...)
const setting = newChartMode(this.metaList[this.metaIndex].parameter_set.MODE)
const setting = this.GLOBAL.getDefaultChartTypeByMode(this.metaList[this.metaIndex].parameter_set.MODE)
const xType = setting[0]
const xValue = setting[1]
const yType = setting[2]
@@ -0,0 +1,83 @@
<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>
@@ -362,6 +362,10 @@
<div v-if="workingModeSelect != null && workingModeSelect.id == 14">
<elite-parameter-recording-elite-pulse-sensing :ref="'PulseSensingMode'" :deviceID="deviceID" :deviceName="deviceName"/>
</div>
<div v-if="workingModeSelect != null && workingModeSelect.id == 15">
<elite-parameter-recording-elite-d-p-v :ref="'DPVMode'" :deviceID="deviceID" :deviceName="deviceName"/>
</div>
</va-tree-root>
</div>
</template>
@@ -378,6 +382,7 @@ 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'
export default {
name: 'EliteParameterRecordingElitezm15',
@@ -391,6 +396,7 @@ export default {
ScanRateRange,
ResolutionRange,
EliteParameterRecordingElitePulseSensing,
EliteParameterRecordingEliteDPV,
},
props: {
deviceID: {
@@ -471,6 +477,10 @@ export default {
id: 14,
description: 'Pulse Sensing',
},
{
id: 15,
description: 'Differential Pulse Voltammetry (DPV)',
},
],
currentRangeSelect: null,
currentRangeOptions: [
@@ -753,6 +763,10 @@ export default {
if (this.$refs.PulseSensingMode != null) {
this.$refs.PulseSensingMode.refresh()
}
if (this.$refs.DPVMode != null) {
this.$refs.DPVMode.refresh()
}
},
workingModeSelectChange (val) {
if (this.workingModeSelect.id === -1) {
@@ -241,22 +241,24 @@
<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="timeRangeChange(1, 0)">
<!-- <va-button slot="append" class="mr-2 pa-1 shrink" small @click="timeRangeChange(1, 0.1)">
0.1
</va-button>
</va-button> -->
<va-input
@keyup.enter="timeRangeChange(1, t1RangeInput)"
v-model="t1RangeInput"
class="mb-0"
:label="'T1 RANGE'"
:error="TRangeErrorMsgList[0].showError"
:error-messages="TRangeErrorMsgList[0].errorMsg"
>
<p slot="append" style="margin-right: 0;" small>
{{unitOptions[unitSelect].label}}
</p>
</va-input>
<va-button slot="append" class="ml-2 pa-1 shrink" small @click="timeRangeChange(1, 10.23)">
<!-- <va-button slot="append" class="ml-2 pa-1 shrink" small @click="timeRangeChange(1, 10.23)">
10.23
</va-button>
</va-button> -->
</div>
</div>
</div>
@@ -264,22 +266,24 @@
<div class="row" v-if="patternModeSelect==1">
<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="timeRangeChange(2, 0)">
<!-- <va-button slot="append" class="mr-2 pa-1 shrink" small @click="timeRangeChange(2, 0)">
0
</va-button>
</va-button> -->
<va-input
@keyup.enter="timeRangeChange(2, t2RangeInput)"
v-model="t2RangeInput"
class="mb-0"
:label="'T2 RANGE'"
:error="TRangeErrorMsgList[1].showError"
:error-messages="TRangeErrorMsgList[1].errorMsg"
>
<p slot="append" style="margin-right: 0;" small>
{{unitOptions[unitSelect].label}}
</p>
</va-input>
<va-button slot="append" class="ml-2 pa-1 shrink" small @click="timeRangeChange(2, 10.23)">
<!-- <va-button slot="append" class="ml-2 pa-1 shrink" small @click="timeRangeChange(2, 10.23)">
10.23
</va-button>
</va-button> -->
</div>
</div>
</div>
@@ -287,22 +291,24 @@
<div class="row" v-if="patternModeSelect==1">
<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="timeRangeChange(3, 0)">
<!-- <va-button slot="append" class="mr-2 pa-1 shrink" small @click="timeRangeChange(3, 0.1)">
0.1
</va-button>
</va-button> -->
<va-input
@keyup.enter="timeRangeChange(3, t3RangeInput)"
v-model="t3RangeInput"
class="mb-0"
:label="'T3 RANGE'"
:error="TRangeErrorMsgList[2].showError"
:error-messages="TRangeErrorMsgList[2].errorMsg"
>
<p slot="append" style="margin-right: 0;" small>
{{unitOptions[unitSelect].label}}
</p>
</va-input>
<va-button slot="append" class="ml-2 pa-1 shrink" small @click="timeRangeChange(3, 10.23)">
<!-- <va-button slot="append" class="ml-2 pa-1 shrink" small @click="timeRangeChange(3, 10.23)">
10.23
</va-button>
</va-button> -->
</div>
</div>
</div>
@@ -310,22 +316,25 @@
<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="timeRangeChange(4, 0)">
<!-- <va-button slot="append" class="mr-2 pa-1 shrink" small @click="timeRangeChange(4, 0)">
0
</va-button>
</va-button> -->
<va-input
@keyup.enter="timeRangeChange(4, t4RangeInput)"
readonly
v-model="t4RangeInput"
class="mb-0"
:label="'T4 RANGE'"
:error="TRangeErrorMsgList[3].showError"
:error-messages="TRangeErrorMsgList[3].errorMsg"
>
<p slot="append" style="margin-right: 0;" small>
{{unitOptions[unitSelect].label}}
</p>
</va-input>
<va-button slot="append" class="ml-2 pa-1 shrink" small @click="timeRangeChange(4, 1310.71)">
<!-- <va-button slot="append" class="ml-2 pa-1 shrink" small @click="timeRangeChange(4, 1310.71)">
1310.71
</va-button>
</va-button> -->
</div>
</div>
</div>
@@ -352,7 +361,9 @@
<script>
import { taskInfo } from '../../../../data/task/TaskInfo'
import { mapActions, mapMutations } from 'vuex'
import { mapFields } from 'vuex-map-fields'
import types from '@/store/modules/task/content/types'
export default {
name: 'NeuliveParameterStimulation',
@@ -449,6 +460,7 @@ export default {
'posChannelList',
'negChannelList',
'stimulateElectrodeSelect',
'TRangeErrorMsgList',
]),
stimulateDisable () {
// posChannel and negChannel at least one && t1 ~ t4 > 0
@@ -488,7 +500,7 @@ export default {
this.t4RangeInput = String((this.t4Range * 10) / this.unitMultiply)
this.t4RangeArray.fill(this.t4Range, 0)
if (this.pattternModeSelect === 0) {
if (this.patternModeSelect === 0) {
this.periodNumber = (this.t1Range + this.t4Range) * 10
} else {
this.periodNumber = (this.t1Range + this.t2Range + this.t3Range + this.t4Range) * 10
@@ -546,11 +558,11 @@ export default {
// console.log(this.frequencyNumberInput)
},
transUnit () {
if (this.unitSelect === 0) {
if (this.unitSelect === 0) { // s
this.unitMultiply = 1000000
} else if (this.unitSelect === 1) {
} else if (this.unitSelect === 1) { // ms
this.unitMultiply = 1000
} else {
} else { // us
this.unitMultiply = 1
}
this.refresh()
@@ -665,197 +677,215 @@ export default {
}))
}
},
checkDivisible (x, y) { //
if (Number.isInteger(y / x)) {
return true
}
return false
},
patternModeSelectChange () {
if (this.patternModeSelect == null) {
return false
}
this.t1Range = 10
this.t1RangeInput = String((this.t1Range * 10) / this.unitMultiply)
if (this.patternModeSelect === 0) {
this.t2Range = 0
this.t2RangeInput = '0'
this.t3Range = 0
this.t3RangeInput = '0'
this.t4Range = (this.periodNumber / 10) - this.t1Range
this.t4RangeInput = String((this.t4Range * 10) / this.unitMultiply)
} else {
this.t3Range = this.t1Range
this.t3RangeInput = this.t1RangeInput
this.t4Range = (this.periodNumber / 10) - this.t1Range - this.t2Range - this.t3Range
this.t4RangeInput = String((this.t4Range * 10) / this.unitMultiply)
}
if (this.t4Range < 0) {
this.refreshPattern()
this.pageToast('T4 Range will be negative, so reset')
} else {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: 'STI_PATTERN',
content: this.patternModeSelect,
}))
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: 'STI_PATTERN',
content: this.patternModeSelect,
}))
this.autoComputeT4()
const check4 = this.checkIndividualTRange(4, this.t4Range)
if (check4) {
this.updateTimeRange()
}
},
frequencyNumberChange (val) {
if (this.frequencyNumberInput == null) {
if (this.frequencyNumberInput == null || isNaN(val)) {
return false
}
if (typeof (val) === 'string') {
if (isNaN(val) || parseInt(val) < 1 || parseInt(val) > 10000) {
this.frequencyNumberInput = '100'
this.frequencyNumber = 100
}
if (parseInt(this.frequencyNumberInput) !== parseInt(this.frequencyNumber)) {
this.frequencyNumber = parseInt(val)
}
val = parseInt(val)
if (val < 1) {
this.frequencyNumberInput = '1'
this.frequencyNumber = 1
this.pageToast('Reset to 1 Hz')
} else if (val > 20000) {
this.frequencyNumberInput = '20000'
this.frequencyNumber = 20000
this.pageToast('Reset to 20000 Hz')
} else {
this.frequencyNumberInput = val.toString()
this.frequencyNumber = val
}
this.periodNumber = (1 / this.frequencyNumber * 1e6).toFixed(3)
this.periodNumber = (1e6 / this.frequencyNumber).toFixed(3) // us
this.periodNumberInput = String(this.periodNumber / this.unitMultiply)
if (this.checkDivisible(this.unitMultiply, this.periodNumber)) {
this.t1Range = 10
this.t1RangeInput = String((this.t1Range * 10) / this.unitMultiply)
if (this.patternModeSelect === 0) {
this.t3Range = 0
} else if (this.patternModeSelect === 1) {
this.t3Range = 10
}
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)
if (this.t4Range < 0) {
this.refreshPattern()
this.pageToast('T4 Range will be negative, so reset')
} else {
this.updateTimeRange()
}
} else {
this.refreshPattern()
this.pageToast('Frequency cannot be divided by 1s, so reset')
this.autoResetAllTRange()
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 && check2 && check3 && check4) {
this.updateTimeRange()
}
},
periodNumberChange (val) {
if (this.periodNumberInput === null) {
const usVal = parseFloat(val * this.unitMultiply) // us
if (this.periodNumberInput == null || isNaN(usVal)) {
return false
}
if (typeof (val) === 'string') {
if (isNaN(val) || parseFloat(val) < 0 || parseFloat(val / this.unitMultiply) > 1) {
this.periodNumber = 1000
this.periodNumberInput = String(this.periodNumber / this.unitMultiply)
}
if (parseInt(this.periodNumberInput) !== parseInt(this.periodNumber)) {
this.periodNumber = parseFloat(val * this.unitMultiply)
this.periodNumberInput = val
}
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')
} else if (usVal > 1e6) { // freq: 1 to 20000Hz, so period < 1e6us (1e6/1e6=1)
this.periodNumber = 1e6
this.periodNumberInput = String(1e6 / this.unitMultiply)
this.pageToast('Reset to 1 s')
} else {
this.periodNumber = usVal
this.periodNumberInput = val
}
this.frequencyNumber = parseInt(1 / (this.periodNumber * 1e-6))
this.frequencyNumber = parseInt(1e6 / this.periodNumber)
this.frequencyNumberInput = String(this.frequencyNumber)
this.t1Range = 10
this.t1RangeInput = String((this.t1Range * 10) / this.unitMultiply)
if (this.patternModeSelect === 0) {
this.t3Range = 0
} else if (this.patternModeSelect === 1) {
this.t3Range = 10
}
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)
this.autoResetAllTRange()
if (this.t4Range < 0) {
this.refreshPattern()
this.pageToast('T4 Range will be negative, so reset')
} else {
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 && check2 && check3 && check4) {
this.updateTimeRange()
}
},
timeRangeChange (stiIimeSelect, val) {
if (parseInt(val) < 0) {
this.refreshPattern()
this.pageToast('Value cannot be negative, so reset')
}
switch (stiIimeSelect) {
case 1:
if (parseInt(val) === 0) {
this.t1Range = 10
this.t1RangeInput = String((this.t1Range * 10) / this.unitMultiply)
if (this.patternModeSelect === 1) {
this.t3Range = 10
this.t3RangeInput = String((this.t3Range * 10) / this.unitMultiply)
}
} else {
this.t1Range = parseInt((val * this.unitMultiply) / 10)
this.t1RangeInput = val
if (this.patternModeSelect === 1) {
this.t3Range = parseInt((val * this.unitMultiply) / 10)
this.t3RangeInput = val
}
}
break
case 2:
this.t2Range = parseInt((val * this.unitMultiply) / 10)
this.t2RangeInput = val
break
case 3:
if (parseInt(val) === 0) {
this.t1Range = 10
this.t1RangeInput = String((this.t1Range * 10) / this.unitMultiply)
this.t3Range = 10
this.t3RangeInput = String((this.t3Range * 10) / this.unitMultiply)
} else {
this.t1Range = parseInt((val * this.unitMultiply) / 10)
this.t1RangeInput = val
this.t3Range = parseInt((val * this.unitMultiply) / 10)
this.t3RangeInput = val
}
break
case 4:
this.t4Range = parseInt((val * this.unitMultiply) / 10)
this.t4RangeInput = val
if (this.frequencyNumber > 0) {
if (this.patternModeSelect === 0) {
this.t2Range = 0
this.t3Range = 0
this.t1Range = (this.periodNumber / 10) - this.t2Range - this.t3Range - this.t4Range
this.t1RangeInput = String((this.t1Range * 10) / this.unitMultiply)
if (parseInt(this.t1Range) < 0) {
this.refreshPattern()
this.pageToast('T1 value will be negative, so reset')
return
}
} else if (this.patternModeSelect === 1) {
this.t2Range = (this.periodNumber / 10) - this.t1Range - this.t3Range - this.t4Range
this.t2RangeInput = String((this.t2Range * 10) / this.unitMultiply)
if (parseInt(this.t2Range) < 0) {
this.refreshPattern()
this.pageToast('T2 value will be negative, so reset')
return
}
}
}
break
}
if (this.frequencyNumber > 0 && stiIimeSelect !== 4) {
this.t4Range = (this.periodNumber / 10) - this.t1Range - this.t2Range - this.t3Range
autoResetAllTRange () {
if (this.patternModeSelect === 0) { // Monophasic
this.t1Range = 10
this.t1RangeInput = String((this.t1Range * 10) / this.unitMultiply)
this.t4Range = this.periodNumber / 10 - this.t1Range
this.t4RangeInput = String((this.t4Range * 10) / this.unitMultiply)
} else if (this.patternModeSelect === 1) { // Biphasic
this.t1Range = 10
this.t1RangeInput = String((this.t1Range * 10) / this.unitMultiply)
this.t2Range = 10
this.t2RangeInput = String((this.t2Range * 10) / this.unitMultiply)
this.t3Range = 10
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)
}
},
timeRangeChange (stiIimeSelect, inputVal) {
inputVal = parseFloat(inputVal)
if (this.t4Range < 0) {
this.refreshPattern()
this.pageToast('T4 Range will be negative, so reset')
} else {
switch (stiIimeSelect) {
case 1:
this.t1RangeInput = inputVal
this.t1Range = parseFloat((inputVal * this.unitMultiply) / 10)
this.autoComputeT4()
break
case 2:
this.t2RangeInput = inputVal
this.t2Range = parseFloat((inputVal * this.unitMultiply) / 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
}
const overallStatus = this.checkOverallTRange()
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 (overallStatus && status1 && status2 && status3 && status4) {
this.resetAllTRangeErrorMsgParam({ totalT: 4 })
this.updateTimeRange()
}
},
autoComputeT4 () {
if (this.patternModeSelect === 0) {
this.t4Range = (this.periodNumber / 10) - this.t1Range
this.t4RangeInput = String((this.t4Range * 10) / this.unitMultiply)
this.pageToast('Auto complete T4 value')
} else if (this.patternModeSelect === 1) {
this.t4Range = (this.periodNumber / 10) - this.t1Range - this.t2Range - this.t3Range
this.t4RangeInput = String((this.t4Range * 10) / this.unitMultiply)
this.pageToast('Auto complete T4 value')
}
},
checkOverallTRange () {
let status = true
if (this.t1Range > this.periodNumber) {
this.updateTRangeErrorMsgParam({ stiIimeSelect: 1, status: true, msg: 'T1 > Period' })
status = false
}
if (this.t2Range > this.periodNumber) {
this.updateTRangeErrorMsgParam({ stiIimeSelect: 2, status: true, msg: 'T2 > Period' })
status = false
}
if (this.t3Range > this.periodNumber) {
this.updateTRangeErrorMsgParam({ stiIimeSelect: 3, status: true, msg: 'T3 > Period' })
status = false
}
if (this.t4Range > this.periodNumber) {
this.updateTRangeErrorMsgParam({ stiIimeSelect: 4, status: true, msg: 'T4 > Period' })
status = false
}
return status
},
checkIndividualTRange (stiIimeSelect, val) {
// val unit: us
val = parseFloat(val) * 10 // UI us
if (val < 0 || isNaN(val)) {
this.updateTRangeErrorMsgParam({ stiIimeSelect: stiIimeSelect, status: true, msg: 'T > 0' })
return false
}
switch (stiIimeSelect) {
case 1:
if (val < 100 || val > 10230) { // us
this.updateTRangeErrorMsgParam({ stiIimeSelect: stiIimeSelect, status: true, msg: '0.1ms <= T1 <= 10.23ms' })
return false
} else {
this.updateTRangeErrorMsgParam({ stiIimeSelect: stiIimeSelect, status: false, msg: '' })
return true
}
case 2:
if (val < 0 || val > 10230) { // us
this.updateTRangeErrorMsgParam({ stiIimeSelect: stiIimeSelect, status: true, msg: '0ms <= T2 <= 10.23ms' })
return false
} else {
this.updateTRangeErrorMsgParam({ stiIimeSelect: stiIimeSelect, status: false, msg: '' })
return true
}
case 3:
if (val < 100 || val > 10230) { // us
this.updateTRangeErrorMsgParam({ stiIimeSelect: stiIimeSelect, status: true, msg: '0.1ms <= T3 <= 10.23ms' })
return false
} else {
this.updateTRangeErrorMsgParam({ stiIimeSelect: stiIimeSelect, status: false, msg: '' })
return true
}
case 4:
if (val < 0 || val > 1310710) { // us
this.updateTRangeErrorMsgParam({ stiIimeSelect: stiIimeSelect, status: true, msg: '0ms <= T4 <= 1310.71ms' })
return false
} else {
this.updateTRangeErrorMsgParam({ stiIimeSelect: stiIimeSelect, status: false, msg: '' })
return true
}
}
},
updateStiChannel () {
// stiChannelSet (+,-), stiPolaritySet (+)
let stiChannelSet = ''
@@ -930,6 +960,12 @@ export default {
},
)
},
...mapActions('taskContent', [types.param.resetAllTRangeErrorMsg]),
...mapMutations('taskContent', [types.param.initTRangeErrorMsgList, types.param.updateTRangeErrorMsg]),
},
created () {
this.initTRangeErrorMsgListParam({ totalT: 4 })
},
mounted () {
this.refresh()
@@ -0,0 +1,98 @@
<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)" />
</div>
</template>
<script>
import { taskInfo } from '@/data/task/TaskInfo'
import EInitial from './EInitial'
import E1 from './E1'
import E2 from './E2'
import EFinal from './EFinal'
import PulseAmp from './PulseAmp'
import PulseWidth from './PulseWidth'
import Increment from './Increment'
import StepTime from './StepTime'
import CurrentRecordingPeriod from './CurrentRecordingPeriod'
export default {
name: 'SegmentBlock',
components: {
EInitial,
E1,
E2,
EFinal,
PulseAmp,
PulseWidth,
Increment,
StepTime,
CurrentRecordingPeriod,
},
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.PulseAmp != null) {
this.$refs.PulseAmp.refresh()
}
if (this.$refs.PulseWidth != null) {
this.$refs.PulseWidth.refresh()
}
if (this.$refs.Increment != null) {
this.$refs.Increment.refresh()
}
if (this.$refs.StepTime != null) {
this.$refs.StepTime.refresh()
}
},
},
mounted () {
this.refresh()
},
watch: {
},
destroyed () {
},
}
</script>
@@ -0,0 +1,89 @@
<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)" />
</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 StepTime from './StepTime'
export default {
name: 'SegmentBlock',
components: {
EInitial,
EFinal,
PulseAmp,
PulseWidth,
Increment,
StepTime,
},
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.PulseAmp != null) {
this.$refs.PulseAmp.refresh()
}
if (this.$refs.PulseWidth != null) {
this.$refs.PulseWidth.refresh()
}
if (this.$refs.Increment != null) {
this.$refs.Increment.refresh()
}
if (this.$refs.StepTime != null) {
this.$refs.StepTime.refresh()
}
},
},
mounted () {
this.refresh()
},
watch: {
},
destroyed () {
},
}
</script>
@@ -0,0 +1,119 @@
<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>
<div class="flex sm12 xl12 md12 xs12" :key="inputeKey">
<va-slider
@mouseup.native="itemChange(itemInput)"
@mouseleave.native="itemChange(itemInput)"
@touchend.native="itemChange(itemInput)"
pins
:min="0"
:max="90"
value-visible
:step="10"
v-model="itemInput"
/>
</div>
</div>
</template>
<script>
import { taskInfo } from '@/data/task/TaskInfo'
export default {
name: 'CurrentRecordingPeriod',
components: {
},
props: {
deviceID: {
type: Number,
required: true,
},
parameterName: {
type: String,
required: true,
},
},
created () {
},
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,
}
},
mqtt: {
},
methods: {
itemChange (val) {
this.itemInput = val
this.$emit('parameterChange', [this.parameterName, val])
},
checkSliderRange (duration) {
if (duration <= 10) {
this.disableSlider = true
} 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])
}
}
},
refresh () {
// this.itemInput
// this.duration = Math.round(taskInfo.getDeviceInfo(this.deviceID).parameterSet['t_pulse_' + String(this.segmentID)]) / 10
},
},
async mounted () {
// this.checkSliderRange(this.duration)
},
destroyed () {
},
watch: {
},
}
</script>
<style lang="scss">
.flex-container {
display: flex;
}
.flex-child {
flex: 2;
}
.flex-child2 {
flex: 0;
}
.flex-child:first-child {
margin-right: 1px;
}
</style>
@@ -0,0 +1,121 @@
<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>
</template>
<script>
import { taskInfo } from '@/data/task/TaskInfo'
export default {
name: 'E1',
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)] - 25000) / 5)),
unitSelect: 'mV',
unitClickTime: 0,
showError: false,
errorMsg: [''],
}
},
mqtt: {
},
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) {
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])
}
},
unitChange () {
this.unitClickTime += 1
if (this.unitClickTime % 2 === 0) {
this.unitSelect = 'mV'
this.itemInput = String(parseFloat(this.itemInput) * 1000)
} else {
this.unitSelect = 'V'
this.itemInput = String(parseFloat(this.itemInput) / 1000)
}
},
refresh () {
let volt = Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)
if (this.unitSelect === 'V') {
volt /= 1000
}
this.itemInput = String(volt)
},
},
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>
@@ -0,0 +1,121 @@
<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>
</template>
<script>
import { taskInfo } from '@/data/task/TaskInfo'
export default {
name: 'E2',
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)] - 25000) / 5)),
unitSelect: 'mV',
unitClickTime: 0,
showError: false,
errorMsg: [''],
}
},
mqtt: {
},
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) {
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])
}
},
unitChange () {
this.unitClickTime += 1
if (this.unitClickTime % 2 === 0) {
this.unitSelect = 'mV'
this.itemInput = String(parseFloat(this.itemInput) * 1000)
} else {
this.unitSelect = 'V'
this.itemInput = String(parseFloat(this.itemInput) / 1000)
}
},
refresh () {
let volt = Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)
if (this.unitSelect === 'V') {
volt /= 1000
}
this.itemInput = String(volt)
},
},
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>
@@ -0,0 +1,121 @@
<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>
</template>
<script>
import { taskInfo } from '@/data/task/TaskInfo'
export default {
name: 'EFinal',
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)] - 25000) / 5)),
unitSelect: 'mV',
unitClickTime: 0,
showError: false,
errorMsg: [''],
}
},
mqtt: {
},
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) {
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])
}
},
unitChange () {
this.unitClickTime += 1
if (this.unitClickTime % 2 === 0) {
this.unitSelect = 'mV'
this.itemInput = String(parseFloat(this.itemInput) * 1000)
} else {
this.unitSelect = 'V'
this.itemInput = String(parseFloat(this.itemInput) / 1000)
}
},
refresh () {
let volt = Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)
if (this.unitSelect === 'V') {
volt /= 1000
}
this.itemInput = String(volt)
},
},
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>
@@ -0,0 +1,121 @@
<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>
</template>
<script>
import { taskInfo } from '@/data/task/TaskInfo'
export default {
name: 'EInitial',
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)] - 25000) / 5)),
unitSelect: 'mV',
unitClickTime: 0,
showError: false,
errorMsg: [''],
}
},
mqtt: {
},
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) {
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])
}
},
unitChange () {
this.unitClickTime += 1
if (this.unitClickTime % 2 === 0) {
this.unitSelect = 'mV'
this.itemInput = String(parseFloat(this.itemInput) * 1000)
} else {
this.unitSelect = 'V'
this.itemInput = String(parseFloat(this.itemInput) / 1000)
}
},
refresh () {
let volt = Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)
if (this.unitSelect === 'V') {
volt /= 1000
}
this.itemInput = String(volt)
},
},
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>
@@ -0,0 +1,121 @@
<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>
</template>
<script>
import { taskInfo } from '@/data/task/TaskInfo'
export default {
name: 'Increment',
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)] - 25000) / 5)),
unitSelect: 'mV',
unitClickTime: 0,
showError: false,
errorMsg: [''],
}
},
mqtt: {
},
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) {
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])
}
},
unitChange () {
this.unitClickTime += 1
if (this.unitClickTime % 2 === 0) {
this.unitSelect = 'mV'
this.itemInput = String(parseFloat(this.itemInput) * 1000)
} else {
this.unitSelect = 'V'
this.itemInput = String(parseFloat(this.itemInput) / 1000)
}
},
refresh () {
let volt = Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)
if (this.unitSelect === 'V') {
volt /= 1000
}
this.itemInput = String(volt)
},
},
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>
@@ -0,0 +1,121 @@
<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>
</template>
<script>
import { taskInfo } from '@/data/task/TaskInfo'
export default {
name: 'PulseAmp',
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)] - 25000) / 5)),
unitSelect: 'mV',
unitClickTime: 0,
showError: false,
errorMsg: [''],
}
},
mqtt: {
},
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) {
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])
}
},
unitChange () {
this.unitClickTime += 1
if (this.unitClickTime % 2 === 0) {
this.unitSelect = 'mV'
this.itemInput = String(parseFloat(this.itemInput) * 1000)
} else {
this.unitSelect = 'V'
this.itemInput = String(parseFloat(this.itemInput) / 1000)
}
},
refresh () {
let volt = Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)
if (this.unitSelect === 'V') {
volt /= 1000
}
this.itemInput = String(volt)
},
},
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>
@@ -0,0 +1,130 @@
<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>
</template>
<script>
import { taskInfo } from '@/data/task/TaskInfo'
export default {
name: 'PulseWidth',
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>
@@ -0,0 +1,130 @@
<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>
@@ -53,7 +53,7 @@ export default {
data () {
return {
disableSlider: false,
sliderMin: 0,
sliderMin: 35,
sliderMax: 100,
currentRange: [],
inputeKey: 0,
@@ -123,7 +123,7 @@ export default {
}
},
reset () {
this.$emit('parameterChange', [this.parameterName + 'START_' + String(this.segmentID), 5])
this.$emit('parameterChange', [this.parameterName + 'START_' + String(this.segmentID), 35])
this.$emit('parameterChange', [this.parameterName + 'END_' + String(this.segmentID), 95])
},
refresh () {
@@ -1,5 +1,5 @@
<template>
<div>
<div class="block">
<div class="row flex sm12 xl12 md12 xs12 align--center">
<div class="flex sm11 xl11 md11 xs11 px-0 mx-0">
<p class="display-6">- Segment {{ segmentIndex + 1 }} - <p/>
@@ -104,6 +104,14 @@ export default {
</script>
<style lang="scss">
.block {
opacity: 1;
}
.block:hover {
background-color: #d3d3d3;
}
.flex-container {
display: flex;
}
+30
View File
@@ -9,6 +9,34 @@ const ChannelMaxNumber = 16
// const getTimeInDateTime = /(\d{4}),(\d{1,2}),(\d{1,2}),(\d{1,2}),(\d{1,2}),(\d{1,2})/
const hasCycleMode = (mode) => {
if (mode === 1 || mode === 7 || mode === 14) {
return true
}
return false
}
const getDefaultChartTypeByMode = (mode) => {
// 1: I, 2: V, 3: R
const settings = {}
settings[0] = ['Elite', 2, 'Elite', 1]
settings[1] = ['Elite', 2, 'Elite', 1]
settings[2] = ['Time', 2, 'Elite', 2]
settings[3] = ['Time', 2, 'Elite', 3]
settings[4] = ['Time', 2, 'Elite', 2]
settings[5] = ['Time', 2, 'Elite', 1]
settings[6] = ['Time', 2, 'Elite', 2]
settings[7] = ['Elite', 2, 'Elite', 1]
settings[8] = ['Elite', 2, 'Elite', 1]
settings[9] = ['Time', 2, 'Elite', 1]
settings[10] = ['Elite', 2, 'Elite', 1]
settings[11] = ['Time', 2, 'Elite', 1]
settings[13] = ['Time', 2, 'Elite', 2]
settings[14] = ['Time', 2, 'Elite', 2]
settings[15] = ['Elite', 2, 'Elite', 1]
return settings[mode]
}
const transMac = (rawAddr) => {
let _address = ''
rawAddr.forEach(addr => {
@@ -84,6 +112,8 @@ const dateToStr = (time) => {
export default
{
hasCycleMode,
getDefaultChartTypeByMode,
transMac,
transFileSize,
transTime,
+3 -2
View File
@@ -1,10 +1,11 @@
import newDataZoom from '@/factories/chart/dataZoomFactory'
import newChart, { newChartMode } from '@/factories/chart/chartFactory'
import newChart from '@/factories/chart/chartFactory'
import newTooltip from '@/factories/chart/tooltipFactory'
// import newInterval from '@/factories/chart/intervalFactory'
import newSeries from '@/factories/chart/seriesFactory'
import { dataStreamBuffer } from './DataStreamBuffer'
import { taskInfo } from './TaskInfo'
import global_ from '@/data/global/global'
function getIndexArrayForBalenceSampleRate (indexArray, dis, l) {
if (indexArray.length >= 3 || dis <= 0) {
@@ -683,7 +684,7 @@ export const chartData = {
const _chartRegisterDevice = (chartID, device) => {
if (taskInfo.getDeviceInfo(device.id).info.library_name.indexOf('Elite') >= 0) {
const setting = newChartMode(taskInfo.getDeviceInfo(device.id).parameterSet.MODE)
const setting = global_.getDefaultChartTypeByMode(taskInfo.getDeviceInfo(device.id).parameterSet.MODE)
console.log(setting)
const xType = setting[0]
const xValue = setting[1]
-21
View File
@@ -32,25 +32,4 @@ function newChart (chartID) {
}
}
function newChartMode (mode) {
// 1: I, 2: V, 3: R
const settings = {}
settings[0] = ['Elite', 2, 'Elite', 1]
settings[1] = ['Elite', 2, 'Elite', 1]
settings[2] = ['Time', 2, 'Elite', 2]
settings[3] = ['Time', 2, 'Elite', 3]
settings[4] = ['Time', 2, 'Elite', 2]
settings[5] = ['Time', 2, 'Elite', 1]
settings[6] = ['Time', 2, 'Elite', 2]
settings[7] = ['Elite', 2, 'Elite', 1]
settings[8] = ['Elite', 2, 'Elite', 1]
settings[9] = ['Time', 2, 'Elite', 1]
settings[10] = ['Elite', 2, 'Elite', 1]
settings[11] = ['Time', 2, 'Elite', 1]
settings[13] = ['Time', 2, 'Elite', 2]
settings[14] = ['Time', 2, 'Elite', 2]
return settings[mode]
}
export default newChart
export { newChartMode }
@@ -99,8 +99,8 @@ const chartMutations = {
label += millisecond + ' ms '
}
} else { // not time, e.g. I, V, R
const num = val / unitScale
label = num.toExponential(3) + unit
const num = String(val / unitScale)
label = num + unit
}
return label
}
@@ -1,13 +1,18 @@
// import types from '@/store/modules/task/content/types'
import types from '@/store/modules/task/content/types'
// const typePath = types.param
const typePath = types.param
const paramActs = {
// [typePath.updateDisplaySetting]: async ({ state, getters, commit }, payload) => {
// commit(typePath.updateDisplaySetting, {
// updateObject: payload.updateObject,
// })
// },
/**
* reset all t range error msg
*
* @param {int} totalT
*/
[typePath.resetAllTRangeErrorMsg]: async ({ state, getters, commit }, payload) => {
for (let i = 1; i <= payload.totalT; i++) {
commit(typePath.updateTRangeErrorMsg, { stiIimeSelect: i, status: false, msg: '' })
}
},
}
export default paramActs
@@ -42,7 +42,16 @@ const paramGet = {
}
if (state.posChannelList.length <= 0 || state.negChannelList.length <= 0) { // 且要有正有負
status = false
message += '\nBipolar need at least one positive and one negative channel'
message += '\nBipolar need at least one positive and one negative channel,'
}
}
const tRangeLength = state.TRangeErrorMsgList.length
for (let i = 0; i < tRangeLength; i++) {
if (state.TRangeErrorMsgList[i].showError === true) {
status = false
message += '\nStimulation T ranges are not set correctly'
break
}
}
return { status: status, message: message }
@@ -1,16 +1,31 @@
// import types from '@/store/modules/task/content/types'
import types from '@/store/modules/task/content/types'
// const typePath = types.param
const typePath = types.param
const paramMutations = {
// /**
// * set rec list
// *
// * @param {object} data
// */
// [typePath.set]: async (state, payload) => {
// state.recInfo = payload.data
// },
/**
* init TRange Error Msg List
*
* @param {int} totalT
*/
[typePath.initTRangeErrorMsgList]: (state, payload) => {
for (let i = 1; i <= payload.totalT; i++) {
state.TRangeErrorMsgList.push({ id: i, showError: false, errorMsg: [''] })
}
},
/**
* update individual t range error msg
*
* @param {int} stiIimeSelect
* @param {bool} status
* @param {string} msg
*/
[typePath.updateTRangeErrorMsg]: (state, payload) => {
const index = payload.stiIimeSelect - 1
state.TRangeErrorMsgList[index].showError = payload.status
state.TRangeErrorMsgList[index].errorMsg[0] = payload.msg
},
}
export default paramMutations
+3
View File
@@ -7,6 +7,9 @@ function newState () {
posChannelList: [],
negChannelList: [],
stimulateElectrodeSelect: 1, // 0 (monopolar) or 1 (bipolar)
TRangeErrorMsgList: [],
// TRangeErrorMsgList:[ { id: 1, showError: false, errorMsg: [''] }, { id: 2, showError: false, errorMsg: [''] }, { id: 3, showError: false, errorMsg: [''] }, { id: 4, showError: false, errorMsg: [''] } ],
}
}
+7 -1
View File
@@ -1,11 +1,17 @@
const types = {
param: {
initTRangeErrorMsgList: 'initTRangeErrorMsgListParam',
updateTRangeErrorMsg: 'updateTRangeErrorMsgParam',
resetAllTRangeErrorMsg: 'resetAllTRangeErrorMsgParam',
getIsRecordingParamSetDone: 'getIsRecordingParamSetDoneParam',
getIsStimulationParamSetDone: 'getIsStimulationParamSetDoneParam',
getIsParamSetDone: 'getIsParamSetDoneParam',
},
},
}
export default types