fix: 优化部分组件性能
This commit is contained in:
parent
d8987d28c2
commit
628689fb45
|
@ -1,7 +1,7 @@
|
||||||
const sample = {
|
const sample = {
|
||||||
state: {
|
state: Object.freeze({
|
||||||
sampleList: [] // [{ inputFileName: String; data: Object; }]
|
sampleList: [] // [{ inputFileName: String; data: Object; }]
|
||||||
},
|
}),
|
||||||
mutations: {
|
mutations: {
|
||||||
SET_SAMPLE_LIST: (state, sampleList) => {
|
SET_SAMPLE_LIST: (state, sampleList) => {
|
||||||
state.sampleList = sampleList
|
state.sampleList = sampleList
|
||||||
|
|
|
@ -307,8 +307,8 @@ export default {
|
||||||
|
|
||||||
const { dbName, sampleId, inputFileName, analyst } = this.sample
|
const { dbName, sampleId, inputFileName, analyst } = this.sample
|
||||||
try {
|
try {
|
||||||
this.isLoading = true
|
|
||||||
this.cancelLastRequest()
|
this.cancelLastRequest()
|
||||||
|
this.isLoading = true
|
||||||
const cancelToken = this.createCancelToken()
|
const cancelToken = this.createCancelToken()
|
||||||
const { success, result, message } = await getAction(
|
const { success, result, message } = await getAction(
|
||||||
'/spectrumAnalysis/getDBSpectrumChart',
|
'/spectrumAnalysis/getDBSpectrumChart',
|
||||||
|
@ -320,6 +320,7 @@ export default {
|
||||||
cancelToken
|
cancelToken
|
||||||
)
|
)
|
||||||
if (success) {
|
if (success) {
|
||||||
|
this.isLoading = false
|
||||||
this.sampleDetail = result
|
this.sampleDetail = result
|
||||||
this.changeChartByType('sample')
|
this.changeChartByType('sample')
|
||||||
this.emitGetFiles(result)
|
this.emitGetFiles(result)
|
||||||
|
@ -334,8 +335,10 @@ export default {
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
} finally {
|
const isCancel = axios.isCancel(error)
|
||||||
this.isLoading = false
|
if(!isCancel) {
|
||||||
|
this.isLoading = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -356,8 +359,8 @@ export default {
|
||||||
qcFileName: this.sample.qcFileStatus ? this.sample.qcFileName : '',
|
qcFileName: this.sample.qcFileStatus ? this.sample.qcFileName : '',
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.isLoading = true
|
|
||||||
this.cancelLastRequest()
|
this.cancelLastRequest()
|
||||||
|
this.isLoading = true
|
||||||
const cancelToken = this.createCancelToken()
|
const cancelToken = this.createCancelToken()
|
||||||
const { success, result, message } = await getAction(
|
const { success, result, message } = await getAction(
|
||||||
'/spectrumAnalysis/getFileSpectrumChart',
|
'/spectrumAnalysis/getFileSpectrumChart',
|
||||||
|
@ -379,12 +382,17 @@ export default {
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
const isCancel = axios.isCancel(error)
|
||||||
|
if(!isCancel) {
|
||||||
|
this.isLoading = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
cancelLastRequest() {
|
cancelLastRequest() {
|
||||||
if (this._cancelToken && typeof this._cancelToken == 'function') {
|
if (this._cancelToken && typeof this._cancelToken == 'function') {
|
||||||
this._cancelToken()
|
this._cancelToken()
|
||||||
|
this._cancelToken = undefined
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -653,6 +661,8 @@ export default {
|
||||||
this.resultDisplay = []
|
this.resultDisplay = []
|
||||||
const sampleData = await this.$store.dispatch('GET_SAMPLE_DATA', newVal.inputFileName)
|
const sampleData = await this.$store.dispatch('GET_SAMPLE_DATA', newVal.inputFileName)
|
||||||
if (sampleData) {
|
if (sampleData) {
|
||||||
|
this.cancelLastRequest()
|
||||||
|
this.isLoading = false
|
||||||
const { data, from } = sampleData
|
const { data, from } = sampleData
|
||||||
this.sampleDetail = data
|
this.sampleDetail = data
|
||||||
this.changeChartByType('sample')
|
this.changeChartByType('sample')
|
||||||
|
|
|
@ -163,6 +163,36 @@ export default {
|
||||||
StripModal,
|
StripModal,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
this.channelData = {
|
||||||
|
peakGroup: [],
|
||||||
|
spectrumLine: null,
|
||||||
|
baseLine: null,
|
||||||
|
lcLine: null,
|
||||||
|
scacLine: null,
|
||||||
|
all: null,
|
||||||
|
baseLineCP: [],
|
||||||
|
|
||||||
|
compareLine: null,
|
||||||
|
stripSumOrCutLine: null,
|
||||||
|
stripReferenceLine: null,
|
||||||
|
}
|
||||||
|
|
||||||
|
this.energyData = {
|
||||||
|
peakGroup: [],
|
||||||
|
spectrumLine: null,
|
||||||
|
baseLine: null,
|
||||||
|
lcLine: null,
|
||||||
|
scacLine: null,
|
||||||
|
all: null,
|
||||||
|
baseLineCP: [],
|
||||||
|
|
||||||
|
compareLine: null,
|
||||||
|
stripSumOrCutLine: null,
|
||||||
|
stripReferenceLine: null,
|
||||||
|
}
|
||||||
|
;(this.peakList = []), // Peak 列表(非点位)
|
||||||
|
(this.baseCtrls = {}) // BaseCtrls
|
||||||
|
|
||||||
return {
|
return {
|
||||||
abc: false,
|
abc: false,
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
|
@ -183,35 +213,6 @@ export default {
|
||||||
qcFlagsVisible: false,
|
qcFlagsVisible: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
channelData: {
|
|
||||||
peakGroup: [],
|
|
||||||
spectrumLine: null,
|
|
||||||
baseLine: null,
|
|
||||||
lcLine: null,
|
|
||||||
scacLine: null,
|
|
||||||
all: null,
|
|
||||||
baseLineCP: [],
|
|
||||||
|
|
||||||
compareLine: null,
|
|
||||||
stripSumOrCutLine: null,
|
|
||||||
stripReferenceLine: null,
|
|
||||||
},
|
|
||||||
energyData: {
|
|
||||||
peakGroup: [],
|
|
||||||
spectrumLine: null,
|
|
||||||
baseLine: null,
|
|
||||||
lcLine: null,
|
|
||||||
scacLine: null,
|
|
||||||
all: null,
|
|
||||||
baseLineCP: [],
|
|
||||||
|
|
||||||
compareLine: null,
|
|
||||||
stripSumOrCutLine: null,
|
|
||||||
stripReferenceLine: null,
|
|
||||||
},
|
|
||||||
peakList: [], // Peak 列表(非点位)
|
|
||||||
baseCtrls: {}, // BaseCtrls
|
|
||||||
|
|
||||||
nuclideLibraryList: [], // 当前鼠标点击选中的channel
|
nuclideLibraryList: [], // 当前鼠标点击选中的channel
|
||||||
peakInfomationTooltip: {
|
peakInfomationTooltip: {
|
||||||
// Peak Infomation的位置
|
// Peak Infomation的位置
|
||||||
|
@ -251,6 +252,8 @@ export default {
|
||||||
|
|
||||||
window.addEventListener('keydown', this.handleKeyboardEvent)
|
window.addEventListener('keydown', this.handleKeyboardEvent)
|
||||||
window.addEventListener('click', this.closePeakInfomationTooltip)
|
window.addEventListener('click', this.closePeakInfomationTooltip)
|
||||||
|
|
||||||
|
console.log('%c [ this.channelData ]-256', 'font-size:13px; background:#e2a49d; color:#ffe8e1;', this.channelData)
|
||||||
},
|
},
|
||||||
destroyed() {
|
destroyed() {
|
||||||
this.cancelLastRequest()
|
this.cancelLastRequest()
|
||||||
|
@ -502,9 +505,9 @@ export default {
|
||||||
async getSampleDetail() {
|
async getSampleDetail() {
|
||||||
const { dbName, sampleId, analyst } = this.sample
|
const { dbName, sampleId, analyst } = this.sample
|
||||||
try {
|
try {
|
||||||
this.isLoading = true
|
|
||||||
// const { success, result, message } = Response
|
// const { success, result, message } = Response
|
||||||
this.cancelLastRequest()
|
this.cancelLastRequest()
|
||||||
|
this.isLoading = true
|
||||||
const cancelToken = this.createCancelToken()
|
const cancelToken = this.createCancelToken()
|
||||||
|
|
||||||
const { success, result, message } = await getAction(
|
const { success, result, message } = await getAction(
|
||||||
|
@ -516,7 +519,6 @@ export default {
|
||||||
},
|
},
|
||||||
cancelToken
|
cancelToken
|
||||||
)
|
)
|
||||||
console.log('%c [ result ]-243', 'font-size:13px; background:pink; color:#bf2c9f;', result)
|
|
||||||
if (success) {
|
if (success) {
|
||||||
this.dataProcess(result, 'db')
|
this.dataProcess(result, 'db')
|
||||||
} else {
|
} else {
|
||||||
|
@ -526,7 +528,7 @@ export default {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
const isCancel = axios.isCancel(error)
|
const isCancel = axios.isCancel(error)
|
||||||
if(!isCancel) {
|
if (!isCancel) {
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -535,10 +537,9 @@ export default {
|
||||||
async getSampleDetail_file() {
|
async getSampleDetail_file() {
|
||||||
const { inputFileName: fileName } = this.sample
|
const { inputFileName: fileName } = this.sample
|
||||||
try {
|
try {
|
||||||
this.isLoading = true
|
|
||||||
// const { success, result, message } = Response
|
// const { success, result, message } = Response
|
||||||
|
|
||||||
this.cancelLastRequest()
|
this.cancelLastRequest()
|
||||||
|
this.isLoading = true
|
||||||
const cancelToken = this.createCancelToken()
|
const cancelToken = this.createCancelToken()
|
||||||
|
|
||||||
const { success, result, message } = await getAction(
|
const { success, result, message } = await getAction(
|
||||||
|
@ -548,7 +549,6 @@ export default {
|
||||||
},
|
},
|
||||||
cancelToken
|
cancelToken
|
||||||
)
|
)
|
||||||
console.log('%c [ result ]-243', 'font-size:13px; background:pink; color:#bf2c9f;', result)
|
|
||||||
if (success) {
|
if (success) {
|
||||||
this.dataProcess(result, 'file')
|
this.dataProcess(result, 'file')
|
||||||
} else {
|
} else {
|
||||||
|
@ -557,7 +557,10 @@ export default {
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
this.isLoading = false
|
const isCancel = axios.isCancel(error)
|
||||||
|
if (!isCancel) {
|
||||||
|
this.isLoading = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -658,6 +661,8 @@ export default {
|
||||||
baseLineCP: shapeEnergyData,
|
baseLineCP: shapeEnergyData,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('%c [ this.channelData ]-664', 'font-size:13px; background:#9bcb26; color:#dfff6a;', this.channelData)
|
||||||
|
|
||||||
this.resetThumbnailChartDataMax()
|
this.resetThumbnailChartDataMax()
|
||||||
|
|
||||||
// 设置 Spectrum Line
|
// 设置 Spectrum Line
|
||||||
|
@ -2190,5 +2195,6 @@ export default {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
background-color: #55a9fe;
|
background-color: #55a9fe;
|
||||||
border-color: #55a9fe;
|
border-color: #55a9fe;
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -602,7 +602,6 @@ export default {
|
||||||
|
|
||||||
// 加载选中的样本
|
// 加载选中的样本
|
||||||
async loadSelectedSample(sample) {
|
async loadSelectedSample(sample) {
|
||||||
console.log('%c [ sample ]-381', 'font-size:13px; background:pink; color:red;', sample)
|
|
||||||
// B是beta-gamma P G是gamma
|
// B是beta-gamma P G是gamma
|
||||||
if (sample.sampleType == 'B') {
|
if (sample.sampleType == 'B') {
|
||||||
this.analysisType = ANALYZE_TYPE.BETA_GAMMA
|
this.analysisType = ANALYZE_TYPE.BETA_GAMMA
|
||||||
|
|
Loading…
Reference in New Issue
Block a user