fix: 修复画布事件冲突问题

This commit is contained in:
shaohuzhang1 2024-08-28 15:57:06 +08:00 committed by shaohuzhang1
parent 64e2e63e92
commit 7c218284a1
9 changed files with 21 additions and 69 deletions

View File

@ -1,8 +1,6 @@
<template> <template>
<el-cascader <el-cascader
@wheel="wheel" @wheel="wheel"
@keydown="isKeyDown = true"
@keyup="isKeyDown = false"
:teleported="false" :teleported="false"
:options="options" :options="options"
@visible-change="visibleChange" @visible-change="visibleChange"
@ -11,12 +9,7 @@
separator=" > " separator=" > "
> >
<template #default="{ node, data }"> <template #default="{ node, data }">
<span <span class="flex align-center" @wheel="wheel">
class="flex align-center"
@wheel="wheel"
@keydown="isKeyDown = true"
@keyup="isKeyDown = false"
>
<component :is="iconComponent(`${data.type}-icon`)" class="mr-8" :size="18" />{{ <component :is="iconComponent(`${data.type}-icon`)" class="mr-8" :size="18" />{{
data.label data.label
}}</span }}</span
@ -42,10 +35,11 @@ const data = computed({
} }
}) })
const options = ref<Array<any>>([]) const options = ref<Array<any>>([])
const isKeyDown = ref(false)
const wheel = (e: any) => { const wheel = (e: any) => {
if (isKeyDown.value) { if (e.ctrlKey === true) {
e.preventDefault() e.preventDefault()
return true
} else { } else {
e.stopPropagation() e.stopPropagation()
return true return true

View File

@ -4,10 +4,6 @@
<el-card shadow="never" class="card-never" style="--el-card-padding: 12px"> <el-card shadow="never" class="card-never" style="--el-card-padding: 12px">
<el-form <el-form
@submit.prevent @submit.prevent
@mousemove.stop
@mousedown.stop
@keydown.stop
@click.stop
:model="chat_data" :model="chat_data"
label-position="top" label-position="top"
require-asterisk-position="right" require-asterisk-position="right"
@ -44,8 +40,6 @@
<el-select <el-select
@change="model_change" @change="model_change"
@wheel="wheel" @wheel="wheel"
@keydown="isKeyDown = true"
@keyup="isKeyDown = false"
:teleported="false" :teleported="false"
v-model="chat_data.model_id" v-model="chat_data.model_id"
placeholder="请选择 AI 模型" placeholder="请选择 AI 模型"
@ -138,8 +132,6 @@
</template> </template>
<MdEditor <MdEditor
@wheel="wheel" @wheel="wheel"
@keydown="isKeyDown = true"
@keyup="isKeyDown = false"
class="reply-node-editor" class="reply-node-editor"
style="height: 150px" style="height: 150px"
v-model="chat_data.prompt" v-model="chat_data.prompt"
@ -216,11 +208,12 @@ import type { Provider } from '@/api/type/model'
import { isLastNode } from '@/workflow/common/data' import { isLastNode } from '@/workflow/common/data'
import AIModeParamSettingDialog from '@/views/application/component/AIModeParamSettingDialog.vue' import AIModeParamSettingDialog from '@/views/application/component/AIModeParamSettingDialog.vue'
const { model, application } = useStore() const { model } = useStore()
const isKeyDown = ref(false)
const wheel = (e: any) => { const wheel = (e: any) => {
if (isKeyDown.value) { if (e.ctrlKey === true) {
e.preventDefault() e.preventDefault()
return true
} else { } else {
e.stopPropagation() e.stopPropagation()
return true return true

View File

@ -2,9 +2,6 @@
<NodeContainer :nodeModel="nodeModel"> <NodeContainer :nodeModel="nodeModel">
<el-form <el-form
@submit.prevent @submit.prevent
@mousedown.stop
@keydown.stop
@click.stop
:model="form_data" :model="form_data"
label-position="top" label-position="top"
require-asterisk-position="right" require-asterisk-position="right"
@ -42,8 +39,6 @@
<el-form-item label="开场白"> <el-form-item label="开场白">
<MdEditor <MdEditor
@wheel="wheel" @wheel="wheel"
@keydown="isKeyDown = true"
@keyup="isKeyDown = false"
style="height: 150px" style="height: 150px"
v-model="form_data.prologue" v-model="form_data.prologue"
:preview="false" :preview="false"
@ -82,10 +77,11 @@ const form = {
prologue: prologue:
'您好,我是 MaxKB 小助手,您可以向我提出 MaxKB 使用问题。\n- MaxKB 主要功能有什么?\n- MaxKB 支持哪些大语言模型?\n- MaxKB 支持哪些文档类型?' '您好,我是 MaxKB 小助手,您可以向我提出 MaxKB 使用问题。\n- MaxKB 主要功能有什么?\n- MaxKB 支持哪些大语言模型?\n- MaxKB 支持哪些文档类型?'
} }
const isKeyDown = ref(false)
const wheel = (e: any) => { const wheel = (e: any) => {
if (isKeyDown.value) { if (e.ctrlKey === true) {
e.preventDefault() e.preventDefault()
return true
} else { } else {
e.stopPropagation() e.stopPropagation()
return true return true

View File

@ -6,11 +6,7 @@
require-asterisk-position="right" require-asterisk-position="right"
label-width="auto" label-width="auto"
ref="ConditionNodeFormRef" ref="ConditionNodeFormRef"
@keydown.stop
@submit.prevent @submit.prevent
@click.stop
@mousedown.stop
@mousemove.stop
> >
<template v-for="(item, index) in form_data.branch" :key="item.id"> <template v-for="(item, index) in form_data.branch" :key="item.id">
<el-card <el-card
@ -68,8 +64,6 @@
> >
<el-select <el-select
@wheel="wheel" @wheel="wheel"
@keydown="isKeyDown = true"
@keyup="isKeyDown = false"
:teleported="false" :teleported="false"
v-model="condition.compare" v-model="condition.compare"
placeholder="请选择条件" placeholder="请选择条件"
@ -158,16 +152,16 @@ const form = {
} }
] ]
} }
const isKeyDown = ref(false)
const wheel = (e: any) => { const wheel = (e: any) => {
if (isKeyDown.value) { if (e.ctrlKey === true) {
e.preventDefault() e.preventDefault()
return true
} else { } else {
e.stopPropagation() e.stopPropagation()
return true return true
} }
} }
const resizeCondition = (wh: any, row: any, index: number) => { const resizeCondition = (wh: any, row: any, index: number) => {
const branch_condition_list = cloneDeep( const branch_condition_list = cloneDeep(
props.nodeModel.properties.branch_condition_list props.nodeModel.properties.branch_condition_list

View File

@ -4,10 +4,6 @@
<h5 class="lighter mb-8">输入变量</h5> <h5 class="lighter mb-8">输入变量</h5>
<el-form <el-form
@submit.prevent @submit.prevent
@mousemove.stop
@mousedown.stop
@keydown.stop
@click.stop
ref="FunctionNodeFormRef" ref="FunctionNodeFormRef"
:model="chat_data" :model="chat_data"
label-position="top" label-position="top"

View File

@ -9,10 +9,6 @@
</div> </div>
<el-form <el-form
@submit.prevent @submit.prevent
@mousemove.stop
@mousedown.stop
@keydown.stop
@click.stop
ref="FunctionNodeFormRef" ref="FunctionNodeFormRef"
:model="chat_data" :model="chat_data"
label-position="top" label-position="top"
@ -228,6 +224,4 @@ onMounted(() => {
}, 100) }, 100)
}) })
</script> </script>
<style lang="scss"> <style lang="scss"></style>
</style>

View File

@ -4,10 +4,6 @@
<el-card shadow="never" class="card-never" style="--el-card-padding: 12px"> <el-card shadow="never" class="card-never" style="--el-card-padding: 12px">
<el-form <el-form
@submit.prevent @submit.prevent
@mousemove.stop
@mousedown.stop
@keydown.stop
@click.stop
:model="form_data" :model="form_data"
label-position="top" label-position="top"
require-asterisk-position="right" require-asterisk-position="right"
@ -44,8 +40,6 @@
<el-select <el-select
@change="model_change" @change="model_change"
@wheel="wheel" @wheel="wheel"
@keydown="isKeyDown = true"
@keyup="isKeyDown = false"
:teleported="false" :teleported="false"
v-model="form_data.model_id" v-model="form_data.model_id"
placeholder="请选择 AI 模型" placeholder="请选择 AI 模型"
@ -136,8 +130,6 @@
</template> </template>
<MdEditor <MdEditor
@wheel="wheel" @wheel="wheel"
@keydown="isKeyDown = true"
@keyup="isKeyDown = false"
class="reply-node-editor" class="reply-node-editor"
style="height: 150px" style="height: 150px"
v-model="form_data.prompt" v-model="form_data.prompt"
@ -216,10 +208,11 @@ import { isLastNode } from '@/workflow/common/data'
const AIModeParamSettingDialogRef = ref<InstanceType<typeof AIModeParamSettingDialog>>() const AIModeParamSettingDialogRef = ref<InstanceType<typeof AIModeParamSettingDialog>>()
const { model } = useStore() const { model } = useStore()
const isKeyDown = ref(false)
const wheel = (e: any) => { const wheel = (e: any) => {
if (isKeyDown.value) { if (e.ctrlKey === true) {
e.preventDefault() e.preventDefault()
return true
} else { } else {
e.stopPropagation() e.stopPropagation()
return true return true

View File

@ -3,9 +3,6 @@
<el-card shadow="never" class="card-never" style="--el-card-padding: 12px"> <el-card shadow="never" class="card-never" style="--el-card-padding: 12px">
<el-form <el-form
@submit.prevent @submit.prevent
@mousedown.stop
@keydown.stop
@click.stop
:model="form_data" :model="form_data"
label-position="top" label-position="top"
require-asterisk-position="right" require-asterisk-position="right"
@ -30,8 +27,6 @@
<MdEditor <MdEditor
v-if="form_data.reply_type === 'content'" v-if="form_data.reply_type === 'content'"
@wheel="wheel" @wheel="wheel"
@keydown="isKeyDown = true"
@keyup="isKeyDown = false"
class="reply-node-editor" class="reply-node-editor"
style="height: 150px" style="height: 150px"
v-model="form_data.content" v-model="form_data.content"
@ -92,10 +87,11 @@ import { ref, computed, onMounted } from 'vue'
import { isLastNode } from '@/workflow/common/data' import { isLastNode } from '@/workflow/common/data'
const props = defineProps<{ nodeModel: any }>() const props = defineProps<{ nodeModel: any }>()
const isKeyDown = ref(false)
const wheel = (e: any) => { const wheel = (e: any) => {
if (isKeyDown.value) { if (e.ctrlKey === true) {
e.preventDefault() e.preventDefault()
return true
} else { } else {
e.stopPropagation() e.stopPropagation()
return true return true

View File

@ -4,10 +4,6 @@
<el-card shadow="never" class="card-never"> <el-card shadow="never" class="card-never">
<el-form <el-form
@submit.prevent @submit.prevent
@mousemove.stop
@mousedown.stop
@keydown.stop
@click.stop
:model="form_data" :model="form_data"
label-position="top" label-position="top"
require-asterisk-position="right" require-asterisk-position="right"