AnalysisSystemForRadionucli.../src/views/spectrumAnalysis/components/Modals/DataProcessingLogModal.vue

85 lines
2.1 KiB
Vue
Raw Normal View History

<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';
export default {
mixins: [ModalMixin],
props: {
sampleId: {
type: Number
}
},
data() {
return {
text: "",
isLoading: false,
fileName: ''
}
},
methods: {
beforeModalOpen() {
this.getViewGammaviewerLog();
},
getViewGammaviewerLog() {
this.isLoading = true
let params = {
sampleId: this.sampleId,
fileName:"CAX05_001-20230731_1528_S_FULL_37563.6.PHD"
}
getAction("/gamma/viewGammaviewerLog", params).then(res => {
this.isLoading = false
if (res.success) {
this.text = res.result
} else {
this.$message.warning("This operation fails. Contact your system administrator")
}
})
},
handleOk() {
let strData = new Blob([this.text], { type: 'text/plain;charset=utf-8' });
// saveAs(strData, `GammaViewer Log.txt`)
let _this = this
this.$confirm({
title: 'Please enter file name',
content: h => <a-input v-model={_this.fileName} />,
okText: 'Save',
cancelText: 'Cancle',
onOk() {
if (_this.fileName) {
_this.visible = false
saveAs(strData, `${_this.fileName}.txt`)
}
},
onCancel() {
console.log('Cancel');
},
});
}
},
}
</script>
<style lang="less" scoped>
.data-processing-log {
height: 450px;
max-height: 450px;
padding: 5px;
overflow: auto;
background-color: #285367;
}
</style>