This commit is contained in:
lzp
2026-03-04 15:48:20 +08:00
6 changed files with 83 additions and 22 deletions

View File

@@ -48,7 +48,7 @@
default: () => ({})
}
})
const emit = defineEmits(['delete-node', 'copy-node'])
const emit = defineEmits(['delete-node', 'copy-node', 'bring-to-font', 'send-to-back', 'flip-horizontal', 'flip-vertical'])
const attrs = useAttrs()
const showHeader = ref(!!attrs.node?.data?.isHeader)
const showMenu = ref(false)
@@ -73,8 +73,8 @@
{ label: 'Bring to font', tip: '', on: () => {} },
{ label: 'Send to back', tip: '', on: () => {} },
{ isDivide: true },
{ label: 'Flip horizontal', tip: '', on: () => {} },
{ label: 'Flip vertical', tip: '', on: () => {} }
{ label: 'Flip horizontal', tip: '', on: () => {emit('flip-horizontal')} },
{ label: 'Flip vertical', tip: '', on: () => {emit('flip-vertical')} }
])
const onMenuItem = (v) => {
if (v.disabled) return

View File

@@ -34,6 +34,10 @@
@delete-node="deleteNode(node.id)"
@copy-node="copyNode(node.id)"
@update-data="(v) => (node.data.data = v)"
@bring-to-font="bringToFont(node.id)"
@send-to-back="sendToBack(node.id)"
@flip-horizontal="flipHorizontal(node.id)"
@flip-vertical="flipVertical(node.id)"
/>
</node>
</template>
@@ -139,7 +143,23 @@
}
/** 复制节点 */
const copyNode = (id) => {
console.log('复制:', id)
nodeManager.copyNodeById(id)
}
/** 节点zIndex设置最大 */
const bringToFont = (id) => {
// nodeManager.bringToFont(id)
}
/** 节点zIndex设置最小 */
const sendToBack = (id) => {
// nodeManager.sendToBack(id)
}
/** 水平翻转 */
const flipHorizontal = (id) => {
// nodeManager.flipHorizontal(id)
}
/** 垂直翻转 */
const flipVertical = (id) => {
// nodeManager.flipVertical(id)
}
// 导出流程

View File

@@ -100,4 +100,21 @@ export class NodeManager {
}
return this.createNode(options_)
}
copyNodeById(id: string) {
const node = this.stateManager.getNodeById(id)
const flowNode = this.stateManager.flowManager.getNodeById(id)
console.log(node,this.stateManager.flowManager.getNodeById(id))
if (!node) return console.warn(`copyNodeById: ${id}找不到对应节点`)
const node_ = {
...JSON.parse(JSON.stringify(node)),
id: createId(),
position: {
x: node.position.x,
y: node.position.y + (flowNode?.dimensions?.height || 0) + 50,
}
}
this.stateManager.addNode(node_)
// return this.createNode(options_)
}
}

View File

@@ -127,4 +127,12 @@ export class StateManager {
setNodesDraggable(v: boolean) { this.nodesDraggable.value = v }
/** 设置是否可以平移画布 */
setPanOnDrag(v: boolean) { this.panOnDrag.value = v }
/** 获取节点最大zIndex值 */
getMaxZIndex() {
return this.nodes.value.reduce((max, node) => Math.max(max, node.zIndex), 0)
}
/** 获取节点最小zIndex值 */
getMinZIndex() {
return this.nodes.value.reduce((min, node) => Math.min(min, node.zIndex), 0)
}
}

View File

@@ -7,7 +7,10 @@
<div class="thumb">
<img :src="content.isUser ? userThumb : agentThumb" class="thumb-icon" />
</div>
<div class="message-context" v-show="!content.loading">
<div
class="message-context"
v-show="!content.loading && !content.thinking && !content.streaming"
>
<div class="img-list flex" v-if="imageList.length > 0">
<img
v-for="(item, index) in imageList"
@@ -225,9 +228,9 @@
.operate {
margin-top: 1.3rem;
column-gap: 1.2rem;
&.is-user {
justify-content: flex-end;
}
// &.is-user {
// justify-content: flex-end;
// }
}
}
.img-list {

View File

@@ -598,6 +598,22 @@
</script>
<style lang="less" scoped>
.report-btn {
position: absolute;
bottom: -7.4rem;
height: 4.4rem;
border-radius: 2.2rem;
width: 20rem;
background-color: #fff;
border: 1px solid #f6f4ef;
column-gap: 1.2rem;
cursor: pointer;
.c-svg {
width: 1.5rem;
height: 1.9rem;
}
}
.assist-input-wrapper {
min-height: 23.5rem;
max-height: 43.5rem;
@@ -605,24 +621,18 @@
border-radius: 2.8rem;
background-color: #fff;
border: 0.1rem solid #00000005;
box-shadow: 0px 5px 14px 0px #0000001a;
box-shadow: 0px 0.5rem 1.4rem 0px #0000001a;
margin: 0 auto;
padding: 0;
position: relative;
.report-btn {
position: absolute;
bottom: -7.4rem;
height: 4.4rem;
border-radius: 2.2rem;
width: 20rem;
background-color: #fff;
border: 1px solid #f6f4ef;
column-gap: 1.2rem;
cursor: pointer;
.c-svg {
width: 1.5rem;
height: 1.9rem;
&:not(.agent):hover {
box-shadow: 0px 0.5rem 3.36rem 2.2rem #f1ede999;
transition: all 0.3s ease;
top: -1rem;
.report-btn {
bottom: -8.4rem;
}
}
@@ -823,6 +833,9 @@
cursor: pointer;
background-color: #ff7a51;
border-radius: 50%;
&:hover {
background-color: #f8693d;
}
.sender-icon {
width: 1.3rem;
height: 1.3rem;