Merge pull request #6669 from dataease/pr@dev-v2@fix_template

fix: 打包问题
This commit is contained in:
王嘉豪 2023-11-13 18:15:48 +08:00 committed by GitHub
commit cd8afcb432
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 68 additions and 26 deletions

View File

@ -0,0 +1,41 @@
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.ne("view_id",viewId);
List<VisualizationTemplateExtendData> extendDataList = extendDataMapper.selectList(queryWrapper);
if (CollectionUtils.isNotEmpty(extendDataList)) {
ChartViewDTO chartViewTemplate = JsonUtil.parse(extendDataList.get(0).getViewDetails(),ChartViewDTO.class);
Map<String, Object> dataInfo = chartViewTemplate.getData();
view.setData(chartViewTemplate.getData());
} else {
DEException.throwException("模板缓存数据中未获取指定视图数据:" + viewId);
}
return view;
}
}

View File

@ -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,14 +25,14 @@
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>
@ -204,7 +204,7 @@ const handleFileChange = e => {
reader.readAsText(file)
}
const goFile = () => {
files.value.files.click()
files.value.click()
}
const close = () => {
@ -221,22 +221,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>

View File

@ -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;
}