mirror of
https://github.com/dataease/dataease.git
synced 2025-02-24 11:32:57 +08:00
Merge pull request #13723 from dataease/pr@dev-v2@fixExcel
Pr@dev v2@fix excel
This commit is contained in:
commit
5bffe53fa0
@ -60,6 +60,9 @@ public class NumericalChartHandler extends DefaultChartHandler {
|
||||
String maxType = (String) target.get(type);
|
||||
if (StringUtils.equalsIgnoreCase("dynamic", maxType)) {
|
||||
Map<String, Object> maxField = (Map<String, Object>) target.get(field);
|
||||
if (maxField.get("id") == null || StringUtils.isEmpty(maxField.get("id").toString())) {
|
||||
DEException.throwException(Translator.get("i18n_gauge_field_delete"));
|
||||
}
|
||||
Long id = Long.valueOf((String) maxField.get("id"));
|
||||
String summary = (String) maxField.get("summary");
|
||||
DatasetTableFieldDTO datasetTableField = datasetTableFieldManage.selectById(id);
|
||||
|
@ -486,6 +486,7 @@ public class ExcelUtils {
|
||||
tableFiled.setName(filedName);
|
||||
tableFiled.setOriginName(filedName);
|
||||
tableFiled.setFieldType(null);
|
||||
tableFiled.setChecked(true);
|
||||
fields.add(tableFiled);
|
||||
}
|
||||
|
||||
|
@ -808,19 +808,11 @@ public class DatasourceServer implements DatasourceApi {
|
||||
datasourceRequest.setDatasource(transDTO(coreDatasource));
|
||||
List<DatasetTableDTO> datasetTableDTOS = ExcelUtils.getTables(datasourceRequest);
|
||||
for (ExcelSheetData sheet : excelFileData.getSheets()) {
|
||||
boolean find = false;
|
||||
for (DatasetTableDTO datasetTableDTO : datasetTableDTOS) {
|
||||
if (excelDataTableName(datasetTableDTO.getTableName()).equals(sheet.getTableName()) || isCsv(file.getOriginalFilename())) {
|
||||
find = true;
|
||||
sheet.setDeTableName(datasetTableDTO.getTableName());
|
||||
datasourceRequest.setTable(datasetTableDTO.getTableName());
|
||||
List<TableField> oldTableFields = ExcelUtils.getTableFields(datasourceRequest);
|
||||
mergeFields(oldTableFields, sheet.getFields());
|
||||
}
|
||||
}
|
||||
if (!find) {
|
||||
sheet.setNewSheet(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -289,7 +289,11 @@ const saveItem = () => {
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < apiItem.fields.length; i++) {
|
||||
if (apiItem.fields[i].primaryKey && !apiItem.fields[i].length) {
|
||||
if (
|
||||
apiItem.fields[i].primaryKey &&
|
||||
!apiItem.fields[i].length &&
|
||||
apiItem.fields[i].deExtractType === 0
|
||||
) {
|
||||
ElMessage.error(t('datasource.primary_key_length') + apiItem.fields[i].name)
|
||||
return
|
||||
}
|
||||
|
@ -644,7 +644,7 @@ defineExpose({
|
||||
></SheetTabs>
|
||||
|
||||
<div class="table-select_mode">
|
||||
<div class="btn-select" v-if="param.id === '0' || sheetObj.newSheet">
|
||||
<div class="btn-select" v-if="param.editType === 0">
|
||||
<el-button
|
||||
@click="changeCurrentMode('preview')"
|
||||
:class="[currentMode === 'preview' && 'is-active']"
|
||||
@ -705,7 +705,7 @@ defineExpose({
|
||||
<el-table-column
|
||||
prop="length"
|
||||
:label="t('datasource.length')"
|
||||
v-if="param.id === '0' || sheetObj.newSheet"
|
||||
v-if="param.editType === 0"
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-input-number
|
||||
@ -728,7 +728,7 @@ defineExpose({
|
||||
class-name="checkbox-table"
|
||||
:label="t('datasource.set_key')"
|
||||
width="100"
|
||||
v-if="param.id === '0' || sheetObj.newSheet"
|
||||
v-if="param.editType === 0"
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-checkbox
|
||||
|
@ -1,10 +1,13 @@
|
||||
package io.dataease.extensions.view.dto;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.dataease.extensions.datasource.dto.DatasetTableFieldDTO;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ -23,4 +26,16 @@ public class ChartExtFilterDTO {
|
||||
@JsonIgnore
|
||||
private List<String> originValue;
|
||||
private int filterType;// 0-过滤组件,1-下钻,2-联动,外部参数
|
||||
|
||||
|
||||
public List<String> getValue() {
|
||||
if (CollectionUtils.isNotEmpty(value)) {
|
||||
List<String> values = new ArrayList<>();
|
||||
value.forEach(v -> {
|
||||
values.add(v.replace("\n", "\\n"));
|
||||
});
|
||||
return values;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user