feat: [bpm][antd] bpm 设计器消息与信号,文档描述优化
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { nextTick, onBeforeUnmount, ref, toRaw, watch } from 'vue';
|
import { nextTick, onBeforeUnmount, ref, toRaw, watch } from 'vue';
|
||||||
|
|
||||||
import { Input } from 'ant-design-vue';
|
import { Textarea } from 'ant-design-vue';
|
||||||
|
|
||||||
defineOptions({ name: 'ElementOtherConfig' });
|
defineOptions({ name: 'ElementOtherConfig' });
|
||||||
|
|
||||||
@@ -12,8 +12,6 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const { Textarea } = Input;
|
|
||||||
|
|
||||||
const documentation = ref('');
|
const documentation = ref('');
|
||||||
const bpmnElement = ref();
|
const bpmnElement = ref();
|
||||||
|
|
||||||
@@ -58,10 +56,10 @@ watch(
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="panel-tab__content">
|
<div class="px-2 py-1">
|
||||||
<div class="element-property input-property">
|
<div class="flex items-start gap-2">
|
||||||
<div class="element-property__label">元素文档:</div>
|
<div class="w-20 pt-1 text-sm text-gray-700">元素文档:</div>
|
||||||
<div class="element-property__value">
|
<div class="flex-1">
|
||||||
<Textarea
|
<Textarea
|
||||||
v-model:value="documentation"
|
v-model:value="documentation"
|
||||||
:auto-size="{ minRows: 2, maxRows: 4 }"
|
:auto-size="{ minRows: 2, maxRows: 4 }"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, onMounted, ref } from 'vue';
|
import { computed, onMounted, ref, watch } from 'vue';
|
||||||
|
|
||||||
|
import { confirm, useVbenModal } from '@vben/common-ui';
|
||||||
import { IconifyIcon } from '@vben/icons';
|
import { IconifyIcon } from '@vben/icons';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -10,17 +11,16 @@ import {
|
|||||||
FormItem,
|
FormItem,
|
||||||
Input,
|
Input,
|
||||||
message,
|
message,
|
||||||
Modal,
|
|
||||||
Table,
|
|
||||||
TableColumn,
|
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
|
|
||||||
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
|
|
||||||
defineOptions({ name: 'SignalAndMassage' });
|
defineOptions({ name: 'SignalAndMassage' });
|
||||||
const signalList = ref<any[]>([]);
|
const signalList = ref<any[]>([]);
|
||||||
const messageList = ref<any[]>([]);
|
const messageList = ref<any[]>([]);
|
||||||
const dialogVisible = ref(false);
|
|
||||||
const modelType = ref('');
|
const modelType = ref('');
|
||||||
const modelObjectForm = ref<any>({});
|
const modelObjectForm = ref<any>({});
|
||||||
|
const formRef = ref();
|
||||||
const rootElements = ref();
|
const rootElements = ref();
|
||||||
const messageIdMap = ref();
|
const messageIdMap = ref();
|
||||||
const signalIdMap = ref();
|
const signalIdMap = ref();
|
||||||
@@ -75,17 +75,24 @@ const openModel = (type: any) => {
|
|||||||
id: generateStandardId(type),
|
id: generateStandardId(type),
|
||||||
name: '',
|
name: '',
|
||||||
};
|
};
|
||||||
dialogVisible.value = true;
|
modelModalApi.open();
|
||||||
};
|
};
|
||||||
|
|
||||||
const openEditModel = (type: any, row: any, index: number) => {
|
const openEditModel = (type: any, row: any, index: number) => {
|
||||||
modelType.value = type;
|
modelType.value = type;
|
||||||
editingIndex.value = index;
|
editingIndex.value = index;
|
||||||
modelObjectForm.value = { ...row };
|
modelObjectForm.value = { ...row };
|
||||||
dialogVisible.value = true;
|
modelModalApi.open();
|
||||||
};
|
};
|
||||||
|
|
||||||
const addNewObject = () => {
|
const addNewObject = async () => {
|
||||||
|
try {
|
||||||
|
await formRef.value?.validate();
|
||||||
|
} catch {
|
||||||
|
// 校验未通过,直接返回
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (modelType.value === 'message') {
|
if (modelType.value === 'message') {
|
||||||
// 编辑模式
|
// 编辑模式
|
||||||
if (editingIndex.value === -1) {
|
if (editingIndex.value === -1) {
|
||||||
@@ -135,144 +142,202 @@ const addNewObject = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dialogVisible.value = false;
|
modelModalApi.close();
|
||||||
initDataList();
|
initDataList();
|
||||||
};
|
};
|
||||||
|
|
||||||
// 补充"编辑"、"移除"功能。相关 issue:https://github.com/YunaiV/yudao-cloud/issues/270
|
// 补充"编辑"、"移除"功能。相关 issue:https://github.com/YunaiV/yudao-cloud/issues/270
|
||||||
const removeObject = (type: any, row: any) => {
|
const removeObject = (type: any, row: any) => {
|
||||||
Modal.confirm({
|
confirm({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: `确认移除该${type === 'message' ? '消息' : '信号'}吗?`,
|
content: `确认移除该${type === 'message' ? '消息' : '信号'}吗?`,
|
||||||
okText: '确 认',
|
}).then(() => {
|
||||||
cancelText: '取 消',
|
// 从 rootElements 中移除
|
||||||
onOk() {
|
const targetType = type === 'message' ? 'bpmn:Message' : 'bpmn:Signal';
|
||||||
// 从 rootElements 中移除
|
const elementIndex = rootElements.value.findIndex(
|
||||||
const targetType = type === 'message' ? 'bpmn:Message' : 'bpmn:Signal';
|
(el: any) => el.$type === targetType && el.id === row.id,
|
||||||
const elementIndex = rootElements.value.findIndex(
|
);
|
||||||
(el: any) => el.$type === targetType && el.id === row.id,
|
if (elementIndex !== -1) {
|
||||||
);
|
rootElements.value.splice(elementIndex, 1);
|
||||||
if (elementIndex !== -1) {
|
}
|
||||||
rootElements.value.splice(elementIndex, 1);
|
// 刷新列表
|
||||||
}
|
initDataList();
|
||||||
// 刷新列表
|
message.success('移除成功');
|
||||||
initDataList();
|
|
||||||
message.success('移除成功');
|
|
||||||
},
|
|
||||||
onCancel() {
|
|
||||||
// console.info('操作取消');
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const [MessageGrid, messageGridApi] = useVbenVxeGrid({
|
||||||
|
gridOptions: {
|
||||||
|
columns: [
|
||||||
|
{ type: 'seq', width: 50, title: '序号' },
|
||||||
|
{ field: 'id', title: '消息ID', minWidth: 120 },
|
||||||
|
{ field: 'name', title: '消息名称', minWidth: 100 },
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
width: 120,
|
||||||
|
slots: { default: 'action' },
|
||||||
|
fixed: 'right',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
border: true,
|
||||||
|
showOverflow: true,
|
||||||
|
height: 'auto',
|
||||||
|
toolbarConfig: {
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
pagerConfig: {
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const [SignalGrid, signalGridApi] = useVbenVxeGrid({
|
||||||
|
gridOptions: {
|
||||||
|
columns: [
|
||||||
|
{ type: 'seq', width: 50, title: '序号' },
|
||||||
|
{ field: 'id', title: '信号ID', minWidth: 120 },
|
||||||
|
{ field: 'name', title: '信号名称', minWidth: 100 },
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
width: 120,
|
||||||
|
slots: { default: 'action' },
|
||||||
|
fixed: 'right',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
border: true,
|
||||||
|
showOverflow: true,
|
||||||
|
height: 'auto',
|
||||||
|
toolbarConfig: {
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
pagerConfig: {
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const [ModelModal, modelModalApi] = useVbenModal({
|
||||||
|
destroyOnClose: true,
|
||||||
|
onConfirm: addNewObject,
|
||||||
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
initDataList();
|
initDataList();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
messageList,
|
||||||
|
(val) => {
|
||||||
|
messageGridApi.setGridOptions({ data: val });
|
||||||
|
},
|
||||||
|
{ deep: true },
|
||||||
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
signalList,
|
||||||
|
(val) => {
|
||||||
|
signalGridApi.setGridOptions({ data: val });
|
||||||
|
},
|
||||||
|
{ deep: true },
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="panel-tab__content">
|
<div class="-mx-2">
|
||||||
<div class="panel-tab__content--title">
|
<div class="mb-2 flex items-center justify-between">
|
||||||
<span class="flex items-center">
|
<span class="flex items-center">
|
||||||
<IconifyIcon icon="ep:menu" class="mr-2 text-gray-600" />
|
<IconifyIcon icon="ep:menu" class="mr-2 text-gray-600" />
|
||||||
消息列表
|
消息列表
|
||||||
</span>
|
</span>
|
||||||
<Button type="primary" title="创建新消息" @click="openModel('message')">
|
<Button
|
||||||
|
class="flex items-center"
|
||||||
|
size="small"
|
||||||
|
type="link"
|
||||||
|
@click="openModel('message')"
|
||||||
|
>
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<IconifyIcon icon="ep:plus" />
|
<IconifyIcon icon="ep:plus" />
|
||||||
</template>
|
</template>
|
||||||
创建新消息
|
创建新消息
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<Table :data-source="messageList" size="small" bordered>
|
<MessageGrid :data="messageList">
|
||||||
<TableColumn title="序号" width="60px">
|
<template #action="{ row, rowIndex }">
|
||||||
<template #default="{ index }">
|
<Button
|
||||||
{{ index + 1 }}
|
size="small"
|
||||||
</template>
|
type="link"
|
||||||
</TableColumn>
|
@click="openEditModel('message', row, rowIndex)"
|
||||||
<TableColumn title="消息ID" data-index="id" />
|
>
|
||||||
<TableColumn title="消息名称" data-index="name" />
|
编辑
|
||||||
<TableColumn title="操作" width="110px">
|
</Button>
|
||||||
<template #default="{ record, index }">
|
<Divider type="vertical" />
|
||||||
<Button
|
<Button
|
||||||
size="small"
|
size="small"
|
||||||
type="link"
|
type="link"
|
||||||
@click="openEditModel('message', record, index)"
|
danger
|
||||||
>
|
@click="removeObject('message', row)"
|
||||||
编辑
|
>
|
||||||
</Button>
|
移除
|
||||||
<Divider type="vertical" />
|
</Button>
|
||||||
<Button
|
</template>
|
||||||
size="small"
|
</MessageGrid>
|
||||||
type="link"
|
<div
|
||||||
danger
|
class="mb-2 mt-2 flex items-center justify-between border-t border-gray-200 pt-2"
|
||||||
@click="removeObject('message', record)"
|
>
|
||||||
>
|
|
||||||
移除
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
</TableColumn>
|
|
||||||
</Table>
|
|
||||||
<div class="panel-tab__content--title mt-2 border-t border-gray-200 pt-2">
|
|
||||||
<span class="flex items-center">
|
<span class="flex items-center">
|
||||||
<IconifyIcon icon="ep:menu" class="mr-2 text-gray-600" />
|
<IconifyIcon icon="ep:menu" class="mr-2 text-gray-600" />
|
||||||
信号列表
|
信号列表
|
||||||
</span>
|
</span>
|
||||||
<Button type="primary" title="创建新信号" @click="openModel('signal')">
|
<Button
|
||||||
|
class="flex items-center"
|
||||||
|
size="small"
|
||||||
|
type="link"
|
||||||
|
@click="openModel('signal')"
|
||||||
|
>
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<IconifyIcon icon="ep:plus" />
|
<IconifyIcon icon="ep:plus" />
|
||||||
</template>
|
</template>
|
||||||
创建新信号
|
创建新信号
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<Table :data-source="signalList" size="small" bordered>
|
<SignalGrid :data="signalList">
|
||||||
<TableColumn title="序号" width="60px">
|
<template #action="{ row, rowIndex }">
|
||||||
<template #default="{ index }">
|
<Button
|
||||||
{{ index + 1 }}
|
size="small"
|
||||||
</template>
|
type="link"
|
||||||
</TableColumn>
|
@click="openEditModel('signal', row, rowIndex)"
|
||||||
<TableColumn title="信号ID" data-index="id" />
|
>
|
||||||
<TableColumn title="信号名称" data-index="name" />
|
编辑
|
||||||
<TableColumn title="操作" width="110px">
|
</Button>
|
||||||
<template #default="{ record, index }">
|
<Divider type="vertical" />
|
||||||
<Button
|
<Button
|
||||||
size="small"
|
size="small"
|
||||||
type="link"
|
type="link"
|
||||||
@click="openEditModel('signal', record, index)"
|
danger
|
||||||
>
|
@click="removeObject('signal', row)"
|
||||||
编辑
|
>
|
||||||
</Button>
|
移除
|
||||||
<Divider type="vertical" />
|
</Button>
|
||||||
<Button
|
</template>
|
||||||
size="small"
|
</SignalGrid>
|
||||||
type="link"
|
|
||||||
danger
|
|
||||||
@click="removeObject('signal', record)"
|
|
||||||
>
|
|
||||||
移除
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
</TableColumn>
|
|
||||||
</Table>
|
|
||||||
|
|
||||||
<Modal
|
<ModelModal :title="modelConfig.title" class="w-3/5">
|
||||||
v-model:open="dialogVisible"
|
<Form
|
||||||
:title="modelConfig.title"
|
:model="modelObjectForm"
|
||||||
:mask-closable="false"
|
ref="formRef"
|
||||||
width="400px"
|
:label-col="{ span: 4 }"
|
||||||
:destroy-on-close="true"
|
:wrapper-col="{ span: 18 }"
|
||||||
>
|
>
|
||||||
<Form :model="modelObjectForm">
|
<FormItem
|
||||||
<FormItem :label="modelConfig.idLabel">
|
:label="modelConfig.idLabel"
|
||||||
|
name="id"
|
||||||
|
:rules="[{ required: true, message: '请输入 ID' }]"
|
||||||
|
>
|
||||||
<Input v-model:value="modelObjectForm.id" allow-clear />
|
<Input v-model:value="modelObjectForm.id" allow-clear />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem :label="modelConfig.nameLabel">
|
<FormItem :label="modelConfig.nameLabel">
|
||||||
<Input v-model:value="modelObjectForm.name" allow-clear />
|
<Input v-model:value="modelObjectForm.name" allow-clear />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</Form>
|
</Form>
|
||||||
<template #footer>
|
</ModelModal>
|
||||||
<Button @click="dialogVisible = false">取 消</Button>
|
|
||||||
<Button type="primary" @click="addNewObject">保 存</Button>
|
|
||||||
</template>
|
|
||||||
</Modal>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user