fix: bug修复

This commit is contained in:
wangdan-fit2cloud 2024-06-27 17:48:07 +08:00
parent ef0eb09eb4
commit bc096d0478
3 changed files with 33 additions and 5 deletions

View File

@ -30,7 +30,11 @@
<div v-show="showPopover" class="workflow-dropdown-menu border border-r-4">
<h5 class="title">基础组件</h5>
<template v-for="(item, index) in menuNodes" :key="index">
<div class="workflow-dropdown-item cursor flex p-8-12" @mousedown="onmousedown(item)">
<div
class="workflow-dropdown-item cursor flex p-8-12"
@click="clickNodes(item)"
@mousedown="onmousedown(item)"
>
<component :is="iconComponent(`${item.type}-icon`)" class="mr-8 mt-4" :size="32" />
<div class="pre-line">
<div class="lighter">{{ item.label }}</div>
@ -158,6 +162,10 @@ function clickoutsideDebug() {
showDebug.value = false
}
function clickNodes(item: any) {
// workflowRef.value?.addNode(item)
}
function onmousedown(item: any) {
workflowRef.value?.onmousedown(item)
}

View File

@ -89,6 +89,9 @@ onMounted(() => {
lf.value.deleteEdge(id)
})
})
setTimeout(() => {
lf.value?.fitView()
}, 500)
}
})
const validate = () => {
@ -102,19 +105,28 @@ const onmousedown = (shapeItem: ShapeItem) => {
if (shapeItem.type) {
lf.value.dnd.startDrag({
type: shapeItem.type,
properties: shapeItem.properties,
icon: shapeItem.icon
properties: shapeItem.properties
})
}
if (shapeItem.callback) {
shapeItem.callback(lf.value)
}
}
const addNode = (shapeItem: ShapeItem) => {
const virtualdata = lf.value.graphModel.getVirtualRectSize()
lf.value.graphModel.addNode({
type: shapeItem.type,
properties: shapeItem.properties,
x: virtualdata.virtualRectCenterPositionX,
y: virtualdata.virtualRectCenterPositionY
})
}
defineExpose({
onmousedown,
validate,
getGraphData
getGraphData,
addNode
})
</script>
<style lang="scss">

View File

@ -83,7 +83,15 @@
</el-row>
</div>
</el-form-item>
<el-form-item label="检索问题输入">
<el-form-item
label="检索问题输入"
prop="question_reference_address"
:rules="{
message: '请选择检索问题输入',
trigger: 'blur',
required: true
}"
>
<NodeCascader
:nodeModel="nodeModel"
class="w-full"