fix: 除明细表外,对于其他图表类型,脱敏字段不展示

This commit is contained in:
taojinlong 2024-06-14 17:21:48 +08:00
parent 58ce241e8d
commit aacc847e20
6 changed files with 19 additions and 16 deletions

View File

@ -1594,7 +1594,7 @@ public class ChartDataManage {
private List<ChartViewFieldDTO> getAllChartFields(ChartViewDTO view) {
// get all fields
Map<String, List<ChartViewFieldDTO>> stringListMap = chartViewManege.listByDQ(view.getTableId(), view.getId());
Map<String, List<ChartViewFieldDTO>> stringListMap = chartViewManege.listByDQ(view.getTableId(), view.getId(), view);
List<ChartViewFieldDTO> dimensionList = stringListMap.get("dimensionList");
List<ChartViewFieldDTO> quotaList = stringListMap.get("quotaList");
List<ChartViewFieldDTO> allFields = new ArrayList<>();

View File

@ -118,7 +118,7 @@ public class ChartViewManege {
return chartDataManage.calcData(details);
}
public Map<String, List<ChartViewFieldDTO>> listByDQ(Long id, Long chartId) {
public Map<String, List<ChartViewFieldDTO>> listByDQ(Long id, Long chartId, ChartViewDTO chartViewDTO) {
QueryWrapper<CoreDatasetTableField> wrapper = new QueryWrapper<>();
wrapper.eq("dataset_group_id", id);
wrapper.eq("checked", true);
@ -133,6 +133,9 @@ public class ChartViewManege {
// filter column disable field
Map<String, ColumnPermissionItem> desensitizationList = new HashMap<>();
List<DatasetTableFieldDTO> datasetTableFieldDTOS = permissionManage.filterColumnPermissions(collect, desensitizationList, id, null);
if (!chartViewDTO.getType().equalsIgnoreCase("table-info")) {
datasetTableFieldDTOS = datasetTableFieldDTOS.stream().filter(datasetTableFieldDTO -> !desensitizationList.keySet().contains(datasetTableFieldDTO.getDataeaseName())).collect(Collectors.toList());
}
datasetTableFieldDTOS.add(createCountField(id));
List<ChartViewFieldDTO> list = transFieldDTO(datasetTableFieldDTOS);

View File

@ -34,8 +34,8 @@ public class ChartViewServer implements ChartViewApi {
}
@Override
public Map<String, List<ChartViewFieldDTO>> listByDQ(Long id, Long chartId) {
return chartViewManege.listByDQ(id, chartId);
public Map<String, List<ChartViewFieldDTO>> listByDQ(Long id, Long chartId, ChartViewDTO dto) {
return chartViewManege.listByDQ(id, chartId, dto);
}
@Override

View File

@ -26,8 +26,8 @@ export interface ComponentInfo {
datasetId: string
}
export const getFieldByDQ = async (id, chartId): Promise<IResponse> => {
return request.post({ url: `/chart/listByDQ/${id}/${chartId}`, data: {} }).then(res => {
export const getFieldByDQ = async (id, chartId, data): Promise<IResponse> => {
return request.post({ url: `/chart/listByDQ/${id}/${chartId}`, data: data }).then(res => {
return res?.data
})
}

View File

@ -213,7 +213,7 @@ watch(
{ deep: true }
)
const watchDs = () => {
getFields(props.view.tableId, props.view.id)
getFields(props.view.tableId, props.view.id, props.view.type)
const nodeId = view.value['tableId']
if (!!nodeId) {
cacheId = nodeId as unknown as string
@ -223,10 +223,10 @@ const watchDs = () => {
curDatasetWeight.value = node.data.weight
}
}
const getFields = (id, chartId) => {
const getFields = (id, chartId, type) => {
if (id && chartId) {
fieldLoading.value = true
getFieldByDQ(id, chartId)
getFieldByDQ(id, chartId, { type: type })
.then(res => {
state.dimension = (res.dimensionList as unknown as Field[]) || []
state.quota = (res.quotaList as unknown as Field[]) || []
@ -1294,7 +1294,7 @@ const confirmEditCalc = () => {
const obj = cloneDeep(calcEdit.value.fieldForm)
setFieldDefaultValue(obj)
saveField(obj).then(() => {
getFields(view.value.tableId, view.value.id)
getFields(view.value.tableId, view.value.id, view.value.type)
closeEditCalc()
})
}
@ -1310,7 +1310,7 @@ const chartFieldEdit = param => {
state.currEditField.name = getFieldName(state.dimension.concat(state.quota), param.item.name)
saveField(state.currEditField).then(() => {
getFields(view.value.tableId, view.value.id)
getFields(view.value.tableId, view.value.id, view.value.type)
})
break
case 'edit':
@ -1318,7 +1318,7 @@ const chartFieldEdit = param => {
break
case 'delete':
deleteField(param.item?.id).then(() => {
getFields(view.value.tableId, view.value.id)
getFields(view.value.tableId, view.value.id, view.value.type)
})
break
}
@ -1534,7 +1534,7 @@ const copyChartFieldItem = id => {
fieldLoading.value = true
copyChartField(id, view.value.id)
.then(() => {
getFields(view.value.tableId, view.value.id)
getFields(view.value.tableId, view.value.id, view.value.type)
})
.catch(() => {
fieldLoading.value = false
@ -1545,7 +1545,7 @@ const deleteChartFieldItem = id => {
fieldLoading.value = true
deleteChartField(id)
.then(() => {
getFields(view.value.tableId, view.value.id)
getFields(view.value.tableId, view.value.id, view.value.type)
})
.catch(() => {
fieldLoading.value = false
@ -2557,7 +2557,7 @@ const deleteChartFieldItem = id => {
<el-icon
class="field-search-icon-btn"
:class="{ dark: themes === 'dark' }"
@click="getFields(view.tableId, view.id)"
@click="getFields(view.tableId, view.id, view.type)"
>
<Icon
name="icon_refresh_outlined"

View File

@ -26,7 +26,7 @@ public interface ChartViewApi {
@Operation(summary = "获取图表字段")
@PostMapping("listByDQ/{id}/{chartId}")
Map<String, List<ChartViewFieldDTO>> listByDQ(@PathVariable Long id, @PathVariable Long chartId);
Map<String, List<ChartViewFieldDTO>> listByDQ(@PathVariable Long id, @PathVariable Long chartId, @RequestBody ChartViewDTO dto);
@Operation(summary = "保存图表")
@PostMapping("save")