From 847584037e1e8bbbe822ae3f4ef8f4e073efed74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E4=BA=91=E9=B9=8F?= Date: Tue, 19 Nov 2024 10:25:00 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A1=E7=AE=97=EF=BC=9A=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E6=B7=BB=E5=8A=A0=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/backend/calculate/index.vue | 39 ++++++++++++++++++- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/ui/dasadmin/src/views/backend/calculate/index.vue b/ui/dasadmin/src/views/backend/calculate/index.vue index 593dd65a..73cfc7cf 100644 --- a/ui/dasadmin/src/views/backend/calculate/index.vue +++ b/ui/dasadmin/src/views/backend/calculate/index.vue @@ -105,7 +105,13 @@ - + +

@@ -200,13 +206,16 @@ const deactive = (name: string) => { const previewVisible = ref(false) const previewContent = ref('') - +let previewBlob: any = null +let previewName: any = '' const getScript = (name: string) => { + previewName = name getScriptCalcReq({ moduleName: name }).then((res) => { if (res.success) { // 预览 const txt = 'data:text/plain;charset=utf-8;base64,' + res.data const blob = base64ToBlob(txt) + previewBlob = blob blob.text().then((text) => { let showText = '' for (let i = 0; i < text.length; i++) { @@ -233,6 +242,21 @@ const base64ToBlob = (dataurl: string) => { } return new Blob([u8arr], { type: 'text/plain' }) } +const closePreview = () => { + previewBlob = null + previewName = null +} +const downloadScript = () => { + const a = document.createElement('a') + const url = URL.createObjectURL(previewBlob) + a.href = url + a.download = previewName + '.av' + document.body.appendChild(a) + a.click() + document.body.removeChild(a) + URL.revokeObjectURL(url) +} + getList() @@ -363,4 +387,15 @@ getList() } } } +.previewDialogHeader { + display: flex; + align-items: center; + p { + color: #303133; + font-size: 18px; + } + .el-button { + margin-left: 20px; + } +}