From 22af2dc2d93174a1815d263a2c96b2cb976d03a6 Mon Sep 17 00:00:00 2001 From: jason <2667446@qq.com> Date: Tue, 7 May 2024 23:44:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BF=E9=92=89=E9=92=89=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8-=20=E4=BC=98=E5=8C=96=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/nodes-config/ConditionNodeConfig.vue | 45 +++++++++++----- .../src/nodes-config/CopyTaskNodeConfig.vue | 41 +++++++++++---- .../src/nodes-config/UserTaskNodeConfig.vue | 46 ++++++++-------- .../src/nodes/CopyTaskNode.vue | 3 +- .../src/nodes/ExclusiveNode.vue | 25 +++++---- .../src/nodes/UserTaskNode.vue | 3 +- .../SimpleProcessDesignerV2/src/utils.ts | 7 +++ .../theme/simple-process-designer.scss | 52 +++++++++++++++++-- 8 files changed, 157 insertions(+), 65 deletions(-) create mode 100644 src/components/SimpleProcessDesignerV2/src/utils.ts diff --git a/src/components/SimpleProcessDesignerV2/src/nodes-config/ConditionNodeConfig.vue b/src/components/SimpleProcessDesignerV2/src/nodes-config/ConditionNodeConfig.vue index c449af1b..e539604a 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes-config/ConditionNodeConfig.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes-config/ConditionNodeConfig.vue @@ -7,9 +7,19 @@ :before-close="saveConfig" >
@@ -65,6 +75,7 @@ diff --git a/src/components/SimpleProcessDesignerV2/src/nodes-config/CopyTaskNodeConfig.vue b/src/components/SimpleProcessDesignerV2/src/nodes-config/CopyTaskNodeConfig.vue index 4647d1ef..3acc2822 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes-config/CopyTaskNodeConfig.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes-config/CopyTaskNodeConfig.vue @@ -7,9 +7,19 @@ :before-close="saveConfig" > @@ -144,7 +154,7 @@ diff --git a/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue b/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue index f793cd68..7893b9f8 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue @@ -8,9 +8,19 @@ class="justify-start" > @@ -162,7 +172,7 @@ diff --git a/src/components/SimpleProcessDesignerV2/src/nodes/CopyTaskNode.vue b/src/components/SimpleProcessDesignerV2/src/nodes/CopyTaskNode.vue index 3c64aa44..9e553a13 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes/CopyTaskNode.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes/CopyTaskNode.vue @@ -27,8 +27,7 @@
- -
+
diff --git a/src/components/SimpleProcessDesignerV2/src/nodes/ExclusiveNode.vue b/src/components/SimpleProcessDesignerV2/src/nodes/ExclusiveNode.vue index 3a8f330a..b997be09 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes/ExclusiveNode.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes/ExclusiveNode.vue @@ -15,10 +15,13 @@
-
+
+ type="text" + class="input-max-width editable-title-input" + @blur="blurEvent(index)" + v-mountedFocus + v-model="item.name" />
{{ item.name }}
优先级{{ index + 1 }}
@@ -33,7 +36,7 @@ type="text" class="input-max-width editable-title-input" @blur="blurEvent(index)
- +
- +
@@ -65,6 +68,7 @@ type="text" class="input-max-width editable-title-input" @blur="blurEvent(index) import NodeHandler from '../NodeHandler.vue' import ProcessNodeTree from '../ProcessNodeTree.vue' import { SimpleFlowNode, NodeType, NODE_DEFAULT_TEXT } from '../consts' +import { getDefaultConditionNodeName } from '../utils' import { generateUUID } from '@/utils' import ConditionNodeConfig from '../nodes-config/ConditionNodeConfig.vue' const { proxy } = getCurrentInstance() as any @@ -88,29 +92,24 @@ const currentNode = ref(props.flowNode) watch(() => props.flowNode, (newValue) => { currentNode.value = newValue; }); -// TODO 测试后续去掉 -// watch(() => conditionNodes, (newValue) => { -// console.log('new conditionNodes is ', newValue); -// },{ deep: true }); + const showInputs = ref([]) // 失去焦点 const blurEvent = (index: number) => { showInputs.value[index] = false const conditionNode = currentNode.value.conditionNodes?.at(index) as SimpleFlowNode; - conditionNode.name = conditionNode.name || '条件' + index + conditionNode.name = conditionNode.name || getDefaultConditionNodeName(index, conditionNode.attributes?.defaultFlow) } + // 点击条件名称 const clickEvent = (index: number) => { showInputs.value[index] = true } const conditionNodeConfig = (nodeId: string) => { - console.log('nodeId', nodeId); console.log("proxy.$refs", proxy.$refs); - // TODO 测试后续去掉 const conditionNode = proxy.$refs[nodeId][0]; - console.log("node inf is ", conditionNode.nodeInfo); conditionNode.open() } diff --git a/src/components/SimpleProcessDesignerV2/src/nodes/UserTaskNode.vue b/src/components/SimpleProcessDesignerV2/src/nodes/UserTaskNode.vue index 4cba510a..9e7387f5 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes/UserTaskNode.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes/UserTaskNode.vue @@ -27,8 +27,7 @@
- -
+
diff --git a/src/components/SimpleProcessDesignerV2/src/utils.ts b/src/components/SimpleProcessDesignerV2/src/utils.ts new file mode 100644 index 00000000..c68635ae --- /dev/null +++ b/src/components/SimpleProcessDesignerV2/src/utils.ts @@ -0,0 +1,7 @@ +// 获取条件节点默认的名称 +export const getDefaultConditionNodeName = (index:number, defaultFlow: boolean) : string => { + if ( defaultFlow ){ + return "其它情况" + } + return '条件' + (index+1) +} diff --git a/src/components/SimpleProcessDesignerV2/theme/simple-process-designer.scss b/src/components/SimpleProcessDesignerV2/theme/simple-process-designer.scss index 6cceb074..8a35345a 100644 --- a/src/components/SimpleProcessDesignerV2/theme/simple-process-designer.scss +++ b/src/components/SimpleProcessDesignerV2/theme/simple-process-designer.scss @@ -91,7 +91,7 @@ transition: all 0.1s cubic-bezier(0.645, 0.045, 0.355, 1); &:hover { - // border-color: #0089ff; + border-color: #0089ff; .node-toolbar { opacity: 1; } @@ -130,6 +130,9 @@ text-overflow: ellipsis; color: #1f1f1f; line-height: 18px; + &:hover { + border-bottom: 1px dashed #f60; + } } } @@ -153,6 +156,9 @@ overflow: hidden; text-overflow: ellipsis; color: #f60; + &:hover { + border-bottom: 1px dashed #000; + } } .branch-priority { @@ -211,14 +217,13 @@ .node-toolbar { opacity: 0; position: absolute; - top: -25px; + top: -20px; right: 0px; display: flex; .toolbar-icon { text-align: center; vertical-align: middle; - color: #000; } } @@ -501,10 +506,47 @@ } } } - - } +// 配置节点头部 +.config-header { + display: flex; + flex-direction: column; + + .node-name { + display: flex; + height: 24px; + line-height: 24px; + cursor: pointer; + align-items: center; + } + + .divide-line { + width: 100%; + height: 1px; + margin-top: 16px; + background: #eee; + } + + .config-editable-input { + height: 24px; + max-width: 510px; + font-size: 16px; + line-height: 24px; + border: 1px solid #d9d9d9; + border-radius: 4px; + transition: all 0.3s; + + &:focus { + border-color: #40a9ff; + outline: 0; + box-shadow: 0 0 0 2px rgba(24, 144, 255, .2) + } + } +} + + + // 节点连线气泡卡片样式 .handler-item-wrapper { display: flex;