feat: 增加SAVE上的loading,增加BG log viewer弹窗
This commit is contained in:
parent
3ae3dee3d2
commit
9eeb9435b5
|
@ -0,0 +1,67 @@
|
|||
<template>
|
||||
<custom-modal v-model="visible" title="BetaGamma Analyser Log" :width="800">
|
||||
<a-spin :spinning="isLoading">
|
||||
<a-textarea class="bg-log-viewer" v-model="content"></a-textarea>
|
||||
</a-spin>
|
||||
<div slot="custom-footer">
|
||||
<a-button type="primary" @click="handleClick">Save As</a-button>
|
||||
</div>
|
||||
</custom-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ModalMixin from '@/mixins/ModalMixin'
|
||||
import { getAction } from '@/api/manage'
|
||||
import SampleDataMixin from '@/views/spectrumAnalysis/SampleDataMixin'
|
||||
import { showSaveFileModal } from '@/utils/file'
|
||||
export default {
|
||||
mixins: [ModalMixin, SampleDataMixin],
|
||||
data() {
|
||||
return {
|
||||
content: '',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getDetail() {
|
||||
try {
|
||||
this.isLoading = true
|
||||
const { dbName, sampleId, sampleFileName, gasFileName, detFileName, qcFileName } = this.newSampleData
|
||||
const { success, result, message } = await getAction('/spectrumAnalysis/viewBGLogViewer', {
|
||||
dbName,
|
||||
sampleId,
|
||||
sampleFileName,
|
||||
gasFileName,
|
||||
detFileName,
|
||||
qcFileName,
|
||||
})
|
||||
if (success) {
|
||||
console.log('%c [ ]-21', 'font-size:13px; background:pink; color:#bf2c9f;', result)
|
||||
this.content = 'test'
|
||||
} else {
|
||||
this.$message.error(message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
this.isLoading = false
|
||||
}
|
||||
},
|
||||
|
||||
beforeModalOpen() {
|
||||
this.getDetail()
|
||||
},
|
||||
|
||||
handleClick() {
|
||||
const blob = new Blob([this.content], { type: 'text/plain' })
|
||||
showSaveFileModal(blob, 'txt')
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.bg-log-viewer {
|
||||
height: 400px;
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
|
@ -10,7 +10,10 @@
|
|||
:overlay-style="operation.style"
|
||||
:key="operation.title"
|
||||
>
|
||||
<a-button type="primary">{{ operation.title }}</a-button>
|
||||
<a-button type="primary">
|
||||
<a-icon type="loading" v-if="operation.loading"></a-icon>
|
||||
{{ operation.title }}
|
||||
</a-button>
|
||||
<div slot="overlay">
|
||||
<template v-for="(child, index) in operation.children">
|
||||
<component v-if="child.show !== false" :is="child.type" :key="index" v-bind="child.attrs" v-on="child.on">
|
||||
|
@ -197,6 +200,7 @@
|
|||
<!-- Beta-Gamma 的 Statistics Paramer History 弹窗 -->
|
||||
<statistics-paramer-history-modal v-model="statisticsParamerHistoryModalVisible" />
|
||||
<!-- Beta-Gamma 的 Statistics Paramer History 弹窗 结束 -->
|
||||
<bg-log-viewer v-model="bgLogViewerVisible" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
|
@ -240,6 +244,7 @@ import BetaGammaExtrapolationModal from './components/Modals/BetaGammaModals/Bet
|
|||
import { getAction } from '@/api/manage'
|
||||
import { clearSampleCache } from './clearSampleCache'
|
||||
import { fetchAndDownload } from '@/utils/file'
|
||||
import BGLogViewer from './components/Modals/BetaGammaModals/BGLogViewer.vue'
|
||||
|
||||
// 分析类型
|
||||
const ANALYZE_TYPE = {
|
||||
|
@ -284,6 +289,7 @@ export default {
|
|||
BetaGammaEnergyCalibrationModal,
|
||||
AutomaticAnalysisLogModal,
|
||||
BetaGammaExtrapolationModal,
|
||||
BgLogViewer: BGLogViewer,
|
||||
},
|
||||
|
||||
provide() {
|
||||
|
@ -361,6 +367,7 @@ export default {
|
|||
betaGammaQCResultsModalVisible: false, // beta-gamma QC Result 弹窗
|
||||
betaGammaRlrModalVisible: false, // beta-gamma RLR 弹窗
|
||||
statisticsParamerHistoryModalVisible: false, // beta-gamma Statistics Paramer History 弹窗
|
||||
bgLogViewerVisible: false, // beta-gamma Log 下的BG log viewer 弹窗
|
||||
analyseCurrentSpectrumData: {},
|
||||
resultDisplayFlag: [],
|
||||
params_toDB: {
|
||||
|
@ -388,6 +395,8 @@ export default {
|
|||
updateFlag: '2',
|
||||
isReAnalyed_gamma: false,
|
||||
isReAnalyed_beta: false,
|
||||
|
||||
isSaving: false,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
@ -494,12 +503,19 @@ export default {
|
|||
|
||||
// 保存结果到文件, 服务端生成文件,前端下载
|
||||
async handleSaveResultsToFile(saveFormat) {
|
||||
this.isSaving = true
|
||||
if (this.isGamma) {
|
||||
const url = saveFormat == 'xls' ? '/gamma/saveToExcel' : saveFormat == 'txt' ? '/gamma/saveToTxt' : ''
|
||||
let params = {
|
||||
fileName: this.newSampleData.inputFileName,
|
||||
}
|
||||
fetchAndDownload(url, params, 'get')
|
||||
try {
|
||||
await fetchAndDownload(url, params, 'get')
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
this.isSaving = false
|
||||
}
|
||||
}
|
||||
if (this.isBetaGamma) {
|
||||
const url =
|
||||
|
@ -524,8 +540,13 @@ export default {
|
|||
this.params_toDB.detFileName = this.newSampleData.detFileName
|
||||
this.params_toDB.qcFileName = this.newSampleData.qcFileName
|
||||
this.params_toDB.dbName = this.newSampleData.dbName
|
||||
|
||||
fetchAndDownload(url, this.params_toDB)
|
||||
try {
|
||||
await fetchAndDownload(url, this.params_toDB)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
this.isSaving = false
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -803,6 +824,7 @@ export default {
|
|||
},
|
||||
{
|
||||
title: 'SAVE',
|
||||
loading: this.isSaving,
|
||||
children: [
|
||||
{
|
||||
type: 'MultiLevelMenu',
|
||||
|
@ -1197,7 +1219,9 @@ export default {
|
|||
type: 'a-menu-item',
|
||||
title: 'BG log viewer',
|
||||
show: this.isBetaGamma,
|
||||
handler: () => {},
|
||||
handler: () => {
|
||||
this.bgLogViewerVisible = true
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'a-menu-item',
|
||||
|
|
Loading…
Reference in New Issue
Block a user