Merge branch 'dev' into pr@dev_eslint_auto_fix

This commit is contained in:
dataeaseShu 2022-11-02 15:48:16 +08:00
commit 66f7608992
13 changed files with 61 additions and 17 deletions

View File

@ -0,0 +1,14 @@
package io.dataease.ext;
import io.dataease.plugins.common.base.domain.PanelAppTemplateWithBLOBs;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import java.util.List;
@Mapper
public interface ExtPanelAppTemplateMapper {
List<PanelAppTemplateWithBLOBs> queryBaseInfo(@Param("nodeType") String nodeType , @Param("pid") String pid);
}

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.dataease.ext.ExtPanelAppTemplateMapper">
<select id="queryBaseInfo" resultType="io.dataease.plugins.common.base.domain.PanelAppTemplateWithBLOBs">
select id, `name`, node_type, `level`, pid, version, icon, update_time, update_user, create_time,
create_user,snapshot,datasource_info from panel_app_template
where 1=1
<if test="pid != null">
and pid = #{pid}
</if>
<if test="nodeType != null">
and node_type = #{nodeType}
</if>
</select>
</mapper>

View File

@ -10,6 +10,7 @@ import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.controller.request.panel.PanelAppTemplateApplyRequest; import io.dataease.controller.request.panel.PanelAppTemplateApplyRequest;
import io.dataease.controller.request.panel.PanelAppTemplateRequest; import io.dataease.controller.request.panel.PanelAppTemplateRequest;
import io.dataease.controller.request.panel.PanelGroupRequest; import io.dataease.controller.request.panel.PanelGroupRequest;
import io.dataease.ext.ExtPanelAppTemplateMapper;
import io.dataease.plugins.common.base.domain.*; import io.dataease.plugins.common.base.domain.*;
import io.dataease.plugins.common.base.mapper.PanelAppTemplateMapper; import io.dataease.plugins.common.base.mapper.PanelAppTemplateMapper;
import io.dataease.plugins.common.constants.DatasetType; import io.dataease.plugins.common.constants.DatasetType;
@ -19,6 +20,7 @@ import io.dataease.service.dataset.DataSetGroupService;
import io.dataease.service.dataset.DataSetTableFieldsService; import io.dataease.service.dataset.DataSetTableFieldsService;
import io.dataease.service.dataset.DataSetTableService; import io.dataease.service.dataset.DataSetTableService;
import io.dataease.service.datasource.DatasourceService; import io.dataease.service.datasource.DatasourceService;
import io.dataease.service.staticResource.StaticResourceService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.pentaho.di.core.util.UUIDUtil; import org.pentaho.di.core.util.UUIDUtil;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
@ -31,6 +33,8 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static io.dataease.commons.constants.StaticResourceConstants.UPLOAD_URL_PREFIX;
/** /**
* Author: wangjiahao * Author: wangjiahao
* Date: 2022/9/8 * Date: 2022/9/8
@ -40,6 +44,8 @@ import java.util.Map;
public class PanelAppTemplateService { public class PanelAppTemplateService {
private static Gson gson = new Gson(); private static Gson gson = new Gson();
@Resource
private ExtPanelAppTemplateMapper extPanelAppTemplateMapper;
@Resource @Resource
private PanelAppTemplateMapper panelAppTemplateMapper; private PanelAppTemplateMapper panelAppTemplateMapper;
@Resource @Resource
@ -59,16 +65,11 @@ public class PanelAppTemplateService {
private PanelViewService panelViewService; private PanelViewService panelViewService;
@Resource @Resource
private DataSetGroupService dataSetGroupService; private DataSetGroupService dataSetGroupService;
@Resource
private StaticResourceService staticResourceService;
public List<PanelAppTemplateWithBLOBs> list(PanelAppTemplateRequest request) { public List<PanelAppTemplateWithBLOBs> list(PanelAppTemplateRequest request) {
PanelAppTemplateExample example = new PanelAppTemplateExample(); return extPanelAppTemplateMapper.queryBaseInfo(request.getNodeType(),request.getPid());
if (StringUtils.isNotEmpty(request.getPid())) {
example.createCriteria().andPidEqualTo(request.getPid());
}
if (StringUtils.isNotEmpty(request.getNodeType())) {
example.createCriteria().andNodeTypeEqualTo(request.getNodeType());
}
return panelAppTemplateMapper.selectByExampleWithBLOBs(example);
} }
public void save(PanelAppTemplateRequest request) { public void save(PanelAppTemplateRequest request) {
@ -80,6 +81,10 @@ public class PanelAppTemplateService {
if (StringUtils.isEmpty(requestTemplate.getNodeType())) { if (StringUtils.isEmpty(requestTemplate.getNodeType())) {
requestTemplate.setNodeType("template"); requestTemplate.setNodeType("template");
} }
//Store static resource into the server
String snapshotName = "app-template-" + request.getId() + ".jpeg";
staticResourceService.saveSingleFileToServe(snapshotName, request.getSnapshot().replace("data:image/jpeg;base64,", ""));
requestTemplate.setSnapshot("/" + UPLOAD_URL_PREFIX + '/' + snapshotName);
panelAppTemplateMapper.insertSelective(requestTemplate); panelAppTemplateMapper.insertSelective(requestTemplate);
} }
@ -90,6 +95,10 @@ public class PanelAppTemplateService {
request.setUpdateTime(System.currentTimeMillis()); request.setUpdateTime(System.currentTimeMillis());
PanelAppTemplateWithBLOBs requestTemplate = new PanelAppTemplateWithBLOBs(); PanelAppTemplateWithBLOBs requestTemplate = new PanelAppTemplateWithBLOBs();
BeanUtils.copyBean(requestTemplate, request); BeanUtils.copyBean(requestTemplate, request);
//Store static resource into the server
String snapshotName = "app-template-" + request.getId() + ".jpeg";
staticResourceService.saveSingleFileToServe(snapshotName, request.getSnapshot().replace("data:image/jpeg;base64,", ""));
requestTemplate.setSnapshot("/" + UPLOAD_URL_PREFIX + '/' + snapshotName);
panelAppTemplateMapper.updateByPrimaryKeySelective(requestTemplate); panelAppTemplateMapper.updateByPrimaryKeySelective(requestTemplate);
} }

View File

@ -1,7 +1,7 @@
\u4E2A\u4EBA\u4FE1\u606F=Personal Information \u4E2A\u4EBA\u4FE1\u606F=Personal Information
\u4EEA\u8868\u677F=Dashboard \u4EEA\u8868\u677F=Dashboard
\u6A21\u677F\u5E02\u573A=Template Market \u6A21\u677F\u5E02\u573A=Template Market
\u5E94\u7528\u5E02\u573A=App Market \u5E94\u7528=Application
\u5E94\u7528\u7BA1\u7406=Applications \u5E94\u7528\u7BA1\u7406=Applications
\u4FEE\u6539\u5BC6\u7801=Change Password \u4FEE\u6539\u5BC6\u7801=Change Password
\u521B\u5EFA\u7528\u6237=Create User \u521B\u5EFA\u7528\u6237=Create User

View File

@ -1,7 +1,7 @@
\u4E2A\u4EBA\u4FE1\u606F=\u4E2A\u4EBA\u4FE1\u606F \u4E2A\u4EBA\u4FE1\u606F=\u4E2A\u4EBA\u4FE1\u606F
\u4EEA\u8868\u677F=\u4EEA\u8868\u677F \u4EEA\u8868\u677F=\u4EEA\u8868\u677F
\u6A21\u677F\u5E02\u573A=\u6A21\u677F\u5E02\u573A \u6A21\u677F\u5E02\u573A=\u6A21\u677F\u5E02\u573A
\u5E94\u7528\u5E02\u573A=\u5E94\u7528\u5E02\u573A \u5E94\u7528=\u5E94\u7528
\u5E94\u7528\u7BA1\u7406=\u5E94\u7528\u7BA1\u7406 \u5E94\u7528\u7BA1\u7406=\u5E94\u7528\u7BA1\u7406
\u4FEE\u6539\u5BC6\u7801=\u4FEE\u6539\u5BC6\u7801 \u4FEE\u6539\u5BC6\u7801=\u4FEE\u6539\u5BC6\u7801
\u521B\u5EFA\u7528\u6237=\u521B\u5EFA\u7528\u6237 \u521B\u5EFA\u7528\u6237=\u521B\u5EFA\u7528\u6237

View File

@ -1,7 +1,7 @@
\u4E2A\u4EBA\u4FE1\u606F=\u500B\u4EBA\u4FE1\u606F \u4E2A\u4EBA\u4FE1\u606F=\u500B\u4EBA\u4FE1\u606F
\u4EEA\u8868\u677F=\u5100\u8868\u677F \u4EEA\u8868\u677F=\u5100\u8868\u677F
\u6A21\u677F\u5E02\u573A=\u6A21\u677F\u5E02\u5834 \u6A21\u677F\u5E02\u573A=\u6A21\u677F\u5E02\u5834
\u5E94\u7528\u5E02\u573A=\u5E94\u7528\u5E02\u5834 \u5E94\u7528=\u5E94\u7528
\u5E94\u7528\u7BA1\u7406=\u5E94\u7528\u7BA1\u7406 \u5E94\u7528\u7BA1\u7406=\u5E94\u7528\u7BA1\u7406
\u4FEE\u6539\u5BC6\u7801=\u4FEE\u6539\u5BC6\u78BC \u4FEE\u6539\u5BC6\u7801=\u4FEE\u6539\u5BC6\u78BC
\u521B\u5EFA\u7528\u6237=\u5275\u5EFA\u7528\u6236 \u521B\u5EFA\u7528\u6237=\u5275\u5EFA\u7528\u6236

View File

@ -2629,6 +2629,7 @@ export default {
'I18N_USER_TEMPLATE_ERROR': 'Template file error', 'I18N_USER_TEMPLATE_ERROR': 'Template file error',
'i18n_max_user_import_size': 'File size exceeds 10M', 'i18n_max_user_import_size': 'File size exceeds 10M',
app_template: { app_template: {
execution_time: 'Execution time',
app_manager: 'Application management', app_manager: 'Application management',
app_upload: 'Upload app', app_upload: 'Upload app',
no_apps: 'No apps', no_apps: 'No apps',

View File

@ -2630,6 +2630,7 @@ export default {
'I18N_USER_TEMPLATE_ERROR': '模版錯誤', 'I18N_USER_TEMPLATE_ERROR': '模版錯誤',
'i18n_max_user_import_size': '文件最大不能超過10M', 'i18n_max_user_import_size': '文件最大不能超過10M',
app_template: { app_template: {
execution_time: '执行时间',
app_manager: '應用管理', app_manager: '應用管理',
app_upload: '上傳應用', app_upload: '上傳應用',
no_apps: '暫無應用', no_apps: '暫無應用',

View File

@ -2630,6 +2630,7 @@ export default {
'I18N_USER_TEMPLATE_ERROR': '模版错误', 'I18N_USER_TEMPLATE_ERROR': '模版错误',
'i18n_max_user_import_size': '文件最大不能超过10M', 'i18n_max_user_import_size': '文件最大不能超过10M',
app_template: { app_template: {
execution_time: '执行时间',
app_manager: '应用管理', app_manager: '应用管理',
app_upload: '上传应用', app_upload: '上传应用',
no_apps: '暂无应用', no_apps: '暂无应用',

View File

@ -65,7 +65,7 @@
append-to-body append-to-body
class="de-dialog-form" class="de-dialog-form"
width="600px" width="600px"
destroy-on-close="true" :destroy-on-close="true"
> >
<el-form <el-form
ref="templateEditForm" ref="templateEditForm"

View File

@ -8,7 +8,7 @@
:style="classImg" :style="classImg"
> >
<img <img
:src="model.snapshot" :src="imgSrc"
alt="" alt=""
> >
</div> </div>
@ -82,8 +82,8 @@
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { imgUrlTrans } from '@/components/canvas/utils/utils'
export default { export default {
props: { props: {
showPosition: { showPosition: {
@ -101,6 +101,9 @@ export default {
} }
}, },
computed: { computed: {
imgSrc() {
return imgUrlTrans(this.model.snapshot)
},
classBackground() { classBackground() {
return { return {
width: this.width + 'px', width: this.width + 'px',

View File

@ -13,7 +13,7 @@
class="market-main" class="market-main"
> >
<el-row> <el-row>
<el-col span="12"> <el-col :span="12">
<span class="title-left">{{ $t('app_template.app_manager') }}</span> <span class="title-left">{{ $t('app_template.app_manager') }}</span>
</el-col> </el-col>
</el-row> </el-row>
@ -54,7 +54,7 @@
width="80%" width="80%"
top="5vh" top="5vh"
class="market-dialog-css" class="market-dialog-css"
append-to-body="true" :append-to-body="true"
:destroy-on-close="true" :destroy-on-close="true"
> >
<el-form <el-form

View File

@ -137,7 +137,7 @@
show-overflow-tooltip show-overflow-tooltip
prop="applyTime" prop="applyTime"
sortable="custom" sortable="custom"
:label="'应用时间'" :label="$t('app_template.execution_time')"
> >
<template #default="scope"> <template #default="scope">
<span>{{ scope.row.applyTime | timestampFormatDate }}</span> <span>{{ scope.row.applyTime | timestampFormatDate }}</span>