feat: 增加谱切换时本地保存功能,修复extrapolation 和 Spectrum中的问题
This commit is contained in:
parent
ad19436f82
commit
0f0b3eac14
|
@ -1,6 +1,6 @@
|
||||||
const sample = {
|
const sample = {
|
||||||
state: {
|
state: {
|
||||||
sampleList: []
|
sampleList: [] // [{ inputFileName: String; data: Object; }]
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
SET_SAMPLE_LIST: (state, sampleList) => {
|
SET_SAMPLE_LIST: (state, sampleList) => {
|
||||||
|
@ -8,12 +8,12 @@ const sample = {
|
||||||
},
|
},
|
||||||
|
|
||||||
ADD_SAMPLE_DATA: (state, sampleData) => {
|
ADD_SAMPLE_DATA: (state, sampleData) => {
|
||||||
|
const find = state.sampleList.find(item => item.inputFileName == sampleData.inputFileName)
|
||||||
|
if(find) {
|
||||||
|
find.data = sampleData.data
|
||||||
|
} else {
|
||||||
state.sampleList.push(sampleData)
|
state.sampleList.push(sampleData)
|
||||||
},
|
}
|
||||||
|
|
||||||
GET_SAMPLE_DATA: (state, inputFileName) => {
|
|
||||||
const find = state.sampleList.find(item => item.inputFileName == inputFileName)
|
|
||||||
return find
|
|
||||||
},
|
},
|
||||||
|
|
||||||
REMOVE_SAMPLE_DATA: (state, inputFileName) => {
|
REMOVE_SAMPLE_DATA: (state, inputFileName) => {
|
||||||
|
@ -24,6 +24,12 @@ const sample = {
|
||||||
CLEAR_SAMPLE_DATA: () => {
|
CLEAR_SAMPLE_DATA: () => {
|
||||||
state.sampleList = []
|
state.sampleList = []
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
GET_SAMPLE_DATA: ({ state }, inputFileName) => {
|
||||||
|
const find = state.sampleList.find(item => item.inputFileName == inputFileName)
|
||||||
|
return find ? find : null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -235,7 +235,7 @@ export default {
|
||||||
async getSampleDetail() {
|
async getSampleDetail() {
|
||||||
this.spectraType = this.SampleType[0].value
|
this.spectraType = this.SampleType[0].value
|
||||||
|
|
||||||
const { dbName, sampleId } = this.sample
|
const { dbName, sampleId, inputFileName } = this.sample
|
||||||
try {
|
try {
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
this.cancelLastRequest()
|
this.cancelLastRequest()
|
||||||
|
@ -251,11 +251,14 @@ export default {
|
||||||
if (success) {
|
if (success) {
|
||||||
this.sampleDetail = result
|
this.sampleDetail = result
|
||||||
this.changeChartByType('sample')
|
this.changeChartByType('sample')
|
||||||
this.$emit('getFiles', {
|
this.emitGetFiles(result)
|
||||||
detFileName: result.detBg.fileName,
|
|
||||||
gasFileName: result.gasBg.fileName,
|
this.$store.commit('ADD_SAMPLE_DATA', {
|
||||||
qcFileName: (result.qc && result.qc.fileName) || '',
|
inputFileName,
|
||||||
|
data: result,
|
||||||
|
from: 'db'
|
||||||
})
|
})
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(message)
|
this.$message.error(message)
|
||||||
}
|
}
|
||||||
|
@ -265,6 +268,15 @@ export default {
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
emitGetFiles(result) {
|
||||||
|
this.$emit('getFiles', {
|
||||||
|
detFileName: result.detBg.fileName,
|
||||||
|
gasFileName: result.gasBg.fileName,
|
||||||
|
qcFileName: result.qc ? result.qc.fileName : ''
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
async getSampleDetail_file() {
|
async getSampleDetail_file() {
|
||||||
this.spectraType = this.SampleType[0].value
|
this.spectraType = this.SampleType[0].value
|
||||||
let params = {
|
let params = {
|
||||||
|
@ -285,6 +297,12 @@ export default {
|
||||||
if (success) {
|
if (success) {
|
||||||
this.sampleDetail = result
|
this.sampleDetail = result
|
||||||
this.changeChartByType('sample')
|
this.changeChartByType('sample')
|
||||||
|
|
||||||
|
this.$store.commit('ADD_SAMPLE_DATA', {
|
||||||
|
inputFileName,
|
||||||
|
data: result,
|
||||||
|
from: 'file'
|
||||||
|
})
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(message)
|
this.$message.error(message)
|
||||||
|
@ -435,13 +453,24 @@ export default {
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
sample: {
|
sample: {
|
||||||
handler(newVal, oldVal) {
|
async handler(newVal, oldVal) {
|
||||||
this.resultDisplay = []
|
this.resultDisplay = []
|
||||||
|
const sampleData = await this.$store.dispatch('GET_SAMPLE_DATA', newVal.inputFileName)
|
||||||
|
if(sampleData) {
|
||||||
|
const { data, from } = sampleData
|
||||||
|
this.sampleDetail = data
|
||||||
|
this.changeChartByType('sample')
|
||||||
|
if(from == 'db') {
|
||||||
|
this.sampleDetail = data
|
||||||
|
this.emitGetFiles(data)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (newVal.sampleId) {
|
if (newVal.sampleId) {
|
||||||
this.getSampleDetail()
|
this.getSampleDetail()
|
||||||
} else {
|
} else {
|
||||||
this.getSampleDetail_file()
|
this.getSampleDetail_file()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
immediate: true,
|
immediate: true,
|
||||||
deep: true,
|
deep: true,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { deleteAction } from '@/api/manage'
|
import { deleteAction } from '@/api/manage'
|
||||||
|
import store from '@/store'
|
||||||
/**
|
/**
|
||||||
* 发起请求清理后端对sample的缓存
|
* 发起请求清理后端对sample的缓存
|
||||||
* @param {Array<any>} sampleList
|
* @param {Array<any>} sampleList
|
||||||
|
@ -13,5 +14,6 @@ export const clearSampleCache = (sampleList) => {
|
||||||
params = { sampleFileName , qcFileName }
|
params = { sampleFileName , qcFileName }
|
||||||
}
|
}
|
||||||
deleteAction(url, params)
|
deleteAction(url, params)
|
||||||
|
store.commit('REMOVE_SAMPLE_DATA', fileName)
|
||||||
})
|
})
|
||||||
}
|
}
|
|
@ -706,7 +706,7 @@ export default {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const { sampleId, dbName, sampleFileName, detFileName } = this.sampleData
|
const { sampleId, dbName, inputFileName: sampleFileName, detFileName } = this.newSampleData
|
||||||
try {
|
try {
|
||||||
const params = {
|
const params = {
|
||||||
sampleId,
|
sampleId,
|
||||||
|
|
|
@ -3,16 +3,16 @@
|
||||||
<a-spin :spinning="isLoading">
|
<a-spin :spinning="isLoading">
|
||||||
<a-tabs :animated="false" @change="handleTabChange">
|
<a-tabs :animated="false" @change="handleTabChange">
|
||||||
<a-tab-pane tab="Sample Spectrum" :key="1">
|
<a-tab-pane tab="Sample Spectrum" :key="1">
|
||||||
<pre>{{ content.sample.join('\n') }}</pre>
|
<pre>{{ content.sample && content.sample.join('\n') }}</pre>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
<a-tab-pane tab="GasBg Spectrum" :key="2">
|
<a-tab-pane tab="GasBg Spectrum" :key="2">
|
||||||
<pre>{{ content.gasBg.join('\n') }}</pre>
|
<pre>{{ content.gasBg && content.gasBg.join('\n') }}</pre>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
<a-tab-pane tab="DetBg Spectrum" :key="3">
|
<a-tab-pane tab="DetBg Spectrum" :key="3">
|
||||||
<pre>{{ content.detBg.join('\n') }}</pre>
|
<pre>{{ content.detBg && content.detBg.join('\n') }}</pre>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
<a-tab-pane tab="QC Spectrum" :key="4">
|
<a-tab-pane tab="QC Spectrum" :key="4">
|
||||||
<pre>{{ content.qc.join('\n') }}</pre>
|
<pre>{{ content.qc && content.qc.join('\n') }}</pre>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
</a-tabs>
|
</a-tabs>
|
||||||
</a-spin>
|
</a-spin>
|
||||||
|
@ -28,13 +28,9 @@
|
||||||
<script>
|
<script>
|
||||||
import ModalMixin from '@/mixins/ModalMixin'
|
import ModalMixin from '@/mixins/ModalMixin'
|
||||||
import { getAction } from '../../../../../api/manage'
|
import { getAction } from '../../../../../api/manage'
|
||||||
|
import SampleDataMixin from '@/views/spectrumAnalysis/SampleDataMixin'
|
||||||
export default {
|
export default {
|
||||||
mixins: [ModalMixin],
|
mixins: [ModalMixin, SampleDataMixin],
|
||||||
props: {
|
|
||||||
sampleId: {
|
|
||||||
type: Number
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
content: {
|
content: {
|
||||||
|
@ -52,13 +48,21 @@ export default {
|
||||||
async getContent() {
|
async getContent() {
|
||||||
try {
|
try {
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
const res = await getAction('/spectrumAnalysis/viewSpectrum', {
|
const { sampleId, dbName, sampleFileName, gasFileName, detFileName, qcFileName } = this.newSampleData
|
||||||
sampleId: this.sampleId
|
const { success, result, message } = await getAction('/spectrumAnalysis/viewSpectrum', {
|
||||||
|
sampleId,
|
||||||
|
dbName,
|
||||||
|
sampleFileName,
|
||||||
|
gasFileName,
|
||||||
|
detFileName,
|
||||||
|
qcFileName
|
||||||
})
|
})
|
||||||
if (res.success) {
|
if (success) {
|
||||||
this.content = res.result
|
if(result) {
|
||||||
|
this.content = result
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(res.message)
|
this.$message.error(message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
@ -68,9 +72,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeModalOpen() {
|
beforeModalOpen() {
|
||||||
if (this.sampleId) {
|
|
||||||
this.getContent()
|
this.getContent()
|
||||||
}
|
|
||||||
},
|
},
|
||||||
handleTabChange(key) {
|
handleTabChange(key) {
|
||||||
this.currTab = key
|
this.currTab = key
|
||||||
|
|
|
@ -140,7 +140,6 @@ import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||||
import StripModal from './components/Modals/StripModal.vue'
|
import StripModal from './components/Modals/StripModal.vue'
|
||||||
import { FilePicker } from '@/utils/FilePicker'
|
import { FilePicker } from '@/utils/FilePicker'
|
||||||
import { zipFile } from '@/utils/file'
|
import { zipFile } from '@/utils/file'
|
||||||
import { mapMutations } from 'vuex'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
|
@ -532,6 +531,14 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
dataProcess(result, flag) {
|
dataProcess(result, flag) {
|
||||||
|
const { inputFileName } = this.sample
|
||||||
|
|
||||||
|
this.$store.commit('ADD_SAMPLE_DATA', {
|
||||||
|
inputFileName,
|
||||||
|
data: result,
|
||||||
|
from: flag,
|
||||||
|
})
|
||||||
|
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
@ -562,7 +569,7 @@ export default {
|
||||||
this.detailedInfomation = DetailedInformation
|
this.detailedInfomation = DetailedInformation
|
||||||
this.qcFlags = QCFlag
|
this.qcFlags = QCFlag
|
||||||
|
|
||||||
if(peak) {
|
if (peak) {
|
||||||
this.peakList = peak
|
this.peakList = peak
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1576,6 +1583,9 @@ export default {
|
||||||
this.option.xAxis.name = 'Channel'
|
this.option.xAxis.name = 'Channel'
|
||||||
this.option.yAxis.type = 'log'
|
this.option.yAxis.type = 'log'
|
||||||
this.thumbnailOption.yAxis.type = 'log'
|
this.thumbnailOption.yAxis.type = 'log'
|
||||||
|
|
||||||
|
this.option.series[0].markLine.data[0].xAxis = -1
|
||||||
|
this.setChartBottomTitle(0, 0, 0)
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1697,8 +1707,6 @@ export default {
|
||||||
const arrFunc = isList ? Array.prototype.filter : Array.prototype.find
|
const arrFunc = isList ? Array.prototype.filter : Array.prototype.find
|
||||||
return arrFunc.call(allData, (item) => item.name == name && item.group == group) || {}
|
return arrFunc.call(allData, (item) => item.name == name && item.group == group) || {}
|
||||||
},
|
},
|
||||||
|
|
||||||
...mapMutations(['ADD_SAMPLE_DATA', 'GET_SAMPLE_DATA']),
|
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
currStep: {
|
currStep: {
|
||||||
|
@ -1711,13 +1719,13 @@ export default {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
},
|
},
|
||||||
sample: {
|
sample: {
|
||||||
handler(newVal, oldVal) {
|
async handler(newVal, oldVal) {
|
||||||
console.log('newValnewVal', newVal)
|
console.log('newValnewVal', newVal)
|
||||||
this.graphAssistance.axisType = 'Channel'
|
this.graphAssistance.axisType = 'Channel'
|
||||||
this.handleResetState()
|
this.handleResetState()
|
||||||
const sampleData = this.GET_SAMPLE_DATA(newVal.inputFileName)
|
const sampleData = await this.$store.dispatch('GET_SAMPLE_DATA', newVal.inputFileName)
|
||||||
if (sampleData) {
|
if (sampleData) {
|
||||||
console.log('%c [ ]-1521', 'font-size:13px; background:pink; color:#bf2c9f;', sampleData)
|
this.dataProcess(sampleData.data, sampleData.from)
|
||||||
} else {
|
} else {
|
||||||
if (newVal.sampleId) {
|
if (newVal.sampleId) {
|
||||||
this.getSampleDetail()
|
this.getSampleDetail()
|
||||||
|
|
|
@ -174,7 +174,7 @@
|
||||||
<!-- Beta-Gamma 的 Extrapolation 弹窗结束 -->
|
<!-- Beta-Gamma 的 Extrapolation 弹窗结束 -->
|
||||||
|
|
||||||
<!-- Beta-Gamma 的 Spectrum 弹窗 -->
|
<!-- Beta-Gamma 的 Spectrum 弹窗 -->
|
||||||
<beta-gamma-spectrum-modal v-model="betaGammaSpectrumModalVisible" :sampleId="this.sampleData.sampleId" />
|
<beta-gamma-spectrum-modal v-model="betaGammaSpectrumModalVisible" />
|
||||||
<!-- Beta-Gamma 的 Spectrum 弹窗 结束 -->
|
<!-- Beta-Gamma 的 Spectrum 弹窗 结束 -->
|
||||||
|
|
||||||
<!-- Beta-Gamma 的 Sample Infomation 弹窗 -->
|
<!-- Beta-Gamma 的 Sample Infomation 弹窗 -->
|
||||||
|
@ -415,10 +415,10 @@ export default {
|
||||||
},
|
},
|
||||||
getStationName(arg, val, flag) {
|
getStationName(arg, val, flag) {
|
||||||
arg.forEach((item) => {
|
arg.forEach((item) => {
|
||||||
item.conc = item.conc.toFixed(6)
|
item.conc = Number(item.conc).toFixed(6)
|
||||||
item.concErr = item.concErr.toFixed(6)
|
item.concErr = Number(item.concErr).toFixed(6)
|
||||||
item.lc = item.lc.toFixed(6)
|
item.lc = Number(item.lc).toFixed(6)
|
||||||
item.mdc = item.mdc.toFixed(6)
|
item.mdc = Number(item.mdc).toFixed(6)
|
||||||
})
|
})
|
||||||
this.resultDisplayFlag = arg
|
this.resultDisplayFlag = arg
|
||||||
this.params_toDB.stationName = val
|
this.params_toDB.stationName = val
|
||||||
|
|
Loading…
Reference in New Issue
Block a user