处理 View Spectrum 弹窗中下载当前tab页中的文档出错的问题

This commit is contained in:
任珮宇 2024-04-16 17:44:12 +08:00
parent 9c755377a4
commit bcaaf9d280

View File

@ -1,5 +1,5 @@
<template> <template>
<custom-modal v-model="visible" :width="1000" title="View Spectrum" destroyOnClose> <custom-modal v-model="visible" :width="1000" title="View Spectrum" destroyOnClose @cancel="handleCancel">
<a-spin :spinning="isLoading"> <a-spin :spinning="isLoading">
<a-tabs :animated="false" @change="handleTabChange"> <a-tabs :animated="false" @change="handleTabChange">
<a-tab-pane tab="Sample Spectrum" :key="1"> <a-tab-pane tab="Sample Spectrum" :key="1">
@ -19,7 +19,7 @@
<div slot="custom-footer"> <div slot="custom-footer">
<a-space :size="20"> <a-space :size="20">
<a-button type="primary" @click="handleOk">Save Text</a-button> <a-button type="primary" @click="handleOk">Save Text</a-button>
<a-button @click="visible = false">Cancel</a-button> <a-button @click="handleCancel">Cancel</a-button>
</a-space> </a-space>
</div> </div>
</custom-modal> </custom-modal>
@ -89,7 +89,6 @@ export default {
this.currTab = key this.currTab = key
}, },
handleOk() { handleOk() {
console.log(this.sampleData)
this.fileName = '' this.fileName = ''
let text = '' let text = ''
if (this.currTab == 1) { if (this.currTab == 1) {
@ -104,7 +103,6 @@ export default {
if (text) { if (text) {
let name = this.newSampleData.inputFileName.split('.')[0] let name = this.newSampleData.inputFileName.split('.')[0]
let strData = new Blob([text], { type: 'text/plain;charset=utf-8' }) let strData = new Blob([text], { type: 'text/plain;charset=utf-8' })
// saveAs(strData, `GammaViewer Log.txt`)
if (this.currTab == 1) { if (this.currTab == 1) {
saveAs(strData, `${name}_Sample Spectrum.txt`) saveAs(strData, `${name}_Sample Spectrum.txt`)
} else if (this.currTab == 2) { } else if (this.currTab == 2) {
@ -114,27 +112,14 @@ export default {
} else if (this.currTab == 4) { } else if (this.currTab == 4) {
saveAs(strData, `${name}_QC Spectrum.txt`) saveAs(strData, `${name}_QC Spectrum.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 { } else {
this.$message.warning('No data can be saved!') this.$message.warning('No data can be saved!')
} }
}, },
handleCancel() {
this.currTab = 1
this.visible = false
},
}, },
} }
</script> </script>