Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 00b45f637c | |||
| e1d4fad695 | |||
| a9947a97b3 | |||
| 15dd324508 | |||
| de69839949 | |||
| 4ebb4ac73c | |||
| 785bdf1573 | |||
| 2fceef1f6b | |||
| 89e157f4f3 | |||
| cf0a542cc7 | |||
| 6ea4308521 | |||
| 140078ce0d | |||
| d3d4b05b18 | |||
| 2bccfc220e | |||
| 5d7481569c | |||
| efe4232ddf | |||
| a1757d46bc | |||
| d4c598f20c | |||
| e062122e49 | |||
| 6435c2991f | |||
| 94bf603808 | |||
| 25de9fc2b1 | |||
| 26df9f41fb | |||
| 1be7db8409 | |||
| 9c23160470 | |||
| 2d1eb8dc5b | |||
| f57a162f0e | |||
| 0a9afef67b | |||
| 51a9ae441c |
|
Before Width: | Height: | Size: 117 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 9.7 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 7.0 KiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 799 B After Width: | Height: | Size: 638 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 9.7 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 10 KiB |
@@ -8,7 +8,7 @@
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
|
||||
<title>Vuestic Admin</title>
|
||||
<title>R-index</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vuestic-admin",
|
||||
"short_name": "vuestic-admin",
|
||||
"name": "R-index",
|
||||
"short_name": "R-index",
|
||||
"icons": [
|
||||
{
|
||||
"src": "./img/icons/android-chrome-192x192.png",
|
||||
|
||||
@@ -14,12 +14,14 @@ import YmapPlugin from 'vue-yandex-maps'
|
||||
import VueClipboard from 'vue-clipboard2'
|
||||
|
||||
import ECharts from 'vue-echarts'
|
||||
import 'echarts/lib/chart/pie'
|
||||
import 'echarts/lib/chart/line'
|
||||
import 'echarts/lib/component/dataZoom'
|
||||
import 'echarts/lib/component/tooltip'
|
||||
import 'echarts/lib/component/legend'
|
||||
import 'echarts/lib/component/axisPointer'
|
||||
import 'echarts/lib/component/grid'
|
||||
import 'echarts/lib/component/title'
|
||||
|
||||
import VueMqtt from 'vue-mqtt'
|
||||
import global_ from '../data/global/global'
|
||||
|
||||
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 3.1 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 2.3 MiB |
|
After Width: | Height: | Size: 2.5 MiB |
@@ -25,7 +25,7 @@
|
||||
>
|
||||
<!-- *** icon -->
|
||||
<!-- <va-icon-vuestic /> -->
|
||||
<img v-bind:src="'https://www.bioproweb.com/wp-content/uploads/2020/01/BPS-LOGO_60.png'">
|
||||
<img src='../../../assets/img/BPS-LOGO_60.png'>
|
||||
</router-link>
|
||||
</div>
|
||||
<!-- <img style="height: 40px;" v-bind:src="'https://www.bioproweb.com/wp-content/uploads/2020/01/BPS-LOGO_60.png'"> -->
|
||||
@@ -54,11 +54,11 @@
|
||||
{{$t('navbar.repository')}}
|
||||
</va-button> -->
|
||||
</div>
|
||||
<app-navbar-actions
|
||||
<!--<app-navbar-actions
|
||||
class="app-navbar__actions md5 lg4"
|
||||
:user-name="userName"
|
||||
:is-top-bar.sync="isTopBarProxy"
|
||||
/>
|
||||
/>-->
|
||||
</div>
|
||||
<div
|
||||
class="app-navbar__shape"
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
|
||||
<va-item-section avatar class="ml-1">
|
||||
<va-avatar style="border-radius: 0;">
|
||||
<img :src="device.pic" :alt="device.name">
|
||||
<img :src="device.pic" :alt="device.name" @click.stop="detect(controller.id,device)">
|
||||
</va-avatar>
|
||||
</va-item-section>
|
||||
|
||||
@@ -317,14 +317,28 @@ export default {
|
||||
default:
|
||||
break
|
||||
}
|
||||
console.log(String.fromCharCode.apply(null, data), topic)
|
||||
// console.log(String.fromCharCode.apply(null, data), topic)
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
detect: function (controllerID, device) {
|
||||
this.mqttPub(controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
device: device.id,
|
||||
instruction: 'VIS_DEVICE_DETECT',
|
||||
}))
|
||||
setTimeout(() => {
|
||||
this.mqttPub(controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
device: device.id,
|
||||
instruction: 'VIS_DEVICE_DONE',
|
||||
}))
|
||||
}, 5000)
|
||||
},
|
||||
getControllerList: async function () {
|
||||
const update = async () => {
|
||||
this.controllerList.push({
|
||||
id: 'pokai',
|
||||
id: 'roy_test',
|
||||
mac: '',
|
||||
status: 'loading',
|
||||
isScan: true,
|
||||
@@ -351,6 +365,7 @@ export default {
|
||||
// this.mqttSub(controller.id + '/file_list/+')
|
||||
this.mqttSub(controller.id + '/hardware_scan/+')
|
||||
this.mqttSub(controller.id + '/broadcast')
|
||||
this.mqttSub(controller.id + '/device_instruction/+')
|
||||
})
|
||||
},
|
||||
pageMqttUnSub: function () {
|
||||
@@ -362,6 +377,7 @@ export default {
|
||||
// this.mqttUnSub(controller.id + '/file_list/+')
|
||||
this.mqttUnSub(controller.id + '/hardware_scan/+')
|
||||
this.mqttUnSub(controller.id + '/broadcast')
|
||||
this.mqttUnSub(controller.id + '/device_instruction/+')
|
||||
})
|
||||
},
|
||||
pageInitPub: function () {
|
||||
|
||||
@@ -288,6 +288,56 @@
|
||||
</form>
|
||||
</va-card>
|
||||
</div>
|
||||
|
||||
<div class="flex xs12">
|
||||
<va-card :title="$t('forms.controls.title')">
|
||||
<div class="row">
|
||||
<div class="flex md3">
|
||||
<fieldset>
|
||||
|
||||
<va-checkbox
|
||||
:label="$t('forms.controls.readonly')"
|
||||
v-model="checkbox.readonly"
|
||||
:readonly="true"
|
||||
/>
|
||||
<va-checkbox
|
||||
:label="$t('forms.controls.error')"
|
||||
error
|
||||
v-model="checkbox.error"
|
||||
/>
|
||||
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="flex md3">
|
||||
<fieldset>
|
||||
<va-radio-button
|
||||
option="option1"
|
||||
v-model="radioSelectedOption"
|
||||
label="Radio"
|
||||
/>
|
||||
<va-radio-button
|
||||
option="option2"
|
||||
v-model="radioSelectedOption"
|
||||
label="Radio"
|
||||
/>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<fieldset>
|
||||
<va-toggle
|
||||
v-model="toggles.selected"
|
||||
label="Selected toggle"
|
||||
/>
|
||||
<va-toggle
|
||||
v-model="toggles.disabled"
|
||||
small
|
||||
label="Small toggle"
|
||||
/>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</va-card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -75,6 +75,8 @@
|
||||
:chartID="chart.chartID"
|
||||
@init="initChart(chart.chartID)"
|
||||
@remove="removeChartCheck(chart.chartID)"
|
||||
:emojiEn="emojiEnable"
|
||||
@click-emoji-switch="emojiEnable=$event"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -128,8 +130,15 @@ export default {
|
||||
selectChartID: null,
|
||||
showDeviceSetting: true,
|
||||
chartAreaClass: ['flex', 'xs12', 'sm12', 'md12', 'xl8', 'pa-0'],
|
||||
emojiEnable: false,
|
||||
}
|
||||
},
|
||||
// props:{
|
||||
// emojiEn: {
|
||||
// type: Boolean,
|
||||
// default: false,
|
||||
// },
|
||||
// },
|
||||
mqtt: {
|
||||
async '+/get_device_info_all/+' (data, topic) {
|
||||
await projectInfo.deviceInfo(String.fromCharCode.apply(null, data))
|
||||
|
||||
@@ -12,12 +12,19 @@
|
||||
<va-tab>
|
||||
{{'SOURCE'}}
|
||||
</va-tab>
|
||||
<!-- <va-tab>
|
||||
<va-tab>
|
||||
{{'SETTING'}}
|
||||
</va-tab> -->
|
||||
</va-tab>
|
||||
</va-tabs>
|
||||
<div v-if="tabValue == 0" >
|
||||
<div v-if="data.legend.data.length != 0">
|
||||
<audio src="../../../../assets/audio/audio_infect.wav" ref="au_infect"></audio>
|
||||
<div v-if="emojiEn == true && (type == 'R Index' || type == 'I Index' || type == 'V Index')"
|
||||
align="center"
|
||||
:style="'width: '+ cardwidth + ';' + 'height: auto;'">
|
||||
<img v-if="emoji == 1" src="../../../../assets/img/IMB_Rindex_normal.gif" style="height: 100%; width: 100%;" >
|
||||
<img v-else-if="emoji == 0" src="../../../../assets/img/IMB_Rindex_infect.gif" style="height: 100%; width: 100%;" >
|
||||
</div>
|
||||
<chart :ref="'chart_ref'" :style="'width: '+ cardwidth + '; height: ' + cardheight + ';'" :options="data" :auto-resize="true"></chart>
|
||||
</div>
|
||||
<div v-else>
|
||||
@@ -27,6 +34,19 @@
|
||||
<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-if="tabValue == 2" :style="'width: '+ cardwidth + '; height: ' + cardheight + ';'" >
|
||||
<div class="flex">
|
||||
<fieldset>
|
||||
<va-toggle
|
||||
v-model="emojiEn"
|
||||
small
|
||||
label="Show Picture"
|
||||
style="font-size: 20px;"
|
||||
@click.native="clickEmojiSwitch(emojiEn)"
|
||||
/>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else :style="'width: '+ cardwidth + '; height: ' + cardheight + ';'" >
|
||||
<canvas-chart-setting></canvas-chart-setting>
|
||||
</div>
|
||||
@@ -84,6 +104,10 @@ export default {
|
||||
type: String,
|
||||
default: 'auto',
|
||||
},
|
||||
emojiEn: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
created () {
|
||||
},
|
||||
@@ -98,6 +122,12 @@ export default {
|
||||
mappingOptions: projectInfo.getMappingList(),
|
||||
nameCard: chartData.getAllChartsData()[this.chartID].cardName,
|
||||
initDone: false,
|
||||
emoji: null,
|
||||
emojiEnable: false,
|
||||
formula: chartData.getAllChartsData()[this.chartID].formula,
|
||||
type: '',
|
||||
last_emoji: null,
|
||||
dataNow: null,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -154,6 +184,35 @@ export default {
|
||||
resize: function () {
|
||||
if (this.$refs.chart_ref != null) {
|
||||
this.$refs.chart_ref.resize()
|
||||
this.formula = chartData.getAllChartsData()[this.chartID].series[0].formula
|
||||
|
||||
if (this.formula !== null) {
|
||||
this.emoji = chartData.getAllChartsData()[this.chartID].series[0].formula.emoji
|
||||
this.type = chartData.getAllChartsData()[this.chartID].series[0].formula.type
|
||||
this.dataNow = chartData.getAllChartsData()[this.chartID].series[0].formula.dataNow
|
||||
this.last_emoji = chartData.getAllChartsData()[this.chartID].series[0].formula.last_emoji
|
||||
|
||||
if ((this.type === 'R Index' || this.type === 'I Index' || this.type === 'V Index') && this.dataNow != null) {
|
||||
if (this.last_emoji !== this.emoji) {
|
||||
this.handleCanplay()
|
||||
chartData.getAllChartsData()[this.chartID].series[0].formula.last_emoji = this.emoji
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
clickEmojiSwitch: function (selected) {
|
||||
this.emojiEnable = selected
|
||||
|
||||
this.$emit('click-emoji-switch', this.emojiEnable)
|
||||
},
|
||||
handleCanplay () {
|
||||
if (this.emoji === 0 && this.emojiEn === true) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.au_infect.play()
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
<va-item-section avatar class="ml-0">
|
||||
<va-avatar style="border-radius: 0;">
|
||||
<img :src="device.picture" :alt="device.name">
|
||||
<img :src="device.picture" :alt="device.name" @click.stop="detect(device)">
|
||||
</va-avatar>
|
||||
</va-item-section>
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
// import NeuliveParameterWindow from '../parameter/NeuliveParameterWindow'
|
||||
import EliteParameterWindow from '../parameter/EliteParameterWindow'
|
||||
import NeuliveParameterWindow from '../parameter/NeuliveParameterWindow'
|
||||
import { projectInfo } from '../../../../data/project/ProjectInfo'
|
||||
|
||||
export default {
|
||||
name: 'ProjectDeviceList',
|
||||
@@ -88,6 +89,23 @@ export default {
|
||||
computed: {
|
||||
},
|
||||
methods: {
|
||||
mqttPub: function (topic, mes) {
|
||||
this.$mqtt.publish(topic, mes)
|
||||
},
|
||||
detect: function (device) {
|
||||
this.mqttPub(projectInfo.getProjectInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
device: projectInfo.getRawDeviceID(device.id),
|
||||
instruction: 'VIS_DEVICE_DETECT',
|
||||
}))
|
||||
setTimeout(() => {
|
||||
this.mqttPub(projectInfo.getProjectInfo().controllerID + '_user', JSON.stringify({
|
||||
header: 'device_instruction/0',
|
||||
device: projectInfo.getRawDeviceID(device.id),
|
||||
instruction: 'VIS_DEVICE_DONE',
|
||||
}))
|
||||
}, 5000)
|
||||
},
|
||||
removeCheck: function (device) {
|
||||
this.selectDevice = device
|
||||
this.showDeleteModal = true
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
</va-item>
|
||||
</span>
|
||||
<div slot="body">
|
||||
<div class="mt-0 mb-0" style="height: 100px; overflow-y: scroll; overflow-x: hidden;" :key="'detail' + formula.id">
|
||||
<div class="mt-0 mb-0" style="height: 100%; overflow-y: scroll; overflow-x: hidden;" :key="'detail' + formula.id">
|
||||
<div class="" v-if="formula.type == 'Sheet Resistance'">
|
||||
<div class="row flex">
|
||||
<div style="text-align: center;">
|
||||
@@ -75,6 +75,91 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="" v-if="formula.type == 'R Index'" style="height: 100%;">
|
||||
<div class="row flex">
|
||||
<div style="text-align: center;">
|
||||
{{ formula.description }}
|
||||
<va-button :disabled="formula.R0_device.id == null || formula.R1_device.id == null" @click.stop="generate(formula)" class="pl-2 pr-2 mr-0" small>APPLY</va-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="flex xs12 sm6 md6 xl6">
|
||||
<va-select
|
||||
small
|
||||
:label="'Resistance (R1)'"
|
||||
v-model="formula.R1_device"
|
||||
textBy="name"
|
||||
:options="deviceOptions"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex xs12 sm6 md6 xl6">
|
||||
<va-select
|
||||
:label="'Resistance (R0)'"
|
||||
v-model="formula.R0_device"
|
||||
textBy="name"
|
||||
:options="deviceOptions"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="" v-if="formula.type == 'I Index'" style="height: 100%;">
|
||||
<div class="row flex">
|
||||
<div style="text-align: center;">
|
||||
{{ formula.description }}
|
||||
<va-button :disabled="formula.I0_device.id == null || formula.I1_device.id == null" @click.stop="generate(formula)" class="pl-2 pr-2 mr-0" small>APPLY</va-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="flex xs12 sm6 md6 xl6">
|
||||
<va-select
|
||||
small
|
||||
:label="'Current (I1)'"
|
||||
v-model="formula.I1_device"
|
||||
textBy="name"
|
||||
:options="deviceOptions"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex xs12 sm6 md6 xl6">
|
||||
<va-select
|
||||
:label="'Current (I0)'"
|
||||
v-model="formula.I0_device"
|
||||
textBy="name"
|
||||
:options="deviceOptions"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="" v-if="formula.type == 'V Index'" style="height: 100%;">
|
||||
<div class="row flex">
|
||||
<div style="text-align: center;">
|
||||
{{ formula.description }}
|
||||
<va-button :disabled="formula.V0_device.id == null || formula.V1_device.id == null" @click.stop="generate(formula)" class="pl-2 pr-2 mr-0" small>APPLY</va-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="flex xs12 sm6 md6 xl6">
|
||||
<va-select
|
||||
small
|
||||
:label="'Voltage (V1)'"
|
||||
v-model="formula.V1_device"
|
||||
textBy="name"
|
||||
:options="deviceOptions"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex xs12 sm6 md6 xl6">
|
||||
<va-select
|
||||
:label="'Voltage (V0)'"
|
||||
v-model="formula.V0_device"
|
||||
textBy="name"
|
||||
:options="deviceOptions"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</va-collapse>
|
||||
@@ -125,15 +210,51 @@ export default {
|
||||
showFormulaModal: false,
|
||||
formulaSelect: '',
|
||||
formulaOptions: [
|
||||
// {
|
||||
// id: 0,
|
||||
// name: 'Sheet Resistance',
|
||||
// type: 'Sheet Resistance',
|
||||
// description: '𝝆𝒔 = (𝞓𝑽/𝑰) * (𝝅/𝒍𝒏𝟐)',
|
||||
// I_device: '',
|
||||
// V_device: '',
|
||||
// dataNow: 0,
|
||||
// isSync: false,
|
||||
// },
|
||||
{
|
||||
id: 0,
|
||||
name: 'Sheet Resistance',
|
||||
type: 'Sheet Resistance',
|
||||
description: '𝝆𝒔 = (𝞓𝑽/𝑰) * (𝝅/𝒍𝒏𝟐)',
|
||||
I_device: '',
|
||||
V_device: '',
|
||||
id: 1,
|
||||
name: 'R Index',
|
||||
type: 'R Index',
|
||||
description: 'R = (R1) / (R0)',
|
||||
R0_device: '',
|
||||
R1_device: '',
|
||||
dataNow: 0,
|
||||
isSync: false,
|
||||
emoji: null,
|
||||
last_emoji: null,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: 'I Index',
|
||||
type: 'I Index',
|
||||
description: 'I = (I1) / (I0)',
|
||||
I0_device: '',
|
||||
I1_device: '',
|
||||
dataNow: 0,
|
||||
isSync: false,
|
||||
emoji: null,
|
||||
last_emoji: null,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: 'V Index',
|
||||
type: 'V Index',
|
||||
description: 'V = (V1) / (V0)',
|
||||
V0_device: '',
|
||||
V1_device: '',
|
||||
dataNow: 0,
|
||||
isSync: false,
|
||||
emoji: null,
|
||||
last_emoji: null,
|
||||
},
|
||||
],
|
||||
formulaList: projectInfo.getFormulaList(),
|
||||
@@ -178,6 +299,11 @@ export default {
|
||||
formula.dataNow = 0
|
||||
chartData.defaultChartGenerator(formula.id, null, 'formula')
|
||||
break
|
||||
case 'R Index':
|
||||
case 'I Index':
|
||||
case 'V Index':
|
||||
chartData.defaultChartGenerator(formula.id, null, 'formula')
|
||||
break
|
||||
}
|
||||
this.pageToast('The ' + formula.name + 'has been applied.')
|
||||
},
|
||||
|
||||
@@ -815,18 +815,18 @@ export default {
|
||||
description: 'Init',
|
||||
},
|
||||
workingModeOptions: [
|
||||
{
|
||||
id: 0,
|
||||
description: 'I-V Curve',
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
description: 'Cycle I-V',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
description: 'Function Generator',
|
||||
},
|
||||
// {
|
||||
// id: 0,
|
||||
// description: 'I-V Curve',
|
||||
// },
|
||||
// {
|
||||
// id: 1,
|
||||
// description: 'Cycle I-V',
|
||||
// },
|
||||
// {
|
||||
// id: 2,
|
||||
// description: 'Function Generator',
|
||||
// },
|
||||
{
|
||||
id: 3,
|
||||
description: 'R-T Graph',
|
||||
@@ -839,30 +839,30 @@ export default {
|
||||
id: 5,
|
||||
description: 'I-T Graph',
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
description: 'ADC_Test',
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
description: 'Constant Current',
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
description: 'Cyclic Voltammetry',
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
description: 'Cyclic Voltammetry-hi-cycles',
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
description: 'Linear Sweep Voltammetry',
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
description: 'Chronoamperometric Graph',
|
||||
},
|
||||
// {
|
||||
// id: 6,
|
||||
// description: 'ADC_Test',
|
||||
// },
|
||||
// {
|
||||
// id: 7,
|
||||
// description: 'Constant Current',
|
||||
// },
|
||||
// {
|
||||
// id: 8,
|
||||
// description: 'Cyclic Voltammetry',
|
||||
// },
|
||||
// {
|
||||
// id: 9,
|
||||
// description: 'Cyclic Voltammetry-hi-cycles',
|
||||
// },
|
||||
// {
|
||||
// id: 10,
|
||||
// description: 'Linear Sweep Voltammetry',
|
||||
// },
|
||||
// {
|
||||
// id: 11,
|
||||
// description: 'Chronoamperometric Graph',
|
||||
// },
|
||||
],
|
||||
currentRangeSelect: null,
|
||||
currentRangeOptions: [
|
||||
|
||||
@@ -131,6 +131,17 @@ export const chartData = {
|
||||
x: 'center',
|
||||
y: '88%',
|
||||
},
|
||||
title: {
|
||||
text: '',
|
||||
subtext: '',
|
||||
show: false,
|
||||
left: 'center',
|
||||
textStyle: {
|
||||
fontSize: 15,
|
||||
color: '#7F7F7F',
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
},
|
||||
tooltip: {},
|
||||
axisPointer: {
|
||||
link: [{ xAxisIndex: 'all' }],
|
||||
@@ -185,7 +196,6 @@ export const chartData = {
|
||||
const param = params[i]
|
||||
const style = 'color: ' + param.color
|
||||
let value
|
||||
// console.log(param.value)
|
||||
if (param.seriesName === 'Time') {
|
||||
value = param.value[1]
|
||||
} else if (param.seriesName.split('_')[1] === 'T' && param.seriesName.split('_')[0] !== 'T') {
|
||||
@@ -309,7 +319,7 @@ export const chartData = {
|
||||
|
||||
// remove legend
|
||||
const _legendIndex = _chartData[chartID].legend.data.indexOf(legendName)
|
||||
console.log(_legendIndex)
|
||||
|
||||
if (_legendIndex >= 0) {
|
||||
_chartData[chartID].legend.data.splice(_chartData[chartID].legend.data.indexOf(legendName), 1)
|
||||
} else {
|
||||
@@ -371,7 +381,6 @@ export const chartData = {
|
||||
_chartData[chartID].dataZoom[2].yAxisIndex.pop()
|
||||
}
|
||||
|
||||
console.log(_chartData[chartID])
|
||||
return true
|
||||
},
|
||||
|
||||
@@ -422,6 +431,7 @@ export const chartData = {
|
||||
}
|
||||
})
|
||||
let value
|
||||
var chars = ['\u1D62', '\u1D65', '\u1D63'] // i,v,r
|
||||
switch (series.formula.type) {
|
||||
case 'Sheet Resistance':
|
||||
for (let i = 0; i < Object.keys(popData[0].data).length; i++) {
|
||||
@@ -466,26 +476,229 @@ export const chartData = {
|
||||
}
|
||||
series.formula.dataNow = value.toFixed(3)
|
||||
break
|
||||
|
||||
case 'R Index': // indexRaw:0 => R1; indexRaw:1 => R0; papData[0] => [0]Elite; papData[1] => [1]Elite;
|
||||
for (let i = 0; i < Object.keys(popData[0].data).length; i++) {
|
||||
let dataR0
|
||||
let dataR1
|
||||
dataR1 = popData[0].indexRaw === 0 ? popData[0].data[Object.keys(popData[0].data)[i]] : popData[1].data[Object.keys(popData[1].data)[indexNow[1]]]
|
||||
dataR0 = popData[0].indexRaw === 1 ? popData[0].data[Object.keys(popData[0].data)[i]] : popData[1].data[Object.keys(popData[1].data)[indexNow[1]]]
|
||||
|
||||
value = parseFloat(dataR1 / dataR0)
|
||||
|
||||
const percentR0 = value * 100
|
||||
const percentR1 = value > 1 ? 0 : (100 - percentR0)
|
||||
|
||||
const greenPieChart = '#28CDBA'
|
||||
const darkBluePieChart = '#8794EA'
|
||||
const lightBluePieChart = '#32CCF3'
|
||||
const pinkPieChart = '#FD7589'
|
||||
|
||||
let colorPercentR0
|
||||
if (series.formula.R1_device.id === 0) {
|
||||
colorPercentR0 = greenPieChart
|
||||
} else if (series.formula.R1_device.id === 1) {
|
||||
colorPercentR0 = darkBluePieChart
|
||||
} else if (series.formula.R1_device.id === 2) {
|
||||
colorPercentR0 = lightBluePieChart
|
||||
} else if (series.formula.R1_device.id === 3) {
|
||||
colorPercentR0 = pinkPieChart
|
||||
}
|
||||
|
||||
series.data = ([{ value: percentR0.toFixed(1), name: 'R0', itemStyle: { color: colorPercentR0 } }, { value: percentR1.toFixed(1), name: 'R`', itemStyle: { color: '#FFFFFF' } }])
|
||||
indexNow[1]++
|
||||
|
||||
if (series.dataYMax < value || series.dataYMax == null) {
|
||||
series.dataYMax = value
|
||||
}
|
||||
if (series.dataYMin > value || series.dataYMin == null) {
|
||||
series.dataYMin = value
|
||||
}
|
||||
|
||||
_chartData[chartID].title.text = 'Recovery Index (RI' + chars[2] + ') = ' + (percentR0).toFixed(1) + '%'
|
||||
|
||||
// console.log('value', value)
|
||||
// console.log('percentR0', percentR0)
|
||||
// console.log('percentR1', percentR1)
|
||||
// console.log('series.data', series.data)
|
||||
// console.log(series.formula.dataNow)
|
||||
// console.log('_chartData[chartID].title.text', _chartData[chartID].title.text)
|
||||
|
||||
indexArray.forEach(pattern => {
|
||||
if ((i + 1) % pattern[0] === 0) {
|
||||
for (let j = 0; j < pattern[1]; j++) {
|
||||
if (popData[1].data[Object.keys(popData[1].data)[indexNow[1]]] != null) {
|
||||
dataR1 = popData[0].indexRaw === 0 ? popData[0].data[Object.keys(popData[0].data)[i]] : popData[1].data[Object.keys(popData[1].data)[indexNow[1]]]
|
||||
dataR0 = popData[0].indexRaw === 1 ? popData[0].data[Object.keys(popData[0].data)[i]] : popData[1].data[Object.keys(popData[1].data)[indexNow[1]]]
|
||||
|
||||
value = parseFloat(dataR1 / dataR0)
|
||||
series.data = ([parseInt(Object.keys(popData[1].data)[indexNow[1]]), value])
|
||||
indexNow[1]++
|
||||
|
||||
if (series.dataYMax < value || series.dataYMax == null) {
|
||||
series.dataYMax = value
|
||||
}
|
||||
if (series.dataYMin > value || series.dataYMin == null) {
|
||||
series.dataYMin = value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
series.formula.dataNow = value.toFixed(3)
|
||||
if (series.formula.dataNow >= 0.075) {
|
||||
series.formula.emoji = 1
|
||||
} else {
|
||||
series.formula.emoji = 0
|
||||
}
|
||||
// console.log('pie chart', _chartData[chartID].series[0])
|
||||
break
|
||||
|
||||
case 'I Index': // indexRaw:0 => R1; indexRaw:1 => R0; papData[0] => [0]Elite; papData[1] => [1]Elite;
|
||||
for (let i = 0; i < Object.keys(popData[0].data).length; i++) {
|
||||
let dataR0
|
||||
let dataR1
|
||||
dataR1 = popData[0].indexRaw === 0 ? popData[0].data[Object.keys(popData[0].data)[i]] : popData[1].data[Object.keys(popData[1].data)[indexNow[1]]]
|
||||
dataR0 = popData[0].indexRaw === 1 ? popData[0].data[Object.keys(popData[0].data)[i]] : popData[1].data[Object.keys(popData[1].data)[indexNow[1]]]
|
||||
|
||||
value = parseFloat(dataR1 / dataR0)
|
||||
|
||||
const percentR0 = value * 100
|
||||
const percentR1 = value > 1 ? 0 : (100 - percentR0)
|
||||
const greenPieChart = '#28CDBA'
|
||||
const darkBluePieChart = '#8794EA'
|
||||
const lightBluePieChart = '#32CCF3'
|
||||
const pinkPieChart = '#FD7589'
|
||||
|
||||
let colorPercentR0
|
||||
if (series.formula.I1_device.id === 0) {
|
||||
colorPercentR0 = greenPieChart
|
||||
} else if (series.formula.I1_device.id === 1) {
|
||||
colorPercentR0 = darkBluePieChart
|
||||
} else if (series.formula.I1_device.id === 2) {
|
||||
colorPercentR0 = lightBluePieChart
|
||||
} else if (series.formula.I1_device.id === 3) {
|
||||
colorPercentR0 = pinkPieChart
|
||||
}
|
||||
|
||||
series.data = ([{ value: percentR0.toFixed(1), name: 'I0', itemStyle: { color: colorPercentR0 } }, { value: percentR1.toFixed(1), name: 'I`', itemStyle: { color: '#FFFFFF' } }])
|
||||
indexNow[1]++
|
||||
|
||||
if (series.dataYMax < value || series.dataYMax == null) {
|
||||
series.dataYMax = value
|
||||
}
|
||||
if (series.dataYMin > value || series.dataYMin == null) {
|
||||
series.dataYMin = value
|
||||
}
|
||||
|
||||
_chartData[chartID].title.text = 'Recovery Index (RI' + chars[0] + ') = ' + (percentR0).toFixed(1) + '%'
|
||||
// _chartData[chartID].title.text = 'I Index ' + series.formula.I1_device.id + ' = ' + (percentR0).toFixed(1) + '%'
|
||||
|
||||
indexArray.forEach(pattern => {
|
||||
if ((i + 1) % pattern[0] === 0) {
|
||||
for (let j = 0; j < pattern[1]; j++) {
|
||||
if (popData[1].data[Object.keys(popData[1].data)[indexNow[1]]] != null) {
|
||||
dataR1 = popData[0].indexRaw === 0 ? popData[0].data[Object.keys(popData[0].data)[i]] : popData[1].data[Object.keys(popData[1].data)[indexNow[1]]]
|
||||
dataR0 = popData[0].indexRaw === 1 ? popData[0].data[Object.keys(popData[0].data)[i]] : popData[1].data[Object.keys(popData[1].data)[indexNow[1]]]
|
||||
|
||||
value = parseFloat(dataR1 / dataR0)
|
||||
series.data = ([parseInt(Object.keys(popData[1].data)[indexNow[1]]), value])
|
||||
indexNow[1]++
|
||||
|
||||
if (series.dataYMax < value || series.dataYMax == null) {
|
||||
series.dataYMax = value
|
||||
}
|
||||
if (series.dataYMin > value || series.dataYMin == null) {
|
||||
series.dataYMin = value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
series.formula.dataNow = value.toFixed(3)
|
||||
if (series.formula.dataNow >= 0.075) { // 0.075
|
||||
series.formula.emoji = 1
|
||||
} else if (series.formula.dataNow <= 0.074) {
|
||||
series.formula.emoji = 0
|
||||
}
|
||||
break
|
||||
|
||||
case 'V Index': // indexRaw:0 => R1; indexRaw:1 => R0; papData[0] => [0]Elite; papData[1] => [1]Elite;
|
||||
for (let i = 0; i < Object.keys(popData[0].data).length; i++) {
|
||||
let dataR0
|
||||
let dataR1
|
||||
dataR1 = popData[0].indexRaw === 0 ? popData[0].data[Object.keys(popData[0].data)[i]] : popData[1].data[Object.keys(popData[1].data)[indexNow[1]]]
|
||||
dataR0 = popData[0].indexRaw === 1 ? popData[0].data[Object.keys(popData[0].data)[i]] : popData[1].data[Object.keys(popData[1].data)[indexNow[1]]]
|
||||
|
||||
value = parseFloat(dataR1 / dataR0)
|
||||
|
||||
const percentR0 = value * 100
|
||||
const percentR1 = value > 1 ? 0 : (100 - percentR0)
|
||||
const greenPieChart = '#28CDBA'
|
||||
const darkBluePieChart = '#8794EA'
|
||||
const lightBluePieChart = '#32CCF3'
|
||||
const pinkPieChart = '#FD7589'
|
||||
|
||||
let colorPercentR0
|
||||
if (series.formula.V1_device.id === 0) {
|
||||
colorPercentR0 = greenPieChart
|
||||
} else if (series.formula.V1_device.id === 1) {
|
||||
colorPercentR0 = darkBluePieChart
|
||||
} else if (series.formula.V1_device.id === 2) {
|
||||
colorPercentR0 = lightBluePieChart
|
||||
} else if (series.formula.V1_device.id === 3) {
|
||||
colorPercentR0 = pinkPieChart
|
||||
}
|
||||
|
||||
series.data = ([{ value: percentR0.toFixed(1), name: 'V0', itemStyle: { color: colorPercentR0 } }, { value: percentR1.toFixed(1), name: 'V`', itemStyle: { color: '#FFFFFF' } }])
|
||||
indexNow[1]++
|
||||
|
||||
if (series.dataYMax < value || series.dataYMax == null) {
|
||||
series.dataYMax = value
|
||||
}
|
||||
if (series.dataYMin > value || series.dataYMin == null) {
|
||||
series.dataYMin = value
|
||||
}
|
||||
|
||||
_chartData[chartID].title.text = 'Recovery Index (RI' + chars[1] + ') = ' + (percentR0).toFixed(1) + '%'
|
||||
|
||||
indexArray.forEach(pattern => {
|
||||
if ((i + 1) % pattern[0] === 0) {
|
||||
for (let j = 0; j < pattern[1]; j++) {
|
||||
if (popData[1].data[Object.keys(popData[1].data)[indexNow[1]]] != null) {
|
||||
dataR1 = popData[0].indexRaw === 0 ? popData[0].data[Object.keys(popData[0].data)[i]] : popData[1].data[Object.keys(popData[1].data)[indexNow[1]]]
|
||||
dataR0 = popData[0].indexRaw === 1 ? popData[0].data[Object.keys(popData[0].data)[i]] : popData[1].data[Object.keys(popData[1].data)[indexNow[1]]]
|
||||
|
||||
value = parseFloat(dataR1 / dataR0)
|
||||
series.data = ([parseInt(Object.keys(popData[1].data)[indexNow[1]]), value])
|
||||
indexNow[1]++
|
||||
|
||||
if (series.dataYMax < value || series.dataYMax == null) {
|
||||
series.dataYMax = value
|
||||
}
|
||||
if (series.dataYMin > value || series.dataYMin == null) {
|
||||
series.dataYMin = value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
series.formula.dataNow = value.toFixed(3)
|
||||
if (series.formula.dataNow >= 0.075) {
|
||||
series.formula.emoji = 1
|
||||
} else {
|
||||
series.formula.emoji = 0
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
// series data list shift
|
||||
if (series.data.length > _chartData[chartID].maxDots) {
|
||||
series.data.splice(0, series.data.length - _chartData[chartID].maxDots)
|
||||
}
|
||||
|
||||
// axis shift
|
||||
if (series.data.length > 0) {
|
||||
_chartData[chartID].xAxis[series.xAxisIndex].max = series.data[series.data.length - 1][0]
|
||||
_chartData[chartID].xAxis[series.xAxisIndex].min = series.data[0][0]
|
||||
const center = (series.dataYMax + series.dataYMin) / 2
|
||||
const range = (series.dataYMax - series.dataYMin)
|
||||
if (_chartData[chartID].yAxis[series.yAxisIndex].max < center + (range * 2) || _chartData[chartID].yAxis[series.yAxisIndex].max == null) {
|
||||
_chartData[chartID].yAxis[series.yAxisIndex].max = center + (range * 2)
|
||||
}
|
||||
if (_chartData[chartID].yAxis[series.yAxisIndex].min > center - (range * 2) || _chartData[chartID].yAxis[series.yAxisIndex].min == null) {
|
||||
_chartData[chartID].yAxis[series.yAxisIndex].min = center - (range * 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (series.xAxisSource[0] === -1 && series.yAxisSource[0] === -1) {
|
||||
@@ -705,8 +918,6 @@ export const chartData = {
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// console.log(_chartData[chartID])
|
||||
},
|
||||
|
||||
defaultChartGenerator: (_itemID, _chartID, _type) => {
|
||||
@@ -780,6 +991,16 @@ export const chartData = {
|
||||
case 'Sheet Resistance':
|
||||
chartRegister(chartID, 0, 'Elite', formula.I_device.id, 1, 'Elite', formula.V_device.id, 2, formula)
|
||||
break
|
||||
case 'R Index':
|
||||
// console.log('piepie_formula', formula)
|
||||
piechartRegister(chartID, 0, 'Elite', formula.R1_device.id, 3, 'Elite', formula.R0_device.id, 3, formula)
|
||||
break
|
||||
case 'I Index':
|
||||
piechartRegister(chartID, 0, 'Elite', formula.I1_device.id, 1, 'Elite', formula.I0_device.id, 1, formula)
|
||||
break
|
||||
case 'V Index':
|
||||
piechartRegister(chartID, 0, 'Elite', formula.V1_device.id, 2, 'Elite', formula.V0_device.id, 2, formula)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1042,6 +1263,215 @@ const chartRegister = (chartID, gridIndex, deviceNameX, deviceIDX, channelX, dev
|
||||
|
||||
_chartData[chartID].grid[gridIndex].series.push(_gridSeries)
|
||||
|
||||
// console.log(_chartData[chartID])
|
||||
return _chartData[chartID]
|
||||
}
|
||||
|
||||
// register device-channel to chartData
|
||||
const piechartRegister = (chartID, gridIndex, deviceNameX, deviceIDX, channelX, deviceNameY, deviceIDY, channelY, formula) => {
|
||||
const sourceList = [
|
||||
{
|
||||
name: deviceNameX,
|
||||
id: deviceIDX,
|
||||
channel: channelX,
|
||||
},
|
||||
{
|
||||
name: deviceNameY,
|
||||
id: deviceIDY,
|
||||
channel: channelY,
|
||||
},
|
||||
]
|
||||
if (_chartData[chartID] == null) {
|
||||
return false
|
||||
}
|
||||
|
||||
let xAxisType
|
||||
let yAxisType
|
||||
let xAxisSource
|
||||
let yAxisSource
|
||||
// formulaSource
|
||||
const formulaSource = []
|
||||
let legendName
|
||||
|
||||
if (formula == null) {
|
||||
legendName = getLegendName(sourceList, formula)
|
||||
} else {
|
||||
legendName = getLegendName(sourceList, formula.id)
|
||||
}
|
||||
|
||||
if (formula == null) {
|
||||
switch (sourceList[0].name) {
|
||||
case 'Time':
|
||||
xAxisType = 'time'
|
||||
xAxisSource = [-1, -1]
|
||||
break
|
||||
default:
|
||||
xAxisType = 'value'
|
||||
xAxisSource = [sourceList[0].id, sourceList[0].channel]
|
||||
break
|
||||
}
|
||||
switch (sourceList[1].name) {
|
||||
case 'Time':
|
||||
yAxisType = 'time'
|
||||
yAxisSource = [-1, -1]
|
||||
break
|
||||
default:
|
||||
yAxisType = 'value'
|
||||
yAxisSource = [sourceList[1].id, sourceList[1].channel]
|
||||
break
|
||||
}
|
||||
} else {
|
||||
sourceList.forEach(source => {
|
||||
formulaSource.push([source.id, source.channel])
|
||||
})
|
||||
xAxisType = 'value'
|
||||
yAxisType = 'value'
|
||||
}
|
||||
|
||||
// register legendName
|
||||
if (_chartData[chartID].legend.data.indexOf(legendName) >= 0) {
|
||||
// have been registered
|
||||
return false
|
||||
}
|
||||
_chartData[chartID].legend.data.push(legendName)
|
||||
|
||||
// if AxisIndex != -1 then add new axis into list
|
||||
let _xAxisIndex = -1
|
||||
let _yAxisIndex = -1
|
||||
// the grid have exist, so just use the axis in grid
|
||||
for (let i = 0; i < _chartData[chartID].xAxis.length; i++) {
|
||||
if (_chartData[chartID].xAxis[i].gridIndex === gridIndex) {
|
||||
_xAxisIndex = i
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < _chartData[chartID].yAxis.length; i++) {
|
||||
if (_chartData[chartID].yAxis[i].gridIndex === gridIndex) {
|
||||
_yAxisIndex = i
|
||||
}
|
||||
}
|
||||
// create new axis
|
||||
if (_xAxisIndex === -1) {
|
||||
_chartData[chartID].xAxis.push(makeXAxis(gridIndex, xAxisType))
|
||||
_xAxisIndex = _chartData[chartID].xAxis.length - 1
|
||||
}
|
||||
if (_yAxisIndex === -1) {
|
||||
_chartData[chartID].yAxis.push(makeYAxis(gridIndex, yAxisType))
|
||||
_yAxisIndex = _chartData[chartID].yAxis.length - 1
|
||||
}
|
||||
|
||||
// update dataZoom AxisIndex list
|
||||
const dataZoomXAxisIndex = Array.apply(null, { length: _chartData[chartID].xAxis.length }).map(Number.call, Number)
|
||||
const dataZoomYAxisIndex = Array.apply(null, { length: _chartData[chartID].yAxis.length }).map(Number.call, Number)
|
||||
|
||||
_chartData[chartID].dataZoom[0].xAxisIndex = dataZoomXAxisIndex
|
||||
_chartData[chartID].dataZoom[1].xAxisIndex = dataZoomXAxisIndex
|
||||
_chartData[chartID].dataZoom[2].yAxisIndex = dataZoomYAxisIndex
|
||||
|
||||
_chartData[chartID].dataZoom = false
|
||||
_chartData[chartID].legend.show = false
|
||||
_chartData[chartID].xAxis[0].axisLine.show = false
|
||||
_chartData[chartID].title.textStyle.fontSize = '19'
|
||||
_chartData[chartID].title.textStyle.color = '#7F7F7F'
|
||||
_chartData[chartID].title.textStyle.fontWeight = 'bold'
|
||||
_chartData[chartID].title.show = true
|
||||
_chartData[chartID].title.top = '5%'
|
||||
// console.log('pie chart', _chartData[chartID])
|
||||
|
||||
_chartData[chartID].series.push({
|
||||
name: legendName,
|
||||
type: 'pie',
|
||||
radius: ['45%', '80%'],
|
||||
avoidLabelOverlap: true,
|
||||
silent: true,
|
||||
label: {
|
||||
show: true,
|
||||
position: 'center',
|
||||
formatter: function (d) {
|
||||
if (d.name === 'R0' || d.name === 'I0' || d.name === 'V0') {
|
||||
return '{a|' + d.value + '%}'
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
},
|
||||
rich: {
|
||||
a: {
|
||||
color: '#7F7F7F', fontSize: '30', fontWeight: 'bold',
|
||||
},
|
||||
},
|
||||
},
|
||||
labelLine: {
|
||||
show: false,
|
||||
},
|
||||
formula: formula,
|
||||
formulaSource: formulaSource,
|
||||
dataXMax: null,
|
||||
dataXMin: null,
|
||||
dataYMax: null,
|
||||
dataYMin: null,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
},
|
||||
},
|
||||
left: '0%',
|
||||
|
||||
center: ['50%', '50%'],
|
||||
data: [],
|
||||
})
|
||||
|
||||
// register series into grid
|
||||
const _axisList = []
|
||||
|
||||
if (formula == null) {
|
||||
sourceList.forEach((source, index) => {
|
||||
let _axis = 'X'
|
||||
if (index !== 0) {
|
||||
_axis = 'Y'
|
||||
}
|
||||
switch (source.name) {
|
||||
case 'Time':
|
||||
_axisList.push(_axis + ' AXIS = TIME')
|
||||
break
|
||||
case 'Neulive':
|
||||
dataStreamBuffer.register(chartID, projectInfo.getRawDeviceID(source.id), source.channel)
|
||||
_axisList.push(_axis + ' AXIS = NEULIVE ' + source.id + ' CHANNEL ' + source.channel)
|
||||
break
|
||||
case 'Elite':
|
||||
dataStreamBuffer.register(chartID, projectInfo.getRawDeviceID(source.id), source.channel)
|
||||
switch (source.channel) {
|
||||
case 1:
|
||||
_axisList.push(_axis + ' AXIS = ELITE ' + source.id + ' CURRENT')
|
||||
break
|
||||
case 2:
|
||||
_axisList.push(_axis + ' AXIS = ELITE ' + source.id + ' VOLTAGE')
|
||||
break
|
||||
case 3:
|
||||
_axisList.push(_axis + ' AXIS = ELITE ' + source.id + ' RESISTANCE')
|
||||
break
|
||||
default:
|
||||
_axisList.push(_axis + ' AXIS = ELITE ' + source.id + ' CHANNEL ' + source.channel)
|
||||
break
|
||||
}
|
||||
break
|
||||
default:
|
||||
dataStreamBuffer.register(chartID, projectInfo.getRawDeviceID(source.id), source.channel)
|
||||
_axisList.push(_axis + ' AXIS = DEVICE ' + source.id + ' CHANNEL ' + source.channel)
|
||||
break
|
||||
}
|
||||
})
|
||||
} else {
|
||||
_axisList.push('X AXIS = TIME')
|
||||
_axisList.push('Y AXIS = FORMULA' + formula.id)
|
||||
sourceList.forEach(source => {
|
||||
dataStreamBuffer.register(chartID, projectInfo.getRawDeviceID(source.id), source.channel)
|
||||
})
|
||||
}
|
||||
|
||||
const _gridSeries = {
|
||||
name: legendName,
|
||||
xAxis: _axisList[0],
|
||||
yAxis: _axisList[1],
|
||||
}
|
||||
|
||||
_chartData[chartID].grid[gridIndex].series.push(_gridSeries)
|
||||
|
||||
return _chartData[chartID]
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ export const projectInfo = {
|
||||
|
||||
updateProjectInfo: async (projectID) => {
|
||||
const update = async () => {
|
||||
_projectInfo.controllerID = 'pokai'
|
||||
_projectInfo.controllerID = 'roy_test'
|
||||
}
|
||||
// _projectInfo.deviceAddrList = [[128, 111, 176, 237, 124, 140], [164, 218, 50, 212, 231, 58], [24, 4, 237, 55, 198, 53]]
|
||||
// _projectInfo.chartNumber = _projectInfo.deviceAddrList.length
|
||||
|
||||
@@ -0,0 +1,357 @@
|
||||
import newTask from '@/factories/task/taskFactory'
|
||||
import { dataStreamBuffer } from './DataStreamBuffer'
|
||||
|
||||
const eliteImgUrl = require('@/assets/img/elite_img.png')
|
||||
const neuliveImgUrl = require('@/assets/img/neulive_img.png')
|
||||
// import { chartData } from './ChartsManagement'
|
||||
|
||||
const _taskInfo = newTask()
|
||||
// show the devices which mac is included in task
|
||||
const _deviceList = []
|
||||
// show the devices which mac is included in task and do not show Time
|
||||
const _deviceListNoTime = []
|
||||
// show the all devices which is not register
|
||||
const _deviceListNotRegister = []
|
||||
// show the all devices which connected
|
||||
const _deviceListAll = []
|
||||
// show the all item can be mapping
|
||||
const _mappingList = []
|
||||
|
||||
export const deviceListRegister = []
|
||||
|
||||
const formulaIDStart = 4
|
||||
|
||||
const updateAllList = async () => {
|
||||
_deviceList.length = 0
|
||||
_deviceListNoTime.length = 0
|
||||
_deviceListNotRegister.length = 0
|
||||
_deviceListAll.length = 0
|
||||
_mappingList.length = 0
|
||||
_deviceList.push({
|
||||
id: -1,
|
||||
name: 'Time',
|
||||
})
|
||||
for (const device in _taskInfo.deviceList) {
|
||||
if (_taskInfo.deviceList[parseInt(device)].info.status === 'connected') {
|
||||
let _deviceListNotRegisterAdd = true
|
||||
_taskInfo.deviceAddrList.forEach(addr => {
|
||||
if (addr.toString() === _taskInfo.deviceList[parseInt(device)].info.device_address.toString()) {
|
||||
_deviceList.push({
|
||||
id: _taskInfo.taskDeviceID.indexOf(parseInt(device)),
|
||||
name: '[' + _taskInfo.taskDeviceID.indexOf(parseInt(device)) + '] ' + _taskInfo.deviceList[parseInt(device)].info.device_name,
|
||||
type: _taskInfo.deviceList[parseInt(device)].info.library_name,
|
||||
})
|
||||
_deviceListNoTime.push({
|
||||
id: _taskInfo.taskDeviceID.indexOf(parseInt(device)),
|
||||
name: '[' + _taskInfo.taskDeviceID.indexOf(parseInt(device)) + '] ' + _taskInfo.deviceList[parseInt(device)].info.device_name,
|
||||
type: _taskInfo.deviceList[parseInt(device)].info.library_name,
|
||||
})
|
||||
_mappingList.push({
|
||||
id: _taskInfo.taskDeviceID.indexOf(parseInt(device)),
|
||||
name: '[' + _taskInfo.taskDeviceID.indexOf(parseInt(device)) + '] ' + _taskInfo.deviceList[parseInt(device)].info.device_name,
|
||||
type: _taskInfo.deviceList[parseInt(device)].info.library_name,
|
||||
})
|
||||
_deviceListNotRegisterAdd = false
|
||||
}
|
||||
})
|
||||
if (_deviceListNotRegisterAdd) {
|
||||
_deviceListNotRegister.push({
|
||||
id: parseInt(device),
|
||||
name: '[' + device + '] ' + _taskInfo.deviceList[parseInt(device)].info.device_name,
|
||||
type: _taskInfo.deviceList[parseInt(device)].info.library_name,
|
||||
})
|
||||
}
|
||||
_deviceListAll.push({
|
||||
id: _taskInfo.taskDeviceID.indexOf(parseInt(device)),
|
||||
name: '[' + _taskInfo.taskDeviceID.indexOf(parseInt(device)) + '] ' + _taskInfo.deviceList[parseInt(device)].info.device_name,
|
||||
type: _taskInfo.deviceList[parseInt(device)].info.library_name,
|
||||
})
|
||||
}
|
||||
}
|
||||
_taskInfo.formulaList.forEach(formula => {
|
||||
_mappingList.push({
|
||||
id: formula.id,
|
||||
name: formula.name,
|
||||
type: formula.type,
|
||||
})
|
||||
})
|
||||
return _deviceList
|
||||
}
|
||||
|
||||
export const taskInfo = {
|
||||
|
||||
updateTaskInfo: async (taskID) => {
|
||||
const update = async () => {
|
||||
_taskInfo.controllerID = 'roy_test'
|
||||
}
|
||||
// _taskInfo.deviceAddrList = [[128, 111, 176, 237, 124, 140], [164, 218, 50, 212, 231, 58], [24, 4, 237, 55, 198, 53]]
|
||||
// _taskInfo.chartNumber = _taskInfo.deviceAddrList.length
|
||||
await update()
|
||||
return _taskInfo
|
||||
},
|
||||
|
||||
destroyed: () => {
|
||||
_taskInfo.controllerID = ''
|
||||
_taskInfo.deviceAddrList.length = 0
|
||||
_taskInfo.taskDeviceID.length = 0
|
||||
_taskInfo.chartNumber = 0
|
||||
deviceListRegister.length = 0
|
||||
for (const device in _taskInfo.deviceList) {
|
||||
_taskInfo.deviceList[device].info.status = ''
|
||||
_taskInfo.deviceList[device].info.isSync = false
|
||||
_taskInfo.deviceList[device].info.isStimulate = false
|
||||
}
|
||||
_taskInfo.formulaList.length = 0
|
||||
},
|
||||
|
||||
deviceInfo: async (mes) => {
|
||||
const mesObj = JSON.parse(mes)
|
||||
const update = async () => {
|
||||
try {
|
||||
if (Array.isArray(mesObj.data)) {
|
||||
mesObj.data.forEach(device => {
|
||||
for (const item in device) {
|
||||
if (parseInt(device.device_id) >= 0) {
|
||||
if (item !== 'configuration') {
|
||||
_taskInfo.deviceList[device.device_id].info[item] = device[item]
|
||||
} else {
|
||||
for (const parameter in device[item]) {
|
||||
_taskInfo.deviceList[device.device_id].parameterSet[parameter] = device[item][parameter]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
for (const item in mesObj.data) {
|
||||
if (parseInt(mesObj.data.device_id) >= 0) {
|
||||
if (item !== 'configuration') {
|
||||
_taskInfo.deviceList[mesObj.data.device_id].info[item] = mesObj.data[item]
|
||||
} else {
|
||||
for (const parameter in mesObj.data[item]) {
|
||||
_taskInfo.deviceList[mesObj.data.device_id].parameterSet[parameter] = mesObj.data[item][parameter]
|
||||
if (parameter === 'STIMULATING') {
|
||||
if (mesObj.data[item][parameter] === 1) {
|
||||
// temp update stimulate stauts way
|
||||
_taskInfo.deviceList[mesObj.data.device_id].info.isStimulate = true
|
||||
deviceListRegister.forEach(device => {
|
||||
if (device.id === _taskInfo.taskDeviceID.indexOf(parseInt(mesObj.data.device_id))) {
|
||||
device.isStimulate = true
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
return false
|
||||
}
|
||||
}
|
||||
await update()
|
||||
await updateAllList()
|
||||
return true
|
||||
},
|
||||
|
||||
deviceSavePath: async (mes) => {
|
||||
const mesObj = JSON.parse(mes)
|
||||
const update = async () => {
|
||||
try {
|
||||
_taskInfo.deviceList[mesObj.device].info.savePath = mesObj.data
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
return false
|
||||
}
|
||||
}
|
||||
await update()
|
||||
return true
|
||||
},
|
||||
|
||||
deviceParameter: async (mes) => {
|
||||
const mesObj = JSON.parse(mes)
|
||||
const update = async () => {
|
||||
try {
|
||||
for (const parameter in mesObj.data) {
|
||||
_taskInfo.deviceList[mesObj.device].parameterSet[parameter] = mesObj.data[parameter]
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
return false
|
||||
}
|
||||
}
|
||||
await update()
|
||||
await updateAllList()
|
||||
return true
|
||||
},
|
||||
|
||||
deviceConnected: async (id) => {
|
||||
const update = async () => {
|
||||
_taskInfo.deviceList[parseInt(id)].info.status = 'connected'
|
||||
}
|
||||
await update()
|
||||
await updateAllList()
|
||||
},
|
||||
|
||||
deviceDisconnected: async (deviceID) => {
|
||||
const update = async () => {
|
||||
taskInfo.getTaskInfo().deviceAddrList.splice(_taskInfo.taskDeviceID.indexOf(parseInt(deviceID)), 1)
|
||||
deviceListRegister.forEach(device => {
|
||||
if (device.id === _taskInfo.taskDeviceID.indexOf(parseInt(deviceID))) {
|
||||
deviceListRegister.splice(deviceListRegister.indexOf(device), 1)
|
||||
}
|
||||
})
|
||||
deviceListRegister.forEach(device => {
|
||||
if (device.id > _taskInfo.taskDeviceID.indexOf(parseInt(deviceID))) {
|
||||
device.id--
|
||||
}
|
||||
})
|
||||
_taskInfo.taskDeviceID.splice(_taskInfo.taskDeviceID.indexOf(parseInt(deviceID)), 1)
|
||||
_taskInfo.deviceList[parseInt(deviceID)].info.status = 'disconnected'
|
||||
}
|
||||
await update()
|
||||
await updateAllList()
|
||||
},
|
||||
|
||||
controllerShutdown: async () => {
|
||||
const update = async () => {
|
||||
for (const device in _taskInfo.deviceList) {
|
||||
_taskInfo.deviceList[device].info.status = 'disconnected'
|
||||
}
|
||||
for (const chart in _taskInfo.chartList) {
|
||||
_taskInfo.chartList[chart].run = false
|
||||
}
|
||||
deviceListRegister.length = 0
|
||||
}
|
||||
await update()
|
||||
await updateAllList()
|
||||
},
|
||||
|
||||
deviceStart: async (deviceID) => {
|
||||
const update = async () => {
|
||||
_taskInfo.deviceList[deviceID].info.isSync = true
|
||||
deviceListRegister.forEach(device => {
|
||||
if (device.id === _taskInfo.taskDeviceID.indexOf(parseInt(deviceID))) {
|
||||
device.isSync = true
|
||||
}
|
||||
})
|
||||
}
|
||||
await update()
|
||||
},
|
||||
|
||||
deviceStop: async (deviceID) => {
|
||||
const update = async () => {
|
||||
await dataStreamBuffer.removeByDevice(taskInfo.getRawDeviceID(deviceID))
|
||||
_taskInfo.deviceList[deviceID].info.isSync = false
|
||||
deviceListRegister.forEach(device => {
|
||||
if (device.id === _taskInfo.taskDeviceID.indexOf(parseInt(deviceID))) {
|
||||
device.isSync = false
|
||||
}
|
||||
})
|
||||
}
|
||||
await update()
|
||||
},
|
||||
|
||||
updateChartInfo: async () => {
|
||||
// for (const chartID in _taskInfo.chartList) {
|
||||
// if (chartData.getChartsData(chartID) == null) {
|
||||
// chartData.init(chartID, 2000, 1, 1)
|
||||
// }
|
||||
// chartData.getChartsData(chartID).cardName = _taskInfo.chartList[chartID].cardName
|
||||
// chartData.getChartsData(chartID).run = _taskInfo.chartList[chartID].run
|
||||
// chartData.getChartsData(chartID).cardHeight = _taskInfo.chartList[chartID].cardHeight
|
||||
// chartData.getChartsData(chartID).cardWidth = _taskInfo.chartList[chartID].cardWidth
|
||||
// chartData.getChartsData(chartID).maxDots = _taskInfo.chartList[chartID].maxDots
|
||||
// chartData.getChartsData(chartID).samplingRate = _taskInfo.chartList[chartID].samplingRate
|
||||
// chartData.updateGridList(chartID, _taskInfo.chartList[chartID].grids.length)
|
||||
// for (let i = 0; i < _taskInfo.chartList[chartID].grids.length; i++) {
|
||||
// _taskInfo.chartList[chartID].grids[i].forEach(line => {
|
||||
// if (line.x[0] === -1) {
|
||||
// chartData.register('NeuLive', i, chartID, line.y[0], line.y[1])
|
||||
// } else {
|
||||
// chartData.register('Elite', i, chartID, line.x[0], line.x[1], line.y[0], line.y[1])
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// return _taskInfo
|
||||
},
|
||||
|
||||
getDevicePic: (libraryName) => {
|
||||
if (libraryName == null) {
|
||||
return false
|
||||
}
|
||||
if (libraryName.indexOf('Elite') >= 0) {
|
||||
return eliteImgUrl
|
||||
} else if (libraryName.indexOf('Neulive') >= 0) {
|
||||
return neuliveImgUrl
|
||||
}
|
||||
},
|
||||
|
||||
addFormula: (formula) => {
|
||||
_taskInfo.formulaList.push(formula)
|
||||
},
|
||||
|
||||
removeFormula: (formula) => {
|
||||
_taskInfo.formulaList.splice(formula, 1)
|
||||
},
|
||||
|
||||
updateAllList: async () => {
|
||||
return await updateAllList()
|
||||
},
|
||||
|
||||
getTaskInfo: () => {
|
||||
return _taskInfo
|
||||
},
|
||||
|
||||
getDeviceIDByRaw: (_deviceID) => {
|
||||
return _taskInfo.taskDeviceID.indexOf(_deviceID)
|
||||
},
|
||||
|
||||
getRawDeviceID: (_taskDeviceID) => {
|
||||
return _taskInfo.taskDeviceID[_taskDeviceID]
|
||||
},
|
||||
|
||||
getDeviceInfo: (_taskDeviceID) => {
|
||||
return _taskInfo.deviceList[_taskInfo.taskDeviceID[_taskDeviceID]]
|
||||
},
|
||||
|
||||
getDeviceInfoByRawID: (_deviceID) => {
|
||||
return _taskInfo.deviceList[_deviceID]
|
||||
},
|
||||
|
||||
getDeviceList: () => {
|
||||
return _deviceList
|
||||
},
|
||||
|
||||
getDeviceListNoTime: () => {
|
||||
return _deviceListNoTime
|
||||
},
|
||||
|
||||
getDeviceListNotRegister: () => {
|
||||
return _deviceListNotRegister
|
||||
},
|
||||
|
||||
getDeviceListAll: () => {
|
||||
return _deviceListAll
|
||||
},
|
||||
|
||||
getDeviceListRegister: () => {
|
||||
return deviceListRegister
|
||||
},
|
||||
|
||||
getMappingList: () => {
|
||||
return _mappingList
|
||||
},
|
||||
|
||||
getFormulaList: () => {
|
||||
return _taskInfo.formulaList
|
||||
},
|
||||
|
||||
getFormulaIDStart: () => {
|
||||
return formulaIDStart
|
||||
},
|
||||
|
||||
}
|
||||