[add] neulive sti T range check point

This commit is contained in:
Jordan Hsu
2021-08-05 12:25:52 +08:00
parent 256070ae76
commit 6c5c832fde
5 changed files with 89 additions and 64 deletions
@@ -241,9 +241,9 @@
<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.1)">
<!-- <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"
@@ -256,9 +256,9 @@
{{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>
@@ -266,9 +266,9 @@
<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"
@@ -281,9 +281,9 @@
{{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>
@@ -291,9 +291,9 @@
<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.1)">
<!-- <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"
@@ -306,9 +306,9 @@
{{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>
@@ -316,11 +316,12 @@
<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'"
@@ -331,9 +332,9 @@
{{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>
@@ -360,7 +361,7 @@
<script>
import { taskInfo } from '../../../../data/task/TaskInfo'
import { mapMutations } from 'vuex'
import { mapActions, mapMutations } from 'vuex'
import { mapFields } from 'vuex-map-fields'
import types from '@/store/modules/task/content/types'
@@ -507,7 +508,7 @@ export default {
this.periodNumberInput = String((this.periodNumber) / this.unitMultiply)
if (this.periodNumber !== 0) {
this.frequencyNumber = parseInt(1e6 / this.periodNumber)
this.frequencyNumber = parseInt(1 / (this.periodNumber * 1e-6))
this.frequencyNumberInput = String(this.frequencyNumber)
}
},
@@ -687,6 +688,12 @@ export default {
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 || isNaN(val)) {
@@ -755,18 +762,18 @@ export default {
},
autoResetAllTRange () {
if (this.patternModeSelect === 0) { // Monophasic
this.t1Range = this.periodNumber * 0.5 / 10
this.t1Range = 10
this.t1RangeInput = String((this.t1Range * 10) / this.unitMultiply)
this.t4Range = this.periodNumber * 0.5 / 10
this.t4Range = this.periodNumber / 10 - this.t1Range
this.t4RangeInput = String((this.t4Range * 10) / this.unitMultiply)
} else if (this.patternModeSelect === 1) { // Biphasic
this.t1Range = this.periodNumber * 0.4 / 10
this.t1Range = 10
this.t1RangeInput = String((this.t1Range * 10) / this.unitMultiply)
this.t2Range = this.periodNumber * 0.1 / 10
this.t2Range = 10
this.t2RangeInput = String((this.t2Range * 10) / this.unitMultiply)
this.t3Range = this.periodNumber * 0.4 / 10
this.t3Range = 10
this.t3RangeInput = String((this.t3Range * 10) / this.unitMultiply)
this.t4Range = this.periodNumber * 0.1 / 10
this.t4Range = this.periodNumber / 10 - this.t1Range - this.t2Range - this.t3Range
this.t4RangeInput = String((this.t4Range * 10) / this.unitMultiply)
}
},
@@ -801,6 +808,7 @@ export default {
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()
}
},
@@ -815,85 +823,69 @@ export default {
this.pageToast('Auto complete T4 value')
}
},
checkOverallTRange () { // [TODO] updateErrorMsg
checkOverallTRange () {
let status = true
if (this.t1Range > this.periodNumber) {
this.updateTRangeErrorMsg(1, true, 'T1 > Period')
this.updateTRangeErrorMsgParam({ stiIimeSelect: 1, status: true, msg: 'T1 > Period' })
status = false
}
if (this.t2Range > this.periodNumber) {
this.updateTRangeErrorMsg(2, true, 'T2 > Period')
this.updateTRangeErrorMsgParam({ stiIimeSelect: 2, status: true, msg: 'T2 > Period' })
status = false
}
if (this.t3Range > this.periodNumber) {
this.updateTRangeErrorMsg(3, true, 'T3 > Period')
this.updateTRangeErrorMsgParam({ stiIimeSelect: 3, status: true, msg: 'T3 > Period' })
status = false
}
if (this.t4Range > this.periodNumber) {
this.updateTRangeErrorMsg(4, true, 'T4 > Period')
this.updateTRangeErrorMsgParam({ stiIimeSelect: 4, status: true, msg: 'T4 > Period' })
status = false
}
if (this.t1Range + this.t2Range + this.t3Range + this.t4Range !== this.periodNumber) {
this.updateTRangeErrorMsg(1, true, 'T1 + T2 + T3 + T4 != period')
status = false
}
this.resetAllTRangeErrorMsg()
return status
},
checkIndividualTRange (stiIimeSelect, val) { // [TODO] updateErrorMsg
checkIndividualTRange (stiIimeSelect, val) {
// val unit: us
val = parseFloat(val) * 10 // UI us
if (val < 0 || isNaN(val)) {
this.updateTRangeErrorMsg(stiIimeSelect, true, 'T > 0')
this.updateTRangeErrorMsgParam({ stiIimeSelect: stiIimeSelect, status: true, msg: 'T > 0' })
return false
}
switch (stiIimeSelect) {
case 1:
if (val < 100 || val > 10230) { // us
this.updateTRangeErrorMsg(stiIimeSelect, true, '0.1ms <= T1 <= 10.23ms')
this.updateTRangeErrorMsgParam({ stiIimeSelect: stiIimeSelect, status: true, msg: '0.1ms <= T1 <= 10.23ms' })
return false
} else {
this.updateTRangeErrorMsg(stiIimeSelect, false, '')
this.updateTRangeErrorMsgParam({ stiIimeSelect: stiIimeSelect, status: false, msg: '' })
return true
}
case 2:
if (val < 0 || val > 10230) { // us
this.updateTRangeErrorMsg(stiIimeSelect, true, '0ms <= T2 <= 10.23ms')
this.updateTRangeErrorMsgParam({ stiIimeSelect: stiIimeSelect, status: true, msg: '0ms <= T2 <= 10.23ms' })
return false
} else {
this.updateTRangeErrorMsg(stiIimeSelect, false, '')
this.updateTRangeErrorMsgParam({ stiIimeSelect: stiIimeSelect, status: false, msg: '' })
return true
}
case 3:
if (val < 100 || val > 10230) { // us
this.updateTRangeErrorMsg(stiIimeSelect, true, '0.1ms <= T3 <= 10.23ms')
this.updateTRangeErrorMsgParam({ stiIimeSelect: stiIimeSelect, status: true, msg: '0.1ms <= T3 <= 10.23ms' })
return false
} else {
this.updateTRangeErrorMsg(stiIimeSelect, false, '')
this.updateTRangeErrorMsgParam({ stiIimeSelect: stiIimeSelect, status: false, msg: '' })
return true
}
case 4:
if (val < 0 || val > 1310710) { // us
this.updateTRangeErrorMsg(stiIimeSelect, true, '0ms <= T4 <= 1310.71ms')
this.updateTRangeErrorMsgParam({ stiIimeSelect: stiIimeSelect, status: true, msg: '0ms <= T4 <= 1310.71ms' })
return false
} else {
this.updateTRangeErrorMsg(stiIimeSelect, false, '')
this.updateTRangeErrorMsgParam({ stiIimeSelect: stiIimeSelect, status: false, msg: '' })
return true
}
}
},
updateTRangeErrorMsg (stiIimeSelect, status, msg) {
const index = stiIimeSelect - 1
this.TRangeErrorMsgList[index].showError = status
this.TRangeErrorMsgList[index].errorMsg[0] = msg
},
resetAllTRangeErrorMsg () {
this.updateTRangeErrorMsg(1, false, '')
this.updateTRangeErrorMsg(2, false, '')
this.updateTRangeErrorMsg(3, false, '')
this.updateTRangeErrorMsg(4, false, '')
},
updateStiChannel () {
// stiChannelSet (+,-), stiPolaritySet (+)
let stiChannelSet = ''
@@ -969,7 +961,8 @@ export default {
)
},
...mapMutations('taskContent', [types.param.initTRangeErrorMsgList]),
...mapActions('taskContent', [types.param.resetAllTRangeErrorMsg]),
...mapMutations('taskContent', [types.param.initTRangeErrorMsgList, types.param.updateTRangeErrorMsg]),
},
created () {
this.initTRangeErrorMsgListParam({ totalT: 4 })
@@ -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 }
@@ -13,6 +13,19 @@ const paramMutations = {
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
+5
View File
@@ -3,9 +3,14 @@ const types = {
param: {
initTRangeErrorMsgList: 'initTRangeErrorMsgListParam',
updateTRangeErrorMsg: 'updateTRangeErrorMsgParam',
resetAllTRangeErrorMsg: 'resetAllTRangeErrorMsgParam',
getIsRecordingParamSetDone: 'getIsRecordingParamSetDoneParam',
getIsStimulationParamSetDone: 'getIsStimulationParamSetDoneParam',
getIsParamSetDone: 'getIsParamSetDoneParam',
},
}