<template>
|
<div class="item_panel_box">
|
<el-input size="mini" placeholder="输入关键字进行过滤" v-model="filterText">
|
</el-input>
|
<div class="box_item">
|
<item-panel class="item-panel" v-loading="loading">
|
<template v-for="(item, index) in nodeItems">
|
<item
|
:key="index"
|
:type="item.type || 'node'"
|
:size="item.size || '72*43'"
|
:shape="item.shape || 'flow-rect'"
|
:model="{
|
// must have model property
|
color: item.color || '#1890FF',
|
label: item.id || '节点'
|
}"
|
>
|
<template v-if="item.src">
|
<div class="item item-img">
|
<img :src="item.src" :alt="item.id" />
|
</div>
|
</template>
|
<template v-else>
|
<div :class="'item item-' + (item.shape || 'flow-rect')">
|
<span>{{ item.id }}</span>
|
</div>
|
</template>
|
</item>
|
</template>
|
</item-panel>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import { Item, ItemPanel } from 'vue-flowchart-editor'
|
// import { getPage } from '../../../api/omd/status'
|
|
export default {
|
name: 'EditorItemPanel',
|
components: { ItemPanel, Item },
|
props: {
|
nodeItems:{
|
type:Array,
|
default:() => [],
|
}
|
},
|
data() {
|
return {
|
filterText: '',
|
loading: false,
|
}
|
},
|
created() {
|
this.loading = false
|
|
},
|
computed: {
|
filterNode() {
|
return this.nodeItems.filter(item => item.id.includes(this.filterText))
|
}
|
},
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.item-panel {
|
width: 210px;
|
height: 77vh;
|
text-align: center;
|
overflow-y: scroll;
|
display: flex;
|
flex-wrap: wrap; /* 允许换行 */
|
justify-content: center; /* 居中对齐项目 */
|
align-items: flex-start; /* 确保项目在容器顶部对齐 */
|
}
|
|
.item {
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
font-size: 12px;
|
margin: 10px; /* 设定外边距以确保项目间有间隔 */
|
user-select: none;
|
}
|
|
/* 项目类型的样式 */
|
.item-flow-rect {
|
width: 75px;
|
padding: 6px;
|
box-sizing: border-box;
|
border: 1px solid rgb(24, 144, 255);
|
background-color: rgba(24, 144, 255, 0.2);
|
}
|
|
.item-flow-circle {
|
width: 70px;
|
height: 70px;
|
border-radius: 60px;
|
border: 1px solid rgb(250, 140, 22);
|
background-color: rgba(250, 140, 22, 0.2);
|
}
|
|
.item-flow-rhombus {
|
width: 70px;
|
height: 70px;
|
border: 1px solid rgb(19, 194, 194);
|
background-color: rgba(19, 194, 194, 0.2);
|
transform: rotate(45deg);
|
margin: 25px auto;
|
|
span {
|
transform: rotate(-45deg);
|
}
|
}
|
|
.item-img {
|
max-width: 100px;
|
}
|
</style>
|