mirror of
https://gitee.com/log4j/pig-ui.git
synced 2024-12-23 05:40:20 +08:00
修复 工作流无法添加新节点问题
1. 修复 工作流无法添加新节点问题 2. 修复 左侧导航无法隐藏问题
This commit is contained in:
parent
1787f09bdc
commit
2b9506845c
2
src/types/views.d.ts
vendored
2
src/types/views.d.ts
vendored
@ -243,8 +243,6 @@ declare type XyState = {
|
||||
};
|
||||
|
||||
declare type WorkflowState<T = any> = {
|
||||
workflowRightRef: HTMLDivElement | null;
|
||||
leftNavRefs: HTMLElement[];
|
||||
leftNavList: T[];
|
||||
dropdownNode: XyState;
|
||||
dropdownLine: XyState;
|
||||
|
@ -12,7 +12,7 @@
|
||||
<el-scrollbar>
|
||||
<div
|
||||
ref="leftNavRefs"
|
||||
v-for="val in leftNavList"
|
||||
v-for="val in state.leftNavList"
|
||||
:key="val.id"
|
||||
:style="{ height: val.isOpen ? 'auto' : '50px', overflow: 'hidden' }"
|
||||
class="workflow-left-id"
|
||||
@ -86,6 +86,8 @@ const Drawer = defineAsyncComponent(() => import('./component/drawer/index.vue')
|
||||
const Help = defineAsyncComponent(() => import('./component/tool/help.vue'));
|
||||
|
||||
// 定义变量内容
|
||||
const leftNavRefs = ref([]);
|
||||
const workflowRightRef = ref();
|
||||
const contextmenuNodeRef = ref();
|
||||
const contextmenuLineRef = ref();
|
||||
const drawerRef = ref();
|
||||
@ -95,8 +97,6 @@ const storesThemeConfig = useThemeConfig();
|
||||
const { themeConfig } = storeToRefs(storesThemeConfig);
|
||||
const { copyText } = commonFunction();
|
||||
const state = reactive<WorkflowState>({
|
||||
workflowRightRef: null,
|
||||
leftNavRefs: [],
|
||||
leftNavList: [],
|
||||
dropdownNode: { x: '', y: '' },
|
||||
dropdownLine: { x: '', y: '' },
|
||||
@ -151,7 +151,7 @@ const initLeftNavList = () => {
|
||||
};
|
||||
// 左侧导航-初始化拖动
|
||||
const initSortable = () => {
|
||||
state.leftNavRefs.forEach((v) => {
|
||||
leftNavRefs.forEach((v) => {
|
||||
Sortable.create(v as HTMLDivElement, {
|
||||
group: {
|
||||
name: 'vue-next-admin-1',
|
||||
@ -165,7 +165,7 @@ const initSortable = () => {
|
||||
onEnd: function (evt: any) {
|
||||
const { name, icon, id } = evt.clone.dataset;
|
||||
const { layerX, layerY, clientX, clientY } = evt.originalEvent;
|
||||
const el = state.workflowRightRef!;
|
||||
const el = workflowRightRef.value!;
|
||||
const { x, y, width, height } = el.getBoundingClientRect();
|
||||
if (clientX < x || clientX > width + x || clientY < y || y > y + height) {
|
||||
ElMessage.warning('请把节点拖入到画布中');
|
||||
|
Loading…
Reference in New Issue
Block a user