Initial commit

This commit is contained in:
libertyspy
2026-02-08 20:57:07 +08:00
parent 58d36a3d6d
commit 1058d666a0
6 changed files with 45 additions and 56 deletions

View File

@@ -46,24 +46,26 @@ export interface ElementVariable {
unit: NullableString;
}
export interface GraphTaskRect {
width?: number;
height?: number;
x?: number;
y?: number;
}
export interface BaseElement {
id: number;
key: NullableString;
name: NullableString;
description: NullableString;
type: NullableString;
width: number;
height: number;
position: GraphPosition;
category: NullableString;
element?: DraggableElement;
[key: string]: unknown;
}
export interface GraphTaskRect {
width?: number;
height?: number;
x?: number;
y?: number;
[key: string]: unknown;
}
export interface GraphTaskElement extends BaseElement {
@@ -72,7 +74,6 @@ export interface GraphTaskElement extends BaseElement {
outputs: any;
variables: ElementVariable[];
parameters: ElementParameter[];
children?: GraphTaskElement[],
[key: string]: unknown;

View File

@@ -9,22 +9,26 @@
>
<template #title>
<a-space>
<span class="ks-designer-node-icon"></span>
<div class="port port-in" data-port="in-0" magnet="passive"></div>
<span class="ks-designer-node-title">{{ element?.name ?? '-' }}</span>
<div class="port port-out" data-port="out-0" magnet="active"></div>
</a-space>
</template>
<!-- 节点内容区域 -->
<div class="w-full">
<div class="ks-designer-node-content">
<div class="ks-designer-node-row">
<div class="port port-in" data-port="in-0" magnet="passive"></div>
<div class="ks-designer-node-name" v-if="element?.category !== 'component'">
{{ element?.name ?? '-' }}
<a-tooltip>
<template #title>
{{element?.description}}
</template>
<div class="ks-designer-node-content">
<div class="ks-designer-node-row">
<div class="ks-designer-node-name">
{{ substring(element?.description ?? '-' ,40) }}
</div>
</div>
<div class="port port-out" data-port="out-0" magnet="active"></div>
</div>
</div>
</a-tooltip>
</div>
</a-card>
@@ -47,6 +51,7 @@ import { elementProps } from './props';
import type { ModelElement } from './element';
import { DeleteOutlined, SettingOutlined } from '@ant-design/icons-vue';
import type { Graph } from '@antv/x6';
import {substring} from '@/utils/strings'
export default defineComponent({
name: 'ModelElement',
@@ -116,6 +121,7 @@ export default defineComponent({
return {
element,
substring,
handleMenuClick,
handleVisibleChange,
};
@@ -164,8 +170,8 @@ export default defineComponent({
border-radius: 0;
font-size: 12px;
padding: 8px 15px;
overflow-y: auto;
border-top: 1px solid #195693;
overflow: hidden;
}
&.ks-designer-task-node {
@@ -264,6 +270,10 @@ export default defineComponent({
height: 20px;
display: block;
background: url('@/assets/icons/point.svg') center / 100% 100%;
position: absolute;
left: 5px;
top: 10px;
}
// 右侧出桩样式
@@ -277,6 +287,10 @@ export default defineComponent({
height: 20px;
display: block;
background: url('@/assets/icons/arrow-right.svg') center / 100% 100%;
position: absolute;
right: 5px;
top: 10px;
}
// 节点文本样式
@@ -285,7 +299,7 @@ export default defineComponent({
line-height: 24px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
//white-space: nowrap;
}
}
</style>

View File

@@ -9,4 +9,3 @@
export * from './tree'
export * from './template'
export * from './parameter'

View File

@@ -1,20 +0,0 @@
/*
* This file is part of the kernelstudio package.
*
* (c) 2014-2026 zlin <admin@kernelstudio.com>
*
* For the full copyright and license information, please view the LICENSE file
* that was distributed with this source code.
*/
import type { NullableString } from '@/types';
export interface NodeSetting {
id: number;
name: NullableString;
type: NullableString;
default_value: NullableString;
data_type: NullableString;
required: boolean;
description: NullableString;
}

View File

@@ -33,22 +33,7 @@ export const createGraphTaskElementFromTemplate = (
height: realRect.height,
inputs: null,
outputs: null,
parameters: [],
variables: [
{
key: generateKey('var_'),
name: '范围',
value: '1000',
defaults: '1000',
unit: 'KM'
},
{
key: generateKey('var_'),
name: '武器名称',
value: '地对空导弹',
defaults: '地对空导弹',
unit: '个'
}
],
parameters: template.parameters ?? [],
variables: [],
} as GraphTaskElement;
};