Compare commits

...

1 Commits

Author SHA1 Message Date
peterlu14 d3610b3430 [fix] elite download 2021-07-12 07:22:16 +08:00
4 changed files with 20 additions and 9 deletions
@@ -166,10 +166,10 @@ export default {
})
}
}
this.createDataStringExport()
this.removeDownloadBufferDownload()
// console.log('end', downloadingFile)
rowIndex += 1
this.createDataStringExport({ lastPartData: (rowIndex === downloadingFile.needRows) })
// this.removeDownloadBufferDownload()
// console.log('end', downloadingFile)
}
this.closeFileStreamExport()
// }
@@ -35,11 +35,12 @@ function getExcleNeedColumns (downloadInfo, excelFormat) {
// estimate 5e5 rows need how many ID
const needRows = (excelFormat) ? parseInt((5e5 / parseInt(rowPerRawData)) + 1) : rowPerRawData
downloadInfo.needRows = needRows
const needRealRows = (needRows > maxIDNums) ? maxIDNums : needRows
downloadInfo.needRows = needRealRows
for (const channelID in meta.raw_data) {
let channelIndex = parseInt(channelID)
const rawDataIDDoubleArray = chunkArray(meta.raw_data[channelID], needRows)
const rawDataIDDoubleArray = chunkArray(meta.raw_data[channelID], needRealRows)
downloadInfo.needColumns = rawDataIDDoubleArray.length
for (const rawDataArray of rawDataIDDoubleArray) {
downloadInfo.downloadIDList[channelIndex] = rawDataArray
@@ -72,6 +73,7 @@ const downloadActs = {
// for (const channel of JSON.parse(downloadInfo.channels)) {
// downloadInfo._downloadBuffer[channel] = []
// }
console.log('downloadInfo.raw_data', downloadInfo.raw_data)
downloadInfo.downloadIDList = JSON.parse(JSON.stringify(downloadInfo.raw_data))
getExcleNeedColumns(downloadInfo, true)
return downloadInfo
@@ -3,6 +3,7 @@ import types from '@/store/modules/file/elite/excel/types'
import golbalMethods from '@/data/global/global'
const typePath = types.export
const typePathDownload = types.download
const NeuliveParameterOrder = ['RECORDING_CH', 'AMP_GAIN', 'ADC_CLOCK']
const NeuliveAmpGain = [100, 400, 800]
@@ -153,7 +154,13 @@ const exportActs = {
let dataLength = 0
for (const channel in data) {
if (data[channel].length > dataLength) {
if (dataLength === undefined) {
dataLength = data[channel].length
}
if (data[channel].length < dataLength && !payload.lastPartData) {
dataLength = data[channel].length
}
if (data[channel].length > dataLength && payload.lastPartData) {
dataLength = data[channel].length
}
}
@@ -174,6 +181,7 @@ const exportActs = {
}
dispatch(typePath.writeDataToFileStream, { data: dataString })
commit(typePathDownload.removeDownloadBuffer, { dataLength: dataLength })
dataString = ''
// return dataString
},
@@ -31,10 +31,11 @@ const downloadMutations = {
* remove download data
*
*/
[typePath.removeDownloadBuffer]: (state) => {
[typePath.removeDownloadBuffer]: (state, payload) => {
for (const channel in state.downloadingFile.downloadBuffer) {
delete state.downloadingFile.downloadBuffer[channel]
state.downloadingFile.downloadBuffer[channel] = []
state.downloadingFile.downloadBuffer[channel].splice(0, payload.dataLength)
// delete state.downloadingFile.downloadBuffer[channel]
// state.downloadingFile.downloadBuffer[channel] = []
}
},
}