fix: 更新部分发布问题

This commit is contained in:
wangjiahao
2025-04-02 15:21:39 +08:00
committed by 王嘉豪
parent ea54189cb7
commit 1dadd2289c
5 changed files with 35 additions and 22 deletions

View File

@@ -514,7 +514,7 @@ public class DataVisualizationServer implements DataVisualizationApi {
coreVisualizationManage.move(request);
}
}
visualizationInfo.setStatus(request.getStatus()!=null?request.getStatus():CommonConstants.DV_STATUS.SAVED_UNPUBLISHED);
visualizationInfo.setStatus(CommonConstants.DV_STATUS.SAVED_UNPUBLISHED);
coreVisualizationManage.innerEdit(visualizationInfo);
//保存图表信息
chartDataManage.saveChartViewFromVisualization(request.getComponentData(), dvId, request.getCanvasViewInfo());

View File

@@ -204,7 +204,7 @@ const publishStatusChange = status => {
})
}
const saveCanvasWithCheck = () => {
const saveCanvasWithCheck = (withPublish = false, status?) => {
if (userStore.getOid && wsCache.get('user.oid') && userStore.getOid !== wsCache.get('user.oid')) {
ElMessageBox.confirm(t('components.from_other_organizations'), {
confirmButtonType: 'primary',
@@ -235,18 +235,18 @@ const saveCanvasWithCheck = () => {
})
} else {
const params = { name: dvInfo.value.name, leaf: true, id: dvInfo.value.pid || '0' }
resourceGroupOpt.value.optInit('leaf', params, 'newLeaf', true)
resourceGroupOpt.value.optInit('leaf', params, 'newLeaf', true, { withPublish, status })
return
}
}
checkCanvasChangePre(() => {
saveResource()
saveResource({ withPublish, status })
})
}
const saveResource = () => {
const saveResource = (checkParams?) => {
wsCache.delete('DE-DV-CATCH-' + dvInfo.value.id)
if (styleChangeTimes.value > 0) {
if (styleChangeTimes.value > 0 || checkParams.withPublish) {
dvMainStore.matrixSizeAdaptor()
queryList.value.forEach(ele => {
useEmitt().emitter.emit(`updateQueryCriteria${ele.id}`)
@@ -254,7 +254,6 @@ const saveResource = () => {
try {
canvasSave(() => {
snapshotStore.resetStyleChangeTimes()
ElMessage.success(t('common.save_success'))
let url = window.location.href
url = url.replace(/\?opt=create/, `?resourceId=${dvInfo.value.id}`)
if (!embeddedStore.baseUrl) {
@@ -276,6 +275,11 @@ const saveResource = () => {
snapshotStore.resetSnapshot()
})
}
if (checkParams.withPublish) {
publishStatusChange(checkParams.status)
} else {
ElMessage.success(t('commons.save_success'))
}
})
} catch (e) {
console.error(e)
@@ -726,8 +730,7 @@ const initOpenHandler = newWindow => {
</el-button>
<el-dropdown popper-class="menu-outer-dv_popper" trigger="hover">
<el-button
@click="publishStatusChange(1)"
:disabled="dvInfo.status === 1 || !dvInfo.id"
@click="saveCanvasWithCheck(true, 1)"
style="float: right; margin: 0 12px 0 0"
type="primary"
>

View File

@@ -120,11 +120,11 @@ const resourceOptFinish = param => {
dvInfo.value.dataState = 'ready'
dvInfo.value.pid = param.pid
dvInfo.value.name = param.name
saveCanvasWithCheck()
saveCanvasWithCheck(param.withPublish, param.status)
}
}
const saveCanvasWithCheck = () => {
const saveCanvasWithCheck = (withPublish = false, status?) => {
if (userStore.getOid && wsCache.get('user.oid') && userStore.getOid !== wsCache.get('user.oid')) {
ElMessageBox.confirm('已切换至新组织,无权保存其他组织的资源', {
confirmButtonType: 'primary',
@@ -154,24 +154,27 @@ const saveCanvasWithCheck = () => {
resourceAppOpt.value.init(params)
})
} else {
const params = { name: dvInfo.value.name, leaf: true, id: dvInfo.value.pid || '0' }
resourceGroupOpt.value.optInit('leaf', params, 'newLeaf', true)
const params = {
name: dvInfo.value.name,
leaf: true,
id: dvInfo.value.pid || '0'
}
resourceGroupOpt.value.optInit('leaf', params, 'newLeaf', true, { withPublish, status })
}
return
}
checkCanvasChangePre(() => {
saveResource()
saveResource({ withPublish, status })
})
}
const saveResource = () => {
if (styleChangeTimes.value > 0) {
const saveResource = (checkParams?) => {
if (styleChangeTimes.value > 0 || checkParams.withPublish) {
eventBus.emit('hideArea-canvas-main')
nextTick(() => {
canvasSave(() => {
snapshotStore.resetStyleChangeTimes()
wsCache.delete('DE-DV-CATCH-' + dvInfo.value.id)
ElMessage.success(t('commons.save_success'))
let url = window.location.href
url = url.replace(/\?opt=create/, `?dvId=${dvInfo.value.id}`)
if (!embeddedStore.baseUrl) {
@@ -192,6 +195,11 @@ const saveResource = () => {
snapshotStore.resetSnapshot()
})
}
if (checkParams.withPublish) {
publishStatusChange(checkParams.status)
} else {
ElMessage.success(t('commons.save_success'))
}
})
})
}
@@ -476,8 +484,7 @@ const fullScreenPreview = () => {
</el-button>
<el-dropdown effect="dark" popper-class="menu-outer-dv_popper" trigger="hover">
<el-button
@click="publishStatusChange(1)"
:disabled="dvInfo.status === 1 || !dvInfo.id"
@click="saveCanvasWithCheck(true, 1)"
style="float: right; margin: 0 12px 0 0"
type="primary"
>

View File

@@ -31,7 +31,8 @@ const { t } = useI18n()
const state = reactive({
tData: [],
nameList: [],
targetInfo: null
targetInfo: null,
attachParams: null
})
const showParentSelected = ref(false)
@@ -135,9 +136,10 @@ const getDialogTitle = exec => {
}
const placeholder = ref('')
const optInit = (type, data: BusiTreeNode, exec, parentSelect = false) => {
const optInit = (type, data: BusiTreeNode, exec, parentSelect = false, attachParams?) => {
showParentSelected.value = parentSelect
state.targetInfo = data
state.attachParams = attachParams
nodeType.value = type
const optSource = data.leaf || type === 'leaf' ? sourceLabel.value : t('visualization.folder')
const placeholderLabel =
@@ -286,7 +288,7 @@ const saveResource = () => {
}
if (cmd.value === 'newLeaf') {
resourceDialogShow.value = false
emits('finish', { opt: 'newLeaf', ...params })
emits('finish', { opt: 'newLeaf', ...params, ...state.attachParams })
} else {
loading.value = true
const method = methodMap[cmd.value] ? methodMap[cmd.value] : updateBase

View File

@@ -19,4 +19,5 @@ public class BusiResourceCreator implements Serializable {
private Long pid = 0L;
private Boolean leaf;
private int extraFlag;
private int extraFlag1;
}