BetaGamma Analyser Log 和之前一样 直接保存文件,不需要输入名称
This commit is contained in:
parent
c8c1c021ea
commit
b026200b25
|
@ -13,7 +13,7 @@
|
|||
import ModalMixin from '@/mixins/ModalMixin'
|
||||
import { getAction } from '@/api/manage'
|
||||
import SampleDataMixin from '@/views/spectrumAnalysis/SampleDataMixin'
|
||||
import { showSaveFileModal } from '@/utils/file'
|
||||
import { saveAs } from 'file-saver'
|
||||
export default {
|
||||
mixins: [ModalMixin, SampleDataMixin],
|
||||
data() {
|
||||
|
@ -25,7 +25,14 @@ export default {
|
|||
async getDetail() {
|
||||
try {
|
||||
this.isLoading = true
|
||||
const { dbName, sampleId, inputFileName: sampleFileName, gasFileName, detFileName, qcFileName } = this.newSampleData
|
||||
const {
|
||||
dbName,
|
||||
sampleId,
|
||||
inputFileName: sampleFileName,
|
||||
gasFileName,
|
||||
detFileName,
|
||||
qcFileName,
|
||||
} = this.newSampleData
|
||||
const result = await getAction('/spectrumAnalysis/viewBGLogViewer', {
|
||||
dbName,
|
||||
sampleId,
|
||||
|
@ -34,7 +41,7 @@ export default {
|
|||
detFileName,
|
||||
qcFileName,
|
||||
})
|
||||
if(typeof result == 'string') {
|
||||
if (typeof result == 'string') {
|
||||
this.content = result
|
||||
} else {
|
||||
const { success, result, message } = res
|
||||
|
@ -56,8 +63,9 @@ export default {
|
|||
},
|
||||
|
||||
handleClick() {
|
||||
let name = this.newSampleData.inputFileName.split('.')[0]
|
||||
const blob = new Blob([this.content], { type: 'text/plain' })
|
||||
showSaveFileModal(blob, 'txt')
|
||||
saveAs(blob, `${name}_beta analysis log.txt`)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<a-spin :spinning="isLoading">
|
||||
<pre class="data-processing-log">{{ text }}</pre>
|
||||
</a-spin>
|
||||
<div slot="custom-footer" style="text-align: center;">
|
||||
<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>
|
||||
|
@ -15,64 +15,48 @@
|
|||
<script>
|
||||
import ModalMixin from '@/mixins/ModalMixin'
|
||||
import { getAction } from '@/api/manage'
|
||||
import { saveAs } from 'file-saver';
|
||||
import { saveAs } from 'file-saver'
|
||||
import SampleDataMixin from '../../SampleDataMixin'
|
||||
export default {
|
||||
mixins: [ModalMixin, SampleDataMixin],
|
||||
data() {
|
||||
return {
|
||||
text: "",
|
||||
text: '',
|
||||
isLoading: false,
|
||||
fileName: ''
|
||||
fileName: '',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
beforeModalOpen() {
|
||||
this.getViewGammaviewerLog();
|
||||
this.getViewGammaviewerLog()
|
||||
},
|
||||
getViewGammaviewerLog() {
|
||||
this.isLoading = true
|
||||
const { sampleId, inputFileName: fileName } = this.sampleData
|
||||
let params = {
|
||||
sampleId,
|
||||
fileName
|
||||
fileName,
|
||||
}
|
||||
getAction("/gamma/viewGammaViewerLog", params).then(res => {
|
||||
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")
|
||||
this.text = ''
|
||||
this.$message.warning('This operation fails. Contact your system administrator')
|
||||
}
|
||||
})
|
||||
},
|
||||
handleOk() {
|
||||
this.fileName=""
|
||||
this.fileName = ''
|
||||
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`)
|
||||
}
|
||||
},
|
||||
});
|
||||
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!")
|
||||
this.$message.warning('No data can be saved!')
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue
Block a user