Merge branch 'main' of http://18.167.251.121:10003/aidlab/FiDA_Front
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<!-- 高级工具选择 -->
|
||||
<div class="cards-select">
|
||||
<div v-for="v in list" :key="v.type" @click="onClickItem(v)" v-show="v.tier === tier">
|
||||
<div v-for="v in (node.data?.secondaryMenu?.selectList || list)" :key="v.type" @click="onClickItem(v)" v-show="v.tier === tier">
|
||||
<span class="icon">
|
||||
<svg-icon :name="v.type + '-2'" size="15" size-unit="px" />
|
||||
</span>
|
||||
@@ -28,7 +28,22 @@
|
||||
{
|
||||
tier: NODE_DATATIER.SURFACE_EDIT,
|
||||
type: NODE_DATATYPE.SURFACE_EDIT,
|
||||
title: 'Surface Edit'
|
||||
title: 'Surface Edit',
|
||||
secondaryMenu: {
|
||||
title: 'Surface Edit',
|
||||
icon: NODE_DATATYPE.SURFACE_EDIT,
|
||||
selectList: [
|
||||
{
|
||||
tier: NODE_DATATIER.CANVAS_MODE,
|
||||
type: NODE_DATATYPE.CANVAS_MODE,
|
||||
title: 'Surface Edit (Canvas)',
|
||||
},{
|
||||
tier: NODE_DATATIER.Fast_MODE,
|
||||
type: NODE_DATATYPE.Fast_MODE,
|
||||
title: 'Surface Edit',
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
tier: NODE_DATATIER.SCENE_COMPOSITION,
|
||||
@@ -55,15 +70,27 @@
|
||||
const id = props.node.id
|
||||
if (!id) return
|
||||
stateManager.deleteNode(id)
|
||||
const superiorID = props.node.data.superiorID
|
||||
nodeManager.createCardNode({
|
||||
data: {
|
||||
tier: v.tier,
|
||||
type: v.type,
|
||||
superiorID,
|
||||
originalImage: props.node.data?.originalImage,
|
||||
}
|
||||
})
|
||||
console.log(props.node)
|
||||
if(v.secondaryMenu){
|
||||
nodeManager.createCardsSelect({
|
||||
data: {
|
||||
tier: props.node.data?.tier,
|
||||
superiorID: props.node.data?.superiorID,
|
||||
originalImage: props.node.data?.originalImage,
|
||||
secondaryMenu: v.secondaryMenu
|
||||
}
|
||||
})
|
||||
}else{
|
||||
const superiorID = props.node.data.superiorID
|
||||
nodeManager.createCardNode({
|
||||
data: {
|
||||
tier: v.tier,
|
||||
type: v.type,
|
||||
superiorID,
|
||||
originalImage: props.node.data?.originalImage,
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({})
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
<template>
|
||||
<!-- 画布编辑印花 -->
|
||||
<div class="fast-mode">
|
||||
<p class="label">Output</p>
|
||||
<div class="imgBox">
|
||||
<img :src="data.url" alt="">
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive, inject, useAttrs } from 'vue'
|
||||
import myEvent from '@/utils/myEvent'
|
||||
import { getCurrentTime } from '../../../../tools/tools.ts'
|
||||
import { NODE_DATATIER } from '../../../tools/index.d'
|
||||
const attrs = useAttrs()
|
||||
const data = reactive({
|
||||
url: attrs.node?.data?.originalImage,
|
||||
})
|
||||
const stateManager = inject('stateManager') as any
|
||||
const nodeManager = inject('nodeManager') as any
|
||||
const eventManager = inject('eventManager') as any
|
||||
const getApiData = ()=>{
|
||||
return {
|
||||
}
|
||||
}
|
||||
const opCanvas = ()=>{
|
||||
const data = {
|
||||
url:attrs?.node?.data?.originalImage,
|
||||
canvasId: attrs?.node?.data?.canvasId || null,
|
||||
sketchId: stateManager.sketchId.value,
|
||||
onWorkbench:(options)=>{
|
||||
let taskId = Date.now()
|
||||
let workbenchData = {
|
||||
createTime: getCurrentTime(),
|
||||
status: 'RETURNED',
|
||||
taskId: taskId + '',
|
||||
...options,
|
||||
}
|
||||
const subordNodes = stateManager.getSubordNodes(attrs.node.id)
|
||||
|
||||
nodeManager.createResultNode({
|
||||
data: {
|
||||
superiorID: attrs.node.id,
|
||||
superiorNodeType: attrs.node?.data?.type,
|
||||
createIndexPosition: 0 + subordNodes.length,
|
||||
tier: NODE_DATATIER.RESULT_IMAGE,
|
||||
isActive: subordNodes.length == 0,
|
||||
data: {
|
||||
imageProcessTasks:[workbenchData],
|
||||
selectTaskId:taskId + '',
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
eventManager.removeEvents()
|
||||
myEvent.emit('openDepthCanvas', data)
|
||||
}
|
||||
defineExpose({ data, getApiData, opCanvas })
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.fast-mode {
|
||||
margin-bottom: 40px;
|
||||
> .imgBox{
|
||||
width: 217px;
|
||||
height: 217px;
|
||||
padding: 7.5px;
|
||||
> img{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -2,13 +2,13 @@
|
||||
<div class="card">
|
||||
<div class="header">
|
||||
<svg-icon
|
||||
v-if="!currentComponent?.hideIcon"
|
||||
:name="currentComponent?.type"
|
||||
v-if="attrs.node?.data?.secondaryMenu?.icon || !currentComponent?.hideIcon"
|
||||
:name="attrs.node?.data?.secondaryMenu?.icon || currentComponent?.type"
|
||||
color="#fff"
|
||||
size="16"
|
||||
size-unit="px"
|
||||
/>
|
||||
<span>{{ currentComponent?.title }}</span>
|
||||
<span>{{ attrs.node?.data?.secondaryMenu?.title ||currentComponent?.title }}</span>
|
||||
<div class="delete-icon" @click="onDeleteClick">
|
||||
<SvgIcon name="flowDelete" size="16" size-unit="px" color="#fff" />
|
||||
</div>
|
||||
@@ -22,6 +22,12 @@
|
||||
<span>Generate</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="footer canvasEdit" @mousedown.stop v-if="currentComponent?.showCanvasEdit">
|
||||
<button @click="currentComponent?.on()">
|
||||
<svg-icon name="xingxing" size="16" size-unit="px" />
|
||||
<span>Edit</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -31,6 +37,7 @@
|
||||
import CardsSelect from './cards-select.vue'
|
||||
import ToRealStyle from './to-real-style.vue'
|
||||
import SurfaceEdit from './surface-edit.vue'
|
||||
import FastMode from './fast-mode.vue'
|
||||
import SceneComposition from './scene-composition.vue'
|
||||
import ColorPalette from './color-palette.vue'
|
||||
import To3View from './to-3view.vue'
|
||||
@@ -41,6 +48,8 @@
|
||||
// import ToVideo from './to-video.vue'
|
||||
// import AddPrint from './add-print.vue'
|
||||
// import ToCAD from './to-cad.vue'
|
||||
const attrs = useAttrs()
|
||||
const componentRef = ref(null)
|
||||
const components = [
|
||||
{
|
||||
tier: NODE_DATATIER.CARDS_SELECT,
|
||||
@@ -58,12 +67,23 @@
|
||||
api: toRealStyleApi
|
||||
},
|
||||
{
|
||||
tier: NODE_DATATIER.SURFACE_EDIT,
|
||||
type: NODE_DATATYPE.SURFACE_EDIT,
|
||||
tier: NODE_DATATIER.Fast_MODE,
|
||||
type: NODE_DATATYPE.Fast_MODE,
|
||||
title: 'Surface Edit',
|
||||
component: SurfaceEdit,
|
||||
api: sketchAddPrintApi
|
||||
},
|
||||
{
|
||||
tier: NODE_DATATIER.CANVAS_MODE,
|
||||
type: NODE_DATATYPE.CANVAS_MODE,
|
||||
title: 'Surface Edit (Canvas)',
|
||||
component: FastMode,
|
||||
hideFooter: true,
|
||||
showCanvasEdit: true,
|
||||
on: ()=>{
|
||||
componentRef.value?.opCanvas()
|
||||
}
|
||||
},
|
||||
{
|
||||
tier: NODE_DATATIER.SCENE_COMPOSITION,
|
||||
type: NODE_DATATYPE.SCENE_COMPOSITION,
|
||||
@@ -117,11 +137,9 @@
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
const attrs = useAttrs()
|
||||
const currentComponent = computed(() => {
|
||||
return components.find((item) => item.type === props.type)
|
||||
})
|
||||
const componentRef = ref(null)
|
||||
|
||||
const onGenerateClick = async () => {
|
||||
const data = componentRef.value?.getApiData?.() || {}
|
||||
@@ -140,13 +158,16 @@
|
||||
}) || []
|
||||
// const taskList = [{taskId:'123'}]
|
||||
// if (!subordNode) {
|
||||
|
||||
//如果是添加印花的结果就作为一级节点可以再次选择添加印花或者生成真实图
|
||||
let tier = NODE_DATATIER.Fast_MODE == currentComponent.value.tier?0:currentComponent.value.tier
|
||||
taskList.forEach((item,index) => {
|
||||
nodeManager.createResultNode({
|
||||
data: {
|
||||
superiorID: attrs.node.id,
|
||||
superiorNodeType: attrs.node?.data?.type,
|
||||
createIndexPosition: index + subordNodes.length,
|
||||
tier: currentComponent.value.tier,
|
||||
tier: tier,
|
||||
isActive: index == 0 && subordNodes.length == 0,
|
||||
data: {
|
||||
imageProcessTasks:[item],
|
||||
@@ -251,6 +272,7 @@
|
||||
font-size: 12px;
|
||||
font-family: SemiBold;
|
||||
cursor: pointer;
|
||||
|
||||
&:active {
|
||||
opacity: 0.5;
|
||||
}
|
||||
@@ -260,6 +282,12 @@
|
||||
margin-right: 4px;
|
||||
}
|
||||
}
|
||||
&.canvasEdit{
|
||||
> button{
|
||||
margin: 0 8px;
|
||||
width: 201px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -181,7 +181,7 @@
|
||||
])
|
||||
const onPreview = (item: any) => {
|
||||
if(data.superiorNodeType == NODE_DATATYPE.TO_3D_MODEL){
|
||||
openThreeModelPreview({url:item?.glbPath,glbInfoObj:item?.glbInfoObj})
|
||||
openThreeModelPreview({glbPath:item?.glbPath,glbInfoObj:item?.glbInfoObj})
|
||||
}else{
|
||||
openImagePreview(item.url)
|
||||
}
|
||||
|
||||
@@ -18,8 +18,7 @@ let data = reactive({
|
||||
|
||||
const modelRef = ref(null)
|
||||
onMounted(()=>{
|
||||
console.log(props?.currentData?.url)
|
||||
if(props?.currentData?.url)modelRef.value.open(props?.currentData?.url)
|
||||
if(props?.currentData?.glbPath)modelRef.value.open(props?.currentData?.glbPath)
|
||||
})
|
||||
onUnmounted(()=>{
|
||||
})
|
||||
|
||||
@@ -25,6 +25,8 @@ export const NODE_DATATYPE = {
|
||||
CARDS_SELECT: 'cards-select',
|
||||
TO_REAL_STYLE: 'to-real-style',
|
||||
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',
|
||||
@@ -38,6 +40,8 @@ export const NODE_DATATIER = {
|
||||
CARDS_SELECT: 0,
|
||||
TO_REAL_STYLE: 1,
|
||||
SURFACE_EDIT: 1,
|
||||
CANVAS_MODE: 1,
|
||||
Fast_MODE: 1,
|
||||
SCENE_COMPOSITION: 2,
|
||||
COLOR_PALETTE: 2,
|
||||
TO_3D_MODEL: 2,
|
||||
|
||||
@@ -77,4 +77,16 @@ export const base64Tofile = (base64: string,name: string) => {
|
||||
// 4. 创建 File 对象(可选)
|
||||
const file = new File([blob], name, { type: mime })
|
||||
return file
|
||||
}
|
||||
//获取当前时间2026-03-20 11:38:29
|
||||
export const getCurrentTime = () => {
|
||||
const now = new Date()
|
||||
const currentTime =
|
||||
now.getFullYear() + '-' +
|
||||
String(now.getMonth() + 1).padStart(2, '0') + '-' +
|
||||
String(now.getDate()).padStart(2, '0') + ' ' +
|
||||
String(now.getHours()).padStart(2, '0') + ':' +
|
||||
String(now.getMinutes()).padStart(2, '0') + ':' +
|
||||
String(now.getSeconds()).padStart(2, '0')
|
||||
return currentTime
|
||||
}
|
||||
Reference in New Issue
Block a user