This commit is contained in:
X1627315083@163.com
2026-03-19 17:14:57 +08:00
parent 4648416f13
commit 59a9c7c80f
3 changed files with 12 additions and 21 deletions

View File

@@ -23,7 +23,6 @@
</button> </button>
</div> </div>
<img <img
v-loadimg="false"
class="image" class="image"
v-if="item.status == 'RETURNED'" v-if="item.status == 'RETURNED'"
:src="item?.url" :src="item?.url"
@@ -59,11 +58,10 @@
<script setup lang="ts"> <script setup lang="ts">
import myEvent from '@/utils/myEvent' import myEvent from '@/utils/myEvent'
import { downloadImage, base64Tofile } 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' import { NODE_DATATYPE } from '../../tools/index.d'
import { uploadImage } from '@/api/upload'
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 openThreeModelPreview = inject('openThreeModelPreview') as (url: string) => void
const props = defineProps({ const props = defineProps({
@@ -205,25 +203,19 @@
eventManager.registerEvents() eventManager.registerEvents()
} }
const depthCanvasWorkbench = (options)=>{ const depthCanvasWorkbench = (options)=>{
console.log(options) data.imageProcessTasks.forEach((item) => {
// 1. 提取 MIME 类型和 Base64 数据 if(item.taskId == options.taskId){
const file = base64Tofile(options.url,'image.png') item.url = options.url
const formData = new FormData() item.canvasId = options.canvasId || null
formData.append('file', file) }
uploadImage(formData).then((res) => {
data.imageProcessTasks.forEach((item) => {
if(item.taskId == options.taskId){
item.url = res
}
})
}) })
} }
const onEdit = (item: any) => { const onEdit = (item: any) => {
const data = { const data = {
url:item.url, url:item.url,
id: item.taskId, canvasId: item?.canvasId || null,
sketchId: stateManager.sketchId.value,
onWorkbench:(options)=>{ onWorkbench:(options)=>{
let workbenchData = { let workbenchData = {
...item, ...item,

View File

@@ -8,7 +8,7 @@
import FullscreenDialog from '../components/fullscreen-dialog.vue' import FullscreenDialog from '../components/fullscreen-dialog.vue'
import flowCanvas from './flow-canvas.vue' import flowCanvas from './flow-canvas.vue'
import { ref } from 'vue' import { ref } from 'vue'
import { getSketchFlowCanvas, putSketchFlowCanvas } from '@/api/flow-canvas' import { getSketchFlowCanvas } from '@/api/flow-canvas'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
const dialogVisible = ref(false) const dialogVisible = ref(false)

View File

@@ -63,8 +63,7 @@ export class StateManager {
this.mxHistory = ref(50) this.mxHistory = ref(50)
this.historyList = ref([]) this.historyList = ref([])
this.historyIndex = ref(0) this.historyIndex = ref(0)
this.sketchId = ref(options.sketchId)
this.sketchId = options.sketchId
this.saveCanvasTimeInterval = 6000 this.saveCanvasTimeInterval = 6000
this.saveCanvasTime = null this.saveCanvasTime = null
@@ -188,12 +187,12 @@ export class StateManager {
} }
/** 画布数据存储 */ /** 画布数据存储 */
async exportFlow (time:number = 0){ async exportFlow (time:number = 0){
if(!this.sketchId)return if(!this.sketchId.value)return
clearTimeout(this.saveCanvasTime) clearTimeout(this.saveCanvasTime)
await new Promise((resolve) => { await new Promise((resolve) => {
this.saveCanvasTime = setTimeout(()=>{ this.saveCanvasTime = setTimeout(()=>{
putSketchFlowCanvas({ putSketchFlowCanvas({
id: this.sketchId, id: this.sketchId.value,
canvasData: JSON.stringify(this.nodes.value) }).then(() => { canvasData: JSON.stringify(this.nodes.value) }).then(() => {
resolve(true) resolve(true)
}).catch(() => { }).catch(() => {