73 lines
1.9 KiB
Vue
73 lines
1.9 KiB
Vue
<template>
|
|
<custom-modal v-model="visible" :width="1000" title="Data Processing Log">
|
|
<a-spin :spinning="isLoading">
|
|
<pre class="data-processing-log">{{ text }}</pre>
|
|
</a-spin>
|
|
<div slot="custom-footer" style="text-align: center">
|
|
<a-space :size="20">
|
|
<a-button type="primary" @click="handleOk">Export</a-button>
|
|
<a-button @click="visible = false">Cancel</a-button>
|
|
</a-space>
|
|
</div>
|
|
</custom-modal>
|
|
</template>
|
|
|
|
<script>
|
|
import ModalMixin from '@/mixins/ModalMixin'
|
|
import { getAction } from '@/api/manage'
|
|
import { saveAs } from 'file-saver'
|
|
import SampleDataMixin from '../../SampleDataMixin'
|
|
export default {
|
|
mixins: [ModalMixin, SampleDataMixin],
|
|
data() {
|
|
return {
|
|
text: '',
|
|
isLoading: false,
|
|
fileName: '',
|
|
}
|
|
},
|
|
methods: {
|
|
beforeModalOpen() {
|
|
this.getViewGammaviewerLog()
|
|
},
|
|
getViewGammaviewerLog() {
|
|
this.isLoading = true
|
|
const { sampleId, inputFileName: fileName } = this.sampleData
|
|
let params = {
|
|
sampleId,
|
|
fileName,
|
|
}
|
|
getAction('/gamma/viewGammaViewerLog', params).then((res) => {
|
|
this.isLoading = false
|
|
if (res.success) {
|
|
this.text = res.result
|
|
} else {
|
|
this.text = ''
|
|
this.$message.warning('This operation fails. Contact your system administrator')
|
|
}
|
|
})
|
|
},
|
|
handleOk() {
|
|
this.fileName = ''
|
|
if (this.text) {
|
|
let name = this.newSampleData.inputFileName.split('.')[0]
|
|
let strData = new Blob([this.text], { type: 'text/plain;charset=utf-8' })
|
|
saveAs(strData, `${name}_gamma analysis log.txt`)
|
|
} else {
|
|
this.$message.warning('No data can be saved!')
|
|
}
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="less" scoped>
|
|
.data-processing-log {
|
|
height: 450px;
|
|
max-height: 450px;
|
|
padding: 5px;
|
|
overflow: auto;
|
|
background-color: #285367;
|
|
}
|
|
</style>
|