fix: 优化、修改某些代码
This commit is contained in:
parent
bdaf65ca99
commit
0c06c5af79
|
@ -133,6 +133,7 @@ import BetaGammaQcFlags from './components/SubOperators/BetaGammaQcFlags.vue'
|
||||||
import PopOverWithIcon from './components/SubOperators/PopOverWithIcon.vue'
|
import PopOverWithIcon from './components/SubOperators/PopOverWithIcon.vue'
|
||||||
import Spectra from './components/SubOperators/Spectra.vue'
|
import Spectra from './components/SubOperators/Spectra.vue'
|
||||||
import CustomSelect from '@/components/CustomSelect/index.vue'
|
import CustomSelect from '@/components/CustomSelect/index.vue'
|
||||||
|
import axios from 'axios'
|
||||||
|
|
||||||
const StatisticsType = {
|
const StatisticsType = {
|
||||||
'Collection Time': 'Colloc_Time',
|
'Collection Time': 'Colloc_Time',
|
||||||
|
@ -219,6 +220,9 @@ export default {
|
||||||
currSample: {},
|
currSample: {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
destroyed() {
|
||||||
|
this.cancelLastRequest()
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleGetFlag(val, obj) {
|
handleGetFlag(val, obj) {
|
||||||
this.resultDisplay.forEach((item) => {
|
this.resultDisplay.forEach((item) => {
|
||||||
|
@ -234,10 +238,16 @@ export default {
|
||||||
const { dbName, sampleId } = this.sample
|
const { dbName, sampleId } = this.sample
|
||||||
try {
|
try {
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
const { success, result, message } = await getAction('/spectrumAnalysis/getDBSpectrumChart', {
|
this.cancelLastRequest()
|
||||||
|
const cancelToken = this.createCancelToken()
|
||||||
|
const { success, result, message } = await getAction(
|
||||||
|
'/spectrumAnalysis/getDBSpectrumChart',
|
||||||
|
{
|
||||||
dbName,
|
dbName,
|
||||||
sampleId,
|
sampleId,
|
||||||
})
|
},
|
||||||
|
cancelToken
|
||||||
|
)
|
||||||
if (success) {
|
if (success) {
|
||||||
this.sampleDetail = result
|
this.sampleDetail = result
|
||||||
this.changeChartByType('sample')
|
this.changeChartByType('sample')
|
||||||
|
@ -264,7 +274,13 @@ export default {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
const { success, result, message } = await getAction('/spectrumAnalysis/getFileSpectrumChart', params)
|
this.cancelLastRequest()
|
||||||
|
const cancelToken = this.createCancelToken()
|
||||||
|
const { success, result, message } = await getAction(
|
||||||
|
'/spectrumAnalysis/getFileSpectrumChart',
|
||||||
|
params,
|
||||||
|
cancelToken
|
||||||
|
)
|
||||||
if (success) {
|
if (success) {
|
||||||
this.sampleDetail = result
|
this.sampleDetail = result
|
||||||
this.changeChartByType('sample')
|
this.changeChartByType('sample')
|
||||||
|
@ -277,6 +293,19 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
cancelLastRequest() {
|
||||||
|
if (this._cancelToken && typeof this._cancelToken == 'function') {
|
||||||
|
this._cancelToken()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
createCancelToken() {
|
||||||
|
const cancelToken = new axios.CancelToken((c) => {
|
||||||
|
this._cancelToken = c
|
||||||
|
})
|
||||||
|
return cancelToken
|
||||||
|
},
|
||||||
|
|
||||||
changeChartByType(val) {
|
changeChartByType(val) {
|
||||||
if (val === 'qc' && !this.sample.qcFileStatus) {
|
if (val === 'qc' && !this.sample.qcFileStatus) {
|
||||||
this.$message.warning('No qc spectrum file!')
|
this.$message.warning('No qc spectrum file!')
|
||||||
|
|
|
@ -411,8 +411,7 @@ export default {
|
||||||
|
|
||||||
// 改为不可刷选状态
|
// 改为不可刷选状态
|
||||||
chart.dispatchAction({
|
chart.dispatchAction({
|
||||||
type: 'takeGlobalCursor',
|
type: 'takeGlobalCursor'
|
||||||
rushOption: false
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<a-spin :spinning="isLoading">
|
<a-spin :spinning="isLoading">
|
||||||
<pre>{{ content }}</pre>
|
<pre>{{ content }}</pre>
|
||||||
</a-spin>
|
</a-spin>
|
||||||
<div slot="custom-footer" style="text-align: center;">
|
<div slot="custom-footer" style="text-align: center">
|
||||||
<a-space :size="20">
|
<a-space :size="20">
|
||||||
<a-button type="primary" @click="handleOk">Export</a-button>
|
<a-button type="primary" @click="handleOk">Export</a-button>
|
||||||
<a-button @click="visible = false">Cancel</a-button>
|
<a-button @click="visible = false">Cancel</a-button>
|
||||||
|
@ -14,25 +14,25 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ModalMixin from '@/mixins/ModalMixin'
|
import ModalMixin from '@/mixins/ModalMixin'
|
||||||
import { getAction } from '../../../../api/manage'
|
import { getAction, postAction } from '../../../../api/manage'
|
||||||
import { saveAs } from 'file-saver';
|
import { saveAs } from 'file-saver'
|
||||||
import SampleDataMixin from '../../SampleDataMixin'
|
import SampleDataMixin from '../../SampleDataMixin'
|
||||||
export default {
|
export default {
|
||||||
mixins: [ModalMixin, SampleDataMixin],
|
mixins: [ModalMixin, SampleDataMixin],
|
||||||
props: {
|
props: {
|
||||||
type: {
|
type: {
|
||||||
type: Number
|
type: Number,
|
||||||
},
|
},
|
||||||
extraData: {
|
extraData: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => ({})
|
default: () => ({}),
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
content: '',
|
content: '',
|
||||||
isLoading: true,
|
isLoading: true,
|
||||||
fileName: ''
|
fileName: '',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -56,15 +56,22 @@ export default {
|
||||||
this.content = ''
|
this.content = ''
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
const { sampleId, inputFileName: fileName } = this.sampleData
|
const { sampleId, inputFileName: fileName } = this.sampleData
|
||||||
const res = await getAction(url, {
|
const method = this.type == 4? postAction : getAction
|
||||||
|
const res = await method(url, {
|
||||||
sampleId,
|
sampleId,
|
||||||
fileName,
|
fileName,
|
||||||
...this.extraData
|
...this.extraData,
|
||||||
})
|
})
|
||||||
if (res.success) {
|
|
||||||
this.content = res.result
|
if (typeof res == 'string') {
|
||||||
|
this.content = res
|
||||||
} else {
|
} else {
|
||||||
this.content = ""
|
const { success, result, message } = res
|
||||||
|
if (success) {
|
||||||
|
this.content = result
|
||||||
|
} else {
|
||||||
|
this.$message.error(message)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
@ -77,9 +84,9 @@ export default {
|
||||||
this.getContent()
|
this.getContent()
|
||||||
},
|
},
|
||||||
handleOk() {
|
handleOk() {
|
||||||
this.fileName=""
|
this.fileName = ''
|
||||||
if (this.content) {
|
if (this.content) {
|
||||||
let strData = new Blob([this.content], { type: 'text/plain;charset=utf-8' });
|
let strData = new Blob([this.content], { type: 'text/plain;charset=utf-8' })
|
||||||
// if (this.type == 1 || this.type == 3) {
|
// if (this.type == 1 || this.type == 3) {
|
||||||
// saveAs(strData, `${this.type == 1 ?'Gamma-':'Beta-'} ARR.txt`)
|
// saveAs(strData, `${this.type == 1 ?'Gamma-':'Beta-'} ARR.txt`)
|
||||||
// } else {
|
// } else {
|
||||||
|
@ -88,25 +95,25 @@ export default {
|
||||||
let _this = this
|
let _this = this
|
||||||
this.$confirm({
|
this.$confirm({
|
||||||
title: 'Please enter file name',
|
title: 'Please enter file name',
|
||||||
content: h => <a-input v-model={_this.fileName} />,
|
content: (h) => <a-input v-model={_this.fileName} />,
|
||||||
okText: 'Cancle',
|
okText: 'Cancle',
|
||||||
cancelText: 'Save',
|
cancelText: 'Save',
|
||||||
okButtonProps: {style: {backgroundColor: "#b98326", color: "#fff", borderColor: "transparent"}},
|
okButtonProps: { style: { backgroundColor: '#b98326', color: '#fff', borderColor: 'transparent' } },
|
||||||
cancelButtonProps: {style: {color: "#fff", backgroundColor: "#31aab0", borderColor: "transparent"}},
|
cancelButtonProps: { style: { color: '#fff', backgroundColor: '#31aab0', borderColor: 'transparent' } },
|
||||||
onOk() {
|
onOk() {
|
||||||
console.log('Cancel');
|
console.log('Cancel')
|
||||||
},
|
},
|
||||||
onCancel() {
|
onCancel() {
|
||||||
if (_this.fileName) {
|
if (_this.fileName) {
|
||||||
saveAs(strData, `${_this.fileName}.txt`)
|
saveAs(strData, `${_this.fileName}.txt`)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
this.$message.warning("No data can be saved!")
|
this.$message.warning('No data can be saved!')
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -451,6 +451,14 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
beforeModalOpen() {
|
beforeModalOpen() {
|
||||||
this.customToolTip.visible = false
|
this.customToolTip.visible = false
|
||||||
|
const gammaSeries = this.gammaSpectrumChartOption.series
|
||||||
|
gammaSeries[0].data = []
|
||||||
|
gammaSeries[1].data = []
|
||||||
|
|
||||||
|
const betaSeries = this.betaSpectrumChartOption.series
|
||||||
|
betaSeries[0].data = []
|
||||||
|
betaSeries[1].data = []
|
||||||
|
|
||||||
this.getDetail()
|
this.getDetail()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -202,6 +202,8 @@ export default {
|
||||||
this.$bus.$on('accept', this.handleAccept)
|
this.$bus.$on('accept', this.handleAccept)
|
||||||
},
|
},
|
||||||
destroyed() {
|
destroyed() {
|
||||||
|
this.cancelLastRequest()
|
||||||
|
|
||||||
this.$bus.$off('colorChange', this.handleColorChange)
|
this.$bus.$off('colorChange', this.handleColorChange)
|
||||||
this.$bus.$off('gammaRefresh', this.handleRefresh)
|
this.$bus.$off('gammaRefresh', this.handleRefresh)
|
||||||
this.$bus.$off('accept', this.handleAccept)
|
this.$bus.$off('accept', this.handleAccept)
|
||||||
|
@ -219,8 +221,8 @@ export default {
|
||||||
this.handleResetState()
|
this.handleResetState()
|
||||||
|
|
||||||
// const { success, result, message } = Response
|
// const { success, result, message } = Response
|
||||||
|
this.cancelLastRequest()
|
||||||
const cancelToken = this.cancelLastRequest()
|
const cancelToken = this.createCancelToken()
|
||||||
|
|
||||||
const { success, result, message } = await getAction(
|
const { success, result, message } = await getAction(
|
||||||
'/gamma/gammaByDB',
|
'/gamma/gammaByDB',
|
||||||
|
@ -247,7 +249,9 @@ export default {
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
this.handleResetState()
|
this.handleResetState()
|
||||||
// const { success, result, message } = Response
|
// const { success, result, message } = Response
|
||||||
const cancelToken = this.cancelLastRequest()
|
|
||||||
|
this.cancelLastRequest()
|
||||||
|
const cancelToken = this.createCancelToken()
|
||||||
|
|
||||||
const { success, result, message } = await getAction(
|
const { success, result, message } = await getAction(
|
||||||
'/gamma/gammaByFile',
|
'/gamma/gammaByFile',
|
||||||
|
@ -271,10 +275,13 @@ export default {
|
||||||
if (this._cancelToken && typeof this._cancelToken == 'function') {
|
if (this._cancelToken && typeof this._cancelToken == 'function') {
|
||||||
this._cancelToken()
|
this._cancelToken()
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
return new axios.CancelToken((c) => {
|
createCancelToken() {
|
||||||
|
const cancelToken = new axios.CancelToken((c) => {
|
||||||
this._cancelToken = c
|
this._cancelToken = c
|
||||||
})
|
})
|
||||||
|
return cancelToken
|
||||||
},
|
},
|
||||||
|
|
||||||
dataProsess(result) {
|
dataProsess(result) {
|
||||||
|
@ -1197,6 +1204,7 @@ export default {
|
||||||
this.option.series = []
|
this.option.series = []
|
||||||
this.option.xAxis.name = 'Channel'
|
this.option.xAxis.name = 'Channel'
|
||||||
this.option.yAxis.type = 'value'
|
this.option.yAxis.type = 'value'
|
||||||
|
this.thumbnailOption.yAxis.type = 'value'
|
||||||
|
|
||||||
if (this.option.series.length) {
|
if (this.option.series.length) {
|
||||||
const spectrumLineSeries = findSeriesByName(this.option.series, 'Spectrum')
|
const spectrumLineSeries = findSeriesByName(this.option.series, 'Spectrum')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user