更新画布菜单交互逻辑,画布生成或画布编辑图片更新外面版本图片
This commit is contained in:
@@ -279,3 +279,24 @@ export const threeToThreeViewsApi = (data:threeToThreeViewsData) => {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据sketchId更新VersionNode的sketch的URL值
|
||||
* @param data 根据sketchId更新VersionNode的sketchL值的参数
|
||||
* @param data.sketchId sketch id
|
||||
* @param data.newUrl 生成的3d模型地址
|
||||
* @returns 根据sketchId更新VersionNode的sketch的URL值
|
||||
*/
|
||||
export interface threeToThreeViewsData {
|
||||
sketchId?: string
|
||||
newUrl?: string
|
||||
}
|
||||
export const updateVersionSketchUrlApi = (data:threeToThreeViewsData) => {
|
||||
return request({
|
||||
url: `/api/canvas/sketchIdAndUrl/${data.sketchId}`,
|
||||
method: 'put',
|
||||
data:{
|
||||
newUrl: data.newUrl,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"
|
||||
>
|
||||
<span class="icon">
|
||||
<svg-icon :name="v.type + '-2'" size="15" size-unit="px" />
|
||||
<svg-icon :name="v.type.split('_')[0] + '-2'" size="15" size-unit="px" />
|
||||
</span>
|
||||
<span class="title">{{ v.title }}</span>
|
||||
</div>
|
||||
@@ -63,6 +63,25 @@
|
||||
},
|
||||
]
|
||||
}
|
||||
},{
|
||||
tier: NODE_DATATIER.SURFACE_EDIT_,
|
||||
type: NODE_DATATYPE.SURFACE_EDIT_,
|
||||
title: t('FlowCanvas.surfaceEditTitle'),
|
||||
secondaryMenu: {
|
||||
title: t('FlowCanvas.surfaceEditTitle'),
|
||||
icon: NODE_DATATYPE.SURFACE_EDIT_,
|
||||
selectList: [
|
||||
{
|
||||
tier: NODE_DATATIER.CANVAS_MODE_,
|
||||
type: NODE_DATATYPE.CANVAS_MODE_,
|
||||
title: t('FlowCanvas.surfaceEditCanvasTitle'),
|
||||
},{
|
||||
tier: NODE_DATATIER.Fast_MODE_,
|
||||
type: NODE_DATATYPE.Fast_MODE_,
|
||||
title: t('FlowCanvas.surfaceEditTitle'),
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
tier: NODE_DATATIER.SCENE_COMPOSITION,
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
import myEvent from '@/utils/myEvent'
|
||||
import { getCurrentTime } from '../../../../tools/tools.ts'
|
||||
import { NODE_DATATIER } from '../../../tools/index.d'
|
||||
import { updateVersionSketchUrlApi } from '@/api/flow-canvas'
|
||||
const attrs = useAttrs()
|
||||
const stateManager = inject('stateManager') as any
|
||||
const nodeManager = inject('nodeManager') as any
|
||||
@@ -24,7 +25,7 @@
|
||||
return {
|
||||
}
|
||||
}
|
||||
const opCanvas = ()=>{
|
||||
const opCanvas = (tier)=>{
|
||||
const superiorNodeUrl = stateManager.getSuperiorNodeImage(attrs?.node?.data?.superiorID || null)
|
||||
if (!superiorNodeUrl) console.log('superiorNodeUrl 找不到原始图片')
|
||||
const data = {
|
||||
@@ -46,7 +47,7 @@
|
||||
superiorID: attrs.node.id,
|
||||
superiorNodeType: attrs.node?.data?.type,
|
||||
createIndexPosition: 0 + subordNodes.length,
|
||||
tier: NODE_DATATIER.RESULT_IMAGE,
|
||||
tier,
|
||||
isActive: subordNodes.length == 0,
|
||||
data: {
|
||||
imageProcessTasks:[workbenchData],
|
||||
@@ -54,6 +55,11 @@
|
||||
}
|
||||
}
|
||||
})
|
||||
//更新VersionNode的sketchIDAndUrl中指定key的URL值
|
||||
updateVersionSketchUrlApi({
|
||||
sketchId: stateManager.sketchId.value,
|
||||
newUrl: options.url,
|
||||
})
|
||||
},
|
||||
}
|
||||
eventManager.removeEvents()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="header">
|
||||
<svg-icon
|
||||
v-if="attrs.node?.data?.secondaryMenu?.icon || !currentComponent?.hideIcon"
|
||||
:name="attrs.node?.data?.secondaryMenu?.icon || currentComponent?.type"
|
||||
:name="attrs.node?.data?.secondaryMenu?.icon || currentComponent?.type.split('_')[0]"
|
||||
color="#fff"
|
||||
size="16"
|
||||
size-unit="px"
|
||||
@@ -73,7 +73,7 @@
|
||||
{
|
||||
tier: NODE_DATATIER.TO_REAL_VARIANTS,
|
||||
type: NODE_DATATYPE.TO_REAL_VARIANTS,
|
||||
title: 'To Real Variants',
|
||||
title: t('FlowCanvas.toRealVariantsTitle'),
|
||||
component: ToRealVariants,
|
||||
api: toRealVariantsApi
|
||||
},
|
||||
@@ -92,7 +92,25 @@
|
||||
hideFooter: true,
|
||||
showCanvasEdit: true,
|
||||
on: ()=>{
|
||||
componentRef.value?.opCanvas()
|
||||
componentRef.value?.opCanvas(0)
|
||||
}
|
||||
},
|
||||
{
|
||||
tier: NODE_DATATIER.Fast_MODE_,
|
||||
type: NODE_DATATYPE.Fast_MODE_,
|
||||
title: t('FlowCanvas.surfaceEditTitle'),
|
||||
component: SurfaceEdit,
|
||||
api: sketchAddPrintApi
|
||||
},
|
||||
{
|
||||
tier: NODE_DATATIER.CANVAS_MODE_,
|
||||
type: NODE_DATATYPE.CANVAS_MODE_,
|
||||
title: t('FlowCanvas.surfaceEditCanvasTitle'),
|
||||
component: FastMode,
|
||||
hideFooter: true,
|
||||
showCanvasEdit: true,
|
||||
on: ()=>{
|
||||
componentRef.value?.opCanvas(1)
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -155,6 +173,7 @@
|
||||
const onGenerateClick = async () => {
|
||||
const data = componentRef.value?.getApiData?.() || {}
|
||||
const subordNodes = stateManager.getSubordNodes(attrs.node.id)
|
||||
const maxPosition = subordNodes.length == 0?0:(subordNodes[subordNodes.length - 1].data.createIndexPosition + 1)
|
||||
const superiorNodeUrl = stateManager.getSuperiorNodeImage(attrs.node.data.superiorID)
|
||||
if(!superiorNodeUrl)return console.log('superiorNodeUrl 找不到原始图片')
|
||||
emit('update-data', componentRef.value?.data)
|
||||
@@ -175,12 +194,16 @@
|
||||
NODE_DATATYPE.CANVAS_MODE,
|
||||
NODE_DATATYPE.SCENE_COMPOSITION,
|
||||
NODE_DATATYPE.COLOR_PALETTE,
|
||||
NODE_DATATYPE.Fast_MODE_,
|
||||
NODE_DATATYPE.CANVAS_MODE_,
|
||||
]
|
||||
let tritList = [
|
||||
NODE_DATATIER.Fast_MODE,
|
||||
NODE_DATATIER.CANVAS_MODE,
|
||||
NODE_DATATIER.SCENE_COMPOSITION,
|
||||
NODE_DATATIER.COLOR_PALETTE,
|
||||
NODE_DATATIER.Fast_MODE_,
|
||||
NODE_DATATIER.CANVAS_MODE_,
|
||||
]
|
||||
let tier = (tritList.includes(currentComponent.value.tier) && typeList.includes(currentComponent.value.type))?currentComponent.value.tier - 1:currentComponent.value.tier
|
||||
if(NODE_DATATYPE.TO_REAL_STYLE == currentComponent.value.type && false){
|
||||
@@ -206,7 +229,7 @@
|
||||
superiorID: attrs.node.id,
|
||||
superiorNodeType: attrs.node?.data?.type,
|
||||
superiorGenerateImg: superiorNodeUrl || null,
|
||||
createIndexPosition: index + subordNodes.length,
|
||||
createIndexPosition: index + maxPosition,
|
||||
tier: tier,
|
||||
isActive: index == 0 && subordNodes.length == 0,
|
||||
data: {
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
import HighlightAdmin from '@/components/highlightAdmin.vue'
|
||||
import { NODE_DATATIER, NODE_DATATYPE } from '../../tools/index.d'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { updateVersionSketchUrlApi } from '@/api/flow-canvas'
|
||||
const { t } = useI18n()
|
||||
const openImagePreview = inject('openImagePreview') as (url: string) => void
|
||||
const openThreeModelPreview = inject('openThreeModelPreview') as (obj: any) => void
|
||||
@@ -225,6 +226,11 @@
|
||||
}
|
||||
depthCanvasWorkbench(workbenchData)
|
||||
depthCanvasClose()
|
||||
//更新VersionNode的sketchIDAndUrl中指定key的URL值
|
||||
updateVersionSketchUrlApi({
|
||||
sketchId: stateManager.sketchId.value,
|
||||
newUrl: options.url,
|
||||
})
|
||||
},
|
||||
onClose:depthCanvasClose
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
import { ref } from 'vue'
|
||||
import { getSketchFlowCanvas } from '@/api/flow-canvas'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import myEvent from '@/utils/myEvent'
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const config = ref({}) as any
|
||||
@@ -33,6 +34,7 @@
|
||||
}
|
||||
const close = async () => {
|
||||
dialogVisible.value = false
|
||||
myEvent.emit('closeFlowCanvas')
|
||||
}
|
||||
defineExpose({
|
||||
open,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { getTaskidResult } from '@/api/flow-canvas'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { updateVersionSketchUrlApi } from '@/api/flow-canvas'
|
||||
|
||||
// interface NodeOptions {
|
||||
// }
|
||||
@@ -54,6 +55,12 @@ export class GenerateManager {
|
||||
nodeDataItem.url = item.url
|
||||
nodeDataItem.createTime = item.createTime
|
||||
nodeDataItem.status = item.status
|
||||
|
||||
//更新VersionNode的sketchIDAndUrl中指定key的URL值
|
||||
updateVersionSketchUrlApi({
|
||||
sketchId: this.stateManager.sketchId.value,
|
||||
newUrl: item.url,
|
||||
})
|
||||
if(item.glbPath){
|
||||
nodeDataItem.glbPath = item.glbPath
|
||||
nodeDataItem.glbInfoObj = item.glbInfoObj
|
||||
|
||||
@@ -28,6 +28,9 @@ export const NODE_DATATYPE = {
|
||||
SURFACE_EDIT: 'surface-edit',
|
||||
CANVAS_MODE: 'canvas-mode',
|
||||
Fast_MODE: 'fast-mode',
|
||||
SURFACE_EDIT_: 'surface-edit_',
|
||||
CANVAS_MODE_: 'canvas-mode_',
|
||||
Fast_MODE_: 'fast-mode_',
|
||||
SCENE_COMPOSITION: 'scene-composition',
|
||||
COLOR_PALETTE: 'color-palette',
|
||||
TO_3D_MODEL: 'to-3d-model',
|
||||
@@ -41,9 +44,12 @@ export const NODE_DATATIER = {
|
||||
CARDS_SELECT: 0,
|
||||
TO_REAL_STYLE: 1,
|
||||
TO_REAL_VARIANTS: 1,
|
||||
SURFACE_EDIT: 2,
|
||||
CANVAS_MODE: 2,
|
||||
Fast_MODE: 2,
|
||||
SURFACE_EDIT: 1,
|
||||
CANVAS_MODE: 1,
|
||||
Fast_MODE: 1,
|
||||
SURFACE_EDIT_: 2,
|
||||
CANVAS_MODE_: 2,
|
||||
Fast_MODE_: 2,
|
||||
SCENE_COMPOSITION: 2,
|
||||
COLOR_PALETTE: 2,
|
||||
TO_3D_MODEL: 2,
|
||||
|
||||
Reference in New Issue
Block a user