Browse Source

修改工程配置。

jxq 3 weeks ago
parent
commit
912ec8dc05

+ 37 - 24
src/components/hjflow/src/nodes/com/basic.vue

@@ -3,55 +3,69 @@ import {
   CurrentHeaderOperationProvideName,
   GrandparentMethod,
   HJInterNodeData,
-  HJMethodName, HJNodeData,
-  HJPosition
-} from '../../types/comTypes';
-import {Handle} from '@vue-flow/core'
-import {Position} from '@vue-flow/core';
-import {inject, watch} from "vue";
+  HJMethodName,
+  HJNodeData,
+  HJPosition,
+} from "../../types/comTypes";
+import { Handle } from "@vue-flow/core";
+import { Position } from "@vue-flow/core";
+import { inject, watch } from "vue";
 const props = defineProps<HJInterNodeData>();
 
 //  'basic-box--selected': props.data.isSelected || (currentHeaderOperationNode && currentHeaderOperationNode.id === props.id) 如果是选中或者正在通过header编辑节点信息的样式
-const currentHeaderOperationNode = inject<HJNodeData | null>(CurrentHeaderOperationProvideName)
-
-
+const currentHeaderOperationNode = inject<HJNodeData | null>(
+  CurrentHeaderOperationProvideName
+);
 </script>
 
 <template>
   <div
-      class="basic-box"
-      :class="{
+    class="basic-box"
+    :class="{
       [`basic-box--${props.type}`]: props.type,
-      'basic-box--selected': props.data.isSelected || (currentHeaderOperationNode && currentHeaderOperationNode.id === props.id),
+      'basic-box--selected':
+        props.data.isSelected ||
+        (currentHeaderOperationNode &&
+          currentHeaderOperationNode.id === props.id),
       'basic-box--dragging': props.data.isDragging,
     }"
   >
-
     <slot name="header"></slot>
 
-    <slot name="default">
-    </slot>
+    <slot name="default"> </slot>
 
     <!--    这里是handle的操作-->
     <div v-if="props.sourcePosition && props.targetPosition">
-      <Handle class="handle-style"  type="source" :position="props.sourcePosition"/>
-      <Handle class="handle-style"  type="target" :position="props.targetPosition"/>
+      <Handle
+        class="handle-style"
+        type="source"
+        :position="props.sourcePosition"
+      />
+      <Handle
+        class="handle-style"
+        type="target"
+        :position="props.targetPosition"
+      />
     </div>
     <div v-else-if="props.data.handles && props.data.handles.length">
-      <Handle class="handle-style" v-for="(handle, index) in props.data.handles"  :type="handle.type"
-              :position="handle.position" :style="handle.style"/>
+      <Handle
+        class="handle-style"
+        v-for="(handle, index) in props.data.handles"
+        :type="handle.type"
+        :position="handle.position"
+        :style="handle.style"
+      />
     </div>
     <div v-else>
-      <Handle class="handle-style"  type="target" :position="Position.Top"/>
-      <Handle class="handle-style"  type="source" :position="Position.Bottom"/>
+      <Handle class="handle-style" type="target" :position="Position.Top" />
+      <Handle class="handle-style" type="source" :position="Position.Bottom" />
     </div>
-
   </div>
 </template>
 
 <style scoped lang="less">
 .basic-box {
-  width: 200px;
+  width: 220px;
   height: 60px;
   border: 2px solid #625454;
   border-radius: 5px;
@@ -64,7 +78,6 @@ const currentHeaderOperationNode = inject<HJNodeData | null>(CurrentHeaderOperat
   height: 10px;
 }
 
-
 //可以根据type类型来设置不同的Node的样式
 .basic-box--custom {
   border-style: dashed;

+ 18 - 12
src/components/hjflow/src/nodes/com/operationHeader.vue

@@ -1,25 +1,31 @@
 <script setup lang="ts">
-
-import {Edit} from "@element-plus/icons-vue";
-import {GrandparentMethod, HJInterNodeData, HJMethodName, HJMethodProvideName} from "../../types/comTypes";
-import {inject, markRaw} from "vue";
+import { Edit } from "@element-plus/icons-vue";
+import {
+  GrandparentMethod,
+  HJInterNodeData,
+  HJMethodName,
+  HJMethodProvideName,
+} from "../../types/comTypes";
+import { inject, markRaw } from "vue";
 const props = defineProps<HJInterNodeData>();
 
-
-const editMethod = inject<GrandparentMethod>(HJMethodProvideName)
+const editMethod = inject<GrandparentMethod>(HJMethodProvideName);
 
 const editClick = () => {
-  editMethod && editMethod( HJMethodName.EditNode,JSON.parse(JSON.stringify(markRaw(props))))
-}
-
+  editMethod &&
+    editMethod(
+      HJMethodName.EditNode,
+      JSON.parse(JSON.stringify(markRaw(props)))
+    );
+};
 </script>
 
 <template>
   <div class="box-header">
-    <div> {{ props?.data?.label ?? "" }}</div>
+    <div>{{ props?.data?.label ?? "" }}</div>
     <div class="right-btns">
-      <el-icon :size="18" class="right-icon">
-        <Edit  @click.prevent="editClick"/>
+      <el-icon :size="20" class="right-icon">
+        <Edit @click.prevent="editClick" />
       </el-icon>
     </div>
   </div>

+ 1 - 1
src/components/hjflow/src/panel/index.vue

@@ -34,7 +34,7 @@ const onAddNode = (type: string) => {
       style="width: 80px"
       @click="() => emits('saveTemplate')"
       v-if="props.funNames.includes('saveTemplate')"
-      >保存模版</el-button
+      >保存</el-button
     >
     <Back @click="() => emits('back')" v-if="props.funNames.includes('back')" />
     <add-node

+ 15 - 1
src/views/modules/project-config/com/function-col.vue

@@ -54,7 +54,15 @@ onMounted(() => {
                 @dragstart="onDragStart($event, dragData)"
                 @click="test(dragData)"
               >
-                {{ dragData?.data?.information?.functionName ?? "-" }}
+                <el-tooltip
+                  :content="dragData?.data?.information?.functionName ?? '-'"
+                  placement="right"
+                  effect="light"
+                >
+                  <div class="ellipsis">
+                    {{ dragData?.data?.information?.functionName ?? "-" }}
+                  </div>
+                </el-tooltip>
               </div>
             </div>
           </el-scrollbar>
@@ -112,4 +120,10 @@ onMounted(() => {
 :deep(.el-collapse, .el-collapse-item__content) {
   border: 0;
 }
+.ellipsis {
+  white-space: nowrap; /* 防止文本换行 */
+  overflow: hidden; /* 隐藏溢出的文本 */
+  text-overflow: ellipsis; /* 使用省略号显示被隐藏的文本 */
+  width: 100%; /* 必须设置宽度,以便溢出的文本生效 */
+}
 </style>

+ 18 - 8
src/views/modules/project-config/project-config.vue

@@ -45,10 +45,10 @@ const onNodeOperation = (name: HJMethodName, node: HJNodeData): void => {
       return;
     }
 
-    if (selectedNode.value) {
-      ElMessage.warning("请先保存节点信息");
-      return;
-    }
+    // if (selectedNode.value) {
+    //   ElMessage.warning("请先保存节点信息");
+    //   return;
+    // }
 
     //   保存模版数据
     let flowData = {
@@ -83,6 +83,16 @@ const onSaveConfigs = () => {
   infoVisible.value = false;
   selectedNode.value = null;
 };
+watch(
+  selectedNode,
+  (newVal) => {
+    flowRef.value &&
+      flowRef.value.updateNodeData(
+        JSON.parse(JSON.stringify(selectedNode.value))
+      );
+  },
+  { deep: true }
+);
 
 onMounted(async () => {
   //   如果选择的测试项目id有值,就获取数据
@@ -180,10 +190,10 @@ const handleSearch = (_: string, prefix: string) => {
         </el-form>
       </div>
       <div class="bottom-box">
-        <div class="save-btn" @click="onSaveConfigs">
-          <svg-icon icon-class="save" />
-          保存节点信息
-        </div>
+        <!--        <div class="save-btn" @click="onSaveConfigs">-->
+        <!--          <svg-icon icon-class="save" />-->
+        <!--          保存节点信息-->
+        <!--        </div>-->
       </div>
     </div>
   </div>