Merge pull request #7732 from dataease/pr@dev-v2@fix_copy-auth

fix: 修复复制可视化资源出现权限变更的问题
This commit is contained in:
王嘉豪 2024-01-22 13:40:01 +08:00 committed by GitHub
commit ce3b78e51d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 33 additions and 4 deletions

View File

@ -89,6 +89,16 @@ public class DataVisualizationServer implements DataVisualizationApi {
@Resource
private VisualizationWatermarkMapper watermarkMapper;
@Override
public DataVisualizationVO findCopyResource(Long dvId, String busiFlag) {
DataVisualizationVO result = findById(dvId, busiFlag);
if(result !=null && result.getPid() == -1){
return result;
}else{
return null;
}
}
@Override
@XpackInteract(value = "dataVisualizationServer", original = true)
public DataVisualizationVO findById(Long dvId, String busiFlag) {

View File

@ -16,6 +16,10 @@ export interface Panel {
updateBy: string
}
export const findCopyResource = async (dvId, busiFlag): Promise<IResponse> => {
return request.get({ url: '/findCopyResource/findById/' + dvId + '/' + busiFlag })
}
export const findById = async (dvId, busiFlag): Promise<IResponse> => {
let busiFlagResult = busiFlag
if (!busiFlagResult) {

View File

@ -5,7 +5,12 @@ import componentList, {
} from '@/custom-component/component-list'
import eventBus from '@/utils/eventBus'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { findById, saveCanvas, updateCanvas } from '@/api/visualization/dataVisualization'
import {
findById,
findCopyResource,
saveCanvas,
updateCanvas
} from '@/api/visualization/dataVisualization'
import { storeToRefs } from 'pinia'
import { getPanelAllLinkageInfo } from '@/api/visualization/linkage'
import { queryVisualizationJumpInfo } from '@/api/visualization/linkJump'
@ -78,7 +83,10 @@ export function commonHandleDragEnd(e, dvModel) {
}
export function initCanvasDataPrepare(dvId, busiFlag, callBack) {
findById(dvId, busiFlag).then(res => {
const copyFlag = busiFlag != null && busiFlag.includes('-copy')
const busiFlagCustom = copyFlag ? busiFlag.split('-')[0] : busiFlag
const method = copyFlag ? findCopyResource : findById
method(dvId, busiFlagCustom).then(res => {
const canvasInfo = res.data
const watermarkInfo = {
...canvasInfo.watermarkInfo,

View File

@ -81,7 +81,8 @@ onMounted(async () => {
state.sourcePid = pid
if (resourceId) {
dataInitState.value = false
initCanvasData(resourceId, 'dashboard', function () {
const busiFlg = opt === 'copy' ? 'dashboard-copy' : 'dashboard'
initCanvasData(resourceId, busiFlg, function () {
dataInitState.value = true
if (dvInfo.value && opt === 'copy') {
dvInfo.value.dataState = 'prepare'

View File

@ -204,7 +204,8 @@ onMounted(async () => {
initDataset()
if (dvId) {
state.canvasInitStatus = false
initCanvasData(dvId, 'dataV', function () {
const busiFlg = opt === 'copy' ? 'dataV-copy' : 'dataV'
initCanvasData(dvId, busiFlg, function () {
state.canvasInitStatus = true
// afterInit
nextTick(() => {

View File

@ -34,6 +34,11 @@ public interface DataVisualizationApi {
@Operation(summary = "查询可视化资源")
DataVisualizationVO findById(@PathVariable("dvId") Long dvId,@PathVariable("busiFlag") String busiFlag);
@GetMapping("/findCopyResource/{dvId}/{busiFlag}")
@Operation(summary = "查询临时复制资源")
DataVisualizationVO findCopyResource(@PathVariable("dvId") Long dvId,@PathVariable("busiFlag") String busiFlag);
@PostMapping("/saveCanvas")
@DePermit(value = {"#p0.pid + ':manage'"}, busiFlag = "#p0.type")
@Operation(summary = "画布保存")