Compare commits

...

45 Commits

Author SHA1 Message Date
peterlu14 0958d708d6 -update subject 2023-06-05 12:05:22 +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
peterlu14 c58ec8c907 - fixed download 2023-04-12 14:55:39 +08:00
peterlu14 dcf9d1b98c - fix edit file way
- remove popover message
- remove sd card button
2023-04-11 18:07:00 +08:00
peterlu14 fd4ff2d99d - click outside table unselect all
- fix the select word conflict with shift
- fix delect files page wrong
2023-04-11 17:47:15 +08:00
peterlu14 8bf7a893ae -real time chart unit more flexible
-add source into gridsource
2023-04-11 17:45:35 +08:00
Roy ce4cf4078b [update] up to 8 hstia 2023-04-11 13:12:32 +08:00
peterlu14 cbd45415bd - download selected files 2023-04-10 14:28:26 +08:00
peterlu14 140a564ee7 - create modal for moving folder
- remove check illegal char
- change UI layout
- add hot key to select file ctrl & shift
- fix edit folder name
- fix delete folder inner all files
- fix refs datatable_ref undefined problem
- when selected file the text in table cannot be select
2023-04-07 16:51:46 +08:00
peterlu14 8d24a93f6d -fix checkbox 2023-03-31 11:18:23 +08:00
peterlu14 98135d6ce2 - update file with sorted
- change single click & double click
- fix delete folder
2023-03-31 11:07:22 +08:00
peterlu14 a3ccb942e5 - fix create task 2023-03-25 13:18:41 +08:00
peterlu14 eacc0d9547 - project sort with created time
- new project created time reassign
- copy project created time reassign
- save project (create task, copy task, delete task)
2023-03-25 13:07:46 +08:00
peterlu14 9cc653b761 -auto save ( cycle, device) 2023-03-24 19:22:38 +08:00
peterlu14 0cfc02c939 - reset projecttableselectIndex
- prevent select task null
- fixed parameter is undefined
- fix scheduler change mode reset problem
- auto save
2023-03-24 19:07:42 +08:00
ROY 60252b5cfe [update] update AC_AMP defaultValue of schedule 2023-03-21 16:21:51 +08:00
peterlu14 cc5207ae07 - fix legend name duplicate problem 2023-03-16 17:56:32 +08:00
peterlu14 4ad2b51161 - Elite EDC VOLT_VSCAN to CA_VOLT 2023-03-08 09:37:12 +08:00
ROY 0f32263d12 [update] update bat0.1 and new bat1.0 2023-03-07 18:03:59 +08:00
peterlu14 52db5b818c [update] remove navbar info 2023-02-04 10:56:28 +08:00
peterlu14 507718e3a3 [update] remove trigger battery 2023-01-12 10:04:15 +08:00
peterlu14 1c02ffb934 [update] fix scheduler trigger parameter show & layout 2023-01-10 11:30:00 +08:00
peterlu14 5d594eff06 [update] fix trigger scheduler & todo fix mode select and parameter info 2023-01-09 18:21:50 +08:00
peterlu14 29f7d23d38 [debug] fix delete file working mode error 2023-01-04 15:21:40 +08:00
peterlu14 4d032858a3 [update] trigger add timer 2023-01-03 15:30:03 +08:00
peterlu14 417c4010a9 [update] fix advanced setting 2023-01-03 14:58:48 +08:00
peterlu14 6bf7edad0b [update] recover trigger ui 2023-01-03 14:42:54 +08:00
peterlu14 fafc6620d2 [debug] fix CC Mode csv header wrong information 2022-12-27 11:04:40 +08:00
peterlu14 78d236d9c0 [update] fix scheduler parameter default problem 2022-12-27 11:03:52 +08:00
ROY 6e42dc9333 [update] add debug channel in file 2022-12-07 14:23:19 +08:00
peterlu14 d4d6172645 Merge branch 'dev/scheduler_UI' into dev/test_ac_amp 2022-12-06 16:07:17 +08:00
peterlu14 8685768f42 [update] fix impendance scale & millidegree 2022-12-06 15:58:06 +08:00
peterlu14 8ca0e3fa28 Merge branch 'dev/scheduler_UI' into dev/test_ac_amp 2022-12-06 14:22:32 +08:00
peterlu14 7e61eb6e52 [update] fix phase degree scale error 2022-12-06 14:22:12 +08:00
peterlu14 d16d7b0cb5 Merge branch 'dev/scheduler_UI' into dev/test_ac_amp 2022-12-05 11:57:19 +08:00
ROY d4423503d6 Merge remote-tracking branch 'origin/dev/scheduler_UI' into dev/test_ac_amp 2022-12-02 17:45:35 +08:00
ROY c3f6349c6e [test] print notify_one & notify_two & notify_three 2022-12-01 14:15:12 +08:00
69 changed files with 2724 additions and 869 deletions
@@ -25,12 +25,12 @@
>
<!-- *** icon -->
<!-- <va-icon-vuestic /> -->
<img src='@/assets/img/bps_logo.png'>
<!-- <img src='@/assets/img/bps_logo.png'> -->
</router-link>
</div>
<!-- <img style="height: 40px;" v-bind:src="'https://www.bioproweb.com/wp-content/uploads/2020/01/BPS-LOGO_60.png'"> -->
<div class="app-navbar__center lg5 md4">
<span
<!-- <span
class="app-navbar__text"
:style="{color: this.$themes.gray}"
>
@@ -43,7 +43,7 @@
>
contact@bioproweb.com
</a>
</span>
</span> -->
</div>
<app-navbar-actions
class="app-navbar__actions md5 lg4"
+177 -172
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: 'csv',
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,169 +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()
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: 'csv',
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 () {
},
+1 -1
View File
@@ -68,7 +68,7 @@ export default {
this.$refs.file_ref.currentInfo = initCollection.data[0]
const folders = await api.collection.getByParent('folder', initCollection.data[0].id)
const files = await api.meta.getAttrByParent('folder', initCollection.data[0].id, 'id-path-name-parent-description-size-time_duration-uuid-device-channels-parameter_set-created_at')
const files = await api.meta.getAttrByParent('folder', initCollection.data[0].id, 'id-path-name-parent-description-size-time_duration-uuid-device-channels-parameter_set-created_at-project')
file.updateFileList(folders)
file.updateFileList(files)
+382 -146
View File
@@ -1,5 +1,10 @@
<template>
<div class="file-list">
<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
class="flex sm12 xl12 md12 xs12"
v-model="showModal.createFolder"
@@ -20,7 +25,7 @@
removable
/>
</va-modal>
<!-- Edit File Modal -->
<va-modal
class="flex sm12 xl12 md12 xs12"
v-model="showModal.editFile"
@@ -48,6 +53,7 @@
removable
/>
</va-modal>
<!-- Delete File Modal-->
<va-modal
v-model="showModal.deleteFile"
size="small"
@@ -64,6 +70,7 @@
<p>Delete File {{ deleteInfo.name }} ? <input type="text" :ref="'delete_input'" style="opacity: 0; line-height: 0;"/></p>
</va-modal>
<!-- Delete MultiFiles Modal -->
<va-modal
v-model="showModal.deleteMultiFiles"
size="small"
@@ -81,17 +88,6 @@
</va-modal>
<va-card class="flex sm12 xl12 md12 xs12">
<template slot="header">
<div class="flex sm12 xl12 md12 xs12" style="text-align: end;">
<va-button class="" color="success" v-if="selected.length" @click="downloadSelected" target="_blank" small>
DOWNLOAD
</va-button>
<va-button class="" color="danger" v-if="selected.length" @click="deleteMultiFilesConfirm" target="_blank" small>
DELETE
</va-button>
</div>
</template>
<!-- SearchField & perPageSelect-->
<div class="row align--center">
<div class="flex xs12 md6">
@@ -116,32 +112,46 @@
</div>
<!-- CreateFolder & FilePath -->
<div class="flex mb-4">
<va-icon
name="fa fa-plus"
size="1rem"
class="mr-2"
style="cursor: pointer;"
:color="'primary'"
@click.native="createFolderConfirm"
/>
<va-icon
name="fa fa-folder-open"
size="0.9rem"
class="mr-2"
style="cursor: pointer;"
:color="(currentPathIndex === -1)?'primary':'dark'"
@click.native="openHome"
/>
<span
class="mt-0 mb-0 mr-2"
v-for="(item, index) in pathLists" :key="index"
:style="{ color:(currentPathIndex === index)?'#6c7fee':'#34495e', cursor:'pointer'}"
@click="openPath(item,index)"
>
<span class="mr-1" style="color: #34495e; cursor: default;">/</span>
{{ item.name }}
</span>
<div class="row">
<div class="flex d-flex xl8 lg8 sm8 xs8" style="align-items: center;">
<div>
<va-icon
name="fa fa-plus"
size="1rem"
class="mr-2"
style="cursor: pointer;"
:color="'primary'"
@click.native="createFolderConfirm"
/>
<va-icon
name="fa fa-folder-open"
size="0.9rem"
class="mr-2"
style="cursor: pointer;"
:color="(currentPathIndex === -1)?'primary':'dark'"
/>
<span
class="mt-0 mb-0 mr-2"
v-for="(item, index) in pathLists" :key="index"
:style="{ color:(currentPathIndex === index)?'#6c7fee':'#34495e', cursor:'pointer'}"
@click="openPath(item,index)"
>
<span class="mr-1" style="color: #34495e; cursor: default;">/</span>
{{ item.name }}
</span>
</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>
MOVE
</va-button>
<va-button class="" color="success" v-if="selected.length" @mousedown.stop="downloadSelected" target="_blank" small>
DOWNLOAD
</va-button>
<va-button class="" color="danger" v-if="selected.length" @mousedown.stop="deleteMultiFilesConfirm" target="_blank" small>
DELETE
</va-button>
</div>
</div>
<!-- FileListTable -->
@@ -160,14 +170,16 @@
:fields="fields"
:data="filteredData"
:per-page="parseInt(perPage)"
@row-clicked="openFile"
@row-clicked="clickRow"
@mouseup.native="mouseUp"
@mousedown.native.stop="mouseDown"
hoverable
clickable
v-else
:ref="'datatable_ref'"
v-else
>
<template slot="select" slot-scope="props">
<va-checkbox :value="props.rowData.checked" @input="select(props.rowData)"/>
<va-checkbox :value="props.rowData.checked"/>
</template>
<template slot="name" slot-scope="props">
<va-icon
@@ -180,7 +192,7 @@
{{ props.rowData.name }}
</template>
<template slot="parameter_set" slot-scope="props">
{{ getWorkingMode(props.rowData) }}
{{ getWorkingMode(props.rowData.device, props.rowData.parameter_set) }}
</template>
<template slot="created_at" slot-scope="props">
{{transDate(props.rowData.created_at)}}
@@ -195,7 +207,7 @@
{{transDeviceInfo(props.rowData.device)}}
</template>
<template slot="actions" slot-scope="props" >
<va-popover :message="`sdcard ${props.rowData.name}`" placement="top">
<!-- <va-popover :message="`sdcard ${props.rowData.name}`" placement="top">
<sd-card-button
v-if="(props.rowData.type !== 'folder') && (props.rowData.device.library_name.indexOf('Neulive') >= 0) && (props.rowData.sd_data_record === true)"
:meta="props.rowData"
@@ -204,26 +216,26 @@
@refreshPage="refreshPage"
@downloadSdCard="downloadSdCard"
/>
</va-popover>
<va-popover :message="`download ${props.rowData.name} in csv format`" placement="top">
</va-popover> -->
<va-popover :message="`Download csv`" 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-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 :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="newDownload(props.rowData)"/>
</va-popover>
<va-popover :message="`download ${props.rowData.name} in csv-edf format`" placement="top">
<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)"/>
</va-popover>
<va-popover :message="`replay ${props.rowData.name}`" placement="top">
<va-popover :message="`Replay`" 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>
<va-popover :message="`spike ${props.rowData.name}`" placement="top">
<va-popover :message="`Spike`" placement="top">
<va-button flat small color="gray" icon="fa fa-filter" v-if="props.rowData.type !== 'folder' && props.rowData.device.library_name.indexOf('Neulive') >= 0" @click.stop="spike(props.rowData)"/>
</va-popover>
<va-popover :message="`edit ${props.rowData.name}`" placement="top">
<va-popover :message="`Edit`" placement="top">
<va-button flat small color="gray" icon="fa fa-pencil" @click.stop="editFileConfirm(props.rowData)"/>
</va-popover>
<va-popover :message="`delete ${props.rowData.name}`" placement="top">
<va-popover :message="`Delete`" placement="top">
<va-button flat small color="gray" icon="fa fa-trash" @click.stop="deleteFileConfirm(props.rowData)"/>
</va-popover>
</template>
@@ -237,19 +249,25 @@ import { debounce } from 'lodash'
import { file } from '../../../data/file/File'
import { FulfillingBouncingCircleSpinner } from 'epic-spinners'
import api from '../../../data/api/index'
import SdCardButton from '../sdcard/SdCardButton.vue'
// 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',
components: {
FulfillingBouncingCircleSpinner,
SdCardButton,
// SdCardButton,
FolderModal,
Download,
DownloadOffline,
},
data () {
return {
term: null,
perPage: '80',
perPage: '40',
perPageOptions: ['20', '40', '80', '160'],
fileLists: [],
@@ -286,6 +304,7 @@ export default {
path: '',
name: '',
metaID: '',
project: null,
},
styleList: {
@@ -296,6 +315,18 @@ export default {
},
SDuuidList: [],
controllerList: [],
// mouse click times
clickCounter: 0,
// record the selected index
clickRecord: [],
// record the target
clickTarget: null,
// mouseup or not
clickStatus: false,
// record shift+click target
shiftIndexRecord: null,
downloadIDList: [],
}
},
computed: {
@@ -372,6 +403,9 @@ export default {
}
})
},
selectedNumber () {
return this.fileLists.filter(file => file.checked).length
},
selected () {
return this.fileLists.filter(file => file.checked)
},
@@ -380,20 +414,28 @@ export default {
mqttPub: function (topic, mes) {
this.$mqtt.publish(topic, mes)
},
// stopEvent: function (e) {
// console.log(e)
// e.stopPropagation()
// },
select: function (file) {
event.stopPropagation()
const idx = this.fileLists.findIndex(f => f.id === file.id)
showFolderModal: async function () {
this.$refs.folder_modal_ref.selected = this.selected
await this.$refs.folder_modal_ref.refreshCollection()
this.$refs.folder_modal_ref.showModal = true
},
unSelectAll: function () {
this.fileLists.forEach(element => {
element.checked = false
})
},
selectConcat: function (idx) {
this.fileLists[idx].checked = !this.fileLists[idx].checked
},
select: function (idx) {
this.unSelectAll()
this.fileLists[idx].checked = true
},
search: debounce(function (term) {
this.term = term
}, 400),
transFileSize: function (fileSize) {
if (fileSize === undefined) {
if (fileSize === undefined || fileSize === -1) {
return '--'
} else {
return this.GLOBAL.transFileSize(fileSize)
@@ -416,7 +458,97 @@ export default {
return device.device_name + '\n' + this.GLOBAL.transMac(device.device_address)
}
},
clickRow: async function (rowData) {
if (window.getSelection().toString() !== '' && this.clickEvent.shiftKey === false) 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) {
// meta key or ctrl key
if (this.clickEvent.metaKey === true || this.clickEvent.ctrlKey === true) {
this.selectConcat(idx)
if (this.clickRecord.includes(idx) === false) {
this.clickRecord.push(idx)
}
this.shiftIndexRecord = null
} else if (this.clickEvent.shiftKey === true) {
// shift key
const start = this.clickRecord[this.clickRecord.length - 1]
const end = idx
// if has shift event has trigger before then reset the checked
if (this.shiftIndexRecord !== null) {
if (start > this.shiftIndexRecord) {
for (let i = start; i >= this.shiftIndexRecord; i--) {
this.fileLists[i].checked = false
}
}
if (start < this.shiftIndexRecord) {
for (let i = start; i <= this.shiftIndexRecord; i++) {
this.fileLists[i].checked = false
}
}
}
if (start > end) {
for (let i = start; i >= end; i--) {
this.fileLists[i].checked = true
}
}
if (start < end) {
for (let i = start; i <= end; i++) {
this.fileLists[i].checked = true
}
}
this.shiftIndexRecord = idx
} else {
// without any hotKey
this.shiftIndexRecord = null
this.clickRecord.length = 0
this.selectConcat(idx)
if (this.clickRecord.includes(idx) === false) {
this.clickRecord.push(idx)
}
}
timeOutTimer = setTimeout(() => {
this.clickCounter = 0
}, 300)
} else if (this.clickCounter === 2) {
clearTimeout(timeOutTimer)
this.clickCounter = 0
await this.openFile(rowData)
}
}, 0)
},
mouseDown: async function (e) {
this.clickEvent = e
this.clickStatus = true
},
mouseUp: function () {
this.clickStatus = false
},
mouseMove: async function (e, rowData) {
const idx = this.fileLists.findIndex(f => f.id === rowData.id)
if (e.metaKey === true || e.ctrlKey === true) {
if (this.clickStatus === true) {
const indexOfRecord = this.clickRecord.indexOf(idx)
// if (indexOfRecord === this.clickRecord.length - 1) return
// console.log('indexOfRecord', indexOfRecord)
if (indexOfRecord !== -1) {
console.log(idx, 'false')
this.clickRecord.splice(indexOfRecord, 1)
this.fileLists[idx].checked = false
} else {
console.log(idx, 'true')
this.clickRecord.push(idx)
this.fileLists[idx].checked = true
}
}
}
},
openFile: async function (info) {
if (info.type === 'folder') {
this.currentInfo = info
@@ -428,7 +560,7 @@ export default {
// call getfolder api and update
const folders = await api.collection.getByParent('folder', info.id)
const files = await api.meta.getAttrByParent('folder', info.id, 'id-path-name-parent-description-size-time_duration-uuid-device-channels-parameter_set-created_at')
const files = await api.meta.getAttrByParent('folder', info.id, 'id-path-name-parent-description-size-time_duration-uuid-device-channels-parameter_set-created_at-project')
file.updateFileList(folders)
file.updateFileList(files)
@@ -448,7 +580,7 @@ export default {
this.currentInfo = item
// call getfolder api and update
const folders = await api.collection.getByParent('folder', item.id)
const files = await api.meta.getAttrByParent('folder', item.id, 'id-path-name-parent-description-size-time_duration-uuid-device-channels-parameter_set-created_at')
const files = await api.meta.getAttrByParent('folder', item.id, 'id-path-name-parent-description-size-time_duration-uuid-device-channels-parameter_set-created_at-project')
file.updateFileList(folders)
file.updateFileList(files)
@@ -469,7 +601,7 @@ export default {
if (initCollection.data.length === 1) {
this.currentInfo = initCollection.data[0]
const folders = await api.collection.getByParent('folder', initCollection.data[0].id)
const files = await api.meta.getAttrByParent('folder', initCollection.data[0].id, 'id-path-name-parent-description-size-time_duration-uuid-device-channels-parameter_set-created_at')
const files = await api.meta.getAttrByParent('folder', initCollection.data[0].id, 'id-path-name-parent-description-size-time_duration-uuid-device-channels-parameter_set-created_at-project')
file.updateFileList(folders)
file.updateFileList(files)
this.fileLists = file.getFileList()
@@ -529,56 +661,67 @@ export default {
}, 100)
},
editFile: async function () {
// TODO editFile
if (this.editInfo.type !== 'folder') {
await api.meta.update(this.editInfo.info.id, { name: this.editInfo.changedName })
} else {
}
await this.editFileDone()
},
checkFileNameValidate: debounce(function (term) {
const illegalChar = term.match(/[^(\w\-)]+/gm)
this.editInfo.changedName = term
if (term.length === 0) {
// input text empty
this.editInfo.error = true
this.editInfo.success = false
this.editInfo.errorMessages.pop()
this.editInfo.errorMessages.push(this.editInfo.errorMessagesAll[1])
} else if (illegalChar !== null) {
// input text illegal
this.editInfo.error = true
this.editInfo.success = false
this.editInfo.errorMessages.pop()
this.editInfo.errorMessages.push(this.editInfo.errorMessagesAll[0] + ' ' + illegalChar[0])
} else {
const existedFile = this.fileLists.filter((file) => {
if (file.name != null) {
return file.name.replace('/', '') === term
} else {
return false
}
})
if (existedFile.length === 0) {
this.editInfo.error = false
this.editInfo.success = true
} else {
// file name exist
this.editInfo.error = true
this.editInfo.success = false
this.editInfo.errorMessages.pop()
this.editInfo.errorMessages.push(this.editInfo.errorMessagesAll[2])
}
}
}, 200),
editFileDone: async function () {
const tmpCurrentPage = this.$refs.datatable_ref.currentPage
await this.refreshPage()
this.$refs.datatable_ref.currentPage = tmpCurrentPage
this.$refs.datatable_ref.inputPage(tmpCurrentPage)
this.showToast(`${this.editInfo.info.name} -> ${this.editInfo.changedName}`, {
position: 'bottom-right',
})
// TODO editFile
if (this.editInfo.info.type === 'folder') {
await api.collection.update(this.editInfo.info.id, { name: this.editInfo.changedName })
const folder = this.fileLists.find((file) => {
if (file.type === 'folder' && this.editInfo.info.id === file.id) return true
})
folder.name = this.editInfo.changedName
} else {
await api.meta.update(this.editInfo.info.id, { name: this.editInfo.changedName })
const meta = this.fileLists.find((file) => {
if (file.type === undefined && this.editInfo.info.id === file.id) return true
})
meta.name = this.editInfo.changedName
}
// await this.editFileDone()
},
checkFileNameValidate: debounce(function (term) {
// const illegalChar = term.match(/[^(\w\-)]+/gm)
this.editInfo.changedName = term
// if (term.length === 0) {
// // input text empty
// this.editInfo.error = true
// this.editInfo.success = false
// this.editInfo.errorMessages.pop()
// this.editInfo.errorMessages.push(this.editInfo.errorMessagesAll[1])
// } else if (illegalChar !== null) {
// // input text illegal
// this.editInfo.error = true
// this.editInfo.success = false
// this.editInfo.errorMessages.pop()
// this.editInfo.errorMessages.push(this.editInfo.errorMessagesAll[0] + ' ' + illegalChar[0])
// } else {
// const existedFile = this.fileLists.filter((file) => {
// if (file.name != null) {
// return file.name.replace('/', '') === term
// } else {
// return false
// }
// })
// if (existedFile.length === 0) {
// this.editInfo.error = false
// this.editInfo.success = true
// } else {
// // file name exist
// this.editInfo.error = true
// this.editInfo.success = false
// this.editInfo.errorMessages.pop()
// this.editInfo.errorMessages.push(this.editInfo.errorMessagesAll[2])
// }
// }
}, 200),
editFileDone: async function () {
// const tmpCurrentPage = this.$refs.datatable_ref.currentPage
// await this.refreshPage()
// if (this.$refs.datatable_ref) {
// this.$refs.datatable_ref.currentPage = tmpCurrentPage
// this.$refs.datatable_ref.inputPage(tmpCurrentPage)
// }
},
undoEdit: function () {
this.editInfo.success = false
@@ -590,22 +733,43 @@ export default {
removeFileFromList: function () {
},
fillDeleteInfo: function (info) {
console.log('info', info)
if (info.type === 'folder') {
this.deleteInfo.metaID = undefined
this.deleteInfo.folderID = info.id
this.deleteInfo.name = info.name
this.deleteInfo.project = undefined
} else {
this.deleteInfo.path = info.path
this.deleteInfo.name = info.name
this.deleteInfo.metaID = info.id
this.deleteInfo.project = info.project
}
},
deleteFolder: async function (id) {
await api.collection.update(id, { deleted: true })
const childrenCollection = await api.collection.getByParent('folder', id)
const childrenMeta = await api.meta.getByParent('folder', id)
for (const collection of childrenCollection.data) {
await this.deleteFolder(collection.id)
}
for (const meta of childrenMeta.data) {
this.deleteInfo.project = meta.project
await this.deleteSingleFileByDeleteInfo(meta.id)
}
await api.collection.clearDel()
},
deleteSingleFileByDeleteInfo: async function () {
await api.meta.update(this.deleteInfo.metaID, { deleted: true })
deleteSingleFileByDeleteInfo: async function (metaID) {
if (metaID === undefined) metaID = this.deleteInfo.metaID
const subjectResponse = await api.subjectData.get({ meta: this.deleteInfo.project })
console.log('subject id', this.deleteInfo.project, subjectResponse.data)
if (subjectResponse.status === 200) {
for (const subject of subjectResponse.data) {
await api.subjectData.update(subject.id, { deleted: true })
await api.subjectData.clearDel()
}
}
await api.meta.update(metaID, { deleted: true })
await api.meta.clearDel()
},
deleteFileConfirm: function (info) {
@@ -629,10 +793,23 @@ export default {
deleteFileDone: async function () {
const tmpCurrentPage = this.$refs.datatable_ref.currentPage
// rebuild table
this.fileLists = this.fileLists.filter(file => file.name !== this.deleteInfo.name)
await this.refreshPage()
this.$refs.datatable_ref.currentPage = tmpCurrentPage
this.$refs.datatable_ref.inputPage(tmpCurrentPage)
if (this.deleteInfo.metaID) {
this.fileLists = this.fileLists.filter(file => {
return file.id !== this.deleteInfo.metaID
})
}
if (this.deleteInfo.folderID) {
this.fileLists = this.fileLists.filter(file => {
if (file.type === 'folder') {
return file.id !== this.deleteInfo.folderID
}
return true
})
}
// await this.refreshPage()
await this.$refs.datatable_ref.inputPage(1)
await this.$refs.datatable_ref.inputPage(tmpCurrentPage)
// this.$refs.datatable_ref.inputPage(tmpCurrentPage)
// this.loadingFiles = false
this.showToast(`deleted ${this.deleteInfo.name}`, {
position: 'bottom-right',
@@ -648,7 +825,7 @@ export default {
this.showToast('deleting file...', {
position: 'bottom-right',
})
this.deleteSelected()
await this.deleteSelected()
},
inputFieldReset: function (info) {
info.name = ''
@@ -676,7 +853,7 @@ export default {
// call getfolder api and update
const folders = await api.collection.getByParent('folder', this.currentInfo.id)
const files = await api.meta.getAttrByParent('folder', this.currentInfo.id, 'id-path-name-parent-description-size-time_duration-uuid-device-channels-created_at')
const files = await api.meta.getAttrByParent('folder', this.currentInfo.id, 'id-path-name-parent-description-size-time_duration-uuid-device-channels-parameter_set-created_at-project')
file.updateFileList(folders)
file.updateFileList(files)
@@ -686,25 +863,67 @@ export default {
// this.$refs.datatable_ref.refresh()
// this.$refs.datatable_ref.currentPage = 1
},
downloadSelected: function () {
for (let i = 0; i < this.selected.length; i++) {
const meta = this.selected[i]
this.downloadExcel(meta)
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)
}
},
async deleteSelected () {
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 () {
for (let i = 0; i < this.selected.length; i++) {
const meta = this.selected[i]
this.fillDeleteInfo(meta)
await this.deleteSingleFileByDeleteInfo()
if (this.deleteInfo.metaID === undefined) {
await this.deleteFolder(this.deleteInfo.folderID)
} else {
await this.deleteSingleFileByDeleteInfo()
}
this.showToast(`deleted ${this.deleteInfo.name}`, {
position: 'bottom-right',
})
}
const tmpCurrentPage = this.$refs.datatable_ref.currentPage
await this.refreshPage()
this.$refs.datatable_ref.currentPage = tmpCurrentPage
this.$refs.datatable_ref.inputPage(tmpCurrentPage)
// filter the checked files
this.fileLists = this.fileLists.filter((file) => { return file.checked === false })
await this.$refs.datatable_ref.inputPage(1)
await this.$refs.datatable_ref.inputPage(tmpCurrentPage)
},
downloadCsv: async function (meta) {
const href = location.href.split('/')[2]
@@ -716,20 +935,26 @@ export default {
}
},
downloadExcel: async function (meta) {
this.downloadIDList.length = 0
const href = location.href.split('/')[2]
const connectCheck = await api.connection.check()
if (meta.device.library_name.indexOf('Elite') >= 0) {
if (connectCheck.status === 200) {
window.open('http://' + href + '/#/download/online/excel/' + meta.id)
} else {
window.open('http://' + href + '/#/download/offline/excel/' + meta.id)
}
} else if (meta.device.library_name.indexOf('Neulive') >= 0) {
if (connectCheck.status === 200) {
window.open('http://' + href + '/#/download/online/csv-edf/' + meta.id)
} else {
window.open('http://' + href + '/#/download/offline/csv-edf/' + meta.id)
let metaID = ''
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)
}
}
} else {
this.downloadIDList.push(meta.id)
}
metaID = this.downloadIDList.join('-')
if (connectCheck.status === 200) {
window.open('http://' + href + '/#/download/online/excel/' + metaID)
} else {
window.open('http://' + href + '/#/download/offline/excel/' + metaID)
}
},
downloadSdCard: async function (meta) {
@@ -774,11 +999,14 @@ export default {
})
}
},
getWorkingMode: function (rowData) {
getWorkingMode: function (device, parameterSet) {
try {
if (rowData.type === 'folder') return ''
return configTable.getModeConfig(rowData.device.library_name, rowData.parameter_set.MODE).name
} catch {
if (parameterSet) {
return configTable.getModeConfig(device.library_name, parameterSet.MODE).name
}
return ''
} catch (e) {
console.log('e', e)
return ''
}
},
@@ -787,8 +1015,16 @@ export default {
const controllerList = await api.controller.getAll()
this.controllerList = controllerList.data
this.getSDuuidList()
window.addEventListener('keypress', (e) => {
this.keyboardEvent = e
})
},
destroyed () {
},
}
</script>
<style>
.text-not-select {
user-select: none;
}
</style>
@@ -0,0 +1,101 @@
<template>
<va-modal
class="flex sm12 xl12 md12 xs12"
v-model="showModal"
size="small"
:title="'MOVE'"
:okText=" $t('modal.confirm') "
@ok="moveFolder()"
@cancel="cancel()"
>
<div class="row flex sm12 xl12 md12 xs12">
<va-select
v-model="destination"
:options="option"
class="va-select-without-margin"
searchable
/>
</div>
</va-modal>
</template>
<script>
import api from '@/data/api/index'
export default {
name: 'aaa',
data: () => {
return {
showModal: false,
option: [],
destination: '',
selected: [],
}
},
methods: {
cancel: function () {
this.destination = ''
this.selected = []
},
refreshCollection: async function () {
await this.getAllCollection()
},
moveFolder: async function () {
for (const e of this.selected) {
if (e.type === 'folder') {
await api.collection.update(e.id, {
parent: {
folder: [this.destination.id],
},
})
}
if (e.type === undefined) {
await api.meta.update(e.id, {
parent: {
folder: [this.destination.id],
},
})
}
}
this.cancel()
this.$emit('refreshPage')
},
getAllCollection: async function () {
// get all collections by api
const collectionResponse = await api.collection.getAll()
// filter the root folder & select folder itself
const allCollection = collectionResponse.data.filter((ele) => {
return ele.name !== 'root' && this.selected.findIndex(v => v.id === ele.id && v.type === 'folder') === -1
})
// create a new list of collection contain text for display
const newCollection = allCollection.map((ele) => {
let parentName = ''
// if has parent
if (Object.keys(ele.parent).length > 0) {
// get parent name
for (const id of ele.parent.folder) {
const parent = allCollection.find((v) => {
return v.id === id
})
if (parent) {
parentName = parent.name
}
}
}
// if parent name is admin then the name is remain origin
if (ele.name === 'admin' || parentName === 'admin') {
ele.text = ele.name
} else {
// if not the name contain it's parent
ele.text = parentName + ' / ' + ele.name
}
return ele
})
this.option = newCollection
},
},
mounted () {
},
}
</script>
<style></style>
+4 -8
View File
@@ -15,6 +15,7 @@
:mask-color="'rgba(0, 0, 0, 0)'"
:visible.sync="taskViewPanel.show"
:title="(taskViewPanel.type === 1) ? 'Device' : (taskViewPanel.type === 3) ? 'Condition' : (taskViewPanel.type === 4) ? 'Parameter' : ''"
@closed="onClosing"
resizable
>
<project-task/>
@@ -100,6 +101,9 @@ export default {
},
},
methods: {
onClosing: async function () {
await this.saveProject(this.getSelectProject)
},
pageToast: function (mes) {
this.showToast(
mes,
@@ -163,14 +167,6 @@ export default {
},
saveProject: async function (project) {
this.updateProject({ project: project, api: this.API })
this.showToast(
'project update finish',
{
icon: 'fa-bell',
position: 'bottom-right',
duration: 5000,
},
)
},
detect: async function (device) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
@@ -40,13 +40,20 @@ export default {
},
computed: {
configList () {
if (this.filterText === '') return this.projectConfigList
return this.projectConfigList.filter(ele => ele.name.includes(this.filterText))
const projectList = this.projectConfigList
projectList.sort((a, b) => {
const date1 = new Date(a.created_at).getTime()
const date2 = new Date(b.created_at).getTime()
return date2 - date1
})
if (this.filterText === '') return projectList
return projectList.filter(ele => ele.name.includes(this.filterText))
},
...mapFields('project', [
'projectConfigList',
'projectSelectIndex',
'projectTableSelectIndex',
]),
},
data () {
@@ -83,6 +90,7 @@ export default {
select: function (index) {
this.selectProjectIndex = index
this.selectDeleteIndex = -1
this.projectTableSelectIndex = -1
this.selectProject({ index: index })
},
@@ -61,7 +61,10 @@ export default {
},
taskDevice () {
return this.getSelectTask.device
if (this.getSelectTask.device) {
return this.getSelectTask.device
}
return null
},
...mapGetters('project', [
types.project.getSelect,
@@ -6,6 +6,7 @@
:parameter="parameter"
:library="library"
:place="'scheduler'"
:resetParameterModeChange="true"
@setParameter="setParameter"
@setParameterWithDebounce="setParameterWithDebounce"
/>
@@ -66,7 +67,8 @@ export default {
condition.select = !condition.select
},
setParameter: function (name, value) {
this.parameter = Object.assign({}, this.parameter)
// this.parameter = Object.assign({}, this.parameter)
this.parameter[name] = value
if (this.parameterUUID === '') {
this.parameterUUID = this.GLOBAL.getUUID()
@@ -105,7 +107,7 @@ export default {
this.parameterUUID = Object.keys(parameterSet)[0]
const param = Object.values(parameterSet)[0]
const modeOption = this.$refs.device_parameter_ref.workingModeOptions.find(ele => ele.id === param.MODE)
this.$refs.device_parameter_ref.workingModeSelectChange(modeOption)
this.$refs.device_parameter_ref.workingModeSelectChange(modeOption, false)
this.parameter = Object.assign(this.parameter, Object.values(parameterSet)[0])
} else {
const defaultMode = this.config.MODE_OPTIONS.find(ele => ele.description === 'Idle')
+1 -1
View File
@@ -13,7 +13,7 @@
</div>
<div v-else>
<project-menu @detect="detect" @save_project="save"/>
<project-table/>
<project-table @save="save"/>
<div align="right" v-if="lockMode === false">
<button class="project-start-btn" @click="start">
<div>
@@ -1,7 +1,9 @@
<template>
<div>
<project-device @showDeviceModal="showDeviceModal" @save="saveProject"></project-device>
<project-subject @showSubjectModal="showSubjectModal"></project-subject>
<div class="flex d-flex sm12 xs12 md6 xl4 px-0">
<add-task/>
<add-task @save="saveProject"/>
<div>
<button class="add-cycle-btn" @click="showCycleModal">
<div class="add-cycle-text">
@@ -10,23 +12,29 @@
</button>
</div>
<div>
<button class="copy-project-btn" @click="copyTask({ project: getSelectProject, index: projectTableSelectIndex})">
<button class="copy-project-btn" @click="() => {
copyTask({ project: getSelectProject, index: projectTableSelectIndex})
saveProject()
}">
<img class="img-vertical-center" src="@/assets/img/project/copy.svg">
</button>
</div>
<div>
<button class="copy-project-btn" @click="saveProject">
<button class="copy-project-btn" @click="saveProject(true)">
<img class="img-vertical-center" src="@/assets/img/project/save.svg">
</button>
</div>
<div>
<button class="copy-project-btn" @click="deleteTask({ project: getSelectProject, index: projectTableSelectIndex})">
<button class="copy-project-btn" @click="() => {
deleteTask({ project: getSelectProject, index: projectTableSelectIndex})
saveProject()
}">
<img class="img-vertical-center" src="@/assets/img/project/delete.svg">
</button>
</div>
</div>
<project-device @showDeviceModal="showDeviceModal"></project-device>
<new-device-modal ref="device_modal_ref" @detect="detect"></new-device-modal>
<subject-modal ref="subject_modal_ref" @save="saveSubject" @remove="removeSubject"></subject-modal>
<new-device-modal ref="device_modal_ref" @detect="detect" @save="saveProject"></new-device-modal>
<cycle-modal ref="cycle_modal_ref" @createCycle="createCycle"></cycle-modal>
</div>
</template>
@@ -36,7 +44,9 @@
import AddTask from '@/components/project/view/menu/components/AddTask'
// import AddDevice from '@/components/project/view/menu/components/AddDevice'
import ProjectDevice from '@/components/project/view/menu/components/ProjectDevice'
import ProjectSubject from '@/components/project/view/menu/components/ProjectSubject'
import NewDeviceModal from '@/components/project/view/menu/components/NewDeviceModal'
import SubjectModal from '@/components/project/view/menu/components/SubjectModal'
import CycleModal from '@/components/project/view/menu/components/CycleModal'
import { mapFields } from 'vuex-map-fields'
import { mapActions, mapGetters } from 'vuex'
@@ -50,6 +60,8 @@ export default {
ProjectDevice,
NewDeviceModal,
CycleModal,
ProjectSubject,
SubjectModal,
},
computed: {
...mapGetters('project', [
@@ -75,6 +87,10 @@ export default {
this.$refs.device_modal_ref.show()
this.$refs.device_modal_ref.initSetting(key, device)
},
showSubjectModal: function (subject) {
this.$refs.subject_modal_ref.show()
this.$refs.subject_modal_ref.initSetting(subject)
},
createCycle: function (cycleInfo) {
this.createCycleTask({ cycleInfo: cycleInfo })
},
@@ -82,9 +98,34 @@ export default {
this.$refs.cycle_modal_ref.show()
this.$refs.cycle_modal_ref.reset()
},
saveProject: function () {
saveProject: function (showMessage = false) {
if (showMessage === true) {
this.showToast(
'project update finish',
{
icon: 'fa-bell',
position: 'bottom-right',
duration: 5000,
},
)
}
this.$emit('save_project', this.getSelectProject)
},
saveSubject: function (subject) {
if (this.getSelectProject.subject === undefined) this.getSelectProject.subject = []
if (this.getSelectProject.subject.findIndex((ele) => ele.id === subject.id) >= 0) return
this.getSelectProject.subject.push(subject)
this.saveProject()
},
removeSubject: function (subject) {
if (this.getSelectProject.subject === undefined) this.getSelectProject.subject = []
const subjexIndex = this.getSelectProject.subject.findIndex((ele) => ele.id === subject.id)
if (subjexIndex >= 0) {
this.getSelectProject.subject.splice(subjexIndex, 1)
}
this.saveProject()
},
...mapActions('project',
[
@@ -1,6 +1,9 @@
<template>
<div>
<button class="add-task-btn" @click="createTask">
<button class="add-task-btn" @click="() => {
createTask()
save()
}">
<div class="add-task-text">
<p>Add Task</p>
</div>
@@ -22,13 +25,12 @@ export default {
}
},
methods: {
save: function () {
this.$emit('save')
},
...mapActions('project',
[
types.task.init,
types.task.create,
types.task.save,
types.task.delete,
types.task.select,
],
),
},
@@ -135,7 +135,6 @@ export default {
this.showModal = false
},
createCycle: async function () {
this.showModal = false
const project = this.getSelectProject
if (Object.keys(this.cycleInfo).length === 0) {
this.$emit('createCycle', this.task)
@@ -182,7 +181,8 @@ export default {
await this.swapTask({ project: project, originIndex: originEndIndex, newIndex: newEndIndex + 1 })
}
}
this.$emit('save')
this.showModal = false
return true
},
removeCycle: async function () {
@@ -199,6 +199,7 @@ export default {
const originEndIndex = await this.getIndexTask({ project: project, uuid: this.cycleInfo.range[1] })
await this.deleteTask({ project: project, index: originEndIndex })
this.$emit('save')
this.showModal = false
return true
},
@@ -101,10 +101,12 @@ export default {
if (this.deviceList[this.deviceSelect]) {
this.device.pair = this.deviceList[this.deviceSelect].macAddress
}
this.$emit('save')
this.hide()
},
removeDevice: function () {
this.deleteDeviceProject({ deviceKey: this.key })
this.$emit('save')
this.hide()
},
getDeviceList: async function (device) {
@@ -92,6 +92,7 @@ export default {
pairStatus: 1,
order: this.getDeviceMaxOrderProject,
})
this.$emit('save')
return true
},
clickShowDevice: async function (library) {
@@ -103,6 +104,7 @@ export default {
pairStatus: 0,
order: this.getDeviceMaxOrderProject,
})
this.$emit('save')
return false
},
cancelSelectDevice: function () {
@@ -113,6 +115,7 @@ export default {
},
deleteDevice: function (deviceIndex) {
this.deleteDeviceProject({ index: deviceIndex })
this.$emit('save')
},
handleMove (e) {
const { index, futureIndex } = e.draggedContext
@@ -131,6 +134,7 @@ export default {
deviceList[keyOld][key] = deviceListTemp[this.futureIndex][1][key]
deviceList[keyNew][key] = deviceListTemp[this.index][1][key]
}
this.$emit('save')
},
...mapActions('project',
[
@@ -0,0 +1,196 @@
<template>
<div class="flex d-flex sm12 xs12 md12 xl12 pa-0" style="align-items: center; margin-left: 0.6rem; margin-top: -12px;">
<!-- header -->
<div class="flex sm3 xs3 md3 xl1 px-0 project-device-header-text">
<p>Subject</p>
</div>
<!-- device list -->
<div class="flex d-flex">
<draggable class="d-flex" :list="subjectList">
<!-- devices -->
<div class="mr-2" v-for="(subject, index) in subjectList" :key="index">
<!-- <button :class="device[1].pairStatus === 1 ? 'pair-button mr-2' : 'not-pair-button mr-2'" @click="showDeviceModal(device[0], device[1])"> -->
<button class="pair-button mr-2" @click="showSubjectModal(subject)">
<span class="pair-button-text">{{ subject.name }}</span>
</button>
</div>
<!-- append device -->
<div>
<button class="add-button" icon="fa fa-plus" @click="showSubjectModal"><span class="add-button-text">+</span></button>
</div>
</draggable>
</div>
</div>
</template>
<script>
import { mapFields } from 'vuex-map-fields'
import { mapActions, mapGetters } from 'vuex'
import types from '@/store/modules/project/types'
import draggable from 'vuedraggable'
export default {
name: 'project-subject',
components: {
draggable,
},
computed: {
subjectList () {
return this.getSelectProject.subject
},
...mapGetters('project', [
types.project.getSelect,
types.project.getDeviceShowName,
types.project.getDeviceMaxOrder,
]),
...mapFields('project', [
'projectLibrary',
'projectSelectIndex',
]),
},
data () {
return {
showDevice: false,
showLibrary: false,
notRegisterDevice: [],
index: -1,
futureIndex: -1,
}
},
methods: {
// clickShowLibrary: async function () {
// this.notRegisterDevice = await this.checkNotRegisterDeviceProject({})
// if (this.notRegisterDevice.length === 0) {
// this.showLibrary = true
// return true
// }
// await this.createDeviceProject({
// name: this.notRegisterDevice[0].name,
// library: this.notRegisterDevice[0].library,
// pair: this.notRegisterDevice[0].macAddress,
// pairStatus: 1,
// order: this.getDeviceMaxOrderProject,
// })
// this.$emit('save')
// return true
// },
// clickShowDevice: async function (library) {
// this.showLibrary = false
// await this.createDeviceProject({
// name: library + '-' + String(Object.keys(this.getSelectProject.device).length + 1),
// library: library,
// pair: null,
// pairStatus: 0,
// order: this.getDeviceMaxOrderProject,
// })
// this.$emit('save')
// return false
// },
cancelSelectDevice: function () {
this.showLibrary = false
},
showSubjectModal: function (subject) {
this.$emit('showSubjectModal', subject)
},
deleteDevice: function (deviceIndex) {
this.deleteDeviceProject({ index: deviceIndex })
this.$emit('save')
},
handleMove (e) {
const { index, futureIndex } = e.draggedContext
this.index = index
this.futureIndex = futureIndex
return false // disable sort
},
handleDragEnd () {
const changeList = ['name', 'library', 'pair', 'pairStatus']
const deviceListTemp = JSON.parse(JSON.stringify(this.deviceListInOrder))
const keyOld = deviceListTemp[this.index][0]
const keyNew = deviceListTemp[this.futureIndex][0]
const deviceList = this.getSelectProject.device
for (const key of changeList) {
deviceList[keyOld][key] = deviceListTemp[this.futureIndex][1][key]
deviceList[keyNew][key] = deviceListTemp[this.index][1][key]
}
this.$emit('save')
},
...mapActions('project',
[
types.project.createDevice,
types.project.deleteDevice,
types.project.checkNotRegisterDevice,
types.project.checkPairDeviceExist,
],
),
},
mounted () {
},
watch: {
projectSelectIndex: {
immediate: true,
handler: async function (val) {
this.checkPairDeviceExistProject()
},
},
},
}
</script>
<style lang="scss">
.add-button {
width: 38px;
height: 36px;
background: #e0e0e0;
border: 2px dashed #b7b7b7;
border-radius: 20px;
}
.add-button-text {
color: white;
font-size: 20px;
font-weight: bold;
}
.pair-button {
width: 100%;
height: 36px;
background: #858dd6;
border: 0;
border-radius: 20px;
}
.not-pair-button {
width: 100%;
height: 36px;
background: #e0e0e0;
border: 0;
border-radius: 20px;
}
.pair-button-text {
font-family: 'Inter-Regular';
font-style: normal;
font-weight: 400;
font-size: 16px;
line-height: 24px;
text-align: center;
color: #ffffff;
}
.project-device-header-text {
align-items: center;
// font-family: 'Inter-Regular';
// font-style: normal;
font-weight: 700;
font-size: 20px;
line-height: 29px;
/* identical to box height */
color: rgb(52, 73, 94);
// color: #768b9b;
}
</style>
@@ -0,0 +1,187 @@
<template>
<div>
<va-modal
class="flex sm12 xl12 md12 xs12"
v-model="showModal"
size="small"
:noOutsideDismiss="true"
hide-default-actions
>
<template slot="header">
<div class="d-flex mb-3">
<va-icon name="fa fa-bluetooth-b mr-3" color="primary"/>
<h5 class="mt-0 mb-0">Choose Subject</h5>
</div>
</template>
<va-list fit class="mb-2 pb-0">
<div>
<va-icon name="fa fa-plus" @click.native="showCreate"></va-icon>
<va-icon class="ml-2" name="fa fa-minus" @click.native="deleteSubject"></va-icon>
</div>
<div class="row" v-if="showCreateInput === true">
<va-input label="NAME" v-model="name"></va-input>
<va-input label="DESCRIPTION" v-model="description"></va-input>
<va-button @click="createSubject">SAVE</va-button>
</div>
<va-list-label>
</va-list-label>
<template v-for="(subject, index) in subjectList">
<va-item :class="subjectSelect === index ? 'list-focus': ''" :key="'connect-' + index" @click="selectSubject(index)" clickable>
<!-- <va-item-section avatar>
<va-avatar style="border-radius: 0;">
<img src='@/assets/img/elite_img.png' :alt="device.macAddress">
</va-avatar>
</va-item-section> -->
<va-item-section>
{{ subject.name }}
</va-item-section>
<va-item-section>
{{ subject.description }}
</va-item-section>
</va-item>
<!-- <va-list-separator v-if="index < deviceList.length - 1" :key="'separator-' + index" /> -->
</template>
</va-list>
<div class="flex-center sm12 xl12 md12 xs12">
<va-button color='danger' @click="removeSubject">Remove</va-button>
<va-button @click="hide">Cancel</va-button>
<va-button @click="changeSubject">OK</va-button>
</div>
</va-modal>
</div>
</template>
<script>
// import { mapFields } from 'vuex-map-fields'
import api from '@/data/api/index'
import { mapActions, mapGetters } from 'vuex'
import types from '@/store/modules/project/types'
export default {
name: 'subject-modal',
components: {
},
computed: {
...mapGetters('project', [
types.project.getSelect,
types.project.getDeviceShowName,
]),
// ...mapFields('project', [
// 'deviceConnectList',
// ]),
},
data () {
return {
showModal: false,
showDisplayDevice: false,
key: '',
device: {},
subjectList: [],
subjectSelect: -1,
name: '',
description: '',
showCreateInput: false,
}
},
methods: {
showCreate: function () {
this.showCreateInput = true
},
deleteSubject: async function () {
const selectSubject = this.subjectList[this.subjectSelect]
if (selectSubject) {
await api.subject.update(selectSubject.id, { deleted: true })
await api.subject.clearDel()
this.subjectList.splice(this.subjectSelect, 1)
}
},
show: function () {
this.showModal = true
},
hide: function () {
this.showModal = false
},
createSubject: async function () {
const newSubject = await api.subject.create({ name: this.name, description: this.description })
if (newSubject.status === 200) {
this.subjectList.push(newSubject.data)
}
},
// detect: function (device) {
// if (device) this.$emit('detect', device)
// },
selectSubject: function (index) {
this.subjectSelect = index
},
changeSubject: function () {
let subject = null
if (this.subjectList[this.subjectSelect]) {
subject = this.subjectList[this.subjectSelect]
}
this.$emit('save', subject)
this.hide()
},
removeSubject: function () {
let subject = null
if (this.subjectList[this.subjectSelect]) {
subject = this.subjectList[this.subjectSelect]
}
this.$emit('remove', subject)
this.hide()
},
removeDevice: function () {
this.deleteDeviceProject({ deviceKey: this.key })
this.$emit('save')
this.hide()
},
getSubjectList: async function (subject) {
},
initSetting: async function (subject) {
this.subjectList.length = 0
const subjectResponse = await api.subject.get()
if (subjectResponse.status === 200) {
this.subjectList.push(...subjectResponse.data)
}
this.name = ''
this.description = ''
this.subjectSelect = -1
if (subject) {
this.subjectSelect = this.subjectList.findIndex((ele) => ele.id === subject.id)
}
// this.key = key
// this.device = device
// this.deviceList = []
// this.deviceSelect = 0
// this.getDeviceList(device)
},
...mapActions('project',
[
types.project.addDevice,
types.project.findDevice,
types.project.setDevice,
types.project.deleteDevice,
types.project.checkNotRegisterDevice,
types.task.init,
types.task.create,
types.task.save,
types.task.delete,
types.task.select,
],
),
},
mounted () {
},
}
</script>
<style lang="scss">
.list-focus {
background: #ebedff;
border: 1px solid #dbdcf0;
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.25);
border-radius: 5px;
}
</style>
@@ -15,7 +15,10 @@
</tr>
</thead>
<!-- <tbody> -->
<vuedraggable :disabled="lockMode === true || inputMode === true" class="draggable" :list="getSelectProject.task" @end="rearrangeTask({ project: getSelectProject })" tag="tbody" animation="500">
<vuedraggable :disabled="lockMode === true || inputMode === true" class="draggable" :list="getSelectProject.task" @end="()=> {
rearrangeTask({ project: getSelectProject })
saveProject()
}" tag="tbody" animation="500">
<template class="item" v-for="(task, taskIndex) in getSelectProject.task">
<tr
v-if="task.type === 'cycle'"
@@ -204,7 +207,10 @@
<template slot="popover">
<div>
<div v-for="(parameter) in parameterShow(parameterSet.MODE, deviceUUID)" :key="parameter + parameterSet.MODE">
<p>
<p v-if="getConfig(deviceUUID).includes('TRIG') === true">
{{ parameterPair(parameter, parameterSet, deviceUUID) }}
</p>
<p v-else>
{{ parameterName(parameter, deviceUUID) }} : {{ parameterValue(parameter, parameterSet[parameter], deviceUUID) }}
</p>
</div>
@@ -251,7 +257,7 @@
</table>
</div>
<div>
<cycle-modal ref="cycle_modal_ref"></cycle-modal>
<cycle-modal ref="cycle_modal_ref" @save="saveProject"></cycle-modal>
</div>
</div>
</template>
@@ -357,6 +363,7 @@ export default {
if (a === undefined) return
newTaskList.filter(ele => ele != null)
this.rearrangeTask({ project: this.getSelectProject })
this.saveProject()
},
swapTask: function (taskIndex, upDown) {
taskIndex = parseInt(taskIndex)
@@ -370,11 +377,13 @@ export default {
this.getSelectProject.task.splice(taskIndex + 1, 1, a)
}
this.rearrangeTask({ project: this.getSelectProject })
this.saveProject()
},
delSelected: function () {
for (const indexSelected of this.tableColumn.checked) {
this.deleteTask({ project: this.getSelectProject, index: indexSelected })
}
this.saveProject()
},
delAction: function (task, actionKey, conditionKey) {
const _action = JSON.parse(JSON.stringify(task.action))
@@ -385,6 +394,12 @@ export default {
task.action = _action
task.condition = _condition
this.saveProject()
},
saveProject: function () {
console.log('saveProject')
this.$emit('save', this.getSelectProject)
},
trigger_button: function (projectID) {
console.log('project', projectID)
@@ -407,6 +422,8 @@ export default {
this.inputMode = false
this.tableColumn[tag] = -1
}
this.saveProject()
},
switchCycle: function (tag, index, projectID, task) {
this.switchInput(tag, index)
@@ -419,6 +436,7 @@ export default {
index: cycleInfo[0],
content: { id: this.inputSaved },
}))
this.$emit('save', this.getSelectProject)
},
selectAll: function (selectedArray) {
const totalRange = [...Array(this.getSelectProject.task.length).keys()].map(idx => String(idx))
@@ -448,9 +466,44 @@ export default {
parameterShow (mode, deviceKey) {
const config = configTable.getConfig(this.getDeviceLibraryProject(deviceKey))
if (config !== undefined && Object.keys(config) !== 0) {
if (this.getDeviceLibraryProject(deviceKey).includes('TRIG')) return config.MODE[mode].showParameter
return config.MODE[mode].parameter
}
},
parameterPair (name, valueSet, deviceKey) {
let _name, _value
const config = configTable.getConfig(this.getDeviceLibraryProject(deviceKey))
if (config !== undefined && Object.keys(config) !== 0) {
if (this.getDeviceLibraryProject(deviceKey).includes('TRIG')) {
if (name.includes('ACC_a_out')) {
const accName = name + '_current'
if (Boolean(valueSet[name]) === true) {
_name = 'Channel' + String((parseInt(name.replace('ACC_a_out', '')) + 1))
const scale = config[accName].unit[config[accName].defaultUnit]
_value = `${config[accName].outputReadabilityData(valueSet[accName], scale)} ${config[accName].defaultUnit}`
} else return ''
} else if (name.includes('TRIG')) {
if (Boolean(valueSet[name]) === true) {
const optionTrigger = [
'RISING',
'FALLING',
'BOTH',
]
const trigName = name.replace('en', '') + 'edge_type'
_name = 'TRIG' + String((parseInt(name.replace('TRIG', '').replace('_en', '')) + 1))
_value = optionTrigger[valueSet[trigName]]
} else return ''
} else if (name.includes('TIME_DURATION')) {
if (valueSet.TIME_DURATION && parseInt(valueSet.TIME_DURATION) > 0) {
const scale = config[name].unit[config[name].defaultUnit]
_name = 'Timer'
_value = `${config[name].outputReadabilityData(valueSet[name], scale)} ${config[name].defaultUnit}`
} else return ''
}
}
}
return _name + ': ' + _value
},
parameterName (name, deviceKey) {
const config = configTable.getConfig(this.getDeviceLibraryProject(deviceKey))
if (config !== undefined && Object.keys(config) !== 0) {
@@ -498,6 +551,10 @@ export default {
return cycleInfo[1]
},
getConfig: function (deviceKey) {
return this.getDeviceLibraryProject(deviceKey)
},
handleMove (e) {
const { index, futureIndex } = e.draggedContext
this.index = index
+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)
@@ -130,17 +130,66 @@ export default {
if (device === undefined) return
return device.configuration.MODE
},
getChannelConfiguration: function () {
const device = this.deviceListNew.find(ele => String(ele.memory_board) === String(this.chartData[this.chartID].mappingID))
if (device === undefined) return
return configTable.getChannelConfig(device.configuration._LIBRARY_, device.configuration.MODE)
},
// set a new display tool
setRealTime: function (plotIndex, curveIndex) {
// construct realTime object, i.e., record the coressponding value and unit
// the formate imitates the data.gridSource
const channelInfo = this.getChannelConfiguration()
if (this.data !== undefined && this.data.gridSource !== undefined) {
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 === 'P') _xPhysicsQuantity = 'V'
if (_yPhysicsQuantity === 'P') _yPhysicsQuantity = 'V'
const [_xAxis, _yAxis] = this.chartRouter.getChartTable(_xPhysicsQuantity, _yPhysicsQuantity)
const x = this.data.gridSource[plotIndex][curveIndex].xSource
const y = this.data.gridSource[plotIndex][curveIndex].ySource
let _xAxis
let _yAxis
if (channelInfo) {
if (x.name === 'Time') {
_xAxis = { default: channelInfo.time }
} else {
let xInfo = channelInfo[x.channel - 1]
if (xInfo === undefined) {
xInfo = {
name: '',
defaultUnit: '',
unit: {},
}
}
_xAxis = { default: xInfo }
}
if (y.name === 'Time') {
_yAxis = { default: channelInfo.time }
} else {
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
@@ -276,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: {
: 1,
Ω: 1e3,
: 1e6,
: 1e9,
},
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: {
'°': 1,
},
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 () {
@@ -22,7 +22,7 @@
<va-item-section class="ml-3" caption>
<!-- <va-button @click="getBattery(device)"> get battery </va-button> -->
<!-- <pre> {{ device.battery }} </pre> -->
<va-item-label v-if="device.library_name.includes('EIS')">
<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-else-if="parseInt((device.battery - 2900) / 10) >= 75">
@@ -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 = []
@@ -121,10 +121,10 @@ export default {
// directory init
const collection = await api.collection.getAll()
this.directoryOptions = collection.data.filter(el => el.name !== 'root')
this.directoryOptions = collection.data.filter(el => el.name !== 'root').sort((a, b) => { return a.id - b.id })
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 () {
},
@@ -26,6 +26,25 @@
</div>
</div>
<!-- split because of styling problem(treenode), combine together furture -->
<!-- Trigger -->
<div v-if="library && library.includes('TRIG')">
<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>
</div>
<!-- EIS -->
<div v-if="library && library.includes('EIS')">
<component
@@ -44,7 +63,7 @@
/>
</div>
<!-- ZM15-PulseSensingMode -->
<div v-else-if="library && library.includes('EDC') && parameter.MODE === 14">
<div v-else-if="library && (library.includes('EDC') || library.includes('BAT')) && parameter.MODE === 14">
<EliteParameterRecordingElitePulseSensing
:parameter="parameter"
:device="device"
@@ -55,7 +74,7 @@
/>
</div>
<!-- ZM15-DPVMode -->
<div v-else-if="library && library.includes('EDC') && parameter.MODE === 15">
<div v-else-if="library && (library.includes('EDC') || library.includes('BAT')) && parameter.MODE === 15">
<EliteParameterRecordingEliteDPV
:parameter="parameter"
:device="device"
@@ -66,7 +85,7 @@
/>
</div>
<!-- ZM15-OtherModes -->
<div v-else-if="library && library.includes('EDC')">
<div v-else-if="library && (library.includes('EDC') || library.includes('BAT'))">
<va-tree-category
v-for="name in parameterArrayInMode"
:key="name"
@@ -124,6 +143,7 @@ import InputField from '../parameter/itemNew/InputField'
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 EliteParameterRecordingElitePulseSensing from '../parameter/itemNew/PulseSensingNew/EliteParameterRecordingElitePulseSensing'
import { VueFinalModal } from 'vue-final-modal'
import { mapFields } from 'vuex-map-fields'
@@ -141,6 +161,7 @@ export default {
InputField,
MultiInputField,
DevMode,
Trigger,
},
props: {
parameter: {
@@ -162,6 +183,10 @@ export default {
type: String,
default: '',
},
resetParameterModeChange: {
type: Boolean,
default: false,
},
},
computed: {
parameterTable () {
@@ -247,13 +272,20 @@ export default {
},
refresh () {
},
workingModeSelectChange (val) {
if (val === undefined) return
workingModeSelectChange (val, reset = true) {
if (val === undefined || this.parameter.MODE === undefined) return
this.workingModeSelect = val
// console.log('workingModeSelectChange', this.workingModeSelect, this.parameter.MODE)
if (this.workingModeSelect.id !== this.parameter.MODE) {
this.parameterChange('MODE', this.workingModeSelect.id)
if (this.resetParameterModeChange === true) {
if (reset === true) {
for (const parameter of this.parameterTable.MODE[this.workingModeSelect.id].parameter) {
this.$emit('setParameter', parameter, this.parameterTable[parameter].defaultValue)
}
}
}
// if device is idle, then setting highz when mode switch
if (this.deviceStatus === true) {
@@ -0,0 +1,152 @@
<template>
<div class="flex sm12 xl12 md12 xs12 mb-2 pb-1 align--center">
<div class="row">
<div class="flex sm12 xl5 md5 xs12 my-1 py-0">
<p class="display-6"> CHANNEL {{ Number(channel) + 1 }} <p/>
</div>
<div class="flex sm12 xl3 md3 xs12 px-0 mx-0 my-0 py-0">
<va-input
class="mb-0 small-va-input"
v-model="inputStringText"
:disabled="!channelToggle"
@keyup.enter="inputChange(inputString)"
@blur="inputChange(inputString)"
>
<p slot="append" style="margin-right: 0;" small>
mA
</p>
</va-input>
</div>
<div class="flex sm12 xl4 md4 xs12 px-0 mx-0 my-0 py-0">
<va-toggle class="mb-0" v-model="toggle" color="success" style="float: right;" flat small @click.native="switchToggle()"/>
</div>
</div>
<div class="sm11 xl12 md12 xs12 my-1 py-1">
<va-slider
pins
:min="outputReadabilityData(range.min)"
:max="outputReadabilityData(range.max)"
value-visible
:step="10"
:color="toggle === true ? 'primary' : 'gray'"
:disabled="!toggle"
v-model="inputSlider"
/>
</div>
</div>
</template>
<script>
export default {
name: 'ChannelBlock',
components: {
},
computed: {
toggle: {
get () {
return Boolean(this.inputValue[this.toggleName])
},
set (val) {
this.channelToggle = val
},
},
inputStringText: {
get () {
return String(this.outputReadabilityData(this.inputValue[this.parameterName]))
},
set (val) {
this.inputString = val
},
},
inputSlider: {
get () {
return this.outputReadabilityData(this.inputValue[this.parameterName])
},
set (val) {
this.inputChange(val)
},
},
},
props: {
inputValue: {
type: Object,
},
channel: {
type: Number,
required: true,
},
parameterName: {
type: String,
required: true,
},
toggleName: {
type: String,
required: true,
},
range: {
type: Object,
},
defaultUnit: {
type: String,
},
unit: {
type: Object,
},
outputReadabilityData: {
type: Function,
default: (val) => val,
},
outputRawData: {
type: Function,
default: (val) => val,
},
},
created () {
},
data () {
return {
inputString: '',
channelToggle: false,
}
},
mqtt: {
},
methods: {
inputChange (val) {
// if change from input field
if (typeof (val) === 'string') {
if (isNaN(val) || val === '') {
return false
}
val = this.outputRawData(val)
if (parseFloat(val) < this.range.min) {
val = this.range.min
} else if (parseFloat(val) > this.range.max) {
val = this.range.max
}
} else if (typeof (val) === 'number') {
val = this.outputRawData(val)
}
this.$emit('parameterChange', this.parameterName, val, true)
},
switchToggle () {
this.$emit('parameterChange', this.toggleName, this.channelToggle)
},
},
}
</script>
<style lang="scss">
.small-va-input {
.va-input {
&__container {
min-height: 1rem;
}
&__container__input {
margin-bottom: 0.001rem;
padding: 0.8rem 0.5rem;
}
}
}
</style>
@@ -0,0 +1,149 @@
<template>
<div class="flex sm12 xl12 md12 xs12 mb-2 pb-1 align--center">
<div class="row">
<div class="flex sm12 xl5 md5 xs12 my-1 py-0">
<p class="display-6 my-2"> Timer <p/>
</div>
<div class="flex sm12 xl3 md3 xs12 px-0 mx-0 my-2 py-0">
<va-input
class="mb-0 small-va-input"
v-model="inputStringText"
:disabled="!toggle"
@keyup.enter="inputChange(inputString)"
@blur="inputChange(inputString)"
>
<p slot="append" style="margin-right: 0;" small>
s
</p>
</va-input>
</div>
<div class="flex sm12 xl4 md4 xs12 px-0 mx-0 my-2 py-0">
<va-toggle class="mb-0" v-model="toggle" color="success" style="float: right;" flat small @click.native="switchToggle()"/>
</div>
</div>
<!-- <div class="sm11 xl12 md12 xs12 my-1 py-1">
<va-slider
pins
:min="outputReadabilityData(range.min)"
:max="outputReadabilityData(range.max)"
value-visible
:step="10"
:color="timerToggle === true ? 'primary' : 'gray'"
:disabled="!timerToggle"
v-model="inputSlider"
/>
</div> -->
</div>
</template>
<script>
export default {
name: 'TimerBlock',
components: {
},
computed: {
inputStringText: {
get () {
return String(this.outputReadabilityData(this.inputValue[this.parameterName]))
},
set (val) {
this.inputString = val
},
},
inputSlider: {
get () {
return this.outputReadabilityData(this.inputValue[this.parameterName])
},
set (val) {
this.inputChange(val)
},
},
toggle: {
get () {
return !(this.inputValue[this.parameterName] === 0)
},
set (val) {
this.timerToggle = val
},
},
},
props: {
inputValue: {
type: Object,
},
parameterName: {
type: String,
required: true,
},
range: {
type: Object,
},
defaultUnit: {
type: String,
},
unit: {
type: Object,
},
outputReadabilityData: {
type: Function,
default: (val) => val,
},
outputRawData: {
type: Function,
default: (val) => val,
},
},
created () {
},
data () {
return {
inputString: '',
timerToggle: false,
}
},
mqtt: {
},
methods: {
inputChange (val) {
// if change from input field
if (typeof (val) === 'string') {
if (isNaN(val) || val === '') {
return false
}
val = this.outputRawData(val)
if (parseFloat(val) < this.range.min) {
val = this.range.min
} else if (parseFloat(val) > this.range.max) {
val = this.range.max
}
} else if (typeof (val) === 'number') {
val = this.outputRawData(val)
}
this.$emit('parameterChange', this.parameterName, val, true)
},
switchToggle () {
if (this.timerToggle === true) {
this.$emit('parameterChange', this.parameterName, 1)
}
if (this.timerToggle === false) {
this.$emit('parameterChange', this.parameterName, 0)
}
},
},
}
</script>
<style lang="scss">
.small-va-input {
.va-input {
&__container {
min-height: 1rem;
}
&__container__input {
margin-bottom: 0.001rem;
padding: 0.8rem 0.5rem;
}
}
}
</style>
@@ -0,0 +1,108 @@
<template>
<div>
<div v-if="parameter.MODE === 0">
<div v-for="channel in channelList" :key="channel">
<ChannelBlock
:channel="channel"
:inputValue="parameter"
:parameterName="channelBlockCurrent(channel)"
:toggleName="channelBlockToggle(channel)"
v-bind="parameterTable[channelBlockCurrent(channel)]"
@parameterChange="parameterChange"
></ChannelBlock>
</div>
<div class="row px-0 mx-0">
<p class="my-2 mr-2 display-5"> ADVANCED SETTING </p>
<!-- <va-toggle class="mb-0" flat small color="success" v-model="openAdvanced"/> -->
</div>
<div>
<TimerBlock
:inputValue="parameter"
:parameterName="'TIME_DURATION'"
v-bind="parameterTable.TIME_DURATION"
@parameterChange="parameterChange"
></TimerBlock>
</div>
<div>
<div v-for="triggerIndex in triggerList" :key="'trigger_' + triggerIndex">
<TriggerBlock
:triggerIndex="triggerIndex"
:inputValue="parameter"
:parameterName="triggerBlockType(triggerIndex)"
:toggleName="triggerBlockEnable(triggerIndex)"
v-bind="parameterTable[triggerBlockType()]"
@parameterChange="parameterChange"
></TriggerBlock>
</div>
</div>
</div>
</div>
</template>
<script>
import ChannelBlock from './ChannelBlock.vue'
import TriggerBlock from './TriggerBlock.vue'
import TimerBlock from './TimerBlock.vue'
export default {
name: 'Trigger',
components: {
ChannelBlock,
TriggerBlock,
TimerBlock,
},
computed: {
},
props: {
parameter: {
type: Object,
default: () => {},
},
parameterTable: {
type: Object,
default: () => {},
},
},
data () {
return {
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)
},
},
}
</script>
@@ -0,0 +1,101 @@
<template>
<div class="row flex sm12 xl12 md12 xs12 ma-0 pa-0">
<div class="d-flex sm12 xl12 md12 xs12 my-0 py-0">
<div class="flex sm8 xl8 md8 xs8 my-1 py-0">
<p class="display-6 my-2"> TRIGGER IN {{ triggerIndex + 1 }} <p/>
</div>
<div class="flex sm4 xl4 md4 xs4 ma-0 pa-0 my-2">
<va-toggle class="mb-0" v-model="toggle" color="success" style="float: right;" flat small @click.native="switchToggle()"/>
</div>
</div>
<div class="flex sm12 xl12 md12 xs12 pa-0 ma-0">
<va-radio-button
v-for="(option, index) in optionTrigger"
:key="index"
style="float: left;"
v-model="selectTrigger"
:option="optionTrigger[index]"
:label="optionTrigger[index]"
:disabled="!toggle"
@click.native.stop="inputChange(index)"
/>
</div>
</div>
</template>
<script>
export default {
name: 'TriggerBlock',
components: {
},
props: {
triggerIndex: {
type: Number,
required: true,
},
inputValue: {
type: Object,
},
parameterName: {
type: String,
required: true,
},
toggleName: {
type: String,
required: true,
},
range: {
type: Object,
},
defaultUnit: {
type: String,
},
unit: {
type: Object,
},
outputReadabilityData: {
type: Function,
default: (val) => val,
},
outputRawData: {
type: Function,
default: (val) => val,
},
},
computed: {
toggle: {
get () {
return Boolean(this.inputValue[this.toggleName])
},
set (val) {
this.triggerToggle = val
},
},
},
created () {
},
data () {
return {
selectTrigger: 'RISING',
optionTrigger: [
'RISING',
'FALLING',
'BOTH',
],
triggerToggle: false,
}
},
methods: {
inputChange (val) {
this.$emit('parameterChange', this.parameterName, val)
},
switchToggle () {
this.$emit('parameterChange', this.toggleName, this.triggerToggle)
},
},
mounted () {
this.selectTrigger = this.optionTrigger[this.inputValue[this.parameterName]]
this.triggerToggle = Boolean(this.inputValue[this.toggleName])
},
}
</script>
+4
View File
@@ -11,6 +11,8 @@ import analysis from './analysis'
import sdcard from './sdcard'
import connection from './connection'
import project from './project'
import subject from './subject'
import subjectData from './subject_data'
// axios.defaults.baseURL = 'http://192.168.3.211:3000'
axios.defaults.baseURL = 'http://' + location.href.split('/')[2].split(':')[0] + ':3000'
@@ -29,6 +31,8 @@ const api = {
sdcard,
connection,
project,
subject,
subjectData,
}
export default api
+52
View File
@@ -0,0 +1,52 @@
import api from './index'
import auth from './auth'
async function create (attrs) {
const _header = auth.getHeader()
try {
return await api.axios.post('/api/subject/create', attrs, { headers: _header })
} catch (e) {
console.error(e)
return false
}
}
async function update (id, attrs) {
const _header = auth.getHeader()
try {
return await api.axios.post(`/api/subject/update/${id}`, attrs, { headers: _header })
} catch (e) {
console.error(e)
return false
}
}
async function clearDel () {
const _header = auth.getHeader()
try {
return await api.axios.get('/api/subject/clear_deleted', { headers: _header })
} catch (e) {
console.error(e)
return false
}
}
async function get (id) {
const _header = auth.getHeader()
try {
return await api.axios.get('/api/subject/get', { headers: _header })
} catch (e) {
console.error(e)
return false
}
}
const subject = {
create,
update,
clearDel,
get,
}
export default subject
+56
View File
@@ -0,0 +1,56 @@
import api from './index'
import auth from './auth'
async function create (attrs) {
const _header = auth.getHeader()
try {
return await api.axios.post('/api/subject_data/create', attrs, { headers: _header })
} catch (e) {
console.error(e)
return false
}
}
async function update (id, attrs) {
const _header = auth.getHeader()
try {
return await api.axios.post(`/api/subject_data/update/${id}`, attrs, { headers: _header })
} catch (e) {
console.error(e)
return false
}
}
async function clearDel () {
const _header = auth.getHeader()
try {
return await api.axios.get('/api/subject_data/clear_deleted', { headers: _header })
} catch (e) {
console.error(e)
return false
}
}
async function get (attrs) {
let query = ''
const _header = auth.getHeader()
for (const attr in attrs) {
query += `${attr}=${attrs[attr]}`
}
try {
return await api.axios.get(`/api/subject_data/get?${query}`, { headers: _header })
} catch (e) {
console.error(e)
return false
}
}
const subjectData = {
create,
update,
clearDel,
get,
}
export default subjectData
@@ -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,
+10 -10
View File
@@ -99,20 +99,20 @@ const EliteZM15 = {
showName: 'Current range',
componentType: 'input-button-toggle',
options: [
{ value: 0, label: '<4 μA' },
{ value: 1, label: '2.5-100 μA' },
{ value: 2, label: '85-2050 μA' },
{ value: 0, label: '<4 uA' },
{ value: 1, label: '2.5-100 uA' },
{ value: 2, label: '85-2050 uA' },
{ value: 3, label: '1800 uA' },
{ value: 4, label: 'Auto' },
],
range: ['<4 μA', '2.5-100 μA', '85-2050 μA', '1800 uA', 'Auto'],
range: ['<4 uA', '2.5-100 uA', '85-2050 uA', '1800 uA', 'Auto'],
defaultValue: 4,
outputRawData: (val) => {
const currentRangeArr = ['<4 μA', '2.5-100 μA', '85-2050 μA', '1800 uA', 'Auto']
const currentRangeArr = ['<4 uA', '2.5-100 uA', '85-2050 uA', '1800 uA', 'Auto']
return currentRangeArr.indexOf(val.toString())
},
outputReadabilityData: (idx) => {
const currentRangeArr = ['<4 μA', '2.5-100 μA', '85-2050 μA', '1800 uA', 'Auto']
const currentRangeArr = ['<4 uA', '2.5-100 uA', '85-2050 uA', '1800 uA', 'Auto']
return currentRangeArr[parseInt(idx)]
},
},
@@ -393,10 +393,10 @@ const EliteZM15 = {
componentType: 'input-range',
range: Object.freeze({ min: 0, max: 1500000 }),
defaultValue: 0,
defaultUnit: 'μA',
downloadUnit: 'mA',
defaultUnit: 'uA',
downloadUnit: 'uA',
unit: {
μA: 1,
uA: 1,
mA: 1e3,
},
outputRawData: (val) => {
@@ -520,7 +520,7 @@ const EliteZM15 = {
return parseInt((parseFloat(val) - 25000) / 5) / scale
},
},
VOLT_VSCAN: {
CA_VOLT: {
type: 'number',
showName: 'Volt (v.s. ref)',
componentType: 'input-range',
@@ -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,14 +117,17 @@ export default {
},
7: {
name: 'Phase',
physicalQuantity: 'Degree',
unit: {
millidegree: 1,
'°': 1e3,
},
downloadUnit: null,
downloadUnit: 'millidegree',
defaultUnit: '°',
},
8: {
name: 'Current',
physicalQuantity: 'A',
unit: {
nA: 1,
uA: 1e3,
@@ -128,12 +138,51 @@ export default {
},
9: {
name: 'Level gain',
physicalQuantity: '',
unit: {
default: 1,
},
downloadUnit: null,
defaultUnit: 'default',
},
10: {
name: 'notify_one',
physicalQuantity: '',
unit: {
default: 1,
},
downloadUnit: null,
defaultUnit: 'default',
},
11: {
name: 'notify_two',
physicalQuantity: '',
unit: {
default: 1,
},
downloadUnit: null,
defaultUnit: 'default',
},
12: {
name: 'notify_three',
physicalQuantity: '',
unit: {
default: 1,
},
downloadUnit: null,
defaultUnit: 'default',
},
13: {
name: 'debug_amp[mV]',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
V: 1e6,
},
defaultUnit: 'mV',
downloadUnit: 'mV',
},
},
charts: {
default: [
@@ -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,14 +117,17 @@ export default {
},
7: {
name: 'Phase',
physicalQuantity: 'Degree',
unit: {
millidegree: 1,
'°': 1e3,
},
downloadUnit: null,
downloadUnit: 'millidegree',
defaultUnit: '°',
},
8: {
name: 'Current',
physicalQuantity: 'A',
unit: {
nA: 1,
uA: 1e3,
@@ -128,12 +138,51 @@ export default {
},
9: {
name: 'Level gain',
physicalQuantity: '',
unit: {
default: 1,
},
downloadUnit: null,
defaultUnit: 'default',
},
10: {
name: 'notify_one',
physicalQuantity: '',
unit: {
default: 1,
},
downloadUnit: null,
defaultUnit: 'default',
},
11: {
name: 'notify_two',
physicalQuantity: '',
unit: {
default: 1,
},
downloadUnit: null,
defaultUnit: 'default',
},
12: {
name: 'notify_three',
physicalQuantity: '',
unit: {
default: 1,
},
downloadUnit: null,
defaultUnit: 'default',
},
13: {
name: 'debug_amp[mV]',
physicalQuantity: 'V',
unit: {
uV: 1,
mV: 1e3,
V: 1e6,
},
defaultUnit: 'mV',
downloadUnit: 'mV',
},
},
charts: {
default: [
+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,
+11 -7
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)]
},
},
@@ -158,7 +162,7 @@ const EliteEIS = {
outputReadabilityData: (val, scale = 1) => {
return Math.round(parseInt(val) / 2047 * 800) / scale
},
defaultValue: 25,
defaultValue: 26,
defaultUnit: 'mV',
downloadUnit: 'mV',
unit: {
@@ -289,7 +293,7 @@ const EliteEIS = {
outputReadabilityData: (val, scale = 1) => {
return Math.round(parseInt(val) / 2047 * 800) / scale
},
defaultValue: 25,
defaultValue: 26,
defaultUnit: 'mV',
downloadUnit: 'mV',
unit: {
+24
View File
@@ -0,0 +1,24 @@
export default {
name: 'ACC',
parameter: ['TIME_DURATION', 'ACC_a_out0', 'ACC_a_out1', 'ACC_a_out2', 'ACC_a_out3', 'ACC_a_out0_current', 'ACC_a_out1_current', 'ACC_a_out2_current', 'ACC_a_out3_current', 'TRIG0_en', 'TRIG1_en', 'TRIG0_edge_type', 'TRIG1_edge_type'], // 這個mode用到的參數
showParameter: ['ACC_a_out0', 'ACC_a_out1', 'ACC_a_out2', 'ACC_a_out3', 'TRIG0_en', 'TRIG1_en', 'TIME_DURATION'], // 有要秀給user看的參數
headerParameter: () => [], // export header的參數
valScales: {
linear: {
func: (val) => {
return val
},
},
log: {
func: (val) => {
return Math.log10(Math.abs(val))
},
},
},
channels: {
},
charts: {
default: [
],
},
}
@@ -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,
},
},
],
},
],
},
],
},
}
+253
View File
@@ -0,0 +1,253 @@
import Idle from '../Common/Idle'
import ACC from './ACC'
import DevMode from './DevMode'
const EliteTrigger = {
TIME_DURATION: {
type: 'number',
showName: 'Time duration',
componentType: 'input-range',
range: Object.freeze({ min: 0, max: 86400 }), // UI上能輸入的最大最小值
defaultValue: 0,
defaultUnit: 's',
downloadUnit: 's',
unit: {
ms: 1e-3,
s: 1,
m: 60,
h: 3600,
},
outputRawData: (val) => {
return parseInt(parseFloat(val))
},
outputReadabilityData: (val) => {
return parseInt(parseFloat(val))
},
},
ACC_a_out0: {
type: 'number',
showName: 'Channel 1 Enable',
componentType: 'channelBlock',
range: Object.freeze({ min: 0, max: 1 }), // UI上能輸入的最大最小值
defaultValue: 0,
defaultUnit: null,
downloadUnit: null,
unit: {},
outputRawData: (val) => {
return parseInt(val)
},
outputReadabilityData: (val) => {
return parseInt(val)
},
},
ACC_a_out1: {
type: 'number',
showName: 'Channel 2 Enable',
componentType: 'channelBlock',
range: Object.freeze({ min: 0, max: 1 }), // UI上能輸入的最大最小值
defaultValue: 0,
defaultUnit: null,
downloadUnit: null,
unit: {},
outputRawData: (val) => {
return parseInt(val)
},
outputReadabilityData: (val) => {
return parseInt(val)
},
},
ACC_a_out2: {
type: 'number',
showName: 'Channel 3 Enable',
componentType: 'channelBlock',
range: Object.freeze({ min: 0, max: 1 }), // UI上能輸入的最大最小值
defaultValue: 0,
defaultUnit: null,
downloadUnit: null,
unit: {},
outputRawData: (val) => {
return parseInt(val)
},
outputReadabilityData: (val) => {
return parseInt(val)
},
},
ACC_a_out3: {
type: 'number',
showName: 'Channel 4 Enable',
componentType: 'channelBlock',
range: Object.freeze({ min: 0, max: 1 }), // UI上能輸入的最大最小值
defaultValue: 0,
defaultUnit: null,
downloadUnit: null,
unit: {},
outputRawData: (val) => {
return parseInt(val)
},
outputReadabilityData: (val) => {
return parseInt(val)
},
},
ACC_a_out0_current: {
type: 'number',
showName: 'Channel 1 Current',
componentType: 'channelBlock',
range: Object.freeze({ min: 0, max: 50000 }), // UI上能輸入的最大最小值
defaultValue: 0,
defaultUnit: 'mA',
downloadUnit: null,
unit: {
mA: 1,
},
outputRawData: (val) => {
return val * 250
},
outputReadabilityData: (val) => {
return val / 250
},
},
ACC_a_out1_current: {
type: 'number',
showName: 'Channel 2 Current',
componentType: 'channelBlock',
range: Object.freeze({ min: 0, max: 50000 }), // UI上能輸入的最大最小值
defaultValue: 0,
defaultUnit: 'mA',
downloadUnit: null,
unit: {
mA: 1,
},
outputRawData: (val) => {
return val * 250
},
outputReadabilityData: (val) => {
return val / 250
},
},
ACC_a_out2_current: {
type: 'number',
showName: 'Channel 3 Current',
componentType: 'channelBlock',
range: Object.freeze({ min: 0, max: 50000 }), // UI上能輸入的最大最小值
defaultValue: 0,
defaultUnit: 'mA',
downloadUnit: null,
unit: {
mA: 1,
},
outputRawData: (val) => {
return val * 250
},
outputReadabilityData: (val) => {
return val / 250
},
},
ACC_a_out3_current: {
type: 'number',
showName: 'Channel 4 Current',
componentType: 'channelBlock',
range: Object.freeze({ min: 0, max: 50000 }), // UI上能輸入的最大最小值
defaultValue: 0,
defaultUnit: 'mA',
downloadUnit: null,
unit: {
mA: 1,
},
outputRawData: (val) => {
return val * 250
},
outputReadabilityData: (val) => {
return val / 250
},
},
TRIG0_en: {
type: 'number',
showName: 'Trigger 0 Enable',
componentType: 'triggerBlock',
range: Object.freeze({ min: 0, max: 1 }), // UI上能輸入的最大最小值
defaultValue: 0,
defaultUnit: null,
downloadUnit: null,
unit: {},
outputRawData: (val) => {
return parseInt(val)
},
outputReadabilityData: (val) => {
return parseInt(val)
},
},
TRIG1_en: {
type: 'number',
showName: 'Trigger 1 Enable',
componentType: 'triggerBlock',
range: Object.freeze({ min: 0, max: 1 }), // UI上能輸入的最大最小值
defaultValue: 0,
defaultUnit: null,
downloadUnit: null,
unit: {},
outputRawData: (val) => {
return parseInt(val)
},
outputReadabilityData: (val) => {
return parseInt(val)
},
},
TRIG0_edge_type: {
type: 'number',
showName: 'Trigger 0 Type',
componentType: 'triggerBlock',
range: Object.freeze({ min: 0, max: 2 }), // UI上能輸入的最大最小值
defaultValue: 0,
defaultUnit: null,
downloadUnit: null,
unit: {},
outputRawData: (val) => {
return parseInt(val)
},
outputReadabilityData: (val) => {
return parseInt(val)
},
},
TRIG1_edge_type: {
type: 'number',
showName: 'Trigger 1 Type',
componentType: 'triggerBlock',
range: Object.freeze({ min: 0, max: 2 }), // UI上能輸入的最大最小值
defaultValue: 0,
defaultUnit: null,
downloadUnit: null,
unit: {},
outputRawData: (val) => {
return parseInt(val)
},
outputReadabilityData: (val) => {
return parseInt(val)
},
},
ADC_VALUE_I: {
type: 'none',
showName: 'Instruction',
componentType: 'dev-mode',
},
MODE_OPTIONS: [
{
id: 1,
description: 'Idle',
},
{
id: 0,
description: 'Analog Current Control (ACC)',
},
{
id: 2,
description: 'DEV MODE',
},
],
MODE: {
0: ACC,
1: Idle,
2: DevMode,
},
}
export default EliteTrigger
+6 -4
View File
@@ -1,5 +1,6 @@
import EliteEDC from './EliteEDC/index'
import EliteEIS from './EliteEIS/index'
import EliteTrigger from './EliteTrigger/index'
import store from '@/store/index'
// object saving library name mapping table
@@ -15,7 +16,7 @@ const libraryNameMappingTable = {
'Elite_EIS_1.0': EliteEIS,
'Elite_EIS_1.1': EliteEIS,
'Elite_EIS_MINI_1.0': EliteEIS,
'Elite_TRIG_0.1': null,
'Elite_TRIG_0.1': EliteTrigger,
'Elite_MEGAFLY_0.1': null,
}
@@ -32,19 +33,20 @@ const serialNumberMappingTable = {
},
3: {
1: {
0: EliteEDC, // BAT1.0
0: EliteEDC, // BAT0.1
1: EliteEDC, // BAT1.0
},
},
4: {
1: {
0: EliteEIS, // EIS1.0
1: EliteEIS, // EIS1.1
2: EliteEIS, // EIS1.1mini
2: EliteEIS, // EIS mini1.0
},
},
5: {
1: {
0: null, // TRIG0.1
0: EliteTrigger, // TRIG0.1
},
},
6: {
+6 -1
View File
@@ -23,7 +23,12 @@ export const file = {
item.checked = false
item.hovered = false
})
_fileList.push(...mes.data)
const data = mes.data.sort((a, b) => {
const date1 = new Date(a.created_at).getTime()
const date2 = new Date(b.created_at).getTime()
return date2 - date1
})
_fileList.push(...data)
},
getFileList: () => {
return _fileList
+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) {
+1
View File
@@ -8,6 +8,7 @@ function newProject (name, uuid) {
select: false,
status: -1,
cycle: [],
subject: [],
}
}
@@ -50,6 +50,7 @@ const projectActs = {
const response = await payload.api.project.create(project)
// align project id with column id
project.id = response.data.id
project.created_at = response.data.created_at
state.projectConfigList.push(project)
},
@@ -113,9 +114,13 @@ const projectActs = {
copyProject.uuid = uuidv4()
// create project need to remove
delete copyProject.id
delete copyProject.created_at
delete copyProject.updated_at
const response = await api.project.create(copyProject)
copyProject.id = response.data.id
copyProject.created_at = response.data.created_at
copyProject.updated_at = response.data.updated_at
state.projectList.push(copyProject)
},
@@ -401,6 +401,7 @@ const chartActs = {
// register series into grid
const _axisList = []
const sourceArray = []
if (formula == null) {
sourceList.forEach((source, index) => {
@@ -408,6 +409,7 @@ const chartActs = {
if (index !== 0) {
_axis = 'Y'
}
sourceArray.push(source)
switch (source.name) {
case 'Time':
_axisList.push(_axis + ' AXIS = TIME')
@@ -469,6 +471,8 @@ const chartActs = {
name: legendName,
xAxis: _axisList[0],
yAxis: _axisList[1],
xSource: sourceArray[0],
ySource: sourceArray[1],
}
if (state.chartData[chartID].gridSource[gridIndex] == null) {
state.chartData[chartID].gridSource[gridIndex] = []
@@ -833,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) {
@@ -983,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) {
@@ -1011,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'
}
@@ -1237,7 +1244,7 @@ function getLegendName (sourceList, formulaID, deviceList) {
// eslint-disable-next-line no-case-declarations
channelName = getConfigChannel(device.library_name, device.configuration.MODE, source.channel - 1)
if (!channelName) break
legendName += 'E' + source.id + '-' + channelName.name[0]
legendName += 'E' + source.id + '-' + channelName.name.replace('_', '')
break
case 'EliteEIS':
// eslint-disable-next-line no-case-declarations
@@ -1250,7 +1257,7 @@ function getLegendName (sourceList, formulaID, deviceList) {
legendName += 'E' + source.id + '-' + channelName.name.split('_').join('')
break
}
legendName += 'E' + source.id + '-' + channelName.name[0]
legendName += 'E' + source.id + '-' + channelName.name.replace('_', '')
break
default:
legendName += 'D' + source.id + 'CH' + source.channel