Compare commits

...

20 Commits

Author SHA1 Message Date
peterlu14 d7ad076dbe config add elite 2.0 2024-03-08 09:36:25 +08:00
peterlu14 4c24b08d92 -unshow battery when device working 2023-11-21 15:56:29 +08:00
peterlu14 753248826d -update add BAT 2023-10-02 14:43:08 +08:00
peterlu14 57c9972855 - change download default to excel 2023-07-11 15:30:43 +08:00
peterlu14 ba7145be76 - cycle cannot 0 2023-07-05 17:42:04 +08:00
peterlu14 f0fe12bc84 - 需要下拉選單的指示
- enable/disanable 綠色調整
- 開關往下移讓他跟 s 置中對齊
- 5V output 的 on
- 前端/ UI 輸入要做限制,s 輸入最小精度 0.1 s,current 電流輸入最小精度 0.1 mA
- 名稱文字調整
- Fix current range
2023-06-21 16:58:56 +08:00
peterlu14 096ecb4a7e -update folder click 2023-06-14 16:10:40 +08:00
peterlu14 5614bf69ed -fix backend data type error 2023-06-13 13:42:49 +08:00
peterlu14 d60438e952 - update trigger 2023-06-13 09:49:16 +08:00
peterlu14 55dde2a4e4 -remake trigger 2023-06-13 09:31:07 +08:00
peterlu14 0b1afd6f29 -add trigger dev mode 2023-05-15 11:37:40 +08:00
Roy 74f755a966 [update] fix channel unit 2023-04-14 09:03:49 +08:00
peterlu14 1072b37139 - fix folder bug 2023-04-13 16:34:08 +08:00
peterlu14 030e63b8c6 - fix real time channel info 2023-04-13 16:26:48 +08:00
peterlu14 1aa6cc6d31 - config table add physicalQuantity 2023-04-13 16:24:34 +08:00
peterlu14 30db3a9232 - fix folder conflict problem 2023-04-13 11:47:38 +08:00
peterlu14 0d2b97b87e - remove duplicate messages
- prevent multi-user refresh cause chart clear problem
- chart series add lttb
2023-04-13 10:56:24 +08:00
peterlu14 b4169367aa - download display rebuild
- support download
- support offline-download
2023-04-12 18:44:32 +08:00
peterlu14 820d59cb2f Merge remote-tracking branch 'origin/dev/8hstia' into dev/scheduler-datatable-8hstia 2023-04-12 14:57:15 +08:00
Roy ce4cf4078b [update] up to 8 hstia 2023-04-11 13:12:32 +08:00
49 changed files with 1616 additions and 705 deletions
+4
View File
@@ -0,0 +1,4 @@
<svg width="270" height="110" viewBox="0 0 270 110" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="270" height="110" rx="55" fill="#A4A3A3"/>
<path d="M84.9 88.9C80.4 88.9 76.41 88 72.93 86.2C69.45 84.34 66.75 81.73 64.83 78.37C62.97 75.01 62.04 71.14 62.04 66.76V46.24C62.04 41.92 63 38.11 64.92 34.81C66.84 31.45 69.51 28.87 72.93 27.07C76.41 25.21 80.4 24.28 84.9 24.28C89.46 24.28 93.45 25.21 96.87 27.07C100.35 28.87 103.05 31.45 104.97 34.81C106.89 38.11 107.85 41.92 107.85 46.24V66.76C107.85 71.14 106.89 75.01 104.97 78.37C103.05 81.73 100.35 84.34 96.87 86.2C93.45 88 89.46 88.9 84.9 88.9ZM84.9 79.9C88.68 79.9 91.71 78.73 93.99 76.39C96.27 74.05 97.41 70.96 97.41 67.12V46.15C97.41 42.25 96.27 39.13 93.99 36.79C91.71 34.45 88.68 33.28 84.9 33.28C81.18 33.28 78.18 34.45 75.9 36.79C73.62 39.13 72.48 42.25 72.48 46.15V67.12C72.48 70.96 73.62 74.05 75.9 76.39C78.18 78.73 81.18 79.9 84.9 79.9ZM162.038 32.92C162.038 33.22 161.918 33.49 161.678 33.73C161.498 33.91 161.258 34 160.958 34H130.358C130.058 34 129.908 34.15 129.908 34.45V51.28C129.908 51.58 130.058 51.73 130.358 51.73H150.968C151.268 51.73 151.508 51.85 151.688 52.09C151.928 52.27 152.048 52.51 152.048 52.81V59.65C152.048 59.95 151.928 60.22 151.688 60.46C151.508 60.64 151.268 60.73 150.968 60.73H130.358C130.058 60.73 129.908 60.88 129.908 61.18V86.92C129.908 87.22 129.788 87.49 129.548 87.73C129.368 87.91 129.128 88 128.828 88H120.548C120.248 88 119.978 87.91 119.738 87.73C119.558 87.49 119.468 87.22 119.468 86.92V26.08C119.468 25.78 119.558 25.54 119.738 25.36C119.978 25.12 120.248 25 120.548 25H160.958C161.258 25 161.498 25.12 161.678 25.36C161.918 25.54 162.038 25.78 162.038 26.08V32.92ZM212.751 32.92C212.751 33.22 212.631 33.49 212.391 33.73C212.211 33.91 211.971 34 211.671 34H181.071C180.771 34 180.621 34.15 180.621 34.45V51.28C180.621 51.58 180.771 51.73 181.071 51.73H201.681C201.981 51.73 202.221 51.85 202.401 52.09C202.641 52.27 202.761 52.51 202.761 52.81V59.65C202.761 59.95 202.641 60.22 202.401 60.46C202.221 60.64 201.981 60.73 201.681 60.73H181.071C180.771 60.73 180.621 60.88 180.621 61.18V86.92C180.621 87.22 180.501 87.49 180.261 87.73C180.081 87.91 179.841 88 179.541 88H171.261C170.961 88 170.691 87.91 170.451 87.73C170.271 87.49 170.181 87.22 170.181 86.92V26.08C170.181 25.78 170.271 25.54 170.451 25.36C170.691 25.12 170.961 25 171.261 25H211.671C211.971 25 212.211 25.12 212.391 25.36C212.631 25.54 212.751 25.78 212.751 26.08V32.92Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

+3
View File
@@ -0,0 +1,3 @@
<svg width="65" height="65" viewBox="0 0 65 65" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="65" height="65" rx="32.5" fill="#CDCDCD"/>
</svg>

After

Width:  |  Height:  |  Size: 159 B

+3
View File
@@ -0,0 +1,3 @@
<svg width="65" height="65" viewBox="0 0 65 65" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="65" height="65" rx="32.5" fill="#2CE9A4"/>
</svg>

After

Width:  |  Height:  |  Size: 159 B

+4
View File
@@ -0,0 +1,4 @@
<svg width="270" height="110" viewBox="0 0 270 110" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="270" height="110" rx="55" fill="#FF8989"/>
<path d="M84.9 88.9C80.4 88.9 76.41 88 72.93 86.2C69.45 84.34 66.75 81.73 64.83 78.37C62.97 75.01 62.04 71.14 62.04 66.76V46.24C62.04 41.92 63 38.11 64.92 34.81C66.84 31.45 69.51 28.87 72.93 27.07C76.41 25.21 80.4 24.28 84.9 24.28C89.46 24.28 93.45 25.21 96.87 27.07C100.35 28.87 103.05 31.45 104.97 34.81C106.89 38.11 107.85 41.92 107.85 46.24V66.76C107.85 71.14 106.89 75.01 104.97 78.37C103.05 81.73 100.35 84.34 96.87 86.2C93.45 88 89.46 88.9 84.9 88.9ZM84.9 79.9C88.68 79.9 91.71 78.73 93.99 76.39C96.27 74.05 97.41 70.96 97.41 67.12V46.15C97.41 42.25 96.27 39.13 93.99 36.79C91.71 34.45 88.68 33.28 84.9 33.28C81.18 33.28 78.18 34.45 75.9 36.79C73.62 39.13 72.48 42.25 72.48 46.15V67.12C72.48 70.96 73.62 74.05 75.9 76.39C78.18 78.73 81.18 79.9 84.9 79.9ZM162.038 32.92C162.038 33.22 161.918 33.49 161.678 33.73C161.498 33.91 161.258 34 160.958 34H130.358C130.058 34 129.908 34.15 129.908 34.45V51.28C129.908 51.58 130.058 51.73 130.358 51.73H150.968C151.268 51.73 151.508 51.85 151.688 52.09C151.928 52.27 152.048 52.51 152.048 52.81V59.65C152.048 59.95 151.928 60.22 151.688 60.46C151.508 60.64 151.268 60.73 150.968 60.73H130.358C130.058 60.73 129.908 60.88 129.908 61.18V86.92C129.908 87.22 129.788 87.49 129.548 87.73C129.368 87.91 129.128 88 128.828 88H120.548C120.248 88 119.978 87.91 119.738 87.73C119.558 87.49 119.468 87.22 119.468 86.92V26.08C119.468 25.78 119.558 25.54 119.738 25.36C119.978 25.12 120.248 25 120.548 25H160.958C161.258 25 161.498 25.12 161.678 25.36C161.918 25.54 162.038 25.78 162.038 26.08V32.92ZM212.751 32.92C212.751 33.22 212.631 33.49 212.391 33.73C212.211 33.91 211.971 34 211.671 34H181.071C180.771 34 180.621 34.15 180.621 34.45V51.28C180.621 51.58 180.771 51.73 181.071 51.73H201.681C201.981 51.73 202.221 51.85 202.401 52.09C202.641 52.27 202.761 52.51 202.761 52.81V59.65C202.761 59.95 202.641 60.22 202.401 60.46C202.221 60.64 201.981 60.73 201.681 60.73H181.071C180.771 60.73 180.621 60.88 180.621 61.18V86.92C180.621 87.22 180.501 87.49 180.261 87.73C180.081 87.91 179.841 88 179.541 88H171.261C170.961 88 170.691 87.91 170.451 87.73C170.271 87.49 170.181 87.22 170.181 86.92V26.08C170.181 25.78 170.271 25.54 170.451 25.36C170.691 25.12 170.961 25 171.261 25H211.671C211.971 25 212.211 25.12 212.391 25.36C212.631 25.54 212.751 25.78 212.751 26.08V32.92Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

+4
View File
@@ -0,0 +1,4 @@
<svg width="270" height="110" viewBox="0 0 270 110" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="270" height="110" rx="55" fill="#41DBA2"/>
<path d="M104.9 88.9C100.4 88.9 96.41 88 92.93 86.2C89.45 84.34 86.75 81.73 84.83 78.37C82.97 75.01 82.04 71.14 82.04 66.76V46.24C82.04 41.92 83 38.11 84.92 34.81C86.84 31.45 89.51 28.87 92.93 27.07C96.41 25.21 100.4 24.28 104.9 24.28C109.46 24.28 113.45 25.21 116.87 27.07C120.35 28.87 123.05 31.45 124.97 34.81C126.89 38.11 127.85 41.92 127.85 46.24V66.76C127.85 71.14 126.89 75.01 124.97 78.37C123.05 81.73 120.35 84.34 116.87 86.2C113.45 88 109.46 88.9 104.9 88.9ZM104.9 79.9C108.68 79.9 111.71 78.73 113.99 76.39C116.27 74.05 117.41 70.96 117.41 67.12V46.15C117.41 42.25 116.27 39.13 113.99 36.79C111.71 34.45 108.68 33.28 104.9 33.28C101.18 33.28 98.18 34.45 95.9 36.79C93.62 39.13 92.48 42.25 92.48 46.15V67.12C92.48 70.96 93.62 74.05 95.9 76.39C98.18 78.73 101.18 79.9 104.9 79.9ZM176.098 26.08C176.098 25.78 176.188 25.54 176.368 25.36C176.608 25.12 176.878 25 177.178 25H185.458C185.758 25 185.998 25.12 186.178 25.36C186.418 25.54 186.538 25.78 186.538 26.08V86.92C186.538 87.22 186.418 87.49 186.178 87.73C185.998 87.91 185.758 88 185.458 88H177.448C176.848 88 176.428 87.76 176.188 87.28L150.268 44.8C150.148 44.62 150.028 44.56 149.908 44.62C149.788 44.62 149.728 44.74 149.728 44.98L149.908 86.92C149.908 87.22 149.788 87.49 149.548 87.73C149.368 87.91 149.128 88 148.828 88H140.548C140.248 88 139.978 87.91 139.738 87.73C139.558 87.49 139.468 87.22 139.468 86.92V26.08C139.468 25.78 139.558 25.54 139.738 25.36C139.978 25.12 140.248 25 140.548 25H148.558C149.158 25 149.578 25.24 149.818 25.72L175.648 68.2C175.768 68.38 175.888 68.47 176.008 68.47C176.128 68.41 176.188 68.26 176.188 68.02L176.098 26.08Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

+177 -174
View File
@@ -1,15 +1,5 @@
<template>
<div>
<div class="row flex sm12 xl12 md12 xs12" style="height: 100vh;">
<div class="flex-center spinner-box mt-4 mb-5">
<fulfilling-bouncing-circle-spinner
:animation-duration="3000"
:color="'#6c7fee'"
:size="60"
>
</fulfilling-bouncing-circle-spinner>
</div>
</div>
</div>
</template>
@@ -17,7 +7,6 @@
import api from '@/data/api/index'
import types from '@/store/modules/download/types'
import { mapActions, mapMutations } from 'vuex'
import { FulfillingBouncingCircleSpinner } from 'epic-spinners'
import { mapFields } from 'vuex-map-fields'
import newDownload from '@/factories/file/downloadFactory'
import newChannel from '@/factories/file/channelFactory'
@@ -27,11 +16,17 @@ import configTable from '@/data/config-table/index'
export default {
name: 'Download',
components: {
FulfillingBouncingCircleSpinner,
},
data: () => {
return {
controllerList: [],
downloadList: [],
format: 'excel',
channel: '',
metaListNew: [],
downloading: false,
fileNums: 0,
count: 0,
}
},
computed: {
@@ -67,6 +62,172 @@ export default {
}
return results
},
writeFiles: async function () {
if (this.metaListNew.length !== 0 && this.downloading === false) {
this.downloading = true
let meta
const metaID = this.metaListNew.pop()
const ret = await api.meta.getByID(metaID)
if (ret.status === 200) {
meta = ret.data[0]
}
if (meta !== undefined) {
this.metaInfo = meta
const channelParamObj = configTable.getModeConfig(meta.device.library_name, meta.parameter_set.MODE).channels
const channelArray = this.channel === 'all' ? JSON.parse(this.metaInfo.channels) : Object.keys(channelParamObj).filter(ele => ele !== 'time')
const channelList = []
// split to different subfile by channel
if (meta.device.library_name.indexOf('Neulive') >= 0) {
if (channelArray.some(el => el >= 256)) {
channelList.push(channelArray.filter(el => (el >= 256 && el <= 259)))
channelList.push(channelArray.filter(el => el < 256))
} else {
channelList.push(channelArray)
}
} else if (meta.device.library_name.indexOf('Elite') >= 0) {
channelList.push(channelArray)
}
while (channelList.length > 0) {
const channels = channelList.pop()
let maxSplitFiles = 1
let fileIndex = 0
// find max raw data need sub file
for (const rawDataIndex of channels) {
const dataLength = meta.raw_data[rawDataIndex].length
maxSplitFiles = Math.max(maxSplitFiles, Math.ceil(meta.raw_data[rawDataIndex].length / dataLength))
meta.raw_data[rawDataIndex] = this.chunkArray(meta.raw_data[rawDataIndex], dataLength)
}
while (fileIndex < maxSplitFiles) {
// create new download info & add channel
if (this.downloadInfo === null) {
this.downloadInfo = newDownload()
}
this.downloadInfo.channel = channels
// download format
this.downloadInfo.format = this.format
// download device and filename
if (meta.device.library_name.indexOf('Neulive') >= 0) {
this.downloadInfo.device = [meta.device.library_name.slice(0, 7), meta.device.library_name.slice(7)]
if (this.downloadInfo.channel.some(el => el >= 256 && el <= 259)) {
this.downloadInfo.filename = meta.name + '-accerlate'
this.downloadInfo.size = parseInt(parseInt(meta.size) / (76 * (maxSplitFiles)))
} else {
this.downloadInfo.filename = meta.name
this.downloadInfo.size = parseInt(meta.size / (maxSplitFiles))
}
} else if (meta.device.library_name.indexOf('Elite') >= 0) {
this.downloadInfo.device = [meta.device.library_name.slice(0, 5), meta.device.library_name.slice(5)]
this.downloadInfo.filename = meta.name
this.downloadInfo.size = parseInt(meta.size / (maxSplitFiles))
}
// create new channel info & get sample rate
for (const channel of this.downloadInfo.channel) {
if (this.downloadInfo.channelInfo[channel] === undefined) {
this.downloadInfo.channelInfo[channel] = newChannel()
this.setSampleRateDownload({ channel: channel })
}
}
// set download ID list
this.clearIDListDownload()
for (const channel of this.downloadInfo.channel) {
this.setIDListDownload({ channel: channel, fileIndex: fileIndex })
}
// if create writer
this.clearStreamDownload()
this.setStreamDownload()
// set Header
if (this.downloadInfo.format !== 'csv-edf') {
await this.setHeaderExport()
}
await this.setTitleExport()
// start download data
let rowIndex = 0
let columnNum = 0
const requestArray = []
console.time('download')
// console.log(this.downloadInfo)
while (rowIndex - 10 < this.downloadInfo.maxRows) {
// console.log('rowIndex < this.downloadInfo.maxRows', rowIndex, this.downloadInfo.maxRows)
for (const channel of this.downloadInfo.channel) {
columnNum = this.downloadInfo.channelInfo[channel].downloadIDList.length
for (const idx in this.downloadInfo.channelInfo[channel].downloadIDList) {
const _idx = parseInt(idx)
if (this.downloadInfo.channelInfo[channel].downloadDataBuffer[idx] === undefined) {
this.downloadInfo.channelInfo[channel].downloadDataBuffer[idx] = []
}
// const rawID = this.downloadInfo.channelInfo[channel].downloadIDList[_idx][rowIndex]
const rawIDList = this.downloadInfo.channelInfo[channel].downloadIDList[_idx].slice(rowIndex, rowIndex + 10)
// console.log(channel, rawIDList)
rawIDList.length > 0 && requestArray.push(api.raw.getAttrByIDs(channel, rawIDList, 'id-channel-size-serial_number-start_time-end_time-data'))
if (rawIDList.length === 0) columnNum -= 1
}
}
const responseArray = await Promise.all(requestArray)
for (const responseIndex in responseArray) {
const response = responseArray[responseIndex]
// console.log('response', response)
const idx = responseIndex % columnNum
for (const data of response.data) {
const timeUnitScale = channelParamObj.time.unit[channelParamObj.time.downloadUnit]
const channelUnitScale = channelParamObj[data.channel]?.unit[channelParamObj[data.channel]?.downloadUnit]
// console.log('data', data)
const dataArray = data.data.split('"***"').slice(0, -1)
// console.log('dataArray', dataArray)
for (const raw of dataArray) {
const rawArray = raw.split(' ')
const newArray = rawArray[0] === '' ? [] : rawArray.map((ele, index) => {
// console.log((parseInt(ele) / timeUnitScale).toFixed(Math.log10(timeUnitScale)))
return (index % 2 === 0) ? String((parseInt(ele) / timeUnitScale).toFixed(Math.log10(timeUnitScale))) : channelUnitScale ? String((parseInt(ele) / channelUnitScale).toFixed(Math.log10(channelUnitScale))) : ele
})
this.downloadInfo.channelInfo[data.channel].downloadDataBuffer[idx].push(...newArray)
// console.log('rawArray', rawArray)
}
}
}
requestArray.length = 0
// console.log('this.downloadInfo.channelInfo', this.downloadInfo.channelInfo)
// console.log('this.downloadInfo.maxRows', this.downloadInfo.maxRows)
await this.setDataExport({ last: (rowIndex >= this.downloadInfo.maxRows - 1) })
rowIndex += 10
}
this.closeWriterDownload()
fileIndex += 1
}
console.timeEnd('download')
}
}
this.count += 1
this.downloading = false
this.$emit('download-finish')
if (this.fileNums === 1) {
this.showToast('Download Finish', {
position: 'bottom-right',
})
} else {
this.showToast(`${this.count} / ${this.fileNums} Finish`, {
position: 'bottom-right',
})
}
}
},
...mapActions('download',
[
types.raw.rawDataByID,
@@ -93,171 +254,13 @@ export default {
async mounted () {
await this.getControllerList()
// TODO authorization
const format = this.$route.params.format.split('-')[0]
const allChannel = this.$route.params.format.split('-')[1]
this.metaList = this.$route.params.metaList.split('-')
const sd = this.$route.params.sd
while (this.metaList.length !== 0) {
let meta
const metaID = this.metaList.pop()
if (metaID === '') continue
const ret = await api.meta.getByID(metaID)
if (ret.status === 200) {
meta = ret.data[0]
}
if (meta !== undefined) {
this.metaInfo = meta
const channelParamObj = configTable.getModeConfig(meta.device.library_name, meta.parameter_set.MODE).channels
const channelArray = allChannel === 'all' ? JSON.parse(this.metaInfo.channels) : Object.keys(channelParamObj).filter(ele => ele !== 'time')
const channelList = []
// split to different subfile by channel
if (meta.device.library_name.indexOf('Neulive') >= 0) {
if (channelArray.some(el => el >= 256)) {
channelList.push(channelArray.filter(el => (el >= 256 && el <= 259)))
channelList.push(channelArray.filter(el => el < 256))
} else {
channelList.push(channelArray)
}
} else if (meta.device.library_name.indexOf('Elite') >= 0) {
channelList.push(channelArray)
}
while (channelList.length > 0) {
const channels = channelList.pop()
let maxSplitFiles = 1
let fileIndex = 0
// find max raw data need sub file
for (const rawDataIndex of channels) {
const dataLength = meta.raw_data[rawDataIndex].length
maxSplitFiles = Math.max(maxSplitFiles, Math.ceil(meta.raw_data[rawDataIndex].length / dataLength))
meta.raw_data[rawDataIndex] = this.chunkArray(meta.raw_data[rawDataIndex], dataLength)
}
while (fileIndex < maxSplitFiles) {
// create new download info & add channel
if (this.downloadInfo === null) {
this.downloadInfo = newDownload()
}
this.downloadInfo.channel = channels
// download format
this.downloadInfo.format = format
// download device and filename
if (meta.device.library_name.indexOf('Neulive') >= 0) {
this.downloadInfo.device = [meta.device.library_name.slice(0, 7), meta.device.library_name.slice(7)]
if (this.downloadInfo.channel.some(el => el >= 256 && el <= 259)) {
this.downloadInfo.filename = meta.name + '-accerlate'
this.downloadInfo.filename += (sd !== undefined) ? '-sd' : ''
this.downloadInfo.size = parseInt(parseInt(meta.size) / (76 * (maxSplitFiles)))
} else {
this.downloadInfo.filename = meta.name
this.downloadInfo.filename += (sd !== undefined) ? '-sd' : ''
this.downloadInfo.size = parseInt(meta.size / (maxSplitFiles))
}
} else if (meta.device.library_name.indexOf('Elite') >= 0) {
this.downloadInfo.device = [meta.device.library_name.slice(0, 5), meta.device.library_name.slice(5)]
this.downloadInfo.filename = meta.name
this.downloadInfo.size = parseInt(meta.size / (maxSplitFiles))
}
// create new channel info & get sample rate
for (const channel of this.downloadInfo.channel) {
if (this.downloadInfo.channelInfo[channel] === undefined) {
this.downloadInfo.channelInfo[channel] = newChannel()
this.setSampleRateDownload({ channel: channel })
}
}
// set download ID list
this.clearIDListDownload()
for (const channel of this.downloadInfo.channel) {
this.setIDListDownload({ channel: channel, fileIndex: fileIndex })
}
// if create writer
this.clearStreamDownload()
this.setStreamDownload()
// set Header
if (this.downloadInfo.format !== 'csv-edf') {
await this.setHeaderExport()
}
await this.setTitleExport()
// start download data
let rowIndex = 0
let columnNum = 0
const requestArray = []
console.time('download')
// console.log(this.downloadInfo)
while (rowIndex - 10 < this.downloadInfo.maxRows) {
// console.log('rowIndex < this.downloadInfo.maxRows', rowIndex, this.downloadInfo.maxRows)
for (const channel of this.downloadInfo.channel) {
columnNum = this.downloadInfo.channelInfo[channel].downloadIDList.length
for (const idx in this.downloadInfo.channelInfo[channel].downloadIDList) {
const _idx = parseInt(idx)
if (this.downloadInfo.channelInfo[channel].downloadDataBuffer[idx] === undefined) {
this.downloadInfo.channelInfo[channel].downloadDataBuffer[idx] = []
}
// const rawID = this.downloadInfo.channelInfo[channel].downloadIDList[_idx][rowIndex]
const rawIDList = this.downloadInfo.channelInfo[channel].downloadIDList[_idx].slice(rowIndex, rowIndex + 10)
// console.log(channel, rawIDList)
rawIDList.length > 0 && requestArray.push(api.raw.getAttrByIDs(channel, rawIDList, 'id-channel-size-serial_number-start_time-end_time-data'))
if (rawIDList.length === 0) columnNum -= 1
}
}
const responseArray = await Promise.all(requestArray)
// console.log('responseArray', responseArray)
for (const responseIndex in responseArray) {
const response = responseArray[responseIndex]
// console.log('response', response)
const idx = responseIndex % columnNum
for (const data of response.data) {
const timeUnitScale = channelParamObj.time.unit[channelParamObj.time.downloadUnit]
const channelUnitScale = channelParamObj[data.channel]?.unit[channelParamObj[data.channel]?.downloadUnit]
// console.log('data', data)
const dataArray = data.data.split('"***"').slice(0, -1)
// console.log('dataArray', dataArray)
for (const raw of dataArray) {
const rawArray = raw.split(' ')
const newArray = rawArray[0] === '' ? [] : rawArray.map((ele, index) => {
// console.log((parseInt(ele) / timeUnitScale).toFixed(Math.log10(timeUnitScale)))
return (index % 2 === 0) ? String((parseInt(ele) / timeUnitScale).toFixed(Math.log10(timeUnitScale))) : channelUnitScale ? String((parseInt(ele) / channelUnitScale).toFixed(Math.log10(channelUnitScale))) : ele
})
this.downloadInfo.channelInfo[data.channel].downloadDataBuffer[idx].push(...newArray)
// console.log('rawArray', rawArray)
}
}
}
requestArray.length = 0
// console.log('this.downloadInfo.channelInfo', this.downloadInfo.channelInfo)
// console.log('this.downloadInfo.maxRows', this.downloadInfo.maxRows)
await this.setDataExport({ last: (rowIndex >= this.downloadInfo.maxRows - 1) })
rowIndex += 10
}
this.closeWriterDownload()
fileIndex += 1
}
console.timeEnd('download')
}
}
}
await new Promise(resolve => setTimeout(resolve, 2000)) // sleep 2s prevent window close
window.close()
// await new Promise(resolve => setTimeout(resolve, 2000)) // sleep 2s prevent window close
// window.close()
setInterval(this.writeFiles, 1000)
},
destroyed () {
this.pageMqttUnSub()
// this.pageMqttUnSub()
},
}
</script>
+158 -170
View File
@@ -1,18 +1,8 @@
<template>
<div>
<div class="row flex sm12 xl12 md12 xs12" style="height: 100vh;">
<div class="flex-center spinner-box mt-4 mb-5">
<fulfilling-bouncing-circle-spinner
:animation-duration="3000"
:color="'#6c7fee'"
:size="60"
>
</fulfilling-bouncing-circle-spinner>
<progress-modal
:ref="'progressModalRef'"
/>
</div>
</div>
<progress-modal
:ref="'progressModalRef'"
/>
</div>
</template>
@@ -20,7 +10,6 @@
import api from '@/data/api/index'
import types from '@/store/modules/download/types'
import { mapActions, mapMutations } from 'vuex'
import { FulfillingBouncingCircleSpinner } from 'epic-spinners'
import { mapFields } from 'vuex-map-fields'
import newDownload from '@/factories/file/downloadFactory'
import newChannel from '@/factories/file/channelFactory'
@@ -31,12 +20,18 @@ import configTable from '@/data/config-table/index'
export default {
name: 'DownloadOffline',
components: {
FulfillingBouncingCircleSpinner,
progressModal,
},
data: () => {
return {
controllerList: [],
downloadList: [],
format: 'excel',
channel: '',
metaListNew: [],
downloading: false,
fileNums: 0,
count: 0,
}
},
computed: {
@@ -72,6 +67,153 @@ export default {
}
return results
},
writeFiles: async function () {
if (this.metaListNew.length !== 0 && this.downloading === false) {
let meta
const metaID = this.metaListNew.pop()
const ret = await api.meta.getByID(metaID)
if (ret.status === 200) {
meta = ret.data[0]
}
if (meta !== undefined) {
this.metaInfo = meta
const channelParamObj = configTable.getModeConfig(meta.device.library_name, meta.parameter_set.MODE).channels
const channelArray = this.channel === 'all' ? JSON.parse(this.metaInfo.channels) : Object.keys(channelParamObj).filter(ele => ele !== 'time')
const channelList = []
if (meta.device.library_name.indexOf('Neulive') >= 0) {
if (channelArray.some(el => el >= 256)) {
channelList.push(channelArray.filter(el => (el >= 256 && el <= 259)))
channelList.push(channelArray.filter(el => el < 256))
} else {
channelList.push(channelArray)
}
} else if (meta.device.library_name.indexOf('Elite') >= 0) {
channelList.push(channelArray)
}
this.$refs.progressModalRef.show()
while (channelList.length > 0) {
const channels = channelList.pop()
let maxSplitFiles = 1
let fileIndex = 0
// find max raw data need sub file
for (const rawDataIndex of Object.keys(meta.raw_data)) {
let dataLength = 0
if (rawDataIndex >= 256) {
dataLength = meta.raw_data[rawDataIndex].length
} else {
dataLength = 10000
}
maxSplitFiles = Math.max(maxSplitFiles, Math.ceil(meta.raw_data[rawDataIndex].length / dataLength))
meta.raw_data[rawDataIndex] = this.chunkArray(meta.raw_data[rawDataIndex], dataLength)
}
while (fileIndex < maxSplitFiles) {
if (this.downloadInfo === null) {
this.downloadInfo = newDownload()
}
this.downloadInfo.channel = channels
// download format
this.downloadInfo.format = this.format
// download device and filename
if (meta.device.library_name.indexOf('Neulive') >= 0) {
this.downloadInfo.device = [meta.device.library_name.slice(0, 7), meta.device.library_name.slice(7)]
if (this.downloadInfo.channel.some(el => el >= 256 && el <= 259)) {
this.downloadInfo.filename = meta.name + '-accerlate-' + this.format
this.downloadInfo.size = parseInt(parseInt(meta.size) / 76)
} else {
this.downloadInfo.filename = meta.name + '-' + this.format
this.downloadInfo.size = parseInt(meta.size)
}
} else if (meta.device.library_name.indexOf('Elite') >= 0) {
this.downloadInfo.device = [meta.device.library_name.slice(0, 5), meta.device.library_name.slice(5)]
this.downloadInfo.filename = meta.name + '-' + (fileIndex + 1).toString()
this.downloadInfo.size = parseInt(meta.size)
}
this.$refs.progressModalRef.setTitle(this.downloadInfo.filename)
// get sampleRate && downloadList
for (const channel of this.downloadInfo.channel) {
if (this.downloadInfo.channelInfo[channel] === undefined) {
this.downloadInfo.channelInfo[channel] = newChannel()
this.setSampleRateDownload({ channel: channel })
}
}
this.clearIDListDownload()
for (const channel of this.downloadInfo.channel) {
this.setIDListDownload({ channel: channel, fileIndex: fileIndex })
}
// start download data
fileIndex += 1
let rowIndex = 0
let columnNum = 0
const requestArray = []
console.time('download')
while (rowIndex - 10 < this.downloadInfo.maxRows) {
this.$refs.progressModalRef.setValue(parseInt((rowIndex / this.downloadInfo.maxRows) * 100))
// console.log('rowIndex < this.downloadInfo.maxRows', rowIndex, this.downloadInfo.maxRows)
for (const channel of this.downloadInfo.channel) {
columnNum = this.downloadInfo.channelInfo[channel].downloadIDList.length
for (const idx in this.downloadInfo.channelInfo[channel].downloadIDList) {
const _idx = parseInt(idx)
if (this.downloadInfo.channelInfo[channel].downloadDataBuffer[idx] === undefined) {
this.downloadInfo.channelInfo[channel].downloadDataBuffer[idx] = []
}
// const rawID = this.downloadInfo.channelInfo[channel].downloadIDList[_idx][rowIndex]
const rawIDList = this.downloadInfo.channelInfo[channel].downloadIDList[_idx].slice(rowIndex, rowIndex + 10)
// console.log(channel, rawIDList)
rawIDList.length > 0 && requestArray.push(api.raw.getAttrByIDs(channel, rawIDList, 'id-channel-size-serial_number-start_time-end_time-data'))
if (rawIDList.length === 0) columnNum -= 1
}
}
const responseArray = await Promise.all(requestArray)
// console.log('responseArray', responseArray)
for (const responseIndex in responseArray) {
const response = responseArray[responseIndex]
// console.log('response', response)
const idx = responseIndex % columnNum
// console.log('response', response)
for (const data of response.data) {
const timeUnitScale = channelParamObj.time.unit[channelParamObj.time.downloadUnit]
const channelUnitScale = channelParamObj[data.channel]?.unit[channelParamObj[data.channel]?.downloadUnit]
// console.log('data', data)
const dataArray = data.data.split('"***"').slice(0, -1)
// console.log('dataArray', dataArray)
for (const raw of dataArray) {
const rawArray = raw.split(' ')
const newArray = rawArray[0] === '' ? [] : rawArray.map((ele, index) => {
return (index % 2 === 0) ? String((parseInt(ele) / timeUnitScale).toFixed(Math.log10(timeUnitScale))) : channelUnitScale ? String((parseInt(ele) / channelUnitScale).toFixed(Math.log10(channelUnitScale))) : ele
})
this.downloadInfo.channelInfo[data.channel].downloadDataBuffer[idx].push(...newArray)
// console.log('rawArray', rawArray)
}
}
}
requestArray.length = 0
// console.log('this.downloadInfo.channelInfo', this.downloadInfo.channelInfo)
// console.log('this.downloadInfo.maxRows', this.downloadInfo.maxRows)
// await this.setDataExport({ last: (rowIndex >= this.downloadInfo.maxRows - 1) })
rowIndex += 10
}
await this.setAllExport({ last: (rowIndex >= this.downloadInfo.maxRows - 1) })
this.$refs.progressModalRef.setValue(100)
}
}
}
}
},
...mapActions('download',
[
types.raw.rawDataByID,
@@ -97,161 +239,7 @@ export default {
},
async mounted () {
await this.getControllerList()
// TODO authorization
const format = this.$route.params.format.split('-')[0]
const allChannel = this.$route.params.format.split('-')[1]
this.metaList = this.$route.params.metaList.split('-')
const sd = this.$route.params.sd
while (this.metaList.length !== 0) {
let meta
const metaID = this.metaList.pop()
const ret = await api.meta.getByID(metaID)
if (ret.status === 200) {
meta = ret.data[0]
}
if (meta !== undefined) {
this.metaInfo = meta
const channelParamObj = configTable.getModeConfig(meta.device.library_name, meta.parameter_set.MODE).channels
const channelArray = allChannel === 'all' ? JSON.parse(this.metaInfo.channels) : Object.keys(channelParamObj).filter(ele => ele !== 'time')
const channelList = []
if (meta.device.library_name.indexOf('Neulive') >= 0) {
if (channelArray.some(el => el >= 256)) {
channelList.push(channelArray.filter(el => (el >= 256 && el <= 259)))
channelList.push(channelArray.filter(el => el < 256))
} else {
channelList.push(channelArray)
}
} else if (meta.device.library_name.indexOf('Elite') >= 0) {
channelList.push(channelArray)
}
this.$refs.progressModalRef.show()
while (channelList.length > 0) {
const channels = channelList.pop()
let maxSplitFiles = 1
let fileIndex = 0
// find max raw data need sub file
for (const rawDataIndex of Object.keys(meta.raw_data)) {
let dataLength = 0
if (rawDataIndex >= 256) {
dataLength = meta.raw_data[rawDataIndex].length
} else {
dataLength = 10000
}
maxSplitFiles = Math.max(maxSplitFiles, Math.ceil(meta.raw_data[rawDataIndex].length / dataLength))
meta.raw_data[rawDataIndex] = this.chunkArray(meta.raw_data[rawDataIndex], dataLength)
}
while (fileIndex < maxSplitFiles) {
if (this.downloadInfo === null) {
this.downloadInfo = newDownload()
}
this.downloadInfo.channel = channels
// download format
this.downloadInfo.format = format
// download device and filename
if (meta.device.library_name.indexOf('Neulive') >= 0) {
this.downloadInfo.device = [meta.device.library_name.slice(0, 7), meta.device.library_name.slice(7)]
if (this.downloadInfo.channel.some(el => el >= 256 && el <= 259)) {
this.downloadInfo.filename = meta.name + '-accerlate-' + format
this.downloadInfo.filename += (sd !== undefined) ? '-sd' : ''
this.downloadInfo.size = parseInt(parseInt(meta.size) / 76)
} else {
this.downloadInfo.filename = meta.name + '-' + format
this.downloadInfo.filename += (sd !== undefined) ? '-sd' : ''
this.downloadInfo.size = parseInt(meta.size)
}
} else if (meta.device.library_name.indexOf('Elite') >= 0) {
this.downloadInfo.device = [meta.device.library_name.slice(0, 5), meta.device.library_name.slice(5)]
this.downloadInfo.filename = meta.name + '-' + (fileIndex + 1).toString()
this.downloadInfo.size = parseInt(meta.size)
}
this.$refs.progressModalRef.setTitle(this.downloadInfo.filename)
// get sampleRate && downloadList
for (const channel of this.downloadInfo.channel) {
if (this.downloadInfo.channelInfo[channel] === undefined) {
this.downloadInfo.channelInfo[channel] = newChannel()
this.setSampleRateDownload({ channel: channel })
}
}
this.clearIDListDownload()
for (const channel of this.downloadInfo.channel) {
this.setIDListDownload({ channel: channel, fileIndex: fileIndex })
}
// start download data
fileIndex += 1
let rowIndex = 0
let columnNum = 0
const requestArray = []
console.time('download')
while (rowIndex - 10 < this.downloadInfo.maxRows) {
this.$refs.progressModalRef.setValue(parseInt((rowIndex / this.downloadInfo.maxRows) * 100))
// console.log('rowIndex < this.downloadInfo.maxRows', rowIndex, this.downloadInfo.maxRows)
for (const channel of this.downloadInfo.channel) {
columnNum = this.downloadInfo.channelInfo[channel].downloadIDList.length
for (const idx in this.downloadInfo.channelInfo[channel].downloadIDList) {
const _idx = parseInt(idx)
if (this.downloadInfo.channelInfo[channel].downloadDataBuffer[idx] === undefined) {
this.downloadInfo.channelInfo[channel].downloadDataBuffer[idx] = []
}
// const rawID = this.downloadInfo.channelInfo[channel].downloadIDList[_idx][rowIndex]
const rawIDList = this.downloadInfo.channelInfo[channel].downloadIDList[_idx].slice(rowIndex, rowIndex + 10)
// console.log(channel, rawIDList)
rawIDList.length > 0 && requestArray.push(api.raw.getAttrByIDs(channel, rawIDList, 'id-channel-size-serial_number-start_time-end_time-data'))
if (rawIDList.length === 0) columnNum -= 1
}
}
const responseArray = await Promise.all(requestArray)
// console.log('responseArray', responseArray)
for (const responseIndex in responseArray) {
const response = responseArray[responseIndex]
// console.log('response', response)
const idx = responseIndex % columnNum
// console.log('response', response)
for (const data of response.data) {
const timeUnitScale = channelParamObj.time.unit[channelParamObj.time.downloadUnit]
const channelUnitScale = channelParamObj[data.channel]?.unit[channelParamObj[data.channel]?.downloadUnit]
// console.log('data', data)
const dataArray = data.data.split('"***"').slice(0, -1)
// console.log('dataArray', dataArray)
for (const raw of dataArray) {
const rawArray = raw.split(' ')
const newArray = rawArray[0] === '' ? [] : rawArray.map((ele, index) => {
return (index % 2 === 0) ? String((parseInt(ele) / timeUnitScale).toFixed(Math.log10(timeUnitScale))) : channelUnitScale ? String((parseInt(ele) / channelUnitScale).toFixed(Math.log10(channelUnitScale))) : ele
})
this.downloadInfo.channelInfo[data.channel].downloadDataBuffer[idx].push(...newArray)
// console.log('rawArray', rawArray)
}
}
}
requestArray.length = 0
// console.log('this.downloadInfo.channelInfo', this.downloadInfo.channelInfo)
// console.log('this.downloadInfo.maxRows', this.downloadInfo.maxRows)
// await this.setDataExport({ last: (rowIndex >= this.downloadInfo.maxRows - 1) })
rowIndex += 10
}
await this.setAllExport({ last: (rowIndex >= this.downloadInfo.maxRows - 1) })
this.$refs.progressModalRef.setValue(100)
}
}
}
}
await new Promise(resolve => setTimeout(resolve, 2000)) // sleep
window.close()
setInterval(this.writeFiles, 1000)
},
destroyed () {
},
+55 -19
View File
@@ -1,6 +1,8 @@
<template>
<div class="file-list" @mousedown="unSelectAll">
<!-- Move Folder Modal -->
<download ref="download_ref"></download>
<download-offline ref="download_offline_ref"></download-offline>
<folder-modal ref="folder_modal_ref" @refreshPage="refreshPage"></folder-modal>
<!-- Create Folder Modal -->
<va-modal
@@ -140,13 +142,13 @@
</div>
</div>
<div class="flex xl4 lg4 sm4 xs4" style="text-align: end;">
<va-button class="" color="primary" v-if="selected.length" @mousedown.stop="showFolderModal" target="_blank" small>
<va-button class="" color="primary" @mousedown.stop="showFolderModal" target="_blank" small>
MOVE
</va-button>
<va-button class="" color="success" v-if="selected.length" @mousedown.stop="downloadSelected" target="_blank" small>
<va-button class="" color="success" @mousedown.stop="downloadSelected" target="_blank" small>
DOWNLOAD
</va-button>
<va-button class="" color="danger" v-if="selected.length" @mousedown.stop="deleteMultiFilesConfirm" target="_blank" small>
<va-button class="" color="danger" @mousedown.stop="deleteMultiFilesConfirm" target="_blank" small>
DELETE
</va-button>
</div>
@@ -219,7 +221,7 @@
<va-button flat small color="gray" icon="fa fa-download" v-if="props.rowData.type !== 'folder' && props.rowData.device.library_name.indexOf('Neulive') >= 0" @click.stop="downloadCsv(props.rowData)"/>
</va-popover>
<va-popover :message="`Download excel`" placement="top">
<va-button flat small color="gray" icon="fa fa-download" v-if="props.rowData.type !== 'folder' && props.rowData.device.library_name.indexOf('Elite') >= 0" @click.stop="downloadExcel(props.rowData)"/>
<va-button flat small color="gray" icon="fa fa-download" v-if="props.rowData.type !== 'folder' && props.rowData.device.library_name.indexOf('Elite') >= 0" @click.stop="newDownload(props.rowData)"/>
</va-popover>
<va-popover :message="`Download edf`" placement="top">
<va-button flat small color="gray" icon="fa fa-download" v-if="props.rowData.type !== 'folder' && props.rowData.device.library_name.indexOf('Neulive') >= 0" @click.stop="downloadExcel(props.rowData)"/>
@@ -250,6 +252,8 @@ import api from '../../../data/api/index'
// import SdCardButton from '../sdcard/SdCardButton.vue'
import configTable from '@/data/config-table/index.js'
import FolderModal from './FolderModal.vue'
import Download from '../../download/Download.vue'
import DownloadOffline from '../../download/DownloadOffline.vue'
export default {
name: 'FileTable',
@@ -257,6 +261,8 @@ export default {
FulfillingBouncingCircleSpinner,
// SdCardButton,
FolderModal,
Download,
DownloadOffline,
},
data () {
return {
@@ -452,12 +458,13 @@ export default {
}
},
clickRow: async function (rowData) {
if (window.getSelection().toString() !== '' && this.clickEvent.shiftKey === false) return true
this.clickCounter += 1
setTimeout(() => { this.clickCounter = 0 }, 500)
if (window.getSelection().toString() !== '' && this.clickEvent.shiftKey === false && this.clickCounter !== 2) return true
window.getSelection().removeAllRanges()
// click target id
const idx = this.fileLists.findIndex(f => f.id === rowData.id)
setTimeout(async () => {
this.clickCounter += 1
let timeOutTimer
// single click
if (this.clickCounter === 1) {
@@ -844,11 +851,50 @@ export default {
// this.$refs.datatable_ref.refresh()
// this.$refs.datatable_ref.currentPage = 1
},
downloadSelected: function () {
this.downloadExcel(this.selected)
getAllChildrenByParent: async function (collection) {
const childrenCollection = await api.collection.getByParent('folder', collection)
const childrenMeta = await api.meta.getByParent('folder', collection)
for (const collection of childrenCollection.data) {
await this.getAllChildrenByParent(collection.id)
}
for (const meta of childrenMeta.data) {
this.downloadIDList.push(meta.id)
}
},
downloadSelected: async function () {
this.downloadIDList.length = 0
const meta = this.selected
if (Array.isArray(meta) === true) {
for (const ele of meta) {
if (ele.type === 'folder') {
await this.getAllChildrenByParent(ele.id)
} else {
this.downloadIDList.push(ele.id)
}
}
}
const connectCheck = await api.connection.check()
if (connectCheck.status === 200) {
this.$refs.download_ref.count = 0
this.$refs.download_ref.fileNums = this.downloadIDList.length
this.$refs.download_ref.metaListNew.push(...this.downloadIDList)
} else {
this.$refs.download_offline_ref.count = 0
this.$refs.download_offline_ref.fileNums = this.downloadIDList.length
this.$refs.download_offline_ref.metaListNew.push(...this.downloadIDList)
}
},
newDownload: async function (data) {
const connectCheck = await api.connection.check()
if (connectCheck.status === 200) {
this.$refs.download_ref.fileNums = 1
this.$refs.download_ref.metaListNew.push(data.id)
} else {
this.$refs.download_offline_ref.fileNums = 1
this.$refs.download_offline_ref.metaListNew.push(data.id)
}
},
deleteSelected: async function () {
console.log('deleteSelected', this.selected)
for (let i = 0; i < this.selected.length; i++) {
const meta = this.selected[i]
this.fillDeleteInfo(meta)
@@ -899,16 +945,6 @@ export default {
window.open('http://' + href + '/#/download/offline/excel/' + metaID)
}
},
getAllChildrenByParent: async function (collection) {
const childrenCollection = await api.collection.getByParent('folder', collection)
const childrenMeta = await api.meta.getByParent('folder', collection)
for (const collection of childrenCollection.data) {
await this.getAllChildrenByParent(collection.id)
}
for (const meta of childrenMeta.data) {
this.downloadIDList.push(meta.id)
}
},
downloadSdCard: async function (meta) {
const href = location.href.split('/')[2]
if (meta.device.library_name.indexOf('Neulive') >= 0) {
+7 -6
View File
@@ -312,7 +312,7 @@ export default {
device: parseInt(mes[1]),
instruction: 'interrupt',
}))
this.pageToast('The device [' + taskInfo.getDeviceIDByRaw(parseInt(mes[1])) + '] mission is done.')
this.pageToast('The device [' + taskInfo.getDeviceIDByRaw(parseInt(mes[1])) + '] mission done.')
break
case 'project':
// refresh real-time page when going to next task
@@ -436,7 +436,7 @@ export default {
if (!isDefault) {
await this.taskContentChartSaveToCache({ controllerID: taskInfo.getTaskInfo().controllerID })
}
this.pageToast('The chart has been added.')
// this.pageToast('The chart has been added.')
return newChart.chartID
},
@@ -454,7 +454,7 @@ export default {
mappingID: null,
cardName: null,
})
this.pageToast('The chart has been Initialized.')
// this.pageToast('The chart has been Initialized.')
},
removeChartCheck: function (chartID) {
this.selectChartID = chartID
@@ -490,7 +490,7 @@ export default {
if (saveCache === true) {
await this.taskContentChartSaveToCache({ controllerID: taskInfo.getTaskInfo().controllerID })
}
this.pageToast('The chart has been removed.')
// this.pageToast('The chart has been removed.')
},
showDeviceSettingClick: function () {
this.showDeviceSetting = true
@@ -531,8 +531,9 @@ export default {
_itemID: deviceID,
_chartID: null,
_type: 'device',
_reset: false,
})
this.pageToast('The device [' + deviceID + '] has been registered.')
// this.pageToast('The device [' + deviceID + '] has been registered.')
},
removeDevice: function (deviceID) {
this.mqttUnSub(taskInfo.getTaskInfo().controllerID + '/data_server/device_data_stream/' + deviceID + '/+')
@@ -542,7 +543,7 @@ export default {
this.removeChart(chart)
}
}
this.pageToast('The device [' + deviceID + '] has been removed.')
// this.pageToast('The device [' + deviceID + '] has been removed.')
},
addFormula: async function (formulaID) {
const chart = await this.addChart(true)
@@ -143,38 +143,53 @@ export default {
if (this.data !== undefined && this.data.gridSource !== undefined) {
const x = this.data.gridSource[plotIndex][curveIndex].xSource
const y = this.data.gridSource[plotIndex][curveIndex].ySource
let _xPhysicsQuantity = this.data.gridSource[plotIndex][curveIndex].name.split('_')[0].split('-').at(-1)
let _yPhysicsQuantity = this.data.gridSource[plotIndex][curveIndex].name.split('_')[1].split('-').at(-1)
if (!_xPhysicsQuantity.includes('ZReal') && !_xPhysicsQuantity.includes('ZImag')) {
_xPhysicsQuantity = _xPhysicsQuantity.substring(0, 1)
} else {
_xPhysicsQuantity = _xPhysicsQuantity.substring(0, 5)
}
if (!_yPhysicsQuantity.includes('ZReal') && !_yPhysicsQuantity.includes('ZImag')) {
_yPhysicsQuantity = _yPhysicsQuantity.substring(0, 1)
} else {
_yPhysicsQuantity = _yPhysicsQuantity.substring(0, 5)
}
// console.log('2', _xPhysicsQuantity, _yPhysicsQuantity)
// Potential
if (_xPhysicsQuantity === 'P') _xPhysicsQuantity = 'V'
if (_yPhysicsQuantity === 'P') _yPhysicsQuantity = 'V'
// console.log('2', _xPhysicsQuantity, _yPhysicsQuantity)
let [_xAxis, _yAxis] = this.chartRouter.getChartTable(_xPhysicsQuantity, _yPhysicsQuantity)
if (typeof _xAxis !== 'object') {
let _xAxis
let _yAxis
if (channelInfo) {
if (x.name === 'Time') {
_xAxis = { default: channelInfo.time }
} else {
_xAxis = { default: channelInfo[x.channel - 1] }
let xInfo = channelInfo[x.channel - 1]
if (xInfo === undefined) {
xInfo = {
name: '',
defaultUnit: '',
unit: {},
}
}
_xAxis = { default: xInfo }
}
}
if (typeof _yAxis !== 'object') {
if (y.name === 'Time') {
_yAxis = { default: channelInfo.time }
} else {
_yAxis = { default: channelInfo[y.channel - 1] }
let yInfo = channelInfo[y.channel - 1]
if (yInfo === undefined) {
yInfo = {
name: '',
defaultUnit: '',
unit: {},
}
}
_yAxis = { default: yInfo }
}
} else {
_xAxis = {
default: {
name: '',
defaultUnit: '',
unit: {},
},
}
_yAxis = {
default: {
name: '',
defaultUnit: '',
unit: {},
},
}
}
const _realTime = JSON.parse(JSON.stringify(this.realTime))
const _newCurve = {}
// set name, sourceIndex in data.series
@@ -310,6 +325,16 @@ export default {
let _xPhysicsQuantity = this.data.gridSource[plotIndex][curveIndex].name.split('_')[0].split('-').at(-1)
let _yPhysicsQuantity = this.data.gridSource[plotIndex][curveIndex].name.split('_')[1].split('-').at(-1)
// Potential
if (!_xPhysicsQuantity.includes('ZReal') && !_xPhysicsQuantity.includes('ZImag')) {
_xPhysicsQuantity = _xPhysicsQuantity.substring(0, 1)
} else {
_xPhysicsQuantity = _xPhysicsQuantity.substring(0, 5)
}
if (!_yPhysicsQuantity.includes('ZReal') && !_yPhysicsQuantity.includes('ZImag')) {
_yPhysicsQuantity = _yPhysicsQuantity.substring(0, 1)
} else {
_yPhysicsQuantity = _yPhysicsQuantity.substring(0, 5)
}
if (_xPhysicsQuantity === 'P') _xPhysicsQuantity = 'V'
if (_yPhysicsQuantity === 'P') _yPhysicsQuantity = 'V'
const [_xAxis, _yAxis] = this.chartRouter.getChartTable(_xPhysicsQuantity, _yPhysicsQuantity)
@@ -1,36 +1,6 @@
const chartTable = {
// split 'A-B' by '-',
// then A-B[0] is about 'A' and A-B[1] is about 'B'
T_V: [
// 0
{
default: {
name: 'Time',
unit: {
us: 1,
ms: 1e3,
s: 1e6,
min: 60 * 1e6,
hour: 60 * 60 * 1e6,
},
defaultUnit: 's',
downloadUnit: 'ms',
},
},
// 1
{
default: {
name: 'Voltage',
unit: {
uV: 1,
mV: 1e3,
V: 1e6,
},
defaultUnit: 'mV',
downloadUnit: 'mV',
},
},
],
T_I: [
// 0
{
@@ -74,168 +44,6 @@ const chartTable = {
},
},
],
T_R: [
// 0
{
default: {
name: 'Time',
unit: {
us: 1,
ms: 1e3,
s: 1e6,
min: 60 * 1e6,
hour: 60 * 60 * 1e6,
},
defaultUnit: 's',
downloadUnit: 'ms',
},
},
// 1
{
default: {
name: 'Resistance',
unit: {
: 1,
Ω: 1e3,
: 1e6,
: 1e9,
},
defaultUnit: 'Ω',
downloadUnit: 'Ω',
},
},
],
T_Impedance: [
// 0
{
default: {
name: 'Time',
unit: {
us: 1,
ms: 1e3,
s: 1e6,
min: 60 * 1e6,
hour: 60 * 60 * 1e6,
},
defaultUnit: 's',
downloadUnit: 'ms',
},
},
// 1
{
default: {
name: 'Resistance',
unit: {
: 1e-3,
Ω: 1,
: 1e3,
: 1e6,
},
defaultUnit: 'Ω',
downloadUnit: 'Ω',
},
},
],
T_Phase: [
// 0
{
default: {
name: 'Time',
unit: {
us: 1,
ms: 1e3,
s: 1e6,
min: 60 * 1e6,
hour: 60 * 60 * 1e6,
},
defaultUnit: 's',
downloadUnit: 'ms',
},
},
// 1
{
default: {
name: 'degree',
unit: {
'°': 1e3,
},
defaultUnit: '°',
downloadUnit: '°',
},
},
],
T_Current: [
// 0
// 0
{
default: {
name: 'Time',
unit: {
us: 1,
ms: 1e3,
s: 1e6,
min: 60 * 1e6,
hour: 60 * 60 * 1e6,
},
defaultUnit: 's',
downloadUnit: 'ms',
},
},
// 1
{
default: {
name: 'Current',
unit: {
nA: 1,
uA: 1e3,
mA: 1e6,
A: 1e9,
},
defaultUnit: (Mode) => { return (Mode === 10 || Mode === 11) ? 'nA' : 'mA' },
downloadUnit: 'mA',
},
// Q = ∫ I dt
integral: {
name: 'Charge',
unit: {
nAh: 3600 * 1e6,
uAh: 1600 * 1e9,
mAh: 3600 * 1e12,
Ah: 3600 * 1e15,
},
defaultUnit: 'mAh',
downloadUnit: 'mAh',
},
},
],
V_V: [
// 0
{
default: {
name: 'Voltage',
unit: {
uV: 1,
mV: 1e3,
V: 1e6,
},
defaultUnit: 'mV',
downloadUnit: 'mV',
},
},
// 1
{
default: {
name: 'Voltage',
unit: {
uV: 1,
mV: 1e3,
V: 1e6,
},
defaultUnit: 'mV',
downloadUnit: 'mV',
},
},
],
V_I: [
// 0
{
@@ -309,94 +117,6 @@ const chartTable = {
},
},
],
V_R: [
// 0
{
default: {
name: 'Voltage',
unit: {
uV: 1,
mV: 1e3,
V: 1e6,
},
defaultUnit: 'mV',
downloadUnit: 'mV',
},
},
// 1
{
default: {
name: 'Resistance',
unit: {
: 1,
Ω: 1e3,
: 1e6,
: 1e9,
},
defaultUnit: 'Ω',
downloadUnit: 'Ω',
},
},
],
I_R: [
// 0
{
default: {
name: 'Voltage',
unit: {
uV: 1,
mV: 1e3,
V: 1e6,
},
defaultUnit: 'mV',
downloadUnit: 'mV',
},
},
// 1
{
default: {
name: 'Current',
unit: {
nA: 1,
uA: 1e3,
mA: 1e6,
A: 1e9,
},
defaultUnit: (Mode) => { return (Mode === 10) ? 'nA' : 'mA' },
downloadUnit: 'mA',
},
},
],
ZReal_ZImag: [
// 0
{
default: {
name: 'Z_real',
unit: {
: 1e-3,
Ω: 1,
: 1e3,
: 1e6,
},
downloadUnit: 'Ω',
defaultUnit: 'Ω',
},
},
// 1
{
default: {
name: 'Z_imag',
unit: {
: 1e-3,
Ω: 1,
: 1e3,
: 1e6,
},
downloadUnit: 'Ω',
defaultUnit: 'Ω',
},
},
],
}
export const chartRouter = {
getChartTable: (xAxis, yAxis) => {
@@ -404,6 +124,6 @@ export const chartRouter = {
const name2 = yAxis + '_' + xAxis
if (chartTable[name1] !== undefined) return [chartTable[name1][0], chartTable[name1][1]]
else if (chartTable[name2] !== undefined) return [chartTable[name2][1], chartTable[name2][0]]
else return 'idiot'
else return []
},
}
@@ -140,7 +140,7 @@ export default {
// const status = checkParam.status
// const message = checkParam.message
// if (status === true) {
this.setArchiveSettings()
await this.setArchiveSettings()
// this.$emit('start', device)
setTimeout(() => {
this.$emit('start', device)
@@ -160,7 +160,7 @@ export default {
// const message = checkParam.message
// if (status === true) {
// device.stopping = false
this.setArchiveSettings()
await this.setArchiveSettings()
setTimeout(() => {
this.$emit('record', device)
}, 500)
@@ -176,9 +176,9 @@ export default {
generateChart: function (device) {
this.$emit('generate', device)
},
setArchiveSettings: function () {
this.$refs.fcwindow_ref.forEach(ref => {
ref.setArchiveSettings()
setArchiveSettings: async function () {
this.$refs.fcwindow_ref.forEach(async (ref) => {
await ref.setArchiveSettings()
})
},
refresh: function () {
@@ -25,6 +25,9 @@
<va-item-label v-if="device.library_name.includes('EIS') || device.library_name.includes('TRIG')">
{{ `[${device.memory_board}]` }} {{ device.name }}
</va-item-label>
<va-item-label v-if="device.status !== 0">
{{ `[${device.memory_board}]` }} {{ device.name }} <va-icon class="ml-3 fa fa-battery-full" color="rgb(178 180 178)"/>
</va-item-label>
<va-item-label v-else-if="parseInt((device.battery - 2900) / 10) >= 75">
{{ `[${device.memory_board}]` }} {{ device.name }} <va-icon class="ml-3 fa fa-battery-full" color="#5BC236"/> {{ (parseInt((device.battery - 2900) / 10) > 100 ? 100 : parseInt((device.battery - 2900) / 10)) + '%' }}
</va-item-label>
@@ -129,9 +129,9 @@ export default {
generateChart: function (device) {
this.$emit('add', device.id)
},
setArchiveSettings: function () {
setArchiveSettings: async function () {
if (this.$refs.pdlist_ref != null) {
this.$refs.pdlist_ref.setArchiveSettings()
await this.$refs.pdlist_ref.setArchiveSettings()
}
},
refresh: function () {
@@ -2,7 +2,7 @@
<div class="flex row mt-0 pt-0 sm12 xl12 md12 xs12">
<div class="flex sm6 xl6 md6 xs6">
<va-select
:on-change="directorySelect(directory)"
@input="directorySelect(directory)"
:label="'DIRECTORY'"
v-model="directory"
textBy="name"
@@ -89,7 +89,7 @@ export default {
}
},
directorySelect: function (directoryInfo) {
if (typeof directoryInfo === 'object') {
if (directoryInfo.parent) {
if (this.device.parent.folder === undefined || this.device.parent.folder.indexOf(directoryInfo.id) === -1) {
if (this.device.status === 0) {
this.device.parent.folder = []
@@ -122,9 +122,9 @@ export default {
// directory init
const collection = await api.collection.getAll()
this.directoryOptions = collection.data.filter(el => el.name !== 'root')
if (Object.keys(this.device.parent).length === 0) {
this.directory = this.directoryOptions[0]
this.directory = this.directoryOptions.find(ele => ele.name === 'admin')
this.directorySelect(this.directory)
} else {
for (const directory of this.directoryOptions) {
if (this.device.parent.folder.includes(directory.id)) {
@@ -143,8 +143,8 @@ export default {
pageInit: async function () {
},
},
mounted () {
this.setArchiveSettings()
async mounted () {
await this.setArchiveSettings()
},
destroyed () {
},
@@ -28,7 +28,23 @@
<!-- split because of styling problem(treenode), combine together furture -->
<!-- Trigger -->
<div v-if="library && library.includes('TRIG')">
<Trigger :parameter="parameter" :parameterTable="parameterTable" @parameterChange="parameterChange"></Trigger>
<Trigger v-if="parameter.MODE === 0" :parameter="parameter" :parameterTable="parameterTable" @parameterChange="parameterChange"></Trigger>
<div v-if="parameter.MODE === 2">
<component
v-for="name in parameterArrayInMode"
:key="name"
:is="parameterTable[name].componentType"
:templateType=1
:withHeader="true"
:parameterName="name"
:inputValue="parameter[name]"
v-bind="parameterTable[name]"
@parameterChange="parameterChange"
@getParameter="getParameter"
@sendInstruction="sendInstruction"
/>
</div>
<TriggerNew v-if="parameter.MODE === 3" :parameter="parameter" :parameterTable="parameterTable" @parameterChange="parameterChange"></TriggerNew>
</div>
<!-- EIS -->
<div v-if="library && library.includes('EIS')">
@@ -129,6 +145,7 @@ import MultiInputField from '../parameter/itemNew/MultiInputField'
import EliteParameterRecordingEliteDPV from '../parameter/itemNew/DPVNew/EliteParameterRecordingEliteDPV'
import DevMode from '../parameter/itemNew/DevMode'
import Trigger from '../parameter/itemNew/TriggerNew/Trigger'
import TriggerNew from '../parameter/itemNew/TriggerNew/TriggerNew'
import EliteParameterRecordingElitePulseSensing from '../parameter/itemNew/PulseSensingNew/EliteParameterRecordingElitePulseSensing'
import { VueFinalModal } from 'vue-final-modal'
import { mapFields } from 'vuex-map-fields'
@@ -147,6 +164,7 @@ export default {
MultiInputField,
DevMode,
Trigger,
TriggerNew,
},
props: {
parameter: {
@@ -246,9 +264,9 @@ export default {
return ''
}
},
parameterChange: function (name, value, debounce = false) {
parameterChange: function (name, value, debounce = false, force = false) {
/** if parameter is equal to value, then don't change, JSON.stringify is for array & object compare */
if (JSON.stringify(value) !== JSON.stringify(this.parameter[name])) {
if (JSON.stringify(value) !== JSON.stringify(this.parameter[name]) || force === true) {
this.parameter[name] = value
debounce === false
? this.$emit('setParameter', name, value)
@@ -0,0 +1,216 @@
<template>
<div :class="disabled === true ? 'flex d-flex py-1 disabled-text' : 'flex d-flex py-1'" style="align-items: center;">
<div style="flex-basis: 25%;">
<span>{{ showName }}</span>
</div>
<div v-if="onlyButton === true && disabled === true" style="flex-basis: 50%; display: flex; align-items: center; justify-content: center;">
<img class="button-flat" src="@/assets/icons/button-disable.svg"/>
</div>
<div v-else-if="onlyButton === true && inputValue === false" style="flex-basis: 50%; display: flex; align-items: center; justify-content: center;" @click="inputChange(true)">
<img class="button-flat" src="@/assets/icons/button-off.svg"/>
</div>
<div v-else-if="onlyButton === true && inputValue === true" style="flex-basis: 50%; display: flex; align-items: center; justify-content: center;" @click="inputChange(false)">
<img class="button-flat" src="@/assets/icons/button-on.svg"/>
</div>
<div v-else style="flex-basis: 50%; align-items: center; text-align: -webkit-right;">
<va-input class="mr-2" style="margin-bottom: 0; width: 100px; color: green;"
@keyup.enter="inputChange(inputString)"
@blur="inputChange(inputString)"
v-model="inputStringModel"
:disabled="disabled">
<p v-if="withToggleButton === true" slot="append" style="margin-right: 0;" small>
{{ unitSelect }}
</p>
</va-input>
</div>
<div v-if="withToggleButton === false" style="flex-basis: 25%; align-items: center;">
{{ unitSelect }}
</div>
<div v-if="withToggleButton === true && disabled === true" style="flex-basis: 25%; align-items: center; display: inline-flex;">
<img class="button-dot" src="@/assets/icons/button-dot-off.svg">
</div>
<div v-else-if="withToggleButton === true && toggleValue === false" style="flex-basis: 25%; align-items: center; display: inline-flex;" @click="toggleChange(true)">
<img class="button-dot" src="@/assets/icons/button-dot-off.svg">
</div>
<div v-else-if="withToggleButton === true && toggleValue === true" style="flex-basis: 25%; align-items: center; display: inline-flex;" @click="toggleChange(false)">
<img class="button-dot" src="@/assets/icons/button-dot-on.svg">
</div>
</div>
</template>
<script>
export default {
name: 'InputFieldWithHeader',
components: {
},
props: {
templateType: {
type: Number,
default: 0,
},
onlyButton: {
type: Boolean,
default: false,
},
withHeader: {
type: Boolean,
default: false,
},
withUnitButton: {
type: Boolean,
default: false,
},
withToggleButton: {
type: Boolean,
default: false,
},
parameterName: {
type: String,
required: true,
},
showName: {
type: String,
},
range: {
type: Object,
},
inputValue: {
type: [Number, String, Boolean],
required: true,
},
referenceValue: {
type: Object,
},
defaultUnit: {
type: String,
},
unit: {
type: Object,
},
outputReadabilityData: {
type: Function,
default: (val) => val,
},
outputRawData: {
type: Function,
default: (val) => val,
},
disabled: {
type: Boolean,
default: false,
},
index: {
type: Number,
default: -1,
},
toggleParameter: {
type: String,
},
toggleValue: {
type: [Number, Boolean],
},
},
created () {
},
computed: {
inputStringModel: {
get () {
return String(this.outputReadabilityData(this.inputValue))
},
set (val) {
this.inputString = val
},
},
unitLength () {
return Object.keys(this.unit).length
},
},
data () {
return {
unitSelect: this.defaultUnit,
unitButtonClicked: '',
inputString: '',
size: {
12: 'flex sm12 xl12 md12 xs12 px-0 mx-0',
6: 'flex sm6 xl6 md6 xs6 px-0 mx-0',
5: 'flex sm5 xl5 md5 xs5 px-0 mx-0 my-0 py-0',
4: 'flex sm4 xl4 md4 xs4 px-0 mx-0 my-0 py-0',
3: 'flex sm3 xl3 md3 xs3 px-0 mx-0 my-0 py-0',
},
style: {
header: '',
content: '',
unitButton: '',
},
}
},
mqtt: {
},
methods: {
inputChange: function (val) {
/** */
let scale = 1
if (this.unitSelect) {
scale = this.unit[this.unitSelect]
}
// if change from input field
if (typeof (val) === 'string') {
if (isNaN(val) || val === '') {
return false
}
val = this.outputRawData(val, scale)
if (parseFloat(val) < this.range.min) {
val = this.range.min
} else if (parseFloat(val) > this.range.max) {
val = this.range.max
}
}
/** if parameter is array with index needs to return */
if (this.index === -1) {
this.$emit('parameterChange', this.parameterName, val)
} else {
this.$emit('parameterChangeByIndex', this.parameterName, val, this.index)
}
},
unitChange: function () {
this.unitButtonClicked += 1
this.unitSelect = Object.keys(this.unit)[this.unitButtonClicked % this.unitLength]
},
toggleChange: function (val) {
this.$emit('parameterChangeByIndex', this.toggleParameter, val, this.index)
},
},
async mounted () {
if (this.withHeader === true && this.withUnitButton === true) {
this.style.header = this.size[5]
this.style.content = this.size[4]
this.style.unitButton = this.size[3]
} else if (this.withHeader === true) {
this.style.header = this.size[6]
this.style.content = this.size[6]
} else {
this.style.content = this.size[12]
}
},
destroyed () {
},
watch: {
},
}
</script>
<style>
.button-dot {
height: 16px;
width: 16px;
}
.button-flat {
height: 20px;
width: 64px;
}
.disabled-text {
color: #c2c2c2;
}
</style>
@@ -0,0 +1,270 @@
<template>
<div>
<div v-for="channel of [0,1,2,3,4,5,6,7]" :key="channel">
<button class="accordion">
<div style="display: flex; justify-content: space-between; align-items: center;">
<div class="d-flex align--center">
<i v-if="panelSpread.includes(channel) === false" class="va-icon fa fa-angle-right mr-1" style="width: 15px;"></i>
<i v-if="panelSpread.includes(channel) === true" class="va-icon fa fa-angle-down mr-1" style="width: 15px;"></i>
<span>{{ channelName[channel] }}</span>
</div>
<div class="d-flex align--center">
<va-toggle class="mb-0" color="#2CE9A4" :value="parameter.USED[channel]" style="float: right;" flat small @click.native.stop="parameterChangeByIndex('USED', !parameter.USED[channel], channel)"/>
</div>
</div>
</button>
<div class="panel">
<InputFieldWithToggle
v-if="[2,3].indexOf(channel) >= 0"
style="margin-bottom: 0.5rem;"
:index="channel"
:parameterName="'OUTPUT_5V'"
:inputValue="parameter.OUTPUT_5V[channel]"
:onlyButton="true"
:disabled="channel === 2 ? true: !parameter.USED[channel]"
v-bind="parameterTable.OUTPUT_5V"
@parameterChange="parameterChange"
@parameterChangeByIndex="parameterChangeByIndex"
></InputFieldWithToggle>
<InputFieldWithToggle
v-if="[4,5,6,7].indexOf(channel) >= 0"
:index="channel"
:parameterName="'CURRENT'"
:inputValue="parameter.CURRENT[channel]"
:disabled="!parameter.USED[channel]"
v-bind="parameterTable.CURRENT"
@parameterChange="parameterChange"
@parameterChangeByIndex="parameterChangeByIndex"
></InputFieldWithToggle>
<!-- pre-T -->
<InputFieldWithToggle
:index="channel"
:parameterName="'T_EARLY'"
:inputValue="parameter.T_EARLY[channel]"
:withToggleButton="true"
:toggleParameter="'V_EARLY'"
:toggleValue="parameter.V_EARLY[channel]"
:disabled="!parameter.USED[channel]"
v-bind="parameterTable.T_EARLY"
@parameterChange="parameterChange"
@parameterChangeByIndex="parameterChangeByIndex"
></InputFieldWithToggle>
<InputFieldWithToggle
:index="channel"
:parameterName="'CYCLE'"
:inputValue="parameter.CYCLE[channel]"
:disabled="!parameter.USED[channel]"
v-bind="parameterTable.CYCLE"
@parameterChange="parameterChange"
@parameterChangeByIndex="parameterChangeByIndex"
></InputFieldWithToggle>
<InputFieldWithToggle
:index="channel"
:parameterName="'T_MID0'"
:inputValue="parameter.T_MID0[channel]"
:withToggleButton="true"
:toggleParameter="'V_MID0'"
:toggleValue="parameter.V_MID0[channel]"
:disabled="!parameter.USED[channel]"
v-bind="parameterTable.T_MID0"
@parameterChange="parameterChange"
@parameterChangeByIndex="parameterChangeByIndex"
></InputFieldWithToggle>
<InputFieldWithToggle
:index="channel"
:parameterName="'T_MID1'"
:inputValue="parameter.T_MID1[channel]"
:withToggleButton="true"
:toggleParameter="'V_MID1'"
:toggleValue="parameter.V_MID1[channel]"
:disabled="!parameter.USED[channel]"
v-bind="parameterTable.T_MID1"
@parameterChange="parameterChange"
@parameterChangeByIndex="parameterChangeByIndex"
></InputFieldWithToggle>
<InputFieldWithToggle
:index="channel"
:parameterName="'T_MID2'"
:inputValue="parameter.T_MID2[channel]"
:withToggleButton="true"
:toggleParameter="'V_MID2'"
:toggleValue="parameter.V_MID2[channel]"
:disabled="!parameter.USED[channel]"
v-bind="parameterTable.T_MID2"
@parameterChange="parameterChange"
@parameterChangeByIndex="parameterChangeByIndex"
></InputFieldWithToggle>
<InputFieldWithToggle
:index="channel"
:parameterName="'T_MID3'"
:inputValue="parameter.T_MID3[channel]"
:withToggleButton="true"
:toggleParameter="'V_MID3'"
:toggleValue="parameter.V_MID3[channel]"
:disabled="!parameter.USED[channel]"
v-bind="parameterTable.T_MID3"
@parameterChange="parameterChange"
@parameterChangeByIndex="parameterChangeByIndex"
></InputFieldWithToggle>
<InputFieldWithToggle
:index="channel"
:parameterName="'T_LATE'"
:inputValue="parameter.T_LATE[channel]"
:withToggleButton="true"
:toggleParameter="'V_LATE'"
:toggleValue="parameter.V_LATE[channel]"
:disabled="!parameter.USED[channel]"
v-bind="parameterTable.T_LATE"
@parameterChange="parameterChange"
@parameterChangeByIndex="parameterChangeByIndex"
></InputFieldWithToggle>
</div>
</div>
</div>
</template>
<script>
import InputFieldWithToggle from './InputFieldWithToggle.vue'
export default {
name: 'Trigger',
components: {
InputFieldWithToggle,
},
computed: {
},
props: {
parameter: {
type: Object,
default: () => {},
},
parameterTable: {
type: Object,
default: () => {},
},
},
data () {
return {
panelSpread: [],
channelName: [
'Gas valve 1',
'Gas valve 2',
'Gas valve 3',
'5V TTL',
'LED 1',
'LED 2',
'LED 3',
'LED 4',
],
channelList: [0, 1, 2, 3],
triggerList: [0, 1],
openAdvanced: Boolean(this.parameter.TRIG0_en || this.parameter.TRIG1_en),
}
},
methods: {
channelBlockToggle (channelIndex) {
let name = 'ACC_a_out'
if (channelIndex !== undefined) {
name += channelIndex
}
return name
},
channelBlockCurrent (channelIndex) {
let name = 'ACC_a_out'
if (channelIndex !== undefined) {
name += channelIndex
}
name += '_current'
return name
},
triggerBlockEnable (triggerIndex) {
let name = 'TRIG'
if (triggerIndex !== undefined) {
name += triggerIndex
}
name += '_en'
return name
},
triggerBlockType (triggerIndex) {
let name = 'TRIG'
if (triggerIndex !== undefined) {
name += triggerIndex
}
name += '_edge_type'
return name
},
parameterChange: function (name, value, debounce) {
this.$emit('parameterChange', name, value, debounce)
},
parameterChangeByIndex: function (name, value, index) {
if (name.indexOf('V_MID') >= 0) {
console.log('sadsaasdadadad')
if (name === 'V_MID0' || name === 'V_MID2') {
this.parameter.V_MID0.splice(index, 1, value)
this.parameter.V_MID2.splice(index, 1, value)
this.parameter.V_MID1.splice(index, 1, !value)
this.parameter.V_MID3.splice(index, 1, !value)
}
if (name === 'V_MID1' || name === 'V_MID3') {
this.parameter.V_MID1.splice(index, 1, value)
this.parameter.V_MID3.splice(index, 1, value)
this.parameter.V_MID0.splice(index, 1, !value)
this.parameter.V_MID2.splice(index, 1, !value)
}
this.$emit('parameterChange', 'V_MID0', this.parameter.V_MID0, false, true)
this.$emit('parameterChange', 'V_MID1', this.parameter.V_MID1, false, true)
this.$emit('parameterChange', 'V_MID2', this.parameter.V_MID2, false, true)
this.$emit('parameterChange', 'V_MID3', this.parameter.V_MID3, false, true)
}
const _value = [...this.parameter[name]]
_value[index] = value
this.$emit('parameterChange', name, _value)
},
test: function (index) {
console.log('index', index)
// this.triggerUsed.splice(index, 1, !this.triggerUsed[index])
},
},
mounted () {
const acc = document.getElementsByClassName('accordion')
const panelSpread = this.panelSpread
for (let i = 0; i < acc.length; i++) {
acc[i].addEventListener('click', function () {
this.classList.toggle('active')
var panel = this.nextElementSibling
if (panel.style.display === 'block') {
panel.style.display = 'none'
panelSpread.splice(panelSpread.indexOf(i), 1)
} else {
panel.style.display = 'block'
panelSpread.push(i)
}
})
}
},
}
</script>
<style>
.accordion {
background-color: white;
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
transition: 0.4s;
}
.panel {
padding: 0 18px;
display: none;
background-color: white;
overflow: hidden;
}
.button-dot {
height: 16px;
width: 16px;
}
</style>
@@ -18,6 +18,7 @@ export default {
channels: {
time: {
name: 'Time',
physicalQuantity: 's',
unit: {
us: 1,
ms: 1e3,
@@ -30,6 +31,7 @@ export default {
},
0: {
name: 'I_in',
physicalQuantity: 'A',
unit: {
nA: 1,
},
@@ -37,6 +39,7 @@ export default {
},
1: {
name: 'V_in/V_out',
physicalQuantity: 'V',
unit: {
uV: 1,
},
@@ -44,6 +47,7 @@ export default {
},
2: {
name: 'Gain',
physicalQuantity: '',
unit: {
default: 1,
},
@@ -17,6 +17,7 @@ export default {
channels: {
time: {
name: 'Time',
physicalQuantity: 's',
unit: {
us: 1,
ms: 1e3,
@@ -29,6 +30,7 @@ export default {
},
0: {
name: 'I_in',
physicalQuantity: 'A',
unit: {
nA: 1,
},
@@ -36,6 +38,7 @@ export default {
},
1: {
name: 'V_in/V_out',
physicalQuantity: 'V',
unit: {
uV: 1,
},
@@ -18,6 +18,7 @@ export default {
channels: {
time: {
name: 'Time',
physicalQuantity: 's',
unit: {
us: 1,
ms: 1e3,
@@ -30,6 +31,7 @@ export default {
},
0: {
name: 'I_in',
physicalQuantity: 'A',
unit: {
nA: 1,
uA: 1e3,
@@ -40,6 +42,7 @@ export default {
},
1: {
name: 'Potential',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -50,6 +53,7 @@ export default {
},
2: {
name: 'V_out',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -18,6 +18,7 @@ export default {
channels: {
time: {
name: 'Time',
physicalQuantity: 's',
unit: {
us: 1,
ms: 1e3,
@@ -30,6 +31,7 @@ export default {
},
0: {
name: 'I_in',
physicalQuantity: 'A',
unit: {
nA: 1,
uA: 1e3,
@@ -40,6 +42,7 @@ export default {
},
1: {
name: 'Potential',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -50,6 +53,7 @@ export default {
},
2: {
name: 'V_out',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -60,6 +64,7 @@ export default {
},
3: {
name: 'sum_cnt',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -70,6 +75,7 @@ export default {
},
4: {
name: 'sum_adc_delta_Iin',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -80,6 +86,7 @@ export default {
},
5: {
name: 'sum_adc_delta_Voutin',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -90,6 +97,7 @@ export default {
},
6: {
name: 'resis',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -18,6 +18,7 @@ export default {
channels: {
time: {
name: 'Time',
physicalQuantity: 's',
unit: {
us: 1,
ms: 1e3,
@@ -30,6 +31,7 @@ export default {
},
0: {
name: 'I_in',
physicalQuantity: 'A',
unit: {
nA: 1,
uA: 1e3,
@@ -40,6 +42,7 @@ export default {
},
1: {
name: 'V_in',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -50,6 +53,7 @@ export default {
},
2: {
name: 'V_out',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -18,6 +18,7 @@ export default {
channels: {
time: {
name: 'Time',
physicalQuantity: 's',
unit: {
us: 1,
ms: 1e3,
@@ -30,6 +31,7 @@ export default {
},
0: {
name: 'I_in',
physicalQuantity: 'A',
unit: {
nA: 1,
uA: 1e3,
@@ -40,6 +42,7 @@ export default {
},
1: {
name: 'V_out',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -50,6 +53,7 @@ export default {
},
2: {
name: 'V_in',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -60,6 +64,7 @@ export default {
},
3: {
name: 'Cycle number',
physicalQuantity: '',
unit: {
cycle: 1,
},
@@ -18,6 +18,7 @@ export default {
channels: {
time: {
name: 'Time',
physicalQuantity: 's',
unit: {
us: 1,
ms: 1e3,
@@ -30,6 +31,7 @@ export default {
},
0: {
name: 'I_in',
physicalQuantity: 'A',
unit: {
nA: 1,
uA: 1e3,
@@ -40,6 +42,7 @@ export default {
},
1: {
name: 'Potential',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -50,6 +53,7 @@ export default {
},
2: {
name: 'V_out',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -60,6 +64,7 @@ export default {
},
3: {
name: 'Cycle number',
physicalQuantity: '',
unit: {
cycle: 1,
},
+5
View File
@@ -23,6 +23,7 @@ export default {
channels: {
time: {
name: 'Time',
physicalQuantity: 's',
unit: {
us: 1,
ms: 1e3,
@@ -35,6 +36,7 @@ export default {
},
0: {
name: 'I_in',
physicalQuantity: 'A',
unit: {
nA: 1,
uA: 1e3,
@@ -45,6 +47,7 @@ export default {
},
1: {
name: 'Potential',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -55,6 +58,7 @@ export default {
},
2: {
name: 'V_out',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -65,6 +69,7 @@ export default {
},
3: {
name: 'Cycle number',
physicalQuantity: '',
unit: {
cycle: 1,
},
@@ -16,6 +16,7 @@ export default {
channels: {
time: {
name: 'Time',
physicalQuantity: 's',
unit: {
us: 1,
ms: 1e3,
@@ -28,6 +29,7 @@ export default {
},
0: {
name: '0',
physicalQuantity: '',
unit: {
default: 1,
},
@@ -35,6 +37,7 @@ export default {
},
1: {
name: '1',
physicalQuantity: '',
unit: {
default: 1,
},
@@ -42,6 +45,7 @@ export default {
},
2: {
name: '2',
physicalQuantity: '',
unit: {
default: 1,
},
@@ -49,6 +53,7 @@ export default {
},
3: {
name: '3',
physicalQuantity: '',
unit: {
default: 1,
},
@@ -18,6 +18,7 @@ export default {
channels: {
time: {
name: 'Time',
physicalQuantity: 's',
unit: {
us: 1,
ms: 1e3,
@@ -30,6 +31,7 @@ export default {
},
0: {
name: 'I_in',
physicalQuantity: 'A',
unit: {
nA: 1,
uA: 1e3,
@@ -40,6 +42,7 @@ export default {
},
1: {
name: 'V_out',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -50,6 +53,7 @@ export default {
},
2: {
name: 'V_in',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
+4
View File
@@ -18,6 +18,7 @@ export default {
channels: {
time: {
name: 'Time',
physicalQuantity: 's',
unit: {
us: 1,
ms: 1e3,
@@ -30,6 +31,7 @@ export default {
},
0: {
name: 'I_in',
physicalQuantity: 'A',
unit: {
nA: 1,
uA: 1e3,
@@ -40,6 +42,7 @@ export default {
},
1: {
name: 'V_in',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -50,6 +53,7 @@ export default {
},
2: {
name: 'V_out',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
+4
View File
@@ -18,6 +18,7 @@ export default {
channels: {
time: {
name: 'Time',
physicalQuantity: 's',
unit: {
us: 1,
ms: 1e3,
@@ -30,6 +31,7 @@ export default {
},
0: {
name: 'I_in',
physicalQuantity: 'A',
unit: {
nA: 1,
uA: 1e3,
@@ -40,6 +42,7 @@ export default {
},
1: {
name: 'V_out',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -50,6 +53,7 @@ export default {
},
2: {
name: 'V_in',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -18,6 +18,7 @@ export default {
channels: {
time: {
name: 'Time',
physicalQuantity: 's',
unit: {
us: 1,
ms: 1e3,
@@ -30,6 +31,7 @@ export default {
},
0: {
name: 'I_in',
physicalQuantity: 'A',
unit: {
nA: 1,
uA: 1e3,
@@ -40,6 +42,7 @@ export default {
},
1: {
name: 'Potential',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -50,6 +53,7 @@ export default {
},
2: {
name: 'V_out',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
+4
View File
@@ -18,6 +18,7 @@ export default {
channels: {
time: {
name: 'Time',
physicalQuantity: 's',
unit: {
us: 1,
ms: 1e3,
@@ -30,6 +31,7 @@ export default {
},
0: {
name: 'I_in',
physicalQuantity: 'A',
unit: {
nA: 1,
uA: 1e3,
@@ -40,6 +42,7 @@ export default {
},
1: {
name: 'Potential',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -50,6 +53,7 @@ export default {
},
2: {
name: 'V_in',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -34,6 +34,7 @@ export default {
channels: {
time: {
name: 'Time',
physicalQuantity: 's',
unit: {
us: 1,
ms: 1e3,
@@ -46,6 +47,7 @@ export default {
},
0: {
name: 'I_in_pul1',
physicalQuantity: 'A',
unit: {
nA: 1,
uA: 1e3,
@@ -56,6 +58,7 @@ export default {
},
1: {
name: 'I_in_pul2',
physicalQuantity: 'A',
unit: {
nA: 1,
uA: 1e3,
+4
View File
@@ -18,6 +18,7 @@ export default {
channels: {
time: {
name: 'Time',
physicalQuantity: 's',
unit: {
us: 1,
ms: 1e3,
@@ -30,6 +31,7 @@ export default {
},
0: {
name: 'I_in',
physicalQuantity: 'A',
unit: {
nA: 1,
uA: 1e3,
@@ -40,6 +42,7 @@ export default {
},
1: {
name: 'V_out',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -50,6 +53,7 @@ export default {
},
2: {
name: 'Resistor',
physicalQuantity: 'R',
unit: {
: 1,
mohm: 1,
+3
View File
@@ -18,6 +18,7 @@ export default {
channels: {
time: {
name: 'Time',
physicalQuantity: 's',
unit: {
us: 1,
ms: 1e3,
@@ -30,6 +31,7 @@ export default {
},
0: {
name: 'I_in',
physicalQuantity: 'A',
unit: {
nA: 1,
uA: 1e3,
@@ -40,6 +42,7 @@ export default {
},
1: {
name: 'V_in',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -18,6 +18,7 @@ export default {
channels: {
time: {
name: 'Time',
physicalQuantity: 's',
unit: {
us: 1,
ms: 1e3,
@@ -30,6 +31,7 @@ export default {
},
0: {
name: 'I_in',
physicalQuantity: 'A',
unit: {
nA: 1,
uA: 1e3,
@@ -40,6 +42,7 @@ export default {
},
1: {
name: 'Potential',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -50,6 +53,7 @@ export default {
},
2: {
name: 'V_out',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -18,6 +18,7 @@ export default {
channels: {
time: {
name: 'Time',
physicalQuantity: 's',
unit: {
us: 1,
ms: 1e3,
@@ -31,6 +32,7 @@ export default {
},
0: {
name: 'Z_Imag_Raw',
physicalQuantity: 'R',
unit: {
ohm: 1,
},
@@ -39,14 +41,16 @@ export default {
},
1: {
name: 'Z_Real_Raw',
physicalQuantity: 'R',
unit: {
default: 1,
ohm: 1,
},
downloadUnit: 'ohm',
defaultUnit: 'ohm',
},
2: {
name: 'Frequency',
physicalQuantity: 'Hz',
unit: {
mHz: 1,
Hz: 1e3,
@@ -65,6 +69,7 @@ export default {
// },
4: {
name: 'Z_Imag',
physicalQuantity: 'R',
unit: {
mohm: 1e-3,
: 1e-3,
@@ -80,6 +85,7 @@ export default {
},
5: {
name: 'Z_Real',
physicalQuantity: 'R',
unit: {
mohm: 1e-3,
: 1e-3,
@@ -95,6 +101,7 @@ export default {
},
6: {
name: 'Impedance',
physicalQuantity: 'R',
unit: {
mohm: 1e-3,
: 1e-3,
@@ -110,6 +117,7 @@ export default {
},
7: {
name: 'Phase',
physicalQuantity: 'Degree',
unit: {
millidegree: 1,
'°': 1e3,
@@ -119,6 +127,7 @@ export default {
},
8: {
name: 'Current',
physicalQuantity: 'A',
unit: {
nA: 1,
uA: 1e3,
@@ -129,6 +138,7 @@ export default {
},
9: {
name: 'Level gain',
physicalQuantity: '',
unit: {
default: 1,
},
@@ -137,6 +147,7 @@ export default {
},
10: {
name: 'notify_one',
physicalQuantity: '',
unit: {
default: 1,
},
@@ -145,6 +156,7 @@ export default {
},
11: {
name: 'notify_two',
physicalQuantity: '',
unit: {
default: 1,
},
@@ -153,6 +165,7 @@ export default {
},
12: {
name: 'notify_three',
physicalQuantity: '',
unit: {
default: 1,
},
@@ -161,11 +174,14 @@ export default {
},
13: {
name: 'debug_amp[mV]',
physicalQuantity: 'V',
unit: {
default: 1,
uV: 1,
mV: 1e3,
V: 1e6,
},
downloadUnit: null,
defaultUnit: 'default',
defaultUnit: 'mV',
downloadUnit: 'mV',
},
},
charts: {
@@ -18,6 +18,7 @@ export default {
channels: {
time: {
name: 'Time',
physicalQuantity: 's',
unit: {
us: 1,
ms: 1e3,
@@ -31,6 +32,7 @@ export default {
},
0: {
name: 'I_in',
physicalQuantity: 'A',
unit: {
nA: 1,
uA: 1e3,
@@ -41,6 +43,7 @@ export default {
},
1: {
name: 'V_out-V_in',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -51,6 +54,7 @@ export default {
},
2: {
name: 'V_out',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -61,6 +65,7 @@ export default {
},
3: {
name: 'Cycle',
physicalQuantity: '',
unit: {
cycle: 1,
},
@@ -16,6 +16,7 @@ export default {
channels: {
time: {
name: 'Time',
physicalQuantity: 's',
unit: {
us: 1,
ms: 1e3,
@@ -28,6 +29,7 @@ export default {
},
0: {
name: '0',
physicalQuantity: '',
unit: {
default: 1,
},
@@ -35,6 +37,7 @@ export default {
},
1: {
name: '1',
physicalQuantity: '',
unit: {
default: 1,
},
@@ -42,6 +45,7 @@ export default {
},
2: {
name: '2',
physicalQuantity: '',
unit: {
default: 1,
},
@@ -49,6 +53,7 @@ export default {
},
3: {
name: '3',
physicalQuantity: '',
unit: {
default: 1,
},
@@ -18,6 +18,7 @@ export default {
channels: {
time: {
name: 'Time',
physicalQuantity: 's',
unit: {
us: 1,
ms: 1e3,
@@ -31,6 +32,7 @@ export default {
},
0: {
name: 'Z_Imag_Raw',
physicalQuantity: 'R',
unit: {
ohm: 1,
},
@@ -39,14 +41,16 @@ export default {
},
1: {
name: 'Z_Real_Raw',
physicalQuantity: 'R',
unit: {
default: 1,
ohm: 1,
},
downloadUnit: 'ohm',
defaultUnit: 'ohm',
},
2: {
name: 'Frequency',
physicalQuantity: 'Hz',
unit: {
mHz: 1,
Hz: 1e3,
@@ -65,6 +69,7 @@ export default {
// },
4: {
name: 'Z_Imag',
physicalQuantity: 'R',
unit: {
mohm: 1e-3,
: 1e-3,
@@ -80,6 +85,7 @@ export default {
},
5: {
name: 'Z_Real',
physicalQuantity: 'R',
unit: {
mohm: 1e-3,
: 1e-3,
@@ -95,6 +101,7 @@ export default {
},
6: {
name: 'Impedance',
physicalQuantity: 'R',
unit: {
mohm: 1e-3,
: 1e-3,
@@ -110,6 +117,7 @@ export default {
},
7: {
name: 'Phase',
physicalQuantity: 'Degree',
unit: {
millidegree: 1,
'°': 1e3,
@@ -119,6 +127,7 @@ export default {
},
8: {
name: 'Current',
physicalQuantity: 'A',
unit: {
nA: 1,
uA: 1e3,
@@ -129,6 +138,7 @@ export default {
},
9: {
name: 'Level gain',
physicalQuantity: '',
unit: {
default: 1,
},
@@ -137,6 +147,7 @@ export default {
},
10: {
name: 'notify_one',
physicalQuantity: '',
unit: {
default: 1,
},
@@ -145,6 +156,7 @@ export default {
},
11: {
name: 'notify_two',
physicalQuantity: '',
unit: {
default: 1,
},
@@ -153,6 +165,7 @@ export default {
},
12: {
name: 'notify_three',
physicalQuantity: '',
unit: {
default: 1,
},
@@ -161,6 +174,7 @@ export default {
},
13: {
name: 'debug_amp[mV]',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
+4
View File
@@ -18,6 +18,7 @@ export default {
channels: {
time: {
name: 'Time',
physicalQuantity: 's',
unit: {
us: 1,
ms: 1e3,
@@ -30,6 +31,7 @@ export default {
},
0: {
name: 'I_in',
physicalQuantity: 'A',
unit: {
nA: 1,
uA: 1e3,
@@ -40,6 +42,7 @@ export default {
},
1: {
name: 'V_out',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
@@ -50,6 +53,7 @@ export default {
},
2: {
name: 'Resistor',
physicalQuantity: 'R',
unit: {
: 1,
mohm: 1,
+3
View File
@@ -18,6 +18,7 @@ export default {
channels: {
time: {
name: 'Time',
physicalQuantity: 's',
unit: {
us: 1,
ms: 1e3,
@@ -30,6 +31,7 @@ export default {
},
0: {
name: 'I_in',
physicalQuantity: 'A',
unit: {
nA: 1,
uA: 1e3,
@@ -40,6 +42,7 @@ export default {
},
1: {
name: 'V_in',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
+9 -5
View File
@@ -93,16 +93,20 @@ const EliteEIS = {
{ value: 1, label: '2' },
{ value: 2, label: '3' },
{ value: 3, label: '4' },
{ value: 4, label: 'Auto' },
{ value: 4, label: '5' },
{ value: 5, label: '6' },
{ value: 6, label: '7' },
{ value: 7, label: '8' },
{ value: 8, label: 'Auto' },
],
range: ['1', '2', '3', '4', 'Auto'],
defaultValue: 4,
range: ['1', '2', '3', '4', '5', '6', '7', '8', 'Auto'],
defaultValue: 8,
outputRawData: (val) => {
const numArr = ['1', '2', '3', '4', 'Auto']
const numArr = ['1', '2', '3', '4', '5', '6', '7', '8', 'Auto']
return numArr.indexOf(val.toString())
},
outputReadabilityData: (idx) => {
const numArr = ['1', '2', '3', '4', 'Auto']
const numArr = ['1', '2', '3', '4', '5', '6', '7', '8', 'Auto']
return numArr[parseInt(idx)]
},
},
@@ -0,0 +1,98 @@
export default {
name: 'Dev Mode',
parameter: ['ADC_VALUE_I'],
valScales: {
linear: {
func: (val) => {
return val
},
},
log: {
func: (val) => {
return Math.log10(Math.abs(val))
},
},
},
channels: {
time: {
name: 'Time',
physicalQuantity: 's',
unit: {
us: 1,
ms: 1e3,
s: 1e6,
m: 60 * 1e6,
h: 60 * 60 * 1e6,
auto: 1,
},
defaultUnit: 'us',
},
0: {
name: '0',
physicalQuantity: '',
unit: {
default: 1,
},
defaultUnit: 'default',
},
1: {
name: '1',
physicalQuantity: '',
unit: {
default: 1,
},
defaultUnit: 'default',
},
2: {
name: '2',
physicalQuantity: '',
unit: {
default: 1,
},
defaultUnit: 'default',
},
3: {
name: '3',
physicalQuantity: '',
unit: {
default: 1,
},
defaultUnit: 'default',
},
},
charts: {
default: [
{
name: 'Dev Mode',
description: '',
subplot: [
{
x1: {
type: 'time',
valScale: 'linear',
min: 'dataMin',
max: 'dataMax',
},
y1: {
type: 'value',
valScale: 'linear',
min: 'dataMin',
max: 'dataMax',
},
data: [
{
legend: 'dev',
x1: {
channel: 'time',
},
y1: {
channel: 1,
},
},
],
},
],
},
],
},
}
+382
View File
@@ -1,7 +1,374 @@
import Idle from '../Common/Idle'
import ACC from './ACC'
import DevMode from './DevMode'
const EliteTrigger = {
USED: {
type: 'boolean-array',
range: Object.freeze({ min: false, max: true }),
defaultValue: [false, false, false, false, false, false, false, false],
outputRawData: (val, scale = 1, index = -1) => {
if (index === -1) {
return val
} else {
return val[index]
}
},
outputReadabilityData: (val, scale = 1, index = -1) => {
if (index === -1) {
return val
} else {
return val[index]
}
},
},
T_EARLY: {
type: 'number-array',
showName: 'pre-T',
range: Object.freeze({ min: 0, max: 86400 }),
defaultValue: [0, 0, 0, 0, 0, 0, 0, 0],
outputRawData: (val, scale = 1, index = -1) => {
if (index === -1) {
return Number(Number(val).toFixed(1)) * 1000 * scale
} else {
return val[index]
}
},
outputReadabilityData: (val, scale = 1, index = -1) => {
if (index === -1) {
return Number((val / 1000 / scale).toFixed(1))
} else {
return val[index]
}
},
defaultUnit: 's',
downloadUnit: 's',
unit: {
ms: 1e-3,
s: 1,
m: 60,
h: 3600,
},
},
V_EARLY: {
type: 'boolean-array',
range: Object.freeze({ min: false, max: true }),
defaultValue: [false, false, false, false, false, false, false, false],
outputRawData: (val, scale = 1, index = -1) => {
if (index === -1) {
return val
} else {
return val[index]
}
},
outputReadabilityData: (val, scale = 1, index = -1) => {
if (index === -1) {
return val
} else {
return val[index]
}
},
},
CYCLE: {
type: 'number-array',
showName: 'cycle no.',
range: Object.freeze({ min: 1, max: 50000 }),
defaultValue: [1, 1, 1, 1, 1, 1, 1, 1],
outputRawData: (val, scale = 1, index = -1) => {
if (index === -1) {
return Number(val)
} else {
return val[index]
}
},
outputReadabilityData: (val, scale = 1, index = -1) => {
if (index === -1) {
return val
} else {
return val[index]
}
},
},
T_MID0: {
type: 'number-array',
showName: 'T1',
range: Object.freeze({ min: 0, max: 86400 }),
defaultValue: [0, 0, 0, 0, 0, 0, 0, 0],
outputRawData: (val, scale = 1, index = -1) => {
if (index === -1) {
return Number(Number(val).toFixed(1)) * 1000 * scale
} else {
return val[index]
}
},
outputReadabilityData: (val, scale = 1, index = -1) => {
if (index === -1) {
return Number((val / 1000 / scale).toFixed(1))
} else {
return val[index]
}
},
defaultUnit: 's',
downloadUnit: 's',
unit: {
ms: 1e-3,
s: 1,
m: 60,
h: 3600,
},
},
V_MID0: {
type: 'boolean-array',
range: Object.freeze({ min: false, max: true }),
defaultValue: [false, false, false, false, false, false, false, false],
outputRawData: (val, scale = 1, index = -1) => {
if (index === -1) {
return val
} else {
return val[index]
}
},
outputReadabilityData: (val, scale = 1, index = -1) => {
if (index === -1) {
return val
} else {
return val[index]
}
},
},
T_MID1: {
type: 'number-array',
showName: 'T2',
range: Object.freeze({ min: 0, max: 86400 }),
defaultValue: [0, 0, 0, 0, 0, 0, 0, 0],
outputRawData: (val, scale = 1, index = -1) => {
if (index === -1) {
return Number(Number(val).toFixed(1)) * 1000 * scale
} else {
return val[index]
}
},
outputReadabilityData: (val, scale = 1, index = -1) => {
if (index === -1) {
return Number((val / 1000 / scale).toFixed(1))
} else {
return val[index]
}
},
defaultUnit: 's',
downloadUnit: 's',
unit: {
ms: 1e-3,
s: 1,
m: 60,
h: 3600,
},
},
V_MID1: {
type: 'boolean-array',
range: Object.freeze({ min: false, max: true }),
defaultValue: [false, false, false, false, false, false, false, false],
outputRawData: (val, scale = 1, index = -1) => {
if (index === -1) {
return val
} else {
return val[index]
}
},
outputReadabilityData: (val, scale = 1, index = -1) => {
if (index === -1) {
return val
} else {
return val[index]
}
},
},
T_MID2: {
type: 'number-array',
showName: 'T3',
range: Object.freeze({ min: 0, max: 86400 }),
defaultValue: [0, 0, 0, 0, 0, 0, 0, 0],
outputRawData: (val, scale = 1, index = -1) => {
if (index === -1) {
return Number(Number(val).toFixed(1)) * 1000 * scale
} else {
return val[index]
}
},
outputReadabilityData: (val, scale = 1, index = -1) => {
if (index === -1) {
return Number((val / 1000 / scale).toFixed(1))
} else {
return val[index]
}
},
defaultUnit: 's',
downloadUnit: 's',
unit: {
ms: 1e-3,
s: 1,
m: 60,
h: 3600,
},
},
V_MID2: {
type: 'boolean-array',
range: Object.freeze({ min: false, max: true }),
defaultValue: [false, false, false, false, false, false, false, false],
outputRawData: (val, scale = 1, index = -1) => {
if (index === -1) {
return val
} else {
return val[index]
}
},
outputReadabilityData: (val, scale = 1, index = -1) => {
if (index === -1) {
return val
} else {
return val[index]
}
},
},
T_MID3: {
type: 'number-array',
showName: 'T4',
range: Object.freeze({ min: 0, max: 86400 }),
defaultValue: [0, 0, 0, 0, 0, 0, 0, 0],
outputRawData: (val, scale = 1, index = -1) => {
if (index === -1) {
return Number(Number(val).toFixed(1)) * 1000 * scale
} else {
return val[index]
}
},
outputReadabilityData: (val, scale = 1, index = -1) => {
if (index === -1) {
return Number((val / 1000 / scale).toFixed(1))
} else {
return val[index]
}
},
defaultUnit: 's',
downloadUnit: 's',
unit: {
ms: 1e-3,
s: 1,
m: 60,
h: 3600,
},
},
V_MID3: {
type: 'boolean-array',
range: Object.freeze({ min: false, max: true }),
defaultValue: [false, false, false, false, false, false, false, false],
outputRawData: (val, scale = 1, index = -1) => {
if (index === -1) {
return val
} else {
return val[index]
}
},
outputReadabilityData: (val, scale = 1, index = -1) => {
if (index === -1) {
return val
} else {
return val[index]
}
},
},
T_LATE: {
type: 'number-array',
showName: 'post-T',
range: Object.freeze({ min: 0, max: 86400 }),
defaultValue: [0, 0, 0, 0, 0, 0, 0, 0],
outputRawData: (val, scale = 1, index = -1) => {
if (index === -1) {
return Number(Number(val).toFixed(1)) * 1000 * scale
} else {
return val[index]
}
},
outputReadabilityData: (val, scale = 1, index = -1) => {
if (index === -1) {
return Number((val / 1000 / scale).toFixed(1))
} else {
return val[index]
}
},
defaultUnit: 's',
downloadUnit: 's',
unit: {
ms: 1e-3,
s: 1,
m: 60,
h: 3600,
},
},
V_LATE: {
type: 'boolean-array',
range: Object.freeze({ min: false, max: true }),
defaultValue: [false, false, false, false, false, false, false, false],
outputRawData: (val, scale = 1, index = -1) => {
if (index === -1) {
return val
} else {
return val[index]
}
},
outputReadabilityData: (val, scale = 1, index = -1) => {
if (index === -1) {
return val
} else {
return val[index]
}
},
},
CURRENT: {
type: 'number-array',
showName: 'current',
range: Object.freeze({ min: 0, max: 50000 }),
defaultValue: [0, 0, 0, 0, 0, 0, 0, 0],
outputRawData: (val, scale = 1, index = -1) => {
if (index === -1) {
return Number(Number(val).toFixed(1)) * 250 * scale
} else {
return val[index]
}
},
outputReadabilityData: (val, scale = 1, index = -1) => {
if (index === -1) {
return val / 250 / scale
} else {
return val[index]
}
},
defaultUnit: 'mA',
downloadUnit: 'mA',
unit: {
mA: 1,
},
},
OUTPUT_5V: {
type: 'boolean-array',
showName: '5V output',
range: Object.freeze({ min: false, max: true }),
defaultValue: [false, false, false, false, false, false, false, false],
outputRawData: (val, scale = 1, index = -1) => {
if (index === -1) {
return val
} else {
return val[index]
}
},
outputReadabilityData: (val, scale = 1, index = -1) => {
if (index === -1) {
return val
} else {
return val[index]
}
},
},
TIME_DURATION: {
type: 'number',
showName: 'Time duration',
@@ -223,19 +590,34 @@ const EliteTrigger = {
return parseInt(val)
},
},
ADC_VALUE_I: {
type: 'none',
showName: 'Instruction',
componentType: 'dev-mode',
},
MODE_OPTIONS: [
{
id: 1,
description: 'Idle',
},
{
id: 3,
description: 'Trigger',
},
{
id: 0,
description: 'Analog Current Control (ACC)',
},
{
id: 2,
description: 'DEV MODE',
},
],
MODE: {
0: ACC,
1: Idle,
2: DevMode,
3: ACC,
},
}
+1
View File
@@ -29,6 +29,7 @@ const serialNumberMappingTable = {
6: EliteEDC, // EDC1.5
7: EliteEDC, // EDC1.5re
8: EliteEDC, // EDC1.5r2
9: EliteEDC, // EDC2.0
},
},
3: {
+1 -1
View File
@@ -27,7 +27,7 @@ const hasCycleMode = (mode, lib) => {
}
const getDefaultChartTypeByMode = (mode, lib) => {
if (lib === 'EliteZM15' || lib.includes('Elite_EDC')) {
if (lib === 'EliteZM15' || lib.includes('Elite_EDC') || lib.includes('Elite_BAT')) {
const settings = {}
settings[0] = ['Elite', 2, 'Elite', 1]
settings[1] = ['Elite', 2, 'Elite', 1]
+1
View File
@@ -36,6 +36,7 @@ function newSeries (type, legendName, xAxisIndex, yAxisIndex, xAxisSource, yAxis
showSymbol: false,
showAllSymbol: false,
symbolSize: 4,
sampling: 'lttb',
// [modified 2021/08/10] sampling method managed by vuex
// sampling: 'average',
// sampling: function (frame) {
@@ -837,7 +837,7 @@ const chartActs = {
* @return {bool}
*/
[typePath.defaultChartGenerator]: async ({ state, getters, commit, dispatch }, payload) => {
const { _deviceList, _itemID, _chartID, _type } = payload
const { _deviceList, _itemID, _chartID, _type, _reset } = payload
let item
_deviceList.forEach(_device => {
if (_itemID === _device.id) {
@@ -987,6 +987,7 @@ const chartActs = {
chartID: chartID,
mappingID: state.chartData[chartID].mappingID,
cardName: state.chartData[chartID].cardName,
reset: _reset,
})
state.chartData[chartID].mappingID = item.id
switch (_type) {
@@ -1015,15 +1016,17 @@ const chartActs = {
* @param {String} cardName
*/
[typePath.reset]: ({ state, getters, commit, dispatch }, payload) => {
const { chartID, mappingID, cardName } = payload
const { chartID, mappingID, cardName, reset } = payload
state.chartData[chartID].legend.data.length = 0
state.chartData[chartID].xAxis.length = 0
state.chartData[chartID].yAxis.length = 0
state.chartData[chartID].gridSource.length = 0
if (state.chartData[chartID].series.data != null) {
state.chartData[chartID].series.data.length = 0
if (reset === undefined) {
if (state.chartData[chartID].series.data != null) {
state.chartData[chartID].series.data.length = 0
}
state.chartData[chartID].series.length = 0
}
state.chartData[chartID].series.length = 0
if (mappingID == null) {
state.chartData[chartID].mappingID = '-1'
}