!295 feat: [bpm][antd] bpm设计器 用户任务自定义配置优化
Merge pull request !295 from Jason/dev
This commit is contained in:
@@ -8,17 +8,20 @@
|
|||||||
7. 是否需要签名
|
7. 是否需要签名
|
||||||
-->
|
-->
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import type { ComponentPublicInstance } from 'vue';
|
||||||
|
|
||||||
import type { SystemUserApi } from '#/api/system/user';
|
import type { SystemUserApi } from '#/api/system/user';
|
||||||
import type { ButtonSetting } from '#/views/bpm/components/simple-process-design/consts';
|
|
||||||
|
|
||||||
import { inject, nextTick, onMounted, ref, toRaw, watch } from 'vue';
|
import { inject, nextTick, onMounted, ref, toRaw, watch } from 'vue';
|
||||||
|
|
||||||
import { BpmModelFormType } from '@vben/constants';
|
import { BpmModelFormType } from '@vben/constants';
|
||||||
|
import { IconifyIcon } from '@vben/icons';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Divider,
|
Divider,
|
||||||
Form,
|
Form,
|
||||||
|
Input,
|
||||||
Radio,
|
Radio,
|
||||||
RadioGroup,
|
RadioGroup,
|
||||||
Select,
|
Select,
|
||||||
@@ -74,15 +77,67 @@ const assignEmptyUserIdsEl = ref<any>();
|
|||||||
const assignEmptyUserIds = ref<any>();
|
const assignEmptyUserIds = ref<any>();
|
||||||
|
|
||||||
// 操作按钮
|
// 操作按钮
|
||||||
const buttonsSettingEl = ref<any>();
|
// const buttonsSettingEl = ref<any>();
|
||||||
const { btnDisplayNameEdit, changeBtnDisplayName } = useButtonsSetting();
|
// const { btnDisplayNameEdit, changeBtnDisplayName } = useButtonsSetting();
|
||||||
const btnDisplayNameBlurEvent = (index: number) => {
|
// const btnDisplayNameBlurEvent = (index: number) => {
|
||||||
btnDisplayNameEdit.value[index] = false;
|
// btnDisplayNameEdit.value[index] = false;
|
||||||
const buttonItem = buttonsSettingEl.value[index];
|
// const buttonItem = buttonsSettingEl.value[index];
|
||||||
buttonItem.displayName =
|
// buttonItem.displayName =
|
||||||
buttonItem.displayName || OPERATION_BUTTON_NAME.get(buttonItem.id)!;
|
// buttonItem.displayName || OPERATION_BUTTON_NAME.get(buttonItem.id)!;
|
||||||
updateElementExtensions();
|
// updateElementExtensions();
|
||||||
};
|
// };
|
||||||
|
|
||||||
|
// 操作按钮设置
|
||||||
|
const {
|
||||||
|
buttonsSetting,
|
||||||
|
btnDisplayNameEdit,
|
||||||
|
changeBtnDisplayName,
|
||||||
|
btnDisplayNameBlurEvent,
|
||||||
|
setInputRef,
|
||||||
|
} = useButtonsSetting();
|
||||||
|
|
||||||
|
/** 操作按钮设置 */
|
||||||
|
function useButtonsSetting() {
|
||||||
|
const buttonsSetting = ref<any[]>([]);
|
||||||
|
// 操作按钮显示名称可编辑
|
||||||
|
const btnDisplayNameEdit = ref<boolean[]>([]);
|
||||||
|
// 输入框的引用数组 - 内部使用,不暴露出去
|
||||||
|
const _btnDisplayNameInputRefs = ref<Array<HTMLInputElement | null>>([]);
|
||||||
|
|
||||||
|
const changeBtnDisplayName = (index: number) => {
|
||||||
|
btnDisplayNameEdit.value[index] = true;
|
||||||
|
// 输入框自动聚集
|
||||||
|
nextTick(() => {
|
||||||
|
if (_btnDisplayNameInputRefs.value[index]) {
|
||||||
|
_btnDisplayNameInputRefs.value[index]?.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const btnDisplayNameBlurEvent = (index: number) => {
|
||||||
|
btnDisplayNameEdit.value[index] = false;
|
||||||
|
const buttonItem = buttonsSetting.value![index];
|
||||||
|
if (buttonItem)
|
||||||
|
buttonItem.displayName =
|
||||||
|
buttonItem.displayName || OPERATION_BUTTON_NAME.get(buttonItem.id)!;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 设置 ref 引用的方法
|
||||||
|
const setInputRef = (
|
||||||
|
el: ComponentPublicInstance | Element | null,
|
||||||
|
index: number,
|
||||||
|
) => {
|
||||||
|
_btnDisplayNameInputRefs.value[index] = el as HTMLInputElement;
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
buttonsSetting,
|
||||||
|
btnDisplayNameEdit,
|
||||||
|
changeBtnDisplayName,
|
||||||
|
btnDisplayNameBlurEvent,
|
||||||
|
setInputRef,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// 字段权限
|
// 字段权限
|
||||||
const fieldsPermissionEl = ref<any[]>([]);
|
const fieldsPermissionEl = ref<any[]>([]);
|
||||||
@@ -178,12 +233,12 @@ const resetCustomConfigList = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 操作按钮
|
// 操作按钮
|
||||||
buttonsSettingEl.value = elExtensionElements.value.values?.filter(
|
buttonsSetting.value = elExtensionElements.value.values?.filter(
|
||||||
(ex: any) => ex.$type === `${prefix}:ButtonsSetting`,
|
(ex: any) => ex.$type === `${prefix}:ButtonsSetting`,
|
||||||
);
|
);
|
||||||
if (buttonsSettingEl.value.length === 0) {
|
if (buttonsSetting.value.length === 0) {
|
||||||
DEFAULT_BUTTON_SETTING.forEach((item) => {
|
DEFAULT_BUTTON_SETTING.forEach((item) => {
|
||||||
buttonsSettingEl.value.push(
|
buttonsSetting.value.push(
|
||||||
bpmnInstances().moddle.create(`${prefix}:ButtonsSetting`, {
|
bpmnInstances().moddle.create(`${prefix}:ButtonsSetting`, {
|
||||||
'flowable:id': item.id,
|
'flowable:id': item.id,
|
||||||
'flowable:displayName': item.displayName,
|
'flowable:displayName': item.displayName,
|
||||||
@@ -226,7 +281,7 @@ const resetCustomConfigList = () => {
|
|||||||
|
|
||||||
// 保留剩余扩展元素,便于后面更新该元素对应属性
|
// 保留剩余扩展元素,便于后面更新该元素对应属性
|
||||||
otherExtensions.value =
|
otherExtensions.value =
|
||||||
elExtensionElements.value.values?.find(
|
elExtensionElements.value.values?.filter(
|
||||||
(ex: any) =>
|
(ex: any) =>
|
||||||
ex.$type !== `${prefix}:AssignStartUserHandlerType` &&
|
ex.$type !== `${prefix}:AssignStartUserHandlerType` &&
|
||||||
ex.$type !== `${prefix}:RejectHandlerType` &&
|
ex.$type !== `${prefix}:RejectHandlerType` &&
|
||||||
@@ -287,7 +342,7 @@ const updateElementExtensions = () => {
|
|||||||
assignEmptyHandlerTypeEl.value,
|
assignEmptyHandlerTypeEl.value,
|
||||||
assignEmptyUserIdsEl.value,
|
assignEmptyUserIdsEl.value,
|
||||||
approveType.value,
|
approveType.value,
|
||||||
...buttonsSettingEl.value,
|
...buttonsSetting.value,
|
||||||
...fieldsPermissionEl.value,
|
...fieldsPermissionEl.value,
|
||||||
signEnable.value,
|
signEnable.value,
|
||||||
reasonRequire.value,
|
reasonRequire.value,
|
||||||
@@ -357,19 +412,19 @@ function findAllPredecessorsExcludingStart(elementId: string, modeler: any) {
|
|||||||
return [...predecessors]; // 返回前置节点数组
|
return [...predecessors]; // 返回前置节点数组
|
||||||
}
|
}
|
||||||
|
|
||||||
function useButtonsSetting() {
|
// function useButtonsSetting() {
|
||||||
const buttonsSetting = ref<ButtonSetting[]>();
|
// const buttonsSetting = ref<ButtonSetting[]>();
|
||||||
// 操作按钮显示名称可编辑
|
// // 操作按钮显示名称可编辑
|
||||||
const btnDisplayNameEdit = ref<boolean[]>([]);
|
// const btnDisplayNameEdit = ref<boolean[]>([]);
|
||||||
const changeBtnDisplayName = (index: number) => {
|
// const changeBtnDisplayName = (index: number) => {
|
||||||
btnDisplayNameEdit.value[index] = true;
|
// btnDisplayNameEdit.value[index] = true;
|
||||||
};
|
// };
|
||||||
return {
|
// return {
|
||||||
buttonsSetting,
|
// buttonsSetting,
|
||||||
btnDisplayNameEdit,
|
// btnDisplayNameEdit,
|
||||||
changeBtnDisplayName,
|
// changeBtnDisplayName,
|
||||||
};
|
// };
|
||||||
}
|
// }
|
||||||
|
|
||||||
/** 批量更新权限 */
|
/** 批量更新权限 */
|
||||||
const updatePermission = (type: string) => {
|
const updatePermission = (type: string) => {
|
||||||
@@ -413,13 +468,13 @@ onMounted(async () => {
|
|||||||
:disabled="returnTaskList.length === 0"
|
:disabled="returnTaskList.length === 0"
|
||||||
@change="updateRejectHandlerType"
|
@change="updateRejectHandlerType"
|
||||||
>
|
>
|
||||||
<div class="flex-col">
|
<Radio
|
||||||
<div v-for="(item, index) in REJECT_HANDLER_TYPES" :key="index">
|
v-for="(item, index) in REJECT_HANDLER_TYPES"
|
||||||
<Radio :key="item.value" :value="item.value">
|
:key="index"
|
||||||
{{ item.label }}
|
:value="item.value"
|
||||||
</Radio>
|
>
|
||||||
</div>
|
{{ item.label }}
|
||||||
</div>
|
</Radio>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
@@ -450,7 +505,7 @@ onMounted(async () => {
|
|||||||
v-model:value="assignEmptyHandlerType"
|
v-model:value="assignEmptyHandlerType"
|
||||||
@change="updateAssignEmptyHandlerType"
|
@change="updateAssignEmptyHandlerType"
|
||||||
>
|
>
|
||||||
<div class="flex-col">
|
<div class="flex flex-col gap-2">
|
||||||
<div v-for="(item, index) in ASSIGN_EMPTY_HANDLER_TYPES" :key="index">
|
<div v-for="(item, index) in ASSIGN_EMPTY_HANDLER_TYPES" :key="index">
|
||||||
<Radio :key="item.value" :value="item.value">
|
<Radio :key="item.value" :value="item.value">
|
||||||
{{ item.label }}
|
{{ item.label }}
|
||||||
@@ -486,7 +541,7 @@ onMounted(async () => {
|
|||||||
v-model:value="assignStartUserHandlerType"
|
v-model:value="assignStartUserHandlerType"
|
||||||
@change="updateAssignStartUserHandlerType"
|
@change="updateAssignStartUserHandlerType"
|
||||||
>
|
>
|
||||||
<div class="flex-col">
|
<div class="flex flex-col gap-2">
|
||||||
<div
|
<div
|
||||||
v-for="(item, index) in ASSIGN_START_USER_HANDLER_TYPES"
|
v-for="(item, index) in ASSIGN_START_USER_HANDLER_TYPES"
|
||||||
:key="index"
|
:key="index"
|
||||||
@@ -499,35 +554,44 @@ onMounted(async () => {
|
|||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
|
|
||||||
<Divider orientation="left">操作按钮</Divider>
|
<Divider orientation="left">操作按钮</Divider>
|
||||||
<div class="button-setting-pane">
|
<div class="mt-2 text-sm">
|
||||||
<div class="button-setting-title">
|
<!-- 头部标题行 -->
|
||||||
<div class="button-title-label">操作按钮</div>
|
|
||||||
<div class="button-title-label pl-4">显示名称</div>
|
|
||||||
<div class="button-title-label">启用</div>
|
|
||||||
</div>
|
|
||||||
<div
|
<div
|
||||||
class="button-setting-item"
|
class="flex items-center justify-between border border-slate-200 bg-slate-50 px-3 py-2 text-xs font-semibold text-slate-900"
|
||||||
v-for="(item, index) in buttonsSettingEl"
|
|
||||||
:key="index"
|
|
||||||
>
|
>
|
||||||
<div class="button-setting-item-label">
|
<div class="w-28 text-left">操作按钮</div>
|
||||||
|
<div class="w-40 pl-2 text-left">显示名称</div>
|
||||||
|
<div class="w-20 text-center">启用</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 按钮配置行 -->
|
||||||
|
<div
|
||||||
|
v-for="(item, index) in buttonsSetting"
|
||||||
|
:key="index"
|
||||||
|
class="flex items-center justify-between border border-t-0 border-slate-200 px-3 py-2 text-sm"
|
||||||
|
>
|
||||||
|
<div class="w-28 truncate text-left">
|
||||||
{{ OPERATION_BUTTON_NAME.get(item.id) }}
|
{{ OPERATION_BUTTON_NAME.get(item.id) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="button-setting-item-label">
|
<div class="flex w-40 items-center truncate text-left">
|
||||||
<input
|
<Input
|
||||||
type="text"
|
|
||||||
class="editable-title-input"
|
|
||||||
@blur="btnDisplayNameBlurEvent(index)"
|
|
||||||
v-mounted-focus
|
|
||||||
v-model="item.displayName"
|
|
||||||
:placeholder="item.displayName"
|
|
||||||
v-if="btnDisplayNameEdit[index]"
|
v-if="btnDisplayNameEdit[index]"
|
||||||
|
:ref="(el) => setInputRef(el, index)"
|
||||||
|
@blur="btnDisplayNameBlurEvent(index)"
|
||||||
|
@press-enter="btnDisplayNameBlurEvent(index)"
|
||||||
|
type="text"
|
||||||
|
v-model:value="item.displayName"
|
||||||
|
:placeholder="item.displayName"
|
||||||
|
class="max-w-32 focus:border-blue-500 focus:shadow-[0_0_0_2px_rgba(24,144,255,0.2)] focus:outline-none"
|
||||||
/>
|
/>
|
||||||
<Button v-else type="text" @click="changeBtnDisplayName(index)">
|
<Button v-else @click="changeBtnDisplayName(index)">
|
||||||
{{ item.displayName }}
|
<div class="flex items-center">
|
||||||
|
{{ item.displayName }}
|
||||||
|
<IconifyIcon icon="lucide:edit" class="ml-2" />
|
||||||
|
</div>
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<div class="button-setting-item-label">
|
<div class="flex w-20 items-center justify-center">
|
||||||
<Switch
|
<Switch
|
||||||
v-model:checked="item.enable"
|
v-model:checked="item.enable"
|
||||||
@change="updateElementExtensions"
|
@change="updateElementExtensions"
|
||||||
@@ -537,40 +601,50 @@ onMounted(async () => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Divider orientation="left">字段权限</Divider>
|
<Divider orientation="left">字段权限</Divider>
|
||||||
<div class="field-setting-pane" v-if="formType === BpmModelFormType.NORMAL">
|
<div v-if="formType === BpmModelFormType.NORMAL" class="mt-2 text-sm">
|
||||||
<div class="field-permit-title">
|
<!-- 头部标题行 -->
|
||||||
<div class="setting-title-label first-title">字段名称</div>
|
<div
|
||||||
<div class="other-titles">
|
class="flex items-center justify-between border border-slate-200 bg-slate-50 px-3 py-2 text-xs font-semibold text-slate-900"
|
||||||
|
>
|
||||||
|
<div class="w-28 text-left">字段名称</div>
|
||||||
|
<div class="flex flex-1 justify-between">
|
||||||
<span
|
<span
|
||||||
class="setting-title-label cursor-pointer"
|
class="inline-block w-24 cursor-pointer text-center hover:text-blue-500"
|
||||||
@click="updatePermission('READ')"
|
@click="updatePermission('READ')"
|
||||||
>只读
|
>
|
||||||
|
只读
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
class="setting-title-label cursor-pointer"
|
class="inline-block w-24 cursor-pointer text-center hover:text-blue-500"
|
||||||
@click="updatePermission('WRITE')"
|
@click="updatePermission('WRITE')"
|
||||||
>
|
>
|
||||||
可编辑
|
可编辑
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
class="setting-title-label cursor-pointer"
|
class="inline-block w-24 cursor-pointer text-center hover:text-blue-500"
|
||||||
@click="updatePermission('NONE')"
|
@click="updatePermission('NONE')"
|
||||||
>隐藏
|
>
|
||||||
|
隐藏
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 字段权限行 -->
|
||||||
<div
|
<div
|
||||||
class="field-setting-item"
|
|
||||||
v-for="(item, index) in fieldsPermissionEl"
|
v-for="(item, index) in fieldsPermissionEl"
|
||||||
:key="index"
|
:key="index"
|
||||||
|
class="flex items-center justify-between border border-t-0 border-slate-200 px-3 py-2 text-sm"
|
||||||
>
|
>
|
||||||
<div class="field-setting-item-label">{{ item.title }}</div>
|
<div class="w-28 truncate text-left" :title="item.title">
|
||||||
|
{{ item.title }}
|
||||||
|
</div>
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
class="field-setting-item-group"
|
|
||||||
v-model:value="item.permission"
|
v-model:value="item.permission"
|
||||||
|
class="flex flex-1 justify-between"
|
||||||
>
|
>
|
||||||
<div class="item-radio-wrap">
|
<div class="flex w-24 items-center justify-center">
|
||||||
<Radio
|
<Radio
|
||||||
|
class="ml-5"
|
||||||
:value="FieldPermissionType.READ"
|
:value="FieldPermissionType.READ"
|
||||||
size="large"
|
size="large"
|
||||||
@change="updateElementExtensions"
|
@change="updateElementExtensions"
|
||||||
@@ -578,8 +652,9 @@ onMounted(async () => {
|
|||||||
<span></span>
|
<span></span>
|
||||||
</Radio>
|
</Radio>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-radio-wrap">
|
<div class="flex w-24 items-center justify-center">
|
||||||
<Radio
|
<Radio
|
||||||
|
class="ml-5"
|
||||||
:value="FieldPermissionType.WRITE"
|
:value="FieldPermissionType.WRITE"
|
||||||
size="large"
|
size="large"
|
||||||
@change="updateElementExtensions"
|
@change="updateElementExtensions"
|
||||||
@@ -587,8 +662,9 @@ onMounted(async () => {
|
|||||||
<span></span>
|
<span></span>
|
||||||
</Radio>
|
</Radio>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-radio-wrap">
|
<div class="flex w-24 items-center justify-center">
|
||||||
<Radio
|
<Radio
|
||||||
|
class="ml-5"
|
||||||
:value="FieldPermissionType.NONE"
|
:value="FieldPermissionType.NONE"
|
||||||
size="large"
|
size="large"
|
||||||
@change="updateElementExtensions"
|
@change="updateElementExtensions"
|
||||||
|
|||||||
@@ -1,25 +1,25 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { inject, nextTick, ref, watch } from 'vue';
|
import { inject, nextTick, ref, watch } from 'vue';
|
||||||
|
|
||||||
|
import { confirm, useVbenDrawer, useVbenModal } from '@vben/common-ui';
|
||||||
import { IconifyIcon } from '@vben/icons';
|
import { IconifyIcon } from '@vben/icons';
|
||||||
import { cloneDeep } from '@vben/utils';
|
import { cloneDeep } from '@vben/utils';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Divider,
|
Divider,
|
||||||
Drawer,
|
|
||||||
Form,
|
Form,
|
||||||
FormItem,
|
FormItem,
|
||||||
Input,
|
Input,
|
||||||
Modal,
|
|
||||||
Select,
|
Select,
|
||||||
SelectOption,
|
SelectOption,
|
||||||
Table,
|
|
||||||
TableColumn,
|
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
|
|
||||||
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
|
import ProcessListenerSelectModal from '#/views/bpm/processListener/components/process-listener-select-modal.vue';
|
||||||
|
|
||||||
import { createListenerObject, updateElementExtensions } from '../../utils';
|
import { createListenerObject, updateElementExtensions } from '../../utils';
|
||||||
import ProcessListenerDialog from './ProcessListenerDialog.vue';
|
import ListenerFieldModal from './ListenerFieldModal.vue';
|
||||||
import {
|
import {
|
||||||
fieldType,
|
fieldType,
|
||||||
initListenerForm,
|
initListenerForm,
|
||||||
@@ -41,13 +41,9 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
const prefix = inject('prefix');
|
const prefix = inject('prefix');
|
||||||
const width = inject('width');
|
|
||||||
const elementListenersList = ref<any[]>([]); // 监听器列表
|
const elementListenersList = ref<any[]>([]); // 监听器列表
|
||||||
const listenerForm = ref<any>({}); // 监听器详情表单
|
const listenerForm = ref<any>({}); // 监听器详情表单
|
||||||
const listenerFormModelVisible = ref(false); // 监听器 编辑 侧边栏显示状态
|
|
||||||
const fieldsListOfListener = ref<any[]>([]);
|
const fieldsListOfListener = ref<any[]>([]);
|
||||||
const listenerFieldForm = ref<any>({}); // 监听器 注入字段 详情表单
|
|
||||||
const listenerFieldFormModelVisible = ref(false); // 监听器 注入字段表单弹窗 显示状态
|
|
||||||
const editingListenerIndex = ref(-1); // 监听器所在下标,-1 为新增
|
const editingListenerIndex = ref(-1); // 监听器所在下标,-1 为新增
|
||||||
const editingListenerFieldIndex = ref(-1); // 字段所在下标,-1 为新增
|
const editingListenerFieldIndex = ref(-1); // 字段所在下标,-1 为新增
|
||||||
const listenerTypeObject = ref(listenerType);
|
const listenerTypeObject = ref(listenerType);
|
||||||
@@ -55,7 +51,6 @@ const fieldTypeObject = ref(fieldType);
|
|||||||
const otherExtensionList = ref();
|
const otherExtensionList = ref();
|
||||||
const bpmnElementListeners = ref();
|
const bpmnElementListeners = ref();
|
||||||
const listenerFormRef = ref();
|
const listenerFormRef = ref();
|
||||||
const listenerFieldFormRef = ref();
|
|
||||||
const bpmnInstances = () => (window as any)?.bpmnInstances;
|
const bpmnInstances = () => (window as any)?.bpmnInstances;
|
||||||
|
|
||||||
const resetListenersList = () => {
|
const resetListenersList = () => {
|
||||||
@@ -80,13 +75,12 @@ const resetListenersList = () => {
|
|||||||
};
|
};
|
||||||
// 打开 监听器详情 侧边栏
|
// 打开 监听器详情 侧边栏
|
||||||
const openListenerForm = (listener: any, index: number) => {
|
const openListenerForm = (listener: any, index: number) => {
|
||||||
// debugger
|
|
||||||
if (listener) {
|
if (listener) {
|
||||||
listenerForm.value = initListenerForm(listener);
|
listenerForm.value = initListenerForm(listener);
|
||||||
editingListenerIndex.value = index;
|
editingListenerIndex.value = index;
|
||||||
} else {
|
} else {
|
||||||
listenerForm.value = {};
|
listenerForm.value = {};
|
||||||
editingListenerIndex.value = -1; // 标记为新增
|
editingListenerIndex.value = -1;
|
||||||
}
|
}
|
||||||
if (listener && listener.fields) {
|
if (listener && listener.fields) {
|
||||||
fieldsListOfListener.value = listener.fields.map((field: any) => ({
|
fieldsListOfListener.value = listener.fields.map((field: any) => ({
|
||||||
@@ -97,8 +91,7 @@ const openListenerForm = (listener: any, index: number) => {
|
|||||||
fieldsListOfListener.value = [];
|
fieldsListOfListener.value = [];
|
||||||
listenerForm.value.fields = [];
|
listenerForm.value.fields = [];
|
||||||
}
|
}
|
||||||
// 打开侧边栏并清楚验证状态
|
listenerDrawerApi.open();
|
||||||
listenerFormModelVisible.value = true;
|
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
if (listenerFormRef.value) {
|
if (listenerFormRef.value) {
|
||||||
listenerFormRef.value.clearValidate();
|
listenerFormRef.value.clearValidate();
|
||||||
@@ -108,96 +101,64 @@ const openListenerForm = (listener: any, index: number) => {
|
|||||||
|
|
||||||
// 打开监听器字段编辑弹窗
|
// 打开监听器字段编辑弹窗
|
||||||
const openListenerFieldForm = (field: any, index: number) => {
|
const openListenerFieldForm = (field: any, index: number) => {
|
||||||
listenerFieldForm.value = field ? cloneDeep(field) : {};
|
const data = field ? cloneDeep(field) : {};
|
||||||
editingListenerFieldIndex.value = field ? index : -1;
|
editingListenerFieldIndex.value = field ? index : -1;
|
||||||
listenerFieldFormModelVisible.value = true;
|
fieldModalApi.setData(data).open();
|
||||||
nextTick(() => {
|
|
||||||
if (listenerFieldFormRef.value) {
|
|
||||||
listenerFieldFormRef.value.clearValidate();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
// 保存监听器注入字段
|
// 保存监听器注入字段
|
||||||
const saveListenerFiled = async () => {
|
const saveListenerFiled = async (data: any) => {
|
||||||
// debugger
|
|
||||||
const validateStatus = await listenerFieldFormRef.value.validate();
|
|
||||||
if (!validateStatus) return; // 验证不通过直接返回
|
|
||||||
if (editingListenerFieldIndex.value === -1) {
|
if (editingListenerFieldIndex.value === -1) {
|
||||||
fieldsListOfListener.value.push(listenerFieldForm.value);
|
fieldsListOfListener.value.push(data);
|
||||||
listenerForm.value.fields.push(listenerFieldForm.value);
|
listenerForm.value.fields.push(data);
|
||||||
} else {
|
} else {
|
||||||
fieldsListOfListener.value.splice(
|
fieldsListOfListener.value.splice(editingListenerFieldIndex.value, 1, data);
|
||||||
editingListenerFieldIndex.value,
|
listenerForm.value.fields.splice(editingListenerFieldIndex.value, 1, data);
|
||||||
1,
|
|
||||||
listenerFieldForm.value,
|
|
||||||
);
|
|
||||||
listenerForm.value.fields.splice(
|
|
||||||
editingListenerFieldIndex.value,
|
|
||||||
1,
|
|
||||||
listenerFieldForm.value,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
listenerFieldFormModelVisible.value = false;
|
|
||||||
nextTick(() => {
|
|
||||||
listenerFieldForm.value = {};
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
// 移除监听器字段
|
// 移除监听器字段
|
||||||
const removeListenerField = (index: number) => {
|
const removeListenerField = (index: number) => {
|
||||||
// debugger
|
confirm({
|
||||||
Modal.confirm({
|
title: '提示',
|
||||||
title: '确认移除该字段吗?',
|
content: '确认移除该字段吗?',
|
||||||
content: '此操作不可撤销',
|
}).then(() => {
|
||||||
okText: '确 认',
|
fieldsListOfListener.value.splice(index, 1);
|
||||||
cancelText: '取 消',
|
listenerForm.value.fields.splice(index, 1);
|
||||||
onOk() {
|
|
||||||
fieldsListOfListener.value.splice(index, 1);
|
|
||||||
listenerForm.value.fields.splice(index, 1);
|
|
||||||
},
|
|
||||||
onCancel() {
|
|
||||||
console.warn('操作取消');
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
// 移除监听器
|
// 移除监听器
|
||||||
const removeListener = (index: number) => {
|
const removeListener = (index: number) => {
|
||||||
Modal.confirm({
|
confirm({
|
||||||
title: '确认移除该监听器吗?',
|
title: '提示',
|
||||||
content: '此操作不可撤销',
|
content: '确认移除该监听器吗?',
|
||||||
okText: '确 认',
|
}).then(() => {
|
||||||
cancelText: '取 消',
|
const instances = bpmnInstances();
|
||||||
onOk() {
|
if (!instances || !instances.bpmnElement) return;
|
||||||
const instances = bpmnInstances();
|
bpmnElementListeners.value.splice(index, 1);
|
||||||
if (!instances || !instances.bpmnElement) return;
|
elementListenersList.value.splice(index, 1);
|
||||||
|
updateElementExtensions(instances.bpmnElement, [
|
||||||
bpmnElementListeners.value.splice(index, 1);
|
...otherExtensionList.value,
|
||||||
elementListenersList.value.splice(index, 1);
|
...bpmnElementListeners.value,
|
||||||
updateElementExtensions(instances.bpmnElement, [
|
]);
|
||||||
...otherExtensionList.value,
|
|
||||||
...bpmnElementListeners.value,
|
|
||||||
]);
|
|
||||||
},
|
|
||||||
onCancel() {
|
|
||||||
console.warn('操作取消');
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
// 保存监听器配置
|
// 保存监听器配置
|
||||||
const saveListenerConfig = async () => {
|
const saveListenerConfig = async () => {
|
||||||
// debugger
|
try {
|
||||||
const validateStatus = await listenerFormRef.value.validate();
|
await listenerFormRef.value.validate();
|
||||||
if (!validateStatus) return; // 验证不通过直接返回
|
} catch {
|
||||||
|
return;
|
||||||
const instances = bpmnInstances();
|
}
|
||||||
if (!instances || !instances.bpmnElement) return;
|
|
||||||
|
|
||||||
const bpmnElement = instances.bpmnElement;
|
|
||||||
const listenerObject = createListenerObject(
|
const listenerObject = createListenerObject(
|
||||||
listenerForm.value,
|
listenerForm.value,
|
||||||
false,
|
false,
|
||||||
prefix,
|
prefix,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const instances = bpmnInstances();
|
||||||
|
if (!instances || !instances.bpmnElement) return;
|
||||||
|
|
||||||
|
const bpmnElement = instances.bpmnElement;
|
||||||
|
|
||||||
if (editingListenerIndex.value === -1) {
|
if (editingListenerIndex.value === -1) {
|
||||||
bpmnElementListeners.value.push(listenerObject);
|
bpmnElementListeners.value.push(listenerObject);
|
||||||
elementListenersList.value.push(listenerForm.value);
|
elementListenersList.value.push(listenerForm.value);
|
||||||
@@ -213,7 +174,6 @@ const saveListenerConfig = async () => {
|
|||||||
listenerForm.value,
|
listenerForm.value,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// 保存其他配置
|
|
||||||
otherExtensionList.value =
|
otherExtensionList.value =
|
||||||
bpmnElement.businessObject?.extensionElements?.values?.filter(
|
bpmnElement.businessObject?.extensionElements?.values?.filter(
|
||||||
(ex: any) => ex.$type !== `${prefix}:ExecutionListener`,
|
(ex: any) => ex.$type !== `${prefix}:ExecutionListener`,
|
||||||
@@ -222,15 +182,101 @@ const saveListenerConfig = async () => {
|
|||||||
...otherExtensionList.value,
|
...otherExtensionList.value,
|
||||||
...bpmnElementListeners.value,
|
...bpmnElementListeners.value,
|
||||||
]);
|
]);
|
||||||
// 4. 隐藏侧边栏
|
listenerDrawerApi.close();
|
||||||
listenerFormModelVisible.value = false;
|
|
||||||
listenerForm.value = {};
|
listenerForm.value = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 配置主列表 Grid
|
||||||
|
const [ListenerGrid, listenerGridApi] = useVbenVxeGrid({
|
||||||
|
gridOptions: {
|
||||||
|
columns: [
|
||||||
|
{ type: 'seq', width: 50, title: '序号' },
|
||||||
|
{ field: 'event', title: '事件类型', minWidth: 100 },
|
||||||
|
{
|
||||||
|
field: 'listenerType',
|
||||||
|
title: '监听器类型',
|
||||||
|
minWidth: 100,
|
||||||
|
formatter: ({ cellValue }: { cellValue: string }) =>
|
||||||
|
(listenerTypeObject.value as Record<string, any>)[cellValue],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
width: 120,
|
||||||
|
slots: { default: 'action' },
|
||||||
|
fixed: 'right',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
border: true,
|
||||||
|
showOverflow: true,
|
||||||
|
height: 'auto',
|
||||||
|
toolbarConfig: {
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
pagerConfig: {
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// 配置字段列表 Grid
|
||||||
|
const [FieldsGrid, fieldsGridApi] = useVbenVxeGrid({
|
||||||
|
gridOptions: {
|
||||||
|
columns: [
|
||||||
|
{ type: 'seq', width: 50, title: '序号' },
|
||||||
|
{ field: 'name', title: '字段名称', minWidth: 100 },
|
||||||
|
{
|
||||||
|
field: 'fieldType',
|
||||||
|
title: '字段类型',
|
||||||
|
minWidth: 80,
|
||||||
|
formatter: ({ cellValue }: { cellValue: string }) =>
|
||||||
|
(fieldTypeObject.value as Record<string, any>)[cellValue],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '字段值/表达式',
|
||||||
|
minWidth: 100,
|
||||||
|
formatter: ({ row }: { row: any }) => row.string || row.expression,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
width: 120,
|
||||||
|
slots: { default: 'action' },
|
||||||
|
fixed: 'right',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
border: true,
|
||||||
|
showOverflow: true,
|
||||||
|
maxHeight: 200,
|
||||||
|
toolbarConfig: {
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
pagerConfig: {
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// 配置 Drawer
|
||||||
|
const [ListenerDrawer, listenerDrawerApi] = useVbenDrawer({
|
||||||
|
title: '执行监听器',
|
||||||
|
destroyOnClose: true,
|
||||||
|
onConfirm: saveListenerConfig,
|
||||||
|
});
|
||||||
|
|
||||||
|
// 配置字段 Modal
|
||||||
|
const [FieldModal, fieldModalApi] = useVbenModal({
|
||||||
|
connectedComponent: ListenerFieldModal,
|
||||||
|
});
|
||||||
|
|
||||||
|
// 配置选择监听器 Modal
|
||||||
|
const [ProcessListenerSelectModalComp, processListenerSelectModalApi] =
|
||||||
|
useVbenModal({
|
||||||
|
connectedComponent: ProcessListenerSelectModal,
|
||||||
|
destroyOnClose: true,
|
||||||
|
});
|
||||||
|
|
||||||
// 打开监听器弹窗
|
// 打开监听器弹窗
|
||||||
const processListenerDialogRef = ref();
|
|
||||||
const openProcessListenerDialog = async () => {
|
const openProcessListenerDialog = async () => {
|
||||||
processListenerDialogRef.value.open('execution');
|
processListenerSelectModalApi.setData({ type: 'execution' }).open();
|
||||||
};
|
};
|
||||||
const selectProcessListener = (listener: any) => {
|
const selectProcessListener = (listener: any) => {
|
||||||
const instances = bpmnInstances();
|
const instances = bpmnInstances();
|
||||||
@@ -253,6 +299,22 @@ const selectProcessListener = (listener: any) => {
|
|||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
elementListenersList,
|
||||||
|
(val) => {
|
||||||
|
listenerGridApi.setGridOptions({ data: val });
|
||||||
|
},
|
||||||
|
{ deep: true },
|
||||||
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
fieldsListOfListener,
|
||||||
|
(val) => {
|
||||||
|
fieldsGridApi.setGridOptions({ data: val });
|
||||||
|
},
|
||||||
|
{ deep: true },
|
||||||
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.id,
|
() => props.id,
|
||||||
(val: string) => {
|
(val: string) => {
|
||||||
@@ -266,56 +328,44 @@ watch(
|
|||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="panel-tab__content">
|
<div class="-mx-2">
|
||||||
<Table
|
<ListenerGrid :data="elementListenersList">
|
||||||
:data-source="elementListenersList"
|
<template #action="{ row, rowIndex }">
|
||||||
size="small"
|
<Button
|
||||||
bordered
|
size="small"
|
||||||
:pagination="false"
|
type="link"
|
||||||
>
|
@click="openListenerForm(row, rowIndex)"
|
||||||
<TableColumn title="序号" width="50px">
|
>
|
||||||
<template #default="{ index }">
|
编辑
|
||||||
{{ index + 1 }}
|
</Button>
|
||||||
</template>
|
<Divider type="vertical" />
|
||||||
</TableColumn>
|
<Button
|
||||||
<TableColumn title="事件类型" width="100px" data-index="event" />
|
size="small"
|
||||||
<TableColumn
|
type="link"
|
||||||
title="监听器类型"
|
danger
|
||||||
width="100px"
|
@click="removeListener(rowIndex)"
|
||||||
:custom-render="
|
>
|
||||||
({ record }: any) =>
|
移除
|
||||||
listenerTypeObject[record.listenerType as keyof typeof listenerType]
|
</Button>
|
||||||
"
|
</template>
|
||||||
/>
|
</ListenerGrid>
|
||||||
<TableColumn title="操作" width="100px">
|
<div class="mt-1 flex w-full items-center justify-center gap-2 px-2">
|
||||||
<template #default="{ record, index }">
|
<Button
|
||||||
<Button
|
class="flex flex-1 items-center justify-center"
|
||||||
size="small"
|
type="primary"
|
||||||
type="link"
|
size="small"
|
||||||
@click="openListenerForm(record, index)"
|
@click="openListenerForm(null, -1)"
|
||||||
>
|
>
|
||||||
编辑
|
|
||||||
</Button>
|
|
||||||
<Divider type="vertical" />
|
|
||||||
<Button
|
|
||||||
size="small"
|
|
||||||
type="link"
|
|
||||||
danger
|
|
||||||
@click="removeListener(index)"
|
|
||||||
>
|
|
||||||
移除
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
</TableColumn>
|
|
||||||
</Table>
|
|
||||||
<div class="element-drawer__button">
|
|
||||||
<Button type="primary" size="small" @click="openListenerForm(null, -1)">
|
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<IconifyIcon icon="ep:plus" />
|
<IconifyIcon icon="ep:plus" />
|
||||||
</template>
|
</template>
|
||||||
添加监听器
|
添加监听器
|
||||||
</Button>
|
</Button>
|
||||||
<Button size="small" @click="openProcessListenerDialog">
|
<Button
|
||||||
|
class="flex flex-1 items-center justify-center"
|
||||||
|
size="small"
|
||||||
|
@click="openProcessListenerDialog"
|
||||||
|
>
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<IconifyIcon icon="ep:select" />
|
<IconifyIcon icon="ep:select" />
|
||||||
</template>
|
</template>
|
||||||
@@ -324,13 +374,13 @@ watch(
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 监听器 编辑/创建 部分 -->
|
<!-- 监听器 编辑/创建 部分 -->
|
||||||
<Drawer
|
<ListenerDrawer>
|
||||||
v-model:open="listenerFormModelVisible"
|
<Form
|
||||||
title="执行监听器"
|
:model="listenerForm"
|
||||||
:width="width as any"
|
ref="listenerFormRef"
|
||||||
:destroy-on-close="true"
|
:label-col="{ span: 5 }"
|
||||||
>
|
:wrapper-col="{ span: 19 }"
|
||||||
<Form :model="listenerForm" ref="listenerFormRef">
|
>
|
||||||
<FormItem
|
<FormItem
|
||||||
label="事件类型"
|
label="事件类型"
|
||||||
name="event"
|
name="event"
|
||||||
@@ -484,8 +534,9 @@ watch(
|
|||||||
注入字段
|
注入字段
|
||||||
</span>
|
</span>
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
class="flex items-center"
|
||||||
title="添加字段"
|
size="small"
|
||||||
|
type="link"
|
||||||
@click="openListenerFieldForm(null, -1)"
|
@click="openListenerFieldForm(null, -1)"
|
||||||
>
|
>
|
||||||
<template #icon>
|
<template #icon>
|
||||||
@@ -494,143 +545,32 @@ watch(
|
|||||||
添加字段
|
添加字段
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<Table :data-source="fieldsListOfListener" size="small" bordered>
|
<FieldsGrid :data="fieldsListOfListener">
|
||||||
<TableColumn title="序号" width="50px">
|
<template #action="{ row, rowIndex }">
|
||||||
<template #default="{ index }">
|
<Button
|
||||||
{{ index + 1 }}
|
size="small"
|
||||||
</template>
|
type="link"
|
||||||
</TableColumn>
|
@click="openListenerFieldForm(row, rowIndex)"
|
||||||
<TableColumn title="字段名称" width="100px" data-index="name" />
|
>
|
||||||
<TableColumn
|
编辑
|
||||||
title="字段类型"
|
</Button>
|
||||||
width="80px"
|
<Divider type="vertical" />
|
||||||
:custom-render="
|
<Button
|
||||||
({ record }: any) =>
|
size="small"
|
||||||
fieldTypeObject[record.fieldType as keyof typeof fieldType]
|
type="link"
|
||||||
"
|
danger
|
||||||
/>
|
@click="removeListenerField(rowIndex)"
|
||||||
<TableColumn
|
>
|
||||||
title="字段值/表达式"
|
移除
|
||||||
width="120px"
|
</Button>
|
||||||
:custom-render="
|
</template>
|
||||||
({ record }: any) => record.string || record.expression
|
</FieldsGrid>
|
||||||
"
|
</ListenerDrawer>
|
||||||
/>
|
|
||||||
<TableColumn title="操作" width="80px" fixed="right">
|
|
||||||
<template #default="{ record, index }">
|
|
||||||
<Button
|
|
||||||
size="small"
|
|
||||||
type="link"
|
|
||||||
@click="openListenerFieldForm(record, index)"
|
|
||||||
>
|
|
||||||
编辑
|
|
||||||
</Button>
|
|
||||||
<Divider type="vertical" />
|
|
||||||
<Button
|
|
||||||
size="small"
|
|
||||||
type="link"
|
|
||||||
danger
|
|
||||||
@click="removeListenerField(index)"
|
|
||||||
>
|
|
||||||
移除
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
</TableColumn>
|
|
||||||
</Table>
|
|
||||||
|
|
||||||
<div class="element-drawer__button">
|
|
||||||
<Button @click="listenerFormModelVisible = false">取 消</Button>
|
|
||||||
<Button type="primary" @click="saveListenerConfig">保 存</Button>
|
|
||||||
</div>
|
|
||||||
</Drawer>
|
|
||||||
|
|
||||||
<!-- 注入字段 编辑/创建 部分 -->
|
<!-- 注入字段 编辑/创建 部分 -->
|
||||||
<Modal
|
<FieldModal @confirm="saveListenerFiled" />
|
||||||
title="字段配置"
|
|
||||||
v-model:open="listenerFieldFormModelVisible"
|
|
||||||
width="600px"
|
|
||||||
:destroy-on-close="true"
|
|
||||||
>
|
|
||||||
<Form :model="listenerFieldForm" ref="listenerFieldFormRef">
|
|
||||||
<FormItem
|
|
||||||
label="字段名称:"
|
|
||||||
name="name"
|
|
||||||
:rules="[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请填写字段名称',
|
|
||||||
trigger: ['blur', 'change'],
|
|
||||||
},
|
|
||||||
]"
|
|
||||||
>
|
|
||||||
<Input v-model:value="listenerFieldForm.name" allow-clear />
|
|
||||||
</FormItem>
|
|
||||||
<FormItem
|
|
||||||
label="字段类型:"
|
|
||||||
name="fieldType"
|
|
||||||
:rules="[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请选择字段类型',
|
|
||||||
trigger: ['blur', 'change'],
|
|
||||||
},
|
|
||||||
]"
|
|
||||||
>
|
|
||||||
<Select v-model:value="listenerFieldForm.fieldType">
|
|
||||||
<SelectOption
|
|
||||||
v-for="i in Object.keys(fieldTypeObject)"
|
|
||||||
:key="i"
|
|
||||||
:value="i"
|
|
||||||
>
|
|
||||||
{{ fieldTypeObject[i as keyof typeof fieldType] }}
|
|
||||||
</SelectOption>
|
|
||||||
</Select>
|
|
||||||
</FormItem>
|
|
||||||
<FormItem
|
|
||||||
v-if="listenerFieldForm.fieldType === 'string'"
|
|
||||||
label="字段值:"
|
|
||||||
name="string"
|
|
||||||
key="field-string"
|
|
||||||
:rules="[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请填写字段值',
|
|
||||||
trigger: ['blur', 'change'],
|
|
||||||
},
|
|
||||||
]"
|
|
||||||
>
|
|
||||||
<Input v-model:value="listenerFieldForm.string" allow-clear />
|
|
||||||
</FormItem>
|
|
||||||
<FormItem
|
|
||||||
v-if="listenerFieldForm.fieldType === 'expression'"
|
|
||||||
label="表达式:"
|
|
||||||
name="expression"
|
|
||||||
key="field-expression"
|
|
||||||
:rules="[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请填写表达式',
|
|
||||||
trigger: ['blur', 'change'],
|
|
||||||
},
|
|
||||||
]"
|
|
||||||
>
|
|
||||||
<Input v-model:value="listenerFieldForm.expression" allow-clear />
|
|
||||||
</FormItem>
|
|
||||||
</Form>
|
|
||||||
<template #footer>
|
|
||||||
<Button size="small" @click="listenerFieldFormModelVisible = false">
|
|
||||||
取 消
|
|
||||||
</Button>
|
|
||||||
<Button size="small" type="primary" @click="saveListenerFiled">
|
|
||||||
确 定
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
</Modal>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 选择弹窗 -->
|
<!-- 选择弹窗 -->
|
||||||
<ProcessListenerDialog
|
<ProcessListenerSelectModalComp @select="selectProcessListener" />
|
||||||
ref="processListenerDialogRef"
|
|
||||||
@select="selectProcessListener"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -0,0 +1,117 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
|
|
||||||
|
import { Form, FormItem, Input, Select, SelectOption } from 'ant-design-vue';
|
||||||
|
|
||||||
|
import { fieldType } from './utilSelf';
|
||||||
|
|
||||||
|
defineOptions({ name: 'ListenerFieldModal' });
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
confirm: [data: any];
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const fieldTypeObject = ref(fieldType);
|
||||||
|
const form = ref<any>({});
|
||||||
|
const formRef = ref();
|
||||||
|
|
||||||
|
const [Modal, modalApi] = useVbenModal({
|
||||||
|
onOpenChange(isOpen) {
|
||||||
|
if (isOpen) {
|
||||||
|
const data = modalApi.getData<any>();
|
||||||
|
form.value = data || {};
|
||||||
|
// clear validate
|
||||||
|
setTimeout(() => {
|
||||||
|
formRef.value?.clearValidate();
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onConfirm: async () => {
|
||||||
|
try {
|
||||||
|
await formRef.value?.validate();
|
||||||
|
emit('confirm', { ...form.value });
|
||||||
|
modalApi.close();
|
||||||
|
} catch {
|
||||||
|
// validate failed
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Modal title="字段配置" class="w-3/5">
|
||||||
|
<Form
|
||||||
|
ref="formRef"
|
||||||
|
:model="form"
|
||||||
|
:label-col="{ span: 4 }"
|
||||||
|
:wrapper-col="{ span: 18 }"
|
||||||
|
>
|
||||||
|
<FormItem
|
||||||
|
label="字段名称:"
|
||||||
|
name="name"
|
||||||
|
:rules="[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请填写字段名称',
|
||||||
|
trigger: ['blur', 'change'],
|
||||||
|
},
|
||||||
|
]"
|
||||||
|
>
|
||||||
|
<Input v-model:value="form.name" allow-clear />
|
||||||
|
</FormItem>
|
||||||
|
<FormItem
|
||||||
|
label="字段类型:"
|
||||||
|
name="fieldType"
|
||||||
|
:rules="[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请选择字段类型',
|
||||||
|
trigger: ['blur', 'change'],
|
||||||
|
},
|
||||||
|
]"
|
||||||
|
>
|
||||||
|
<Select v-model:value="form.fieldType">
|
||||||
|
<SelectOption
|
||||||
|
v-for="i in Object.keys(fieldTypeObject)"
|
||||||
|
:key="i"
|
||||||
|
:value="i"
|
||||||
|
>
|
||||||
|
{{ fieldTypeObject[i as keyof typeof fieldType] }}
|
||||||
|
</SelectOption>
|
||||||
|
</Select>
|
||||||
|
</FormItem>
|
||||||
|
<FormItem
|
||||||
|
v-if="form.fieldType === 'string'"
|
||||||
|
label="字段值:"
|
||||||
|
name="string"
|
||||||
|
key="field-string"
|
||||||
|
:rules="[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请填写字段值',
|
||||||
|
trigger: ['blur', 'change'],
|
||||||
|
},
|
||||||
|
]"
|
||||||
|
>
|
||||||
|
<Input v-model:value="form.string" allow-clear />
|
||||||
|
</FormItem>
|
||||||
|
<FormItem
|
||||||
|
v-if="form.fieldType === 'expression'"
|
||||||
|
label="表达式:"
|
||||||
|
name="expression"
|
||||||
|
key="field-expression"
|
||||||
|
:rules="[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请填写表达式',
|
||||||
|
trigger: ['blur', 'change'],
|
||||||
|
},
|
||||||
|
]"
|
||||||
|
>
|
||||||
|
<Input v-model:value="form.expression" allow-clear />
|
||||||
|
</FormItem>
|
||||||
|
</Form>
|
||||||
|
</Modal>
|
||||||
|
</template>
|
||||||
@@ -1,110 +0,0 @@
|
|||||||
<!-- 执行器选择 -->
|
|
||||||
<script setup lang="ts">
|
|
||||||
import type { BpmProcessListenerApi } from '#/api/bpm/processListener';
|
|
||||||
|
|
||||||
import { reactive, ref } from 'vue';
|
|
||||||
|
|
||||||
import { ContentWrap } from '@vben/common-ui';
|
|
||||||
import { CommonStatusEnum, DICT_TYPE } from '@vben/constants';
|
|
||||||
|
|
||||||
import { Button, Modal, Pagination, Table } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { getProcessListenerPage } from '#/api/bpm/processListener';
|
|
||||||
import { DictTag } from '#/components/dict-tag';
|
|
||||||
|
|
||||||
/** BPM 流程 表单 */
|
|
||||||
defineOptions({ name: 'ProcessListenerDialog' });
|
|
||||||
|
|
||||||
/** 提交表单 */
|
|
||||||
const emit = defineEmits(['success', 'select']);
|
|
||||||
const dialogVisible = ref(false); // 弹窗的是否展示
|
|
||||||
const loading = ref(true); // 列表的加载中
|
|
||||||
const list = ref<BpmProcessListenerApi.ProcessListener[]>([]); // 列表的数据
|
|
||||||
const total = ref(0); // 列表的总页数
|
|
||||||
const queryParams = reactive({
|
|
||||||
pageNo: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
type: '',
|
|
||||||
status: CommonStatusEnum.ENABLE,
|
|
||||||
});
|
|
||||||
|
|
||||||
/** 打开弹窗 */
|
|
||||||
const open = async (type: string) => {
|
|
||||||
queryParams.pageNo = 1;
|
|
||||||
queryParams.type = type;
|
|
||||||
await getList();
|
|
||||||
dialogVisible.value = true;
|
|
||||||
};
|
|
||||||
defineExpose({ open }); // 提供 open 方法,用于打开弹窗
|
|
||||||
|
|
||||||
/** 查询列表 */
|
|
||||||
const getList = async () => {
|
|
||||||
loading.value = true;
|
|
||||||
try {
|
|
||||||
const data = await getProcessListenerPage(queryParams);
|
|
||||||
list.value = data.list;
|
|
||||||
total.value = data.total;
|
|
||||||
} finally {
|
|
||||||
loading.value = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 定义 success 事件,用于操作成功后的回调
|
|
||||||
const select = async (row: BpmProcessListenerApi.ProcessListener) => {
|
|
||||||
dialogVisible.value = false;
|
|
||||||
// 发送操作成功的事件
|
|
||||||
emit('select', row);
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
<template>
|
|
||||||
<Modal
|
|
||||||
title="请选择监听器"
|
|
||||||
v-model:open="dialogVisible"
|
|
||||||
width="1024px"
|
|
||||||
:footer="null"
|
|
||||||
>
|
|
||||||
<ContentWrap>
|
|
||||||
<Table
|
|
||||||
:loading="loading"
|
|
||||||
:data-source="list"
|
|
||||||
:pagination="false"
|
|
||||||
:scroll="{ x: 'max-content' }"
|
|
||||||
>
|
|
||||||
<Table.Column title="名字" align="center" data-index="name" />
|
|
||||||
<Table.Column title="类型" align="center" data-index="type">
|
|
||||||
<template #default="{ record }">
|
|
||||||
<DictTag
|
|
||||||
:type="DICT_TYPE.BPM_PROCESS_LISTENER_TYPE"
|
|
||||||
:value="record.type"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</Table.Column>
|
|
||||||
<Table.Column title="事件" align="center" data-index="event" />
|
|
||||||
<Table.Column title="值类型" align="center" data-index="valueType">
|
|
||||||
<template #default="{ record }">
|
|
||||||
<DictTag
|
|
||||||
:type="DICT_TYPE.BPM_PROCESS_LISTENER_VALUE_TYPE"
|
|
||||||
:value="record.valueType"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</Table.Column>
|
|
||||||
<Table.Column title="值" align="center" data-index="value" />
|
|
||||||
<Table.Column title="操作" align="center" fixed="right">
|
|
||||||
<template #default="{ record }">
|
|
||||||
<Button type="primary" @click="select(record)"> 选择 </Button>
|
|
||||||
</template>
|
|
||||||
</Table.Column>
|
|
||||||
</Table>
|
|
||||||
<!-- 分页 -->
|
|
||||||
<div class="mt-4 flex justify-end">
|
|
||||||
<Pagination
|
|
||||||
:total="total"
|
|
||||||
v-model:current="queryParams.pageNo"
|
|
||||||
v-model:page-size="queryParams.pageSize"
|
|
||||||
show-size-changer
|
|
||||||
@change="getList"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</ContentWrap>
|
|
||||||
</Modal>
|
|
||||||
</template>
|
|
||||||
@@ -16,9 +16,10 @@ import {
|
|||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import ProcessListenerDialog from '#/views/bpm/components/bpmn-process-designer/package/penal/listeners/ProcessListenerDialog.vue';
|
import ProcessListenerSelectModal from '#/views/bpm/processListener/components/process-listener-select-modal.vue';
|
||||||
|
|
||||||
import { createListenerObject, updateElementExtensions } from '../../utils';
|
import { createListenerObject, updateElementExtensions } from '../../utils';
|
||||||
|
import ListenerFieldModal from './ListenerFieldModal.vue';
|
||||||
import {
|
import {
|
||||||
eventType,
|
eventType,
|
||||||
fieldType,
|
fieldType,
|
||||||
@@ -47,11 +48,9 @@ const fieldTypeObject = ref(fieldType);
|
|||||||
const fieldsListOfListener = ref<any[]>([]);
|
const fieldsListOfListener = ref<any[]>([]);
|
||||||
const editingListenerIndex = ref(-1);
|
const editingListenerIndex = ref(-1);
|
||||||
const editingListenerFieldIndex = ref<any>(-1);
|
const editingListenerFieldIndex = ref<any>(-1);
|
||||||
const listenerFieldForm = ref<any>({});
|
|
||||||
const bpmnElementListeners = ref<any[]>([]);
|
const bpmnElementListeners = ref<any[]>([]);
|
||||||
const otherExtensionList = ref<any[]>([]);
|
const otherExtensionList = ref<any[]>([]);
|
||||||
const listenerFormRef = ref<any>({});
|
const listenerFormRef = ref<any>({});
|
||||||
const listenerFieldFormRef = ref<any>({});
|
|
||||||
|
|
||||||
const bpmnInstances = () => (window as any)?.bpmnInstances;
|
const bpmnInstances = () => (window as any)?.bpmnInstances;
|
||||||
|
|
||||||
@@ -157,12 +156,9 @@ async function saveListenerConfig() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const openListenerFieldForm = (field: any, index?: number) => {
|
const openListenerFieldForm = (field: any, index?: number) => {
|
||||||
listenerFieldForm.value = field ? cloneDeep(field) : {};
|
const data = field ? cloneDeep(field) : {};
|
||||||
editingListenerFieldIndex.value = field ? index : -1;
|
editingListenerFieldIndex.value = field ? index : -1;
|
||||||
fieldModalApi.open();
|
fieldModalApi.setData(data).open();
|
||||||
nextTick(() => {
|
|
||||||
if (listenerFieldFormRef.value) listenerFieldFormRef.value.clearValidate();
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const [ListenerGrid, listenerGridApi] = useVbenVxeGrid({
|
const [ListenerGrid, listenerGridApi] = useVbenVxeGrid({
|
||||||
@@ -203,28 +199,13 @@ const [ListenerGrid, listenerGridApi] = useVbenVxeGrid({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
async function saveListenerField() {
|
async function saveListenerField(data: any) {
|
||||||
try {
|
if (editingListenerFieldIndex.value === -1) {
|
||||||
await listenerFieldFormRef.value.validate();
|
fieldsListOfListener.value.push(data);
|
||||||
if (editingListenerFieldIndex.value === -1) {
|
listenerForm.value.fields.push(data);
|
||||||
fieldsListOfListener.value.push(cloneDeep(listenerFieldForm.value));
|
} else {
|
||||||
listenerForm.value.fields.push(cloneDeep(listenerFieldForm.value));
|
fieldsListOfListener.value.splice(editingListenerFieldIndex.value, 1, data);
|
||||||
} else {
|
listenerForm.value.fields.splice(editingListenerFieldIndex.value, 1, data);
|
||||||
fieldsListOfListener.value.splice(
|
|
||||||
editingListenerFieldIndex.value,
|
|
||||||
1,
|
|
||||||
cloneDeep(listenerFieldForm.value),
|
|
||||||
);
|
|
||||||
listenerForm.value.fields.splice(
|
|
||||||
editingListenerFieldIndex.value,
|
|
||||||
1,
|
|
||||||
cloneDeep(listenerFieldForm.value),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
fieldModalApi.close();
|
|
||||||
listenerFieldForm.value = {};
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,9 +219,8 @@ const removeListenerField = (_: any, index: number) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const processListenerDialogRef = ref<any>();
|
|
||||||
const openProcessListenerDialog = async () => {
|
const openProcessListenerDialog = async () => {
|
||||||
processListenerDialogRef.value.open('task');
|
processListenerSelectModalApi.setData({ type: 'task' }).open();
|
||||||
};
|
};
|
||||||
const selectProcessListener = (listener: any) => {
|
const selectProcessListener = (listener: any) => {
|
||||||
const instances = bpmnInstances();
|
const instances = bpmnInstances();
|
||||||
@@ -248,6 +228,7 @@ const selectProcessListener = (listener: any) => {
|
|||||||
|
|
||||||
const bpmnElement = instances.bpmnElement;
|
const bpmnElement = instances.bpmnElement;
|
||||||
const listenerForm = initListenerForm2(listener);
|
const listenerForm = initListenerForm2(listener);
|
||||||
|
listenerForm.id = listener.id;
|
||||||
const listenerObject = createListenerObject(listenerForm, true, prefix);
|
const listenerObject = createListenerObject(listenerForm, true, prefix);
|
||||||
bpmnElementListeners.value.push(listenerObject);
|
bpmnElementListeners.value.push(listenerObject);
|
||||||
elementListenersList.value.push(listenerForm);
|
elementListenersList.value.push(listenerForm);
|
||||||
@@ -269,10 +250,15 @@ const [ListenerDrawer, listenerDrawerApi] = useVbenDrawer({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const [FieldModal, fieldModalApi] = useVbenModal({
|
const [FieldModal, fieldModalApi] = useVbenModal({
|
||||||
title: '字段配置',
|
connectedComponent: ListenerFieldModal,
|
||||||
onConfirm: saveListenerField,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const [ProcessListenerSelectModalComp, processListenerSelectModalApi] =
|
||||||
|
useVbenModal({
|
||||||
|
connectedComponent: ProcessListenerSelectModal,
|
||||||
|
destroyOnClose: true,
|
||||||
|
});
|
||||||
|
|
||||||
const [FieldsGrid, fieldsGridApi] = useVbenVxeGrid({
|
const [FieldsGrid, fieldsGridApi] = useVbenVxeGrid({
|
||||||
gridOptions: {
|
gridOptions: {
|
||||||
columns: [
|
columns: [
|
||||||
@@ -568,60 +554,9 @@ watch(
|
|||||||
</ListenerDrawer>
|
</ListenerDrawer>
|
||||||
|
|
||||||
<!-- 注入字段 编辑/创建 部分 -->
|
<!-- 注入字段 编辑/创建 部分 -->
|
||||||
<FieldModal class="w-3/5">
|
<FieldModal @confirm="saveListenerField" />
|
||||||
<Form
|
|
||||||
:label-col="{ span: 4 }"
|
|
||||||
:wrapper-col="{ span: 18 }"
|
|
||||||
:model="listenerFieldForm"
|
|
||||||
ref="listenerFieldFormRef"
|
|
||||||
>
|
|
||||||
<FormItem
|
|
||||||
label="字段名称:"
|
|
||||||
name="name"
|
|
||||||
:rules="[{ required: true, message: '请输入字段名称' }]"
|
|
||||||
>
|
|
||||||
<Input v-model:value="listenerFieldForm.name" allow-clear />
|
|
||||||
</FormItem>
|
|
||||||
<FormItem
|
|
||||||
label="字段类型:"
|
|
||||||
name="fieldType"
|
|
||||||
:rules="[{ required: true, message: '请选择字段类型' }]"
|
|
||||||
>
|
|
||||||
<Select v-model:value="listenerFieldForm.fieldType">
|
|
||||||
<SelectOption
|
|
||||||
v-for="i in Object.keys(fieldTypeObject)"
|
|
||||||
:key="i"
|
|
||||||
:value="i"
|
|
||||||
>
|
|
||||||
{{ fieldTypeObject[i as keyof typeof fieldType] }}
|
|
||||||
</SelectOption>
|
|
||||||
</Select>
|
|
||||||
</FormItem>
|
|
||||||
<FormItem
|
|
||||||
v-if="listenerFieldForm.fieldType === 'string'"
|
|
||||||
label="字段值:"
|
|
||||||
name="string"
|
|
||||||
key="field-string"
|
|
||||||
:rules="[{ required: true, message: '请输入字段值' }]"
|
|
||||||
>
|
|
||||||
<Input v-model:value="listenerFieldForm.string" allow-clear />
|
|
||||||
</FormItem>
|
|
||||||
<FormItem
|
|
||||||
v-if="listenerFieldForm.fieldType === 'expression'"
|
|
||||||
label="表达式:"
|
|
||||||
name="expression"
|
|
||||||
key="field-expression"
|
|
||||||
:rules="[{ required: true, message: '请输入表达式' }]"
|
|
||||||
>
|
|
||||||
<Input v-model:value="listenerFieldForm.expression" allow-clear />
|
|
||||||
</FormItem>
|
|
||||||
</Form>
|
|
||||||
</FieldModal>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 选择弹窗 -->
|
<!-- 选择弹窗 -->
|
||||||
<ProcessListenerDialog
|
<ProcessListenerSelectModalComp @select="selectProcessListener" />
|
||||||
ref="processListenerDialogRef"
|
|
||||||
@select="selectProcessListener"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ export function initListenerForm2(processListener: any) {
|
|||||||
class: processListener.value,
|
class: processListener.value,
|
||||||
event: processListener.event,
|
event: processListener.event,
|
||||||
fields: [],
|
fields: [],
|
||||||
|
id: undefined,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
case 'delegateExpression': {
|
case 'delegateExpression': {
|
||||||
@@ -61,6 +62,7 @@ export function initListenerForm2(processListener: any) {
|
|||||||
delegateExpression: processListener.value,
|
delegateExpression: processListener.value,
|
||||||
event: processListener.event,
|
event: processListener.event,
|
||||||
fields: [],
|
fields: [],
|
||||||
|
id: undefined,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
case 'expression': {
|
case 'expression': {
|
||||||
@@ -69,6 +71,7 @@ export function initListenerForm2(processListener: any) {
|
|||||||
expression: processListener.value,
|
expression: processListener.value,
|
||||||
event: processListener.event,
|
event: processListener.event,
|
||||||
fields: [],
|
fields: [],
|
||||||
|
id: undefined,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
// No default
|
// No default
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<!-- eslint-disable unused-imports/no-unused-vars -->
|
<!-- eslint-disable no-unused-vars -->
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { inject, nextTick, onBeforeUnmount, ref, toRaw, watch } from 'vue';
|
import { inject, nextTick, onBeforeUnmount, ref, toRaw, watch } from 'vue';
|
||||||
|
|
||||||
@@ -73,6 +73,7 @@ declare global {
|
|||||||
|
|
||||||
const bpmnInstances = () => (window as any)?.bpmnInstances;
|
const bpmnInstances = () => (window as any)?.bpmnInstances;
|
||||||
|
|
||||||
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
||||||
const getElementLoop = (businessObject: any): void => {
|
const getElementLoop = (businessObject: any): void => {
|
||||||
if (!businessObject.loopCharacteristics) {
|
if (!businessObject.loopCharacteristics) {
|
||||||
loopCharacteristics.value = 'Null';
|
loopCharacteristics.value = 'Null';
|
||||||
@@ -278,6 +279,8 @@ const approveRatio = ref<number>(100);
|
|||||||
const otherExtensions = ref<any[]>([]);
|
const otherExtensions = ref<any[]>([]);
|
||||||
const getElementLoopNew = (): void => {
|
const getElementLoopNew = (): void => {
|
||||||
if (props.type === 'UserTask') {
|
if (props.type === 'UserTask') {
|
||||||
|
const loopCharacteristics =
|
||||||
|
bpmnElement.value.businessObject?.loopCharacteristics;
|
||||||
const extensionElements =
|
const extensionElements =
|
||||||
bpmnElement.value.businessObject?.extensionElements ??
|
bpmnElement.value.businessObject?.extensionElements ??
|
||||||
bpmnInstances().moddle.create('bpmn:ExtensionElements', { values: [] });
|
bpmnInstances().moddle.create('bpmn:ExtensionElements', { values: [] });
|
||||||
@@ -294,10 +297,25 @@ const getElementLoopNew = (): void => {
|
|||||||
approveMethod.value = ApproveMethodType.SEQUENTIAL_APPROVE;
|
approveMethod.value = ApproveMethodType.SEQUENTIAL_APPROVE;
|
||||||
updateLoopCharacteristics();
|
updateLoopCharacteristics();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 如果是按比例会签,从现有 completionCondition 中解析比例,反推到 approveRatio
|
||||||
|
if (
|
||||||
|
approveMethod.value === ApproveMethodType.APPROVE_BY_RATIO &&
|
||||||
|
loopCharacteristics?.completionCondition?.body
|
||||||
|
) {
|
||||||
|
const body = loopCharacteristics.completionCondition.body as string;
|
||||||
|
// 形如 "${ nrOfCompletedInstances/nrOfInstances >= 0.9 }"
|
||||||
|
const match = body.match(/>=\s*(\d+(?:\.\d+)?)/);
|
||||||
|
if (match) {
|
||||||
|
const ratio = Number(match[1]);
|
||||||
|
if (!Number.isNaN(ratio)) {
|
||||||
|
approveRatio.value = ratio * 100;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const onApproveMethodChange = (): void => {
|
const onApproveMethodChange = (): void => {
|
||||||
approveRatio.value = 100;
|
|
||||||
updateLoopCharacteristics();
|
updateLoopCharacteristics();
|
||||||
};
|
};
|
||||||
const onApproveRatioChange = (): void => {
|
const onApproveRatioChange = (): void => {
|
||||||
@@ -393,31 +411,29 @@ watch(
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="panel-tab__content">
|
<div class="-mx-2 px-2">
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
v-if="type === 'UserTask'"
|
v-if="type === 'UserTask'"
|
||||||
v-model:value="approveMethod"
|
v-model:value="approveMethod"
|
||||||
@change="onApproveMethodChange"
|
@change="onApproveMethodChange"
|
||||||
>
|
>
|
||||||
<div class="flex-col">
|
<div class="flex flex-col gap-3">
|
||||||
<div v-for="(item, index) in APPROVE_METHODS" :key="index">
|
<div v-for="(item, index) in APPROVE_METHODS" :key="index">
|
||||||
<Radio :value="item.value">
|
<Radio :value="item.value">
|
||||||
{{ item.label }}
|
{{ item.label }}
|
||||||
</Radio>
|
</Radio>
|
||||||
<FormItem prop="approveRatio">
|
<InputNumber
|
||||||
<InputNumber
|
v-if="
|
||||||
v-model:value="approveRatio"
|
item.value === ApproveMethodType.APPROVE_BY_RATIO &&
|
||||||
:min="10"
|
approveMethod === ApproveMethodType.APPROVE_BY_RATIO
|
||||||
:max="100"
|
"
|
||||||
:step="10"
|
v-model:value="approveRatio"
|
||||||
size="small"
|
:min="10"
|
||||||
v-if="
|
:max="100"
|
||||||
item.value === ApproveMethodType.APPROVE_BY_RATIO &&
|
:step="10"
|
||||||
approveMethod === ApproveMethodType.APPROVE_BY_RATIO
|
size="small"
|
||||||
"
|
@change="onApproveRatioChange"
|
||||||
@change="onApproveRatioChange"
|
/>
|
||||||
/>
|
|
||||||
</FormItem>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
|
|||||||
@@ -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,19 +1,13 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { inject, nextTick, ref, watch } from 'vue';
|
import { inject, nextTick, ref, watch } from 'vue';
|
||||||
|
|
||||||
|
import { confirm, useVbenModal } from '@vben/common-ui';
|
||||||
import { IconifyIcon } from '@vben/icons';
|
import { IconifyIcon } from '@vben/icons';
|
||||||
import { cloneDeep } from '@vben/utils';
|
import { cloneDeep } from '@vben/utils';
|
||||||
|
|
||||||
import {
|
import { Button, Divider, Form, FormItem, Input } from 'ant-design-vue';
|
||||||
Button,
|
|
||||||
Divider,
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
Form,
|
|
||||||
FormItem,
|
|
||||||
Input,
|
|
||||||
Modal,
|
|
||||||
Table,
|
|
||||||
TableColumn,
|
|
||||||
} from 'ant-design-vue';
|
|
||||||
|
|
||||||
defineOptions({ name: 'ElementProperties' });
|
defineOptions({ name: 'ElementProperties' });
|
||||||
|
|
||||||
@@ -29,12 +23,10 @@ const props = defineProps({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const prefix = inject('prefix');
|
const prefix = inject('prefix');
|
||||||
// const width = inject('width')
|
|
||||||
|
|
||||||
const elementPropertyList = ref<Array<{ name: string; value: string }>>([]);
|
const elementPropertyList = ref<Array<{ name: string; value: string }>>([]);
|
||||||
const propertyForm = ref<{ name?: string; value?: string }>({});
|
const propertyForm = ref<{ name?: string; value?: string }>({});
|
||||||
const editingPropertyIndex = ref(-1);
|
const editingPropertyIndex = ref(-1);
|
||||||
const propertyFormModelVisible = ref(false);
|
|
||||||
const otherExtensionList = ref<any[]>([]);
|
const otherExtensionList = ref<any[]>([]);
|
||||||
const bpmnElementProperties = ref<any[]>([]);
|
const bpmnElementProperties = ref<any[]>([]);
|
||||||
const bpmnElementPropertyList = ref<any[]>([]);
|
const bpmnElementPropertyList = ref<any[]>([]);
|
||||||
@@ -58,57 +50,41 @@ const resetAttributesList = () => {
|
|||||||
return ex.$type === `${prefix}:Properties`;
|
return ex.$type === `${prefix}:Properties`;
|
||||||
}) ?? [];
|
}) ?? [];
|
||||||
|
|
||||||
// 保存所有的 扩展属性字段
|
|
||||||
bpmnElementPropertyList.value = bpmnElementProperties.value.flatMap(
|
bpmnElementPropertyList.value = bpmnElementProperties.value.flatMap(
|
||||||
(current: any) => current.values,
|
(current: any) => current.values,
|
||||||
);
|
);
|
||||||
// 复制 显示
|
|
||||||
elementPropertyList.value = cloneDeep(bpmnElementPropertyList.value ?? []);
|
elementPropertyList.value = cloneDeep(bpmnElementPropertyList.value ?? []);
|
||||||
};
|
};
|
||||||
|
|
||||||
const openAttributesForm = (
|
|
||||||
attr: null | { name: string; value: string },
|
|
||||||
index: number,
|
|
||||||
) => {
|
|
||||||
editingPropertyIndex.value = index;
|
|
||||||
// @ts-ignore
|
|
||||||
propertyForm.value = index === -1 ? {} : cloneDeep(attr);
|
|
||||||
propertyFormModelVisible.value = true;
|
|
||||||
nextTick(() => {
|
|
||||||
if (attributeFormRef.value) attributeFormRef.value.clearValidate();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const removeAttributes = (
|
const removeAttributes = (
|
||||||
_attr: { name: string; value: string },
|
_attr: { name: string; value: string },
|
||||||
index: number,
|
index: number,
|
||||||
) => {
|
) => {
|
||||||
Modal.confirm({
|
confirm({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '确认移除该属性吗?',
|
content: '确认移除该属性吗?',
|
||||||
okText: '确 认',
|
}).then(() => {
|
||||||
cancelText: '取 消',
|
elementPropertyList.value.splice(index, 1);
|
||||||
onOk() {
|
bpmnElementPropertyList.value.splice(index, 1);
|
||||||
elementPropertyList.value.splice(index, 1);
|
const propertiesObject = bpmnInstances().moddle.create(
|
||||||
bpmnElementPropertyList.value.splice(index, 1);
|
`${prefix}:Properties`,
|
||||||
// 新建一个属性字段的保存列表
|
{
|
||||||
const propertiesObject = bpmnInstances().moddle.create(
|
values: bpmnElementPropertyList.value,
|
||||||
`${prefix}:Properties`,
|
},
|
||||||
{
|
);
|
||||||
values: bpmnElementPropertyList.value,
|
updateElementExtensions(propertiesObject);
|
||||||
},
|
resetAttributesList();
|
||||||
);
|
|
||||||
updateElementExtensions(propertiesObject);
|
|
||||||
resetAttributesList();
|
|
||||||
},
|
|
||||||
onCancel() {
|
|
||||||
// console.info('操作取消');
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const saveAttribute = () => {
|
const saveAttribute = async () => {
|
||||||
// console.log(propertyForm.value, 'propertyForm.value');
|
try {
|
||||||
|
await attributeFormRef.value?.validate();
|
||||||
|
} catch {
|
||||||
|
// 校验未通过,直接返回
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const { name, value } = propertyForm.value;
|
const { name, value } = propertyForm.value;
|
||||||
const instances = bpmnInstances();
|
const instances = bpmnInstances();
|
||||||
if (!instances || !instances.bpmnElement) return;
|
if (!instances || !instances.bpmnElement) return;
|
||||||
@@ -136,7 +112,7 @@ const saveAttribute = () => {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
propertyFormModelVisible.value = false;
|
fieldModalApi.close();
|
||||||
resetAttributesList();
|
resetAttributesList();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -153,11 +129,61 @@ const updateElementExtensions = (properties: any) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
|
gridOptions: {
|
||||||
|
columns: [
|
||||||
|
{ type: 'seq', width: 50, title: '序号' },
|
||||||
|
{ field: 'name', title: '属性名', minWidth: 120 },
|
||||||
|
{ field: 'value', title: '属性值', minWidth: 120 },
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
width: 120,
|
||||||
|
slots: { default: 'action' },
|
||||||
|
fixed: 'right',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
border: true,
|
||||||
|
showOverflow: true,
|
||||||
|
height: 'auto',
|
||||||
|
toolbarConfig: {
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
pagerConfig: {
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const [FieldModal, fieldModalApi] = useVbenModal({
|
||||||
|
title: '属性配置',
|
||||||
|
onConfirm: saveAttribute,
|
||||||
|
});
|
||||||
|
|
||||||
|
const openAttributesForm = (
|
||||||
|
attr: null | { name: string; value: string },
|
||||||
|
index: number,
|
||||||
|
) => {
|
||||||
|
editingPropertyIndex.value = index;
|
||||||
|
propertyForm.value = index === -1 ? {} : cloneDeep(attr || {});
|
||||||
|
fieldModalApi.open();
|
||||||
|
nextTick(() => {
|
||||||
|
if (attributeFormRef.value) attributeFormRef.value.clearValidate();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
elementPropertyList,
|
||||||
|
(val) => {
|
||||||
|
gridApi.setGridOptions({ data: val });
|
||||||
|
},
|
||||||
|
{ deep: true },
|
||||||
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.id,
|
() => props.id,
|
||||||
(val) => {
|
(val) => {
|
||||||
if (val) {
|
if (val && val.length > 0) {
|
||||||
val && val.length > 0 && resetAttributesList();
|
resetAttributesList();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ immediate: true },
|
{ immediate: true },
|
||||||
@@ -165,38 +191,34 @@ watch(
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="panel-tab__content">
|
<div class="-mx-2">
|
||||||
<Table :data="elementPropertyList" size="small" bordered>
|
<Grid :data="elementPropertyList">
|
||||||
<TableColumn title="序号" width="50">
|
<template #action="{ row, rowIndex }">
|
||||||
<template #default="{ index }">
|
<Button
|
||||||
{{ index + 1 }}
|
size="small"
|
||||||
</template>
|
type="link"
|
||||||
</TableColumn>
|
@click="openAttributesForm(row, rowIndex)"
|
||||||
<TableColumn title="属性名" data-index="name" />
|
>
|
||||||
<TableColumn title="属性值" data-index="value" />
|
编辑
|
||||||
<TableColumn title="操作">
|
</Button>
|
||||||
<template #default="{ record, index }">
|
<Divider type="vertical" />
|
||||||
<Button
|
<Button
|
||||||
type="link"
|
size="small"
|
||||||
@click="openAttributesForm(record, index)"
|
type="link"
|
||||||
size="small"
|
danger
|
||||||
>
|
@click="removeAttributes(row, rowIndex)"
|
||||||
编辑
|
>
|
||||||
</Button>
|
移除
|
||||||
<Divider type="vertical" />
|
</Button>
|
||||||
<Button
|
</template>
|
||||||
type="link"
|
</Grid>
|
||||||
size="small"
|
<div class="mt-1 flex w-full items-center justify-center gap-2 px-2">
|
||||||
danger
|
<Button
|
||||||
@click="removeAttributes(record, index)"
|
class="flex flex-1 items-center justify-center"
|
||||||
>
|
type="primary"
|
||||||
移除
|
size="small"
|
||||||
</Button>
|
@click="openAttributesForm(null, -1)"
|
||||||
</template>
|
>
|
||||||
</TableColumn>
|
|
||||||
</Table>
|
|
||||||
<div class="element-drawer__button">
|
|
||||||
<Button type="primary" @click="openAttributesForm(null, -1)">
|
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<IconifyIcon icon="ep:plus" />
|
<IconifyIcon icon="ep:plus" />
|
||||||
</template>
|
</template>
|
||||||
@@ -204,24 +226,28 @@ watch(
|
|||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Modal
|
<FieldModal class="w-3/5">
|
||||||
v-model:open="propertyFormModelVisible"
|
<Form
|
||||||
title="属性配置"
|
:model="propertyForm"
|
||||||
:width="600"
|
ref="attributeFormRef"
|
||||||
:destroy-on-close="true"
|
:label-col="{ span: 5 }"
|
||||||
>
|
:wrapper-col="{ span: 17 }"
|
||||||
<Form :model="propertyForm" ref="attributeFormRef">
|
>
|
||||||
<FormItem label="属性名:" name="name">
|
<FormItem
|
||||||
|
label="属性名:"
|
||||||
|
name="name"
|
||||||
|
:rules="[{ required: true, message: '请输入属性名' }]"
|
||||||
|
>
|
||||||
<Input v-model:value="propertyForm.name" allow-clear />
|
<Input v-model:value="propertyForm.name" allow-clear />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="属性值:" name="value">
|
<FormItem
|
||||||
|
label="属性值:"
|
||||||
|
name="value"
|
||||||
|
:rules="[{ required: true, message: '请输入属性值' }]"
|
||||||
|
>
|
||||||
<Input v-model:value="propertyForm.value" allow-clear />
|
<Input v-model:value="propertyForm.value" allow-clear />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</Form>
|
</Form>
|
||||||
<template #footer>
|
</FieldModal>
|
||||||
<Button @click="propertyFormModelVisible = false">取 消</Button>
|
|
||||||
<Button type="primary" @click="saveAttribute">确 定</Button>
|
|
||||||
</template>
|
|
||||||
</Modal>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -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();
|
||||||
@@ -50,7 +50,6 @@ const generateStandardId = (type: string): string => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const initDataList = () => {
|
const initDataList = () => {
|
||||||
// console.log(window, 'window');
|
|
||||||
rootElements.value = bpmnInstances().modeler.getDefinitions().rootElements;
|
rootElements.value = bpmnInstances().modeler.getDefinitions().rootElements;
|
||||||
messageIdMap.value = {};
|
messageIdMap.value = {};
|
||||||
signalIdMap.value = {};
|
signalIdMap.value = {};
|
||||||
@@ -75,17 +74,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,37 +141,29 @@ const addNewObject = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dialogVisible.value = false;
|
modelModalApi.close();
|
||||||
// 触发建模器更新以保存更改
|
// 触发建模器更新以保存更改。
|
||||||
saveChanges();
|
saveChanges();
|
||||||
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('移除成功');
|
||||||
saveChanges();
|
|
||||||
// 刷新列表
|
|
||||||
initDataList();
|
|
||||||
message.success('移除成功');
|
|
||||||
},
|
|
||||||
onCancel() {
|
|
||||||
// console.info('操作取消');
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -202,114 +200,178 @@ const saveChanges = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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>
|
||||||
|
|||||||
@@ -1,96 +0,0 @@
|
|||||||
<!-- 表达式选择 -->
|
|
||||||
<script setup lang="ts">
|
|
||||||
import type { BpmProcessExpressionApi } from '#/api/bpm/processExpression';
|
|
||||||
|
|
||||||
import { reactive, ref } from 'vue';
|
|
||||||
|
|
||||||
import { ContentWrap } from '@vben/common-ui';
|
|
||||||
import { CommonStatusEnum } from '@vben/constants';
|
|
||||||
|
|
||||||
import { Button, Modal, Pagination, Table, TableColumn } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { getProcessExpressionPage } from '#/api/bpm/processExpression';
|
|
||||||
|
|
||||||
/** BPM 流程 表单 */
|
|
||||||
defineOptions({ name: 'ProcessExpressionDialog' });
|
|
||||||
|
|
||||||
/** 提交表单 */
|
|
||||||
const emit = defineEmits(['select']);
|
|
||||||
const dialogVisible = ref(false); // 弹窗的是否展示
|
|
||||||
const loading = ref(true); // 列表的加载中
|
|
||||||
const list = ref<BpmProcessExpressionApi.ProcessExpression[]>([]); // 列表的数据
|
|
||||||
const total = ref(0); // 列表的总页数
|
|
||||||
const queryParams = reactive({
|
|
||||||
pageNo: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
type: '',
|
|
||||||
status: CommonStatusEnum.ENABLE,
|
|
||||||
});
|
|
||||||
|
|
||||||
/** 打开弹窗 */
|
|
||||||
const open = (type: string) => {
|
|
||||||
queryParams.pageNo = 1;
|
|
||||||
queryParams.type = type;
|
|
||||||
getList();
|
|
||||||
dialogVisible.value = true;
|
|
||||||
};
|
|
||||||
defineExpose({ open }); // 提供 open 方法,用于打开弹窗
|
|
||||||
|
|
||||||
/** 查询列表 */
|
|
||||||
const getList = async () => {
|
|
||||||
loading.value = true;
|
|
||||||
try {
|
|
||||||
const data = await getProcessExpressionPage(queryParams);
|
|
||||||
list.value = data.list;
|
|
||||||
total.value = data.total;
|
|
||||||
} finally {
|
|
||||||
loading.value = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 定义 select 事件,用于操作成功后的回调
|
|
||||||
const select = async (row: BpmProcessExpressionApi.ProcessExpression) => {
|
|
||||||
dialogVisible.value = false;
|
|
||||||
// 发送操作成功的事件
|
|
||||||
emit('select', row);
|
|
||||||
};
|
|
||||||
|
|
||||||
// const handleCancel = () => {
|
|
||||||
// dialogVisible.value = false;
|
|
||||||
// };
|
|
||||||
</script>
|
|
||||||
<template>
|
|
||||||
<Modal
|
|
||||||
title="请选择表达式"
|
|
||||||
v-model:open="dialogVisible"
|
|
||||||
width="1024px"
|
|
||||||
:footer="null"
|
|
||||||
>
|
|
||||||
<ContentWrap>
|
|
||||||
<Table
|
|
||||||
:loading="loading"
|
|
||||||
:data-source="list"
|
|
||||||
:pagination="false"
|
|
||||||
:scroll="{ x: 'max-content' }"
|
|
||||||
>
|
|
||||||
<TableColumn title="名字" align="center" data-index="name" />
|
|
||||||
<TableColumn title="表达式" align="center" data-index="expression" />
|
|
||||||
<TableColumn title="操作" align="center">
|
|
||||||
<template #default="{ record }">
|
|
||||||
<Button type="primary" @click="select(record)"> 选择 </Button>
|
|
||||||
</template>
|
|
||||||
</TableColumn>
|
|
||||||
</Table>
|
|
||||||
<!-- 分页 -->
|
|
||||||
<div class="mt-4 flex justify-end">
|
|
||||||
<Pagination
|
|
||||||
:total="total"
|
|
||||||
v-model:current="queryParams.pageNo"
|
|
||||||
v-model:page-size="queryParams.pageSize"
|
|
||||||
show-size-changer
|
|
||||||
@change="getList"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</ContentWrap>
|
|
||||||
</Modal>
|
|
||||||
</template>
|
|
||||||
@@ -17,6 +17,7 @@ import {
|
|||||||
watch,
|
watch,
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
|
|
||||||
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
import { SelectOutlined } from '@vben/icons';
|
import { SelectOutlined } from '@vben/icons';
|
||||||
import { handleTree } from '@vben/utils';
|
import { handleTree } from '@vben/utils';
|
||||||
|
|
||||||
@@ -42,8 +43,7 @@ import {
|
|||||||
MULTI_LEVEL_DEPT,
|
MULTI_LEVEL_DEPT,
|
||||||
} from '#/views/bpm/components/simple-process-design/consts';
|
} from '#/views/bpm/components/simple-process-design/consts';
|
||||||
import { useFormFieldsPermission } from '#/views/bpm/components/simple-process-design/helpers';
|
import { useFormFieldsPermission } from '#/views/bpm/components/simple-process-design/helpers';
|
||||||
|
import ProcessExpressionSelectModal from '#/views/bpm/processExpression/components/process-expression-select-modal.vue';
|
||||||
import ProcessExpressionDialog from './ProcessExpressionDialog.vue';
|
|
||||||
|
|
||||||
defineOptions({ name: 'UserTask' });
|
defineOptions({ name: 'UserTask' });
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -292,9 +292,13 @@ const updateSkipExpression = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 打开监听器弹窗
|
// 打开监听器弹窗
|
||||||
const processExpressionDialogRef = ref<any>();
|
const [ProcessExpressionSelectModalComp, ProcessExpressionSelectModalApi] =
|
||||||
|
useVbenModal({
|
||||||
|
connectedComponent: ProcessExpressionSelectModal,
|
||||||
|
destroyOnClose: true,
|
||||||
|
});
|
||||||
const openProcessExpressionDialog = async () => {
|
const openProcessExpressionDialog = async () => {
|
||||||
processExpressionDialogRef.value.open();
|
ProcessExpressionSelectModalApi.open();
|
||||||
};
|
};
|
||||||
const selectProcessExpression = (
|
const selectProcessExpression = (
|
||||||
expression: BpmProcessExpressionApi.ProcessExpression,
|
expression: BpmProcessExpressionApi.ProcessExpression,
|
||||||
@@ -344,7 +348,7 @@ onBeforeUnmount(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Form>
|
<Form :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
|
||||||
<FormItem label="规则类型" name="candidateStrategy">
|
<FormItem label="规则类型" name="candidateStrategy">
|
||||||
<Select
|
<Select
|
||||||
v-model:value="userTaskForm.candidateStrategy"
|
v-model:value="userTaskForm.candidateStrategy"
|
||||||
@@ -544,19 +548,19 @@ onBeforeUnmount(() => {
|
|||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
@change="updateElementTask"
|
@change="updateElementTask"
|
||||||
/>
|
/>
|
||||||
<Button
|
<div class="mt-2 flex w-full items-center justify-center">
|
||||||
class="!w-1/1 mt-5px"
|
<Button
|
||||||
type="primary"
|
class="flex flex-1 items-center justify-center"
|
||||||
:icon="h(SelectOutlined)"
|
type="primary"
|
||||||
@click="openProcessExpressionDialog"
|
size="small"
|
||||||
>
|
:icon="h(SelectOutlined)"
|
||||||
选择表达式
|
@click="openProcessExpressionDialog"
|
||||||
</Button>
|
>
|
||||||
|
选择表达式
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
<!-- 选择弹窗 -->
|
<!-- 选择弹窗 -->
|
||||||
<ProcessExpressionDialog
|
<ProcessExpressionSelectModalComp @select="selectProcessExpression" />
|
||||||
ref="processExpressionDialogRef"
|
|
||||||
@select="selectProcessExpression"
|
|
||||||
/>
|
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<FormItem label="跳过表达式" name="skipExpression">
|
<FormItem label="跳过表达式" name="skipExpression">
|
||||||
|
|||||||
@@ -25,8 +25,9 @@ import {
|
|||||||
Tooltip,
|
Tooltip,
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
|
|
||||||
import { DeptSelectModal, UserSelectModal } from '#/components/select-modal';
|
|
||||||
import { ImageUpload } from '#/components/upload';
|
import { ImageUpload } from '#/components/upload';
|
||||||
|
import { DeptSelectModal } from '#/views/system/dept/components';
|
||||||
|
import { UserSelectModal } from '#/views/system/user/components';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
categoryList: {
|
categoryList: {
|
||||||
|
|||||||
@@ -0,0 +1,91 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import type { VxeGridPropTypes } from '#/adapter/vxe-table';
|
||||||
|
import type { BpmProcessExpressionApi } from '#/api/bpm/processExpression';
|
||||||
|
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
|
import { CommonStatusEnum } from '@vben/constants';
|
||||||
|
|
||||||
|
import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
|
import { getProcessExpressionPage } from '#/api/bpm/processExpression';
|
||||||
|
|
||||||
|
defineOptions({ name: 'ProcessExpressionSelectModal' });
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
select: [expression: BpmProcessExpressionApi.ProcessExpression];
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 查询参数
|
||||||
|
const queryParams = ref({
|
||||||
|
status: CommonStatusEnum.ENABLE,
|
||||||
|
});
|
||||||
|
|
||||||
|
// 配置 VxeGrid
|
||||||
|
const [Grid] = useVbenVxeGrid({
|
||||||
|
gridOptions: {
|
||||||
|
columns: [
|
||||||
|
{ field: 'name', title: '名字', minWidth: 160 },
|
||||||
|
{ field: 'expression', title: '表达式', minWidth: 260 },
|
||||||
|
{
|
||||||
|
field: 'action',
|
||||||
|
title: '操作',
|
||||||
|
width: 120,
|
||||||
|
slots: { default: 'action' },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
showOverflow: true,
|
||||||
|
minHeight: 300,
|
||||||
|
proxyConfig: {
|
||||||
|
ajax: {
|
||||||
|
// 查询表达式列表
|
||||||
|
query: async ({ page }) => {
|
||||||
|
return await getProcessExpressionPage({
|
||||||
|
pageNo: page.currentPage,
|
||||||
|
pageSize: page.pageSize,
|
||||||
|
status: queryParams.value.status,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
} as VxeGridPropTypes.ProxyConfig,
|
||||||
|
rowConfig: {
|
||||||
|
keyField: 'id',
|
||||||
|
isHover: true,
|
||||||
|
},
|
||||||
|
toolbarConfig: {
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// 配置 Modal
|
||||||
|
const [Modal, modalApi] = useVbenModal({
|
||||||
|
showConfirmButton: false,
|
||||||
|
destroyOnClose: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
// 选择表达式
|
||||||
|
function handleSelect(row: BpmProcessExpressionApi.ProcessExpression) {
|
||||||
|
emit('select', row);
|
||||||
|
modalApi.close();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Modal class="w-4/5" title="请选择表达式">
|
||||||
|
<Grid>
|
||||||
|
<template #action="{ row }">
|
||||||
|
<TableAction
|
||||||
|
:actions="[
|
||||||
|
{
|
||||||
|
label: '选择',
|
||||||
|
type: 'link',
|
||||||
|
icon: 'lucide:pointer',
|
||||||
|
onClick: handleSelect.bind(null, row),
|
||||||
|
},
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</Grid>
|
||||||
|
</Modal>
|
||||||
|
</template>
|
||||||
@@ -16,7 +16,7 @@ import { formatDateTime, isEmpty } from '@vben/utils';
|
|||||||
|
|
||||||
import { Avatar, Button, Image, Timeline, Tooltip } from 'ant-design-vue';
|
import { Avatar, Button, Image, Timeline, Tooltip } from 'ant-design-vue';
|
||||||
|
|
||||||
import { UserSelectModal } from '#/components/select-modal';
|
import { UserSelectModal } from '#/views/system/user/components';
|
||||||
|
|
||||||
defineOptions({ name: 'BpmProcessInstanceTimeline' });
|
defineOptions({ name: 'BpmProcessInstanceTimeline' });
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
|
|
||||||
|
import { DICT_TYPE } from '@vben/constants';
|
||||||
|
|
||||||
|
/** 选择监听器弹窗的列表字段 */
|
||||||
|
export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||||
|
return [
|
||||||
|
{ field: 'name', title: '名字', minWidth: 120 },
|
||||||
|
{
|
||||||
|
field: 'type',
|
||||||
|
title: '类型',
|
||||||
|
minWidth: 200,
|
||||||
|
cellRender: {
|
||||||
|
name: 'CellDict',
|
||||||
|
props: { type: DICT_TYPE.BPM_PROCESS_LISTENER_TYPE },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ field: 'event', title: '事件', minWidth: 200 },
|
||||||
|
{
|
||||||
|
field: 'valueType',
|
||||||
|
title: '值类型',
|
||||||
|
minWidth: 200,
|
||||||
|
cellRender: {
|
||||||
|
name: 'CellDict',
|
||||||
|
props: { type: DICT_TYPE.BPM_PROCESS_LISTENER_VALUE_TYPE },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ field: 'value', title: '值', minWidth: 150 },
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
width: 100,
|
||||||
|
slots: { default: 'action' },
|
||||||
|
fixed: 'right',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import type { VxeGridPropTypes } from '#/adapter/vxe-table';
|
||||||
|
import type { BpmProcessListenerApi } from '#/api/bpm/processListener';
|
||||||
|
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
|
import { CommonStatusEnum } from '@vben/constants';
|
||||||
|
|
||||||
|
import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
|
import { getProcessListenerPage } from '#/api/bpm/processListener';
|
||||||
|
|
||||||
|
import { useGridColumns } from './data';
|
||||||
|
|
||||||
|
defineOptions({ name: 'ProcessListenerSelectModal' });
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
select: [listener: BpmProcessListenerApi.ProcessListener];
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 查询参数
|
||||||
|
const queryParams = ref({
|
||||||
|
type: '',
|
||||||
|
status: CommonStatusEnum.ENABLE,
|
||||||
|
});
|
||||||
|
|
||||||
|
// 配置 VxeGrid
|
||||||
|
const [Grid] = useVbenVxeGrid({
|
||||||
|
gridOptions: {
|
||||||
|
columns: useGridColumns(),
|
||||||
|
showOverflow: true,
|
||||||
|
minHeight: 300,
|
||||||
|
proxyConfig: {
|
||||||
|
ajax: {
|
||||||
|
query: async ({ page }) => {
|
||||||
|
return await getProcessListenerPage({
|
||||||
|
pageNo: page.currentPage,
|
||||||
|
pageSize: page.pageSize,
|
||||||
|
type: queryParams.value.type,
|
||||||
|
status: queryParams.value.status,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
} as VxeGridPropTypes.ProxyConfig,
|
||||||
|
rowConfig: {
|
||||||
|
keyField: 'id',
|
||||||
|
isHover: true,
|
||||||
|
},
|
||||||
|
toolbarConfig: {
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// 配置 Modal
|
||||||
|
const [Modal, modalApi] = useVbenModal({
|
||||||
|
showConfirmButton: false,
|
||||||
|
onOpenChange: async (isOpen: boolean) => {
|
||||||
|
if (!isOpen) {
|
||||||
|
queryParams.value.type = '';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const data = modalApi.getData<{ type: string }>();
|
||||||
|
if (data?.type) {
|
||||||
|
queryParams.value.type = data.type;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
destroyOnClose: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
// 选择监听器
|
||||||
|
function handleSelect(row: BpmProcessListenerApi.ProcessListener) {
|
||||||
|
emit('select', row);
|
||||||
|
modalApi.close();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Modal class="w-4/5" title="请选择监听器">
|
||||||
|
<Grid>
|
||||||
|
<template #action="{ row }">
|
||||||
|
<TableAction
|
||||||
|
:actions="[
|
||||||
|
{
|
||||||
|
label: '选择',
|
||||||
|
type: 'link',
|
||||||
|
icon: 'lucide:pointer',
|
||||||
|
onClick: handleSelect.bind(null, row),
|
||||||
|
},
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</Grid>
|
||||||
|
</Modal>
|
||||||
|
</template>
|
||||||
@@ -1,14 +1,12 @@
|
|||||||
import type { VbenFormSchema } from '#/adapter/form';
|
import type { VbenFormSchema } from '#/adapter/form';
|
||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
|
|
||||||
import { DICT_TYPE } from '@vben/constants';
|
import { DeviceTypeEnum, DICT_TYPE } from '@vben/constants';
|
||||||
import { getDictOptions } from '@vben/hooks';
|
import { getDictOptions } from '@vben/hooks';
|
||||||
|
|
||||||
import { z } from '#/adapter/form';
|
import { z } from '#/adapter/form';
|
||||||
import { getSimpleDeviceList } from '#/api/iot/device/device';
|
import { getSimpleDeviceList } from '#/api/iot/device/device';
|
||||||
import { getSimpleDeviceGroupList } from '#/api/iot/device/group';
|
import { getSimpleDeviceGroupList } from '#/api/iot/device/group';
|
||||||
import { DeviceTypeEnum } from '@vben/constants';
|
|
||||||
|
|
||||||
import { getSimpleProductList } from '#/api/iot/product/product';
|
import { getSimpleProductList } from '#/api/iot/product/product';
|
||||||
|
|
||||||
/** 新增/修改的表单 */
|
/** 新增/修改的表单 */
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import type { ThingModelData } from '#/api/iot/thingmodel';
|
|||||||
import { computed, ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
|
|
||||||
import { ContentWrap } from '@vben/common-ui';
|
import { ContentWrap } from '@vben/common-ui';
|
||||||
|
import { DeviceStateEnum } from '@vben/constants';
|
||||||
import { IconifyIcon } from '@vben/icons';
|
import { IconifyIcon } from '@vben/icons';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -21,15 +22,13 @@ import {
|
|||||||
Textarea,
|
Textarea,
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
|
|
||||||
import { DeviceStateEnum } from '@vben/constants';
|
|
||||||
|
|
||||||
import { sendDeviceMessage } from '#/api/iot/device/device';
|
import { sendDeviceMessage } from '#/api/iot/device/device';
|
||||||
import DataDefinition from '../../../../../thingmodel/modules/components/data-definition.vue';
|
|
||||||
import {
|
import {
|
||||||
IotDeviceMessageMethodEnum,
|
IotDeviceMessageMethodEnum,
|
||||||
IoTThingModelTypeEnum,
|
IoTThingModelTypeEnum,
|
||||||
} from '#/views/iot/utils/constants';
|
} from '#/views/iot/utils/constants';
|
||||||
|
|
||||||
|
import DataDefinition from '../../../../../thingmodel/modules/components/data-definition.vue';
|
||||||
import DeviceDetailsMessage from './message.vue';
|
import DeviceDetailsMessage from './message.vue';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
|||||||
@@ -529,7 +529,10 @@ defineExpose({ open }); // 提供 open 方法,用于打开弹窗
|
|||||||
.chart-container,
|
.chart-container,
|
||||||
.table-container {
|
.table-container {
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
background-color: hsl(var(--card)); // TODO @haohao:看看这个能不能 fix 下~ idea 爆红了;
|
background-color: hsl(
|
||||||
|
var(--card)
|
||||||
|
); // TODO @haohao:看看这个能不能 fix 下~ idea 爆红了;
|
||||||
|
|
||||||
border: 1px solid hsl(var(--border) / 60%);
|
border: 1px solid hsl(var(--border) / 60%);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { IotProductApi } from '#/api/iot/product/product';
|
import type { IotProductApi } from '#/api/iot/product/product';
|
||||||
|
|
||||||
import { DICT_TYPE } from '@vben/constants';
|
import { DeviceTypeEnum, DICT_TYPE } from '@vben/constants';
|
||||||
|
|
||||||
import { Card, Descriptions } from 'ant-design-vue';
|
import { Card, Descriptions } from 'ant-design-vue';
|
||||||
|
|
||||||
import { DeviceTypeEnum } from '@vben/constants';
|
|
||||||
import { DictTag } from '#/components/dict-tag';
|
import { DictTag } from '#/components/dict-tag';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { nextTick, onMounted, watch } from 'vue';
|
|||||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
|
|
||||||
import { useImageGridColumns } from './data';
|
import { useImageGridColumns } from './data';
|
||||||
import {$t} from '@vben/locales';
|
import { $t } from '@vben/locales';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
list: MpMaterialApi.Material[];
|
list: MpMaterialApi.Material[];
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// TODO @芋艿:是否有更好的组织形式?!
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { DataNode } from 'ant-design-vue/es/tree';
|
import type { DataNode } from 'ant-design-vue/es/tree';
|
||||||
|
|
||||||
@@ -1,2 +1 @@
|
|||||||
export { default as DeptSelectModal } from './dept-select-modal.vue';
|
export { default as DeptSelectModal } from './dept-select-modal.vue';
|
||||||
export { default as UserSelectModal } from './user-select-modal.vue';
|
|
||||||
1
apps/web-antd/src/views/system/user/components/index.ts
Normal file
1
apps/web-antd/src/views/system/user/components/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export { default as UserSelectModal } from './user-select-modal.vue';
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
// TODO @芋艿:是否有更好的组织形式?!
|
|
||||||
import type { Key } from 'ant-design-vue/es/table/interface';
|
import type { Key } from 'ant-design-vue/es/table/interface';
|
||||||
|
|
||||||
import type { SystemDeptApi } from '#/api/system/dept';
|
import type { SystemDeptApi } from '#/api/system/dept';
|
||||||
Reference in New Issue
Block a user