diff --git a/src/views/spectrumAnalysis/components/Modals/ArrRrrModal.vue b/src/views/spectrumAnalysis/components/Modals/ArrRrrModal.vue index 04be842..97ca2fe 100644 --- a/src/views/spectrumAnalysis/components/Modals/ArrRrrModal.vue +++ b/src/views/spectrumAnalysis/components/Modals/ArrRrrModal.vue @@ -63,7 +63,7 @@ export default { if (res.success) { this.content = res.result } else { - this.content = res + this.content = "" } } catch (error) { console.error(error) @@ -80,28 +80,34 @@ export default { } }, handleOk() { - let strData = new Blob([this.content], { type: 'text/plain;charset=utf-8' }); - // if (this.type == 1 || this.type == 3) { - // saveAs(strData, `${this.type == 1 ?'Gamma-':'Beta-'} ARR.txt`) - // } else { - // saveAs(strData, `${this.type == 2 ?'Gamma-':'Beta-'} RRR.txt`) - // } - let _this = this - this.$confirm({ - title: 'Please enter file name', - content: h => , - okText: 'Save', - cancelText: 'Cancle', - onOk() { - if (_this.fileName) { - _this.visible = false - saveAs(strData, `${_this.fileName}.txt`) - } - }, - onCancel() { - console.log('Cancel'); - }, - }); + if (this.content) { + let strData = new Blob([this.content], { type: 'text/plain;charset=utf-8' }); + // if (this.type == 1 || this.type == 3) { + // saveAs(strData, `${this.type == 1 ?'Gamma-':'Beta-'} ARR.txt`) + // } else { + // saveAs(strData, `${this.type == 2 ?'Gamma-':'Beta-'} RRR.txt`) + // } + let _this = this + this.$confirm({ + title: 'Please enter file name', + content: h => , + 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) { + _this.visible = false + saveAs(strData, `${_this.fileName}.txt`) + } + }, + }); + } else { + this.$message.warning("No data can be saved!") + } } } } diff --git a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/AutomaticAnalysisLogModal.vue b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/AutomaticAnalysisLogModal.vue index de88602..807c501 100644 --- a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/AutomaticAnalysisLogModal.vue +++ b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/AutomaticAnalysisLogModal.vue @@ -41,7 +41,7 @@ export default { const res = await getAction(this.type == 1 ? '/gamma/viewAutomaticAnalysisLog' : '/gamma/viewAutomaticAnalysisLog', { // 自动分析日志接口暂用都是gammam,beta暂时没有 sampleId }) - this.content = res + this.content = "" } catch (error) { console.error(error) } finally { @@ -54,24 +54,30 @@ export default { }, handleOk() { - let _this = this - let strData = new Blob([this.content], { type: 'text/plain;charset=utf-8' }); - // saveAs(strData, `${this.type == 1 ?'Gamma-':'Beta-'}Automatic Analysis Log.txt`) - this.$confirm({ - title: 'Please enter file name', - content: h => , - okText: 'Save', - cancelText: 'Cancle', - onOk() { - if (_this.fileName) { - _this.visible = false - saveAs(strData, `${_this.fileName}.txt`) - } - }, - onCancel() { - console.log('Cancel'); - }, - }); + if (this.content) { + let _this = this + let strData = new Blob([this.content], { type: 'text/plain;charset=utf-8' }); + // saveAs(strData, `${this.type == 1 ?'Gamma-':'Beta-'}Automatic Analysis Log.txt`) + this.$confirm({ + title: 'Please enter file name', + content: h => , + 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) { + _this.visible = false + saveAs(strData, `${_this.fileName}.txt`) + } + }, + }); + } else { + this.$message.warning("No data can be saved!") + } } } } diff --git a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaQCResultsModal.vue b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaQCResultsModal.vue index dc107d1..719404d 100644 --- a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaQCResultsModal.vue +++ b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaQCResultsModal.vue @@ -142,17 +142,19 @@ export default { this.$confirm({ title: 'Please enter file name', content: h => , - okText: 'Save', - cancelText: 'Cancle', + 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) { _this.visible = false saveAs(strData, `${_this.fileName}.txt`) } }, - onCancel() { - console.log('Cancel'); - }, }); } } diff --git a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaSampleInfomationModal.vue b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaSampleInfomationModal.vue index 5c00441..1df1723 100644 --- a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaSampleInfomationModal.vue +++ b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaSampleInfomationModal.vue @@ -44,6 +44,7 @@ export default { this.content = res.result } else { + this.content = "" this.$message.error(res.message) } } catch (error) { @@ -59,24 +60,30 @@ export default { } }, saveText() { - let strData = new Blob([this.content], { type: 'text/plain;charset=utf-8' }); - // saveAs(strData, `Beta-View Sample Infomation.txt`) - let _this = this - this.$confirm({ - title: 'Please enter file name', - content: h => , - okText: 'Save', - cancelText: 'Cancle', - onOk() { - if (_this.fileName) { - _this.visible = false - saveAs(strData, `${_this.fileName}.txt`) - } - }, - onCancel() { - console.log('Cancel'); - }, - }); + if (this.content) { + let strData = new Blob([this.content], { type: 'text/plain;charset=utf-8' }); + // saveAs(strData, `Beta-View Sample Infomation.txt`) + let _this = this + this.$confirm({ + title: 'Please enter file name', + content: h => , + 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) { + _this.visible = false + saveAs(strData, `${_this.fileName}.txt`) + } + }, + }); + } else { + this.$message.warning("No data can be saved!") + } } } } diff --git a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaSpectrumModal.vue b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaSpectrumModal.vue index e4a842b..08f55c2 100644 --- a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaSpectrumModal.vue +++ b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaSpectrumModal.vue @@ -77,7 +77,7 @@ export default { }, handleOk() { let text = "" - if (this.currTab==1) { + if (this.currTab == 1) { text=this.content.sample.join('\n') } else if (this.currTab == 2) { text=this.content.gasBg.join('\n') @@ -86,25 +86,30 @@ export default { }else if (this.currTab == 4) { text=this.content.qc.join('\n') } - console.log(text); - let strData = new Blob([text], { type: 'text/plain;charset=utf-8' }); - // saveAs(strData, `GammaViewer Log.txt`) - let _this = this - this.$confirm({ - title: 'Please enter file name', - content: h => , - okText: 'Save', - cancelText: 'Cancle', - onOk() { - if (_this.fileName) { - // _this.visible = false - saveAs(strData, `${_this.fileName}.txt`) - } - }, - onCancel() { - console.log('Cancel'); - }, - }); + if (this.text) { + let strData = new Blob([text], { type: 'text/plain;charset=utf-8' }); + // saveAs(strData, `GammaViewer Log.txt`) + let _this = this + this.$confirm({ + title: 'Please enter file name', + content: h => , + 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) { + _this.visible = false + saveAs(strData, `${_this.fileName}.txt`) + } + }, + }); + } else { + this.$message.warning("No data can be saved!") + } } } } diff --git a/src/views/spectrumAnalysis/components/Modals/DataProcessingLogModal.vue b/src/views/spectrumAnalysis/components/Modals/DataProcessingLogModal.vue index f664ffd..839fa97 100644 --- a/src/views/spectrumAnalysis/components/Modals/DataProcessingLogModal.vue +++ b/src/views/spectrumAnalysis/components/Modals/DataProcessingLogModal.vue @@ -45,29 +45,36 @@ export default { if (res.success) { this.text = res.result } else { + this.text = "" 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 => , - okText: 'Save', - cancelText: 'Cancle', - onOk() { - if (_this.fileName) { - _this.visible = false - saveAs(strData, `${_this.fileName}.txt`) - } - }, - onCancel() { - console.log('Cancel'); - }, - }); + 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 => , + 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) { + _this.visible = false + saveAs(strData, `${_this.fileName}.txt`) + } + }, + }); + } else { + this.$message.warning("No data can be saved!") + } } }, }