Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 33a7b0faeb | |||
| 200a07f6db | |||
| 0c9d8499b8 | |||
| 21bb21b315 | |||
| 6d48fd44de | |||
| ee6cbdf216 | |||
| 12e9d4b5e5 | |||
| 2f9758e164 | |||
| c320152e46 | |||
| 349b2e372f | |||
| 5cc081e015 | |||
| 0bfba093fd |
@@ -127,7 +127,7 @@ export default {
|
||||
getControllerList: async function () {
|
||||
const update = async () => {
|
||||
this.controllerList.push({
|
||||
id: 'tommy_test',
|
||||
id: 'BPS-HUB-02-060',
|
||||
mac: '',
|
||||
status: 'loading',
|
||||
isScan: true,
|
||||
|
||||
@@ -353,7 +353,7 @@ export default {
|
||||
getControllerList: async function () {
|
||||
const update = async () => {
|
||||
this.controllerList.push({
|
||||
id: 'tommy_test',
|
||||
id: 'BPS-HUB-02-060',
|
||||
mac: '',
|
||||
status: 'loading',
|
||||
isScan: true,
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<script>
|
||||
import api from '@/data/api/index'
|
||||
import types from '@/store/modules/download/types'
|
||||
import { mapActions } from 'vuex'
|
||||
import { mapActions, mapMutations } from 'vuex'
|
||||
import { FulfillingBouncingCircleSpinner } from 'epic-spinners'
|
||||
import { mapFields } from 'vuex-map-fields'
|
||||
import newDownload from '@/factories/file/downloadFactory'
|
||||
@@ -43,7 +43,7 @@ export default {
|
||||
getControllerList: async function () {
|
||||
const update = async () => {
|
||||
this.controllerList.push({
|
||||
id: 'tommy_test',
|
||||
id: 'BPS-HUB-02-060',
|
||||
mac: '',
|
||||
status: 'loading',
|
||||
isScan: true,
|
||||
@@ -57,9 +57,18 @@ export default {
|
||||
position: 'bottom-right',
|
||||
})
|
||||
},
|
||||
chunkArray (rawDataIDArray, chunkSize) {
|
||||
const arrayLength = rawDataIDArray.length
|
||||
const results = []
|
||||
for (let index = 0; index < arrayLength; index += chunkSize) {
|
||||
results.push(rawDataIDArray.slice(index, index + chunkSize))
|
||||
}
|
||||
return results
|
||||
},
|
||||
...mapActions('download',
|
||||
[
|
||||
types.raw.rawDataByID,
|
||||
types.raw.rawDataByIDs,
|
||||
types.raw.rawSdDataByID,
|
||||
types.export.setHeader,
|
||||
types.export.setTitle,
|
||||
@@ -68,6 +77,12 @@ export default {
|
||||
types.download.setStream,
|
||||
types.download.setSampleRate,
|
||||
types.download.setIDList,
|
||||
types.download.clearStream,
|
||||
],
|
||||
),
|
||||
...mapMutations('download',
|
||||
[
|
||||
types.download.clearIDList,
|
||||
],
|
||||
),
|
||||
},
|
||||
@@ -93,96 +108,121 @@ export default {
|
||||
const channelArray = JSON.parse(this.metaInfo.channels)
|
||||
const channelList = []
|
||||
|
||||
// split to different subfile by channel
|
||||
if (meta.device.library_name.indexOf('Neulive') >= 0) {
|
||||
if (channelArray.some(el => el >= 256)) {
|
||||
channelList.push(channelArray.filter(el => el < 256))
|
||||
channelList.push(channelArray.filter(el => (el >= 256 && el <= 259)))
|
||||
channelList.push(channelArray.filter(el => el < 256))
|
||||
} else {
|
||||
channelList.push(channelArray)
|
||||
}
|
||||
} else if (meta.device.library_name.indexOf('Elite') >= 0) {
|
||||
channelList.push(channelArray)
|
||||
}
|
||||
|
||||
while (channelList.length > 0) {
|
||||
this.downloadInfo = newDownload()
|
||||
this.downloadInfo.channel = channelList.pop()
|
||||
const channels = channelList.pop()
|
||||
|
||||
// download format
|
||||
this.downloadInfo.format = format
|
||||
let maxSplitFiles = 1
|
||||
let fileIndex = 0
|
||||
|
||||
// download device and filename
|
||||
if (meta.device.library_name.indexOf('Neulive') >= 0) {
|
||||
this.downloadInfo.device = [meta.device.library_name.slice(0, 7), meta.device.library_name.slice(7)]
|
||||
if (this.downloadInfo.channel.some(el => el >= 256 && el <= 259)) {
|
||||
this.downloadInfo.filename = meta.name + '-accerlate-' + format
|
||||
this.downloadInfo.size = parseInt(parseInt(meta.size) / 76)
|
||||
} else {
|
||||
this.downloadInfo.filename = meta.name + '-' + format
|
||||
this.downloadInfo.size = parseInt(meta.size)
|
||||
// find max raw data need sub file
|
||||
for (const rawDataIndex of channels) {
|
||||
const dataLength = meta.raw_data[rawDataIndex].length
|
||||
|
||||
maxSplitFiles = Math.max(maxSplitFiles, Math.ceil(meta.raw_data[rawDataIndex].length / dataLength))
|
||||
meta.raw_data[rawDataIndex] = this.chunkArray(meta.raw_data[rawDataIndex], dataLength)
|
||||
}
|
||||
|
||||
while (fileIndex < maxSplitFiles) {
|
||||
// create new download info & add channel
|
||||
if (this.downloadInfo === null) {
|
||||
this.downloadInfo = newDownload()
|
||||
}
|
||||
} else if (meta.device.library_name.indexOf('Elite') >= 0) {
|
||||
this.downloadInfo.device = [meta.device.library_name.slice(0, 5), meta.device.library_name.slice(5)]
|
||||
this.downloadInfo.filename = meta.name + '-' + format
|
||||
this.downloadInfo.size = parseInt(meta.size)
|
||||
}
|
||||
this.downloadInfo.channel = channels
|
||||
|
||||
// init
|
||||
// download format
|
||||
this.downloadInfo.format = format
|
||||
|
||||
// get sampleRate && downloadList
|
||||
for (const channel of this.downloadInfo.channel) {
|
||||
this.downloadInfo.channelInfo[channel] = newChannel()
|
||||
this.setSampleRateDownload({ channel: channel })
|
||||
this.setIDListDownload({ channel: channel })
|
||||
}
|
||||
// download device and filename
|
||||
if (meta.device.library_name.indexOf('Neulive') >= 0) {
|
||||
this.downloadInfo.device = [meta.device.library_name.slice(0, 7), meta.device.library_name.slice(7)]
|
||||
if (this.downloadInfo.channel.some(el => el >= 256 && el <= 259)) {
|
||||
this.downloadInfo.filename = meta.name + '-accerlate'
|
||||
this.downloadInfo.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))
|
||||
}
|
||||
|
||||
// if create writer
|
||||
this.setStreamDownload()
|
||||
|
||||
console.log(this.downloadInfo)
|
||||
console.log(this.metaInfo)
|
||||
|
||||
// set Header
|
||||
if (this.downloadInfo.format !== 'csv-edf') {
|
||||
await this.setHeaderExport()
|
||||
}
|
||||
await this.setTitleExport()
|
||||
|
||||
// start download data
|
||||
let rowIndex = 0
|
||||
|
||||
while (rowIndex < this.downloadInfo.maxRows) {
|
||||
// create new channel info & get sample rate
|
||||
for (const channel of this.downloadInfo.channel) {
|
||||
for (const idx in this.downloadInfo.channelInfo[channel].downloadIDList) {
|
||||
const _idx = parseInt(idx)
|
||||
const rawID = this.downloadInfo.channelInfo[channel].downloadIDList[_idx][rowIndex]
|
||||
// console.log(rowIndex, _idx, rawID)
|
||||
if (rawID !== undefined) {
|
||||
if (sd === 'sd') {
|
||||
await this.rawSdDataByIDRaw({
|
||||
channel: channel,
|
||||
rawID: rawID,
|
||||
idx: _idx,
|
||||
api: api,
|
||||
})
|
||||
} else {
|
||||
await this.rawDataByIDRaw({
|
||||
channel: channel,
|
||||
rawID: rawID,
|
||||
idx: _idx,
|
||||
api: api,
|
||||
})
|
||||
if (this.downloadInfo.channelInfo[channel] === undefined) {
|
||||
this.downloadInfo.channelInfo[channel] = newChannel()
|
||||
this.setSampleRateDownload({ channel: channel })
|
||||
}
|
||||
}
|
||||
|
||||
// set download ID list
|
||||
this.clearIDListDownload()
|
||||
for (const channel of this.downloadInfo.channel) {
|
||||
this.setIDListDownload({ channel: channel, fileIndex: fileIndex })
|
||||
}
|
||||
|
||||
// if create writer
|
||||
this.clearStreamDownload()
|
||||
this.setStreamDownload()
|
||||
|
||||
// set Header
|
||||
if (this.downloadInfo.format !== 'csv-edf') {
|
||||
await this.setHeaderExport()
|
||||
}
|
||||
await this.setTitleExport()
|
||||
|
||||
// start download data
|
||||
let rowIndex = 0
|
||||
|
||||
while (rowIndex < this.downloadInfo.maxRows) {
|
||||
for (const channel of this.downloadInfo.channel) {
|
||||
for (const idx in this.downloadInfo.channelInfo[channel].downloadIDList) {
|
||||
const _idx = parseInt(idx)
|
||||
const rawID = this.downloadInfo.channelInfo[channel].downloadIDList[_idx][rowIndex]
|
||||
// const rawID = this.downloadInfo.channelInfo[channel].downloadIDList[_idx].splice(0, 10).join(',')
|
||||
// console.log(rowIndex, _idx, rawID)
|
||||
if (rawID !== undefined) {
|
||||
if (sd === 'sd') {
|
||||
await this.rawSdDataByIDRaw({
|
||||
channel: channel,
|
||||
rawID: rawID,
|
||||
idx: _idx,
|
||||
api: api,
|
||||
})
|
||||
} else {
|
||||
await this.rawDataByIDRaw({
|
||||
channel: channel,
|
||||
rawID: rawID,
|
||||
idx: _idx,
|
||||
api: api,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
await this.setDataExport({ last: (rowIndex >= this.downloadInfo.maxRows - 1) })
|
||||
rowIndex += 1
|
||||
}
|
||||
await this.setDataExport({ last: (rowIndex === this.downloadInfo.maxRows - 1) })
|
||||
rowIndex += 1
|
||||
this.closeWriterDownload()
|
||||
fileIndex += 1
|
||||
}
|
||||
this.closeWriterDownload()
|
||||
}
|
||||
}
|
||||
}
|
||||
await new Promise(resolve => setTimeout(resolve, 2000)) // sleep
|
||||
await new Promise(resolve => setTimeout(resolve, 2000)) // sleep 2s prevent window close
|
||||
window.close()
|
||||
},
|
||||
destroyed () {
|
||||
|
||||
@@ -48,7 +48,7 @@ export default {
|
||||
getControllerList: async function () {
|
||||
const update = async () => {
|
||||
this.controllerList.push({
|
||||
id: 'tommy_test',
|
||||
id: 'BPS-HUB-02-060',
|
||||
mac: '',
|
||||
status: 'loading',
|
||||
isScan: true,
|
||||
@@ -73,6 +73,7 @@ export default {
|
||||
...mapActions('download',
|
||||
[
|
||||
types.raw.rawDataByID,
|
||||
types.raw.rawDataByIDs,
|
||||
types.raw.rawSdDataByID,
|
||||
types.export.setHeader,
|
||||
types.export.setTitle,
|
||||
@@ -114,8 +115,8 @@ export default {
|
||||
|
||||
if (meta.device.library_name.indexOf('Neulive') >= 0) {
|
||||
if (channelArray.some(el => el >= 256)) {
|
||||
channelList.push(channelArray.filter(el => el < 256))
|
||||
channelList.push(channelArray.filter(el => (el >= 256 && el <= 259)))
|
||||
channelList.push(channelArray.filter(el => el < 256))
|
||||
} else {
|
||||
channelList.push(channelArray)
|
||||
}
|
||||
@@ -123,18 +124,27 @@ export default {
|
||||
channelList.push(channelArray)
|
||||
}
|
||||
|
||||
let maxSplitFiles = 1
|
||||
let fileIndex = 0
|
||||
this.$refs.progressModalRef.show()
|
||||
|
||||
// find max raw data need sub file
|
||||
for (const rawDataIndex of Object.keys(meta.raw_data)) {
|
||||
maxSplitFiles = Math.max(maxSplitFiles, Math.ceil(meta.raw_data[rawDataIndex].length / 400))
|
||||
meta.raw_data[rawDataIndex] = this.chunkArray(meta.raw_data[rawDataIndex], 400)
|
||||
}
|
||||
|
||||
while (channelList.length > 0) {
|
||||
const channels = channelList.pop()
|
||||
|
||||
let maxSplitFiles = 1
|
||||
let fileIndex = 0
|
||||
|
||||
// find max raw data need sub file
|
||||
for (const rawDataIndex of Object.keys(meta.raw_data)) {
|
||||
let dataLength = 0
|
||||
if (rawDataIndex >= 256) {
|
||||
dataLength = meta.raw_data[rawDataIndex].length
|
||||
} else {
|
||||
dataLength = 160
|
||||
}
|
||||
|
||||
maxSplitFiles = Math.max(maxSplitFiles, Math.ceil(meta.raw_data[rawDataIndex].length / dataLength))
|
||||
meta.raw_data[rawDataIndex] = this.chunkArray(meta.raw_data[rawDataIndex], dataLength)
|
||||
}
|
||||
|
||||
while (fileIndex < maxSplitFiles) {
|
||||
if (this.downloadInfo === null) {
|
||||
this.downloadInfo = newDownload()
|
||||
@@ -147,18 +157,20 @@ export default {
|
||||
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 = meta.name + '-accerlate-' + (fileIndex + 1).toString()
|
||||
this.downloadInfo.size = parseInt(parseInt(meta.size) / 76)
|
||||
} else {
|
||||
this.downloadInfo.filename = meta.name + '-' + format
|
||||
this.downloadInfo.filename = meta.name + '-' + (fileIndex + 1).toString()
|
||||
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 + '-' + format
|
||||
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) {
|
||||
@@ -181,7 +193,7 @@ export default {
|
||||
for (const channel of this.downloadInfo.channel) {
|
||||
for (const idx in this.downloadInfo.channelInfo[channel].downloadIDList) {
|
||||
const _idx = parseInt(idx)
|
||||
const rawID = this.downloadInfo.channelInfo[channel].downloadIDList[_idx][rowIndex]
|
||||
const rawID = this.downloadInfo.channelInfo[channel].downloadIDList[_idx].splice(0, 10).join(',')
|
||||
// console.log(rowIndex, _idx, rawID)
|
||||
if (rawID !== undefined) {
|
||||
if (sd === 'sd') {
|
||||
@@ -192,7 +204,7 @@ export default {
|
||||
api: api,
|
||||
})
|
||||
} else {
|
||||
await this.rawDataByIDRaw({
|
||||
await this.rawDataByIDsRaw({
|
||||
channel: channel,
|
||||
rawID: rawID,
|
||||
idx: _idx,
|
||||
@@ -202,9 +214,9 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
rowIndex += 1
|
||||
rowIndex += 10
|
||||
}
|
||||
this.setAllExport({ last: (rowIndex === this.downloadInfo.maxRows - 1) })
|
||||
await this.setAllExport({ last: (rowIndex >= this.downloadInfo.maxRows - 1) })
|
||||
this.$refs.progressModalRef.setValue(100)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ export default {
|
||||
getControllerList: async function () {
|
||||
const update = async () => {
|
||||
this.controllerList.push({
|
||||
id: 'tommy_test',
|
||||
id: 'BPS-HUB-02-060',
|
||||
mac: '',
|
||||
status: 'loading',
|
||||
isScan: true,
|
||||
|
||||
@@ -186,12 +186,12 @@
|
||||
<va-popover :message="`download ${props.rowData.name} in csv format`" placement="top">
|
||||
<va-button flat small color="gray" icon="fa fa-download" v-if="props.rowData.type !== 'folder' && props.rowData.device.library_name.indexOf('Neulive') >= 0" @click.stop="downloadCsv(props.rowData)"/>
|
||||
</va-popover>
|
||||
<va-popover :message="`download ${props.rowData.name} in excel format`" placement="top">
|
||||
<!-- <va-popover :message="`download ${props.rowData.name} in excel format`" placement="top">
|
||||
<va-button flat small color="gray" icon="fa fa-download" v-if="props.rowData.type !== 'folder' && props.rowData.device.library_name.indexOf('Elite') >= 0" @click.stop="downloadExcel(props.rowData)"/>
|
||||
</va-popover>
|
||||
<va-popover :message="`download ${props.rowData.name} in csv-edf format`" placement="top">
|
||||
<va-button flat small color="gray" icon="fa fa-download" v-if="props.rowData.type !== 'folder' && props.rowData.device.library_name.indexOf('Neulive') >= 0" @click.stop="downloadExcel(props.rowData)"/>
|
||||
</va-popover>
|
||||
</va-popover> -->
|
||||
<va-popover :message="`replay ${props.rowData.name}`" placement="top">
|
||||
<va-button flat small color="gray" icon="fa fa-eye" v-if="props.rowData.type !== 'folder'" @click.stop="replay(props.rowData)"/>
|
||||
</va-popover>
|
||||
|
||||
@@ -150,10 +150,10 @@ export default {
|
||||
const ret = await api.analysis.IIRFilter({
|
||||
type: this.selectFilter.name,
|
||||
order: this.order,
|
||||
fs: parseInt(_fs / _chNum),
|
||||
f0: parseInt(this.freq0),
|
||||
f1: parseInt(this.freq1),
|
||||
f2: parseInt(this.freq2),
|
||||
fs: parseFloat(_fs / _chNum),
|
||||
f0: parseFloat(this.freq0),
|
||||
f1: parseFloat(this.freq1),
|
||||
f2: parseFloat(this.freq2),
|
||||
})
|
||||
|
||||
if (ret.status !== 200) {
|
||||
@@ -175,10 +175,10 @@ export default {
|
||||
this.data.series[i].filter[index].type = this.selectFilter.name
|
||||
this.data.series[i].filter[index].order = this.order
|
||||
// sampling rate changed by channel number
|
||||
this.data.series[i].filter[index].fs = parseInt(_fs / _chNum)
|
||||
this.data.series[i].filter[index].f0 = parseInt(this.freq0)
|
||||
this.data.series[i].filter[index].f1 = parseInt(this.freq1)
|
||||
this.data.series[i].filter[index].f2 = parseInt(this.freq2)
|
||||
this.data.series[i].filter[index].fs = parseFloat(_fs / _chNum)
|
||||
this.data.series[i].filter[index].f0 = parseFloat(this.freq0)
|
||||
this.data.series[i].filter[index].f1 = parseFloat(this.freq1)
|
||||
this.data.series[i].filter[index].f2 = parseFloat(this.freq2)
|
||||
this.data.series[i].filter[index].sos = sos
|
||||
this.data.series[i].filter[index].filter = IIRFilter.init(sos)
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
@ok="remove()"
|
||||
/>
|
||||
<va-accordion v-for="device in deviceList" :key="device.id">
|
||||
<va-collapse class="mb-2">
|
||||
<va-collapse class="mb-2" :isOpenDefault='true'>
|
||||
<span slot="header" >
|
||||
<va-item :key="device.id" class="pa-0 ma-0"
|
||||
>
|
||||
@@ -38,13 +38,13 @@
|
||||
</va-item-section>
|
||||
|
||||
<va-item-section class="mr-3" v-if="device.type == 'Neulive'" side>
|
||||
<va-icon
|
||||
<!-- <va-icon
|
||||
name="material-icons"
|
||||
:color="(device.sdCardStatus === true) ? 'primary' : 'grey'"
|
||||
class="mr-3"
|
||||
@click.native.stop="sdCardStatus(device)"
|
||||
> sd_card
|
||||
</va-icon>
|
||||
</va-icon> -->
|
||||
<va-icon
|
||||
:name="(device.transmission_type === 0) ? 'fa fa-bluetooth-b' : 'fa fa-usb'"
|
||||
color="primary"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<div class="flex" >
|
||||
<va-tree-root >
|
||||
<va-tree-category
|
||||
isOpen
|
||||
style="font-size: 20px;"
|
||||
:label="'Channels'">
|
||||
<va-tree-node>
|
||||
@@ -243,7 +244,7 @@ export default {
|
||||
refresh () {
|
||||
this.channelList.length = 0
|
||||
const channelSet = taskInfo.getDeviceInfo(this.deviceID).parameterSet.RECORDING_CH.toString(2).split('').reverse()
|
||||
taskInfo.getDeviceInfo(this.deviceID).parameterSet.CH_NUMBER = 1
|
||||
taskInfo.getDeviceInfo(this.deviceID).parameterSet.CH_NUMBER = 0
|
||||
channelSet.forEach((element, index) => {
|
||||
if (parseInt(element) > 0) {
|
||||
this.channelList.push(index + 1)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
<va-tree-root>
|
||||
<va-tree-category
|
||||
isOpen
|
||||
style="font-size: 20px;"
|
||||
:label="'RECORDING'"
|
||||
>
|
||||
|
||||
@@ -2,7 +2,7 @@ import axios from 'axios'
|
||||
|
||||
async function check () {
|
||||
try {
|
||||
return await axios.get('https://maps.googleapis.com/maps/api/timezone/json?location=39.6034810%2C-119.6822510×tamp=1331161200')
|
||||
return await axios.get('https://maps.googleapis.com/maps/api/timezone/json?location=39.6034810%2C-119.6822510×tamp=1331161200', { timeout: 1000 })
|
||||
} catch (e) {
|
||||
return { status: 404 }
|
||||
}
|
||||
|
||||
@@ -1053,6 +1053,7 @@ const chartRegister = (chartID, gridIndex, deviceNameX, deviceIDX, channelX, dev
|
||||
return label
|
||||
}
|
||||
_chartData[chartID].xAxis[_xAxisIndex].interval = 500 * 1000
|
||||
_chartData[chartID].yAxis[_yAxisIndex].interval = 500
|
||||
} else if (sourceList[0].name === 'Elite') {
|
||||
// _chartData[chartID].series[_chartData[chartID].series.length - 1].sampling = false
|
||||
switch (sourceList[0].channel) {
|
||||
|
||||
@@ -112,7 +112,7 @@ const downloadActs = {
|
||||
/**
|
||||
* set download stream
|
||||
*/
|
||||
[typePath.setStream]: async function ({ state, getters, commit, dispatch }, payload) {
|
||||
[typePath.setStream]: function ({ state, getters, commit, dispatch }, payload) {
|
||||
const downloadInfo = state.downloadInfo
|
||||
|
||||
if (downloadInfo.stream === null) {
|
||||
@@ -129,6 +129,10 @@ const downloadActs = {
|
||||
}
|
||||
},
|
||||
|
||||
[typePath.clearStream]: function ({ state, getters, commit, dispatch }, payload) {
|
||||
state.downloadInfo.stream = null
|
||||
},
|
||||
|
||||
/**
|
||||
* write data
|
||||
*
|
||||
@@ -137,6 +141,7 @@ const downloadActs = {
|
||||
[typePath.writeData]: function ({ state, getters, commit }, payload) {
|
||||
const data = encode(payload.data)
|
||||
data && state.downloadInfo.stream.writer.write(data)
|
||||
delete payload.data
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -154,6 +159,7 @@ const downloadActs = {
|
||||
*/
|
||||
[typePath.saveFile]: function ({ state, getters, commit }, payload) {
|
||||
saveAs(payload.data, state.downloadInfo.filename + '.csv')
|
||||
delete payload.data
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -238,7 +238,6 @@ const exportActs = {
|
||||
[typePath.setHeader]: async function ({ state, getters, commit, dispatch }) {
|
||||
const headerString = await dispatch(typePath.getHeader, {})
|
||||
dispatch(typePathDownload.writeData, { data: headerString })
|
||||
return true
|
||||
},
|
||||
|
||||
[typePath.setTitle]: async function ({ state, getters, commit, dispatch }) {
|
||||
@@ -253,14 +252,12 @@ const exportActs = {
|
||||
} else if (state.downloadInfo.device[0] === 'Elite') {
|
||||
dispatch(typePathDownload.writeData, { data: titleString })
|
||||
}
|
||||
return true
|
||||
},
|
||||
[typePath.setData]: async function ({ state, getters, commit, dispatch }, payload) {
|
||||
const { dataString, dataLength } = await dispatch(typePath.getData, { last: payload.last })
|
||||
|
||||
commit(typePathDownload.deleteBuffer, { dataLength: dataLength })
|
||||
dispatch(typePathDownload.writeData, { data: dataString })
|
||||
return true
|
||||
},
|
||||
|
||||
[typePath.setAll]: async function ({ state, getters, commit, dispatch }, payload) {
|
||||
@@ -271,22 +268,22 @@ const exportActs = {
|
||||
commit(typePathDownload.deleteBuffer, { dataLength: dataLength })
|
||||
const stringArray = []
|
||||
|
||||
if (state.downloadInfo.fomat !== 'csv-edf') {
|
||||
if (state.downloadInfo.format !== 'csv-edf') {
|
||||
stringArray.push(headerString)
|
||||
}
|
||||
|
||||
stringArray.push(channelString)
|
||||
|
||||
if (state.downloadInfo.fomat !== 'csv-edf') {
|
||||
if (state.downloadInfo.format !== 'csv-edf') {
|
||||
stringArray.push(titleString)
|
||||
}
|
||||
stringArray.push(dataString)
|
||||
|
||||
const exportString = new Blob(stringArray)
|
||||
let exportString = new Blob(stringArray)
|
||||
|
||||
dispatch(typePathDownload.saveFile, { data: exportString })
|
||||
|
||||
return true
|
||||
exportString = null
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ const rawActs = {
|
||||
}
|
||||
dispatch(typePath.parseRawData, { channel: channel, idx: idx, rawData: rawDataRes })
|
||||
}
|
||||
return true
|
||||
},
|
||||
|
||||
[typePath.rawSdDataByID]: async ({ state, getters, commit, dispatch }, payload) => {
|
||||
@@ -47,15 +46,14 @@ const rawActs = {
|
||||
* @return {object} : raw data
|
||||
*/
|
||||
[typePath.rawDataByIDs]: async ({ state, getters, commit, dispatch }, payload) => {
|
||||
const { channel, rawDataIDList, api } = payload
|
||||
const rawDataRes = await api.raw.getAttrByIDs(channel, rawDataIDList, 'id-channel-size-serial_number-start_time-end_time-data')
|
||||
const { channel, rawID, idx, api } = payload
|
||||
const rawDataRes = await api.raw.getAttrByIDs(channel, rawID, 'id-channel-size-serial_number-start_time-end_time-data')
|
||||
if (rawDataRes.data !== null) {
|
||||
dispatch(typePath.parseRawData, { rawData: rawDataRes, channel: channel }).then(response => {
|
||||
}).catch(e => {
|
||||
console.log(e)
|
||||
})
|
||||
if (state.downloadInfo.channelInfo[channel].downloadDataBuffer[idx] === undefined) {
|
||||
state.downloadInfo.channelInfo[channel].downloadDataBuffer[idx] = []
|
||||
}
|
||||
dispatch(typePath.parseRawData, { channel: channel, idx: idx, rawData: rawDataRes })
|
||||
}
|
||||
return true
|
||||
},
|
||||
|
||||
[typePath.parseRawData]: function ({ state, getters, commit, dispatch }, payload) {
|
||||
@@ -120,6 +118,7 @@ const rawActs = {
|
||||
|
||||
[typePath.parseData]: function ({ state, getters, commit }, payload) {
|
||||
const { channel, rawData, idx } = payload
|
||||
const dataArray = []
|
||||
const meta = state.metaInfo
|
||||
|
||||
for (let i = 0; i <= rawData.length - 1; i += 2) {
|
||||
@@ -128,12 +127,14 @@ const rawActs = {
|
||||
const data = (channel >= 256 && channel <= 259) ? (rawData[i + 1] / 100).toFixed(3) : rawData[i + 1]
|
||||
|
||||
if (time <= parseInt(meta.time_duration)) {
|
||||
state.downloadInfo.channelInfo[channel].downloadDataBuffer[idx].push([time, data])
|
||||
dataArray.push([time, data])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
state.downloadInfo.channelInfo[channel].downloadDataBuffer[idx].push(...dataArray)
|
||||
dataArray.length = 0
|
||||
delete payload.rawData
|
||||
return true
|
||||
},
|
||||
|
||||
[typePath.parseFixedData]: function ({ state, getters, commit }, payload) {
|
||||
@@ -141,6 +142,7 @@ const rawActs = {
|
||||
const meta = state.metaInfo
|
||||
const downloadInfo = state.downloadInfo
|
||||
const timeInterval = state.downloadInfo.channelInfo[channel].timeInterval
|
||||
const dataArray = []
|
||||
|
||||
for (let i = 0; i <= rawData.length - 1; i += 2) {
|
||||
if (rawData[i].length !== 0) {
|
||||
@@ -161,20 +163,21 @@ const rawActs = {
|
||||
if (timeDiff > 0) {
|
||||
const _time = parseInt(downloadInfo.channelInfo[channel].prevTime) + parseInt(timeCorrection)
|
||||
const _data = (parseInt(downloadInfo.channelInfo[channel].prevData) + (timeCorrection / timeDiffOrigin) * (dataDiff)).toFixed(3)
|
||||
state.downloadInfo.channelInfo[channel].downloadDataBuffer[idx].push([_time, _data])
|
||||
dataArray.push([_time, _data])
|
||||
dataIndex = dataIndex + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
if (time <= parseInt(meta.time_duration) && time !== downloadInfo.channelInfo[channel].prevTime) {
|
||||
state.downloadInfo.channelInfo[channel].downloadDataBuffer[idx].push([time, data])
|
||||
dataArray.push([time, data])
|
||||
}
|
||||
downloadInfo.channelInfo[channel].prevTime = time
|
||||
downloadInfo.channelInfo[channel].prevData = data
|
||||
}
|
||||
}
|
||||
state.downloadInfo.channelInfo[channel].downloadDataBuffer[idx].push(...dataArray)
|
||||
dataArray.length = 0
|
||||
delete payload.rawData
|
||||
return true
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
const types = {
|
||||
download: {
|
||||
setStream: 'setStreamDownload',
|
||||
clearStream: 'clearStreamDownload',
|
||||
writeData: 'writeDataDownload',
|
||||
closeWriter: 'closeWriterDownload',
|
||||
saveFile: 'saveFileDownload',
|
||||
@@ -22,6 +23,7 @@ const types = {
|
||||
},
|
||||
raw: {
|
||||
rawDataByID: 'rawDataByIDRaw',
|
||||
rawDataByIDs: 'rawDataByIDsRaw',
|
||||
rawSdDataByID: 'rawSdDataByIDRaw',
|
||||
parseRawData: 'parseRawDataRaw',
|
||||
parseRawSdData: 'parseRawSdDataRaw',
|
||||
|
||||
Reference in New Issue
Block a user