mirror of
https://github.com/dataease/dataease.git
synced 2025-02-24 11:32:57 +08:00
fix: 普通用户不现实数据源配置信息
This commit is contained in:
parent
4758ae8a23
commit
631d852af3
@ -126,17 +126,20 @@ public class ChartDataServer implements ChartDataApi {
|
||||
request.setHeader(dsHeader);
|
||||
request.setExcelTypes(dsTypes);
|
||||
}
|
||||
for (Object[] objects : tableRow) {
|
||||
for (int i = 0; i < viewDTO.getXAxis().size(); i++) {
|
||||
if (viewDTO.getXAxis().get(i).getDeType().equals(DeTypeConstants.DE_INT) || viewDTO.getXAxis().get(i).getDeType().equals(DeTypeConstants.DE_FLOAT)) {
|
||||
try {
|
||||
objects[i] = valueFormatter(BigDecimal.valueOf(Double.valueOf(objects[i].toString())), viewDTO.getXAxis().get(i).getFormatterCfg());
|
||||
} catch (Exception ignore) {
|
||||
if (CollectionUtils.isNotEmpty(tableRow)) {
|
||||
for (Object[] objects : tableRow) {
|
||||
for (int i = 0; i < viewDTO.getXAxis().size(); i++) {
|
||||
if (viewDTO.getXAxis().get(i).getDeType().equals(DeTypeConstants.DE_INT) || viewDTO.getXAxis().get(i).getDeType().equals(DeTypeConstants.DE_FLOAT)) {
|
||||
try {
|
||||
objects[i] = valueFormatter(BigDecimal.valueOf(Double.valueOf(objects[i].toString())), viewDTO.getXAxis().get(i).getFormatterCfg());
|
||||
} catch (Exception ignore) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
request.setDetails(tableRow);
|
||||
request.setData(chartViewInfo.getData());
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -483,6 +483,23 @@ public class DatasourceServer implements DatasourceApi {
|
||||
return getDatasourceDTOById(datasourceId, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatasourceDTO getSimpleDs(Long datasourceId) throws DEException {
|
||||
CoreDatasource datasource = datasourceMapper.selectById(datasourceId);
|
||||
if (datasource == null) {
|
||||
DEException.throwException("不存在的数据源!");
|
||||
}
|
||||
if (datasource.getType().equalsIgnoreCase("api")) {
|
||||
datasource.setConfiguration("[]");
|
||||
} else {
|
||||
datasource.setConfiguration("");
|
||||
}
|
||||
datasource.setConfiguration("");
|
||||
DatasourceDTO datasourceDTO = new DatasourceDTO();
|
||||
BeanUtils.copyBean(datasourceDTO, datasource);
|
||||
return datasourceDTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatasourceDTO get(Long datasourceId) throws DEException {
|
||||
return getDatasourceDTOById(datasourceId, false);
|
||||
|
@ -655,16 +655,18 @@ public class ExportCenterManage implements BaseExportApi {
|
||||
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||
|
||||
if (CollectionUtils.isEmpty(request.getMultiInfo())) {
|
||||
List<Object[]> details = request.getDetails();
|
||||
Integer[] excelTypes = request.getExcelTypes();
|
||||
details.add(0, request.getHeader());
|
||||
ViewDetailField[] detailFields = request.getDetailFields();
|
||||
Object[] header = request.getHeader();
|
||||
if(request.getViewInfo().getType().equalsIgnoreCase("chart-mix-dual-line")){
|
||||
|
||||
//明细sheet
|
||||
Sheet detailsSheet = wb.createSheet("数据");
|
||||
}else {
|
||||
List<Object[]> details = request.getDetails();
|
||||
Integer[] excelTypes = request.getExcelTypes();
|
||||
details.add(0, request.getHeader());
|
||||
ViewDetailField[] detailFields = request.getDetailFields();
|
||||
Object[] header = request.getHeader();
|
||||
Sheet detailsSheet = wb.createSheet("数据");
|
||||
ChartDataServer.setExcelData(detailsSheet, cellStyle, header, details, detailFields, excelTypes);
|
||||
}
|
||||
|
||||
ChartDataServer.setExcelData(detailsSheet, cellStyle, header, details, detailFields, excelTypes);
|
||||
} else {
|
||||
//多个sheet
|
||||
for (int i = 0; i < request.getMultiInfo().size(); i++) {
|
||||
|
@ -155,6 +155,8 @@ export const getById = (id: number) => request.get({ url: '/datasource/get/' + i
|
||||
|
||||
export const getHidePwById = (id: number) => request.get({ url: '/datasource/hidePw/' + id })
|
||||
|
||||
export const getSimpleDs = (id: number) => request.get({ url: '/datasource/getSimpleDs/' + id })
|
||||
|
||||
export const uploadFile = async (data): Promise<IResponse> => {
|
||||
return request
|
||||
.post({
|
||||
|
@ -41,7 +41,13 @@ import { HandleMore } from '@/components/handle-more'
|
||||
import { Icon } from '@/components/icon-custom'
|
||||
import { fieldType } from '@/utils/attr'
|
||||
import { useEmitt } from '@/hooks/web/useEmitt'
|
||||
import { getHidePwById, listSyncRecord, uploadFile, perDeleteDatasource } from '@/api/datasource'
|
||||
import {
|
||||
getHidePwById,
|
||||
listSyncRecord,
|
||||
uploadFile,
|
||||
perDeleteDatasource,
|
||||
getSimpleDs
|
||||
} from '@/api/datasource'
|
||||
import CreatDsGroup from './form/CreatDsGroup.vue'
|
||||
import type { Tree } from '../dataset/form/CreatDsGroup.vue'
|
||||
import { previewData, getById } from '@/api/datasource'
|
||||
@ -549,7 +555,11 @@ const handleNodeClick = data => {
|
||||
dsListTree.value.setCurrentKey(null)
|
||||
return
|
||||
}
|
||||
return getHidePwById(data.id).then(res => {
|
||||
let method = getHidePwById
|
||||
if (data.weight < 7) {
|
||||
method = getSimpleDs
|
||||
}
|
||||
return method(data.id).then(res => {
|
||||
let {
|
||||
name,
|
||||
createBy,
|
||||
@ -893,6 +903,7 @@ const operation = (cmd: string, data: Tree, nodeType: string) => {
|
||||
const handleClick = (tabName: TabPaneName) => {
|
||||
switch (tabName) {
|
||||
case 'config':
|
||||
tableData.value = []
|
||||
listDatasourceTables({ datasourceId: nodeInfo.id }).then(res => {
|
||||
tabList.value = res.data.map(ele => {
|
||||
const { name, tableName } = ele
|
||||
@ -1421,7 +1432,9 @@ const getMenuList = (val: boolean) => {
|
||||
}}</BaseInfoItem>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<template v-if="!['Excel', 'API', 'es'].includes(nodeInfo.type)">
|
||||
<template
|
||||
v-if="!['Excel', 'API', 'es'].includes(nodeInfo.type) && nodeInfo.weight >= 7"
|
||||
>
|
||||
<el-row :gutter="24" v-show="nodeInfo.configuration.urlType !== 'jdbcUrl'">
|
||||
<el-col :span="12">
|
||||
<BaseInfoItem :label="t('datasource.host')">{{
|
||||
@ -1552,7 +1565,7 @@ const getMenuList = (val: boolean) => {
|
||||
</el-row>
|
||||
</template>
|
||||
</template>
|
||||
<template v-if="['es'].includes(nodeInfo.type)">
|
||||
<template v-if="['es'].includes(nodeInfo.type) && nodeInfo.weight >= 7">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12">
|
||||
<BaseInfoItem :label="t('datasource.datasource_url')">{{
|
||||
@ -1564,7 +1577,7 @@ const getMenuList = (val: boolean) => {
|
||||
</template>
|
||||
</BaseInfoContent>
|
||||
<BaseInfoContent
|
||||
v-if="nodeInfo.type === 'API'"
|
||||
v-if="nodeInfo.type === 'API' && nodeInfo.weight >= 7"
|
||||
v-slot="slotProps"
|
||||
:name="t('datasource.data_table')"
|
||||
>
|
||||
|
@ -5,6 +5,7 @@ import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author wangjiahao
|
||||
@ -26,4 +27,6 @@ public class ChartExcelRequest extends ChartExcelRequestInner {
|
||||
|
||||
private String downloadType;
|
||||
|
||||
private Map<String, Object> data;
|
||||
|
||||
}
|
||||
|
@ -87,16 +87,21 @@ public interface DatasourceApi {
|
||||
@Operation(summary = "删除")
|
||||
void delete(@PathVariable("datasourceId") Long datasourceId) throws DEException;
|
||||
|
||||
@DePermit({"#p0+':read'"})
|
||||
@DePermit({"#p0+':manage'"})
|
||||
@GetMapping("/get/{datasourceId}")
|
||||
@Operation(summary = "数据源详情")
|
||||
DatasourceDTO get(@PathVariable("datasourceId") Long datasourceId) throws DEException;
|
||||
|
||||
@DePermit({"#p0+':read'"})
|
||||
@DePermit({"#p0+':manage'"})
|
||||
@GetMapping("/hidePw/{datasourceId}")
|
||||
@Operation(summary = "数据源详情")
|
||||
DatasourceDTO hidePw(@PathVariable("datasourceId") Long datasourceId) throws DEException;
|
||||
|
||||
@DePermit({"#p0+':read'"})
|
||||
@GetMapping("/getSimpleDs/{datasourceId}")
|
||||
@Operation(summary = "数据源详情")
|
||||
DatasourceDTO getSimpleDs(@PathVariable("datasourceId") Long datasourceId) throws DEException;
|
||||
|
||||
|
||||
@PostMapping("/getTableField")
|
||||
@Operation(summary = "获取表字段")
|
||||
|
Loading…
Reference in New Issue
Block a user