forked from github/dataease
Merge branch 'dev-v2' into pr@dev-v2_dzz
This commit is contained in:
commit
322d8172d2
@ -47,16 +47,16 @@ public class TemplateManageService implements TemplateManageApi {
|
||||
request.setWithBlobs("N");
|
||||
List<TemplateManageDTO> templateList = extTemplateMapper.findTemplateList(request);
|
||||
if (request.getWithChildren()) {
|
||||
getTreeChildren(templateList);
|
||||
getTreeChildren(templateList,request.getLeafDvType());
|
||||
}
|
||||
return templateList;
|
||||
}
|
||||
|
||||
public void getTreeChildren(List<TemplateManageDTO> parentTemplateList) {
|
||||
public void getTreeChildren(List<TemplateManageDTO> parentTemplateList,String dvType) {
|
||||
Optional.ofNullable(parentTemplateList).ifPresent(parent -> parent.forEach(parentTemplate -> {
|
||||
List<TemplateManageDTO> panelTemplateDTOChildren = extTemplateMapper.findTemplateList(new TemplateManageRequest(parentTemplate.getId()));
|
||||
List<TemplateManageDTO> panelTemplateDTOChildren = extTemplateMapper.findTemplateList(new TemplateManageRequest(parentTemplate.getId(),dvType));
|
||||
parentTemplate.setChildren(panelTemplateDTOChildren);
|
||||
getTreeChildren(panelTemplateDTOChildren);
|
||||
getTreeChildren(panelTemplateDTOChildren,dvType);
|
||||
}));
|
||||
}
|
||||
|
||||
@ -140,8 +140,8 @@ public class TemplateManageService implements TemplateManageApi {
|
||||
templateMapper.deleteById(id);
|
||||
}
|
||||
@Override
|
||||
public VisualizationTemplateVO findOne(String panelId) {
|
||||
VisualizationTemplate template = templateMapper.selectById(panelId);
|
||||
public VisualizationTemplateVO findOne(String templateId) {
|
||||
VisualizationTemplate template = templateMapper.selectById(templateId);
|
||||
if(template != null){
|
||||
VisualizationTemplateVO templateVO = new VisualizationTemplateVO();
|
||||
BeanUtils.copyBean(templateVO,template);
|
||||
|
@ -0,0 +1,40 @@
|
||||
package io.dataease.visualization.manage;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.dataease.api.chart.dto.ChartViewDTO;
|
||||
import io.dataease.exception.DEException;
|
||||
import io.dataease.template.dao.auto.entity.VisualizationTemplateExtendData;
|
||||
import io.dataease.template.dao.auto.mapper.VisualizationTemplateExtendDataMapper;
|
||||
import io.dataease.utils.JsonUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author : WangJiaHao
|
||||
* @date : 2023/11/13 13:25
|
||||
*/
|
||||
@Service
|
||||
public class VisualizationTemplateExtendDataManage {
|
||||
|
||||
@Resource
|
||||
private VisualizationTemplateExtendDataMapper extendDataMapper;
|
||||
|
||||
public ChartViewDTO getChartDataInfo(Long viewId, ChartViewDTO view) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("view_id",viewId);
|
||||
List<VisualizationTemplateExtendData> extendDataList = extendDataMapper.selectList(queryWrapper);
|
||||
if (CollectionUtils.isNotEmpty(extendDataList)) {
|
||||
ChartViewDTO chartViewTemplate = JsonUtil.parseObject(extendDataList.get(0).getViewDetails(),ChartViewDTO.class);
|
||||
view.setData(chartViewTemplate.getData());
|
||||
} else {
|
||||
DEException.throwException("模板缓存数据中未获取指定视图数据:" + viewId);
|
||||
}
|
||||
return view;
|
||||
}
|
||||
}
|
@ -82,8 +82,8 @@ public class DataVisualizationServer implements DataVisualizationApi {
|
||||
|
||||
@Override
|
||||
@XpackInteract(value = "dataVisualizationServer", original = true)
|
||||
public DataVisualizationVO findById(Long dvId,String busiFlag) {
|
||||
DataVisualizationVO result = extDataVisualizationMapper.findDvInfo(dvId,busiFlag);
|
||||
public DataVisualizationVO findById(Long dvId, String busiFlag) {
|
||||
DataVisualizationVO result = extDataVisualizationMapper.findDvInfo(dvId, busiFlag);
|
||||
if (result != null) {
|
||||
//获取视图信息
|
||||
List<ChartViewDTO> chartViewDTOS = chartViewManege.listBySceneId(dvId);
|
||||
@ -154,7 +154,7 @@ public class DataVisualizationServer implements DataVisualizationApi {
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public void deleteLogic(Long dvId,String busiFlag) {
|
||||
public void deleteLogic(Long dvId, String busiFlag) {
|
||||
coreVisualizationManage.delete(dvId);
|
||||
}
|
||||
|
||||
@ -261,31 +261,34 @@ public class DataVisualizationServer implements DataVisualizationApi {
|
||||
// 解析动态数据
|
||||
Map<String, String> dynamicDataMap = JsonUtil.parseObject(dynamicData, Map.class);
|
||||
List<ChartViewDTO> chartViews = new ArrayList<>();
|
||||
Map<Long,ChartViewDTO> canvasViewInfo = new HashMap<>();
|
||||
Map<Long,VisualizationTemplateExtendDataDTO> extendDataInfo = new HashMap<>();
|
||||
Map<Long, ChartViewDTO> canvasViewInfo = new HashMap<>();
|
||||
Map<Long, VisualizationTemplateExtendDataDTO> extendDataInfo = new HashMap<>();
|
||||
for (Map.Entry<String, String> entry : dynamicDataMap.entrySet()) {
|
||||
String originViewId = entry.getKey();
|
||||
String originViewData = entry.getValue();
|
||||
String originViewData = JsonUtil.toJSONString(entry.getValue()).toString();
|
||||
ChartViewDTO chartView = JsonUtil.parseObject(originViewData, ChartViewDTO.class);
|
||||
if(chartView == null){
|
||||
continue;
|
||||
}
|
||||
Long newViewId = IDUtils.snowID();
|
||||
chartView.setId(newViewId);
|
||||
chartView.setSceneId(newDvId);
|
||||
chartView.setTableId(null);
|
||||
chartView.setDataFrom(CommonConstants.VIEW_DATA_FROM.TEMPLATE);
|
||||
// 数据处理 1.替换viewId 2.加入模板view data数据
|
||||
VisualizationTemplateExtendDataDTO extendDataDTO = new VisualizationTemplateExtendDataDTO(newViewId, newDvId,originViewData);
|
||||
VisualizationTemplateExtendDataDTO extendDataDTO = new VisualizationTemplateExtendDataDTO(newDvId, newViewId, originViewData);
|
||||
extendDataInfo.put(newViewId, extendDataDTO);
|
||||
templateData = templateData.replaceAll(originViewId, newViewId.toString());
|
||||
chartViewManege.save(chartView);
|
||||
canvasViewInfo.put(chartView.getId(),chartView);
|
||||
canvasViewInfo.put(chartView.getId(), chartView);
|
||||
//插入模版数据 此处预先插入减少数据交互量
|
||||
VisualizationTemplateExtendData extendData = new VisualizationTemplateExtendData();
|
||||
templateExtendDataMapper.insert(BeanUtils.copyBean(extendData,extendDataDTO));
|
||||
templateExtendDataMapper.insert(BeanUtils.copyBean(extendData, extendDataDTO));
|
||||
}
|
||||
request.setComponentData(templateData);
|
||||
request.setCanvasStyleData(templateStyle);
|
||||
//Store static resource into the server
|
||||
staticResourceServer.saveFilesToServe(staticResource);
|
||||
return new DataVisualizationVO(newDvId,name,dvType,templateStyle,templateData,canvasViewInfo,null);
|
||||
return new DataVisualizationVO(newDvId, name, dvType, templateStyle, templateData, canvasViewInfo, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,8 +1,8 @@
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://127.0.0.1:3306/de_standalone?autoReconnect=false&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false
|
||||
url: jdbc:mysql://localhost:3306/dataease?autoReconnect=false&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false
|
||||
username: root
|
||||
password: Password123@mysql
|
||||
password: 123456
|
||||
messages:
|
||||
basename: i18n/core,i18n/permissions
|
||||
flyway:
|
||||
|
1
core/core-frontend/src/assets/svg/dv-up-arrow.svg
Normal file
1
core/core-frontend/src/assets/svg/dv-up-arrow.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1699933113241" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4024" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M426.752 344.149333v554.666667c0 23.68 19.285333 42.666667 43.093333 42.666667h84.48a42.666667 42.666667 0 0 0 43.093334-42.666667v-554.666667h84.949333c47.232 0 62.805333-30.549333 34.56-68.266666l-153.642667-204.8c-28.501333-37.973333-74.112-37.717333-102.4 0l-153.6 204.8c-28.501333 37.973333-12.8 68.266667 34.517334 68.266666h84.949333z" fill="#3D3D3D" p-id="4025"></path></svg>
|
After Width: | Height: | Size: 716 B |
@ -301,7 +301,7 @@ const reShow = () => {
|
||||
|
||||
const calcData = (view: Chart, callback) => {
|
||||
isError.value = false
|
||||
if (view.tableId) {
|
||||
if (view.tableId || view['dataFrom'] === 'template') {
|
||||
const v = JSON.parse(JSON.stringify(view))
|
||||
getData(v)
|
||||
.then(res => {
|
||||
|
@ -4,8 +4,10 @@ import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { findResourceAsBase64 } from '@/api/staticResource'
|
||||
import FileSaver from 'file-saver'
|
||||
import { deepCopy } from '@/utils/utils'
|
||||
const dvMainStore = dvMainStoreWithOut()
|
||||
const { canvasStyleData, componentData, canvasViewInfo, dvInfo } = storeToRefs(dvMainStore)
|
||||
const { canvasStyleData, componentData, canvasViewInfo, canvasViewDataInfo, dvInfo } =
|
||||
storeToRefs(dvMainStore)
|
||||
const basePath = import.meta.env.VITE_API_BASEPATH
|
||||
|
||||
export function imgUrlTrans(url) {
|
||||
@ -29,6 +31,10 @@ export function download2AppTemplate(downloadType, canvasDom, name, callBack?) {
|
||||
try {
|
||||
findStaticSource(function (staticResource) {
|
||||
html2canvas(canvasDom).then(canvas => {
|
||||
const canvasViewDataTemplate = deepCopy(canvasViewInfo.value)
|
||||
Object.keys(canvasViewDataTemplate).forEach(viewId => {
|
||||
canvasViewDataTemplate[viewId].data = canvasViewDataInfo.value[viewId]
|
||||
})
|
||||
const snapshot = canvas.toDataURL('image/jpeg', 0.1) // 0.1是图片质量
|
||||
if (snapshot !== '') {
|
||||
const templateInfo = {
|
||||
@ -38,7 +44,7 @@ export function download2AppTemplate(downloadType, canvasDom, name, callBack?) {
|
||||
dvType: dvInfo.value.type,
|
||||
canvasStyleData: JSON.stringify(canvasStyleData.value),
|
||||
componentData: JSON.stringify(componentData.value),
|
||||
dynamicData: JSON.stringify(canvasViewInfo.value),
|
||||
dynamicData: JSON.stringify(canvasViewDataTemplate),
|
||||
staticResource: JSON.stringify(staticResource || {})
|
||||
}
|
||||
const blob = new Blob([JSON.stringify(templateInfo)], { type: '' })
|
||||
|
@ -0,0 +1,30 @@
|
||||
<script lang="tsx" setup></script>
|
||||
|
||||
<template>
|
||||
<div class="template-check-info">
|
||||
<div>
|
||||
<Icon class-name="item-icon" name="dv-up-arrow" />
|
||||
</div>
|
||||
<div>当前为模版视图,请更换数据集...</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.template-check-info {
|
||||
position: absolute;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 12px;
|
||||
color: #9ea6b2;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.item-icon {
|
||||
width: 50%;
|
||||
height: 50%;
|
||||
opacity: 0.3;
|
||||
}
|
||||
</style>
|
@ -58,7 +58,7 @@ const containerId = 'container-' + showPosition.value + '-' + view.value.id
|
||||
const viewTrack = ref(null)
|
||||
|
||||
const calcData = (view, callback) => {
|
||||
if (view.tableId) {
|
||||
if (view.tableId || view['dataFrom'] === 'template') {
|
||||
state.loading = true
|
||||
isError.value = false
|
||||
const v = JSON.parse(JSON.stringify(view))
|
||||
|
@ -78,7 +78,7 @@ const containerId = 'container-' + showPosition.value + '-' + view.value.id
|
||||
const viewTrack = ref(null)
|
||||
|
||||
const calcData = (view: Chart, callback, resetPageInfo = true) => {
|
||||
if (view.tableId) {
|
||||
if (view.tableId || view['dataFrom'] === 'template') {
|
||||
isError.value = false
|
||||
const v = JSON.parse(JSON.stringify(view))
|
||||
getData(v)
|
||||
|
@ -501,7 +501,8 @@ const chartAreaShow = computed(() => {
|
||||
(view.value.tableId &&
|
||||
(element.value['state'] === undefined || element.value['state'] === 'ready')) ||
|
||||
view.value.type === 'rich-text' ||
|
||||
(view.value.type === 'map' && view.value.customAttr.map.id)
|
||||
(view.value.type === 'map' && view.value.customAttr.map.id) ||
|
||||
view.value['dataFrom'] === 'template'
|
||||
)
|
||||
})
|
||||
|
||||
|
@ -3,11 +3,11 @@
|
||||
class="create-dialog"
|
||||
title="从模版新建"
|
||||
v-model="state.dialogShow"
|
||||
width="600"
|
||||
width="700"
|
||||
:before-close="close"
|
||||
@submit.prevent
|
||||
>
|
||||
<el-row v-loading="state.loading">
|
||||
<el-row class="create-main" v-loading="state.loading">
|
||||
<el-row>
|
||||
<el-col :span="18" style="height: 40px">
|
||||
<el-radio v-model="state.inputType" label="new_outer_template"
|
||||
@ -17,7 +17,7 @@
|
||||
>{{ t('visualization.copy_template') }}
|
||||
</el-radio>
|
||||
</el-col>
|
||||
<el-col v-if="state.inputType === 'new_outer_template'" :span="6">
|
||||
<el-col v-if="state.inputType === 'new_outer_template'" :span="6" class="button-main">
|
||||
<el-button class="el-icon-upload" size="small" type="primary" @click="goFile"
|
||||
>{{ t('visualization.upload_template') }}
|
||||
</el-button>
|
||||
@ -25,21 +25,21 @@
|
||||
id="input"
|
||||
ref="files"
|
||||
type="file"
|
||||
accept=".DET"
|
||||
accept=".DET2"
|
||||
hidden
|
||||
@change="handleFileChange"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row style="margin-top: 5px">
|
||||
<el-col :span="4">{{ state.titleSuf }}{{ t('commons.name') }}</el-col>
|
||||
<el-col :span="4" class="name-area">名称</el-col>
|
||||
<el-col :span="20">
|
||||
<el-input v-model="state.dvCreateInfo.name" clearable size="mini" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-if="state.inputType === 'new_inner_template'" class="preview">
|
||||
<el-col :span="8" style="height: 100%; overflow-y: auto">
|
||||
<template-all-list
|
||||
<de-template-preview-list
|
||||
:template-list="state.templateList"
|
||||
@showCurrentTemplateInfo="showCurrentTemplateInfo"
|
||||
/>
|
||||
@ -68,13 +68,13 @@ import { computed, reactive, ref, watch } from 'vue'
|
||||
import { imgUrlTrans } from '@/utils/imgUtils'
|
||||
import { ElMessage } from 'element-plus-secondary'
|
||||
import { decompression } from '@/api/visualization/dataVisualization'
|
||||
import { deepCopy } from '@/utils/utils'
|
||||
import DeTemplatePreviewList from '@/views/common/DeTemplatePreviewList.vue'
|
||||
const { t } = useI18n()
|
||||
const emits = defineEmits(['finish'])
|
||||
const files = ref(null)
|
||||
const props = defineProps({
|
||||
editPanelOut: {
|
||||
type: Object,
|
||||
curCanvasType: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
@ -148,7 +148,8 @@ const showCurrentTemplateInfo = data => {
|
||||
|
||||
const getTree = () => {
|
||||
const request = {
|
||||
level: '-1',
|
||||
level: '0',
|
||||
leafDvType: props.curCanvasType,
|
||||
withChildren: true
|
||||
}
|
||||
state.loading = true
|
||||
@ -204,7 +205,7 @@ const handleFileChange = e => {
|
||||
reader.readAsText(file)
|
||||
}
|
||||
const goFile = () => {
|
||||
files.value.files.click()
|
||||
files.value.click()
|
||||
}
|
||||
|
||||
const close = () => {
|
||||
@ -221,22 +222,39 @@ defineExpose({
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.create-main {
|
||||
display: inherit;
|
||||
}
|
||||
|
||||
.name-area {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: left;
|
||||
}
|
||||
|
||||
.button-main {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: right;
|
||||
}
|
||||
.root-class {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: right;
|
||||
margin: 15px 0px 5px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.preview {
|
||||
margin-top: 5px;
|
||||
border: 1px solid #e6e6e6;
|
||||
height: 250px !important;
|
||||
height: 310px !important;
|
||||
overflow: hidden;
|
||||
background-size: 100% 100% !important;
|
||||
}
|
||||
|
||||
.preview-show {
|
||||
border-left: 1px solid #e6e6e6;
|
||||
height: 250px;
|
||||
height: 310px;
|
||||
background-size: 100% 100% !important;
|
||||
}
|
||||
</style>
|
||||
|
@ -15,6 +15,8 @@ import router from '@/router'
|
||||
import { useI18n } from '@/hooks/web/useI18n'
|
||||
import _ from 'lodash'
|
||||
import DeResourceCreateOpt from '@/views/common/DeResourceCreateOpt.vue'
|
||||
import { useCache } from '@/hooks/web/useCache'
|
||||
const { wsCache } = useCache()
|
||||
|
||||
const dvMainStore = dvMainStoreWithOut()
|
||||
const { dvInfo } = storeToRefs(dvMainStore)
|
||||
@ -95,7 +97,8 @@ const state = reactive({
|
||||
divided: true
|
||||
}
|
||||
],
|
||||
resourceTypeList: []
|
||||
resourceTypeList: [],
|
||||
templateCreatePid: 0
|
||||
})
|
||||
|
||||
state.resourceTypeList = [
|
||||
@ -244,6 +247,7 @@ const addOperation = (
|
||||
window.open(baseUrl, '_blank')
|
||||
}
|
||||
} else if (cmd === 'newFromTemplate') {
|
||||
state.templateCreatePid = data.id
|
||||
// newFromTemplate
|
||||
resourceCreateOpt.value.optInit()
|
||||
} else {
|
||||
@ -264,8 +268,18 @@ const resourceOptFinish = () => {
|
||||
getTree()
|
||||
}
|
||||
|
||||
const resourceCreateFinish = () => {
|
||||
const resourceCreateFinish = templateData => {
|
||||
// do create
|
||||
wsCache.set(`de-template-data`, JSON.stringify(templateData))
|
||||
const baseUrl =
|
||||
curCanvasType.value === 'dataV'
|
||||
? '#/dvCanvas?opt=create'
|
||||
: '#/dashboard?opt=create&createType=template'
|
||||
if (state.templateCreatePid) {
|
||||
window.open(baseUrl + `&pid=${state.templateCreatePid}`, '_blank')
|
||||
} else {
|
||||
window.open(baseUrl, '_blank')
|
||||
}
|
||||
}
|
||||
|
||||
const getParentKeys = (tree, targetKey, parentKeys = []) => {
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<el-col>
|
||||
<el-row style="margin-top: 5px">
|
||||
<el-row style="display: inherit; margin-top: 5px">
|
||||
<el-row>
|
||||
<el-input
|
||||
v-model="state.templateFilterText"
|
||||
@ -10,7 +10,7 @@
|
||||
prefix-icon="el-icon-search"
|
||||
/>
|
||||
</el-row>
|
||||
<el-row style="margin-top: 5px">
|
||||
<el-row style="display: inherit; margin-top: 5px">
|
||||
<el-tree
|
||||
ref="templateTree"
|
||||
:default-expanded-keys="state.defaultExpandedKeys"
|
||||
@ -23,23 +23,17 @@
|
||||
>
|
||||
<template #default="{ data }">
|
||||
<span class="custom-tree-node">
|
||||
<span style="display: flex; flex: 1 1 0%; width: 0px">
|
||||
<span v-if="data.nodeType === 'template'">
|
||||
<svg-icon icon-class="panel" class="ds-icon-scene" />
|
||||
</span>
|
||||
<span v-if="data.nodeType === 'folder'">
|
||||
<i class="el-icon-folder" />
|
||||
</span>
|
||||
<span
|
||||
:title="data.name"
|
||||
style="
|
||||
margin-left: 6px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
"
|
||||
>{{ data.name }}</span
|
||||
>
|
||||
<span class="custom-label">
|
||||
<el-icon style="font-size: 18px" v-if="data.nodeType === 'folder'">
|
||||
<Icon name="dv-folder"></Icon>
|
||||
</el-icon>
|
||||
<el-icon style="font-size: 18px" v-else-if="data.dvType === 'dashboard'">
|
||||
<Icon name="dv-dashboard-spine"></Icon>
|
||||
</el-icon>
|
||||
<el-icon class="icon-screen-new" style="font-size: 18px" v-else>
|
||||
<Icon name="icon_operation-analysis_outlined"></Icon>
|
||||
</el-icon>
|
||||
<span :title="data.name" class="custom-name">{{ data.name }}</span>
|
||||
</span>
|
||||
</span>
|
||||
</template>
|
||||
@ -57,6 +51,10 @@ const { t } = useI18n()
|
||||
const emits = defineEmits(['showCurrentTemplateInfo'])
|
||||
|
||||
const props = defineProps({
|
||||
curCanvasType: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
templateList: {
|
||||
type: Array,
|
||||
default: function () {
|
||||
@ -77,13 +75,28 @@ const filterNode = (value, data) => {
|
||||
}
|
||||
|
||||
const nodeClick = (data, node) => {
|
||||
findOne(data.id).then(res => {
|
||||
emits('showCurrentTemplateInfo', res.data)
|
||||
})
|
||||
if (data.nodeType === 'template') {
|
||||
findOne(data.id).then(res => {
|
||||
emits('showCurrentTemplateInfo', res.data)
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
<style scoped lang="less">
|
||||
.custom-label {
|
||||
display: flex;
|
||||
flex: 1 1 0%;
|
||||
width: 0px;
|
||||
}
|
||||
|
||||
.custom-name {
|
||||
margin-left: 6px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.custom-tree-node {
|
||||
flex: 1;
|
||||
display: flex;
|
@ -54,7 +54,7 @@ const viewEditorShow = computed(() => {
|
||||
onMounted(() => {
|
||||
window.addEventListener('storage', eventCheck)
|
||||
initDataset()
|
||||
const { resourceId, opt, pid } = window.DataEaseBi || router.currentRoute.value.query
|
||||
const { resourceId, opt, pid, createType } = window.DataEaseBi || router.currentRoute.value.query
|
||||
state.sourcePid = pid
|
||||
if (resourceId) {
|
||||
dataInitState.value = false
|
||||
@ -65,6 +65,14 @@ onMounted(() => {
|
||||
dataInitState.value = false
|
||||
nextTick(() => {
|
||||
dvMainStore.createInit('dashboard', null, pid)
|
||||
// 从模版新建
|
||||
if (createType === 'template') {
|
||||
const deTemplateDataStr = wsCache.get(`de-template-data`)
|
||||
const deTemplateData = JSON.parse(deTemplateDataStr)
|
||||
dvMainStore.setComponentData(JSON.parse(deTemplateData['componentData']))
|
||||
dvMainStore.setCanvasStyle(JSON.parse(deTemplateData['canvasStyleData']))
|
||||
dvMainStore.setCanvasViewInfo(deTemplateData['canvasViewInfo'])
|
||||
}
|
||||
dataInitState.value = true
|
||||
// preOpt
|
||||
canvasStyleData.value.component.chartTitle.color = '#000000'
|
||||
|
@ -1,18 +1,6 @@
|
||||
<template>
|
||||
<div style="width: 100%; height: 100%">
|
||||
<div class="de-template">
|
||||
<el-tabs v-model="state.currentTemplateType" @tab-click="handleClick">
|
||||
<el-tab-pane name="self">
|
||||
<template #label>
|
||||
<span>{{ t('visualization.user_template') }}</span>
|
||||
</template>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane name="system">
|
||||
<template #label>
|
||||
<span>{{ t('visualization.sys_template') }}</span>
|
||||
</template>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<div class="tabs-container flex-tabs">
|
||||
<div class="de-tabs-left">
|
||||
<de-template-list
|
||||
@ -354,16 +342,12 @@ onMounted(() => {
|
||||
<style lang="less" scoped>
|
||||
.de-template {
|
||||
height: 100%;
|
||||
background-color: var(--MainBG, #f5f6f7);
|
||||
|
||||
.tabs-container {
|
||||
height: calc(100% - 48px);
|
||||
background: var(--ContentBG, #ffffff);
|
||||
height: 100%;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.flex-tabs {
|
||||
margin-top: 16px;
|
||||
display: flex;
|
||||
background: #f5f6f7;
|
||||
}
|
||||
|
2
de-xpack
2
de-xpack
@ -1 +1 @@
|
||||
Subproject commit 42512e0da8e326349aadc72d901059ab366c664f
|
||||
Subproject commit 14d70f42b222b3fc573a0624eabf7002cdb237fa
|
@ -9,7 +9,7 @@ import java.util.List;
|
||||
public interface TemplateManageApi {
|
||||
|
||||
@PostMapping("/templateList")
|
||||
List<TemplateManageDTO> templateList(TemplateManageRequest request);
|
||||
List<TemplateManageDTO> templateList(@RequestBody TemplateManageRequest request);
|
||||
|
||||
@PostMapping("/save")
|
||||
TemplateManageDTO save(@RequestBody TemplateManageRequest request);
|
||||
@ -17,8 +17,8 @@ public interface TemplateManageApi {
|
||||
@DeleteMapping("/delete/{id}")
|
||||
void delete(@PathVariable String id);
|
||||
|
||||
@GetMapping("/findOne/{id}")
|
||||
VisualizationTemplateVO findOne(@PathVariable String id) throws Exception;
|
||||
@GetMapping("/findOne/{templateId}")
|
||||
VisualizationTemplateVO findOne(@PathVariable String templateId) throws Exception;
|
||||
|
||||
@PostMapping("/find")
|
||||
List<TemplateManageDTO> find(@RequestBody TemplateManageRequest request);
|
||||
|
@ -19,11 +19,14 @@ public class TemplateManageRequest extends VisualizationTemplateVO {
|
||||
|
||||
private Boolean withChildren = false;
|
||||
|
||||
private String leafDvType;
|
||||
|
||||
public TemplateManageRequest() {
|
||||
}
|
||||
|
||||
public TemplateManageRequest(String pid) {
|
||||
public TemplateManageRequest(String pid,String dvType) {
|
||||
super.setPid(pid);
|
||||
super.setDvType(dvType);
|
||||
withBlobs="N";
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user