Merge pull request #12590 from dataease/pr@dev@refactor_recover

refactor(仪表板): 编辑仪表板时,不保存返回支持同步恢复最后更改的视图信息 #11472
This commit is contained in:
王嘉豪 2024-10-09 15:38:05 +08:00 committed by GitHub
commit ea10b7ff60
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 62 additions and 1 deletions

View File

@ -165,6 +165,13 @@ public class ChartViewController {
chartViewCacheService.resetView(id);
}
@DePermission(type = DePermissionType.PANEL, level = ResourceAuthLevel.PANEL_LEVEL_VIEW, paramIndex = 0)
@ApiOperation("重置仪表板视图")
@PostMapping("/resetAllViewCache/{panelId}")
public void resetAllViewCache(@PathVariable String panelId) {
chartViewCacheService.resetAllPanelView(panelId);
}
@ApiOperation("校验视图Title")
@PostMapping("/checkTitle")
public String checkTitle(@RequestBody ChartViewCacheRequest request) {

View File

@ -49,6 +49,9 @@ public interface ExtChartViewMapper {
int updateToViewFromCache(@Param("viewId") String viewId );
int updateToViewFromCacheBatch(@Param("panelId") String panelId );
void copyCache(@Param("sourceViewId") String sourceViewId,@Param("newViewId") String newViewId);
void deleteNoUseView(@Param("viewIds") List<String> viewIds,@Param("panelId") String panelId );

View File

@ -611,6 +611,42 @@
where cve.id = cv.id and cv.id =#{viewId}
</update>
<update id="updateToViewFromCacheBatch">
UPDATE chart_view_cache cve
JOIN chart_view cv ON cve.id = cv.id
SET cv.`name` = cve.`name`,
cv.title = cve.title,
cv.scene_id = cve.scene_id,
cv.table_id = cve.table_id,
cv.`type` = cve.`type`,
cv.render = cve.render,
cv.result_count = cve.result_count,
cv.result_mode = cve.result_mode,
cv.create_by = cve.create_by,
cv.create_time = cve.create_time,
cv.update_time = cve.update_time,
cv.style_priority = cve.style_priority,
cv.chart_type = cve.chart_type,
cv.is_plugin = cve.is_plugin,
cv.x_axis = cve.x_axis,
cv.x_axis_ext = cve.x_axis_ext,
cv.y_axis = cve.y_axis,
cv.y_axis_ext = cve.y_axis_ext,
cv.ext_stack = cve.ext_stack,
cv.ext_bubble = cve.ext_bubble,
cv.custom_attr = cve.custom_attr,
cv.custom_style = cve.custom_style,
cv.custom_filter = cve.custom_filter,
cv.drill_fields = cve.drill_fields,
cv.senior = cve.senior,
cv.SNAPSHOT = cve.SNAPSHOT,
cv.data_from = cve.data_from,
cv.refresh_view_enable = cve.refresh_view_enable,
cv.refresh_unit = cve.refresh_unit,
cv.refresh_time = cve.refresh_time
WHERE cve.scene_id = cv.scene_id AND cv.scene_id = #{panelId};
</update>
<delete id="deleteNoUseView">
delete from chart_view
where scene_id = #{panelId} and create_time &lt; ( unix_timestamp()- 30 ) * 1000

View File

@ -28,4 +28,8 @@ public class ChartViewCacheService {
extChartViewMapper.updateToViewFromCache(viewId);
}
public void resetAllPanelView(String panelId){
extChartViewMapper.updateToViewFromCacheBatch(panelId);
}
}

View File

@ -128,6 +128,14 @@ export function resetViewCache(viewId, panelId) {
})
}
export function resetAllViewCache(panelId) {
return request({
url: '/chart/view/resetAllViewCache/' + panelId,
method: 'post',
loading: false
})
}
export function checkTitle(data) {
return request({
url: '/chart/view/checkTitle',

View File

@ -274,6 +274,7 @@ import { getPanelAllLinkageInfo, saveLinkage } from '@/api/panel/linkage'
import bus from '@/utils/bus'
import { queryPanelJumpInfo } from '@/api/panel/linkJump'
import { inOtherPlatform } from '@/utils/index'
import {resetAllViewCache} from "@/api/chart/chart";
export default {
name: 'Toolbar',
@ -576,7 +577,9 @@ export default {
this.$emit('changeAidedDesign')
},
closeNotSave() {
this.close()
resetAllViewCache(this.panelInfo.id).then(rep => {
this.close()
})
},
saveLinkage() {
this.$store.commit('canvasChange')