From c45cd40ba974f0721ec83aef6472d6e931437fed Mon Sep 17 00:00:00 2001 From: renpy Date: Wed, 6 Sep 2023 17:48:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9confirm=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E7=9A=84=E9=BB=98=E8=AE=A4=E6=8C=89=E9=92=AE=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=97=A0=E6=95=B0=E6=8D=AE=E7=9A=84=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Modals/ArrRrrModal.vue | 52 +++++++++++-------- .../AutomaticAnalysisLogModal.vue | 44 +++++++++------- .../BetaGammaQCResultsModal.vue | 12 +++-- .../BetaGammaSampleInfomationModal.vue | 43 ++++++++------- .../BetaGammaSpectrumModal.vue | 45 +++++++++------- .../Modals/DataProcessingLogModal.vue | 43 ++++++++------- 6 files changed, 136 insertions(+), 103 deletions(-) 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!") + } } }, }