上级为3d的情况点击放大按钮为打开模型窗口

This commit is contained in:
X1627315083@163.com
2026-03-16 15:28:05 +08:00
parent 334c658d7c
commit f44adb0244
7 changed files with 37 additions and 13 deletions

View File

@@ -132,7 +132,6 @@
imageUrl: attrs.node?.data?.originalImage, imageUrl: attrs.node?.data?.originalImage,
...data, ...data,
} }
console.log(subordNode)
const taskList = await currentComponent.value.api(apiData).then((rv)=>{ const taskList = await currentComponent.value.api(apiData).then((rv)=>{
return rv return rv
}) || [] }) || []
@@ -143,6 +142,7 @@
positionY: (index + subordNodes.length) * (50 + 250), positionY: (index + subordNodes.length) * (50 + 250),
data: { data: {
superiorID: attrs.node.id, superiorID: attrs.node.id,
superiorNodeType: attrs.node?.data?.type,
createIndexPosition: index, createIndexPosition: index,
tier: currentComponent.value.tier, tier: currentComponent.value.tier,
isActive: index == 0 && subordNodes.length == 0, isActive: index == 0 && subordNodes.length == 0,

View File

@@ -7,7 +7,7 @@
:class="{'active': config.isActive}" :class="{'active': config.isActive}"
@click="setSelectTaskId(item.taskId)" @click="setSelectTaskId(item.taskId)"
> >
<div class="header" v-if="item.status == 'RETURNED'" v-show="showHeader && item.taskId === data.selectTaskId" @mousedown.stop> <div class="header" v-if="item.status == 'RETURNED'" v-show="showHeader && config.isActive" @mousedown.stop>
<span class="icon"> <span class="icon">
<svg-icon name="chat-compose" size="20" size-unit="px" /> <svg-icon name="chat-compose" size="20" size-unit="px" />
</span> </span>
@@ -61,7 +61,9 @@
import { downloadImage } from '../../../tools/tools' import { downloadImage } from '../../../tools/tools'
import { reactive, ref, onBeforeUnmount, useAttrs, inject, watch, computed, onMounted } from 'vue' import { reactive, ref, onBeforeUnmount, useAttrs, inject, watch, computed, onMounted } from 'vue'
import HighlightAdmin from '@/components/highlightAdmin.vue' import HighlightAdmin from '@/components/highlightAdmin.vue'
import { NODE_DATATYPE } from '../../tools/index.d'
const openImagePreview = inject('openImagePreview') as (url: string) => void const openImagePreview = inject('openImagePreview') as (url: string) => void
const openThreeModelPreview = inject('openThreeModelPreview') as (url: string) => void
const props = defineProps({ const props = defineProps({
node: { node: {
type: Object, type: Object,
@@ -83,8 +85,8 @@
'send-to-back', 'send-to-back',
'update-data' 'update-data'
]) ])
const attrs = useAttrs() // const attrs = useAttrs()
const showHeader = ref(!!attrs.node?.data?.isHeader) const showHeader = ref(!!props.node?.data?.isHeader)
const showMenu = ref(false) const showMenu = ref(false)
const clickTaskId = ref('') const clickTaskId = ref('')
const generateManager = inject('generateManager') as any const generateManager = inject('generateManager') as any
@@ -97,6 +99,7 @@
const data = reactive({ const data = reactive({
selectTaskId: props.data?.selectTaskId || '', selectTaskId: props.data?.selectTaskId || '',
imageProcessTasks: props.data?.imageProcessTasks, imageProcessTasks: props.data?.imageProcessTasks,
superiorNodeType: props?.node?.data?.superiorNodeType,
isActive: props.data?.isActive || false, isActive: props.data?.isActive || false,
}) })
const setSelectTaskId = (taskId: string) => { const setSelectTaskId = (taskId: string) => {
@@ -171,7 +174,11 @@
} }
]) ])
const onPreview = (url: string) => { const onPreview = (url: string) => {
openImagePreview(url) if(data.superiorNodeType == NODE_DATATYPE.TO_3D_MODEL){
openThreeModelPreview(url)
}else{
openImagePreview(url)
}
} }
const onDownload = (url: string) => { const onDownload = (url: string) => {
downloadImage(url, 'image.png') downloadImage(url, 'image.png')

View File

@@ -1,18 +1,25 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, onUnmounted, reactive, toRefs } from "vue"; import { ref, onMounted, onUnmounted, reactive, toRefs } from "vue";
import threeGlb from '@/assets/images/three/sample.glb'
import model from './model.vue' import model from './model.vue'
import detail from './detail.vue' import detail from './detail.vue'
//const props = defineProps({ const props = defineProps({
//}) currentUrl: {
type: String,
default: ''
}
})
//const emit = defineEmits([ //const emit = defineEmits([
//]) //])
let data = reactive({ let data = reactive({
}) })
const modelRef = ref(null) const modelRef = ref(null)
onMounted(()=>{ onMounted(()=>{
modelRef.value.open() console.log(props.currentUrl)
modelRef.value.open(threeGlb)
}) })
onUnmounted(()=>{ onUnmounted(()=>{
}) })

View File

@@ -5,7 +5,6 @@ import { useI18n } from 'vue-i18n'
import gsap from 'gsap'; import gsap from 'gsap';
import * as THREE from 'three'; import * as THREE from 'three';
import { initThree,clearModel,addModel,getModelInfo,calculateCameraPosition } from './threeTool' import { initThree,clearModel,addModel,getModelInfo,calculateCameraPosition } from './threeTool'
import threeGlb from '@/assets/images/three/sample.glb'
//const props = defineProps({ //const props = defineProps({
//}) //})
@@ -134,7 +133,7 @@ const setModel = async (url:any)=>{
await addModel(url,controls,camera,pointLight,group,load) await addModel(url,controls,camera,pointLight,group,load)
// addMaterial() // addMaterial()
} }
const open = async ()=>{ const open = async (url)=>{
load.value.state = true load.value.state = true
await nextTick(()=>{ await nextTick(()=>{
init() init()
@@ -152,7 +151,7 @@ const open = async ()=>{
// composer.render(); // composer.render();
}; };
animate(); animate();
await setModel(threeGlb) await setModel(url)
load.value.state = false load.value.state = false
} }

View File

@@ -56,7 +56,9 @@
/> />
<image-preview ref="imagePreviewRef" /> <image-preview ref="imagePreviewRef" />
<baseModal ref="threeModelRef"> <baseModal ref="threeModelRef">
<threeModel /> <template v-slot="{ currentUrl }">
<threeModel :currentUrl="currentUrl" />
</template>
</baseModal> </baseModal>
</template> </template>
@@ -215,7 +217,12 @@
const openImagePreview = (url: string) => { const openImagePreview = (url: string) => {
imagePreviewRef.value.open(url) imagePreviewRef.value.open(url)
} }
/** 打开3D预览 */
const openThreeModelPreview = (url: string) => {
threeModelRef.value.open(url)
}
provide('openImagePreview', openImagePreview) provide('openImagePreview', openImagePreview)
provide('openThreeModelPreview', openThreeModelPreview)
onMounted(async () => { onMounted(async () => {
// window['vueFlow'] = vueFlow // window['vueFlow'] = vueFlow

View File

@@ -7,6 +7,7 @@ interface NodeData {
tier?: string// 节点层级 tier?: string// 节点层级
isHeader?: boolean// 是否显示头 isHeader?: boolean// 是否显示头
superiorID?: string// 上级节点ID superiorID?: string// 上级节点ID
superiorNodeType?: string// 上级节点类型
disableDelete?: boolean// 是否禁用删除 disableDelete?: boolean// 是否禁用删除
disableCopy?: boolean// 是否禁用复制 disableCopy?: boolean// 是否禁用复制
originalImage?: string// 要进行生成的图片 originalImage?: string// 要进行生成的图片

View File

@@ -13,7 +13,7 @@
</div> </div>
</template> </template>
<div class="modal-box"> <div class="modal-box">
<slot></slot> <slot v-if="currentUrl" :currentUrl="currentUrl"></slot>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
@@ -27,11 +27,14 @@
} }
}) })
const showDialog = ref(false) const showDialog = ref(false)
let currentUrl = ref('')
const open = (url_: any) => { const open = (url_: any) => {
currentUrl.value = url_
showDialog.value = true showDialog.value = true
} }
const close = () => { const close = () => {
showDialog.value = false showDialog.value = false
currentUrl.value = ''
} }
defineExpose({ defineExpose({