update 优化面板工具
This commit is contained in:
parent
d27bc8be46
commit
aadc43d5dc
@ -9,6 +9,9 @@
|
|||||||
import { NodeName } from './assets/lang/zh';
|
import { NodeName } from './assets/lang/zh';
|
||||||
import TaskPanel from './panel/TaskPanel.vue';
|
import TaskPanel from './panel/TaskPanel.vue';
|
||||||
import ProcessPanel from './panel/ProcessPanel.vue';
|
import ProcessPanel from './panel/ProcessPanel.vue';
|
||||||
|
import StartEndPanel from './panel/StartEndPanel.vue';
|
||||||
|
import GatewayPanel from './panel/GatewayPanel.vue';
|
||||||
|
import SequenceFlowPanel from './panel/SequenceFlowPanel.vue';
|
||||||
interface propsType {
|
interface propsType {
|
||||||
users: Array<any>;
|
users: Array<any>;
|
||||||
groups: Array<any>;
|
groups: Array<any>;
|
||||||
@ -49,10 +52,10 @@ const processType = ['bpmn:Process'];
|
|||||||
const component = computed(() => {
|
const component = computed(() => {
|
||||||
if (!element.value) return null;
|
if (!element.value) return null;
|
||||||
const type = element.value.type;
|
const type = element.value.type;
|
||||||
if (startEndType.includes(type)) return 'startEndPanel';
|
if (startEndType.includes(type)) return StartEndPanel;
|
||||||
if (taskType.includes(type)) return TaskPanel;
|
if (taskType.includes(type)) return TaskPanel;
|
||||||
if (sequenceType.includes(type)) return 'sequenceFlowPanel';
|
if (sequenceType.includes(type)) return SequenceFlowPanel;
|
||||||
if (gatewayType.includes(type)) return 'gatewayPanel';
|
if (gatewayType.includes(type)) return GatewayPanel;
|
||||||
if (processType.includes(type)) return ProcessPanel;
|
if (processType.includes(type)) return ProcessPanel;
|
||||||
return console.error('no ' + type + ' type panel');
|
return console.error('no ' + type + ' type panel');
|
||||||
});
|
});
|
||||||
|
@ -36,9 +36,7 @@ export default (ops: Options) => {
|
|||||||
const documentationElement = modeler.get('moddle').create('bpmn:Documentation', { text: newVal });
|
const documentationElement = modeler.get('moddle').create('bpmn:Documentation', { text: newVal });
|
||||||
updateProperties({ documentation: [documentationElement] });
|
updateProperties({ documentation: [documentationElement] });
|
||||||
} else {
|
} else {
|
||||||
const elements = element.businessObject;
|
updateProperties({ documentation: null });
|
||||||
delete elements.documentation;
|
|
||||||
updateProperties({ process: elements });
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -50,9 +50,11 @@
|
|||||||
<el-main style="padding: 0">
|
<el-main style="padding: 0">
|
||||||
<div ref="canvas" class="canvas" />
|
<div ref="canvas" class="canvas" />
|
||||||
</el-main>
|
</el-main>
|
||||||
|
<el-scrollbar height="650px">
|
||||||
<el-aside style="width: 400px; min-height: 650px; background-color: #f0f2f5">
|
<el-aside style="width: 400px; min-height: 650px; background-color: #f0f2f5">
|
||||||
<PropertyPanel v-if="bpmnModeler" :modeler="bpmnModeler" :users="users" :groups="groups" :categorys="categorys" />
|
<PropertyPanel v-if="bpmnModeler" :modeler="bpmnModeler" :users="users" :groups="groups" :categorys="categorys" />
|
||||||
</el-aside>
|
</el-aside>
|
||||||
|
</el-scrollbar>
|
||||||
</el-container>
|
</el-container>
|
||||||
</el-container>
|
</el-container>
|
||||||
</div>
|
</div>
|
||||||
|
47
src/components/BpmnDesign/panel/GatewayPanel.vue
Normal file
47
src/components/BpmnDesign/panel/GatewayPanel.vue
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="80px">
|
||||||
|
<el-form-item prop="id" label="节点 ID">
|
||||||
|
<el-input v-model="formData.id" @change="idChange"> </el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item prop="name" label="节点名称">
|
||||||
|
<el-input v-model="formData.name" @change="nameChange"> </el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item prop="documentation" label="节点描述">
|
||||||
|
<el-input v-model="formData.documentation" @change="documentationChange"> </el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="执行监听器" style="margin-bottom: 0"> </el-form-item>
|
||||||
|
<ExecutionListener :modeler="modeler" :element="element"></ExecutionListener>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { GatewayPanel } from 'bpmnDesign';
|
||||||
|
import useParseElement from '@/components/BpmnDesign/hooks/useParseElement';
|
||||||
|
import usePanel from '@/components/BpmnDesign/hooks/usePanel';
|
||||||
|
|
||||||
|
interface PropType {
|
||||||
|
modeler: any;
|
||||||
|
element: any;
|
||||||
|
categorys?: any[];
|
||||||
|
}
|
||||||
|
const props = withDefaults(defineProps<PropType>(), {
|
||||||
|
categorys: () => []
|
||||||
|
});
|
||||||
|
const { documentationChange, nameChange, idChange } = usePanel({
|
||||||
|
modeler: props.modeler,
|
||||||
|
element: toRaw(props.element)
|
||||||
|
});
|
||||||
|
const { parse, formData } = useParseElement<GatewayPanel>({
|
||||||
|
modeler: props.modeler,
|
||||||
|
element: toRaw(props.element)
|
||||||
|
});
|
||||||
|
|
||||||
|
const formRules = ref<ElFormRules>({
|
||||||
|
processCategory: [{ required: true, message: '请选择', trigger: 'blur' }],
|
||||||
|
id: [{ required: true, message: '请输入', trigger: 'blur' }],
|
||||||
|
name: [{ required: true, message: '请输入', trigger: 'blur' }]
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
66
src/components/BpmnDesign/panel/SequenceFlowPanel.vue
Normal file
66
src/components/BpmnDesign/panel/SequenceFlowPanel.vue
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="80px">
|
||||||
|
<el-form-item prop="id" label="节点 ID">
|
||||||
|
<el-input v-model="formData.id" @change="idChange"> </el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item prop="name" label="节点名称">
|
||||||
|
<el-input v-model="formData.name" @change="nameChange"> </el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item prop="documentation" label="节点描述">
|
||||||
|
<el-input v-model="formData.documentation" @change="documentationChange"> </el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item prop="conditionExpression" label="跳过条件">
|
||||||
|
<el-input v-model="formData.conditionExpression" @change="conditionExpressionChange"> </el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item prop="skipExpression" label="跳过表达式">
|
||||||
|
<el-input v-model="formData.skipExpression" @change="skipExpressionChange"> </el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="执行监听器" style="margin-bottom: 0"> </el-form-item>
|
||||||
|
<ExecutionListener :modeler="modeler" :element="element"></ExecutionListener>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { SequenceFlowPanel } from 'bpmnDesign';
|
||||||
|
import useParseElement from '@/components/BpmnDesign/hooks/useParseElement';
|
||||||
|
import usePanel from '@/components/BpmnDesign/hooks/usePanel';
|
||||||
|
|
||||||
|
interface PropType {
|
||||||
|
modeler: any;
|
||||||
|
element: any;
|
||||||
|
categorys?: any[];
|
||||||
|
}
|
||||||
|
const props = withDefaults(defineProps<PropType>(), {
|
||||||
|
categorys: () => []
|
||||||
|
});
|
||||||
|
const { documentationChange, nameChange, idChange, updateProperties } = usePanel({
|
||||||
|
modeler: props.modeler,
|
||||||
|
element: toRaw(props.element)
|
||||||
|
});
|
||||||
|
const { parse, formData } = useParseElement<SequenceFlowPanel>({
|
||||||
|
modeler: props.modeler,
|
||||||
|
element: toRaw(props.element)
|
||||||
|
});
|
||||||
|
|
||||||
|
const formRules = ref<ElFormRules>({
|
||||||
|
processCategory: [{ required: true, message: '请选择', trigger: 'blur' }],
|
||||||
|
id: [{ required: true, message: '请输入', trigger: 'blur' }],
|
||||||
|
name: [{ required: true, message: '请输入', trigger: 'blur' }]
|
||||||
|
});
|
||||||
|
|
||||||
|
const conditionExpressionChange = (val: string) => {
|
||||||
|
if (val) {
|
||||||
|
const newCondition = props.modeler.get('moddle').create('bpmn:FormalExpression', { body: val });
|
||||||
|
updateProperties({ conditionExpression: newCondition });
|
||||||
|
} else {
|
||||||
|
updateProperties({ conditionExpression: null });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const skipExpressionChange = (val: string) => {
|
||||||
|
updateProperties({ 'flowable:skipExpression': val });
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
47
src/components/BpmnDesign/panel/StartEndPanel.vue
Normal file
47
src/components/BpmnDesign/panel/StartEndPanel.vue
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="80px">
|
||||||
|
<el-form-item prop="id" label="节点 ID">
|
||||||
|
<el-input v-model="formData.id" @change="idChange"> </el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item prop="name" label="节点名称">
|
||||||
|
<el-input v-model="formData.name" @change="nameChange"> </el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item prop="documentation" label="节点描述">
|
||||||
|
<el-input v-model="formData.documentation" @change="documentationChange"> </el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="执行监听器" style="margin-bottom: 0"> </el-form-item>
|
||||||
|
<ExecutionListener :modeler="modeler" :element="element"></ExecutionListener>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { StartEndPanel } from 'bpmnDesign';
|
||||||
|
import useParseElement from '@/components/BpmnDesign/hooks/useParseElement';
|
||||||
|
import usePanel from '@/components/BpmnDesign/hooks/usePanel';
|
||||||
|
|
||||||
|
interface PropType {
|
||||||
|
modeler: any;
|
||||||
|
element: any;
|
||||||
|
categorys?: any[];
|
||||||
|
}
|
||||||
|
const props = withDefaults(defineProps<PropType>(), {
|
||||||
|
categorys: () => []
|
||||||
|
});
|
||||||
|
const { documentationChange, nameChange, idChange } = usePanel({
|
||||||
|
modeler: props.modeler,
|
||||||
|
element: toRaw(props.element)
|
||||||
|
});
|
||||||
|
const { parse, formData } = useParseElement<StartEndPanel>({
|
||||||
|
modeler: props.modeler,
|
||||||
|
element: toRaw(props.element)
|
||||||
|
});
|
||||||
|
|
||||||
|
const formRules = ref<ElFormRules>({
|
||||||
|
processCategory: [{ required: true, message: '请选择', trigger: 'blur' }],
|
||||||
|
id: [{ required: true, message: '请输入', trigger: 'blur' }],
|
||||||
|
name: [{ required: true, message: '请输入', trigger: 'blur' }]
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-form ref="formRef" v-model="formData" label-width="80px">
|
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="80px">
|
||||||
<el-form-item prop="id" label="节点 ID">
|
<el-form-item prop="id" label="节点 ID">
|
||||||
<el-input v-model="formData.id" @change="idChange"> </el-input>
|
<el-input v-model="formData.id" @change="idChange"> </el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -41,6 +41,12 @@ const { parse, formData } = useParseElement<TaskPanel>({
|
|||||||
modeler: props.modeler,
|
modeler: props.modeler,
|
||||||
element: toRaw(props.element)
|
element: toRaw(props.element)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const formRules = ref<ElFormRules>({
|
||||||
|
processCategory: [{ required: true, message: '请选择', trigger: 'blur' }],
|
||||||
|
id: [{ required: true, message: '请输入', trigger: 'blur' }],
|
||||||
|
name: [{ required: true, message: '请输入', trigger: 'blur' }]
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped></style>
|
<style lang="scss" scoped></style>
|
||||||
|
@ -286,7 +286,6 @@ const initTableData = () => {
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
initTableData();
|
initTableData();
|
||||||
console.log(2222);
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
20
src/types/bpmn.d.ts
vendored
20
src/types/bpmn.d.ts
vendored
@ -20,21 +20,27 @@ declare module 'bpmnDesign' {
|
|||||||
params: ParamVO[];
|
params: ParamVO[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProcessPanel {
|
interface BasePanel {
|
||||||
processCategory: string;
|
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
documentation?: string;
|
documentation?: string;
|
||||||
}
|
}
|
||||||
|
export interface ProcessPanel extends BasePanel {
|
||||||
export interface TaskPanel {
|
processCategory: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TaskPanel extends BasePanel {
|
||||||
processCategory: string;
|
processCategory: string;
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
documentation: string;
|
|
||||||
userType: string;
|
userType: string;
|
||||||
assignee: string;
|
assignee: string;
|
||||||
candidateUsers: string;
|
candidateUsers: string;
|
||||||
candidateGroups: string;
|
candidateGroups: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface StartEndPanel extends BasePanel {}
|
||||||
|
export interface GatewayPanel extends BasePanel {}
|
||||||
|
export interface SequenceFlowPanel extends BasePanel {
|
||||||
|
conditionExpression: string;
|
||||||
|
skipExpression: string;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user