2023-07-13 19:18:23 +08:00
|
|
|
<template>
|
|
|
|
<custom-modal v-model="visible" :width="1000" title="Data Processing Log">
|
2023-08-31 09:59:14 +08:00
|
|
|
<a-spin :spinning="isLoading">
|
|
|
|
<pre class="data-processing-log">{{ text }}</pre>
|
|
|
|
</a-spin>
|
2023-09-06 15:12:15 +08:00
|
|
|
<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>
|
2023-07-13 19:18:23 +08:00
|
|
|
</custom-modal>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import ModalMixin from '@/mixins/ModalMixin'
|
2023-08-31 09:59:14 +08:00
|
|
|
import { getAction } from '@/api/manage'
|
2023-09-05 16:31:09 +08:00
|
|
|
import { saveAs } from 'file-saver';
|
2023-09-05 19:06:19 +08:00
|
|
|
import SampleDataMixin from '../../SampleDataMixin'
|
2023-07-13 19:18:23 +08:00
|
|
|
export default {
|
2023-09-05 19:06:19 +08:00
|
|
|
mixins: [ModalMixin, SampleDataMixin],
|
2023-07-13 19:18:23 +08:00
|
|
|
data() {
|
|
|
|
return {
|
2023-08-31 09:59:14 +08:00
|
|
|
text: "",
|
|
|
|
isLoading: false,
|
2023-09-06 15:12:15 +08:00
|
|
|
fileName: ''
|
2023-08-31 09:59:14 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
beforeModalOpen() {
|
|
|
|
this.getViewGammaviewerLog();
|
|
|
|
},
|
|
|
|
getViewGammaviewerLog() {
|
|
|
|
this.isLoading = true
|
2023-09-05 19:06:19 +08:00
|
|
|
const { sampleId, inputFileName: fileName } = this.sampleData
|
2023-08-31 09:59:14 +08:00
|
|
|
let params = {
|
2023-09-05 19:06:19 +08:00
|
|
|
sampleId,
|
|
|
|
fileName
|
2023-08-31 09:59:14 +08:00
|
|
|
}
|
2023-09-07 14:48:09 +08:00
|
|
|
getAction("/gamma/viewGammaViewerLog", params).then(res => {
|
2023-08-31 09:59:14 +08:00
|
|
|
this.isLoading = false
|
|
|
|
if (res.success) {
|
|
|
|
this.text = res.result
|
|
|
|
} else {
|
2023-09-06 17:48:47 +08:00
|
|
|
this.text = ""
|
2023-08-31 09:59:14 +08:00
|
|
|
this.$message.warning("This operation fails. Contact your system administrator")
|
|
|
|
}
|
|
|
|
})
|
2023-09-05 16:31:09 +08:00
|
|
|
},
|
|
|
|
handleOk() {
|
2023-09-07 18:17:24 +08:00
|
|
|
this.fileName=""
|
2023-09-06 17:48:47 +08:00
|
|
|
if (this.text) {
|
|
|
|
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: 'Cancle',
|
|
|
|
cancelText: 'Save',
|
|
|
|
okButtonProps: {style: {backgroundColor: "#b98326", color: "#fff", borderColor: "transparent"}},
|
|
|
|
cancelButtonProps: {style: {color: "#fff", backgroundColor: "#31aab0", borderColor: "transparent"}},
|
|
|
|
onOk() {
|
|
|
|
console.log('Cancel');
|
|
|
|
},
|
|
|
|
onCancel() {
|
|
|
|
if (_this.fileName) {
|
|
|
|
saveAs(strData, `${_this.fileName}.txt`)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
this.$message.warning("No data can be saved!")
|
|
|
|
}
|
2023-07-13 19:18:23 +08:00
|
|
|
}
|
2023-08-31 09:59:14 +08:00
|
|
|
},
|
2023-07-13 19:18:23 +08:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
.data-processing-log {
|
2023-08-31 09:59:14 +08:00
|
|
|
height: 450px;
|
2023-07-17 19:37:46 +08:00
|
|
|
max-height: 450px;
|
2023-07-13 19:18:23 +08:00
|
|
|
padding: 5px;
|
|
|
|
overflow: auto;
|
|
|
|
background-color: #285367;
|
|
|
|
}
|
|
|
|
</style>
|