From 397b9da6dbcba8ef7370b684d7b15d73fde0939f Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 1 Jul 2022 11:14:03 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20echarts=E9=9B=B7=E8=BE=BE=E5=9B=BE?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E6=8C=87=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/chart/radar/radar.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/chart/chart/radar/radar.js b/frontend/src/views/chart/chart/radar/radar.js index 0e921b618b..4ecf149e35 100644 --- a/frontend/src/views/chart/chart/radar/radar.js +++ b/frontend/src/views/chart/chart/radar/radar.js @@ -55,11 +55,11 @@ export function baseRadarOption(chart_option, chart) { name: y.name, label: y.label } - ] + ], + selectedMode: true, + select: BASE_ECHARTS_SELECT } y.value = JSON.parse(JSON.stringify(y.data)) - chart_option.series[0].selectedMode = true - chart_option.series[0].select = BASE_ECHARTS_SELECT chart_option.series.push(d) maxValues.push(Math.max.apply(null, y.value)) From 84bfda9332ae8b2a2db46dda4ecd46c02d13999a Mon Sep 17 00:00:00 2001 From: taojinlong Date: Fri, 1 Jul 2022 11:31:18 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20sql=20=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/dataset/add/AddSQL.vue | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/src/views/dataset/add/AddSQL.vue b/frontend/src/views/dataset/add/AddSQL.vue index 9f2196c7f3..d3c277b08b 100644 --- a/frontend/src/views/dataset/add/AddSQL.vue +++ b/frontend/src/views/dataset/add/AddSQL.vue @@ -48,6 +48,12 @@ + + + {{ $t('sql_variable.variable_mgm') }} + + + From 59e771d6059f9d57d4bb61513ef128b0589e6e3f Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 1 Jul 2022 12:23:39 +0800 Subject: [PATCH 3/3] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E4=BD=BF=E7=94=A8=EF=BC=8C=E4=B8=8A=E4=BC=A0=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E6=97=B6=E6=A8=A1=E6=9D=BF=E9=A2=84=E8=A7=88=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E4=BD=BF=E7=94=A8=E9=9D=99=E6=80=81=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=AD=98=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/panel/PanelTemplateService.java | 5 ++++ .../staticResource/StaticResourceService.java | 30 +++++++++++-------- frontend/src/api/system/template.js | 1 + .../src/views/panel/list/EditPanel/index.vue | 23 ++++++++++---- frontend/src/views/panel/template/index.vue | 2 +- 5 files changed, 41 insertions(+), 20 deletions(-) diff --git a/backend/src/main/java/io/dataease/service/panel/PanelTemplateService.java b/backend/src/main/java/io/dataease/service/panel/PanelTemplateService.java index 71e79b9627..3e9ffdbe02 100644 --- a/backend/src/main/java/io/dataease/service/panel/PanelTemplateService.java +++ b/backend/src/main/java/io/dataease/service/panel/PanelTemplateService.java @@ -24,6 +24,8 @@ import java.util.List; import java.util.Optional; import java.util.UUID; +import static io.dataease.commons.constants.StaticResourceConstants.UPLOAD_URL_PREFIX; + /** * Author: wangjiahao * Date: 2021-03-05 @@ -80,6 +82,9 @@ public class PanelTemplateService { } //Store static resource into the server staticResourceService.saveFilesToServe(request.getStaticResource()); + String snapshotName = "template-" + request.getId() + ".jpeg"; + staticResourceService.saveSingleFileToServe(snapshotName,request.getSnapshot().replace("data:image/jpeg;base64,","") ); + request.setSnapshot("/"+UPLOAD_URL_PREFIX+'/'+snapshotName); panelTemplateMapper.insert(request); } else { String nameCheckResult = this.nameCheck(CommonConstants.OPT_TYPE.UPDATE, request.getName(), request.getPid(), request.getId()); diff --git a/backend/src/main/java/io/dataease/service/staticResource/StaticResourceService.java b/backend/src/main/java/io/dataease/service/staticResource/StaticResourceService.java index da03757982..309f0d6f3b 100644 --- a/backend/src/main/java/io/dataease/service/staticResource/StaticResourceService.java +++ b/backend/src/main/java/io/dataease/service/staticResource/StaticResourceService.java @@ -56,21 +56,25 @@ public class StaticResourceService { Map resource = gson.fromJson(staticResource,Map.class); for(Map.Entry entry:resource.entrySet()){ String path = entry.getKey(); - Path uploadPath = Paths.get(staticDir.toString(), path.substring(path.lastIndexOf("/")+1,path.length())); - try{ - if (uploadPath.toFile().exists()) { - LogUtil.info("file exists"); - }else{ - String content = entry.getValue(); - if(StringUtils.isNotEmpty(content)){ - Files.createFile(uploadPath); - FileCopyUtils.copy(Base64Decoder.decode(content),Files.newOutputStream(uploadPath)); - } - } - }catch (Exception e){ - LogUtil.error("template static resource save error"+e.getMessage()); + String fileName = path.substring(path.lastIndexOf("/")+1,path.length()); + saveSingleFileToServe(fileName,entry.getValue()); + } + } + } + + public void saveSingleFileToServe(String fileName,String content){ + Path uploadPath = Paths.get(staticDir.toString(), fileName); + try{ + if (uploadPath.toFile().exists()) { + LogUtil.info("file exists"); + }else{ + if(StringUtils.isNotEmpty(content)){ + Files.createFile(uploadPath); + FileCopyUtils.copy(Base64Decoder.decode(content),Files.newOutputStream(uploadPath)); } } + }catch (Exception e){ + LogUtil.error("template static resource save error"+e.getMessage()); } } diff --git a/frontend/src/api/system/template.js b/frontend/src/api/system/template.js index 3e17a9be40..541de080c7 100644 --- a/frontend/src/api/system/template.js +++ b/frontend/src/api/system/template.js @@ -34,6 +34,7 @@ export function find(data) { return request({ url: '/template/find', data: data, + loading: true, method: 'post' }) } diff --git a/frontend/src/views/panel/list/EditPanel/index.vue b/frontend/src/views/panel/list/EditPanel/index.vue index 0645aaafd1..fa2ba62f22 100644 --- a/frontend/src/views/panel/list/EditPanel/index.vue +++ b/frontend/src/views/panel/list/EditPanel/index.vue @@ -26,7 +26,7 @@ {{ $t('commons.cancel') }} - {{ $t('commons.confirm') }} + {{ $t('commons.confirm') }} @@ -57,10 +57,14 @@ export default { importTemplateInfo: { snapshot: '' }, - editPanel: null + editPanel: null, + templateSelected: false } }, computed: { + saveStatus() { + return this.editPanel.panelInfo.name && (this.inputType === 'new' || this.templateSelected) + }, classBackground() { if (this.importTemplateInfo.snapshot) { return { @@ -76,6 +80,7 @@ export default { if (newVal === 'new') { this.editPanel = deepCopy(this.editPanelOut) } else { + this.templateSelected = false this.editPanel.panelInfo.name = null this.editPanel.panelInfo.panelStyle = null this.editPanel.panelInfo.panelData = null @@ -109,10 +114,15 @@ export default { }, showCurrentTemplateInfo(data) { this.editPanel.panelInfo.templateId = data.id - this.editPanel.panelInfo.name = data.name - // this.editPanel.panelInfo.panelStyle = data.templateStyle - // this.editPanel.panelInfo.panelData = data.templateData - this.importTemplateInfo.snapshot = data.snapshot + if (data.nodeType === 'folder') { + this.editPanel.panelInfo.name = null + this.importTemplateInfo.snapshot = null + this.templateSelected = false + } else { + this.editPanel.panelInfo.name = data.name + this.importTemplateInfo.snapshot = data.snapshot + this.templateSelected = true + } }, getTree() { const request = { @@ -177,6 +187,7 @@ export default { const file = e.target.files[0] const reader = new FileReader() reader.onload = (res) => { + this.templateSelected = true const result = res.target.result this.importTemplateInfo = JSON.parse(result) this.editPanel.panelInfo.name = this.importTemplateInfo.name diff --git a/frontend/src/views/panel/template/index.vue b/frontend/src/views/panel/template/index.vue index d40258a2d5..786f244dbd 100644 --- a/frontend/src/views/panel/template/index.vue +++ b/frontend/src/views/panel/template/index.vue @@ -31,7 +31,7 @@ - +