Commit 167692b04dbecbac5b2ebfed1ea60c510358eade

Authored by YunaiV
1 parent c84a9dd6

引入 bpmnProcessDesigner 组件

Showing 60 changed files with 8943 additions and 2 deletions
yudao-admin-ui/package.json
@@ -59,7 +59,10 @@ @@ -59,7 +59,10 @@
59 "vue-cropper": "0.5.5", 59 "vue-cropper": "0.5.5",
60 "vue-router": "3.4.9", 60 "vue-router": "3.4.9",
61 "vuedraggable": "2.24.3", 61 "vuedraggable": "2.24.3",
62 - "vuex": "3.6.0" 62 + "vuex": "3.6.0",
  63 + "bpmn-js-token-simulation": "^0.10.0",
  64 + "min-dash": "^3.5.2",
  65 + "xml-js": "^1.6.11"
63 }, 66 },
64 "devDependencies": { 67 "devDependencies": {
65 "@vue/cli-plugin-babel": "4.4.6", 68 "@vue/cli-plugin-babel": "4.4.6",
@@ -77,7 +80,19 @@ @@ -77,7 +80,19 @@
77 "script-ext-html-webpack-plugin": "2.1.5", 80 "script-ext-html-webpack-plugin": "2.1.5",
78 "svg-sprite-loader": "5.1.1", 81 "svg-sprite-loader": "5.1.1",
79 "vue-template-compiler": "2.6.12", 82 "vue-template-compiler": "2.6.12",
80 - "vue2-ace-editor": "^0.0.15" 83 + "vue2-ace-editor": "^0.0.15",
  84 + "@vue/compiler-sfc": "^3.0.1",
  85 + "@vue/eslint-config-prettier": "^5.0.0",
  86 + "axios": "^0.21.1",
  87 + "bpmn-js": "^7.4.0",
  88 + "bpmn-js-properties-panel": "^0.37.2",
  89 + "camunda-bpmn-moddle": "^4.4.1",
  90 + "compression-webpack-plugin": "^6.1.1",
  91 + "element-ui": "^2.13.2",
  92 + "eslint-plugin-prettier": "^3.1.0",
  93 + "fs-extra": "^8.1.0",
  94 + "terser-webpack-plugin": "^4.2.3",
  95 + "webpack-bundle-analyzer": "^3.9.0"
81 }, 96 },
82 "engines": { 97 "engines": {
83 "node": ">=8.9", 98 "node": ">=8.9",
yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/ProcessDesigner.vue 0 → 100644
  1 +<template>
  2 + <div class="my-process-designer">
  3 + <div class="my-process-designer__header">
  4 + <slot name="control-header"></slot>
  5 + <template v-if="!$slots['control-header']">
  6 + <el-button-group key="file-control">
  7 + <el-button :size="headerButtonSize" :type="headerButtonType" icon="el-icon-folder-opened" @click="$refs.refFile.click()">打开文件</el-button>
  8 + <el-tooltip effect="light">
  9 + <div slot="content">
  10 + <el-button :size="headerButtonSize" type="text" @click="downloadProcessAsXml()">下载为XML文件</el-button>
  11 + <br />
  12 + <el-button :size="headerButtonSize" type="text" @click="downloadProcessAsSvg()">下载为SVG文件</el-button>
  13 + <br />
  14 + <el-button :size="headerButtonSize" type="text" @click="downloadProcessAsBpmn()">下载为BPMN文件</el-button>
  15 + </div>
  16 + <el-button :size="headerButtonSize" :type="headerButtonType" icon="el-icon-download">下载文件</el-button>
  17 + </el-tooltip>
  18 + <el-tooltip effect="light">
  19 + <div slot="content">
  20 + <el-button :size="headerButtonSize" type="text" @click="previewProcessXML">预览XML</el-button>
  21 + <br />
  22 + <el-button :size="headerButtonSize" type="text" @click="previewProcessJson">预览JSON</el-button>
  23 + </div>
  24 + <el-button :size="headerButtonSize" :type="headerButtonType" icon="el-icon-view">预览</el-button>
  25 + </el-tooltip>
  26 + <el-tooltip v-if="simulation" effect="light" :content="this.simulationStatus ? '退出模拟' : '开启模拟'">
  27 + <el-button :size="headerButtonSize" :type="headerButtonType" icon="el-icon-cpu" @click="processSimulation">
  28 + 模拟
  29 + </el-button>
  30 + </el-tooltip>
  31 + </el-button-group>
  32 + <el-button-group key="align-control">
  33 + <el-tooltip effect="light" content="向左对齐">
  34 + <el-button :size="headerButtonSize" class="align align-left" icon="el-icon-s-data" @click="elementsAlign('left')" />
  35 + </el-tooltip>
  36 + <el-tooltip effect="light" content="向右对齐">
  37 + <el-button :size="headerButtonSize" class="align align-right" icon="el-icon-s-data" @click="elementsAlign('right')" />
  38 + </el-tooltip>
  39 + <el-tooltip effect="light" content="向上对齐">
  40 + <el-button :size="headerButtonSize" class="align align-top" icon="el-icon-s-data" @click="elementsAlign('top')" />
  41 + </el-tooltip>
  42 + <el-tooltip effect="light" content="向下对齐">
  43 + <el-button :size="headerButtonSize" class="align align-bottom" icon="el-icon-s-data" @click="elementsAlign('bottom')" />
  44 + </el-tooltip>
  45 + <el-tooltip effect="light" content="水平居中">
  46 + <el-button :size="headerButtonSize" class="align align-center" icon="el-icon-s-data" @click="elementsAlign('center')" />
  47 + </el-tooltip>
  48 + <el-tooltip effect="light" content="垂直居中">
  49 + <el-button :size="headerButtonSize" class="align align-middle" icon="el-icon-s-data" @click="elementsAlign('middle')" />
  50 + </el-tooltip>
  51 + </el-button-group>
  52 + <el-button-group key="scale-control">
  53 + <el-tooltip effect="light" content="缩小视图">
  54 + <el-button :size="headerButtonSize" :disabled="defaultZoom < 0.2" icon="el-icon-zoom-out" @click="processZoomOut()" />
  55 + </el-tooltip>
  56 + <el-button :size="headerButtonSize">{{ Math.floor(this.defaultZoom * 10 * 10) + "%" }}</el-button>
  57 + <el-tooltip effect="light" content="放大视图">
  58 + <el-button :size="headerButtonSize" :disabled="defaultZoom > 4" icon="el-icon-zoom-in" @click="processZoomIn()" />
  59 + </el-tooltip>
  60 + <el-tooltip effect="light" content="重置视图并居中">
  61 + <el-button :size="headerButtonSize" icon="el-icon-c-scale-to-original" @click="processReZoom()" />
  62 + </el-tooltip>
  63 + </el-button-group>
  64 + <el-button-group key="stack-control">
  65 + <el-tooltip effect="light" content="撤销">
  66 + <el-button :size="headerButtonSize" :disabled="!revocable" icon="el-icon-refresh-left" @click="processUndo()" />
  67 + </el-tooltip>
  68 + <el-tooltip effect="light" content="恢复">
  69 + <el-button :size="headerButtonSize" :disabled="!recoverable" icon="el-icon-refresh-right" @click="processRedo()" />
  70 + </el-tooltip>
  71 + <el-tooltip effect="light" content="重新绘制">
  72 + <el-button :size="headerButtonSize" icon="el-icon-refresh" @click="processRestart" />
  73 + </el-tooltip>
  74 + </el-button-group>
  75 + </template>
  76 + <!-- 用于打开本地文件-->
  77 + <input type="file" id="files" ref="refFile" style="display: none" accept=".xml, .bpmn" @change="importLocalFile" />
  78 + </div>
  79 + <div class="my-process-designer__container">
  80 + <div class="my-process-designer__canvas" ref="bpmn-canvas"></div>
  81 + </div>
  82 + <el-dialog title="预览" width="60%" :visible.sync="previewModelVisible" append-to-body destroy-on-close>
  83 + <highlightjs :language="previewType" :code="previewResult" />
  84 + </el-dialog>
  85 + </div>
  86 +</template>
  87 +
  88 +<script>
  89 +import BpmnModeler from "bpmn-js/lib/Modeler";
  90 +import DefaultEmptyXML from "./plugins/defaultEmpty";
  91 +// 翻译方法
  92 +import customTranslate from "./plugins/translate/customTranslate";
  93 +import translationsCN from "./plugins/translate/zh";
  94 +// 模拟流转流程
  95 +import tokenSimulation from "bpmn-js-token-simulation";
  96 +// 标签解析构建器
  97 +// import bpmnPropertiesProvider from "bpmn-js-properties-panel/lib/provider/bpmn";
  98 +// 标签解析 Moddle
  99 +import camundaModdleDescriptor from "./plugins/descriptor/camundaDescriptor.json";
  100 +import activitiModdleDescriptor from "./plugins/descriptor/activitiDescriptor.json";
  101 +import flowableModdleDescriptor from "./plugins/descriptor/flowableDescriptor.json";
  102 +// 标签解析 Extension
  103 +import camundaModdleExtension from "./plugins/extension-moddle/camunda";
  104 +import activitiModdleExtension from "./plugins/extension-moddle/activiti";
  105 +import flowableModdleExtension from "./plugins/extension-moddle/flowable";
  106 +// 引入json转换与高亮
  107 +import convert from "xml-js";
  108 +
  109 +export default {
  110 + name: "MyProcessDesigner",
  111 + componentName: "MyProcessDesigner",
  112 + props: {
  113 + value: String, // xml 字符串
  114 + processId: String,
  115 + processName: String,
  116 + translations: Object, // 自定义的翻译文件
  117 + additionalModel: [Object, Array], // 自定义model
  118 + moddleExtension: Object, // 自定义moddle
  119 + onlyCustomizeAddi: {
  120 + type: Boolean,
  121 + default: false
  122 + },
  123 + onlyCustomizeModdle: {
  124 + type: Boolean,
  125 + default: false
  126 + },
  127 + simulation: {
  128 + type: Boolean,
  129 + default: true
  130 + },
  131 + keyboard: {
  132 + type: Boolean,
  133 + default: true
  134 + },
  135 + prefix: {
  136 + type: String,
  137 + default: "camunda"
  138 + },
  139 + events: {
  140 + type: Array,
  141 + default: () => ["element.click"]
  142 + },
  143 + headerButtonSize: {
  144 + type: String,
  145 + default: "small",
  146 + validator: value => ["default", "medium", "small", "mini"].indexOf(value) !== -1
  147 + },
  148 + headerButtonType: {
  149 + type: String,
  150 + default: "primary",
  151 + validator: value => ["default", "primary", "success", "warning", "danger", "info"].indexOf(value) !== -1
  152 + }
  153 + },
  154 + data() {
  155 + return {
  156 + defaultZoom: 1,
  157 + previewModelVisible: false,
  158 + simulationStatus: false,
  159 + previewResult: "",
  160 + previewType: "xml",
  161 + recoverable: false,
  162 + revocable: false
  163 + };
  164 + },
  165 + computed: {
  166 + additionalModules() {
  167 + const Modules = [];
  168 + // 仅保留用户自定义扩展模块
  169 + if (this.onlyCustomizeAddi) {
  170 + if (Object.prototype.toString.call(this.additionalModel) === "[object Array]") {
  171 + return this.additionalModel || [];
  172 + }
  173 + return [this.additionalModel];
  174 + }
  175 +
  176 + // 插入用户自定义扩展模块
  177 + if (Object.prototype.toString.call(this.additionalModel) === "[object Array]") {
  178 + Modules.push(...this.additionalModel);
  179 + } else {
  180 + this.additionalModel && Modules.push(this.additionalModel);
  181 + }
  182 +
  183 + // 翻译模块
  184 + const TranslateModule = {
  185 + translate: ["value", customTranslate(this.translations || translationsCN)]
  186 + };
  187 + Modules.push(TranslateModule);
  188 +
  189 + // 模拟流转模块
  190 + if (this.simulation) {
  191 + Modules.push(tokenSimulation);
  192 + }
  193 +
  194 + // 根据需要的流程类型设置扩展元素构建模块
  195 + // if (this.prefix === "bpmn") {
  196 + // Modules.push(bpmnModdleExtension);
  197 + // }
  198 + if (this.prefix === "camunda") {
  199 + Modules.push(camundaModdleExtension);
  200 + }
  201 + if (this.prefix === "flowable") {
  202 + Modules.push(flowableModdleExtension);
  203 + }
  204 + if (this.prefix === "activiti") {
  205 + Modules.push(activitiModdleExtension);
  206 + }
  207 +
  208 + return Modules;
  209 + },
  210 + moddleExtensions() {
  211 + const Extensions = {};
  212 + // 仅使用用户自定义模块
  213 + if (this.onlyCustomizeModdle) {
  214 + return this.moddleExtension || null;
  215 + }
  216 +
  217 + // 插入用户自定义模块
  218 + if (this.moddleExtension) {
  219 + for (let key in this.moddleExtension) {
  220 + Extensions[key] = this.moddleExtension[key];
  221 + }
  222 + }
  223 +
  224 + // 根据需要的 "流程类型" 设置 对应的解析文件
  225 + if (this.prefix === "activiti") {
  226 + Extensions.activiti = activitiModdleDescriptor;
  227 + }
  228 + if (this.prefix === "flowable") {
  229 + Extensions.flowable = flowableModdleDescriptor;
  230 + }
  231 + if (this.prefix === "camunda") {
  232 + Extensions.camunda = camundaModdleDescriptor;
  233 + }
  234 +
  235 + return Extensions;
  236 + }
  237 + },
  238 + mounted() {
  239 + this.initBpmnModeler();
  240 + this.createNewDiagram(this.value);
  241 + this.$once("hook:beforeDestroy", () => {
  242 + if (this.bpmnModeler) this.bpmnModeler.destroy();
  243 + this.$emit("destroy", this.bpmnModeler);
  244 + this.bpmnModeler = null;
  245 + });
  246 + },
  247 + methods: {
  248 + initBpmnModeler() {
  249 + if (this.bpmnModeler) return;
  250 + this.bpmnModeler = new BpmnModeler({
  251 + container: this.$refs["bpmn-canvas"],
  252 + keyboard: this.keyboard ? { bindTo: document } : null,
  253 + additionalModules: this.additionalModules,
  254 + moddleExtensions: this.moddleExtensions
  255 + });
  256 + this.$emit("init-finished", this.bpmnModeler);
  257 + this.initModelListeners();
  258 + },
  259 + initModelListeners() {
  260 + const EventBus = this.bpmnModeler.get("eventBus");
  261 + const that = this;
  262 + // 注册需要的监听事件, 将. 替换为 - , 避免解析异常
  263 + this.events.forEach(event => {
  264 + EventBus.on(event, function(eventObj) {
  265 + let eventName = event.replace(/\./g, "-");
  266 + let element = eventObj ? eventObj.element : null;
  267 + that.$emit(eventName, element, eventObj);
  268 + });
  269 + });
  270 + // 监听图形改变返回xml
  271 + EventBus.on("commandStack.changed", async event => {
  272 + try {
  273 + this.recoverable = this.bpmnModeler.get("commandStack").canRedo();
  274 + this.revocable = this.bpmnModeler.get("commandStack").canUndo();
  275 + let { xml } = await this.bpmnModeler.saveXML({ format: true });
  276 + this.$emit("commandStack-changed", event);
  277 + this.$emit("input", xml);
  278 + this.$emit("change", xml);
  279 + } catch (e) {
  280 + console.error(`[Process Designer Warn]: ${e.message || e}`);
  281 + }
  282 + });
  283 + // 监听视图缩放变化
  284 + this.bpmnModeler.on("canvas.viewbox.changed", ({ viewbox }) => {
  285 + this.$emit("canvas-viewbox-changed", { viewbox });
  286 + const { scale } = viewbox;
  287 + this.defaultZoom = Math.floor(scale * 100) / 100;
  288 + });
  289 + },
  290 + /* 创建新的流程图 */
  291 + async createNewDiagram(xml) {
  292 + // 将字符串转换成图显示出来
  293 + let newId = this.processId || `Process_${new Date().getTime()}`;
  294 + let newName = this.processName || `业务流程_${new Date().getTime()}`;
  295 + let xmlString = xml || DefaultEmptyXML(newId, newName, this.prefix);
  296 + try {
  297 + console.log(this.bpmnModeler.importXML);
  298 + let { warnings } = await this.bpmnModeler.importXML(xmlString);
  299 + if (warnings && warnings.length) {
  300 + warnings.forEach(warn => console.warn(warn));
  301 + }
  302 + } catch (e) {
  303 + console.error(`[Process Designer Warn]: ${e?.message || e}`);
  304 + }
  305 + },
  306 +
  307 + // 下载流程图到本地
  308 + async downloadProcess(type, name) {
  309 + try {
  310 + const _this = this;
  311 + // 按需要类型创建文件并下载
  312 + if (type === "xml" || type === "bpmn") {
  313 + const { err, xml } = await this.bpmnModeler.saveXML();
  314 + // 读取异常时抛出异常
  315 + if (err) {
  316 + console.error(`[Process Designer Warn ]: ${err.message || err}`);
  317 + }
  318 + let { href, filename } = _this.setEncoded(type.toUpperCase(), name, xml);
  319 + downloadFunc(href, filename);
  320 + } else {
  321 + const { err, svg } = await this.bpmnModeler.saveSVG();
  322 + // 读取异常时抛出异常
  323 + if (err) {
  324 + return console.error(err);
  325 + }
  326 + let { href, filename } = _this.setEncoded("SVG", name, svg);
  327 + downloadFunc(href, filename);
  328 + }
  329 + } catch (e) {
  330 + console.error(`[Process Designer Warn ]: ${e.message || e}`);
  331 + }
  332 + // 文件下载方法
  333 + function downloadFunc(href, filename) {
  334 + if (href && filename) {
  335 + let a = document.createElement("a");
  336 + a.download = filename; //指定下载的文件名
  337 + a.href = href; // URL对象
  338 + a.click(); // 模拟点击
  339 + URL.revokeObjectURL(a.href); // 释放URL 对象
  340 + }
  341 + }
  342 + },
  343 +
  344 + // 根据所需类型进行转码并返回下载地址
  345 + setEncoded(type, filename = "diagram", data) {
  346 + const encodedData = encodeURIComponent(data);
  347 + return {
  348 + filename: `${filename}.${type}`,
  349 + href: `data:application/${type === "svg" ? "text/xml" : "bpmn20-xml"};charset=UTF-8,${encodedData}`,
  350 + data: data
  351 + };
  352 + },
  353 +
  354 + // 加载本地文件
  355 + importLocalFile() {
  356 + const that = this;
  357 + const file = this.$refs.refFile.files[0];
  358 + const reader = new FileReader();
  359 + reader.readAsText(file);
  360 + reader.onload = function() {
  361 + let xmlStr = this.result;
  362 + that.createNewDiagram(xmlStr);
  363 + };
  364 + },
  365 + /* ------------------------------------------------ refs methods ------------------------------------------------------ */
  366 + downloadProcessAsXml() {
  367 + this.downloadProcess("xml");
  368 + },
  369 + downloadProcessAsBpmn() {
  370 + this.downloadProcess("bpmn");
  371 + },
  372 + downloadProcessAsSvg() {
  373 + this.downloadProcess("svg");
  374 + },
  375 + processSimulation() {
  376 + this.simulationStatus = !this.simulationStatus;
  377 + this.simulation && this.bpmnModeler.get("toggleMode").toggleMode();
  378 + },
  379 + processRedo() {
  380 + this.bpmnModeler.get("commandStack").redo();
  381 + },
  382 + processUndo() {
  383 + this.bpmnModeler.get("commandStack").undo();
  384 + },
  385 + processZoomIn(zoomStep = 0.1) {
  386 + let newZoom = Math.floor(this.defaultZoom * 100 + zoomStep * 100) / 100;
  387 + if (newZoom > 4) {
  388 + throw new Error("[Process Designer Warn ]: The zoom ratio cannot be greater than 4");
  389 + }
  390 + this.defaultZoom = newZoom;
  391 + this.bpmnModeler.get("canvas").zoom(this.defaultZoom);
  392 + },
  393 + processZoomOut(zoomStep = 0.1) {
  394 + let newZoom = Math.floor(this.defaultZoom * 100 - zoomStep * 100) / 100;
  395 + if (newZoom < 0.2) {
  396 + throw new Error("[Process Designer Warn ]: The zoom ratio cannot be less than 0.2");
  397 + }
  398 + this.defaultZoom = newZoom;
  399 + this.bpmnModeler.get("canvas").zoom(this.defaultZoom);
  400 + },
  401 + processZoomTo(newZoom = 1) {
  402 + if (newZoom < 0.2) {
  403 + throw new Error("[Process Designer Warn ]: The zoom ratio cannot be less than 0.2");
  404 + }
  405 + if (newZoom > 4) {
  406 + throw new Error("[Process Designer Warn ]: The zoom ratio cannot be greater than 4");
  407 + }
  408 + this.defaultZoom = newZoom;
  409 + this.bpmnModeler.get("canvas").zoom(newZoom);
  410 + },
  411 + processReZoom() {
  412 + this.defaultZoom = 1;
  413 + this.bpmnModeler.get("canvas").zoom("fit-viewport", "auto");
  414 + },
  415 + processRestart() {
  416 + this.recoverable = false;
  417 + this.revocable = false;
  418 + this.createNewDiagram(null);
  419 + },
  420 + elementsAlign(align) {
  421 + const Align = this.bpmnModeler.get("alignElements");
  422 + const Selection = this.bpmnModeler.get("selection");
  423 + const SelectedElements = Selection.get();
  424 + if (!SelectedElements || SelectedElements.length <= 1) {
  425 + this.$message.warning("请按住 Ctrl 键选择多个元素对齐");
  426 + return;
  427 + }
  428 + this.$confirm("自动对齐可能造成图形变形,是否继续?", "警告", {
  429 + confirmButtonText: "确定",
  430 + cancelButtonText: "取消",
  431 + type: "warning"
  432 + }).then(() => Align.trigger(SelectedElements, align));
  433 + },
  434 + /*----------------------------- 方法结束 ---------------------------------*/
  435 + previewProcessXML() {
  436 + this.bpmnModeler.saveXML({ format: true }).then(({ xml }) => {
  437 + this.previewResult = xml;
  438 + this.previewType = "xml";
  439 + this.previewModelVisible = true;
  440 + });
  441 + },
  442 + previewProcessJson() {
  443 + this.bpmnModeler.saveXML({ format: true }).then(({ xml }) => {
  444 + this.previewResult = convert.xml2json(xml, { spaces: 2 });
  445 + this.previewType = "json";
  446 + this.previewModelVisible = true;
  447 + });
  448 + }
  449 + }
  450 +};
  451 +</script>
yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/index.js 0 → 100644
  1 +import MyProcessDesigner from "./ProcessDesigner.vue";
  2 +
  3 +MyProcessDesigner.install = function(Vue) {
  4 + Vue.component(MyProcessDesigner.name, MyProcessDesigner);
  5 +};
  6 +
  7 +export default MyProcessDesigner;
yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/plugins/content-pad/contentPadProvider.js 0 → 100644
  1 +import { assign, forEach, isArray } from "min-dash";
  2 +
  3 +import { is } from "bpmn-js/lib/util/ModelUtil";
  4 +
  5 +import { isExpanded, isEventSubProcess } from "bpmn-js/lib/util/DiUtil";
  6 +
  7 +import { isAny } from "bpmn-js/lib/features/modeling/util/ModelingUtil";
  8 +
  9 +import { getChildLanes } from "bpmn-js/lib/features/modeling/util/LaneUtil";
  10 +
  11 +import { hasPrimaryModifier } from "diagram-js/lib/util/Mouse";
  12 +
  13 +/**
  14 + * A provider for BPMN 2.0 elements context pad
  15 + */
  16 +export default function ContextPadProvider(
  17 + config,
  18 + injector,
  19 + eventBus,
  20 + contextPad,
  21 + modeling,
  22 + elementFactory,
  23 + connect,
  24 + create,
  25 + popupMenu,
  26 + canvas,
  27 + rules,
  28 + translate,
  29 + elementRegistry
  30 +) {
  31 + config = config || {};
  32 +
  33 + contextPad.registerProvider(this);
  34 +
  35 + this._contextPad = contextPad;
  36 +
  37 + this._modeling = modeling;
  38 +
  39 + this._elementFactory = elementFactory;
  40 + this._connect = connect;
  41 + this._create = create;
  42 + this._popupMenu = popupMenu;
  43 + this._canvas = canvas;
  44 + this._rules = rules;
  45 + this._translate = translate;
  46 +
  47 + if (config.autoPlace !== false) {
  48 + this._autoPlace = injector.get("autoPlace", false);
  49 + }
  50 +
  51 + eventBus.on("create.end", 250, function(event) {
  52 + var context = event.context,
  53 + shape = context.shape;
  54 +
  55 + if (!hasPrimaryModifier(event) || !contextPad.isOpen(shape)) {
  56 + return;
  57 + }
  58 +
  59 + var entries = contextPad.getEntries(shape);
  60 +
  61 + if (entries.replace) {
  62 + entries.replace.action.click(event, shape);
  63 + }
  64 + });
  65 +}
  66 +
  67 +ContextPadProvider.$inject = [
  68 + "config.contextPad",
  69 + "injector",
  70 + "eventBus",
  71 + "contextPad",
  72 + "modeling",
  73 + "elementFactory",
  74 + "connect",
  75 + "create",
  76 + "popupMenu",
  77 + "canvas",
  78 + "rules",
  79 + "translate",
  80 + "elementRegistry"
  81 +];
  82 +
  83 +ContextPadProvider.prototype.getContextPadEntries = function(element) {
  84 + var contextPad = this._contextPad,
  85 + modeling = this._modeling,
  86 + elementFactory = this._elementFactory,
  87 + connect = this._connect,
  88 + create = this._create,
  89 + popupMenu = this._popupMenu,
  90 + canvas = this._canvas,
  91 + rules = this._rules,
  92 + autoPlace = this._autoPlace,
  93 + translate = this._translate;
  94 +
  95 + var actions = {};
  96 +
  97 + if (element.type === "label") {
  98 + return actions;
  99 + }
  100 +
  101 + var businessObject = element.businessObject;
  102 +
  103 + function startConnect(event, element) {
  104 + connect.start(event, element);
  105 + }
  106 +
  107 + function removeElement() {
  108 + modeling.removeElements([element]);
  109 + }
  110 +
  111 + function getReplaceMenuPosition(element) {
  112 + var Y_OFFSET = 5;
  113 +
  114 + var diagramContainer = canvas.getContainer(),
  115 + pad = contextPad.getPad(element).html;
  116 +
  117 + var diagramRect = diagramContainer.getBoundingClientRect(),
  118 + padRect = pad.getBoundingClientRect();
  119 +
  120 + var top = padRect.top - diagramRect.top;
  121 + var left = padRect.left - diagramRect.left;
  122 +
  123 + var pos = {
  124 + x: left,
  125 + y: top + padRect.height + Y_OFFSET
  126 + };
  127 +
  128 + return pos;
  129 + }
  130 +
  131 + /**
  132 + * Create an append action
  133 + *
  134 + * @param {string} type
  135 + * @param {string} className
  136 + * @param {string} [title]
  137 + * @param {Object} [options]
  138 + *
  139 + * @return {Object} descriptor
  140 + */
  141 + function appendAction(type, className, title, options) {
  142 + if (typeof title !== "string") {
  143 + options = title;
  144 + title = translate("Append {type}", { type: type.replace(/^bpmn:/, "") });
  145 + }
  146 +
  147 + function appendStart(event, element) {
  148 + var shape = elementFactory.createShape(assign({ type: type }, options));
  149 + create.start(event, shape, {
  150 + source: element
  151 + });
  152 + }
  153 +
  154 + var append = autoPlace
  155 + ? function(event, element) {
  156 + var shape = elementFactory.createShape(assign({ type: type }, options));
  157 +
  158 + autoPlace.append(element, shape);
  159 + }
  160 + : appendStart;
  161 +
  162 + return {
  163 + group: "model",
  164 + className: className,
  165 + title: title,
  166 + action: {
  167 + dragstart: appendStart,
  168 + click: append
  169 + }
  170 + };
  171 + }
  172 +
  173 + function splitLaneHandler(count) {
  174 + return function(event, element) {
  175 + // actual split
  176 + modeling.splitLane(element, count);
  177 +
  178 + // refresh context pad after split to
  179 + // get rid of split icons
  180 + contextPad.open(element, true);
  181 + };
  182 + }
  183 +
  184 + if (isAny(businessObject, ["bpmn:Lane", "bpmn:Participant"]) && isExpanded(businessObject)) {
  185 + var childLanes = getChildLanes(element);
  186 +
  187 + assign(actions, {
  188 + "lane-insert-above": {
  189 + group: "lane-insert-above",
  190 + className: "bpmn-icon-lane-insert-above",
  191 + title: translate("Add Lane above"),
  192 + action: {
  193 + click: function(event, element) {
  194 + modeling.addLane(element, "top");
  195 + }
  196 + }
  197 + }
  198 + });
  199 +
  200 + if (childLanes.length < 2) {
  201 + if (element.height >= 120) {
  202 + assign(actions, {
  203 + "lane-divide-two": {
  204 + group: "lane-divide",
  205 + className: "bpmn-icon-lane-divide-two",
  206 + title: translate("Divide into two Lanes"),
  207 + action: {
  208 + click: splitLaneHandler(2)
  209 + }
  210 + }
  211 + });
  212 + }
  213 +
  214 + if (element.height >= 180) {
  215 + assign(actions, {
  216 + "lane-divide-three": {
  217 + group: "lane-divide",
  218 + className: "bpmn-icon-lane-divide-three",
  219 + title: translate("Divide into three Lanes"),
  220 + action: {
  221 + click: splitLaneHandler(3)
  222 + }
  223 + }
  224 + });
  225 + }
  226 + }
  227 +
  228 + assign(actions, {
  229 + "lane-insert-below": {
  230 + group: "lane-insert-below",
  231 + className: "bpmn-icon-lane-insert-below",
  232 + title: translate("Add Lane below"),
  233 + action: {
  234 + click: function(event, element) {
  235 + modeling.addLane(element, "bottom");
  236 + }
  237 + }
  238 + }
  239 + });
  240 + }
  241 +
  242 + if (is(businessObject, "bpmn:FlowNode")) {
  243 + if (is(businessObject, "bpmn:EventBasedGateway")) {
  244 + assign(actions, {
  245 + "append.receive-task": appendAction("bpmn:ReceiveTask", "bpmn-icon-receive-task", translate("Append ReceiveTask")),
  246 + "append.message-intermediate-event": appendAction(
  247 + "bpmn:IntermediateCatchEvent",
  248 + "bpmn-icon-intermediate-event-catch-message",
  249 + translate("Append MessageIntermediateCatchEvent"),
  250 + { eventDefinitionType: "bpmn:MessageEventDefinition" }
  251 + ),
  252 + "append.timer-intermediate-event": appendAction(
  253 + "bpmn:IntermediateCatchEvent",
  254 + "bpmn-icon-intermediate-event-catch-timer",
  255 + translate("Append TimerIntermediateCatchEvent"),
  256 + { eventDefinitionType: "bpmn:TimerEventDefinition" }
  257 + ),
  258 + "append.condition-intermediate-event": appendAction(
  259 + "bpmn:IntermediateCatchEvent",
  260 + "bpmn-icon-intermediate-event-catch-condition",
  261 + translate("Append ConditionIntermediateCatchEvent"),
  262 + { eventDefinitionType: "bpmn:ConditionalEventDefinition" }
  263 + ),
  264 + "append.signal-intermediate-event": appendAction(
  265 + "bpmn:IntermediateCatchEvent",
  266 + "bpmn-icon-intermediate-event-catch-signal",
  267 + translate("Append SignalIntermediateCatchEvent"),
  268 + { eventDefinitionType: "bpmn:SignalEventDefinition" }
  269 + )
  270 + });
  271 + } else if (isEventType(businessObject, "bpmn:BoundaryEvent", "bpmn:CompensateEventDefinition")) {
  272 + assign(actions, {
  273 + "append.compensation-activity": appendAction("bpmn:Task", "bpmn-icon-task", translate("Append compensation activity"), {
  274 + isForCompensation: true
  275 + })
  276 + });
  277 + } else if (
  278 + !is(businessObject, "bpmn:EndEvent") &&
  279 + !businessObject.isForCompensation &&
  280 + !isEventType(businessObject, "bpmn:IntermediateThrowEvent", "bpmn:LinkEventDefinition") &&
  281 + !isEventSubProcess(businessObject)
  282 + ) {
  283 + assign(actions, {
  284 + "append.end-event": appendAction("bpmn:EndEvent", "bpmn-icon-end-event-none", translate("Append EndEvent")),
  285 + "append.gateway": appendAction("bpmn:ExclusiveGateway", "bpmn-icon-gateway-none", translate("Append Gateway")),
  286 + "append.append-task": appendAction("bpmn:UserTask", "bpmn-icon-user-task", translate("Append Task")),
  287 + "append.intermediate-event": appendAction(
  288 + "bpmn:IntermediateThrowEvent",
  289 + "bpmn-icon-intermediate-event-none",
  290 + translate("Append Intermediate/Boundary Event")
  291 + )
  292 + });
  293 + }
  294 + }
  295 +
  296 + if (!popupMenu.isEmpty(element, "bpmn-replace")) {
  297 + // Replace menu entry
  298 + assign(actions, {
  299 + replace: {
  300 + group: "edit",
  301 + className: "bpmn-icon-screw-wrench",
  302 + title: translate("Change type"),
  303 + action: {
  304 + click: function(event, element) {
  305 + var position = assign(getReplaceMenuPosition(element), {
  306 + cursor: { x: event.x, y: event.y }
  307 + });
  308 +
  309 + popupMenu.open(element, "bpmn-replace", position);
  310 + }
  311 + }
  312 + }
  313 + });
  314 + }
  315 +
  316 + if (isAny(businessObject, ["bpmn:FlowNode", "bpmn:InteractionNode", "bpmn:DataObjectReference", "bpmn:DataStoreReference"])) {
  317 + assign(actions, {
  318 + "append.text-annotation": appendAction("bpmn:TextAnnotation", "bpmn-icon-text-annotation"),
  319 +
  320 + connect: {
  321 + group: "connect",
  322 + className: "bpmn-icon-connection-multi",
  323 + title: translate("Connect using " + (businessObject.isForCompensation ? "" : "Sequence/MessageFlow or ") + "Association"),
  324 + action: {
  325 + click: startConnect,
  326 + dragstart: startConnect
  327 + }
  328 + }
  329 + });
  330 + }
  331 +
  332 + if (isAny(businessObject, ["bpmn:DataObjectReference", "bpmn:DataStoreReference"])) {
  333 + assign(actions, {
  334 + connect: {
  335 + group: "connect",
  336 + className: "bpmn-icon-connection-multi",
  337 + title: translate("Connect using DataInputAssociation"),
  338 + action: {
  339 + click: startConnect,
  340 + dragstart: startConnect
  341 + }
  342 + }
  343 + });
  344 + }
  345 +
  346 + if (is(businessObject, "bpmn:Group")) {
  347 + assign(actions, {
  348 + "append.text-annotation": appendAction("bpmn:TextAnnotation", "bpmn-icon-text-annotation")
  349 + });
  350 + }
  351 +
  352 + // delete element entry, only show if allowed by rules
  353 + var deleteAllowed = rules.allowed("elements.delete", { elements: [element] });
  354 +
  355 + if (isArray(deleteAllowed)) {
  356 + // was the element returned as a deletion candidate?
  357 + deleteAllowed = deleteAllowed[0] === element;
  358 + }
  359 +
  360 + if (deleteAllowed) {
  361 + assign(actions, {
  362 + delete: {
  363 + group: "edit",
  364 + className: "bpmn-icon-trash",
  365 + title: translate("Remove"),
  366 + action: {
  367 + click: removeElement
  368 + }
  369 + }
  370 + });
  371 + }
  372 +
  373 + return actions;
  374 +};
  375 +
  376 +// helpers /////////
  377 +
  378 +function isEventType(eventBo, type, definition) {
  379 + var isType = eventBo.$instanceOf(type);
  380 + var isDefinition = false;
  381 +
  382 + var definitions = eventBo.eventDefinitions || [];
  383 + forEach(definitions, function(def) {
  384 + if (def.$type === definition) {
  385 + isDefinition = true;
  386 + }
  387 + });
  388 +
  389 + return isType && isDefinition;
  390 +}
yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/plugins/content-pad/index.js 0 → 100644
  1 +import CustomContextPadProvider from "./contentPadProvider";
  2 +
  3 +export default {
  4 + __init__: ["contextPadProvider"],
  5 + contextPadProvider: ["type", CustomContextPadProvider]
  6 +};
yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/plugins/defaultEmpty.js 0 → 100644
  1 +export default (key, name, type) => {
  2 + if (!type) type = "camunda";
  3 + const TYPE_TARGET = {
  4 + activiti: "http://activiti.org/bpmn",
  5 + camunda: "http://bpmn.io/schema/bpmn",
  6 + flowable: "http://flowable.org/bpmn"
  7 + };
  8 + return `<?xml version="1.0" encoding="UTF-8"?>
  9 +<bpmn2:definitions
  10 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  11 + xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL"
  12 + xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
  13 + xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
  14 + xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
  15 + id="diagram_${key}"
  16 + targetNamespace="${TYPE_TARGET[type]}">
  17 + <bpmn2:process id="${key}" name="${name}" isExecutable="true">
  18 + </bpmn2:process>
  19 + <bpmndi:BPMNDiagram id="BPMNDiagram_1">
  20 + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="${key}">
  21 + </bpmndi:BPMNPlane>
  22 + </bpmndi:BPMNDiagram>
  23 +</bpmn2:definitions>`;
  24 +};
yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/activitiDescriptor.json 0 → 100644
  1 +{
  2 + "name": "Activiti",
  3 + "uri": "http://activiti.org/bpmn",
  4 + "prefix": "activiti",
  5 + "xml": {
  6 + "tagAlias": "lowerCase"
  7 + },
  8 + "associations": [],
  9 + "types": [
  10 + {
  11 + "name": "Definitions",
  12 + "isAbstract": true,
  13 + "extends": [
  14 + "bpmn:Definitions"
  15 + ],
  16 + "properties": [
  17 + {
  18 + "name": "diagramRelationId",
  19 + "isAttr": true,
  20 + "type": "String"
  21 + }
  22 + ]
  23 + },
  24 + {
  25 + "name": "InOutBinding",
  26 + "superClass": [
  27 + "Element"
  28 + ],
  29 + "isAbstract": true,
  30 + "properties": [
  31 + {
  32 + "name": "source",
  33 + "isAttr": true,
  34 + "type": "String"
  35 + },
  36 + {
  37 + "name": "sourceExpression",
  38 + "isAttr": true,
  39 + "type": "String"
  40 + },
  41 + {
  42 + "name": "target",
  43 + "isAttr": true,
  44 + "type": "String"
  45 + },
  46 + {
  47 + "name": "businessKey",
  48 + "isAttr": true,
  49 + "type": "String"
  50 + },
  51 + {
  52 + "name": "local",
  53 + "isAttr": true,
  54 + "type": "Boolean",
  55 + "default": false
  56 + },
  57 + {
  58 + "name": "variables",
  59 + "isAttr": true,
  60 + "type": "String"
  61 + }
  62 + ]
  63 + },
  64 + {
  65 + "name": "In",
  66 + "superClass": [
  67 + "InOutBinding"
  68 + ],
  69 + "meta": {
  70 + "allowedIn": [
  71 + "bpmn:CallActivity"
  72 + ]
  73 + }
  74 + },
  75 + {
  76 + "name": "Out",
  77 + "superClass": [
  78 + "InOutBinding"
  79 + ],
  80 + "meta": {
  81 + "allowedIn": [
  82 + "bpmn:CallActivity"
  83 + ]
  84 + }
  85 + },
  86 + {
  87 + "name": "AsyncCapable",
  88 + "isAbstract": true,
  89 + "extends": [
  90 + "bpmn:Activity",
  91 + "bpmn:Gateway",
  92 + "bpmn:Event"
  93 + ],
  94 + "properties": [
  95 + {
  96 + "name": "async",
  97 + "isAttr": true,
  98 + "type": "Boolean",
  99 + "default": false
  100 + },
  101 + {
  102 + "name": "asyncBefore",
  103 + "isAttr": true,
  104 + "type": "Boolean",
  105 + "default": false
  106 + },
  107 + {
  108 + "name": "asyncAfter",
  109 + "isAttr": true,
  110 + "type": "Boolean",
  111 + "default": false
  112 + },
  113 + {
  114 + "name": "exclusive",
  115 + "isAttr": true,
  116 + "type": "Boolean",
  117 + "default": true
  118 + }
  119 + ]
  120 + },
  121 + {
  122 + "name": "JobPriorized",
  123 + "isAbstract": true,
  124 + "extends": [
  125 + "bpmn:Process",
  126 + "activiti:AsyncCapable"
  127 + ],
  128 + "properties": [
  129 + {
  130 + "name": "jobPriority",
  131 + "isAttr": true,
  132 + "type": "String"
  133 + }
  134 + ]
  135 + },
  136 + {
  137 + "name": "SignalEventDefinition",
  138 + "isAbstract": true,
  139 + "extends": [
  140 + "bpmn:SignalEventDefinition"
  141 + ],
  142 + "properties": [
  143 + {
  144 + "name": "async",
  145 + "isAttr": true,
  146 + "type": "Boolean",
  147 + "default": false
  148 + }
  149 + ]
  150 + },
  151 + {
  152 + "name": "ErrorEventDefinition",
  153 + "isAbstract": true,
  154 + "extends": [
  155 + "bpmn:ErrorEventDefinition"
  156 + ],
  157 + "properties": [
  158 + {
  159 + "name": "errorCodeVariable",
  160 + "isAttr": true,
  161 + "type": "String"
  162 + },
  163 + {
  164 + "name": "errorMessageVariable",
  165 + "isAttr": true,
  166 + "type": "String"
  167 + }
  168 + ]
  169 + },
  170 + {
  171 + "name": "Error",
  172 + "isAbstract": true,
  173 + "extends": [
  174 + "bpmn:Error"
  175 + ],
  176 + "properties": [
  177 + {
  178 + "name": "activiti:errorMessage",
  179 + "isAttr": true,
  180 + "type": "String"
  181 + }
  182 + ]
  183 + },
  184 + {
  185 + "name": "PotentialStarter",
  186 + "superClass": [
  187 + "Element"
  188 + ],
  189 + "properties": [
  190 + {
  191 + "name": "resourceAssignmentExpression",
  192 + "type": "bpmn:ResourceAssignmentExpression"
  193 + }
  194 + ]
  195 + },
  196 + {
  197 + "name": "FormSupported",
  198 + "isAbstract": true,
  199 + "extends": [
  200 + "bpmn:StartEvent",
  201 + "bpmn:UserTask"
  202 + ],
  203 + "properties": [
  204 + {
  205 + "name": "formHandlerClass",
  206 + "isAttr": true,
  207 + "type": "String"
  208 + },
  209 + {
  210 + "name": "formKey",
  211 + "isAttr": true,
  212 + "type": "String"
  213 + }
  214 + ]
  215 + },
  216 + {
  217 + "name": "TemplateSupported",
  218 + "isAbstract": true,
  219 + "extends": [
  220 + "bpmn:Process",
  221 + "bpmn:FlowElement"
  222 + ],
  223 + "properties": [
  224 + {
  225 + "name": "modelerTemplate",
  226 + "isAttr": true,
  227 + "type": "String"
  228 + }
  229 + ]
  230 + },
  231 + {
  232 + "name": "Initiator",
  233 + "isAbstract": true,
  234 + "extends": [ "bpmn:StartEvent" ],
  235 + "properties": [
  236 + {
  237 + "name": "initiator",
  238 + "isAttr": true,
  239 + "type": "String"
  240 + }
  241 + ]
  242 + },
  243 + {
  244 + "name": "ScriptTask",
  245 + "isAbstract": true,
  246 + "extends": [
  247 + "bpmn:ScriptTask"
  248 + ],
  249 + "properties": [
  250 + {
  251 + "name": "resultVariable",
  252 + "isAttr": true,
  253 + "type": "String"
  254 + },
  255 + {
  256 + "name": "resource",
  257 + "isAttr": true,
  258 + "type": "String"
  259 + }
  260 + ]
  261 + },
  262 + {
  263 + "name": "Process",
  264 + "isAbstract": true,
  265 + "extends": [
  266 + "bpmn:Process"
  267 + ],
  268 + "properties": [
  269 + {
  270 + "name": "candidateStarterGroups",
  271 + "isAttr": true,
  272 + "type": "String"
  273 + },
  274 + {
  275 + "name": "candidateStarterUsers",
  276 + "isAttr": true,
  277 + "type": "String"
  278 + },
  279 + {
  280 + "name": "versionTag",
  281 + "isAttr": true,
  282 + "type": "String"
  283 + },
  284 + {
  285 + "name": "historyTimeToLive",
  286 + "isAttr": true,
  287 + "type": "String"
  288 + },
  289 + {
  290 + "name": "isStartableInTasklist",
  291 + "isAttr": true,
  292 + "type": "Boolean",
  293 + "default": true
  294 + },
  295 + {
  296 + "name":"executionListener",
  297 + "isAbstract": true,
  298 + "type":"Expression"
  299 + }
  300 + ]
  301 + },
  302 + {
  303 + "name": "EscalationEventDefinition",
  304 + "isAbstract": true,
  305 + "extends": [
  306 + "bpmn:EscalationEventDefinition"
  307 + ],
  308 + "properties": [
  309 + {
  310 + "name": "escalationCodeVariable",
  311 + "isAttr": true,
  312 + "type": "String"
  313 + }
  314 + ]
  315 + },
  316 + {
  317 + "name": "FormalExpression",
  318 + "isAbstract": true,
  319 + "extends": [
  320 + "bpmn:FormalExpression"
  321 + ],
  322 + "properties": [
  323 + {
  324 + "name": "resource",
  325 + "isAttr": true,
  326 + "type": "String"
  327 + }
  328 + ]
  329 + },
  330 + {
  331 + "name": "multiinstance_type",
  332 + "superClass":[
  333 + "Element"
  334 + ]
  335 + },
  336 + {
  337 + "name": "multiinstance_condition",
  338 + "superClass":[
  339 + "Element"
  340 + ]
  341 + },
  342 + {
  343 + "name": "Assignable",
  344 + "extends": [ "bpmn:UserTask" ],
  345 + "properties": [
  346 + {
  347 + "name": "assignee",
  348 + "isAttr": true,
  349 + "type": "String"
  350 + },
  351 + {
  352 + "name": "candidateUsers",
  353 + "isAttr": true,
  354 + "type": "String"
  355 + },
  356 + {
  357 + "name": "candidateGroups",
  358 + "isAttr": true,
  359 + "type": "String"
  360 + },
  361 + {
  362 + "name": "dueDate",
  363 + "isAttr": true,
  364 + "type": "String"
  365 + },
  366 + {
  367 + "name": "followUpDate",
  368 + "isAttr": true,
  369 + "type": "String"
  370 + },
  371 + {
  372 + "name": "priority",
  373 + "isAttr": true,
  374 + "type": "String"
  375 + },
  376 + {
  377 + "name": "multiinstance_condition",
  378 + "isAttr": true,
  379 + "type": "String"
  380 + }
  381 + ]
  382 + },
  383 + {
  384 + "name": "CallActivity",
  385 + "extends": [ "bpmn:CallActivity" ],
  386 + "properties": [
  387 + {
  388 + "name": "calledElementBinding",
  389 + "isAttr": true,
  390 + "type": "String",
  391 + "default": "latest"
  392 + },
  393 + {
  394 + "name": "calledElementVersion",
  395 + "isAttr": true,
  396 + "type": "String"
  397 + },
  398 + {
  399 + "name": "calledElementVersionTag",
  400 + "isAttr": true,
  401 + "type": "String"
  402 + },
  403 + {
  404 + "name": "calledElementTenantId",
  405 + "isAttr": true,
  406 + "type": "String"
  407 + },
  408 + {
  409 + "name": "caseRef",
  410 + "isAttr": true,
  411 + "type": "String"
  412 + },
  413 + {
  414 + "name": "caseBinding",
  415 + "isAttr": true,
  416 + "type": "String",
  417 + "default": "latest"
  418 + },
  419 + {
  420 + "name": "caseVersion",
  421 + "isAttr": true,
  422 + "type": "String"
  423 + },
  424 + {
  425 + "name": "caseTenantId",
  426 + "isAttr": true,
  427 + "type": "String"
  428 + },
  429 + {
  430 + "name": "variableMappingClass",
  431 + "isAttr": true,
  432 + "type": "String"
  433 + },
  434 + {
  435 + "name": "variableMappingDelegateExpression",
  436 + "isAttr": true,
  437 + "type": "String"
  438 + }
  439 + ]
  440 + },
  441 + {
  442 + "name": "ServiceTaskLike",
  443 + "extends": [
  444 + "bpmn:ServiceTask",
  445 + "bpmn:BusinessRuleTask",
  446 + "bpmn:SendTask",
  447 + "bpmn:MessageEventDefinition"
  448 + ],
  449 + "properties": [
  450 + {
  451 + "name": "expression",
  452 + "isAttr": true,
  453 + "type": "String"
  454 + },
  455 + {
  456 + "name": "class",
  457 + "isAttr": true,
  458 + "type": "String"
  459 + },
  460 + {
  461 + "name": "delegateExpression",
  462 + "isAttr": true,
  463 + "type": "String"
  464 + },
  465 + {
  466 + "name": "resultVariable",
  467 + "isAttr": true,
  468 + "type": "String"
  469 + }
  470 + ]
  471 + },
  472 + {
  473 + "name": "DmnCapable",
  474 + "extends": [
  475 + "bpmn:BusinessRuleTask"
  476 + ],
  477 + "properties": [
  478 + {
  479 + "name": "decisionRef",
  480 + "isAttr": true,
  481 + "type": "String"
  482 + },
  483 + {
  484 + "name": "decisionRefBinding",
  485 + "isAttr": true,
  486 + "type": "String",
  487 + "default": "latest"
  488 + },
  489 + {
  490 + "name": "decisionRefVersion",
  491 + "isAttr": true,
  492 + "type": "String"
  493 + },
  494 + {
  495 + "name": "mapDecisionResult",
  496 + "isAttr": true,
  497 + "type": "String",
  498 + "default": "resultList"
  499 + },
  500 + {
  501 + "name": "decisionRefTenantId",
  502 + "isAttr": true,
  503 + "type": "String"
  504 + }
  505 + ]
  506 + },
  507 + {
  508 + "name": "ExternalCapable",
  509 + "extends": [
  510 + "activiti:ServiceTaskLike"
  511 + ],
  512 + "properties": [
  513 + {
  514 + "name": "type",
  515 + "isAttr": true,
  516 + "type": "String"
  517 + },
  518 + {
  519 + "name": "topic",
  520 + "isAttr": true,
  521 + "type": "String"
  522 + }
  523 + ]
  524 + },
  525 + {
  526 + "name": "TaskPriorized",
  527 + "extends": [
  528 + "bpmn:Process",
  529 + "activiti:ExternalCapable"
  530 + ],
  531 + "properties": [
  532 + {
  533 + "name": "taskPriority",
  534 + "isAttr": true,
  535 + "type": "String"
  536 + }
  537 + ]
  538 + },
  539 + {
  540 + "name": "Properties",
  541 + "superClass": [
  542 + "Element"
  543 + ],
  544 + "meta": {
  545 + "allowedIn": [ "*" ]
  546 + },
  547 + "properties": [
  548 + {
  549 + "name": "values",
  550 + "type": "Property",
  551 + "isMany": true
  552 + }
  553 + ]
  554 + },
  555 + {
  556 + "name": "Property",
  557 + "superClass": [
  558 + "Element"
  559 + ],
  560 + "properties": [
  561 + {
  562 + "name": "id",
  563 + "type": "String",
  564 + "isAttr": true
  565 + },
  566 + {
  567 + "name": "name",
  568 + "type": "String",
  569 + "isAttr": true
  570 + },
  571 + {
  572 + "name": "value",
  573 + "type": "String",
  574 + "isAttr": true
  575 + }
  576 + ]
  577 + },
  578 + {
  579 + "name": "Connector",
  580 + "superClass": [
  581 + "Element"
  582 + ],
  583 + "meta": {
  584 + "allowedIn": [
  585 + "activiti:ServiceTaskLike"
  586 + ]
  587 + },
  588 + "properties": [
  589 + {
  590 + "name": "inputOutput",
  591 + "type": "InputOutput"
  592 + },
  593 + {
  594 + "name": "connectorId",
  595 + "type": "String"
  596 + }
  597 + ]
  598 + },
  599 + {
  600 + "name": "InputOutput",
  601 + "superClass": [
  602 + "Element"
  603 + ],
  604 + "meta": {
  605 + "allowedIn": [
  606 + "bpmn:FlowNode",
  607 + "activiti:Connector"
  608 + ]
  609 + },
  610 + "properties": [
  611 + {
  612 + "name": "inputOutput",
  613 + "type": "InputOutput"
  614 + },
  615 + {
  616 + "name": "connectorId",
  617 + "type": "String"
  618 + },
  619 + {
  620 + "name": "inputParameters",
  621 + "isMany": true,
  622 + "type": "InputParameter"
  623 + },
  624 + {
  625 + "name": "outputParameters",
  626 + "isMany": true,
  627 + "type": "OutputParameter"
  628 + }
  629 + ]
  630 + },
  631 + {
  632 + "name": "InputOutputParameter",
  633 + "properties": [
  634 + {
  635 + "name": "name",
  636 + "isAttr": true,
  637 + "type": "String"
  638 + },
  639 + {
  640 + "name": "value",
  641 + "isBody": true,
  642 + "type": "String"
  643 + },
  644 + {
  645 + "name": "definition",
  646 + "type": "InputOutputParameterDefinition"
  647 + }
  648 + ]
  649 + },
  650 + {
  651 + "name": "InputOutputParameterDefinition",
  652 + "isAbstract": true
  653 + },
  654 + {
  655 + "name": "List",
  656 + "superClass": [ "InputOutputParameterDefinition" ],
  657 + "properties": [
  658 + {
  659 + "name": "items",
  660 + "isMany": true,
  661 + "type": "InputOutputParameterDefinition"
  662 + }
  663 + ]
  664 + },
  665 + {
  666 + "name": "Map",
  667 + "superClass": [ "InputOutputParameterDefinition" ],
  668 + "properties": [
  669 + {
  670 + "name": "entries",
  671 + "isMany": true,
  672 + "type": "Entry"
  673 + }
  674 + ]
  675 + },
  676 + {
  677 + "name": "Entry",
  678 + "properties": [
  679 + {
  680 + "name": "key",
  681 + "isAttr": true,
  682 + "type": "String"
  683 + },
  684 + {
  685 + "name": "value",
  686 + "isBody": true,
  687 + "type": "String"
  688 + },
  689 + {
  690 + "name": "definition",
  691 + "type": "InputOutputParameterDefinition"
  692 + }
  693 + ]
  694 + },
  695 + {
  696 + "name": "Value",
  697 + "superClass": [
  698 + "InputOutputParameterDefinition"
  699 + ],
  700 + "properties": [
  701 + {
  702 + "name": "id",
  703 + "isAttr": true,
  704 + "type": "String"
  705 + },
  706 + {
  707 + "name": "name",
  708 + "isAttr": true,
  709 + "type": "String"
  710 + },
  711 + {
  712 + "name": "value",
  713 + "isBody": true,
  714 + "type": "String"
  715 + }
  716 + ]
  717 + },
  718 + {
  719 + "name": "Script",
  720 + "superClass": [ "InputOutputParameterDefinition" ],
  721 + "properties": [
  722 + {
  723 + "name": "scriptFormat",
  724 + "isAttr": true,
  725 + "type": "String"
  726 + },
  727 + {
  728 + "name": "resource",
  729 + "isAttr": true,
  730 + "type": "String"
  731 + },
  732 + {
  733 + "name": "value",
  734 + "isBody": true,
  735 + "type": "String"
  736 + }
  737 + ]
  738 + },
  739 + {
  740 + "name": "Field",
  741 + "superClass": [ "Element" ],
  742 + "meta": {
  743 + "allowedIn": [
  744 + "activiti:ServiceTaskLike",
  745 + "activiti:ExecutionListener",
  746 + "activiti:TaskListener"
  747 + ]
  748 + },
  749 + "properties": [
  750 + {
  751 + "name": "name",
  752 + "isAttr": true,
  753 + "type": "String"
  754 + },
  755 + {
  756 + "name": "expression",
  757 + "type": "String"
  758 + },
  759 + {
  760 + "name": "stringValue",
  761 + "isAttr": true,
  762 + "type": "String"
  763 + },
  764 + {
  765 + "name": "string",
  766 + "type": "String"
  767 + }
  768 + ]
  769 + },
  770 + {
  771 + "name": "InputParameter",
  772 + "superClass": [ "InputOutputParameter" ]
  773 + },
  774 + {
  775 + "name": "OutputParameter",
  776 + "superClass": [ "InputOutputParameter" ]
  777 + },
  778 + {
  779 + "name": "Collectable",
  780 + "isAbstract": true,
  781 + "extends": [ "bpmn:MultiInstanceLoopCharacteristics" ],
  782 + "superClass": [ "activiti:AsyncCapable" ],
  783 + "properties": [
  784 + {
  785 + "name": "collection",
  786 + "isAttr": true,
  787 + "type": "String"
  788 + },
  789 + {
  790 + "name": "elementVariable",
  791 + "isAttr": true,
  792 + "type": "String"
  793 + }
  794 + ]
  795 + },
  796 + {
  797 + "name": "FailedJobRetryTimeCycle",
  798 + "superClass": [ "Element" ],
  799 + "meta": {
  800 + "allowedIn": [
  801 + "activiti:AsyncCapable",
  802 + "bpmn:MultiInstanceLoopCharacteristics"
  803 + ]
  804 + },
  805 + "properties": [
  806 + {
  807 + "name": "body",
  808 + "isBody": true,
  809 + "type": "String"
  810 + }
  811 + ]
  812 + },
  813 + {
  814 + "name": "ExecutionListener",
  815 + "superClass": [ "Element" ],
  816 + "meta": {
  817 + "allowedIn": [
  818 + "bpmn:Task",
  819 + "bpmn:ServiceTask",
  820 + "bpmn:UserTask",
  821 + "bpmn:BusinessRuleTask",
  822 + "bpmn:ScriptTask",
  823 + "bpmn:ReceiveTask",
  824 + "bpmn:ManualTask",
  825 + "bpmn:ExclusiveGateway",
  826 + "bpmn:SequenceFlow",
  827 + "bpmn:ParallelGateway",
  828 + "bpmn:InclusiveGateway",
  829 + "bpmn:EventBasedGateway",
  830 + "bpmn:StartEvent",
  831 + "bpmn:IntermediateCatchEvent",
  832 + "bpmn:IntermediateThrowEvent",
  833 + "bpmn:EndEvent",
  834 + "bpmn:BoundaryEvent",
  835 + "bpmn:CallActivity",
  836 + "bpmn:SubProcess",
  837 + "bpmn:Process"
  838 + ]
  839 + },
  840 + "properties": [
  841 + {
  842 + "name": "expression",
  843 + "isAttr": true,
  844 + "type": "String"
  845 + },
  846 + {
  847 + "name": "class",
  848 + "isAttr": true,
  849 + "type": "String"
  850 + },
  851 + {
  852 + "name": "delegateExpression",
  853 + "isAttr": true,
  854 + "type": "String"
  855 + },
  856 + {
  857 + "name": "event",
  858 + "isAttr": true,
  859 + "type": "String"
  860 + },
  861 + {
  862 + "name": "script",
  863 + "type": "Script"
  864 + },
  865 + {
  866 + "name": "fields",
  867 + "type": "Field",
  868 + "isMany": true
  869 + }
  870 + ]
  871 + },
  872 + {
  873 + "name": "TaskListener",
  874 + "superClass": [ "Element" ],
  875 + "meta": {
  876 + "allowedIn": [
  877 + "bpmn:UserTask"
  878 + ]
  879 + },
  880 + "properties": [
  881 + {
  882 + "name": "expression",
  883 + "isAttr": true,
  884 + "type": "String"
  885 + },
  886 + {
  887 + "name": "class",
  888 + "isAttr": true,
  889 + "type": "String"
  890 + },
  891 + {
  892 + "name": "delegateExpression",
  893 + "isAttr": true,
  894 + "type": "String"
  895 + },
  896 + {
  897 + "name": "event",
  898 + "isAttr": true,
  899 + "type": "String"
  900 + },
  901 + {
  902 + "name": "script",
  903 + "type": "Script"
  904 + },
  905 + {
  906 + "name": "fields",
  907 + "type": "Field",
  908 + "isMany": true
  909 + }
  910 + ]
  911 + },
  912 + {
  913 + "name": "FormProperty",
  914 + "superClass": [ "Element" ],
  915 + "meta": {
  916 + "allowedIn": [
  917 + "bpmn:StartEvent",
  918 + "bpmn:UserTask"
  919 + ]
  920 + },
  921 + "properties": [
  922 + {
  923 + "name": "id",
  924 + "type": "String",
  925 + "isAttr": true
  926 + },
  927 + {
  928 + "name": "name",
  929 + "type": "String",
  930 + "isAttr": true
  931 + },
  932 + {
  933 + "name": "type",
  934 + "type": "String",
  935 + "isAttr": true
  936 + },
  937 + {
  938 + "name": "required",
  939 + "type": "String",
  940 + "isAttr": true
  941 + },
  942 + {
  943 + "name": "readable",
  944 + "type": "String",
  945 + "isAttr": true
  946 + },
  947 + {
  948 + "name": "writable",
  949 + "type": "String",
  950 + "isAttr": true
  951 + },
  952 + {
  953 + "name": "variable",
  954 + "type": "String",
  955 + "isAttr": true
  956 + },
  957 + {
  958 + "name": "expression",
  959 + "type": "String",
  960 + "isAttr": true
  961 + },
  962 + {
  963 + "name": "datePattern",
  964 + "type": "String",
  965 + "isAttr": true
  966 + },
  967 + {
  968 + "name": "default",
  969 + "type": "String",
  970 + "isAttr": true
  971 + },
  972 + {
  973 + "name": "values",
  974 + "type": "Value",
  975 + "isMany": true
  976 + }
  977 + ]
  978 + },
  979 + {
  980 + "name": "FormProperty",
  981 + "superClass": [ "Element" ],
  982 + "properties": [
  983 + {
  984 + "name": "id",
  985 + "type": "String",
  986 + "isAttr": true
  987 + },
  988 + {
  989 + "name": "label",
  990 + "type": "String",
  991 + "isAttr": true
  992 + },
  993 + {
  994 + "name": "type",
  995 + "type": "String",
  996 + "isAttr": true
  997 + },
  998 + {
  999 + "name": "datePattern",
  1000 + "type": "String",
  1001 + "isAttr": true
  1002 + },
  1003 + {
  1004 + "name": "defaultValue",
  1005 + "type": "String",
  1006 + "isAttr": true
  1007 + },
  1008 + {
  1009 + "name": "properties",
  1010 + "type": "Properties"
  1011 + },
  1012 + {
  1013 + "name": "validation",
  1014 + "type": "Validation"
  1015 + },
  1016 + {
  1017 + "name": "values",
  1018 + "type": "Value",
  1019 + "isMany": true
  1020 + }
  1021 + ]
  1022 + },
  1023 + {
  1024 + "name": "Validation",
  1025 + "superClass": [ "Element" ],
  1026 + "properties": [
  1027 + {
  1028 + "name": "constraints",
  1029 + "type": "Constraint",
  1030 + "isMany": true
  1031 + }
  1032 + ]
  1033 + },
  1034 + {
  1035 + "name": "Constraint",
  1036 + "superClass": [ "Element" ],
  1037 + "properties": [
  1038 + {
  1039 + "name": "name",
  1040 + "type": "String",
  1041 + "isAttr": true
  1042 + },
  1043 + {
  1044 + "name": "config",
  1045 + "type": "String",
  1046 + "isAttr": true
  1047 + }
  1048 + ]
  1049 + },
  1050 + {
  1051 + "name": "ConditionalEventDefinition",
  1052 + "isAbstract": true,
  1053 + "extends": [
  1054 + "bpmn:ConditionalEventDefinition"
  1055 + ],
  1056 + "properties": [
  1057 + {
  1058 + "name": "variableName",
  1059 + "isAttr": true,
  1060 + "type": "String"
  1061 + },
  1062 + {
  1063 + "name": "variableEvent",
  1064 + "isAttr": true,
  1065 + "type": "String"
  1066 + }
  1067 + ]
  1068 + }
  1069 + ],
  1070 + "emumerations": [ ]
  1071 +}
yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/camundaDescriptor.json 0 → 100644
  1 +{
  2 + "name": "Camunda",
  3 + "uri": "http://camunda.org/schema/1.0/bpmn",
  4 + "prefix": "camunda",
  5 + "xml": {
  6 + "tagAlias": "lowerCase"
  7 + },
  8 + "associations": [],
  9 + "types": [
  10 + {
  11 + "name": "Definitions",
  12 + "isAbstract": true,
  13 + "extends": [
  14 + "bpmn:Definitions"
  15 + ],
  16 + "properties": [
  17 + {
  18 + "name": "diagramRelationId",
  19 + "isAttr": true,
  20 + "type": "String"
  21 + }
  22 + ]
  23 + },
  24 + {
  25 + "name": "InOutBinding",
  26 + "superClass": [
  27 + "Element"
  28 + ],
  29 + "isAbstract": true,
  30 + "properties": [
  31 + {
  32 + "name": "source",
  33 + "isAttr": true,
  34 + "type": "String"
  35 + },
  36 + {
  37 + "name": "sourceExpression",
  38 + "isAttr": true,
  39 + "type": "String"
  40 + },
  41 + {
  42 + "name": "target",
  43 + "isAttr": true,
  44 + "type": "String"
  45 + },
  46 + {
  47 + "name": "businessKey",
  48 + "isAttr": true,
  49 + "type": "String"
  50 + },
  51 + {
  52 + "name": "local",
  53 + "isAttr": true,
  54 + "type": "Boolean",
  55 + "default": false
  56 + },
  57 + {
  58 + "name": "variables",
  59 + "isAttr": true,
  60 + "type": "String"
  61 + }
  62 + ]
  63 + },
  64 + {
  65 + "name": "In",
  66 + "superClass": [
  67 + "InOutBinding"
  68 + ],
  69 + "meta": {
  70 + "allowedIn": [
  71 + "bpmn:CallActivity",
  72 + "bpmn:SignalEventDefinition"
  73 + ]
  74 + }
  75 + },
  76 + {
  77 + "name": "Out",
  78 + "superClass": [
  79 + "InOutBinding"
  80 + ],
  81 + "meta": {
  82 + "allowedIn": [
  83 + "bpmn:CallActivity"
  84 + ]
  85 + }
  86 + },
  87 + {
  88 + "name": "AsyncCapable",
  89 + "isAbstract": true,
  90 + "extends": [
  91 + "bpmn:Activity",
  92 + "bpmn:Gateway",
  93 + "bpmn:Event"
  94 + ],
  95 + "properties": [
  96 + {
  97 + "name": "async",
  98 + "isAttr": true,
  99 + "type": "Boolean",
  100 + "default": false
  101 + },
  102 + {
  103 + "name": "asyncBefore",
  104 + "isAttr": true,
  105 + "type": "Boolean",
  106 + "default": false
  107 + },
  108 + {
  109 + "name": "asyncAfter",
  110 + "isAttr": true,
  111 + "type": "Boolean",
  112 + "default": false
  113 + },
  114 + {
  115 + "name": "exclusive",
  116 + "isAttr": true,
  117 + "type": "Boolean",
  118 + "default": true
  119 + }
  120 + ]
  121 + },
  122 + {
  123 + "name": "JobPriorized",
  124 + "isAbstract": true,
  125 + "extends": [
  126 + "bpmn:Process",
  127 + "camunda:AsyncCapable"
  128 + ],
  129 + "properties": [
  130 + {
  131 + "name": "jobPriority",
  132 + "isAttr": true,
  133 + "type": "String"
  134 + }
  135 + ]
  136 + },
  137 + {
  138 + "name": "SignalEventDefinition",
  139 + "isAbstract": true,
  140 + "extends": [
  141 + "bpmn:SignalEventDefinition"
  142 + ],
  143 + "properties": [
  144 + {
  145 + "name": "async",
  146 + "isAttr": true,
  147 + "type": "Boolean",
  148 + "default": false
  149 + }
  150 + ]
  151 + },
  152 + {
  153 + "name": "ErrorEventDefinition",
  154 + "isAbstract": true,
  155 + "extends": [
  156 + "bpmn:ErrorEventDefinition"
  157 + ],
  158 + "properties": [
  159 + {
  160 + "name": "errorCodeVariable",
  161 + "isAttr": true,
  162 + "type": "String"
  163 + },
  164 + {
  165 + "name": "errorMessageVariable",
  166 + "isAttr": true,
  167 + "type": "String"
  168 + }
  169 + ]
  170 + },
  171 + {
  172 + "name": "Error",
  173 + "isAbstract": true,
  174 + "extends": [
  175 + "bpmn:Error"
  176 + ],
  177 + "properties": [
  178 + {
  179 + "name": "camunda:errorMessage",
  180 + "isAttr": true,
  181 + "type": "String"
  182 + }
  183 + ]
  184 + },
  185 + {
  186 + "name": "PotentialStarter",
  187 + "superClass": [
  188 + "Element"
  189 + ],
  190 + "properties": [
  191 + {
  192 + "name": "resourceAssignmentExpression",
  193 + "type": "bpmn:ResourceAssignmentExpression"
  194 + }
  195 + ]
  196 + },
  197 + {
  198 + "name": "FormSupported",
  199 + "isAbstract": true,
  200 + "extends": [
  201 + "bpmn:StartEvent",
  202 + "bpmn:UserTask"
  203 + ],
  204 + "properties": [
  205 + {
  206 + "name": "formHandlerClass",
  207 + "isAttr": true,
  208 + "type": "String"
  209 + },
  210 + {
  211 + "name": "formKey",
  212 + "isAttr": true,
  213 + "type": "String"
  214 + }
  215 + ]
  216 + },
  217 + {
  218 + "name": "TemplateSupported",
  219 + "isAbstract": true,
  220 + "extends": [
  221 + "bpmn:Process",
  222 + "bpmn:FlowElement"
  223 + ],
  224 + "properties": [
  225 + {
  226 + "name": "modelerTemplate",
  227 + "isAttr": true,
  228 + "type": "String"
  229 + },
  230 + {
  231 + "name": "modelerTemplateVersion",
  232 + "isAttr": true,
  233 + "type": "Integer"
  234 + }
  235 + ]
  236 + },
  237 + {
  238 + "name": "Initiator",
  239 + "isAbstract": true,
  240 + "extends": [ "bpmn:StartEvent" ],
  241 + "properties": [
  242 + {
  243 + "name": "initiator",
  244 + "isAttr": true,
  245 + "type": "String"
  246 + }
  247 + ]
  248 + },
  249 + {
  250 + "name": "ScriptTask",
  251 + "isAbstract": true,
  252 + "extends": [
  253 + "bpmn:ScriptTask"
  254 + ],
  255 + "properties": [
  256 + {
  257 + "name": "resultVariable",
  258 + "isAttr": true,
  259 + "type": "String"
  260 + },
  261 + {
  262 + "name": "resource",
  263 + "isAttr": true,
  264 + "type": "String"
  265 + }
  266 + ]
  267 + },
  268 + {
  269 + "name": "Process",
  270 + "isAbstract": true,
  271 + "extends": [
  272 + "bpmn:Process"
  273 + ],
  274 + "properties": [
  275 + {
  276 + "name": "candidateStarterGroups",
  277 + "isAttr": true,
  278 + "type": "String"
  279 + },
  280 + {
  281 + "name": "candidateStarterUsers",
  282 + "isAttr": true,
  283 + "type": "String"
  284 + },
  285 + {
  286 + "name": "versionTag",
  287 + "isAttr": true,
  288 + "type": "String"
  289 + },
  290 + {
  291 + "name": "historyTimeToLive",
  292 + "isAttr": true,
  293 + "type": "String"
  294 + },
  295 + {
  296 + "name": "isStartableInTasklist",
  297 + "isAttr": true,
  298 + "type": "Boolean",
  299 + "default": true
  300 + }
  301 + ]
  302 + },
  303 + {
  304 + "name": "EscalationEventDefinition",
  305 + "isAbstract": true,
  306 + "extends": [
  307 + "bpmn:EscalationEventDefinition"
  308 + ],
  309 + "properties": [
  310 + {
  311 + "name": "escalationCodeVariable",
  312 + "isAttr": true,
  313 + "type": "String"
  314 + }
  315 + ]
  316 + },
  317 + {
  318 + "name": "FormalExpression",
  319 + "isAbstract": true,
  320 + "extends": [
  321 + "bpmn:FormalExpression"
  322 + ],
  323 + "properties": [
  324 + {
  325 + "name": "resource",
  326 + "isAttr": true,
  327 + "type": "String"
  328 + }
  329 + ]
  330 + },
  331 + {
  332 + "name": "Assignable",
  333 + "extends": [ "bpmn:UserTask" ],
  334 + "properties": [
  335 + {
  336 + "name": "assignee",
  337 + "isAttr": true,
  338 + "type": "String"
  339 + },
  340 + {
  341 + "name": "candidateUsers",
  342 + "isAttr": true,
  343 + "type": "String"
  344 + },
  345 + {
  346 + "name": "candidateGroups",
  347 + "isAttr": true,
  348 + "type": "String"
  349 + },
  350 + {
  351 + "name": "dueDate",
  352 + "isAttr": true,
  353 + "type": "String"
  354 + },
  355 + {
  356 + "name": "followUpDate",
  357 + "isAttr": true,
  358 + "type": "String"
  359 + },
  360 + {
  361 + "name": "priority",
  362 + "isAttr": true,
  363 + "type": "String"
  364 + }
  365 + ]
  366 + },
  367 + {
  368 + "name": "CallActivity",
  369 + "extends": [ "bpmn:CallActivity" ],
  370 + "properties": [
  371 + {
  372 + "name": "calledElementBinding",
  373 + "isAttr": true,
  374 + "type": "String",
  375 + "default": "latest"
  376 + },
  377 + {
  378 + "name": "calledElementVersion",
  379 + "isAttr": true,
  380 + "type": "String"
  381 + },
  382 + {
  383 + "name": "calledElementVersionTag",
  384 + "isAttr": true,
  385 + "type": "String"
  386 + },
  387 + {
  388 + "name": "calledElementTenantId",
  389 + "isAttr": true,
  390 + "type": "String"
  391 + },
  392 + {
  393 + "name": "caseRef",
  394 + "isAttr": true,
  395 + "type": "String"
  396 + },
  397 + {
  398 + "name": "caseBinding",
  399 + "isAttr": true,
  400 + "type": "String",
  401 + "default": "latest"
  402 + },
  403 + {
  404 + "name": "caseVersion",
  405 + "isAttr": true,
  406 + "type": "String"
  407 + },
  408 + {
  409 + "name": "caseTenantId",
  410 + "isAttr": true,
  411 + "type": "String"
  412 + },
  413 + {
  414 + "name": "variableMappingClass",
  415 + "isAttr": true,
  416 + "type": "String"
  417 + },
  418 + {
  419 + "name": "variableMappingDelegateExpression",
  420 + "isAttr": true,
  421 + "type": "String"
  422 + }
  423 + ]
  424 + },
  425 + {
  426 + "name": "ServiceTaskLike",
  427 + "extends": [
  428 + "bpmn:ServiceTask",
  429 + "bpmn:BusinessRuleTask",
  430 + "bpmn:SendTask",
  431 + "bpmn:MessageEventDefinition"
  432 + ],
  433 + "properties": [
  434 + {
  435 + "name": "expression",
  436 + "isAttr": true,
  437 + "type": "String"
  438 + },
  439 + {
  440 + "name": "class",
  441 + "isAttr": true,
  442 + "type": "String"
  443 + },
  444 + {
  445 + "name": "delegateExpression",
  446 + "isAttr": true,
  447 + "type": "String"
  448 + },
  449 + {
  450 + "name": "resultVariable",
  451 + "isAttr": true,
  452 + "type": "String"
  453 + }
  454 + ]
  455 + },
  456 + {
  457 + "name": "DmnCapable",
  458 + "extends": [
  459 + "bpmn:BusinessRuleTask"
  460 + ],
  461 + "properties": [
  462 + {
  463 + "name": "decisionRef",
  464 + "isAttr": true,
  465 + "type": "String"
  466 + },
  467 + {
  468 + "name": "decisionRefBinding",
  469 + "isAttr": true,
  470 + "type": "String",
  471 + "default": "latest"
  472 + },
  473 + {
  474 + "name": "decisionRefVersion",
  475 + "isAttr": true,
  476 + "type": "String"
  477 + },
  478 + {
  479 + "name": "mapDecisionResult",
  480 + "isAttr": true,
  481 + "type": "String",
  482 + "default": "resultList"
  483 + },
  484 + {
  485 + "name": "decisionRefTenantId",
  486 + "isAttr": true,
  487 + "type": "String"
  488 + }
  489 + ]
  490 + },
  491 + {
  492 + "name": "ExternalCapable",
  493 + "extends": [
  494 + "camunda:ServiceTaskLike"
  495 + ],
  496 + "properties": [
  497 + {
  498 + "name": "type",
  499 + "isAttr": true,
  500 + "type": "String"
  501 + },
  502 + {
  503 + "name": "topic",
  504 + "isAttr": true,
  505 + "type": "String"
  506 + }
  507 + ]
  508 + },
  509 + {
  510 + "name": "TaskPriorized",
  511 + "extends": [
  512 + "bpmn:Process",
  513 + "camunda:ExternalCapable"
  514 + ],
  515 + "properties": [
  516 + {
  517 + "name": "taskPriority",
  518 + "isAttr": true,
  519 + "type": "String"
  520 + }
  521 + ]
  522 + },
  523 + {
  524 + "name": "Properties",
  525 + "superClass": [
  526 + "Element"
  527 + ],
  528 + "meta": {
  529 + "allowedIn": [ "*" ]
  530 + },
  531 + "properties": [
  532 + {
  533 + "name": "values",
  534 + "type": "Property",
  535 + "isMany": true
  536 + }
  537 + ]
  538 + },
  539 + {
  540 + "name": "Property",
  541 + "superClass": [
  542 + "Element"
  543 + ],
  544 + "properties": [
  545 + {
  546 + "name": "id",
  547 + "type": "String",
  548 + "isAttr": true
  549 + },
  550 + {
  551 + "name": "name",
  552 + "type": "String",
  553 + "isAttr": true
  554 + },
  555 + {
  556 + "name": "value",
  557 + "type": "String",
  558 + "isAttr": true
  559 + }
  560 + ]
  561 + },
  562 + {
  563 + "name": "Connector",
  564 + "superClass": [
  565 + "Element"
  566 + ],
  567 + "meta": {
  568 + "allowedIn": [
  569 + "camunda:ServiceTaskLike"
  570 + ]
  571 + },
  572 + "properties": [
  573 + {
  574 + "name": "inputOutput",
  575 + "type": "InputOutput"
  576 + },
  577 + {
  578 + "name": "connectorId",
  579 + "type": "String"
  580 + }
  581 + ]
  582 + },
  583 + {
  584 + "name": "InputOutput",
  585 + "superClass": [
  586 + "Element"
  587 + ],
  588 + "meta": {
  589 + "allowedIn": [
  590 + "bpmn:FlowNode",
  591 + "camunda:Connector"
  592 + ]
  593 + },
  594 + "properties": [
  595 + {
  596 + "name": "inputOutput",
  597 + "type": "InputOutput"
  598 + },
  599 + {
  600 + "name": "connectorId",
  601 + "type": "String"
  602 + },
  603 + {
  604 + "name": "inputParameters",
  605 + "isMany": true,
  606 + "type": "InputParameter"
  607 + },
  608 + {
  609 + "name": "outputParameters",
  610 + "isMany": true,
  611 + "type": "OutputParameter"
  612 + }
  613 + ]
  614 + },
  615 + {
  616 + "name": "InputOutputParameter",
  617 + "properties": [
  618 + {
  619 + "name": "name",
  620 + "isAttr": true,
  621 + "type": "String"
  622 + },
  623 + {
  624 + "name": "value",
  625 + "isBody": true,
  626 + "type": "String"
  627 + },
  628 + {
  629 + "name": "definition",
  630 + "type": "InputOutputParameterDefinition"
  631 + }
  632 + ]
  633 + },
  634 + {
  635 + "name": "InputOutputParameterDefinition",
  636 + "isAbstract": true
  637 + },
  638 + {
  639 + "name": "List",
  640 + "superClass": [ "InputOutputParameterDefinition" ],
  641 + "properties": [
  642 + {
  643 + "name": "items",
  644 + "isMany": true,
  645 + "type": "InputOutputParameterDefinition"
  646 + }
  647 + ]
  648 + },
  649 + {
  650 + "name": "Map",
  651 + "superClass": [ "InputOutputParameterDefinition" ],
  652 + "properties": [
  653 + {
  654 + "name": "entries",
  655 + "isMany": true,
  656 + "type": "Entry"
  657 + }
  658 + ]
  659 + },
  660 + {
  661 + "name": "Entry",
  662 + "properties": [
  663 + {
  664 + "name": "key",
  665 + "isAttr": true,
  666 + "type": "String"
  667 + },
  668 + {
  669 + "name": "value",
  670 + "isBody": true,
  671 + "type": "String"
  672 + },
  673 + {
  674 + "name": "definition",
  675 + "type": "InputOutputParameterDefinition"
  676 + }
  677 + ]
  678 + },
  679 + {
  680 + "name": "Value",
  681 + "superClass": [
  682 + "InputOutputParameterDefinition"
  683 + ],
  684 + "properties": [
  685 + {
  686 + "name": "id",
  687 + "isAttr": true,
  688 + "type": "String"
  689 + },
  690 + {
  691 + "name": "name",
  692 + "isAttr": true,
  693 + "type": "String"
  694 + },
  695 + {
  696 + "name": "value",
  697 + "isBody": true,
  698 + "type": "String"
  699 + }
  700 + ]
  701 + },
  702 + {
  703 + "name": "Script",
  704 + "superClass": [ "InputOutputParameterDefinition" ],
  705 + "properties": [
  706 + {
  707 + "name": "scriptFormat",
  708 + "isAttr": true,
  709 + "type": "String"
  710 + },
  711 + {
  712 + "name": "resource",
  713 + "isAttr": true,
  714 + "type": "String"
  715 + },
  716 + {
  717 + "name": "value",
  718 + "isBody": true,
  719 + "type": "String"
  720 + }
  721 + ]
  722 + },
  723 + {
  724 + "name": "Field",
  725 + "superClass": [ "Element" ],
  726 + "meta": {
  727 + "allowedIn": [
  728 + "camunda:ServiceTaskLike",
  729 + "camunda:ExecutionListener",
  730 + "camunda:TaskListener"
  731 + ]
  732 + },
  733 + "properties": [
  734 + {
  735 + "name": "name",
  736 + "isAttr": true,
  737 + "type": "String"
  738 + },
  739 + {
  740 + "name": "expression",
  741 + "type": "String"
  742 + },
  743 + {
  744 + "name": "stringValue",
  745 + "isAttr": true,
  746 + "type": "String"
  747 + },
  748 + {
  749 + "name": "string",
  750 + "type": "String"
  751 + }
  752 + ]
  753 + },
  754 + {
  755 + "name": "InputParameter",
  756 + "superClass": [ "InputOutputParameter" ]
  757 + },
  758 + {
  759 + "name": "OutputParameter",
  760 + "superClass": [ "InputOutputParameter" ]
  761 + },
  762 + {
  763 + "name": "Collectable",
  764 + "isAbstract": true,
  765 + "extends": [ "bpmn:MultiInstanceLoopCharacteristics" ],
  766 + "superClass": [ "camunda:AsyncCapable" ],
  767 + "properties": [
  768 + {
  769 + "name": "collection",
  770 + "isAttr": true,
  771 + "type": "String"
  772 + },
  773 + {
  774 + "name": "elementVariable",
  775 + "isAttr": true,
  776 + "type": "String"
  777 + }
  778 + ]
  779 + },
  780 + {
  781 + "name": "FailedJobRetryTimeCycle",
  782 + "superClass": [ "Element" ],
  783 + "meta": {
  784 + "allowedIn": [
  785 + "camunda:AsyncCapable",
  786 + "bpmn:MultiInstanceLoopCharacteristics"
  787 + ]
  788 + },
  789 + "properties": [
  790 + {
  791 + "name": "body",
  792 + "isBody": true,
  793 + "type": "String"
  794 + }
  795 + ]
  796 + },
  797 + {
  798 + "name": "ExecutionListener",
  799 + "superClass": [ "Element" ],
  800 + "meta": {
  801 + "allowedIn": [
  802 + "bpmn:Task",
  803 + "bpmn:ServiceTask",
  804 + "bpmn:UserTask",
  805 + "bpmn:BusinessRuleTask",
  806 + "bpmn:ScriptTask",
  807 + "bpmn:ReceiveTask",
  808 + "bpmn:ManualTask",
  809 + "bpmn:ExclusiveGateway",
  810 + "bpmn:SequenceFlow",
  811 + "bpmn:ParallelGateway",
  812 + "bpmn:InclusiveGateway",
  813 + "bpmn:EventBasedGateway",
  814 + "bpmn:StartEvent",
  815 + "bpmn:IntermediateCatchEvent",
  816 + "bpmn:IntermediateThrowEvent",
  817 + "bpmn:EndEvent",
  818 + "bpmn:BoundaryEvent",
  819 + "bpmn:CallActivity",
  820 + "bpmn:SubProcess",
  821 + "bpmn:Process"
  822 + ]
  823 + },
  824 + "properties": [
  825 + {
  826 + "name": "expression",
  827 + "isAttr": true,
  828 + "type": "String"
  829 + },
  830 + {
  831 + "name": "class",
  832 + "isAttr": true,
  833 + "type": "String"
  834 + },
  835 + {
  836 + "name": "delegateExpression",
  837 + "isAttr": true,
  838 + "type": "String"
  839 + },
  840 + {
  841 + "name": "event",
  842 + "isAttr": true,
  843 + "type": "String"
  844 + },
  845 + {
  846 + "name": "script",
  847 + "type": "Script"
  848 + },
  849 + {
  850 + "name": "fields",
  851 + "type": "Field",
  852 + "isMany": true
  853 + }
  854 + ]
  855 + },
  856 + {
  857 + "name": "TaskListener",
  858 + "superClass": [ "Element" ],
  859 + "meta": {
  860 + "allowedIn": [
  861 + "bpmn:UserTask"
  862 + ]
  863 + },
  864 + "properties": [
  865 + {
  866 + "name": "expression",
  867 + "isAttr": true,
  868 + "type": "String"
  869 + },
  870 + {
  871 + "name": "class",
  872 + "isAttr": true,
  873 + "type": "String"
  874 + },
  875 + {
  876 + "name": "delegateExpression",
  877 + "isAttr": true,
  878 + "type": "String"
  879 + },
  880 + {
  881 + "name": "event",
  882 + "isAttr": true,
  883 + "type": "String"
  884 + },
  885 + {
  886 + "name": "script",
  887 + "type": "Script"
  888 + },
  889 + {
  890 + "name": "fields",
  891 + "type": "Field",
  892 + "isMany": true
  893 + },
  894 + {
  895 + "name": "id",
  896 + "type": "String",
  897 + "isAttr": true
  898 + },
  899 + {
  900 + "name": "eventDefinitions",
  901 + "type": "bpmn:TimerEventDefinition",
  902 + "isMany": true
  903 + }
  904 + ]
  905 + },
  906 + {
  907 + "name": "FormProperty",
  908 + "superClass": [ "Element" ],
  909 + "meta": {
  910 + "allowedIn": [
  911 + "bpmn:StartEvent",
  912 + "bpmn:UserTask"
  913 + ]
  914 + },
  915 + "properties": [
  916 + {
  917 + "name": "id",
  918 + "type": "String",
  919 + "isAttr": true
  920 + },
  921 + {
  922 + "name": "name",
  923 + "type": "String",
  924 + "isAttr": true
  925 + },
  926 + {
  927 + "name": "type",
  928 + "type": "String",
  929 + "isAttr": true
  930 + },
  931 + {
  932 + "name": "required",
  933 + "type": "String",
  934 + "isAttr": true
  935 + },
  936 + {
  937 + "name": "readable",
  938 + "type": "String",
  939 + "isAttr": true
  940 + },
  941 + {
  942 + "name": "writable",
  943 + "type": "String",
  944 + "isAttr": true
  945 + },
  946 + {
  947 + "name": "variable",
  948 + "type": "String",
  949 + "isAttr": true
  950 + },
  951 + {
  952 + "name": "expression",
  953 + "type": "String",
  954 + "isAttr": true
  955 + },
  956 + {
  957 + "name": "datePattern",
  958 + "type": "String",
  959 + "isAttr": true
  960 + },
  961 + {
  962 + "name": "default",
  963 + "type": "String",
  964 + "isAttr": true
  965 + },
  966 + {
  967 + "name": "values",
  968 + "type": "Value",
  969 + "isMany": true
  970 + }
  971 + ]
  972 + },
  973 + {
  974 + "name": "FormData",
  975 + "superClass": [ "Element" ],
  976 + "meta": {
  977 + "allowedIn": [
  978 + "bpmn:StartEvent",
  979 + "bpmn:UserTask"
  980 + ]
  981 + },
  982 + "properties": [
  983 + {
  984 + "name": "fields",
  985 + "type": "FormField",
  986 + "isMany": true
  987 + },
  988 + {
  989 + "name": "businessKey",
  990 + "type": "String",
  991 + "isAttr": true
  992 + }
  993 + ]
  994 + },
  995 + {
  996 + "name": "FormField",
  997 + "superClass": [ "Element" ],
  998 + "properties": [
  999 + {
  1000 + "name": "id",
  1001 + "type": "String",
  1002 + "isAttr": true
  1003 + },
  1004 + {
  1005 + "name": "label",
  1006 + "type": "String",
  1007 + "isAttr": true
  1008 + },
  1009 + {
  1010 + "name": "type",
  1011 + "type": "String",
  1012 + "isAttr": true
  1013 + },
  1014 + {
  1015 + "name": "datePattern",
  1016 + "type": "String",
  1017 + "isAttr": true
  1018 + },
  1019 + {
  1020 + "name": "defaultValue",
  1021 + "type": "String",
  1022 + "isAttr": true
  1023 + },
  1024 + {
  1025 + "name": "properties",
  1026 + "type": "Properties"
  1027 + },
  1028 + {
  1029 + "name": "validation",
  1030 + "type": "Validation"
  1031 + },
  1032 + {
  1033 + "name": "values",
  1034 + "type": "Value",
  1035 + "isMany": true
  1036 + }
  1037 + ]
  1038 + },
  1039 + {
  1040 + "name": "Validation",
  1041 + "superClass": [ "Element" ],
  1042 + "properties": [
  1043 + {
  1044 + "name": "constraints",
  1045 + "type": "Constraint",
  1046 + "isMany": true
  1047 + }
  1048 + ]
  1049 + },
  1050 + {
  1051 + "name": "Constraint",
  1052 + "superClass": [ "Element" ],
  1053 + "properties": [
  1054 + {
  1055 + "name": "name",
  1056 + "type": "String",
  1057 + "isAttr": true
  1058 + },
  1059 + {
  1060 + "name": "config",
  1061 + "type": "String",
  1062 + "isAttr": true
  1063 + }
  1064 + ]
  1065 + },
  1066 + {
  1067 + "name": "ConditionalEventDefinition",
  1068 + "isAbstract": true,
  1069 + "extends": [
  1070 + "bpmn:ConditionalEventDefinition"
  1071 + ],
  1072 + "properties": [
  1073 + {
  1074 + "name": "variableName",
  1075 + "isAttr": true,
  1076 + "type": "String"
  1077 + },
  1078 + {
  1079 + "name": "variableEvents",
  1080 + "isAttr": true,
  1081 + "type": "String"
  1082 + }
  1083 + ]
  1084 + }
  1085 + ],
  1086 + "emumerations": [ ]
  1087 +}
yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/flowableDescriptor.json 0 → 100644
  1 +{
  2 + "name": "Flowable",
  3 + "uri": "http://flowable.org/bpmn",
  4 + "prefix": "flowable",
  5 + "xml": {
  6 + "tagAlias": "lowerCase"
  7 + },
  8 + "associations": [],
  9 + "types": [
  10 + {
  11 + "name": "InOutBinding",
  12 + "superClass": ["Element"],
  13 + "isAbstract": true,
  14 + "properties": [
  15 + {
  16 + "name": "source",
  17 + "isAttr": true,
  18 + "type": "String"
  19 + },
  20 + {
  21 + "name": "sourceExpression",
  22 + "isAttr": true,
  23 + "type": "String"
  24 + },
  25 + {
  26 + "name": "target",
  27 + "isAttr": true,
  28 + "type": "String"
  29 + },
  30 + {
  31 + "name": "businessKey",
  32 + "isAttr": true,
  33 + "type": "String"
  34 + },
  35 + {
  36 + "name": "local",
  37 + "isAttr": true,
  38 + "type": "Boolean",
  39 + "default": false
  40 + },
  41 + {
  42 + "name": "variables",
  43 + "isAttr": true,
  44 + "type": "String"
  45 + }
  46 + ]
  47 + },
  48 + {
  49 + "name": "In",
  50 + "superClass": ["InOutBinding"],
  51 + "meta": {
  52 + "allowedIn": ["bpmn:CallActivity"]
  53 + }
  54 + },
  55 + {
  56 + "name": "Out",
  57 + "superClass": ["InOutBinding"],
  58 + "meta": {
  59 + "allowedIn": ["bpmn:CallActivity"]
  60 + }
  61 + },
  62 + {
  63 + "name": "AsyncCapable",
  64 + "isAbstract": true,
  65 + "extends": ["bpmn:Activity", "bpmn:Gateway", "bpmn:Event"],
  66 + "properties": [
  67 + {
  68 + "name": "async",
  69 + "isAttr": true,
  70 + "type": "Boolean",
  71 + "default": false
  72 + },
  73 + {
  74 + "name": "asyncBefore",
  75 + "isAttr": true,
  76 + "type": "Boolean",
  77 + "default": false
  78 + },
  79 + {
  80 + "name": "asyncAfter",
  81 + "isAttr": true,
  82 + "type": "Boolean",
  83 + "default": false
  84 + },
  85 + {
  86 + "name": "exclusive",
  87 + "isAttr": true,
  88 + "type": "Boolean",
  89 + "default": true
  90 + }
  91 + ]
  92 + },
  93 + {
  94 + "name": "JobPriorized",
  95 + "isAbstract": true,
  96 + "extends": ["bpmn:Process", "flowable:AsyncCapable"],
  97 + "properties": [
  98 + {
  99 + "name": "jobPriority",
  100 + "isAttr": true,
  101 + "type": "String"
  102 + }
  103 + ]
  104 + },
  105 + {
  106 + "name": "SignalEventDefinition",
  107 + "isAbstract": true,
  108 + "extends": ["bpmn:SignalEventDefinition"],
  109 + "properties": [
  110 + {
  111 + "name": "async",
  112 + "isAttr": true,
  113 + "type": "Boolean",
  114 + "default": false
  115 + }
  116 + ]
  117 + },
  118 + {
  119 + "name": "ErrorEventDefinition",
  120 + "isAbstract": true,
  121 + "extends": ["bpmn:ErrorEventDefinition"],
  122 + "properties": [
  123 + {
  124 + "name": "errorCodeVariable",
  125 + "isAttr": true,
  126 + "type": "String"
  127 + },
  128 + {
  129 + "name": "errorMessageVariable",
  130 + "isAttr": true,
  131 + "type": "String"
  132 + }
  133 + ]
  134 + },
  135 + {
  136 + "name": "Error",
  137 + "isAbstract": true,
  138 + "extends": ["bpmn:Error"],
  139 + "properties": [
  140 + {
  141 + "name": "flowable:errorMessage",
  142 + "isAttr": true,
  143 + "type": "String"
  144 + }
  145 + ]
  146 + },
  147 + {
  148 + "name": "PotentialStarter",
  149 + "superClass": ["Element"],
  150 + "properties": [
  151 + {
  152 + "name": "resourceAssignmentExpression",
  153 + "type": "bpmn:ResourceAssignmentExpression"
  154 + }
  155 + ]
  156 + },
  157 + {
  158 + "name": "FormSupported",
  159 + "isAbstract": true,
  160 + "extends": ["bpmn:StartEvent", "bpmn:UserTask"],
  161 + "properties": [
  162 + {
  163 + "name": "formHandlerClass",
  164 + "isAttr": true,
  165 + "type": "String"
  166 + },
  167 + {
  168 + "name": "formKey",
  169 + "isAttr": true,
  170 + "type": "String"
  171 + },
  172 + {
  173 + "name": "formType",
  174 + "isAttr": true,
  175 + "type": "String"
  176 + },
  177 + {
  178 + "name": "formReadOnly",
  179 + "isAttr": true,
  180 + "type": "Boolean",
  181 + "default": false
  182 + },
  183 + {
  184 + "name": "formInit",
  185 + "isAttr": true,
  186 + "type": "Boolean",
  187 + "default": true
  188 + }
  189 + ]
  190 + },
  191 + {
  192 + "name": "TemplateSupported",
  193 + "isAbstract": true,
  194 + "extends": ["bpmn:Process", "bpmn:FlowElement"],
  195 + "properties": [
  196 + {
  197 + "name": "modelerTemplate",
  198 + "isAttr": true,
  199 + "type": "String"
  200 + }
  201 + ]
  202 + },
  203 + {
  204 + "name": "Initiator",
  205 + "isAbstract": true,
  206 + "extends": ["bpmn:StartEvent"],
  207 + "properties": [
  208 + {
  209 + "name": "initiator",
  210 + "isAttr": true,
  211 + "type": "String"
  212 + }
  213 + ]
  214 + },
  215 + {
  216 + "name": "ScriptTask",
  217 + "isAbstract": true,
  218 + "extends": ["bpmn:ScriptTask"],
  219 + "properties": [
  220 + {
  221 + "name": "resultVariable",
  222 + "isAttr": true,
  223 + "type": "String"
  224 + },
  225 + {
  226 + "name": "resource",
  227 + "isAttr": true,
  228 + "type": "String"
  229 + }
  230 + ]
  231 + },
  232 + {
  233 + "name": "Process",
  234 + "isAbstract": true,
  235 + "extends": ["bpmn:Process"],
  236 + "properties": [
  237 + {
  238 + "name": "candidateStarterGroups",
  239 + "isAttr": true,
  240 + "type": "String"
  241 + },
  242 + {
  243 + "name": "candidateStarterUsers",
  244 + "isAttr": true,
  245 + "type": "String"
  246 + },
  247 + {
  248 + "name": "versionTag",
  249 + "isAttr": true,
  250 + "type": "String"
  251 + },
  252 + {
  253 + "name": "historyTimeToLive",
  254 + "isAttr": true,
  255 + "type": "String"
  256 + },
  257 + {
  258 + "name": "isStartableInTasklist",
  259 + "isAttr": true,
  260 + "type": "Boolean",
  261 + "default": true
  262 + }
  263 + ]
  264 + },
  265 + {
  266 + "name": "EscalationEventDefinition",
  267 + "isAbstract": true,
  268 + "extends": ["bpmn:EscalationEventDefinition"],
  269 + "properties": [
  270 + {
  271 + "name": "escalationCodeVariable",
  272 + "isAttr": true,
  273 + "type": "String"
  274 + }
  275 + ]
  276 + },
  277 + {
  278 + "name": "FormalExpression",
  279 + "isAbstract": true,
  280 + "extends": ["bpmn:FormalExpression"],
  281 + "properties": [
  282 + {
  283 + "name": "resource",
  284 + "isAttr": true,
  285 + "type": "String"
  286 + }
  287 + ]
  288 + },
  289 + {
  290 + "name": "Assignable",
  291 + "extends": ["bpmn:UserTask"],
  292 + "properties": [
  293 + {
  294 + "name": "assignee",
  295 + "isAttr": true,
  296 + "type": "String"
  297 + },
  298 + {
  299 + "name": "candidateUsers",
  300 + "isAttr": true,
  301 + "type": "String"
  302 + },
  303 + {
  304 + "name": "candidateGroups",
  305 + "isAttr": true,
  306 + "type": "String"
  307 + },
  308 + {
  309 + "name": "dueDate",
  310 + "isAttr": true,
  311 + "type": "String"
  312 + },
  313 + {
  314 + "name": "followUpDate",
  315 + "isAttr": true,
  316 + "type": "String"
  317 + },
  318 + {
  319 + "name": "priority",
  320 + "isAttr": true,
  321 + "type": "String"
  322 + }
  323 + ]
  324 + },
  325 + {
  326 + "name": "Assignee",
  327 + "supperClass": "Element",
  328 + "meta": {
  329 + "allowedIn": ["*"]
  330 + },
  331 + "properties": [
  332 + {
  333 + "name": "label",
  334 + "type": "String",
  335 + "isAttr": true
  336 + },
  337 + {
  338 + "name": "viewId",
  339 + "type": "Number",
  340 + "isAttr": true
  341 + }
  342 + ]
  343 + },
  344 + {
  345 + "name": "CallActivity",
  346 + "extends": ["bpmn:CallActivity"],
  347 + "properties": [
  348 + {
  349 + "name": "calledElementBinding",
  350 + "isAttr": true,
  351 + "type": "String",
  352 + "default": "latest"
  353 + },
  354 + {
  355 + "name": "calledElementVersion",
  356 + "isAttr": true,
  357 + "type": "String"
  358 + },
  359 + {
  360 + "name": "calledElementVersionTag",
  361 + "isAttr": true,
  362 + "type": "String"
  363 + },
  364 + {
  365 + "name": "calledElementTenantId",
  366 + "isAttr": true,
  367 + "type": "String"
  368 + },
  369 + {
  370 + "name": "caseRef",
  371 + "isAttr": true,
  372 + "type": "String"
  373 + },
  374 + {
  375 + "name": "caseBinding",
  376 + "isAttr": true,
  377 + "type": "String",
  378 + "default": "latest"
  379 + },
  380 + {
  381 + "name": "caseVersion",
  382 + "isAttr": true,
  383 + "type": "String"
  384 + },
  385 + {
  386 + "name": "caseTenantId",
  387 + "isAttr": true,
  388 + "type": "String"
  389 + },
  390 + {
  391 + "name": "variableMappingClass",
  392 + "isAttr": true,
  393 + "type": "String"
  394 + },
  395 + {
  396 + "name": "variableMappingDelegateExpression",
  397 + "isAttr": true,
  398 + "type": "String"
  399 + }
  400 + ]
  401 + },
  402 + {
  403 + "name": "ServiceTaskLike",
  404 + "extends": [
  405 + "bpmn:ServiceTask",
  406 + "bpmn:BusinessRuleTask",
  407 + "bpmn:SendTask",
  408 + "bpmn:MessageEventDefinition"
  409 + ],
  410 + "properties": [
  411 + {
  412 + "name": "expression",
  413 + "isAttr": true,
  414 + "type": "String"
  415 + },
  416 + {
  417 + "name": "class",
  418 + "isAttr": true,
  419 + "type": "String"
  420 + },
  421 + {
  422 + "name": "delegateExpression",
  423 + "isAttr": true,
  424 + "type": "String"
  425 + },
  426 + {
  427 + "name": "resultVariable",
  428 + "isAttr": true,
  429 + "type": "String"
  430 + }
  431 + ]
  432 + },
  433 + {
  434 + "name": "DmnCapable",
  435 + "extends": ["bpmn:BusinessRuleTask"],
  436 + "properties": [
  437 + {
  438 + "name": "decisionRef",
  439 + "isAttr": true,
  440 + "type": "String"
  441 + },
  442 + {
  443 + "name": "decisionRefBinding",
  444 + "isAttr": true,
  445 + "type": "String",
  446 + "default": "latest"
  447 + },
  448 + {
  449 + "name": "decisionRefVersion",
  450 + "isAttr": true,
  451 + "type": "String"
  452 + },
  453 + {
  454 + "name": "mapDecisionResult",
  455 + "isAttr": true,
  456 + "type": "String",
  457 + "default": "resultList"
  458 + },
  459 + {
  460 + "name": "decisionRefTenantId",
  461 + "isAttr": true,
  462 + "type": "String"
  463 + }
  464 + ]
  465 + },
  466 + {
  467 + "name": "ExternalCapable",
  468 + "extends": ["flowable:ServiceTaskLike"],
  469 + "properties": [
  470 + {
  471 + "name": "type",
  472 + "isAttr": true,
  473 + "type": "String"
  474 + },
  475 + {
  476 + "name": "topic",
  477 + "isAttr": true,
  478 + "type": "String"
  479 + }
  480 + ]
  481 + },
  482 + {
  483 + "name": "TaskPriorized",
  484 + "extends": ["bpmn:Process", "flowable:ExternalCapable"],
  485 + "properties": [
  486 + {
  487 + "name": "taskPriority",
  488 + "isAttr": true,
  489 + "type": "String"
  490 + }
  491 + ]
  492 + },
  493 + {
  494 + "name": "Properties",
  495 + "superClass": ["Element"],
  496 + "meta": {
  497 + "allowedIn": ["*"]
  498 + },
  499 + "properties": [
  500 + {
  501 + "name": "values",
  502 + "type": "Property",
  503 + "isMany": true
  504 + }
  505 + ]
  506 + },
  507 + {
  508 + "name": "Property",
  509 + "superClass": ["Element"],
  510 + "properties": [
  511 + {
  512 + "name": "id",
  513 + "type": "String",
  514 + "isAttr": true
  515 + },
  516 + {
  517 + "name": "name",
  518 + "type": "String",
  519 + "isAttr": true
  520 + },
  521 + {
  522 + "name": "value",
  523 + "type": "String",
  524 + "isAttr": true
  525 + }
  526 + ]
  527 + },
  528 + {
  529 + "name": "Button",
  530 + "superClass": ["Element"],
  531 + "meta": {
  532 + "allowedIn": ["bpmn:UserTask"]
  533 + },
  534 + "properties": [
  535 + {
  536 + "name": "id",
  537 + "type": "String",
  538 + "isAttr": true
  539 + },
  540 + {
  541 + "name": "name",
  542 + "type": "String",
  543 + "isAttr": true
  544 + },
  545 + {
  546 + "name": "code",
  547 + "type": "String",
  548 + "isAttr": true
  549 + },
  550 + {
  551 + "name": "isHide",
  552 + "type": "String",
  553 + "isAttr": true
  554 + },
  555 + {
  556 + "name": "next",
  557 + "type": "String",
  558 + "isAttr": true
  559 + },
  560 + {
  561 + "name": "sort",
  562 + "type": "Integer",
  563 + "isAttr": true
  564 + }
  565 + ]
  566 + },
  567 + {
  568 + "name": "Assignee",
  569 + "superClass": ["Element"],
  570 + "meta": {
  571 + "allowedIn": ["bpmn:UserTask"]
  572 + },
  573 + "properties": [
  574 + {
  575 + "name": "id",
  576 + "type": "String",
  577 + "isAttr": true
  578 + },
  579 + {
  580 + "name": "type",
  581 + "type": "String",
  582 + "isAttr": true
  583 + },
  584 + {
  585 + "name": "value",
  586 + "type": "String",
  587 + "isAttr": true
  588 + },
  589 + {
  590 + "name": "condition",
  591 + "type": "String",
  592 + "isAttr": true
  593 + },
  594 + {
  595 + "name": "operationType",
  596 + "type": "String",
  597 + "isAttr": true
  598 + },
  599 + {
  600 + "name": "sort",
  601 + "type": "Integer",
  602 + "isAttr": true
  603 + }
  604 + ]
  605 + },
  606 + {
  607 + "name": "Connector",
  608 + "superClass": ["Element"],
  609 + "meta": {
  610 + "allowedIn": ["flowable:ServiceTaskLike"]
  611 + },
  612 + "properties": [
  613 + {
  614 + "name": "inputOutput",
  615 + "type": "InputOutput"
  616 + },
  617 + {
  618 + "name": "connectorId",
  619 + "type": "String"
  620 + }
  621 + ]
  622 + },
  623 + {
  624 + "name": "InputOutput",
  625 + "superClass": ["Element"],
  626 + "meta": {
  627 + "allowedIn": ["bpmn:FlowNode", "flowable:Connector"]
  628 + },
  629 + "properties": [
  630 + {
  631 + "name": "inputOutput",
  632 + "type": "InputOutput"
  633 + },
  634 + {
  635 + "name": "connectorId",
  636 + "type": "String"
  637 + },
  638 + {
  639 + "name": "inputParameters",
  640 + "isMany": true,
  641 + "type": "InputParameter"
  642 + },
  643 + {
  644 + "name": "outputParameters",
  645 + "isMany": true,
  646 + "type": "OutputParameter"
  647 + }
  648 + ]
  649 + },
  650 + {
  651 + "name": "InputOutputParameter",
  652 + "properties": [
  653 + {
  654 + "name": "name",
  655 + "isAttr": true,
  656 + "type": "String"
  657 + },
  658 + {
  659 + "name": "value",
  660 + "isBody": true,
  661 + "type": "String"
  662 + },
  663 + {
  664 + "name": "definition",
  665 + "type": "InputOutputParameterDefinition"
  666 + }
  667 + ]
  668 + },
  669 + {
  670 + "name": "InputOutputParameterDefinition",
  671 + "isAbstract": true
  672 + },
  673 + {
  674 + "name": "List",
  675 + "superClass": ["InputOutputParameterDefinition"],
  676 + "properties": [
  677 + {
  678 + "name": "items",
  679 + "isMany": true,
  680 + "type": "InputOutputParameterDefinition"
  681 + }
  682 + ]
  683 + },
  684 + {
  685 + "name": "Map",
  686 + "superClass": ["InputOutputParameterDefinition"],
  687 + "properties": [
  688 + {
  689 + "name": "entries",
  690 + "isMany": true,
  691 + "type": "Entry"
  692 + }
  693 + ]
  694 + },
  695 + {
  696 + "name": "Entry",
  697 + "properties": [
  698 + {
  699 + "name": "key",
  700 + "isAttr": true,
  701 + "type": "String"
  702 + },
  703 + {
  704 + "name": "value",
  705 + "isBody": true,
  706 + "type": "String"
  707 + },
  708 + {
  709 + "name": "definition",
  710 + "type": "InputOutputParameterDefinition"
  711 + }
  712 + ]
  713 + },
  714 + {
  715 + "name": "Value",
  716 + "superClass": ["InputOutputParameterDefinition"],
  717 + "properties": [
  718 + {
  719 + "name": "id",
  720 + "isAttr": true,
  721 + "type": "String"
  722 + },
  723 + {
  724 + "name": "name",
  725 + "isAttr": true,
  726 + "type": "String"
  727 + },
  728 + {
  729 + "name": "value",
  730 + "isBody": true,
  731 + "type": "String"
  732 + }
  733 + ]
  734 + },
  735 + {
  736 + "name": "Script",
  737 + "superClass": ["InputOutputParameterDefinition"],
  738 + "properties": [
  739 + {
  740 + "name": "scriptFormat",
  741 + "isAttr": true,
  742 + "type": "String"
  743 + },
  744 + {
  745 + "name": "resource",
  746 + "isAttr": true,
  747 + "type": "String"
  748 + },
  749 + {
  750 + "name": "value",
  751 + "isBody": true,
  752 + "type": "String"
  753 + }
  754 + ]
  755 + },
  756 + {
  757 + "name": "Field",
  758 + "superClass": ["Element"],
  759 + "meta": {
  760 + "allowedIn": [
  761 + "flowable:ServiceTaskLike",
  762 + "flowable:ExecutionListener",
  763 + "flowable:TaskListener"
  764 + ]
  765 + },
  766 + "properties": [
  767 + {
  768 + "name": "name",
  769 + "isAttr": true,
  770 + "type": "String"
  771 + },
  772 + {
  773 + "name": "expression",
  774 + "type": "String"
  775 + },
  776 + {
  777 + "name": "stringValue",
  778 + "isAttr": true,
  779 + "type": "String"
  780 + },
  781 + {
  782 + "name": "string",
  783 + "type": "String"
  784 + }
  785 + ]
  786 + },
  787 + {
  788 + "name": "ChildField",
  789 + "superClass": ["Element"],
  790 + "properties": [
  791 + {
  792 + "name": "id",
  793 + "type": "String",
  794 + "isAttr": true
  795 + },
  796 + {
  797 + "name": "name",
  798 + "type": "String",
  799 + "isAttr": true
  800 + },
  801 + {
  802 + "name": "type",
  803 + "type": "String",
  804 + "isAttr": true
  805 + },
  806 + {
  807 + "name": "required",
  808 + "type": "String",
  809 + "isAttr": true
  810 + },
  811 + {
  812 + "name": "readable",
  813 + "type": "String",
  814 + "isAttr": true
  815 + },
  816 + {
  817 + "name": "writable",
  818 + "type": "String",
  819 + "isAttr": true
  820 + },
  821 + {
  822 + "name": "variable",
  823 + "type": "String",
  824 + "isAttr": true
  825 + },
  826 + {
  827 + "name": "expression",
  828 + "type": "String",
  829 + "isAttr": true
  830 + },
  831 + {
  832 + "name": "datePattern",
  833 + "type": "String",
  834 + "isAttr": true
  835 + },
  836 + {
  837 + "name": "default",
  838 + "type": "String",
  839 + "isAttr": true
  840 + },
  841 + {
  842 + "name": "values",
  843 + "type": "Value",
  844 + "isMany": true
  845 + }
  846 + ]
  847 + },
  848 + {
  849 + "name": "InputParameter",
  850 + "superClass": ["InputOutputParameter"]
  851 + },
  852 + {
  853 + "name": "OutputParameter",
  854 + "superClass": ["InputOutputParameter"]
  855 + },
  856 + {
  857 + "name": "Collectable",
  858 + "isAbstract": true,
  859 + "extends": ["bpmn:MultiInstanceLoopCharacteristics"],
  860 + "superClass": ["flowable:AsyncCapable"],
  861 + "properties": [
  862 + {
  863 + "name": "collection",
  864 + "isAttr": true,
  865 + "type": "String"
  866 + },
  867 + {
  868 + "name": "elementVariable",
  869 + "isAttr": true,
  870 + "type": "String"
  871 + }
  872 + ]
  873 + },
  874 + {
  875 + "name": "FailedJobRetryTimeCycle",
  876 + "superClass": ["Element"],
  877 + "meta": {
  878 + "allowedIn": [
  879 + "flowable:AsyncCapable",
  880 + "bpmn:MultiInstanceLoopCharacteristics"
  881 + ]
  882 + },
  883 + "properties": [
  884 + {
  885 + "name": "body",
  886 + "isBody": true,
  887 + "type": "String"
  888 + }
  889 + ]
  890 + },
  891 + {
  892 + "name": "ExecutionListener",
  893 + "superClass": ["Element"],
  894 + "meta": {
  895 + "allowedIn": [
  896 + "bpmn:Task",
  897 + "bpmn:ServiceTask",
  898 + "bpmn:UserTask",
  899 + "bpmn:BusinessRuleTask",
  900 + "bpmn:ScriptTask",
  901 + "bpmn:ReceiveTask",
  902 + "bpmn:ManualTask",
  903 + "bpmn:ExclusiveGateway",
  904 + "bpmn:SequenceFlow",
  905 + "bpmn:ParallelGateway",
  906 + "bpmn:InclusiveGateway",
  907 + "bpmn:EventBasedGateway",
  908 + "bpmn:StartEvent",
  909 + "bpmn:IntermediateCatchEvent",
  910 + "bpmn:IntermediateThrowEvent",
  911 + "bpmn:EndEvent",
  912 + "bpmn:BoundaryEvent",
  913 + "bpmn:CallActivity",
  914 + "bpmn:SubProcess",
  915 + "bpmn:Process"
  916 + ]
  917 + },
  918 + "properties": [
  919 + {
  920 + "name": "expression",
  921 + "isAttr": true,
  922 + "type": "String"
  923 + },
  924 + {
  925 + "name": "class",
  926 + "isAttr": true,
  927 + "type": "String"
  928 + },
  929 + {
  930 + "name": "delegateExpression",
  931 + "isAttr": true,
  932 + "type": "String"
  933 + },
  934 + {
  935 + "name": "event",
  936 + "isAttr": true,
  937 + "type": "String"
  938 + },
  939 + {
  940 + "name": "script",
  941 + "type": "Script"
  942 + },
  943 + {
  944 + "name": "fields",
  945 + "type": "Field",
  946 + "isMany": true
  947 + }
  948 + ]
  949 + },
  950 + {
  951 + "name": "TaskListener",
  952 + "superClass": ["Element"],
  953 + "meta": {
  954 + "allowedIn": ["bpmn:UserTask"]
  955 + },
  956 + "properties": [
  957 + {
  958 + "name": "expression",
  959 + "isAttr": true,
  960 + "type": "String"
  961 + },
  962 + {
  963 + "name": "class",
  964 + "isAttr": true,
  965 + "type": "String"
  966 + },
  967 + {
  968 + "name": "delegateExpression",
  969 + "isAttr": true,
  970 + "type": "String"
  971 + },
  972 + {
  973 + "name": "event",
  974 + "isAttr": true,
  975 + "type": "String"
  976 + },
  977 + {
  978 + "name": "script",
  979 + "type": "Script"
  980 + },
  981 + {
  982 + "name": "fields",
  983 + "type": "Field",
  984 + "isMany": true
  985 + }
  986 + ]
  987 + },
  988 + {
  989 + "name": "FormProperty",
  990 + "superClass": ["Element"],
  991 + "meta": {
  992 + "allowedIn": ["bpmn:StartEvent", "bpmn:UserTask"]
  993 + },
  994 + "properties": [
  995 + {
  996 + "name": "id",
  997 + "type": "String",
  998 + "isAttr": true
  999 + },
  1000 + {
  1001 + "name": "name",
  1002 + "type": "String",
  1003 + "isAttr": true
  1004 + },
  1005 + {
  1006 + "name": "type",
  1007 + "type": "String",
  1008 + "isAttr": true
  1009 + },
  1010 + {
  1011 + "name": "required",
  1012 + "type": "String",
  1013 + "isAttr": true
  1014 + },
  1015 + {
  1016 + "name": "readable",
  1017 + "type": "String",
  1018 + "isAttr": true
  1019 + },
  1020 + {
  1021 + "name": "writable",
  1022 + "type": "String",
  1023 + "isAttr": true
  1024 + },
  1025 + {
  1026 + "name": "variable",
  1027 + "type": "String",
  1028 + "isAttr": true
  1029 + },
  1030 + {
  1031 + "name": "expression",
  1032 + "type": "String",
  1033 + "isAttr": true
  1034 + },
  1035 + {
  1036 + "name": "datePattern",
  1037 + "type": "String",
  1038 + "isAttr": true
  1039 + },
  1040 + {
  1041 + "name": "default",
  1042 + "type": "String",
  1043 + "isAttr": true
  1044 + },
  1045 + {
  1046 + "name": "values",
  1047 + "type": "Value",
  1048 + "isMany": true
  1049 + },
  1050 + {
  1051 + "name": "children",
  1052 + "type": "ChildField",
  1053 + "isMany": true
  1054 + },
  1055 + {
  1056 + "name": "extensionElements",
  1057 + "type": "bpmn:ExtensionElements",
  1058 + "isMany": true
  1059 + }
  1060 + ]
  1061 + },
  1062 + {
  1063 + "name": "FormData",
  1064 + "superClass": ["Element"],
  1065 + "meta": {
  1066 + "allowedIn": ["bpmn:StartEvent", "bpmn:UserTask"]
  1067 + },
  1068 + "properties": [
  1069 + {
  1070 + "name": "fields",
  1071 + "type": "FormField",
  1072 + "isMany": true
  1073 + },
  1074 + {
  1075 + "name": "businessKey",
  1076 + "type": "String",
  1077 + "isAttr": true
  1078 + }
  1079 + ]
  1080 + },
  1081 + {
  1082 + "name": "FormField",
  1083 + "superClass": ["Element"],
  1084 + "properties": [
  1085 + {
  1086 + "name": "id",
  1087 + "type": "String",
  1088 + "isAttr": true
  1089 + },
  1090 + {
  1091 + "name": "label",
  1092 + "type": "String",
  1093 + "isAttr": true
  1094 + },
  1095 + {
  1096 + "name": "type",
  1097 + "type": "String",
  1098 + "isAttr": true
  1099 + },
  1100 + {
  1101 + "name": "datePattern",
  1102 + "type": "String",
  1103 + "isAttr": true
  1104 + },
  1105 + {
  1106 + "name": "defaultValue",
  1107 + "type": "String",
  1108 + "isAttr": true
  1109 + },
  1110 + {
  1111 + "name": "properties",
  1112 + "type": "Properties"
  1113 + },
  1114 + {
  1115 + "name": "validation",
  1116 + "type": "Validation"
  1117 + },
  1118 + {
  1119 + "name": "values",
  1120 + "type": "Value",
  1121 + "isMany": true
  1122 + }
  1123 + ]
  1124 + },
  1125 + {
  1126 + "name": "Validation",
  1127 + "superClass": ["Element"],
  1128 + "properties": [
  1129 + {
  1130 + "name": "constraints",
  1131 + "type": "Constraint",
  1132 + "isMany": true
  1133 + }
  1134 + ]
  1135 + },
  1136 + {
  1137 + "name": "Constraint",
  1138 + "superClass": ["Element"],
  1139 + "properties": [
  1140 + {
  1141 + "name": "name",
  1142 + "type": "String",
  1143 + "isAttr": true
  1144 + },
  1145 + {
  1146 + "name": "config",
  1147 + "type": "String",
  1148 + "isAttr": true
  1149 + }
  1150 + ]
  1151 + },
  1152 + {
  1153 + "name": "ConditionalEventDefinition",
  1154 + "isAbstract": true,
  1155 + "extends": ["bpmn:ConditionalEventDefinition"],
  1156 + "properties": [
  1157 + {
  1158 + "name": "variableName",
  1159 + "isAttr": true,
  1160 + "type": "String"
  1161 + },
  1162 + {
  1163 + "name": "variableEvent",
  1164 + "isAttr": true,
  1165 + "type": "String"
  1166 + }
  1167 + ]
  1168 + },
  1169 + {
  1170 + "name": "Condition",
  1171 + "superClass": ["Element"],
  1172 + "meta": {
  1173 + "allowedIn": ["bpmn:SequenceFlow"]
  1174 + },
  1175 + "properties": [
  1176 + {
  1177 + "name": "id",
  1178 + "type": "String",
  1179 + "isAttr": true
  1180 + },
  1181 + {
  1182 + "name": "field",
  1183 + "type": "String",
  1184 + "isAttr": true
  1185 + },
  1186 + {
  1187 + "name": "compare",
  1188 + "type": "String",
  1189 + "isAttr": true
  1190 + },
  1191 + {
  1192 + "name": "value",
  1193 + "type": "String",
  1194 + "isAttr": true
  1195 + },
  1196 + {
  1197 + "name": "logic",
  1198 + "type": "String",
  1199 + "isAttr": true
  1200 + },
  1201 + {
  1202 + "name": "sort",
  1203 + "type": "Integer",
  1204 + "isAttr": true
  1205 + }
  1206 + ]
  1207 + }
  1208 + ],
  1209 + "emumerations": []
  1210 +}
yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/plugins/extension-moddle/activiti/activitiExtension.js 0 → 100644
  1 +"use strict";
  2 +
  3 +var some = require("min-dash").some;
  4 +
  5 +var ALLOWED_TYPES = {
  6 + FailedJobRetryTimeCycle: ["bpmn:StartEvent", "bpmn:BoundaryEvent", "bpmn:IntermediateCatchEvent", "bpmn:Activity"],
  7 + Connector: ["bpmn:EndEvent", "bpmn:IntermediateThrowEvent"],
  8 + Field: ["bpmn:EndEvent", "bpmn:IntermediateThrowEvent"]
  9 +};
  10 +
  11 +function is(element, type) {
  12 + return element && typeof element.$instanceOf === "function" && element.$instanceOf(type);
  13 +}
  14 +
  15 +function exists(element) {
  16 + return element && element.length;
  17 +}
  18 +
  19 +function includesType(collection, type) {
  20 + return (
  21 + exists(collection) &&
  22 + some(collection, function(element) {
  23 + return is(element, type);
  24 + })
  25 + );
  26 +}
  27 +
  28 +function anyType(element, types) {
  29 + return some(types, function(type) {
  30 + return is(element, type);
  31 + });
  32 +}
  33 +
  34 +function isAllowed(propName, propDescriptor, newElement) {
  35 + var name = propDescriptor.name,
  36 + types = ALLOWED_TYPES[name.replace(/activiti:/, "")];
  37 +
  38 + return name === propName && anyType(newElement, types);
  39 +}
  40 +
  41 +function ActivitiModdleExtension(eventBus) {
  42 + eventBus.on(
  43 + "property.clone",
  44 + function(context) {
  45 + var newElement = context.newElement,
  46 + propDescriptor = context.propertyDescriptor;
  47 +
  48 + this.canCloneProperty(newElement, propDescriptor);
  49 + },
  50 + this
  51 + );
  52 +}
  53 +
  54 +ActivitiModdleExtension.$inject = ["eventBus"];
  55 +
  56 +ActivitiModdleExtension.prototype.canCloneProperty = function(newElement, propDescriptor) {
  57 + if (isAllowed("activiti:FailedJobRetryTimeCycle", propDescriptor, newElement)) {
  58 + return (
  59 + includesType(newElement.eventDefinitions, "bpmn:TimerEventDefinition") ||
  60 + includesType(newElement.eventDefinitions, "bpmn:SignalEventDefinition") ||
  61 + is(newElement.loopCharacteristics, "bpmn:MultiInstanceLoopCharacteristics")
  62 + );
  63 + }
  64 +
  65 + if (isAllowed("activiti:Connector", propDescriptor, newElement)) {
  66 + return includesType(newElement.eventDefinitions, "bpmn:MessageEventDefinition");
  67 + }
  68 +
  69 + if (isAllowed("activiti:Field", propDescriptor, newElement)) {
  70 + return includesType(newElement.eventDefinitions, "bpmn:MessageEventDefinition");
  71 + }
  72 +};
  73 +
  74 +module.exports = ActivitiModdleExtension;
yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/plugins/extension-moddle/activiti/index.js 0 → 100644
  1 +/*
  2 + * @author igdianov
  3 + * address https://github.com/igdianov/activiti-bpmn-moddle
  4 + * */
  5 +
  6 +module.exports = {
  7 + __init__: ["ActivitiModdleExtension"],
  8 + ActivitiModdleExtension: ["type", require("./activitiExtension")]
  9 +};
yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/plugins/extension-moddle/camunda/extension.js 0 → 100644
  1 +"use strict";
  2 +
  3 +var isFunction = require("min-dash").isFunction,
  4 + isObject = require("min-dash").isObject,
  5 + some = require("min-dash").some;
  6 +
  7 +var WILDCARD = "*";
  8 +
  9 +function CamundaModdleExtension(eventBus) {
  10 + var self = this;
  11 +
  12 + eventBus.on("moddleCopy.canCopyProperty", function(context) {
  13 + var property = context.property,
  14 + parent = context.parent;
  15 +
  16 + return self.canCopyProperty(property, parent);
  17 + });
  18 +}
  19 +
  20 +CamundaModdleExtension.$inject = ["eventBus"];
  21 +
  22 +/**
  23 + * Check wether to disallow copying property.
  24 + */
  25 +CamundaModdleExtension.prototype.canCopyProperty = function(property, parent) {
  26 + // (1) check wether property is allowed in parent
  27 + if (isObject(property) && !isAllowedInParent(property, parent)) {
  28 + return false;
  29 + }
  30 +
  31 + // (2) check more complex scenarios
  32 +
  33 + if (is(property, "camunda:InputOutput") && !this.canHostInputOutput(parent)) {
  34 + return false;
  35 + }
  36 +
  37 + if (isAny(property, ["camunda:Connector", "camunda:Field"]) && !this.canHostConnector(parent)) {
  38 + return false;
  39 + }
  40 +
  41 + if (is(property, "camunda:In") && !this.canHostIn(parent)) {
  42 + return false;
  43 + }
  44 +};
  45 +
  46 +CamundaModdleExtension.prototype.canHostInputOutput = function(parent) {
  47 + // allowed in camunda:Connector
  48 + var connector = getParent(parent, "camunda:Connector");
  49 +
  50 + if (connector) {
  51 + return true;
  52 + }
  53 +
  54 + // special rules inside bpmn:FlowNode
  55 + var flowNode = getParent(parent, "bpmn:FlowNode");
  56 +
  57 + if (!flowNode) {
  58 + return false;
  59 + }
  60 +
  61 + if (isAny(flowNode, ["bpmn:StartEvent", "bpmn:Gateway", "bpmn:BoundaryEvent"])) {
  62 + return false;
  63 + }
  64 +
  65 + if (is(flowNode, "bpmn:SubProcess") && flowNode.get("triggeredByEvent")) {
  66 + return false;
  67 + }
  68 +
  69 + return true;
  70 +};
  71 +
  72 +CamundaModdleExtension.prototype.canHostConnector = function(parent) {
  73 + var serviceTaskLike = getParent(parent, "camunda:ServiceTaskLike");
  74 +
  75 + if (is(serviceTaskLike, "bpmn:MessageEventDefinition")) {
  76 + // only allow on throw and end events
  77 + return getParent(parent, "bpmn:IntermediateThrowEvent") || getParent(parent, "bpmn:EndEvent");
  78 + }
  79 +
  80 + return true;
  81 +};
  82 +
  83 +CamundaModdleExtension.prototype.canHostIn = function(parent) {
  84 + var callActivity = getParent(parent, "bpmn:CallActivity");
  85 +
  86 + if (callActivity) {
  87 + return true;
  88 + }
  89 +
  90 + var signalEventDefinition = getParent(parent, "bpmn:SignalEventDefinition");
  91 +
  92 + if (signalEventDefinition) {
  93 + // only allow on throw and end events
  94 + return getParent(parent, "bpmn:IntermediateThrowEvent") || getParent(parent, "bpmn:EndEvent");
  95 + }
  96 +
  97 + return true;
  98 +};
  99 +
  100 +module.exports = CamundaModdleExtension;
  101 +
  102 +// helpers //////////
  103 +
  104 +function is(element, type) {
  105 + return element && isFunction(element.$instanceOf) && element.$instanceOf(type);
  106 +}
  107 +
  108 +function isAny(element, types) {
  109 + return some(types, function(t) {
  110 + return is(element, t);
  111 + });
  112 +}
  113 +
  114 +function getParent(element, type) {
  115 + if (!type) {
  116 + return element.$parent;
  117 + }
  118 +
  119 + if (is(element, type)) {
  120 + return element;
  121 + }
  122 +
  123 + if (!element.$parent) {
  124 + return;
  125 + }
  126 +
  127 + return getParent(element.$parent, type);
  128 +}
  129 +
  130 +function isAllowedInParent(property, parent) {
  131 + // (1) find property descriptor
  132 + var descriptor = property.$type && property.$model.getTypeDescriptor(property.$type);
  133 +
  134 + var allowedIn = descriptor && descriptor.meta && descriptor.meta.allowedIn;
  135 +
  136 + if (!allowedIn || isWildcard(allowedIn)) {
  137 + return true;
  138 + }
  139 +
  140 + // (2) check wether property has parent of allowed type
  141 + return some(allowedIn, function(type) {
  142 + return getParent(parent, type);
  143 + });
  144 +}
  145 +
  146 +function isWildcard(allowedIn) {
  147 + return allowedIn.indexOf(WILDCARD) !== -1;
  148 +}
yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/plugins/extension-moddle/camunda/index.js 0 → 100644
  1 +"use strict";
  2 +
  3 +module.exports = {
  4 + __init__: ["camundaModdleExtension"],
  5 + camundaModdleExtension: ["type", require("./extension")]
  6 +};
yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/plugins/extension-moddle/flowable/flowableExtension.js 0 → 100644
  1 +"use strict";
  2 +
  3 +var some = require("min-dash").some;
  4 +
  5 +var ALLOWED_TYPES = {
  6 + FailedJobRetryTimeCycle: ["bpmn:StartEvent", "bpmn:BoundaryEvent", "bpmn:IntermediateCatchEvent", "bpmn:Activity"],
  7 + Connector: ["bpmn:EndEvent", "bpmn:IntermediateThrowEvent"],
  8 + Field: ["bpmn:EndEvent", "bpmn:IntermediateThrowEvent"]
  9 +};
  10 +
  11 +function is(element, type) {
  12 + return element && typeof element.$instanceOf === "function" && element.$instanceOf(type);
  13 +}
  14 +
  15 +function exists(element) {
  16 + return element && element.length;
  17 +}
  18 +
  19 +function includesType(collection, type) {
  20 + return (
  21 + exists(collection) &&
  22 + some(collection, function(element) {
  23 + return is(element, type);
  24 + })
  25 + );
  26 +}
  27 +
  28 +function anyType(element, types) {
  29 + return some(types, function(type) {
  30 + return is(element, type);
  31 + });
  32 +}
  33 +
  34 +function isAllowed(propName, propDescriptor, newElement) {
  35 + var name = propDescriptor.name,
  36 + types = ALLOWED_TYPES[name.replace(/flowable:/, "")];
  37 +
  38 + return name === propName && anyType(newElement, types);
  39 +}
  40 +
  41 +function FlowableModdleExtension(eventBus) {
  42 + eventBus.on(
  43 + "property.clone",
  44 + function(context) {
  45 + var newElement = context.newElement,
  46 + propDescriptor = context.propertyDescriptor;
  47 +
  48 + this.canCloneProperty(newElement, propDescriptor);
  49 + },
  50 + this
  51 + );
  52 +}
  53 +
  54 +FlowableModdleExtension.$inject = ["eventBus"];
  55 +
  56 +FlowableModdleExtension.prototype.canCloneProperty = function(newElement, propDescriptor) {
  57 + if (isAllowed("flowable:FailedJobRetryTimeCycle", propDescriptor, newElement)) {
  58 + return (
  59 + includesType(newElement.eventDefinitions, "bpmn:TimerEventDefinition") ||
  60 + includesType(newElement.eventDefinitions, "bpmn:SignalEventDefinition") ||
  61 + is(newElement.loopCharacteristics, "bpmn:MultiInstanceLoopCharacteristics")
  62 + );
  63 + }
  64 +
  65 + if (isAllowed("flowable:Connector", propDescriptor, newElement)) {
  66 + return includesType(newElement.eventDefinitions, "bpmn:MessageEventDefinition");
  67 + }
  68 +
  69 + if (isAllowed("flowable:Field", propDescriptor, newElement)) {
  70 + return includesType(newElement.eventDefinitions, "bpmn:MessageEventDefinition");
  71 + }
  72 +};
  73 +
  74 +module.exports = FlowableModdleExtension;
yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/plugins/extension-moddle/flowable/index.js 0 → 100644
  1 +/*
  2 + * @author igdianov
  3 + * address https://github.com/igdianov/activiti-bpmn-moddle
  4 + * */
  5 +
  6 +module.exports = {
  7 + __init__: ["FlowableModdleExtension"],
  8 + FlowableModdleExtension: ["type", require("./flowableExtension")]
  9 +};
yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/plugins/palette/CustomPalette.js 0 → 100644
  1 +import PaletteProvider from "bpmn-js/lib/features/palette/PaletteProvider";
  2 +import { assign } from "min-dash";
  3 +
  4 +export default function CustomPalette(palette, create, elementFactory, spaceTool, lassoTool, handTool, globalConnect, translate) {
  5 + PaletteProvider.call(this, palette, create, elementFactory, spaceTool, lassoTool, handTool, globalConnect, translate, 2000);
  6 +}
  7 +
  8 +const F = function() {}; // 核心,利用空对象作为中介;
  9 +F.prototype = PaletteProvider.prototype; // 核心,将父类的原型赋值给空对象F;
  10 +
  11 +// 利用中介函数重写原型链方法
  12 +F.prototype.getPaletteEntries = function() {
  13 + var actions = {},
  14 + create = this._create,
  15 + elementFactory = this._elementFactory,
  16 + spaceTool = this._spaceTool,
  17 + lassoTool = this._lassoTool,
  18 + handTool = this._handTool,
  19 + globalConnect = this._globalConnect,
  20 + translate = this._translate;
  21 +
  22 + function createAction(type, group, className, title, options) {
  23 + function createListener(event) {
  24 + var shape = elementFactory.createShape(assign({ type: type }, options));
  25 +
  26 + if (options) {
  27 + shape.businessObject.di.isExpanded = options.isExpanded;
  28 + }
  29 +
  30 + create.start(event, shape);
  31 + }
  32 +
  33 + var shortType = type.replace(/^bpmn:/, "");
  34 +
  35 + return {
  36 + group: group,
  37 + className: className,
  38 + title: title || translate("Create {type}", { type: shortType }),
  39 + action: {
  40 + dragstart: createListener,
  41 + click: createListener
  42 + }
  43 + };
  44 + }
  45 +
  46 + function createSubprocess(event) {
  47 + var subProcess = elementFactory.createShape({
  48 + type: "bpmn:SubProcess",
  49 + x: 0,
  50 + y: 0,
  51 + isExpanded: true
  52 + });
  53 +
  54 + var startEvent = elementFactory.createShape({
  55 + type: "bpmn:StartEvent",
  56 + x: 40,
  57 + y: 82,
  58 + parent: subProcess
  59 + });
  60 +
  61 + create.start(event, [subProcess, startEvent], {
  62 + hints: {
  63 + autoSelect: [startEvent]
  64 + }
  65 + });
  66 + }
  67 +
  68 + function createParticipant(event) {
  69 + create.start(event, elementFactory.createParticipantShape());
  70 + }
  71 +
  72 + assign(actions, {
  73 + "hand-tool": {
  74 + group: "tools",
  75 + className: "bpmn-icon-hand-tool",
  76 + title: translate("Activate the hand tool"),
  77 + action: {
  78 + click: function(event) {
  79 + handTool.activateHand(event);
  80 + }
  81 + }
  82 + },
  83 + "lasso-tool": {
  84 + group: "tools",
  85 + className: "bpmn-icon-lasso-tool",
  86 + title: translate("Activate the lasso tool"),
  87 + action: {
  88 + click: function(event) {
  89 + lassoTool.activateSelection(event);
  90 + }
  91 + }
  92 + },
  93 + "space-tool": {
  94 + group: "tools",
  95 + className: "bpmn-icon-space-tool",
  96 + title: translate("Activate the create/remove space tool"),
  97 + action: {
  98 + click: function(event) {
  99 + spaceTool.activateSelection(event);
  100 + }
  101 + }
  102 + },
  103 + "global-connect-tool": {
  104 + group: "tools",
  105 + className: "bpmn-icon-connection-multi",
  106 + title: translate("Activate the global connect tool"),
  107 + action: {
  108 + click: function(event) {
  109 + globalConnect.toggle(event);
  110 + }
  111 + }
  112 + },
  113 + "tool-separator": {
  114 + group: "tools",
  115 + separator: true
  116 + },
  117 + "create.start-event": createAction("bpmn:StartEvent", "event", "bpmn-icon-start-event-none", translate("Create StartEvent")),
  118 + "create.intermediate-event": createAction(
  119 + "bpmn:IntermediateThrowEvent",
  120 + "event",
  121 + "bpmn-icon-intermediate-event-none",
  122 + translate("Create Intermediate/Boundary Event")
  123 + ),
  124 + "create.end-event": createAction("bpmn:EndEvent", "event", "bpmn-icon-end-event-none", translate("Create EndEvent")),
  125 + "create.exclusive-gateway": createAction("bpmn:ExclusiveGateway", "gateway", "bpmn-icon-gateway-none", translate("Create Gateway")),
  126 + "create.user-task": createAction("bpmn:UserTask", "activity", "bpmn-icon-user-task", translate("Create User Task")),
  127 + "create.data-object": createAction("bpmn:DataObjectReference", "data-object", "bpmn-icon-data-object", translate("Create DataObjectReference")),
  128 + "create.data-store": createAction("bpmn:DataStoreReference", "data-store", "bpmn-icon-data-store", translate("Create DataStoreReference")),
  129 + "create.subprocess-expanded": {
  130 + group: "activity",
  131 + className: "bpmn-icon-subprocess-expanded",
  132 + title: translate("Create expanded SubProcess"),
  133 + action: {
  134 + dragstart: createSubprocess,
  135 + click: createSubprocess
  136 + }
  137 + },
  138 + "create.participant-expanded": {
  139 + group: "collaboration",
  140 + className: "bpmn-icon-participant",
  141 + title: translate("Create Pool/Participant"),
  142 + action: {
  143 + dragstart: createParticipant,
  144 + click: createParticipant
  145 + }
  146 + },
  147 + "create.group": createAction("bpmn:Group", "artifact", "bpmn-icon-group", translate("Create Group"))
  148 + });
  149 +
  150 + return actions;
  151 +};
  152 +
  153 +CustomPalette.$inject = ["palette", "create", "elementFactory", "spaceTool", "lassoTool", "handTool", "globalConnect", "translate"];
  154 +
  155 +CustomPalette.prototype = new F(); // 核心,将 F的实例赋值给子类;
  156 +CustomPalette.prototype.constructor = CustomPalette; // 修复子类CustomPalette的构造器指向,防止原型链的混乱;
yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/plugins/palette/index.js 0 → 100644
  1 +// import PaletteModule from "diagram-js/lib/features/palette";
  2 +// import CreateModule from "diagram-js/lib/features/create";
  3 +// import SpaceToolModule from "diagram-js/lib/features/space-tool";
  4 +// import LassoToolModule from "diagram-js/lib/features/lasso-tool";
  5 +// import HandToolModule from "diagram-js/lib/features/hand-tool";
  6 +// import GlobalConnectModule from "diagram-js/lib/features/global-connect";
  7 +// import translate from "diagram-js/lib/i18n/translate";
  8 +//
  9 +// import PaletteProvider from "./paletteProvider";
  10 +//
  11 +// export default {
  12 +// __depends__: [PaletteModule, CreateModule, SpaceToolModule, LassoToolModule, HandToolModule, GlobalConnectModule, translate],
  13 +// __init__: ["paletteProvider"],
  14 +// paletteProvider: ["type", PaletteProvider]
  15 +// };
  16 +
  17 +// custom/index.js
  18 +import CustomPalette from "./CustomPalette";
  19 +
  20 +export default {
  21 + __init__: ["paletteProvider"],
  22 + paletteProvider: ["type", CustomPalette]
  23 +};
yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/plugins/palette/paletteProvider.js 0 → 100644
  1 +import { assign } from "min-dash";
  2 +
  3 +/**
  4 + * A palette provider for BPMN 2.0 elements.
  5 + */
  6 +export default function PaletteProvider(palette, create, elementFactory, spaceTool, lassoTool, handTool, globalConnect, translate) {
  7 + this._palette = palette;
  8 + this._create = create;
  9 + this._elementFactory = elementFactory;
  10 + this._spaceTool = spaceTool;
  11 + this._lassoTool = lassoTool;
  12 + this._handTool = handTool;
  13 + this._globalConnect = globalConnect;
  14 + this._translate = translate;
  15 +
  16 + palette.registerProvider(this);
  17 +}
  18 +
  19 +PaletteProvider.$inject = ["palette", "create", "elementFactory", "spaceTool", "lassoTool", "handTool", "globalConnect", "translate"];
  20 +
  21 +PaletteProvider.prototype.getPaletteEntries = function() {
  22 + var actions = {},
  23 + create = this._create,
  24 + elementFactory = this._elementFactory,
  25 + spaceTool = this._spaceTool,
  26 + lassoTool = this._lassoTool,
  27 + handTool = this._handTool,
  28 + globalConnect = this._globalConnect,
  29 + translate = this._translate;
  30 +
  31 + function createAction(type, group, className, title, options) {
  32 + function createListener(event) {
  33 + var shape = elementFactory.createShape(assign({ type: type }, options));
  34 +
  35 + if (options) {
  36 + shape.businessObject.di.isExpanded = options.isExpanded;
  37 + }
  38 +
  39 + create.start(event, shape);
  40 + }
  41 +
  42 + var shortType = type.replace(/^bpmn:/, "");
  43 +
  44 + return {
  45 + group: group,
  46 + className: className,
  47 + title: title || translate("Create {type}", { type: shortType }),
  48 + action: {
  49 + dragstart: createListener,
  50 + click: createListener
  51 + }
  52 + };
  53 + }
  54 +
  55 + function createSubprocess(event) {
  56 + var subProcess = elementFactory.createShape({
  57 + type: "bpmn:SubProcess",
  58 + x: 0,
  59 + y: 0,
  60 + isExpanded: true
  61 + });
  62 +
  63 + var startEvent = elementFactory.createShape({
  64 + type: "bpmn:StartEvent",
  65 + x: 40,
  66 + y: 82,
  67 + parent: subProcess
  68 + });
  69 +
  70 + create.start(event, [subProcess, startEvent], {
  71 + hints: {
  72 + autoSelect: [startEvent]
  73 + }
  74 + });
  75 + }
  76 +
  77 + function createParticipant(event) {
  78 + create.start(event, elementFactory.createParticipantShape());
  79 + }
  80 +
  81 + assign(actions, {
  82 + "hand-tool": {
  83 + group: "tools",
  84 + className: "bpmn-icon-hand-tool",
  85 + title: translate("Activate the hand tool"),
  86 + action: {
  87 + click: function(event) {
  88 + handTool.activateHand(event);
  89 + }
  90 + }
  91 + },
  92 + "lasso-tool": {
  93 + group: "tools",
  94 + className: "bpmn-icon-lasso-tool",
  95 + title: translate("Activate the lasso tool"),
  96 + action: {
  97 + click: function(event) {
  98 + lassoTool.activateSelection(event);
  99 + }
  100 + }
  101 + },
  102 + "space-tool": {
  103 + group: "tools",
  104 + className: "bpmn-icon-space-tool",
  105 + title: translate("Activate the create/remove space tool"),
  106 + action: {
  107 + click: function(event) {
  108 + spaceTool.activateSelection(event);
  109 + }
  110 + }
  111 + },
  112 + "global-connect-tool": {
  113 + group: "tools",
  114 + className: "bpmn-icon-connection-multi",
  115 + title: translate("Activate the global connect tool"),
  116 + action: {
  117 + click: function(event) {
  118 + globalConnect.toggle(event);
  119 + }
  120 + }
  121 + },
  122 + "tool-separator": {
  123 + group: "tools",
  124 + separator: true
  125 + },
  126 + "create.start-event": createAction("bpmn:StartEvent", "event", "bpmn-icon-start-event-none", translate("Create StartEvent")),
  127 + "create.intermediate-event": createAction(
  128 + "bpmn:IntermediateThrowEvent",
  129 + "event",
  130 + "bpmn-icon-intermediate-event-none",
  131 + translate("Create Intermediate/Boundary Event")
  132 + ),
  133 + "create.end-event": createAction("bpmn:EndEvent", "event", "bpmn-icon-end-event-none", translate("Create EndEvent")),
  134 + "create.exclusive-gateway": createAction("bpmn:ExclusiveGateway", "gateway", "bpmn-icon-gateway-none", translate("Create Gateway")),
  135 + "create.user-task": createAction("bpmn:UserTask", "activity", "bpmn-icon-user-task", translate("Create User Task")),
  136 + "create.data-object": createAction("bpmn:DataObjectReference", "data-object", "bpmn-icon-data-object", translate("Create DataObjectReference")),
  137 + "create.data-store": createAction("bpmn:DataStoreReference", "data-store", "bpmn-icon-data-store", translate("Create DataStoreReference")),
  138 + "create.subprocess-expanded": {
  139 + group: "activity",
  140 + className: "bpmn-icon-subprocess-expanded",
  141 + title: translate("Create expanded SubProcess"),
  142 + action: {
  143 + dragstart: createSubprocess,
  144 + click: createSubprocess
  145 + }
  146 + },
  147 + "create.participant-expanded": {
  148 + group: "collaboration",
  149 + className: "bpmn-icon-participant",
  150 + title: translate("Create Pool/Participant"),
  151 + action: {
  152 + dragstart: createParticipant,
  153 + click: createParticipant
  154 + }
  155 + },
  156 + "create.group": createAction("bpmn:Group", "artifact", "bpmn-icon-group", translate("Create Group"))
  157 + });
  158 +
  159 + return actions;
  160 +};
yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/plugins/translate/customTranslate.js 0 → 100644
  1 +// import translations from "./zh";
  2 +//
  3 +// export default function customTranslate(template, replacements) {
  4 +// replacements = replacements || {};
  5 +//
  6 +// // Translate
  7 +// template = translations[template] || template;
  8 +//
  9 +// // Replace
  10 +// return template.replace(/{([^}]+)}/g, function(_, key) {
  11 +// let str = replacements[key];
  12 +// if (
  13 +// translations[replacements[key]] !== null &&
  14 +// translations[replacements[key]] !== "undefined"
  15 +// ) {
  16 +// // eslint-disable-next-line no-mixed-spaces-and-tabs
  17 +// str = translations[replacements[key]];
  18 +// // eslint-disable-next-line no-mixed-spaces-and-tabs
  19 +// }
  20 +// return str || "{" + key + "}";
  21 +// });
  22 +// }
  23 +
  24 +export default function customTranslate(translations) {
  25 + return function(template, replacements) {
  26 + replacements = replacements || {};
  27 + // Translate
  28 + template = translations[template] || template;
  29 +
  30 + // Replace
  31 + return template.replace(/{([^}]+)}/g, function(_, key) {
  32 + let str = replacements[key];
  33 + if (translations[replacements[key]] !== null && translations[replacements[key]] !== undefined) {
  34 + // eslint-disable-next-line no-mixed-spaces-and-tabs
  35 + str = translations[replacements[key]];
  36 + // eslint-disable-next-line no-mixed-spaces-and-tabs
  37 + }
  38 + return str || "{" + key + "}";
  39 + });
  40 + };
  41 +}
yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/plugins/translate/zh.js 0 → 100644
  1 +/**
  2 + * This is a sample file that should be replaced with the actual translation.
  3 + *
  4 + * Checkout https://github.com/bpmn-io/bpmn-js-i18n for a list of available
  5 + * translations and labels to translate.
  6 + */
  7 +export default {
  8 + // 添加部分
  9 + "Append EndEvent": "追加结束事件",
  10 + "Append Gateway": "追加网关",
  11 + "Append Task": "追加任务",
  12 + "Append Intermediate/Boundary Event": "追加中间抛出事件/边界事件",
  13 +
  14 + "Activate the global connect tool": "激活全局连接工具",
  15 + "Append {type}": "添加 {type}",
  16 + "Add Lane above": "在上面添加道",
  17 + "Divide into two Lanes": "分割成两个道",
  18 + "Divide into three Lanes": "分割成三个道",
  19 + "Add Lane below": "在下面添加道",
  20 + "Append compensation activity": "追加补偿活动",
  21 + "Change type": "修改类型",
  22 + "Connect using Association": "使用关联连接",
  23 + "Connect using Sequence/MessageFlow or Association": "使用顺序/消息流或者关联连接",
  24 + "Connect using DataInputAssociation": "使用数据输入关联连接",
  25 + Remove: "移除",
  26 + "Activate the hand tool": "激活抓手工具",
  27 + "Activate the lasso tool": "激活套索工具",
  28 + "Activate the create/remove space tool": "激活创建/删除空间工具",
  29 + "Create expanded SubProcess": "创建扩展子过程",
  30 + "Create IntermediateThrowEvent/BoundaryEvent": "创建中间抛出事件/边界事件",
  31 + "Create Pool/Participant": "创建池/参与者",
  32 + "Parallel Multi Instance": "并行多重事件",
  33 + "Sequential Multi Instance": "时序多重事件",
  34 + DataObjectReference: "数据对象参考",
  35 + DataStoreReference: "数据存储参考",
  36 + Loop: "循环",
  37 + "Ad-hoc": "即席",
  38 + "Create {type}": "创建 {type}",
  39 + Task: "任务",
  40 + "Send Task": "发送任务",
  41 + "Receive Task": "接收任务",
  42 + "User Task": "用户任务",
  43 + "Manual Task": "手工任务",
  44 + "Business Rule Task": "业务规则任务",
  45 + "Service Task": "服务任务",
  46 + "Script Task": "脚本任务",
  47 + "Call Activity": "调用活动",
  48 + "Sub Process (collapsed)": "子流程(折叠的)",
  49 + "Sub Process (expanded)": "子流程(展开的)",
  50 + "Start Event": "开始事件",
  51 + StartEvent: "开始事件",
  52 + "Intermediate Throw Event": "中间事件",
  53 + "End Event": "结束事件",
  54 + EndEvent: "结束事件",
  55 + "Create StartEvent": "创建开始事件",
  56 + "Create EndEvent": "创建结束事件",
  57 + "Create Task": "创建任务",
  58 + "Create User Task": "创建用户任务",
  59 + "Create Gateway": "创建网关",
  60 + "Create DataObjectReference": "创建数据对象",
  61 + "Create DataStoreReference": "创建数据存储",
  62 + "Create Group": "创建分组",
  63 + "Create Intermediate/Boundary Event": "创建中间/边界事件",
  64 + "Message Start Event": "消息开始事件",
  65 + "Timer Start Event": "定时开始事件",
  66 + "Conditional Start Event": "条件开始事件",
  67 + "Signal Start Event": "信号开始事件",
  68 + "Error Start Event": "错误开始事件",
  69 + "Escalation Start Event": "升级开始事件",
  70 + "Compensation Start Event": "补偿开始事件",
  71 + "Message Start Event (non-interrupting)": "消息开始事件(非中断)",
  72 + "Timer Start Event (non-interrupting)": "定时开始事件(非中断)",
  73 + "Conditional Start Event (non-interrupting)": "条件开始事件(非中断)",
  74 + "Signal Start Event (non-interrupting)": "信号开始事件(非中断)",
  75 + "Escalation Start Event (non-interrupting)": "升级开始事件(非中断)",
  76 + "Message Intermediate Catch Event": "消息中间捕获事件",
  77 + "Message Intermediate Throw Event": "消息中间抛出事件",
  78 + "Timer Intermediate Catch Event": "定时中间捕获事件",
  79 + "Escalation Intermediate Throw Event": "升级中间抛出事件",
  80 + "Conditional Intermediate Catch Event": "条件中间捕获事件",
  81 + "Link Intermediate Catch Event": "链接中间捕获事件",
  82 + "Link Intermediate Throw Event": "链接中间抛出事件",
  83 + "Compensation Intermediate Throw Event": "补偿中间抛出事件",
  84 + "Signal Intermediate Catch Event": "信号中间捕获事件",
  85 + "Signal Intermediate Throw Event": "信号中间抛出事件",
  86 + "Message End Event": "消息结束事件",
  87 + "Escalation End Event": "定时结束事件",
  88 + "Error End Event": "错误结束事件",
  89 + "Cancel End Event": "取消结束事件",
  90 + "Compensation End Event": "补偿结束事件",
  91 + "Signal End Event": "信号结束事件",
  92 + "Terminate End Event": "终止结束事件",
  93 + "Message Boundary Event": "消息边界事件",
  94 + "Message Boundary Event (non-interrupting)": "消息边界事件(非中断)",
  95 + "Timer Boundary Event": "定时边界事件",
  96 + "Timer Boundary Event (non-interrupting)": "定时边界事件(非中断)",
  97 + "Escalation Boundary Event": "升级边界事件",
  98 + "Escalation Boundary Event (non-interrupting)": "升级边界事件(非中断)",
  99 + "Conditional Boundary Event": "条件边界事件",
  100 + "Conditional Boundary Event (non-interrupting)": "条件边界事件(非中断)",
  101 + "Error Boundary Event": "错误边界事件",
  102 + "Cancel Boundary Event": "取消边界事件",
  103 + "Signal Boundary Event": "信号边界事件",
  104 + "Signal Boundary Event (non-interrupting)": "信号边界事件(非中断)",
  105 + "Compensation Boundary Event": "补偿边界事件",
  106 + "Exclusive Gateway": "互斥网关",
  107 + "Parallel Gateway": "并行网关",
  108 + "Inclusive Gateway": "相容网关",
  109 + "Complex Gateway": "复杂网关",
  110 + "Event based Gateway": "事件网关",
  111 + Transaction: "转运",
  112 + "Sub Process": "子流程",
  113 + "Event Sub Process": "事件子流程",
  114 + "Collapsed Pool": "折叠池",
  115 + "Expanded Pool": "展开池",
  116 +
  117 + // Errors
  118 + "no parent for {element} in {parent}": "在{parent}里,{element}没有父类",
  119 + "no shape type specified": "没有指定的形状类型",
  120 + "flow elements must be children of pools/participants": "流元素必须是池/参与者的子类",
  121 + "out of bounds release": "out of bounds release",
  122 + "more than {count} child lanes": "子道大于{count} ",
  123 + "element required": "元素不能为空",
  124 + "diagram not part of bpmn:Definitions": "流程图不符合bpmn规范",
  125 + "no diagram to display": "没有可展示的流程图",
  126 + "no process or collaboration to display": "没有可展示的流程/协作",
  127 + "element {element} referenced by {referenced}#{property} not yet drawn": "由{referenced}#{property}引用的{element}元素仍未绘制",
  128 + "already rendered {element}": "{element} 已被渲染",
  129 + "failed to import {element}": "导入{element}失败",
  130 + //属性面板的参数
  131 + Id: "编号",
  132 + Name: "名称",
  133 + General: "常规",
  134 + Details: "详情",
  135 + "Message Name": "消息名称",
  136 + Message: "消息",
  137 + Initiator: "创建者",
  138 + "Asynchronous Continuations": "持续异步",
  139 + "Asynchronous Before": "异步前",
  140 + "Asynchronous After": "异步后",
  141 + "Job Configuration": "工作配置",
  142 + Exclusive: "排除",
  143 + "Job Priority": "工作优先级",
  144 + "Retry Time Cycle": "重试时间周期",
  145 + Documentation: "文档",
  146 + "Element Documentation": "元素文档",
  147 + "History Configuration": "历史配置",
  148 + "History Time To Live": "历史的生存时间",
  149 + Forms: "表单",
  150 + "Form Key": "表单key",
  151 + "Form Fields": "表单字段",
  152 + "Business Key": "业务key",
  153 + "Form Field": "表单字段",
  154 + ID: "编号",
  155 + Type: "类型",
  156 + Label: "名称",
  157 + "Default Value": "默认值",
  158 + "Default Flow": "默认流转路径",
  159 + "Conditional Flow": "条件流转路径",
  160 + "Sequence Flow": "普通流转路径",
  161 + Validation: "校验",
  162 + "Add Constraint": "添加约束",
  163 + Config: "配置",
  164 + Properties: "属性",
  165 + "Add Property": "添加属性",
  166 + Value: "值",
  167 + Listeners: "监听器",
  168 + "Execution Listener": "执行监听",
  169 + "Event Type": "事件类型",
  170 + "Listener Type": "监听器类型",
  171 + "Java Class": "Java类",
  172 + Expression: "表达式",
  173 + "Must provide a value": "必须提供一个值",
  174 + "Delegate Expression": "代理表达式",
  175 + Script: "脚本",
  176 + "Script Format": "脚本格式",
  177 + "Script Type": "脚本类型",
  178 + "Inline Script": "内联脚本",
  179 + "External Script": "外部脚本",
  180 + Resource: "资源",
  181 + "Field Injection": "字段注入",
  182 + Extensions: "扩展",
  183 + "Input/Output": "输入/输出",
  184 + "Input Parameters": "输入参数",
  185 + "Output Parameters": "输出参数",
  186 + Parameters: "参数",
  187 + "Output Parameter": "输出参数",
  188 + "Timer Definition Type": "定时器定义类型",
  189 + "Timer Definition": "定时器定义",
  190 + Date: "日期",
  191 + Duration: "持续",
  192 + Cycle: "循环",
  193 + Signal: "信号",
  194 + "Signal Name": "信号名称",
  195 + Escalation: "升级",
  196 + Error: "错误",
  197 + "Link Name": "链接名称",
  198 + Condition: "条件名称",
  199 + "Variable Name": "变量名称",
  200 + "Variable Event": "变量事件",
  201 + "Specify more than one variable change event as a comma separated list.": "多个变量事件以逗号隔开",
  202 + "Wait for Completion": "等待完成",
  203 + "Activity Ref": "活动参考",
  204 + "Version Tag": "版本标签",
  205 + Executable: "可执行文件",
  206 + "External Task Configuration": "扩展任务配置",
  207 + "Task Priority": "任务优先级",
  208 + External: "外部",
  209 + Connector: "连接器",
  210 + "Must configure Connector": "必须配置连接器",
  211 + "Connector Id": "连接器编号",
  212 + Implementation: "实现方式",
  213 + "Field Injections": "字段注入",
  214 + Fields: "字段",
  215 + "Result Variable": "结果变量",
  216 + Topic: "主题",
  217 + "Configure Connector": "配置连接器",
  218 + "Input Parameter": "输入参数",
  219 + Assignee: "代理人",
  220 + "Candidate Users": "候选用户",
  221 + "Candidate Groups": "候选组",
  222 + "Due Date": "到期时间",
  223 + "Follow Up Date": "跟踪日期",
  224 + Priority: "优先级",
  225 + "The follow up date as an EL expression (e.g. ${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)":
  226 + "跟踪日期必须符合EL表达式,如: ${someDate} ,或者一个ISO标准日期,如:2015-06-26T09:54:00",
  227 + "The due date as an EL expression (e.g. ${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)":
  228 + "跟踪日期必须符合EL表达式,如: ${someDate} ,或者一个ISO标准日期,如:2015-06-26T09:54:00",
  229 + Variables: "变量",
  230 + "Candidate Starter Configuration": "候选人起动器配置",
  231 + "Candidate Starter Groups": "候选人起动器组",
  232 + "This maps to the process definition key.": "这映射到流程定义键。",
  233 + "Candidate Starter Users": "候选人起动器的用户",
  234 + "Specify more than one user as a comma separated list.": "指定多个用户作为逗号分隔的列表。",
  235 + "Tasklist Configuration": "Tasklist配置",
  236 + Startable: "启动",
  237 + "Specify more than one group as a comma separated list.": "指定多个组作为逗号分隔的列表。"
  238 +};
yudao-admin-ui/src/components/bpmnProcessDesigner/package/index.js 0 → 100644
  1 +import MyProcessDesigner from "./designer";
  2 +import MyProcessPenal from "./penal";
  3 +
  4 +const components = [MyProcessDesigner, MyProcessPenal];
  5 +
  6 +const install = function(Vue) {
  7 + components.forEach(component => {
  8 + Vue.component(component.name, component);
  9 + });
  10 +};
  11 +
  12 +if (typeof window !== "undefined" && window.Vue) {
  13 + install(window.Vue);
  14 +}
  15 +
  16 +export default {
  17 + version: "0.0.1",
  18 + install,
  19 + ...components
  20 +};
yudao-admin-ui/src/components/bpmnProcessDesigner/package/palette/ProcessPalette.vue 0 → 100644
  1 +<template>
  2 + <div class="my-process-palette">
  3 + <div class="test-button" @click="addTask" @mousedown="addTask">测试任务</div>
  4 + <div class="test-container" id="palette-container">1</div>
  5 + </div>
  6 +</template>
  7 +
  8 +<script>
  9 +import { assign } from "min-dash";
  10 +
  11 +export default {
  12 + name: "MyProcessPalette",
  13 + data() {
  14 + return {};
  15 + },
  16 + mounted() {},
  17 + methods: {
  18 + addTask(event, options = {}) {
  19 + const ElementFactory = window.bpmnInstances.elementFactory;
  20 + const create = window.bpmnInstances.modeler.get("create");
  21 +
  22 + console.log(ElementFactory, create);
  23 +
  24 + const shape = ElementFactory.createShape(assign({ type: "bpmn:UserTask" }, options));
  25 +
  26 + if (options) {
  27 + shape.businessObject.di.isExpanded = options.isExpanded;
  28 + }
  29 +
  30 + create.start(event, shape);
  31 + }
  32 + }
  33 +};
  34 +</script>
  35 +
  36 +<style scoped lang="scss">
  37 +.my-process-palette {
  38 + box-sizing: border-box;
  39 + padding: 80px 20px 20px 20px;
  40 + .test-button {
  41 + box-sizing: border-box;
  42 + padding: 8px 16px;
  43 + border-radius: 4px;
  44 + border: 1px solid rgba(24, 144, 255, 0.8);
  45 + cursor: pointer;
  46 + }
  47 +}
  48 +</style>
yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/PropertiesPanel.vue 0 → 100644
  1 +<template>
  2 + <div class="process-panel__container" :style="{ width: `${this.width}px` }">
  3 + <el-collapse v-model="activeTab">
  4 + <el-collapse-item name="base">
  5 + <div slot="title" class="panel-tab__title"><i class="el-icon-info"></i>常规</div>
  6 + <element-base-info :id-edit-disabled="idEditDisabled" :business-object="elementBusinessObject" :type="elementType" />
  7 + </el-collapse-item>
  8 + <el-collapse-item name="condition" v-if="elementType === 'Process'" key="message">
  9 + <div slot="title" class="panel-tab__title"><i class="el-icon-s-comment"></i>消息与信号</div>
  10 + <signal-and-massage />
  11 + </el-collapse-item>
  12 + <el-collapse-item name="condition" v-if="conditionFormVisible" key="condition">
  13 + <div slot="title" class="panel-tab__title"><i class="el-icon-s-promotion"></i>流转条件</div>
  14 + <flow-condition :business-object="elementBusinessObject" :type="elementType" />
  15 + </el-collapse-item>
  16 + <el-collapse-item name="condition" v-if="formVisible" key="form">
  17 + <div slot="title" class="panel-tab__title"><i class="el-icon-s-order"></i>表单</div>
  18 + <element-form :id="elementId" :type="elementType" />
  19 + </el-collapse-item>
  20 + <el-collapse-item name="task" v-if="elementType.indexOf('Task') !== -1" key="task">
  21 + <div slot="title" class="panel-tab__title"><i class="el-icon-s-claim"></i>任务</div>
  22 + <element-task :id="elementId" :type="elementType" />
  23 + </el-collapse-item>
  24 + <el-collapse-item name="multiInstance" v-if="elementType.indexOf('Task') !== -1" key="multiInstance">
  25 + <div slot="title" class="panel-tab__title"><i class="el-icon-s-help"></i>多实例</div>
  26 + <element-multi-instance :business-object="elementBusinessObject" :type="elementType" />
  27 + </el-collapse-item>
  28 + <el-collapse-item name="listeners" key="listeners">
  29 + <div slot="title" class="panel-tab__title"><i class="el-icon-message-solid"></i>执行监听器</div>
  30 + <element-listeners :id="elementId" :type="elementType" />
  31 + </el-collapse-item>
  32 + <el-collapse-item name="taskListeners" v-if="elementType === 'UserTask'" key="taskListeners">
  33 + <div slot="title" class="panel-tab__title"><i class="el-icon-message-solid"></i>任务监听器</div>
  34 + <user-task-listeners :id="elementId" :type="elementType" />
  35 + </el-collapse-item>
  36 + <el-collapse-item name="extensions" key="extensions">
  37 + <div slot="title" class="panel-tab__title"><i class="el-icon-circle-plus"></i>扩展属性</div>
  38 + <element-properties :id="elementId" :type="elementType" />
  39 + </el-collapse-item>
  40 + <el-collapse-item name="other" key="other">
  41 + <div slot="title" class="panel-tab__title"><i class="el-icon-s-promotion"></i>其他</div>
  42 + <element-other-config :id="elementId" />
  43 + </el-collapse-item>
  44 + </el-collapse>
  45 + </div>
  46 +</template>
  47 +<script>
  48 +import ElementBaseInfo from "./base/ElementBaseInfo";
  49 +import ElementOtherConfig from "./other/ElementOtherConfig";
  50 +import ElementTask from "./task/ElementTask";
  51 +import ElementMultiInstance from "./multi-instance/ElementMultiInstance";
  52 +import FlowCondition from "./flow-condition/FlowCondition";
  53 +import SignalAndMassage from "./signal-message/SignalAndMessage";
  54 +import ElementListeners from "./listeners/ElementListeners";
  55 +import ElementProperties from "./properties/ElementProperties";
  56 +import ElementForm from "./form/ElementForm";
  57 +import UserTaskListeners from "./listeners/UserTaskListeners";
  58 +/**
  59 + * 侧边栏
  60 + * @Author MiyueFE
  61 + * @Home https://github.com/miyuesc
  62 + * @Date 2021年3月31日18:57:51
  63 + */
  64 +export default {
  65 + name: "MyPropertiesPanel",
  66 + components: {
  67 + UserTaskListeners,
  68 + ElementForm,
  69 + ElementProperties,
  70 + ElementListeners,
  71 + SignalAndMassage,
  72 + FlowCondition,
  73 + ElementMultiInstance,
  74 + ElementTask,
  75 + ElementOtherConfig,
  76 + ElementBaseInfo
  77 + },
  78 + componentName: "MyPropertiesPanel",
  79 + props: {
  80 + bpmnModeler: Object,
  81 + prefix: {
  82 + type: String,
  83 + default: "camunda"
  84 + },
  85 + width: {
  86 + type: Number,
  87 + default: 480
  88 + },
  89 + idEditDisabled: {
  90 + type: Boolean,
  91 + default: false
  92 + }
  93 + },
  94 + provide() {
  95 + return {
  96 + prefix: this.prefix,
  97 + width: this.width
  98 + };
  99 + },
  100 + data() {
  101 + return {
  102 + activeTab: "base",
  103 + elementId: "",
  104 + elementType: "",
  105 + elementBusinessObject: {}, // 元素 businessObject 镜像,提供给需要做判断的组件使用
  106 + conditionFormVisible: false, // 流转条件设置
  107 + formVisible: false // 表单配置
  108 + };
  109 + },
  110 + watch: {
  111 + elementId: {
  112 + handler() {
  113 + this.activeTab = "base";
  114 + }
  115 + }
  116 + },
  117 + created() {
  118 + this.initModels();
  119 + },
  120 + methods: {
  121 + initModels() {
  122 + // 初始化 modeler 以及其他 moddle
  123 + if (!this.bpmnModeler) {
  124 + // 避免加载时 流程图 并未加载完成
  125 + this.timer = setTimeout(() => this.initModels(), 10);
  126 + return;
  127 + }
  128 + if (this.timer) clearTimeout(this.timer);
  129 + window.bpmnInstances = {
  130 + modeler: this.bpmnModeler,
  131 + modeling: this.bpmnModeler.get("modeling"),
  132 + moddle: this.bpmnModeler.get("moddle"),
  133 + eventBus: this.bpmnModeler.get("eventBus"),
  134 + bpmnFactory: this.bpmnModeler.get("bpmnFactory"),
  135 + elementFactory: this.bpmnModeler.get("elementFactory"),
  136 + elementRegistry: this.bpmnModeler.get("elementRegistry"),
  137 + replace: this.bpmnModeler.get("replace"),
  138 + selection: this.bpmnModeler.get("selection")
  139 + };
  140 + this.getActiveElement();
  141 + },
  142 + getActiveElement() {
  143 + // 初始第一个选中元素 bpmn:Process
  144 + this.initFormOnChanged(null);
  145 + this.bpmnModeler.on("import.done", e => {
  146 + this.initFormOnChanged(null);
  147 + });
  148 + // 监听选择事件,修改当前激活的元素以及表单
  149 + this.bpmnModeler.on("selection.changed", ({ newSelection }) => {
  150 + this.initFormOnChanged(newSelection[0] || null);
  151 + });
  152 + this.bpmnModeler.on("element.changed", ({ element }) => {
  153 + // 保证 修改 "默认流转路径" 类似需要修改多个元素的事件发生的时候,更新表单的元素与原选中元素不一致。
  154 + if (element && element.id === this.elementId) {
  155 + this.initFormOnChanged(element);
  156 + }
  157 + });
  158 + },
  159 + // 初始化数据
  160 + initFormOnChanged(element) {
  161 + let activatedElement = element;
  162 + if (!activatedElement) {
  163 + activatedElement =
  164 + window.bpmnInstances.elementRegistry.find(el => el.type === "bpmn:Process") ??
  165 + window.bpmnInstances.elementRegistry.find(el => el.type === "bpmn:Collaboration");
  166 + }
  167 + if (!activatedElement) return;
  168 + console.log(`
  169 + ----------
  170 + select element changed:
  171 + id: ${activatedElement.id}
  172 + type: ${activatedElement.businessObject.$type}
  173 + ----------
  174 + `);
  175 + console.log("businessObject: ", activatedElement.businessObject);
  176 + window.bpmnInstances.bpmnElement = activatedElement;
  177 + this.bpmnElement = activatedElement;
  178 + this.elementId = activatedElement.id;
  179 + this.elementType = activatedElement.type.split(":")[1] || "";
  180 + this.elementBusinessObject = JSON.parse(JSON.stringify(activatedElement.businessObject));
  181 + this.conditionFormVisible = !!(
  182 + this.elementType === "SequenceFlow" &&
  183 + activatedElement.source &&
  184 + activatedElement.source.type.indexOf("StartEvent") === -1
  185 + );
  186 + this.formVisible = this.elementType === "UserTask" || this.elementType === "StartEvent";
  187 + },
  188 + beforeDestroy() {
  189 + window.bpmnInstances = null;
  190 + }
  191 + }
  192 +};
  193 +</script>
yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/base/ElementBaseInfo.vue 0 → 100644
  1 +<template>
  2 + <div class="panel-tab__content">
  3 + <el-form size="mini" label-width="90px" @submit.native.prevent>
  4 + <el-form-item label="ID">
  5 + <el-input
  6 + v-model="elementBaseInfo.id"
  7 + :disabled="idEditDisabled || elementBaseInfo.$type === 'bpmn:Process'"
  8 + clearable
  9 + @change="updateBaseInfo('id')"
  10 + />
  11 + </el-form-item>
  12 + <el-form-item label="名称">
  13 + <el-input v-model="elementBaseInfo.name" clearable @change="updateBaseInfo('name')" />
  14 + </el-form-item>
  15 + <!--流程的基础属性-->
  16 + <template v-if="elementBaseInfo.$type === 'bpmn:Process'">
  17 + <el-form-item label="版本标签">
  18 + <el-input v-model="elementBaseInfo.versionTag" clearable @change="updateBaseInfo('versionTag')" />
  19 + </el-form-item>
  20 + <el-form-item label="可执行">
  21 + <el-switch v-model="elementBaseInfo.isExecutable" active-text="是" inactive-text="否" @change="updateBaseInfo('isExecutable')" />
  22 + </el-form-item>
  23 + </template>
  24 + </el-form>
  25 + </div>
  26 +</template>
  27 +<script>
  28 +export default {
  29 + name: "ElementBaseInfo",
  30 + props: {
  31 + businessObject: Object,
  32 + type: String,
  33 + idEditDisabled: {
  34 + type: Boolean,
  35 + default: true
  36 + }
  37 + },
  38 + data() {
  39 + return {
  40 + elementBaseInfo: {}
  41 + };
  42 + },
  43 + watch: {
  44 + businessObject: {
  45 + immediate: false,
  46 + handler: function(val) {
  47 + if (val) {
  48 + this.$nextTick(() => this.resetBaseInfo());
  49 + }
  50 + }
  51 + }
  52 + },
  53 + methods: {
  54 + resetBaseInfo() {
  55 + this.bpmnElement = window?.bpmnInstances?.bpmnElement;
  56 + this.elementBaseInfo = JSON.parse(JSON.stringify(this.bpmnElement.businessObject));
  57 + },
  58 + updateBaseInfo(key) {
  59 + const attrObj = Object.create(null);
  60 + attrObj[key] = this.elementBaseInfo[key];
  61 + if (key === "id") {
  62 + window.bpmnInstances.modeling.updateProperties(this.bpmnElement, {
  63 + id: this.elementBaseInfo[key],
  64 + di: { id: `${this.elementBaseInfo[key]}_di` }
  65 + });
  66 + } else {
  67 + window.bpmnInstances.modeling.updateProperties(this.bpmnElement, attrObj);
  68 + }
  69 + }
  70 + },
  71 + beforeDestroy() {
  72 + this.bpmnElement = null;
  73 + }
  74 +};
  75 +</script>
yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/flow-condition/FlowCondition.vue 0 → 100644
  1 +<template>
  2 + <div class="panel-tab__content">
  3 + <el-form :model="flowConditionForm" label-width="90px" size="mini" @submit.native.prevent>
  4 + <el-form-item label="流转类型">
  5 + <el-select v-model="flowConditionForm.type" @change="updateFlowType">
  6 + <el-option label="普通流转路径" value="normal" />
  7 + <el-option label="默认流转路径" value="default" />
  8 + <el-option label="条件流转路径" value="condition" />
  9 + </el-select>
  10 + </el-form-item>
  11 + <el-form-item label="条件格式" v-if="flowConditionForm.type === 'condition'" key="condition">
  12 + <el-select v-model="flowConditionForm.conditionType">
  13 + <el-option label="表达式" value="expression" />
  14 + <el-option label="脚本" value="script" />
  15 + </el-select>
  16 + </el-form-item>
  17 + <el-form-item label="表达式" v-if="flowConditionForm.conditionType && flowConditionForm.conditionType === 'expression'" key="express">
  18 + <el-input v-model="flowConditionForm.body" clearable @change="updateFlowCondition" />
  19 + </el-form-item>
  20 + <template v-if="flowConditionForm.conditionType && flowConditionForm.conditionType === 'script'">
  21 + <el-form-item label="脚本语言" key="language">
  22 + <el-input v-model="flowConditionForm.language" clearable @change="updateFlowCondition" />
  23 + </el-form-item>
  24 + <el-form-item label="脚本类型" key="scriptType">
  25 + <el-select v-model="flowConditionForm.scriptType">
  26 + <el-option label="内联脚本" value="inlineScript" />
  27 + <el-option label="外部脚本" value="externalScript" />
  28 + </el-select>
  29 + </el-form-item>
  30 + <el-form-item label="脚本" v-if="flowConditionForm.scriptType === 'inlineScript'" key="body">
  31 + <el-input v-model="flowConditionForm.body" type="textarea" clearable @change="updateFlowCondition" />
  32 + </el-form-item>
  33 + <el-form-item label="资源地址" v-if="flowConditionForm.scriptType === 'externalScript'" key="resource">
  34 + <el-input v-model="flowConditionForm.resource" clearable @change="updateFlowCondition" />
  35 + </el-form-item>
  36 + </template>
  37 + </el-form>
  38 + </div>
  39 +</template>
  40 +
  41 +<script>
  42 +export default {
  43 + name: "FlowCondition",
  44 + props: {
  45 + businessObject: Object,
  46 + type: String
  47 + },
  48 + data() {
  49 + return {
  50 + flowConditionForm: {}
  51 + };
  52 + },
  53 + watch: {
  54 + businessObject: {
  55 + immediate: true,
  56 + handler() {
  57 + this.$nextTick(() => this.resetFlowCondition());
  58 + }
  59 + }
  60 + },
  61 + methods: {
  62 + resetFlowCondition() {
  63 + this.bpmnElement = window.bpmnInstances.bpmnElement;
  64 + this.bpmnElementSource = this.bpmnElement.source;
  65 + this.bpmnElementSourceRef = this.bpmnElement.businessObject.sourceRef;
  66 + if (this.bpmnElementSourceRef && this.bpmnElementSourceRef.default && this.bpmnElementSourceRef.default.id === this.bpmnElement.id) {
  67 + // 默认
  68 + this.flowConditionForm = { type: "default" };
  69 + } else if (!this.bpmnElement.businessObject.conditionExpression) {
  70 + // 普通
  71 + this.flowConditionForm = { type: "normal" };
  72 + } else {
  73 + // 带条件
  74 + const conditionExpression = this.bpmnElement.businessObject.conditionExpression;
  75 + this.flowConditionForm = { ...conditionExpression, type: "condition" };
  76 + // resource 可直接标识 是否是外部资源脚本
  77 + if (this.flowConditionForm.resource) {
  78 + this.$set(this.flowConditionForm, "conditionType", "script");
  79 + this.$set(this.flowConditionForm, "scriptType", "externalScript");
  80 + return;
  81 + }
  82 + if (conditionExpression.language) {
  83 + this.$set(this.flowConditionForm, "conditionType", "script");
  84 + this.$set(this.flowConditionForm, "scriptType", "inlineScript");
  85 + return;
  86 + }
  87 + this.$set(this.flowConditionForm, "conditionType", "expression");
  88 + }
  89 + },
  90 + updateFlowType(flowType) {
  91 + // 正常条件类
  92 + if (flowType === "condition") {
  93 + this.flowConditionRef = window.bpmnInstances.moddle.create("bpmn:FormalExpression");
  94 + window.bpmnInstances.modeling.updateProperties(this.bpmnElement, {
  95 + conditionExpression: this.flowConditionRef
  96 + });
  97 + return;
  98 + }
  99 + // 默认路径
  100 + if (flowType === "default") {
  101 + window.bpmnInstances.modeling.updateProperties(this.bpmnElement, {
  102 + conditionExpression: null
  103 + });
  104 + window.bpmnInstances.modeling.updateProperties(this.bpmnElementSource, {
  105 + default: this.bpmnElement
  106 + });
  107 + return;
  108 + }
  109 + // 正常路径,如果来源节点的默认路径是当前连线时,清除父元素的默认路径配置
  110 + if (this.bpmnElementSourceRef.default && this.bpmnElementSourceRef.default.id === this.bpmnElement.id) {
  111 + window.bpmnInstances.modeling.updateProperties(this.bpmnElementSource, {
  112 + default: null
  113 + });
  114 + }
  115 + window.bpmnInstances.modeling.updateProperties(this.bpmnElement, {
  116 + conditionExpression: null
  117 + });
  118 + },
  119 + updateFlowCondition() {
  120 + let { conditionType, scriptType, body, resource, language } = this.flowConditionForm;
  121 + let condition;
  122 + if (conditionType === "expression") {
  123 + condition = window.bpmnInstances.moddle.create("bpmn:FormalExpression", { body });
  124 + } else {
  125 + if (scriptType === "inlineScript") {
  126 + condition = window.bpmnInstances.moddle.create("bpmn:FormalExpression", { body, language });
  127 + this.$set(this.flowConditionForm, "resource", "");
  128 + } else {
  129 + this.$set(this.flowConditionForm, "body", "");
  130 + condition = window.bpmnInstances.moddle.create("bpmn:FormalExpression", { resource, language });
  131 + }
  132 + }
  133 + window.bpmnInstances.modeling.updateProperties(this.bpmnElement, { conditionExpression: condition });
  134 + }
  135 + },
  136 + beforeDestroy() {
  137 + this.bpmnElement = null;
  138 + this.bpmnElementSource = null;
  139 + this.bpmnElementSourceRef = null;
  140 + }
  141 +};
  142 +</script>
yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/form/ElementForm.vue 0 → 100644
  1 +<template>
  2 + <div class="panel-tab__content">
  3 + <el-form size="mini" label-width="80px" @submit.native.prevent>
  4 + <el-form-item label="表单标识">
  5 + <el-input v-model="formKey" clearable @change="updateElementFormKey" />
  6 + </el-form-item>
  7 + <el-form-item label="业务标识">
  8 + <el-select v-model="businessKey" @change="updateElementBusinessKey">
  9 + <el-option v-for="i in fieldList" :key="i.id" :value="i.id" :label="i.label" />
  10 + <el-option label="无" value="" />
  11 + </el-select>
  12 + </el-form-item>
  13 + </el-form>
  14 +
  15 + <!--字段列表-->
  16 + <div class="element-property list-property">
  17 + <el-divider><i class="el-icon-coin"></i> 表单字段</el-divider>
  18 + <el-table :data="fieldList" size="mini" max-height="240" border fit>
  19 + <el-table-column label="序号" type="index" width="50px" />
  20 + <el-table-column label="字段名称" prop="label" min-width="80px" show-overflow-tooltip />
  21 + <el-table-column label="字段类型" prop="type" min-width="80px" :formatter="row => fieldType[row.type] || row.type" show-overflow-tooltip />
  22 + <el-table-column label="默认值" prop="defaultValue" min-width="80px" show-overflow-tooltip />
  23 + <el-table-column label="操作" width="90px">
  24 + <template slot-scope="{ row, $index }">
  25 + <el-button size="mini" type="text" @click="openFieldForm(row, $index)">编辑</el-button>
  26 + <el-divider direction="vertical" />
  27 + <el-button size="mini" type="text" style="color: #ff4d4f" @click="removeField(row, $index)">移除</el-button>
  28 + </template>
  29 + </el-table-column>
  30 + </el-table>
  31 + </div>
  32 + <div class="element-drawer__button">
  33 + <el-button size="mini" type="primary" icon="el-icon-plus" @click="openFieldForm(null, -1)">添加字段</el-button>
  34 + </div>
  35 +
  36 + <!--字段配置侧边栏-->
  37 + <el-drawer :visible.sync="fieldModelVisible" title="字段配置" :size="`${width}px`" append-to-body destroy-on-close>
  38 + <el-form :model="formFieldForm" label-width="90px" size="mini" @submit.native.prevent>
  39 + <el-form-item label="字段ID">
  40 + <el-input v-model="formFieldForm.id" clearable />
  41 + </el-form-item>
  42 + <el-form-item label="类型">
  43 + <el-select v-model="formFieldForm.typeType" placeholder="请选择字段类型" clearable @change="changeFieldTypeType">
  44 + <el-option v-for="(value, key) of fieldType" :label="value" :value="key" :key="key" />
  45 + </el-select>
  46 + </el-form-item>
  47 + <el-form-item label="类型名称" v-if="formFieldForm.typeType === 'custom'">
  48 + <el-input v-model="formFieldForm.type" clearable />
  49 + </el-form-item>
  50 + <el-form-item label="名称">
  51 + <el-input v-model="formFieldForm.label" clearable />
  52 + </el-form-item>
  53 + <el-form-item label="时间格式" v-if="formFieldForm.typeType === 'date'">
  54 + <el-input v-model="formFieldForm.datePattern" clearable />
  55 + </el-form-item>
  56 + <el-form-item label="默认值">
  57 + <el-input v-model="formFieldForm.defaultValue" clearable />
  58 + </el-form-item>
  59 + </el-form>
  60 +
  61 + <!-- 枚举值设置 -->
  62 + <template v-if="formFieldForm.type === 'enum'">
  63 + <el-divider key="enum-divider" />
  64 + <p class="listener-filed__title" key="enum-title">
  65 + <span><i class="el-icon-menu"></i>枚举值列表:</span>
  66 + <el-button size="mini" type="primary" @click="openFieldOptionForm(null, -1, 'enum')">添加枚举值</el-button>
  67 + </p>
  68 + <el-table :data="fieldEnumList" size="mini" key="enum-table" max-height="240" border fit>
  69 + <el-table-column label="序号" width="50px" type="index" />
  70 + <el-table-column label="枚举值编号" prop="id" min-width="100px" show-overflow-tooltip />
  71 + <el-table-column label="枚举值名称" prop="name" min-width="100px" show-overflow-tooltip />
  72 + <el-table-column label="操作" width="90px">
  73 + <template slot-scope="{ row, $index }">
  74 + <el-button size="mini" type="text" @click="openFieldOptionForm(row, $index, 'enum')">编辑</el-button>
  75 + <el-divider direction="vertical" />
  76 + <el-button size="mini" type="text" style="color: #ff4d4f" @click="removeFieldOptionItem(row, $index, 'enum')">移除</el-button>
  77 + </template>
  78 + </el-table-column>
  79 + </el-table>
  80 + </template>
  81 +
  82 + <!-- 校验规则 -->
  83 + <el-divider key="validation-divider" />
  84 + <p class="listener-filed__title" key="validation-title">
  85 + <span><i class="el-icon-menu"></i>约束条件列表:</span>
  86 + <el-button size="mini" type="primary" @click="openFieldOptionForm(null, -1, 'constraint')">添加约束</el-button>
  87 + </p>
  88 + <el-table :data="fieldConstraintsList" size="mini" key="validation-table" max-height="240" border fit>
  89 + <el-table-column label="序号" width="50px" type="index" />
  90 + <el-table-column label="约束名称" prop="name" min-width="100px" show-overflow-tooltip />
  91 + <el-table-column label="约束配置" prop="config" min-width="100px" show-overflow-tooltip />
  92 + <el-table-column label="操作" width="90px">
  93 + <template slot-scope="{ row, $index }">
  94 + <el-button size="mini" type="text" @click="openFieldOptionForm(row, $index, 'constraint')">编辑</el-button>
  95 + <el-divider direction="vertical" />
  96 + <el-button size="mini" type="text" style="color: #ff4d4f" @click="removeFieldOptionItem(row, $index, 'constraint')">移除</el-button>
  97 + </template>
  98 + </el-table-column>
  99 + </el-table>
  100 +
  101 + <!-- 表单属性 -->
  102 + <el-divider key="property-divider" />
  103 + <p class="listener-filed__title" key="property-title">
  104 + <span><i class="el-icon-menu"></i>字段属性列表:</span>
  105 + <el-button size="mini" type="primary" @click="openFieldOptionForm(null, -1, 'property')">添加属性</el-button>
  106 + </p>
  107 + <el-table :data="fieldPropertiesList" size="mini" key="property-table" max-height="240" border fit>
  108 + <el-table-column label="序号" width="50px" type="index" />
  109 + <el-table-column label="属性编号" prop="id" min-width="100px" show-overflow-tooltip />
  110 + <el-table-column label="属性值" prop="value" min-width="100px" show-overflow-tooltip />
  111 + <el-table-column label="操作" width="90px">
  112 + <template slot-scope="{ row, $index }">
  113 + <el-button size="mini" type="text" @click="openFieldOptionForm(row, $index, 'property')">编辑</el-button>
  114 + <el-divider direction="vertical" />
  115 + <el-button size="mini" type="text" style="color: #ff4d4f" @click="removeFieldOptionItem(row, $index, 'property')">移除</el-button>
  116 + </template>
  117 + </el-table-column>
  118 + </el-table>
  119 +
  120 + <!-- 底部按钮 -->
  121 + <div class="element-drawer__button">
  122 + <el-button size="mini">取 消</el-button>
  123 + <el-button size="mini" type="primary" @click="saveField">保 存</el-button>
  124 + </div>
  125 + </el-drawer>
  126 +
  127 + <el-dialog :visible.sync="fieldOptionModelVisible" :title="optionModelTitle" width="600px" append-to-body destroy-on-close>
  128 + <el-form :model="fieldOptionForm" size="mini" label-width="96px" @submit.native.prevent>
  129 + <el-form-item label="编号/ID" v-if="fieldOptionType !== 'constraint'" key="option-id">
  130 + <el-input v-model="fieldOptionForm.id" clearable />
  131 + </el-form-item>
  132 + <el-form-item label="名称" v-if="fieldOptionType !== 'property'" key="option-name">
  133 + <el-input v-model="fieldOptionForm.name" clearable />
  134 + </el-form-item>
  135 + <el-form-item label="配置" v-if="fieldOptionType === 'constraint'" key="option-config">
  136 + <el-input v-model="fieldOptionForm.config" clearable />
  137 + </el-form-item>
  138 + <el-form-item label="值" v-if="fieldOptionType === 'property'" key="option-value">
  139 + <el-input v-model="fieldOptionForm.value" clearable />
  140 + </el-form-item>
  141 + </el-form>
  142 + <template slot="footer">
  143 + <el-button size="mini" @click="fieldOptionModelVisible = false">取 消</el-button>
  144 + <el-button size="mini" type="primary" @click="saveFieldOption">确 定</el-button>
  145 + </template>
  146 + </el-dialog>
  147 + </div>
  148 +</template>
  149 +
  150 +<script>
  151 +export default {
  152 + name: "ElementForm",
  153 + props: {
  154 + id: String,
  155 + type: String
  156 + },
  157 + inject: {
  158 + prefix: "prefix",
  159 + width: "width"
  160 + },
  161 + data() {
  162 + return {
  163 + formKey: "",
  164 + businessKey: "",
  165 + optionModelTitle: "",
  166 + fieldList: [],
  167 + formFieldForm: {},
  168 + fieldType: {
  169 + long: "长整型",
  170 + string: "字符串",
  171 + boolean: "布尔类",
  172 + date: "日期类",
  173 + enum: "枚举类",
  174 + custom: "自定义类型"
  175 + },
  176 + formFieldIndex: -1, // 编辑中的字段, -1 为新增
  177 + formFieldOptionIndex: -1, // 编辑中的字段配置项, -1 为新增
  178 + fieldModelVisible: false,
  179 + fieldOptionModelVisible: false,
  180 + fieldOptionForm: {}, // 当前激活的字段配置项数据
  181 + fieldOptionType: "", // 当前激活的字段配置项弹窗 类型
  182 + fieldEnumList: [], // 枚举值列表
  183 + fieldConstraintsList: [], // 约束条件列表
  184 + fieldPropertiesList: [] // 绑定属性列表
  185 + };
  186 + },
  187 + watch: {
  188 + id: {
  189 + immediate: true,
  190 + handler(val) {
  191 + val && val.length && this.$nextTick(() => this.resetFormList());
  192 + }
  193 + }
  194 + },
  195 + methods: {
  196 + resetFormList() {
  197 + this.bpmnELement = window.bpmnInstances.bpmnElement;
  198 + this.formKey = this.bpmnELement.businessObject.formKey;
  199 + // 获取元素扩展属性 或者 创建扩展属性
  200 + this.elExtensionElements =
  201 + this.bpmnELement.businessObject.get("extensionElements") || window.bpmnInstances.moddle.create("bpmn:ExtensionElements", { values: [] });
  202 + // 获取元素表单配置 或者 创建新的表单配置
  203 + this.formData =
  204 + this.elExtensionElements.values.filter(ex => ex.$type === `${this.prefix}:FormData`)?.[0] ||
  205 + window.bpmnInstances.moddle.create(`${this.prefix}:FormData`, { fields: [] });
  206 +
  207 + // 业务标识 businessKey, 绑定在 formData 中
  208 + this.businessKey = this.formData.businessKey;
  209 +
  210 + // 保留剩余扩展元素,便于后面更新该元素对应属性
  211 + this.otherExtensions = this.elExtensionElements.values.filter(ex => ex.$type !== `${this.prefix}:FormData`);
  212 +
  213 + // 复制原始值,填充表格
  214 + this.fieldList = JSON.parse(JSON.stringify(this.formData.fields || []));
  215 +
  216 + // 更新元素扩展属性,避免后续报错
  217 + this.updateElementExtensions();
  218 + },
  219 + updateElementFormKey() {
  220 + window.bpmnInstances.modeling.updateProperties(this.bpmnELement, { formKey: this.formKey });
  221 + },
  222 + updateElementBusinessKey() {
  223 + window.bpmnInstances.modeling.updateModdleProperties(this.bpmnELement, this.formData, { businessKey: this.businessKey });
  224 + },
  225 + // 根据类型调整字段type
  226 + changeFieldTypeType(type) {
  227 + this.$set(this.formFieldForm, "type", type === "custom" ? "" : type);
  228 + },
  229 +
  230 + // 打开字段详情侧边栏
  231 + openFieldForm(field, index) {
  232 + this.formFieldIndex = index;
  233 + if (index !== -1) {
  234 + const FieldObject = this.formData.fields[index];
  235 + this.formFieldForm = JSON.parse(JSON.stringify(field));
  236 + // 设置自定义类型
  237 + this.$set(this.formFieldForm, "typeType", !this.fieldType[field.type] ? "custom" : field.type);
  238 + // 初始化枚举值列表
  239 + field.type === "enum" && (this.fieldEnumList = JSON.parse(JSON.stringify(FieldObject?.values || [])));
  240 + // 初始化约束条件列表
  241 + this.fieldConstraintsList = JSON.parse(JSON.stringify(FieldObject?.validation?.constraints || []));
  242 + // 初始化自定义属性列表
  243 + this.fieldPropertiesList = JSON.parse(JSON.stringify(FieldObject?.properties?.values || []));
  244 + } else {
  245 + this.formFieldForm = {};
  246 + // 初始化枚举值列表
  247 + this.fieldEnumList = [];
  248 + // 初始化约束条件列表
  249 + this.fieldConstraintsList = [];
  250 + // 初始化自定义属性列表
  251 + this.fieldPropertiesList = [];
  252 + }
  253 + this.fieldModelVisible = true;
  254 + },
  255 + // 打开字段 某个 配置项 弹窗
  256 + openFieldOptionForm(option, index, type) {
  257 + this.fieldOptionModelVisible = true;
  258 + this.fieldOptionType = type;
  259 + this.formFieldOptionIndex = index;
  260 + if (type === "property") {
  261 + this.fieldOptionForm = option ? JSON.parse(JSON.stringify(option)) : {};
  262 + return (this.optionModelTitle = "属性配置");
  263 + }
  264 + if (type === "enum") {
  265 + this.fieldOptionForm = option ? JSON.parse(JSON.stringify(option)) : {};
  266 + return (this.optionModelTitle = "枚举值配置");
  267 + }
  268 + this.fieldOptionForm = option ? JSON.parse(JSON.stringify(option)) : {};
  269 + return (this.optionModelTitle = "约束条件配置");
  270 + },
  271 +
  272 + // 保存字段 某个 配置项
  273 + saveFieldOption() {
  274 + if (this.formFieldOptionIndex === -1) {
  275 + if (this.fieldOptionType === "property") {
  276 + this.fieldPropertiesList.push(this.fieldOptionForm);
  277 + }
  278 + if (this.fieldOptionType === "constraint") {
  279 + this.fieldConstraintsList.push(this.fieldOptionForm);
  280 + }
  281 + if (this.fieldOptionType === "enum") {
  282 + this.fieldEnumList.push(this.fieldOptionForm);
  283 + }
  284 + } else {
  285 + this.fieldOptionType === "property" && this.fieldPropertiesList.splice(this.formFieldOptionIndex, 1, this.fieldOptionForm);
  286 + this.fieldOptionType === "constraint" && this.fieldConstraintsList.splice(this.formFieldOptionIndex, 1, this.fieldOptionForm);
  287 + this.fieldOptionType === "enum" && this.fieldEnumList.splice(this.formFieldOptionIndex, 1, this.fieldOptionForm);
  288 + }
  289 + this.fieldOptionModelVisible = false;
  290 + this.fieldOptionForm = {};
  291 + },
  292 + // 保存字段配置
  293 + saveField() {
  294 + const { id, type, label, defaultValue, datePattern } = this.formFieldForm;
  295 + const Field = window.bpmnInstances.moddle.create(`${this.prefix}:FormField`, { id, type, label });
  296 + defaultValue && (Field.defaultValue = defaultValue);
  297 + datePattern && (Field.datePattern = datePattern);
  298 + // 构建属性
  299 + if (this.fieldPropertiesList && this.fieldPropertiesList.length) {
  300 + const fieldPropertyList = this.fieldPropertiesList.map(fp => {
  301 + return window.bpmnInstances.moddle.create(`${this.prefix}:Property`, { id: fp.id, value: fp.value });
  302 + });
  303 + Field.properties = window.bpmnInstances.moddle.create(`${this.prefix}:Properties`, { values: fieldPropertyList });
  304 + }
  305 + // 构建校验规则
  306 + if (this.fieldConstraintsList && this.fieldConstraintsList.length) {
  307 + const fieldConstraintList = this.fieldConstraintsList.map(fc => {
  308 + return window.bpmnInstances.moddle.create(`${this.prefix}:Constraint`, { name: fc.name, config: fc.config });
  309 + });
  310 + Field.validation = window.bpmnInstances.moddle.create(`${this.prefix}:Validation`, { constraints: fieldConstraintList });
  311 + }
  312 + // 构建枚举值
  313 + if (this.fieldEnumList && this.fieldEnumList.length) {
  314 + Field.values = this.fieldEnumList.map(fe => {
  315 + return window.bpmnInstances.moddle.create(`${this.prefix}:Value`, { name: fe.name, id: fe.id });
  316 + });
  317 + }
  318 + // 更新数组 与 表单配置实例
  319 + if (this.formFieldIndex === -1) {
  320 + this.fieldList.push(this.formFieldForm);
  321 + this.formData.fields.push(Field);
  322 + } else {
  323 + this.fieldList.splice(this.formFieldIndex, 1, this.formFieldForm);
  324 + this.formData.fields.splice(this.formFieldIndex, 1, Field);
  325 + }
  326 + this.updateElementExtensions();
  327 + this.fieldModelVisible = false;
  328 + },
  329 +
  330 + // 移除某个 字段的 配置项
  331 + removeFieldOptionItem(option, index, type) {
  332 + if (type === "property") {
  333 + this.fieldPropertiesList.splice(index, 1);
  334 + return;
  335 + }
  336 + if (type === "enum") {
  337 + this.fieldEnumList.splice(index, 1);
  338 + return;
  339 + }
  340 + this.fieldConstraintsList.splice(index, 1);
  341 + },
  342 + // 移除 字段
  343 + removeField(field, index) {
  344 + this.fieldList.splice(index, 1);
  345 + this.formData.fields.splice(index, 1);
  346 + this.updateElementExtensions();
  347 + },
  348 +
  349 + updateElementExtensions() {
  350 + // 更新回扩展元素
  351 + const newElExtensionElements = window.bpmnInstances.moddle.create(`bpmn:ExtensionElements`, {
  352 + values: this.otherExtensions.concat(this.formData)
  353 + });
  354 + // 更新到元素上
  355 + window.bpmnInstances.modeling.updateProperties(this.bpmnELement, {
  356 + extensionElements: newElExtensionElements
  357 + });
  358 + }
  359 + }
  360 +};
  361 +</script>
yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/index.js 0 → 100644
  1 +import MyPropertiesPanel from "./PropertiesPanel.vue";
  2 +
  3 +MyPropertiesPanel.install = function(Vue) {
  4 + Vue.component(MyPropertiesPanel.name, MyPropertiesPanel);
  5 +};
  6 +
  7 +export default MyPropertiesPanel;
yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/listeners/ElementListeners.vue 0 → 100644
  1 +<template>
  2 + <div class="panel-tab__content">
  3 + <el-table :data="elementListenersList" size="mini" border>
  4 + <el-table-column label="序号" width="50px" type="index" />
  5 + <el-table-column label="事件类型" min-width="100px" prop="event" />
  6 + <el-table-column label="监听器类型" min-width="100px" show-overflow-tooltip :formatter="row => listenerTypeObject[row.listenerType]" />
  7 + <el-table-column label="操作" width="90px">
  8 + <template slot-scope="{ row, $index }">
  9 + <el-button size="mini" type="text" @click="openListenerForm(row, $index)">编辑</el-button>
  10 + <el-divider direction="vertical" />
  11 + <el-button size="mini" type="text" style="color: #ff4d4f" @click="removeListener(row, $index)">移除</el-button>
  12 + </template>
  13 + </el-table-column>
  14 + </el-table>
  15 + <div class="element-drawer__button">
  16 + <el-button size="mini" type="primary" icon="el-icon-plus" @click="openListenerForm(null)">添加监听器</el-button>
  17 + </div>
  18 +
  19 + <!-- 监听器 编辑/创建 部分 -->
  20 + <el-drawer :visible.sync="listenerFormModelVisible" title="执行监听器" :size="`${width}px`" append-to-body destroy-on-close>
  21 + <el-form size="mini" :model="listenerForm" label-width="96px" ref="listenerFormRef" @submit.native.prevent>
  22 + <el-form-item label="事件类型" prop="event" :rules="{ required: true, trigger: ['blur', 'change'] }">
  23 + <el-select v-model="listenerForm.event">
  24 + <el-option label="start" value="start" />
  25 + <el-option label="end" value="end" />
  26 + </el-select>
  27 + </el-form-item>
  28 + <el-form-item label="监听器类型" prop="listenerType" :rules="{ required: true, trigger: ['blur', 'change'] }">
  29 + <el-select v-model="listenerForm.listenerType">
  30 + <el-option v-for="i in Object.keys(listenerTypeObject)" :key="i" :label="listenerTypeObject[i]" :value="i" />
  31 + </el-select>
  32 + </el-form-item>
  33 + <el-form-item
  34 + v-if="listenerForm.listenerType === 'classListener'"
  35 + label="Java类"
  36 + prop="class"
  37 + key="listener-class"
  38 + :rules="{ required: true, trigger: ['blur', 'change'] }"
  39 + >
  40 + <el-input v-model="listenerForm.class" clearable />
  41 + </el-form-item>
  42 + <el-form-item
  43 + v-if="listenerForm.listenerType === 'expressionListener'"
  44 + label="表达式"
  45 + prop="expression"
  46 + key="listener-expression"
  47 + :rules="{ required: true, trigger: ['blur', 'change'] }"
  48 + >
  49 + <el-input v-model="listenerForm.expression" clearable />
  50 + </el-form-item>
  51 + <el-form-item
  52 + v-if="listenerForm.listenerType === 'delegateExpressionListener'"
  53 + label="代理表达式"
  54 + prop="delegateExpression"
  55 + key="listener-delegate"
  56 + :rules="{ required: true, trigger: ['blur', 'change'] }"
  57 + >
  58 + <el-input v-model="listenerForm.delegateExpression" clearable />
  59 + </el-form-item>
  60 + <template v-if="listenerForm.listenerType === 'scriptListener'">
  61 + <el-form-item
  62 + label="脚本格式"
  63 + prop="scriptFormat"
  64 + key="listener-script-format"
  65 + :rules="{ required: true, trigger: ['blur', 'change'], message: '请填写脚本格式' }"
  66 + >
  67 + <el-input v-model="listenerForm.scriptFormat" clearable />
  68 + </el-form-item>
  69 + <el-form-item
  70 + label="脚本类型"
  71 + prop="scriptType"
  72 + key="listener-script-type"
  73 + :rules="{ required: true, trigger: ['blur', 'change'], message: '请选择脚本类型' }"
  74 + >
  75 + <el-select v-model="listenerForm.scriptType">
  76 + <el-option label="内联脚本" value="inlineScript" />
  77 + <el-option label="外部脚本" value="externalScript" />
  78 + </el-select>
  79 + </el-form-item>
  80 + <el-form-item
  81 + v-if="listenerForm.scriptType === 'inlineScript'"
  82 + label="脚本内容"
  83 + prop="value"
  84 + key="listener-script"
  85 + :rules="{ required: true, trigger: ['blur', 'change'], message: '请填写脚本内容' }"
  86 + >
  87 + <el-input v-model="listenerForm.value" clearable />
  88 + </el-form-item>
  89 + <el-form-item
  90 + v-if="listenerForm.scriptType === 'externalScript'"
  91 + label="资源地址"
  92 + prop="resource"
  93 + key="listener-resource"
  94 + :rules="{ required: true, trigger: ['blur', 'change'], message: '请填写资源地址' }"
  95 + >
  96 + <el-input v-model="listenerForm.resource" clearable />
  97 + </el-form-item>
  98 + </template>
  99 + </el-form>
  100 + <el-divider />
  101 + <p class="listener-filed__title">
  102 + <span><i class="el-icon-menu"></i>注入字段:</span>
  103 + <el-button size="mini" type="primary" @click="openListenerFieldForm(null)">添加字段</el-button>
  104 + </p>
  105 + <el-table :data="fieldsListOfListener" size="mini" max-height="240" border fit style="flex: none">
  106 + <el-table-column label="序号" width="50px" type="index" />
  107 + <el-table-column label="字段名称" min-width="100px" prop="name" />
  108 + <el-table-column label="字段类型" min-width="80px" show-overflow-tooltip :formatter="row => fieldTypeObject[row.fieldType]" />
  109 + <el-table-column label="字段值/表达式" min-width="100px" show-overflow-tooltip :formatter="row => row.string || row.expression" />
  110 + <el-table-column label="操作" width="100px">
  111 + <template slot-scope="{ row, $index }">
  112 + <el-button size="mini" type="text" @click="openListenerFieldForm(row, $index)">编辑</el-button>
  113 + <el-divider direction="vertical" />
  114 + <el-button size="mini" type="text" style="color: #ff4d4f" @click="removeListenerField(row, $index)">移除</el-button>
  115 + </template>
  116 + </el-table-column>
  117 + </el-table>
  118 +
  119 + <div class="element-drawer__button">
  120 + <el-button size="mini" @click="listenerFormModelVisible = false">取 消</el-button>
  121 + <el-button size="mini" type="primary" @click="saveListenerConfig">保 存</el-button>
  122 + </div>
  123 + </el-drawer>
  124 +
  125 + <!-- 注入西段 编辑/创建 部分 -->
  126 + <el-dialog title="字段配置" :visible.sync="listenerFieldFormModelVisible" width="600px" append-to-body destroy-on-close>
  127 + <el-form :model="listenerFieldForm" size="mini" label-width="96px" ref="listenerFieldFormRef" style="height: 136px" @submit.native.prevent>
  128 + <el-form-item label="字段名称:" prop="name" :rules="{ required: true, trigger: ['blur', 'change'] }">
  129 + <el-input v-model="listenerFieldForm.name" clearable />
  130 + </el-form-item>
  131 + <el-form-item label="字段类型:" prop="fieldType" :rules="{ required: true, trigger: ['blur', 'change'] }">
  132 + <el-select v-model="listenerFieldForm.fieldType">
  133 + <el-option v-for="i in Object.keys(fieldTypeObject)" :key="i" :label="fieldTypeObject[i]" :value="i" />
  134 + </el-select>
  135 + </el-form-item>
  136 + <el-form-item
  137 + v-if="listenerFieldForm.fieldType === 'string'"
  138 + label="字段值:"
  139 + prop="string"
  140 + key="field-string"
  141 + :rules="{ required: true, trigger: ['blur', 'change'] }"
  142 + >
  143 + <el-input v-model="listenerFieldForm.string" clearable />
  144 + </el-form-item>
  145 + <el-form-item
  146 + v-if="listenerFieldForm.fieldType === 'expression'"
  147 + label="表达式:"
  148 + prop="expression"
  149 + key="field-expression"
  150 + :rules="{ required: true, trigger: ['blur', 'change'] }"
  151 + >
  152 + <el-input v-model="listenerFieldForm.expression" clearable />
  153 + </el-form-item>
  154 + </el-form>
  155 + <template slot="footer">
  156 + <el-button size="mini" @click="listenerFieldFormModelVisible = false">取 消</el-button>
  157 + <el-button size="mini" type="primary" @click="saveListenerFiled">确 定</el-button>
  158 + </template>
  159 + </el-dialog>
  160 + </div>
  161 +</template>
  162 +<script>
  163 +import { createListenerObject, updateElementExtensions } from "../../utils";
  164 +import { initListenerType, initListenerForm, listenerType, fieldType } from "./utilSelf";
  165 +
  166 +export default {
  167 + name: "ElementListeners",
  168 + props: {
  169 + id: String,
  170 + type: String
  171 + },
  172 + inject: {
  173 + prefix: "prefix",
  174 + width: "width"
  175 + },
  176 + data() {
  177 + return {
  178 + elementListenersList: [], // 监听器列表
  179 + listenerForm: {}, // 监听器详情表单
  180 + listenerFormModelVisible: false, // 监听器 编辑 侧边栏显示状态
  181 + fieldsListOfListener: [],
  182 + listenerFieldForm: {}, // 监听器 注入字段 详情表单
  183 + listenerFieldFormModelVisible: false, // 监听器 注入字段表单弹窗 显示状态
  184 + editingListenerIndex: -1, // 监听器所在下标,-1 为新增
  185 + editingListenerFieldIndex: -1, // 字段所在下标,-1 为新增
  186 + listenerTypeObject: listenerType,
  187 + fieldTypeObject: fieldType
  188 + };
  189 + },
  190 + watch: {
  191 + id: {
  192 + immediate: true,
  193 + handler(val) {
  194 + val && val.length && this.$nextTick(() => this.resetListenersList());
  195 + }
  196 + }
  197 + },
  198 + methods: {
  199 + resetListenersList() {
  200 + this.bpmnElement = window.bpmnInstances.bpmnElement;
  201 + this.otherExtensionList = [];
  202 + this.bpmnElementListeners =
  203 + this.bpmnElement.businessObject?.extensionElements?.values?.filter(ex => ex.$type === `${this.prefix}:ExecutionListener`) ?? [];
  204 + this.elementListenersList = this.bpmnElementListeners.map(listener => initListenerType(listener));
  205 + },
  206 + // 打开 监听器详情 侧边栏
  207 + openListenerForm(listener, index) {
  208 + if (listener) {
  209 + this.listenerForm = initListenerForm(listener);
  210 + this.editingListenerIndex = index;
  211 + } else {
  212 + this.listenerForm = {};
  213 + this.editingListenerIndex = -1; // 标记为新增
  214 + }
  215 + if (listener && listener.fields) {
  216 + this.fieldsListOfListener = listener.fields.map(field => ({ ...field, fieldType: field.string ? "string" : "expression" }));
  217 + } else {
  218 + this.fieldsListOfListener = [];
  219 + this.$set(this.listenerForm, "fields", []);
  220 + }
  221 + // 打开侧边栏并清楚验证状态
  222 + this.listenerFormModelVisible = true;
  223 + this.$nextTick(() => {
  224 + if (this.$refs["listenerFormRef"]) this.$refs["listenerFormRef"].clearValidate();
  225 + });
  226 + },
  227 + // 打开监听器字段编辑弹窗
  228 + openListenerFieldForm(field, index) {
  229 + this.listenerFieldForm = field ? JSON.parse(JSON.stringify(field)) : {};
  230 + this.editingListenerFieldIndex = field ? index : -1;
  231 + this.listenerFieldFormModelVisible = true;
  232 + this.$nextTick(() => {
  233 + if (this.$refs["listenerFieldFormRef"]) this.$refs["listenerFieldFormRef"].clearValidate();
  234 + });
  235 + },
  236 + // 保存监听器注入字段
  237 + async saveListenerFiled() {
  238 + let validateStatus = await this.$refs["listenerFieldFormRef"].validate();
  239 + if (!validateStatus) return; // 验证不通过直接返回
  240 + if (this.editingListenerFieldIndex === -1) {
  241 + this.fieldsListOfListener.push(this.listenerFieldForm);
  242 + this.listenerForm.fields.push(this.listenerFieldForm);
  243 + } else {
  244 + this.fieldsListOfListener.splice(this.editingListenerFieldIndex, 1, this.listenerFieldForm);
  245 + this.listenerForm.fields.splice(this.editingListenerFieldIndex, 1, this.listenerFieldForm);
  246 + }
  247 + this.listenerFieldFormModelVisible = false;
  248 + this.$nextTick(() => (this.listenerFieldForm = {}));
  249 + },
  250 + // 移除监听器字段
  251 + removeListenerField(field, index) {
  252 + this.$confirm("确认移除该字段吗?", "提示", {
  253 + confirmButtonText: "确 认",
  254 + cancelButtonText: "取 消"
  255 + })
  256 + .then(() => {
  257 + this.fieldsListOfListener.splice(index, 1);
  258 + this.listenerForm.fields.splice(index, 1);
  259 + })
  260 + .catch(() => console.info("操作取消"));
  261 + },
  262 + // 移除监听器
  263 + removeListener(listener, index) {
  264 + this.$confirm("确认移除该监听器吗?", "提示", {
  265 + confirmButtonText: "确 认",
  266 + cancelButtonText: "取 消"
  267 + })
  268 + .then(() => {
  269 + this.bpmnElementListeners.splice(index, 1);
  270 + this.elementListenersList.splice(index, 1);
  271 + updateElementExtensions(this.bpmnElement, this.otherExtensionList.concat(this.bpmnElementListeners));
  272 + })
  273 + .catch(() => console.info("操作取消"));
  274 + },
  275 + // 保存监听器配置
  276 + async saveListenerConfig() {
  277 + let validateStatus = await this.$refs["listenerFormRef"].validate();
  278 + if (!validateStatus) return; // 验证不通过直接返回
  279 + const listenerObject = createListenerObject(this.listenerForm, false, this.prefix);
  280 + if (this.editingListenerIndex === -1) {
  281 + this.bpmnElementListeners.push(listenerObject);
  282 + this.elementListenersList.push(this.listenerForm);
  283 + } else {
  284 + this.bpmnElementListeners.splice(this.editingListenerIndex, 1, listenerObject);
  285 + this.elementListenersList.splice(this.editingListenerIndex, 1, this.listenerForm);
  286 + }
  287 + // 保存其他配置
  288 + this.otherExtensionList = this.bpmnElement.businessObject?.extensionElements?.values?.filter(ex => ex.$type !== `${this.prefix}:ExecutionListener`) ?? [];
  289 + updateElementExtensions(this.bpmnElement, this.otherExtensionList.concat(this.bpmnElementListeners));
  290 + // 4. 隐藏侧边栏
  291 + this.listenerFormModelVisible = false;
  292 + this.listenerForm = {};
  293 + }
  294 + }
  295 +};
  296 +</script>
yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/listeners/UserTaskListeners.vue 0 → 100644
  1 +<template>
  2 + <div class="panel-tab__content">
  3 + <el-table :data="elementListenersList" size="mini" border>
  4 + <el-table-column label="序号" width="50px" type="index" />
  5 + <el-table-column label="事件类型" min-width="80px" show-overflow-tooltip :formatter="row => listenerEventTypeObject[row.event]" />
  6 + <el-table-column label="事件id" min-width="80px" prop="id" show-overflow-tooltip />
  7 + <el-table-column label="监听器类型" min-width="80px" show-overflow-tooltip :formatter="row => listenerTypeObject[row.listenerType]" />
  8 + <el-table-column label="操作" width="90px">
  9 + <template slot-scope="{ row, $index }">
  10 + <el-button size="mini" type="text" @click="openListenerForm(row, $index)">编辑</el-button>
  11 + <el-divider direction="vertical" />
  12 + <el-button size="mini" type="text" style="color: #ff4d4f" @click="removeListener(row, $index)">移除</el-button>
  13 + </template>
  14 + </el-table-column>
  15 + </el-table>
  16 + <div class="element-drawer__button">
  17 + <el-button size="mini" type="primary" icon="el-icon-plus" @click="openListenerForm(null)">添加监听器</el-button>
  18 + </div>
  19 +
  20 + <!-- 监听器 编辑/创建 部分 -->
  21 + <el-drawer :visible.sync="listenerFormModelVisible" title="任务监听器" :size="`${width}px`" append-to-body destroy-on-close>
  22 + <el-form size="mini" :model="listenerForm" label-width="96px" ref="listenerFormRef" @submit.native.prevent>
  23 + <el-form-item label="事件类型" prop="event" :rules="{ required: true, trigger: ['blur', 'change'] }">
  24 + <el-select v-model="listenerForm.event">
  25 + <el-option v-for="i in Object.keys(listenerEventTypeObject)" :key="i" :label="listenerEventTypeObject[i]" :value="i" />
  26 + </el-select>
  27 + </el-form-item>
  28 + <el-form-item label="监听器ID" prop="id" :rules="{ required: true, trigger: ['blur', 'change'] }">
  29 + <el-input v-model="listenerForm.id" clearable />
  30 + </el-form-item>
  31 + <el-form-item label="监听器类型" prop="listenerType" :rules="{ required: true, trigger: ['blur', 'change'] }">
  32 + <el-select v-model="listenerForm.listenerType">
  33 + <el-option v-for="i in Object.keys(listenerTypeObject)" :key="i" :label="listenerTypeObject[i]" :value="i" />
  34 + </el-select>
  35 + </el-form-item>
  36 + <el-form-item
  37 + v-if="listenerForm.listenerType === 'classListener'"
  38 + label="Java类"
  39 + prop="class"
  40 + key="listener-class"
  41 + :rules="{ required: true, trigger: ['blur', 'change'] }"
  42 + >
  43 + <el-input v-model="listenerForm.class" clearable />
  44 + </el-form-item>
  45 + <el-form-item
  46 + v-if="listenerForm.listenerType === 'expressionListener'"
  47 + label="表达式"
  48 + prop="expression"
  49 + key="listener-expression"
  50 + :rules="{ required: true, trigger: ['blur', 'change'] }"
  51 + >
  52 + <el-input v-model="listenerForm.expression" clearable />
  53 + </el-form-item>
  54 + <el-form-item
  55 + v-if="listenerForm.listenerType === 'delegateExpressionListener'"
  56 + label="代理表达式"
  57 + prop="delegateExpression"
  58 + key="listener-delegate"
  59 + :rules="{ required: true, trigger: ['blur', 'change'] }"
  60 + >
  61 + <el-input v-model="listenerForm.delegateExpression" clearable />
  62 + </el-form-item>
  63 + <template v-if="listenerForm.listenerType === 'scriptListener'">
  64 + <el-form-item
  65 + label="脚本格式"
  66 + prop="scriptFormat"
  67 + key="listener-script-format"
  68 + :rules="{ required: true, trigger: ['blur', 'change'], message: '请填写脚本格式' }"
  69 + >
  70 + <el-input v-model="listenerForm.scriptFormat" clearable />
  71 + </el-form-item>
  72 + <el-form-item
  73 + label="脚本类型"
  74 + prop="scriptType"
  75 + key="listener-script-type"
  76 + :rules="{ required: true, trigger: ['blur', 'change'], message: '请选择脚本类型' }"
  77 + >
  78 + <el-select v-model="listenerForm.scriptType">
  79 + <el-option label="内联脚本" value="inlineScript" />
  80 + <el-option label="外部脚本" value="externalScript" />
  81 + </el-select>
  82 + </el-form-item>
  83 + <el-form-item
  84 + v-if="listenerForm.scriptType === 'inlineScript'"
  85 + label="脚本内容"
  86 + prop="value"
  87 + key="listener-script"
  88 + :rules="{ required: true, trigger: ['blur', 'change'], message: '请填写脚本内容' }"
  89 + >
  90 + <el-input v-model="listenerForm.value" clearable />
  91 + </el-form-item>
  92 + <el-form-item
  93 + v-if="listenerForm.scriptType === 'externalScript'"
  94 + label="资源地址"
  95 + prop="resource"
  96 + key="listener-resource"
  97 + :rules="{ required: true, trigger: ['blur', 'change'], message: '请填写资源地址' }"
  98 + >
  99 + <el-input v-model="listenerForm.resource" clearable />
  100 + </el-form-item>
  101 + </template>
  102 +
  103 + <template v-if="listenerForm.event === 'timeout'">
  104 + <el-form-item label="定时器类型" prop="eventDefinitionType" key="eventDefinitionType">
  105 + <el-select v-model="listenerForm.eventDefinitionType">
  106 + <el-option label="日期" value="date" />
  107 + <el-option label="持续时长" value="duration" />
  108 + <el-option label="循环" value="cycle" />
  109 + <el-option label="无" value="null" />
  110 + </el-select>
  111 + </el-form-item>
  112 + <el-form-item
  113 + v-if="!!listenerForm.eventDefinitionType && listenerForm.eventDefinitionType !== 'null'"
  114 + label="定时器"
  115 + prop="eventTimeDefinitions"
  116 + key="eventTimeDefinitions"
  117 + :rules="{ required: true, trigger: ['blur', 'change'], message: '请填写定时器配置' }"
  118 + >
  119 + <el-input v-model="listenerForm.eventTimeDefinitions" clearable />
  120 + </el-form-item>
  121 + </template>
  122 + </el-form>
  123 +
  124 + <el-divider />
  125 + <p class="listener-filed__title">
  126 + <span><i class="el-icon-menu"></i>注入字段:</span>
  127 + <el-button size="mini" type="primary" @click="openListenerFieldForm(null)">添加字段</el-button>
  128 + </p>
  129 + <el-table :data="fieldsListOfListener" size="mini" max-height="240" border fit style="flex: none">
  130 + <el-table-column label="序号" width="50px" type="index" />
  131 + <el-table-column label="字段名称" min-width="100px" prop="name" />
  132 + <el-table-column label="字段类型" min-width="80px" show-overflow-tooltip :formatter="row => fieldTypeObject[row.fieldType]" />
  133 + <el-table-column label="字段值/表达式" min-width="100px" show-overflow-tooltip :formatter="row => row.string || row.expression" />
  134 + <el-table-column label="操作" width="100px">
  135 + <template slot-scope="{ row, $index }">
  136 + <el-button size="mini" type="text" @click="openListenerFieldForm(row, $index)">编辑</el-button>
  137 + <el-divider direction="vertical" />
  138 + <el-button size="mini" type="text" style="color: #ff4d4f" @click="removeListenerField(row, $index)">移除</el-button>
  139 + </template>
  140 + </el-table-column>
  141 + </el-table>
  142 +
  143 + <div class="element-drawer__button">
  144 + <el-button size="mini" @click="listenerFormModelVisible = false">取 消</el-button>
  145 + <el-button size="mini" type="primary" @click="saveListenerConfig">保 存</el-button>
  146 + </div>
  147 + </el-drawer>
  148 +
  149 + <!-- 注入西段 编辑/创建 部分 -->
  150 + <el-dialog title="字段配置" :visible.sync="listenerFieldFormModelVisible" width="600px" append-to-body destroy-on-close>
  151 + <el-form :model="listenerFieldForm" size="mini" label-width="96px" ref="listenerFieldFormRef" style="height: 136px" @submit.native.prevent>
  152 + <el-form-item label="字段名称:" prop="name" :rules="{ required: true, trigger: ['blur', 'change'] }">
  153 + <el-input v-model="listenerFieldForm.name" clearable />
  154 + </el-form-item>
  155 + <el-form-item label="字段类型:" prop="fieldType" :rules="{ required: true, trigger: ['blur', 'change'] }">
  156 + <el-select v-model="listenerFieldForm.fieldType">
  157 + <el-option v-for="i in Object.keys(fieldTypeObject)" :key="i" :label="fieldTypeObject[i]" :value="i" />
  158 + </el-select>
  159 + </el-form-item>
  160 + <el-form-item
  161 + v-if="listenerFieldForm.fieldType === 'string'"
  162 + label="字段值:"
  163 + prop="string"
  164 + key="field-string"
  165 + :rules="{ required: true, trigger: ['blur', 'change'] }"
  166 + >
  167 + <el-input v-model="listenerFieldForm.string" clearable />
  168 + </el-form-item>
  169 + <el-form-item
  170 + v-if="listenerFieldForm.fieldType === 'expression'"
  171 + label="表达式:"
  172 + prop="expression"
  173 + key="field-expression"
  174 + :rules="{ required: true, trigger: ['blur', 'change'] }"
  175 + >
  176 + <el-input v-model="listenerFieldForm.expression" clearable />
  177 + </el-form-item>
  178 + </el-form>
  179 + <template slot="footer">
  180 + <el-button size="mini" @click="listenerFieldFormModelVisible = false">取 消</el-button>
  181 + <el-button size="mini" type="primary" @click="saveListenerFiled">确 定</el-button>
  182 + </template>
  183 + </el-dialog>
  184 + </div>
  185 +</template>
  186 +<script>
  187 +import { createListenerObject, updateElementExtensions } from "../../utils";
  188 +import { initListenerForm, initListenerType, eventType, listenerType, fieldType } from "./utilSelf";
  189 +
  190 +export default {
  191 + name: "UserTaskListeners",
  192 + props: {
  193 + id: String,
  194 + type: String
  195 + },
  196 + inject: {
  197 + prefix: "prefix",
  198 + width: "width"
  199 + },
  200 + data() {
  201 + return {
  202 + elementListenersList: [],
  203 + listenerEventTypeObject: eventType,
  204 + listenerTypeObject: listenerType,
  205 + listenerFormModelVisible: false,
  206 + listenerForm: {},
  207 + fieldTypeObject: fieldType,
  208 + fieldsListOfListener: [],
  209 + listenerFieldFormModelVisible: false, // 监听器 注入字段表单弹窗 显示状态
  210 + editingListenerIndex: -1, // 监听器所在下标,-1 为新增
  211 + editingListenerFieldIndex: -1, // 字段所在下标,-1 为新增
  212 + listenerFieldForm: {} // 监听器 注入字段 详情表单
  213 + };
  214 + },
  215 + watch: {
  216 + id: {
  217 + immediate: true,
  218 + handler(val) {
  219 + val && val.length && this.$nextTick(() => this.resetListenersList());
  220 + }
  221 + }
  222 + },
  223 + methods: {
  224 + resetListenersList() {
  225 + this.bpmnElement = window.bpmnInstances.bpmnElement;
  226 + this.otherExtensionList = [];
  227 + this.bpmnElementListeners = this.bpmnElement.businessObject?.extensionElements?.values?.filter(ex => ex.$type === `${this.prefix}:TaskListener`) ?? [];
  228 + this.elementListenersList = this.bpmnElementListeners.map(listener => initListenerType(listener));
  229 + },
  230 + openListenerForm(listener, index) {
  231 + if (listener) {
  232 + this.listenerForm = initListenerForm(listener);
  233 + this.editingListenerIndex = index;
  234 + } else {
  235 + this.listenerForm = {};
  236 + this.editingListenerIndex = -1; // 标记为新增
  237 + }
  238 + if (listener && listener.fields) {
  239 + this.fieldsListOfListener = listener.fields.map(field => ({ ...field, fieldType: field.string ? "string" : "expression" }));
  240 + } else {
  241 + this.fieldsListOfListener = [];
  242 + this.$set(this.listenerForm, "fields", []);
  243 + }
  244 + // 打开侧边栏并清楚验证状态
  245 + this.listenerFormModelVisible = true;
  246 + this.$nextTick(() => {
  247 + if (this.$refs["listenerFormRef"]) this.$refs["listenerFormRef"].clearValidate();
  248 + });
  249 + },
  250 + // 移除监听器
  251 + removeListener(listener, index) {
  252 + this.$confirm("确认移除该监听器吗?", "提示", {
  253 + confirmButtonText: "确 认",
  254 + cancelButtonText: "取 消"
  255 + })
  256 + .then(() => {
  257 + this.bpmnElementListeners.splice(index, 1);
  258 + this.elementListenersList.splice(index, 1);
  259 + updateElementExtensions(this.bpmnElement, this.otherExtensionList.concat(this.bpmnElementListeners));
  260 + })
  261 + .catch(() => console.info("操作取消"));
  262 + },
  263 + // 保存监听器
  264 + async saveListenerConfig() {
  265 + let validateStatus = await this.$refs["listenerFormRef"].validate();
  266 + if (!validateStatus) return; // 验证不通过直接返回
  267 + const listenerObject = createListenerObject(this.listenerForm, true, this.prefix);
  268 + if (this.editingListenerIndex === -1) {
  269 + this.bpmnElementListeners.push(listenerObject);
  270 + this.elementListenersList.push(this.listenerForm);
  271 + } else {
  272 + this.bpmnElementListeners.splice(this.editingListenerIndex, 1, listenerObject);
  273 + this.elementListenersList.splice(this.editingListenerIndex, 1, this.listenerForm);
  274 + }
  275 + // 保存其他配置
  276 + this.otherExtensionList = this.bpmnElement.businessObject?.extensionElements?.values?.filter(ex => ex.$type !== `${this.prefix}:TaskListener`) ?? [];
  277 + updateElementExtensions(this.bpmnElement, this.otherExtensionList.concat(this.bpmnElementListeners));
  278 + // 4. 隐藏侧边栏
  279 + this.listenerFormModelVisible = false;
  280 + this.listenerForm = {};
  281 + },
  282 + // 打开监听器字段编辑弹窗
  283 + openListenerFieldForm(field, index) {
  284 + this.listenerFieldForm = field ? JSON.parse(JSON.stringify(field)) : {};
  285 + this.editingListenerFieldIndex = field ? index : -1;
  286 + this.listenerFieldFormModelVisible = true;
  287 + this.$nextTick(() => {
  288 + if (this.$refs["listenerFieldFormRef"]) this.$refs["listenerFieldFormRef"].clearValidate();
  289 + });
  290 + },
  291 + // 保存监听器注入字段
  292 + async saveListenerFiled() {
  293 + let validateStatus = await this.$refs["listenerFieldFormRef"].validate();
  294 + if (!validateStatus) return; // 验证不通过直接返回
  295 + if (this.editingListenerFieldIndex === -1) {
  296 + this.fieldsListOfListener.push(this.listenerFieldForm);
  297 + this.listenerForm.fields.push(this.listenerFieldForm);
  298 + } else {
  299 + this.fieldsListOfListener.splice(this.editingListenerFieldIndex, 1, this.listenerFieldForm);
  300 + this.listenerForm.fields.splice(this.editingListenerFieldIndex, 1, this.listenerFieldForm);
  301 + }
  302 + this.listenerFieldFormModelVisible = false;
  303 + this.$nextTick(() => (this.listenerFieldForm = {}));
  304 + },
  305 + // 移除监听器字段
  306 + removeListenerField(field, index) {
  307 + this.$confirm("确认移除该字段吗?", "提示", {
  308 + confirmButtonText: "确 认",
  309 + cancelButtonText: "取 消"
  310 + })
  311 + .then(() => {
  312 + this.fieldsListOfListener.splice(index, 1);
  313 + this.listenerForm.fields.splice(index, 1);
  314 + })
  315 + .catch(() => console.info("操作取消"));
  316 + }
  317 + }
  318 +};
  319 +</script>
yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/listeners/template.js 0 → 100644
  1 +export const template = isTaskListener => {
  2 + return `
  3 + <div class="panel-tab__content">
  4 + <el-table :data="elementListenersList" size="mini" border>
  5 + <el-table-column label="序号" width="50px" type="index" />
  6 + <el-table-column label="事件类型" min-width="100px" prop="event" />
  7 + <el-table-column label="监听器类型" min-width="100px" show-overflow-tooltip :formatter="row => listenerTypeObject[row.listenerType]" />
  8 + <el-table-column label="操作" width="90px">
  9 + <template slot-scope="{ row, $index }">
  10 + <el-button size="mini" type="text" @click="openListenerForm(row, $index)">编辑</el-button>
  11 + <el-divider direction="vertical" />
  12 + <el-button size="mini" type="text" style="color: #ff4d4f" @click="removeListener(row, $index)">移除</el-button>
  13 + </template>
  14 + </el-table-column>
  15 + </el-table>
  16 + <div class="element-drawer__button">
  17 + <el-button size="mini" type="primary" icon="el-icon-plus" @click="openListenerForm(null)">添加监听器</el-button>
  18 + </div>
  19 +
  20 + <!-- 监听器 编辑/创建 部分 -->
  21 + <el-drawer :visible.sync="listenerFormModelVisible" title="执行监听器" :size="width + 'px'" append-to-body destroy-on-close>
  22 + <el-form size="mini" :model="listenerForm" label-width="96px" ref="listenerFormRef" @submit.native.prevent>
  23 + <el-form-item label="事件类型" prop="event" :rules="{ required: true, trigger: ['blur', 'change'] }">
  24 + <el-select v-model="listenerForm.event">
  25 + <el-option label="start" value="start" />
  26 + <el-option label="end" value="end" />
  27 + </el-select>
  28 + </el-form-item>
  29 + <el-form-item label="监听器类型" prop="listenerType" :rules="{ required: true, trigger: ['blur', 'change'] }">
  30 + <el-select v-model="listenerForm.listenerType">
  31 + <el-option v-for="i in Object.keys(listenerTypeObject)" :key="i" :label="listenerTypeObject[i]" :value="i" />
  32 + </el-select>
  33 + </el-form-item>
  34 + <el-form-item
  35 + v-if="listenerForm.listenerType === 'classListener'"
  36 + label="Java类"
  37 + prop="class"
  38 + key="listener-class"
  39 + :rules="{ required: true, trigger: ['blur', 'change'] }"
  40 + >
  41 + <el-input v-model="listenerForm.class" clearable />
  42 + </el-form-item>
  43 + <el-form-item
  44 + v-if="listenerForm.listenerType === 'expressionListener'"
  45 + label="表达式"
  46 + prop="expression"
  47 + key="listener-expression"
  48 + :rules="{ required: true, trigger: ['blur', 'change'] }"
  49 + >
  50 + <el-input v-model="listenerForm.expression" clearable />
  51 + </el-form-item>
  52 + <el-form-item
  53 + v-if="listenerForm.listenerType === 'delegateExpressionListener'"
  54 + label="代理表达式"
  55 + prop="delegateExpression"
  56 + key="listener-delegate"
  57 + :rules="{ required: true, trigger: ['blur', 'change'] }"
  58 + >
  59 + <el-input v-model="listenerForm.delegateExpression" clearable />
  60 + </el-form-item>
  61 + <template v-if="listenerForm.listenerType === 'scriptListener'">
  62 + <el-form-item
  63 + label="脚本格式"
  64 + prop="scriptFormat"
  65 + key="listener-script-format"
  66 + :rules="{ required: true, trigger: ['blur', 'change'], message: '请填写脚本格式' }"
  67 + >
  68 + <el-input v-model="listenerForm.scriptFormat" clearable />
  69 + </el-form-item>
  70 + <el-form-item
  71 + label="脚本类型"
  72 + prop="scriptType"
  73 + key="listener-script-type"
  74 + :rules="{ required: true, trigger: ['blur', 'change'], message: '请选择脚本类型' }"
  75 + >
  76 + <el-select v-model="listenerForm.scriptType">
  77 + <el-option label="内联脚本" value="inlineScript" />
  78 + <el-option label="外部脚本" value="externalScript" />
  79 + </el-select>
  80 + </el-form-item>
  81 + <el-form-item
  82 + v-if="listenerForm.scriptType === 'inlineScript'"
  83 + label="脚本内容"
  84 + prop="value"
  85 + key="listener-script"
  86 + :rules="{ required: true, trigger: ['blur', 'change'], message: '请填写脚本内容' }"
  87 + >
  88 + <el-input v-model="listenerForm.value" clearable />
  89 + </el-form-item>
  90 + <el-form-item
  91 + v-if="listenerForm.scriptType === 'externalScript'"
  92 + label="资源地址"
  93 + prop="resource"
  94 + key="listener-resource"
  95 + :rules="{ required: true, trigger: ['blur', 'change'], message: '请填写资源地址' }"
  96 + >
  97 + <el-input v-model="listenerForm.resource" clearable />
  98 + </el-form-item>
  99 + </template>
  100 + ${
  101 + isTaskListener
  102 + ? "<el-form-item label='定时器类型' prop='eventDefinitionType' key='eventDefinitionType'>" +
  103 + "<el-select v-model='listenerForm.eventDefinitionType'>" +
  104 + "<el-option label='日期' value='date' />" +
  105 + "<el-option label='持续时长' value='duration' />" +
  106 + "<el-option label='循环' value='cycle' />" +
  107 + "<el-option label='无' value='' />" +
  108 + "</el-select>" +
  109 + "</el-form-item>" +
  110 + "<el-form-item v-if='!!listenerForm.eventDefinitionType' label='定时器' prop='eventDefinitions' key='eventDefinitions'>" +
  111 + "<el-input v-model='listenerForm.eventDefinitions' clearable />" +
  112 + "</el-form-item>"
  113 + : ""
  114 + }
  115 + </el-form>
  116 + <el-divider />
  117 + <p class="listener-filed__title">
  118 + <span><i class="el-icon-menu"></i>注入字段:</span>
  119 + <el-button size="mini" type="primary" @click="openListenerFieldForm(null)">添加字段</el-button>
  120 + </p>
  121 + <el-table :data="fieldsListOfListener" size="mini" max-height="240" border fit style="flex: none">
  122 + <el-table-column label="序号" width="50px" type="index" />
  123 + <el-table-column label="字段名称" min-width="100px" prop="name" />
  124 + <el-table-column label="字段类型" min-width="80px" show-overflow-tooltip :formatter="row => fieldTypeObject[row.fieldType]" />
  125 + <el-table-column label="字段值/表达式" min-width="100px" show-overflow-tooltip :formatter="row => row.string || row.expression" />
  126 + <el-table-column label="操作" width="100px">
  127 + <template slot-scope="{ row, $index }">
  128 + <el-button size="mini" type="text" @click="openListenerFieldForm(row, $index)">编辑</el-button>
  129 + <el-divider direction="vertical" />
  130 + <el-button size="mini" type="text" style="color: #ff4d4f" @click="removeListenerField(row, $index)">移除</el-button>
  131 + </template>
  132 + </el-table-column>
  133 + </el-table>
  134 +
  135 + <div class="element-drawer__button">
  136 + <el-button size="mini" @click="listenerFormModelVisible = false">取 消</el-button>
  137 + <el-button size="mini" type="primary" @click="saveListenerConfig">保 存</el-button>
  138 + </div>
  139 + </el-drawer>
  140 +
  141 + <!-- 注入西段 编辑/创建 部分 -->
  142 + <el-dialog title="字段配置" :visible.sync="listenerFieldFormModelVisible" width="600px" append-to-body destroy-on-close>
  143 + <el-form :model="listenerFieldForm" size="mini" label-width="96px" ref="listenerFieldFormRef" style="height: 136px" @submit.native.prevent>
  144 + <el-form-item label="字段名称:" prop="name" :rules="{ required: true, trigger: ['blur', 'change'] }">
  145 + <el-input v-model="listenerFieldForm.name" clearable />
  146 + </el-form-item>
  147 + <el-form-item label="字段类型:" prop="fieldType" :rules="{ required: true, trigger: ['blur', 'change'] }">
  148 + <el-select v-model="listenerFieldForm.fieldType">
  149 + <el-option v-for="i in Object.keys(fieldTypeObject)" :key="i" :label="fieldTypeObject[i]" :value="i" />
  150 + </el-select>
  151 + </el-form-item>
  152 + <el-form-item
  153 + v-if="listenerFieldForm.fieldType === 'string'"
  154 + label="字段值:"
  155 + prop="string"
  156 + key="field-string"
  157 + :rules="{ required: true, trigger: ['blur', 'change'] }"
  158 + >
  159 + <el-input v-model="listenerFieldForm.string" clearable />
  160 + </el-form-item>
  161 + <el-form-item
  162 + v-if="listenerFieldForm.fieldType === 'expression'"
  163 + label="表达式:"
  164 + prop="expression"
  165 + key="field-expression"
  166 + :rules="{ required: true, trigger: ['blur', 'change'] }"
  167 + >
  168 + <el-input v-model="listenerFieldForm.expression" clearable />
  169 + </el-form-item>
  170 + </el-form>
  171 + <template slot="footer">
  172 + <el-button size="mini" @click="listenerFieldFormModelVisible = false">取 消</el-button>
  173 + <el-button size="mini" type="primary" @click="saveListenerFiled">确 定</el-button>
  174 + </template>
  175 + </el-dialog>
  176 + </div>
  177 + `;
  178 +};
yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/listeners/utilSelf.js 0 → 100644
  1 +// 初始化表单数据
  2 +export function initListenerForm(listener) {
  3 + let self = {
  4 + ...listener
  5 + };
  6 + if (listener.script) {
  7 + self = {
  8 + ...listener,
  9 + ...listener.script,
  10 + scriptType: listener.script.resource ? "externalScript" : "inlineScript"
  11 + };
  12 + }
  13 + if (listener.event === "timeout" && listener.eventDefinitions) {
  14 + if (listener.eventDefinitions.length) {
  15 + let k = "";
  16 + for (let key in listener.eventDefinitions[0]) {
  17 + console.log(listener.eventDefinitions, key);
  18 + if (key.indexOf("time") !== -1) {
  19 + k = key;
  20 + self.eventDefinitionType = key.replace("time", "").toLowerCase();
  21 + }
  22 + }
  23 + console.log(k);
  24 + self.eventTimeDefinitions = listener.eventDefinitions[0][k].body;
  25 + }
  26 + }
  27 + return self;
  28 +}
  29 +
  30 +export function initListenerType(listener) {
  31 + let listenerType;
  32 + if (listener.class) listenerType = "classListener";
  33 + if (listener.expression) listenerType = "expressionListener";
  34 + if (listener.delegateExpression) listenerType = "delegateExpressionListener";
  35 + if (listener.script) listenerType = "scriptListener";
  36 + return {
  37 + ...JSON.parse(JSON.stringify(listener)),
  38 + ...(listener.script ?? {}),
  39 + listenerType: listenerType
  40 + };
  41 +}
  42 +
  43 +export const listenerType = {
  44 + classListener: "Java 类",
  45 + expressionListener: "表达式",
  46 + delegateExpressionListener: "代理表达式",
  47 + scriptListener: "脚本"
  48 +};
  49 +
  50 +export const eventType = {
  51 + create: "创建",
  52 + assignment: "指派",
  53 + complete: "完成",
  54 + delete: "删除",
  55 + update: "更新",
  56 + timeout: "超时"
  57 +};
  58 +
  59 +export const fieldType = {
  60 + string: "字符串",
  61 + expression: "表达式"
  62 +};
yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/multi-instance/ElementMultiInstance.vue 0 → 100644
  1 +<template>
  2 + <div class="panel-tab__content">
  3 + <el-form size="mini" label-width="90px" @submit.native.prevent>
  4 + <el-form-item label="回路特性">
  5 + <el-select v-model="loopCharacteristics" @change="changeLoopCharacteristicsType">
  6 + <!--bpmn:MultiInstanceLoopCharacteristics-->
  7 + <el-option label="并行多重事件" value="ParallelMultiInstance" />
  8 + <el-option label="时序多重事件" value="SequentialMultiInstance" />
  9 + <!--bpmn:StandardLoopCharacteristics-->
  10 + <el-option label="循环事件" value="StandardLoop" />
  11 + <el-option label="无" value="Null" />
  12 + </el-select>
  13 + </el-form-item>
  14 + <template v-if="loopCharacteristics === 'ParallelMultiInstance' || loopCharacteristics === 'SequentialMultiInstance'">
  15 + <el-form-item label="循环基数" key="loopCardinality">
  16 + <el-input v-model="loopInstanceForm.loopCardinality" clearable @change="updateLoopCardinality" />
  17 + </el-form-item>
  18 + <el-form-item label="集合" key="collection">
  19 + <el-input v-model="loopInstanceForm.collection" clearable @change="updateLoopBase" />
  20 + </el-form-item>
  21 + <el-form-item label="元素变量" key="elementVariable">
  22 + <el-input v-model="loopInstanceForm.elementVariable" clearable @change="updateLoopBase" />
  23 + </el-form-item>
  24 + <el-form-item label="完成条件" key="completionCondition">
  25 + <el-input v-model="loopInstanceForm.completionCondition" clearable @change="updateLoopCondition" />
  26 + </el-form-item>
  27 + <el-form-item label="异步状态" key="async">
  28 + <el-checkbox v-model="loopInstanceForm.asyncBefore" label="异步前" @change="updateLoopAsync('asyncBefore')" />
  29 + <el-checkbox v-model="loopInstanceForm.asyncAfter" label="异步后" @change="updateLoopAsync('asyncAfter')" />
  30 + <el-checkbox
  31 + v-model="loopInstanceForm.exclusive"
  32 + v-if="loopInstanceForm.asyncAfter || loopInstanceForm.asyncBefore"
  33 + label="排除"
  34 + @change="updateLoopAsync('exclusive')"
  35 + />
  36 + </el-form-item>
  37 + <el-form-item label="重试周期" prop="timeCycle" v-if="loopInstanceForm.asyncAfter || loopInstanceForm.asyncBefore" key="timeCycle">
  38 + <el-input v-model="loopInstanceForm.timeCycle" clearable @change="updateLoopTimeCycle" />
  39 + </el-form-item>
  40 + </template>
  41 + </el-form>
  42 + </div>
  43 +</template>
  44 +
  45 +<script>
  46 +export default {
  47 + name: "ElementMultiInstance",
  48 + props: {
  49 + businessObject: Object,
  50 + type: String
  51 + },
  52 + inject: {
  53 + prefix: "prefix"
  54 + },
  55 + data() {
  56 + return {
  57 + loopCharacteristics: "",
  58 + //默认配置,用来覆盖原始不存在的选项,避免报错
  59 + defaultLoopInstanceForm: {
  60 + completionCondition: "",
  61 + loopCardinality: "",
  62 + extensionElements: [],
  63 + asyncAfter: false,
  64 + asyncBefore: false,
  65 + exclusive: false
  66 + },
  67 + loopInstanceForm: {}
  68 + };
  69 + },
  70 + watch: {
  71 + businessObject: {
  72 + immediate: true,
  73 + handler(val) {
  74 + this.bpmnElement = window.bpmnInstances.bpmnElement;
  75 + this.getElementLoop(val);
  76 + }
  77 + }
  78 + },
  79 + methods: {
  80 + getElementLoop(businessObject) {
  81 + if (!businessObject.loopCharacteristics) {
  82 + this.loopCharacteristics = "Null";
  83 + this.loopInstanceForm = {};
  84 + return;
  85 + }
  86 + if (businessObject.loopCharacteristics.$type === "bpmn:StandardLoopCharacteristics") {
  87 + this.loopCharacteristics = "StandardLoop";
  88 + this.loopInstanceForm = {};
  89 + return;
  90 + }
  91 + if (businessObject.loopCharacteristics.isSequential) {
  92 + this.loopCharacteristics = "SequentialMultiInstance";
  93 + } else {
  94 + this.loopCharacteristics = "ParallelMultiInstance";
  95 + }
  96 + // 合并配置
  97 + this.loopInstanceForm = {
  98 + ...this.defaultLoopInstanceForm,
  99 + ...businessObject.loopCharacteristics,
  100 + completionCondition: businessObject.loopCharacteristics?.completionCondition?.body ?? "",
  101 + loopCardinality: businessObject.loopCharacteristics?.loopCardinality?.body ?? ""
  102 + };
  103 + // 保留当前元素 businessObject 上的 loopCharacteristics 实例
  104 + this.multiLoopInstance = window.bpmnInstances.bpmnElement.businessObject.loopCharacteristics;
  105 + // 更新表单
  106 + if (
  107 + businessObject.loopCharacteristics.extensionElements &&
  108 + businessObject.loopCharacteristics.extensionElements.values &&
  109 + businessObject.loopCharacteristics.extensionElements.values.length
  110 + ) {
  111 + this.$set(this.loopInstanceForm, "timeCycle", businessObject.loopCharacteristics.extensionElements.values[0].body);
  112 + }
  113 + },
  114 + changeLoopCharacteristicsType(type) {
  115 + // this.loopInstanceForm = { ...this.defaultLoopInstanceForm }; // 切换类型取消原表单配置
  116 + // 取消多实例配置
  117 + if (type === "Null") {
  118 + window.bpmnInstances.modeling.updateProperties(this.bpmnElement, { loopCharacteristics: null });
  119 + return;
  120 + }
  121 + // 配置循环
  122 + if (type === "StandardLoop") {
  123 + const loopCharacteristicsObject = window.bpmnInstances.moddle.create("bpmn:StandardLoopCharacteristics");
  124 + window.bpmnInstances.modeling.updateProperties(this.bpmnElement, {
  125 + loopCharacteristics: loopCharacteristicsObject
  126 + });
  127 + this.multiLoopInstance = null;
  128 + return;
  129 + }
  130 + // 时序
  131 + if (type === "SequentialMultiInstance") {
  132 + this.multiLoopInstance = window.bpmnInstances.moddle.create("bpmn:MultiInstanceLoopCharacteristics", { isSequential: true });
  133 + } else {
  134 + this.multiLoopInstance = window.bpmnInstances.moddle.create("bpmn:MultiInstanceLoopCharacteristics");
  135 + }
  136 + window.bpmnInstances.modeling.updateProperties(this.bpmnElement, {
  137 + loopCharacteristics: this.multiLoopInstance
  138 + });
  139 + },
  140 + // 循环基数
  141 + updateLoopCardinality(cardinality) {
  142 + let loopCardinality = null;
  143 + if (cardinality && cardinality.length) {
  144 + loopCardinality = window.bpmnInstances.moddle.create("bpmn:FormalExpression", { body: cardinality });
  145 + }
  146 + window.bpmnInstances.modeling.updateModdleProperties(this.bpmnElement, this.multiLoopInstance, { loopCardinality });
  147 + },
  148 + // 完成条件
  149 + updateLoopCondition(condition) {
  150 + let completionCondition = null;
  151 + if (condition && condition.length) {
  152 + completionCondition = window.bpmnInstances.moddle.create("bpmn:FormalExpression", { body: condition });
  153 + }
  154 + window.bpmnInstances.modeling.updateModdleProperties(this.bpmnElement, this.multiLoopInstance, { completionCondition });
  155 + },
  156 + // 重试周期
  157 + updateLoopTimeCycle(timeCycle) {
  158 + const extensionElements = window.bpmnInstances.moddle.create("bpmn:ExtensionElements", {
  159 + values: [
  160 + window.bpmnInstances.moddle.create(`${this.prefix}:FailedJobRetryTimeCycle`, {
  161 + body: timeCycle
  162 + })
  163 + ]
  164 + });
  165 + window.bpmnInstances.modeling.updateModdleProperties(this.bpmnElement, this.multiLoopInstance, { extensionElements });
  166 + },
  167 + // 直接更新的基础信息
  168 + updateLoopBase() {
  169 + window.bpmnInstances.modeling.updateModdleProperties(this.bpmnElement, this.multiLoopInstance, {
  170 + collection: this.loopInstanceForm.collection || null,
  171 + elementVariable: this.loopInstanceForm.elementVariable || null
  172 + });
  173 + },
  174 + // 各异步状态
  175 + updateLoopAsync(key) {
  176 + const { asyncBefore, asyncAfter } = this.loopInstanceForm;
  177 + let asyncAttr = Object.create(null);
  178 + if (!asyncBefore && !asyncAfter) {
  179 + this.$set(this.loopInstanceForm, "exclusive", false);
  180 + asyncAttr = { asyncBefore: false, asyncAfter: false, exclusive: false, extensionElements: null };
  181 + } else {
  182 + asyncAttr[key] = this.loopInstanceForm[key];
  183 + }
  184 + window.bpmnInstances.modeling.updateModdleProperties(this.bpmnElement, this.multiLoopInstance, asyncAttr);
  185 + }
  186 + },
  187 + beforeDestroy() {
  188 + this.multiLoopInstance = null;
  189 + this.bpmnElement = null;
  190 + }
  191 +};
  192 +</script>
yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/other/ElementOtherConfig.vue 0 → 100644
  1 +<template>
  2 + <div class="panel-tab__content">
  3 + <div class="element-property input-property">
  4 + <div class="element-property__label">元素文档:</div>
  5 + <div class="element-property__value">
  6 + <el-input
  7 + type="textarea"
  8 + v-model="documentation"
  9 + size="mini"
  10 + resize="vertical"
  11 + :autosize="{ minRows: 2, maxRows: 4 }"
  12 + @input="updateDocumentation"
  13 + @blur="updateDocumentation"
  14 + />
  15 + </div>
  16 + </div>
  17 + </div>
  18 +</template>
  19 +
  20 +<script>
  21 +export default {
  22 + name: "ElementOtherConfig",
  23 + props: {
  24 + id: String
  25 + },
  26 + data() {
  27 + return {
  28 + documentation: ""
  29 + };
  30 + },
  31 + watch: {
  32 + id: {
  33 + immediate: true,
  34 + handler: function(id) {
  35 + if (id && id.length) {
  36 + this.$nextTick(() => {
  37 + const documentations = window.bpmnInstances.bpmnElement.businessObject?.documentation;
  38 + this.documentation = documentations && documentations.length ? documentations[0].text : "";
  39 + });
  40 + } else {
  41 + this.documentation = "";
  42 + }
  43 + }
  44 + }
  45 + },
  46 + methods: {
  47 + updateDocumentation() {
  48 + (this.bpmnElement && this.bpmnElement.id === this.id) || (this.bpmnElement = window.bpmnInstances.elementRegistry.get(this.id));
  49 + const documentation = window.bpmnInstances.bpmnFactory.create("bpmn:Documentation", { text: this.documentation });
  50 + window.bpmnInstances.modeling.updateProperties(this.bpmnElement, {
  51 + documentation: [documentation]
  52 + });
  53 + }
  54 + },
  55 + beforeDestroy() {
  56 + this.bpmnElement = null;
  57 + }
  58 +};
  59 +</script>
yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/properties/ElementProperties.vue 0 → 100644
  1 +<template>
  2 + <div class="panel-tab__content">
  3 + <el-table :data="elementPropertyList" size="mini" max-height="240" border fit>
  4 + <el-table-column label="序号" width="50px" type="index" />
  5 + <el-table-column label="属性名" prop="name" min-width="100px" show-overflow-tooltip />
  6 + <el-table-column label="属性值" prop="value" min-width="100px" show-overflow-tooltip />
  7 + <el-table-column label="操作" width="90px">
  8 + <template slot-scope="{ row, $index }">
  9 + <el-button size="mini" type="text" @click="openAttributesForm(row, $index)">编辑</el-button>
  10 + <el-divider direction="vertical" />
  11 + <el-button size="mini" type="text" style="color: #ff4d4f" @click="removeAttributes(row, $index)">移除</el-button>
  12 + </template>
  13 + </el-table-column>
  14 + </el-table>
  15 + <div class="element-drawer__button">
  16 + <el-button size="mini" type="primary" icon="el-icon-plus" @click="openAttributesForm(null, -1)">添加属性</el-button>
  17 + </div>
  18 +
  19 + <el-dialog :visible.sync="propertyFormModelVisible" title="属性配置" width="600px" append-to-body destroy-on-close>
  20 + <el-form :model="propertyForm" label-width="80px" size="mini" ref="attributeFormRef" @submit.native.prevent>
  21 + <el-form-item label="属性名:" prop="name">
  22 + <el-input v-model="propertyForm.name" clearable />
  23 + </el-form-item>
  24 + <el-form-item label="属性值:" prop="value">
  25 + <el-input v-model="propertyForm.value" clearable />
  26 + </el-form-item>
  27 + </el-form>
  28 + <template slot="footer">
  29 + <el-button size="mini" @click="propertyFormModelVisible = false">取 消</el-button>
  30 + <el-button size="mini" type="primary" @click="saveAttribute">确 定</el-button>
  31 + </template>
  32 + </el-dialog>
  33 + </div>
  34 +</template>
  35 +
  36 +<script>
  37 +export default {
  38 + name: "ElementProperties",
  39 + props: {
  40 + id: String,
  41 + type: String
  42 + },
  43 + inject: {
  44 + prefix: "prefix",
  45 + width: "width"
  46 + },
  47 + data() {
  48 + return {
  49 + elementPropertyList: [],
  50 + propertyForm: {},
  51 + editingPropertyIndex: -1,
  52 + propertyFormModelVisible: false
  53 + };
  54 + },
  55 + watch: {
  56 + id: {
  57 + immediate: true,
  58 + handler(val) {
  59 + val && val.length && this.resetAttributesList();
  60 + }
  61 + }
  62 + },
  63 + methods: {
  64 + resetAttributesList() {
  65 + this.bpmnElement = window.bpmnInstances.bpmnElement;
  66 + this.otherExtensionList = []; // 其他扩展配置
  67 + this.bpmnElementProperties =
  68 + this.bpmnElement.businessObject?.extensionElements?.values?.filter(ex => {
  69 + if (ex.$type !== `${this.prefix}:Properties`) {
  70 + this.otherExtensionList.push(ex);
  71 + }
  72 + return ex.$type === `${this.prefix}:Properties`;
  73 + }) ?? [];
  74 +
  75 + // 保存所有的 扩展属性字段
  76 + this.bpmnElementPropertyList = this.bpmnElementProperties.reduce((pre, current) => pre.concat(current.values), []);
  77 + // 复制 显示
  78 + this.elementPropertyList = JSON.parse(JSON.stringify(this.bpmnElementPropertyList ?? []));
  79 + },
  80 + openAttributesForm(attr, index) {
  81 + this.editingPropertyIndex = index;
  82 + this.propertyForm = index === -1 ? {} : JSON.parse(JSON.stringify(attr));
  83 + this.propertyFormModelVisible = true;
  84 + this.$nextTick(() => {
  85 + if (this.$refs["attributeFormRef"]) this.$refs["attributeFormRef"].clearValidate();
  86 + });
  87 + },
  88 + removeAttributes(attr, index) {
  89 + this.$confirm("确认移除该属性吗?", "提示", {
  90 + confirmButtonText: "确 认",
  91 + cancelButtonText: "取 消"
  92 + })
  93 + .then(() => {
  94 + this.elementPropertyList.splice(index, 1);
  95 + this.bpmnElementPropertyList.splice(index, 1);
  96 + // 新建一个属性字段的保存列表
  97 + const propertiesObject = window.bpmnInstances.moddle.create(`${this.prefix}:Properties`, {
  98 + values: this.bpmnElementPropertyList
  99 + });
  100 + this.updateElementExtensions(propertiesObject);
  101 + this.resetAttributesList();
  102 + })
  103 + .catch(() => console.info("操作取消"));
  104 + },
  105 + saveAttribute() {
  106 + const { name, value } = this.propertyForm;
  107 + console.log(this.bpmnElementPropertyList);
  108 + if (this.editingPropertyIndex !== -1) {
  109 + window.bpmnInstances.modeling.updateModdleProperties(this.bpmnElement, this.bpmnElementPropertyList[this.editingPropertyIndex], {
  110 + name,
  111 + value
  112 + });
  113 + } else {
  114 + // 新建属性字段
  115 + const newPropertyObject = window.bpmnInstances.moddle.create(`${this.prefix}:Property`, { name, value });
  116 + // 新建一个属性字段的保存列表
  117 + const propertiesObject = window.bpmnInstances.moddle.create(`${this.prefix}:Properties`, {
  118 + values: this.bpmnElementPropertyList.concat([newPropertyObject])
  119 + });
  120 + this.updateElementExtensions(propertiesObject);
  121 + }
  122 + this.propertyFormModelVisible = false;
  123 + this.resetAttributesList();
  124 + },
  125 + updateElementExtensions(properties) {
  126 + const extensions = window.bpmnInstances.moddle.create("bpmn:ExtensionElements", {
  127 + values: this.otherExtensionList.concat([properties])
  128 + });
  129 + window.bpmnInstances.modeling.updateProperties(this.bpmnElement, {
  130 + extensionElements: extensions
  131 + });
  132 + }
  133 + }
  134 +};
  135 +</script>
yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/signal-message/SignalAndMessage.vue 0 → 100644
  1 +<template>
  2 + <div class="panel-tab__content">
  3 + <div class="panel-tab__content--title">
  4 + <span><i class="el-icon-menu" style="margin-right: 8px; color: #555555"></i>消息列表</span>
  5 + <el-button size="mini" type="primary" icon="el-icon-plus" @click="openModel('message')">创建新消息</el-button>
  6 + </div>
  7 + <el-table :data="messageList" size="mini" border>
  8 + <el-table-column type="index" label="序号" width="60px" />
  9 + <el-table-column label="消息ID" prop="id" max-width="300px" show-overflow-tooltip />
  10 + <el-table-column label="消息名称" prop="name" max-width="300px" show-overflow-tooltip />
  11 + </el-table>
  12 + <div class="panel-tab__content--title" style="padding-top: 8px; margin-top: 8px; border-top: 1px solid #eeeeee">
  13 + <span><i class="el-icon-menu" style="margin-right: 8px; color: #555555"></i>信号列表</span>
  14 + <el-button size="mini" type="primary" icon="el-icon-plus" @click="openModel('signal')">创建新信号</el-button>
  15 + </div>
  16 + <el-table :data="signalList" size="mini" border>
  17 + <el-table-column type="index" label="序号" width="60px" />
  18 + <el-table-column label="信号ID" prop="id" max-width="300px" show-overflow-tooltip />
  19 + <el-table-column label="信号名称" prop="name" max-width="300px" show-overflow-tooltip />
  20 + </el-table>
  21 +
  22 + <el-dialog :visible.sync="modelVisible" :title="modelConfig.title" :close-on-click-modal="false" width="400px" append-to-body destroy-on-close>
  23 + <el-form :model="modelObjectForm" size="mini" label-width="90px" @submit.native.prevent>
  24 + <el-form-item :label="modelConfig.idLabel">
  25 + <el-input v-model="modelObjectForm.id" clearable />
  26 + </el-form-item>
  27 + <el-form-item :label="modelConfig.nameLabel">
  28 + <el-input v-model="modelObjectForm.name" clearable />
  29 + </el-form-item>
  30 + </el-form>
  31 + <template slot="footer">
  32 + <el-button size="mini" @click="modelVisible = false">取 消</el-button>
  33 + <el-button size="mini" type="primary" @click="addNewObject">保 存</el-button>
  34 + </template>
  35 + </el-dialog>
  36 + </div>
  37 +</template>
  38 +<script>
  39 +export default {
  40 + name: "SignalAndMassage",
  41 + data() {
  42 + return {
  43 + signalList: [],
  44 + messageList: [],
  45 + modelVisible: false,
  46 + modelType: "",
  47 + modelObjectForm: {}
  48 + };
  49 + },
  50 + computed: {
  51 + modelConfig() {
  52 + if (this.modelType === "message") {
  53 + return { title: "创建消息", idLabel: "消息ID", nameLabel: "消息名称" };
  54 + } else {
  55 + return { title: "创建信号", idLabel: "信号ID", nameLabel: "信号名称" };
  56 + }
  57 + }
  58 + },
  59 + mounted() {
  60 + this.initDataList();
  61 + },
  62 + methods: {
  63 + initDataList() {
  64 + this.rootElements = window.bpmnInstances.modeler.getDefinitions().rootElements;
  65 + this.messageIdMap = {};
  66 + this.signalIdMap = {};
  67 + this.messageList = [];
  68 + this.signalList = [];
  69 + this.rootElements.forEach(el => {
  70 + if (el.$type === "bpmn:Message") {
  71 + this.messageIdMap[el.id] = true;
  72 + this.messageList.push({ ...el });
  73 + }
  74 + if (el.$type === "bpmn:Signal") {
  75 + this.signalIdMap[el.id] = true;
  76 + this.signalList.push({ ...el });
  77 + }
  78 + });
  79 + },
  80 + openModel(type) {
  81 + this.modelType = type;
  82 + this.modelObjectForm = {};
  83 + this.modelVisible = true;
  84 + },
  85 + addNewObject() {
  86 + if (this.modelType === "message") {
  87 + if (this.messageIdMap[this.modelObjectForm.id]) {
  88 + return this.$message.error("该消息已存在,请修改id后重新保存");
  89 + }
  90 + const messageRef = window.bpmnInstances.moddle.create("bpmn:Message", this.modelObjectForm);
  91 + this.rootElements.push(messageRef);
  92 + } else {
  93 + if (this.signalIdMap[this.modelObjectForm.id]) {
  94 + return this.$message.error("该信号已存在,请修改id后重新保存");
  95 + }
  96 + const signalRef = window.bpmnInstances.moddle.create("bpmn:Signal", this.modelObjectForm);
  97 + this.rootElements.push(signalRef);
  98 + }
  99 + this.modelVisible = false;
  100 + this.initDataList();
  101 + }
  102 + }
  103 +};
  104 +</script>
yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/task/ElementTask.vue 0 → 100644
  1 +<template>
  2 + <div class="panel-tab__content">
  3 + <el-form size="mini" label-width="90px" @submit.native.prevent>
  4 + <el-form-item label="异步延续">
  5 + <el-checkbox v-model="taskConfigForm.asyncBefore" label="异步前" @change="changeTaskAsync" />
  6 + <el-checkbox v-model="taskConfigForm.asyncAfter" label="异步后" @change="changeTaskAsync" />
  7 + <el-checkbox v-model="taskConfigForm.exclusive" v-if="taskConfigForm.asyncAfter || taskConfigForm.asyncBefore" label="排除" @change="changeTaskAsync" />
  8 + </el-form-item>
  9 + <component :is="witchTaskComponent" v-bind="$props" />
  10 + </el-form>
  11 + </div>
  12 +</template>
  13 +
  14 +<script>
  15 +import UserTask from "./task-components/UserTask";
  16 +import ScriptTask from "./task-components/ScriptTask";
  17 +import ReceiveTask from "./task-components/ReceiveTask";
  18 +
  19 +export default {
  20 + name: "ElementTaskConfig",
  21 + components: { UserTask, ScriptTask, ReceiveTask },
  22 + props: {
  23 + id: String,
  24 + type: String
  25 + },
  26 + data() {
  27 + return {
  28 + taskConfigForm: {
  29 + asyncAfter: false,
  30 + asyncBefore: false,
  31 + exclusive: false
  32 + },
  33 + witchTaskComponent: "",
  34 + installedComponent: {
  35 + // 手工任务与普通任务一致,不需要其他配置
  36 + // 接收消息任务,需要在全局下插入新的消息实例,并在该节点下的 messageRef 属性绑定该实例
  37 + // 发送任务、服务任务、业务规则任务共用一个相同配置
  38 + UserTask: "UserTask", // 用户任务配置
  39 + ScriptTask: "ScriptTask", // 脚本任务配置
  40 + ReceiveTask: "ReceiveTask" // 消息接收任务
  41 + }
  42 + };
  43 + },
  44 + watch: {
  45 + id: {
  46 + immediate: true,
  47 + handler() {
  48 + this.bpmnElement = window.bpmnInstances.bpmnElement;
  49 + this.taskConfigForm.asyncBefore = this.bpmnElement?.businessObject?.asyncBefore;
  50 + this.taskConfigForm.asyncAfter = this.bpmnElement?.businessObject?.asyncAfter;
  51 + this.taskConfigForm.exclusive = this.bpmnElement?.businessObject?.exclusive;
  52 + }
  53 + },
  54 + type: {
  55 + immediate: true,
  56 + handler() {
  57 + this.witchTaskComponent = this.installedComponent[this.type];
  58 + }
  59 + }
  60 + },
  61 + methods: {
  62 + changeTaskAsync() {
  63 + if (!this.taskConfigForm.asyncBefore && !this.taskConfigForm.asyncAfter) {
  64 + this.taskConfigForm.exclusive = false;
  65 + }
  66 + window.bpmnInstances.modeling.updateProperties(window.bpmnInstances.bpmnElement, {
  67 + ...this.taskConfigForm
  68 + });
  69 + }
  70 + }
  71 +};
  72 +</script>
yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/task/task-components/ReceiveTask.vue 0 → 100644
  1 +<template>
  2 + <div style="margin-top: 16px">
  3 + <el-form-item label="消息实例">
  4 + <div style="display: flex; align-items: center; justify-content: space-between; flex-wrap: nowrap">
  5 + <el-select v-model="bindMessageId" @change="updateTaskMessage">
  6 + <el-option v-for="id in Object.keys(messageMap)" :value="id" :label="messageMap[id]" :key="id" />
  7 + </el-select>
  8 + <el-button size="mini" type="primary" icon="el-icon-plus" style="margin-left: 8px" @click="openMessageModel" />
  9 + </div>
  10 + </el-form-item>
  11 + <el-dialog :visible.sync="messageModelVisible" :close-on-click-modal="false" title="创建新消息" width="400px" append-to-body destroy-on-close>
  12 + <el-form :model="newMessageForm" size="mini" label-width="90px" @submit.native.prevent>
  13 + <el-form-item label="消息ID">
  14 + <el-input v-model="newMessageForm.id" clearable />
  15 + </el-form-item>
  16 + <el-form-item label="消息名称">
  17 + <el-input v-model="newMessageForm.name" clearable />
  18 + </el-form-item>
  19 + </el-form>
  20 + <template slot="footer">
  21 + <el-button size="mini" type="primary" @click="createNewMessage">确 认</el-button>
  22 + </template>
  23 + </el-dialog>
  24 + </div>
  25 +</template>
  26 +
  27 +<script>
  28 +export default {
  29 + name: "ReceiveTask",
  30 + props: {
  31 + id: String,
  32 + type: String
  33 + },
  34 + data() {
  35 + return {
  36 + bindMessageId: "",
  37 + newMessageForm: {},
  38 + messageMap: {},
  39 + messageModelVisible: false
  40 + };
  41 + },
  42 + watch: {
  43 + id: {
  44 + immediate: true,
  45 + handler() {
  46 + this.$nextTick(() => this.getBindMessage());
  47 + }
  48 + }
  49 + },
  50 + created() {
  51 + this.bpmnMessageRefsMap = Object.create(null);
  52 + this.bpmnRootElements = window.bpmnInstances.modeler.getDefinitions().rootElements;
  53 + this.bpmnRootElements
  54 + .filter(el => el.$type === "bpmn:Message")
  55 + .forEach(m => {
  56 + this.bpmnMessageRefsMap[m.id] = m;
  57 + this.$set(this.messageMap, m.id, m.name);
  58 + });
  59 + this.$set(this.messageMap, "-1", "无"); // 添加一个空对象,保证可以取消原消息绑定
  60 + },
  61 + methods: {
  62 + getBindMessage() {
  63 + this.bpmnElement = window.bpmnInstances.bpmnElement;
  64 + this.bindMessageId = this.bpmnElement.businessObject?.messageRef?.id || "-1";
  65 + },
  66 + openMessageModel() {
  67 + this.messageModelVisible = true;
  68 + this.newMessageForm = {};
  69 + },
  70 + createNewMessage() {
  71 + if (this.messageMap[this.newMessageForm.id]) {
  72 + this.$message.error("该消息已存在,请修改id后重新保存");
  73 + return;
  74 + }
  75 + const newMessage = window.bpmnInstances.moddle.create("bpmn:Message", this.newMessageForm);
  76 + this.bpmnRootElements.push(newMessage);
  77 + this.$set(this.messageMap, this.newMessageForm.id, this.newMessageForm.name);
  78 + this.bpmnMessageRefsMap[this.newMessageForm.id] = newMessage;
  79 + this.messageModelVisible = false;
  80 + },
  81 + updateTaskMessage(messageId) {
  82 + if (messageId === "-1") {
  83 + window.bpmnInstances.modeling.updateProperties(this.bpmnElement, {
  84 + messageRef: null
  85 + });
  86 + } else {
  87 + window.bpmnInstances.modeling.updateProperties(this.bpmnElement, {
  88 + messageRef: this.bpmnMessageRefsMap[messageId]
  89 + });
  90 + }
  91 + }
  92 + },
  93 + beforeDestroy() {
  94 + this.bpmnElement = null;
  95 + }
  96 +};
  97 +</script>
yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/task/task-components/ScriptTask.vue 0 → 100644
  1 +<template>
  2 + <div style="margin-top: 16px">
  3 + <el-form-item label="脚本格式">
  4 + <el-input v-model="scriptTaskForm.scriptFormat" clearable @input="updateElementTask()" @change="updateElementTask()" />
  5 + </el-form-item>
  6 + <el-form-item label="脚本类型">
  7 + <el-select v-model="scriptTaskForm.scriptType">
  8 + <el-option label="内联脚本" value="inline" />
  9 + <el-option label="外部资源" value="external" />
  10 + </el-select>
  11 + </el-form-item>
  12 + <el-form-item label="脚本" v-show="scriptTaskForm.scriptType === 'inline'">
  13 + <el-input
  14 + v-model="scriptTaskForm.script"
  15 + type="textarea"
  16 + resize="vertical"
  17 + :autosize="{ minRows: 2, maxRows: 4 }"
  18 + clearable
  19 + @input="updateElementTask()"
  20 + @change="updateElementTask()"
  21 + />
  22 + </el-form-item>
  23 + <el-form-item label="资源地址" v-show="scriptTaskForm.scriptType === 'external'">
  24 + <el-input v-model="scriptTaskForm.resource" clearable @input="updateElementTask()" @change="updateElementTask()" />
  25 + </el-form-item>
  26 + <el-form-item label="结果变量">
  27 + <el-input v-model="scriptTaskForm.resultVariable" clearable @input="updateElementTask()" @change="updateElementTask()" />
  28 + </el-form-item>
  29 + </div>
  30 +</template>
  31 +
  32 +<script>
  33 +export default {
  34 + name: "ScriptTask",
  35 + props: {
  36 + id: String,
  37 + type: String
  38 + },
  39 + data() {
  40 + return {
  41 + defaultTaskForm: {
  42 + scriptFormat: "",
  43 + script: "",
  44 + resource: "",
  45 + resultVariable: ""
  46 + },
  47 + scriptTaskForm: {}
  48 + };
  49 + },
  50 + watch: {
  51 + id: {
  52 + immediate: true,
  53 + handler() {
  54 + this.bpmnElement = window.bpmnInstances.bpmnElement;
  55 + this.$nextTick(() => this.resetTaskForm());
  56 + }
  57 + }
  58 + },
  59 + methods: {
  60 + resetTaskForm() {
  61 + for (let key in this.defaultTaskForm) {
  62 + let value = this.bpmnElement?.businessObject[key] || this.defaultTaskForm[key];
  63 + this.$set(this.scriptTaskForm, key, value);
  64 + }
  65 + this.$set(this.scriptTaskForm, "scriptType", this.scriptTaskForm.script ? "inline" : "external");
  66 + },
  67 + updateElementTask() {
  68 + let taskAttr = Object.create(null);
  69 + taskAttr.scriptFormat = this.scriptTaskForm.scriptFormat || null;
  70 + taskAttr.resultVariable = this.scriptTaskForm.resultVariable || null;
  71 + if (this.scriptTaskForm.scriptType === "inline") {
  72 + taskAttr.script = this.scriptTaskForm.script || null;
  73 + taskAttr.resource = null;
  74 + } else {
  75 + taskAttr.resource = this.scriptTaskForm.resource || null;
  76 + taskAttr.script = null;
  77 + }
  78 + window.bpmnInstances.modeling.updateProperties(this.bpmnElement, taskAttr);
  79 + }
  80 + },
  81 + beforeDestroy() {
  82 + this.bpmnElement = null;
  83 + }
  84 +};
  85 +</script>
yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/task/task-components/UserTask.vue 0 → 100644
  1 +<template>
  2 + <div style="margin-top: 16px">
  3 + <el-form-item label="处理用户">
  4 + <el-select v-model="userTaskForm.assignee" @change="updateElementTask('assignee')">
  5 + <el-option v-for="ak in mockData" :key="'ass-' + ak" :label="`用户${ak}`" :value="`user${ak}`" />
  6 + </el-select>
  7 + </el-form-item>
  8 + <el-form-item label="候选用户">
  9 + <el-select v-model="userTaskForm.candidateUsers" multiple collapse-tags @change="updateElementTask('candidateUsers')">
  10 + <el-option v-for="uk in mockData" :key="'user-' + uk" :label="`用户${uk}`" :value="`user${uk}`" />
  11 + </el-select>
  12 + </el-form-item>
  13 + <el-form-item label="候选分组">
  14 + <el-select v-model="userTaskForm.candidateGroups" multiple collapse-tags @change="updateElementTask('candidateGroups')">
  15 + <el-option v-for="gk in mockData" :key="'ass-' + gk" :label="`分组${gk}`" :value="`group${gk}`" />
  16 + </el-select>
  17 + </el-form-item>
  18 + <el-form-item label="到期时间">
  19 + <el-input v-model="userTaskForm.dueDate" clearable @change="updateElementTask('dueDate')" />
  20 + </el-form-item>
  21 + <el-form-item label="跟踪时间">
  22 + <el-input v-model="userTaskForm.followUpDate" clearable @change="updateElementTask('followUpDate')" />
  23 + </el-form-item>
  24 + <el-form-item label="优先级">
  25 + <el-input v-model="userTaskForm.priority" clearable @change="updateElementTask('priority')" />
  26 + </el-form-item>
  27 + </div>
  28 +</template>
  29 +
  30 +<script>
  31 +export default {
  32 + name: "UserTask",
  33 + props: {
  34 + id: String,
  35 + type: String
  36 + },
  37 + data() {
  38 + return {
  39 + defaultTaskForm: {
  40 + assignee: "",
  41 + candidateUsers: [],
  42 + candidateGroups: [],
  43 + dueDate: "",
  44 + followUpDate: "",
  45 + priority: ""
  46 + },
  47 + userTaskForm: {},
  48 + mockData: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  49 + };
  50 + },
  51 + watch: {
  52 + id: {
  53 + immediate: true,
  54 + handler() {
  55 + this.bpmnElement = window.bpmnInstances.bpmnElement;
  56 + this.$nextTick(() => this.resetTaskForm());
  57 + }
  58 + }
  59 + },
  60 + methods: {
  61 + resetTaskForm() {
  62 + for (let key in this.defaultTaskForm) {
  63 + let value;
  64 + if (key === "candidateUsers" || key === "candidateGroups") {
  65 + value = this.bpmnElement?.businessObject[key] ? this.bpmnElement.businessObject[key].split(",") : [];
  66 + } else {
  67 + value = this.bpmnElement?.businessObject[key] || this.defaultTaskForm[key];
  68 + }
  69 + this.$set(this.userTaskForm, key, value);
  70 + }
  71 + },
  72 + updateElementTask(key) {
  73 + const taskAttr = Object.create(null);
  74 + if (key === "candidateUsers" || key === "candidateGroups") {
  75 + taskAttr[key] = this.userTaskForm[key] && this.userTaskForm[key].length ? this.userTaskForm[key].join() : null;
  76 + } else {
  77 + taskAttr[key] = this.userTaskForm[key] || null;
  78 + }
  79 + window.bpmnInstances.modeling.updateProperties(this.bpmnElement, taskAttr);
  80 + }
  81 + },
  82 + beforeDestroy() {
  83 + this.bpmnElement = null;
  84 + }
  85 +};
  86 +</script>
yudao-admin-ui/src/components/bpmnProcessDesigner/package/theme/element-variables.scss 0 → 100644
  1 +/* 改变主题色变量 */
  2 +$--color-primary: #1890ff;
  3 +$--color-danger: #ff4d4f;
  4 +
  5 +/* 改变 icon 字体路径变量,必需 */
  6 +$--font-path: '~element-ui/lib/theme-chalk/fonts';
  7 +
  8 +@import "~element-ui/packages/theme-chalk/src/index";
  9 +
  10 +.el-table td,
  11 +.el-table th {
  12 + color: #333;
  13 +}
  14 +.el-drawer__header {
  15 + padding: 16px 16px 8px 16px;
  16 + margin: 0;
  17 + line-height: 24px;
  18 + font-size: 18px;
  19 + color: #303133;
  20 + box-sizing: border-box;
  21 + border-bottom: 1px solid #e8e8e8;
  22 +}
  23 +div[class^="el-drawer"]:focus,
  24 +span:focus {
  25 + outline: none;
  26 +}
  27 +.el-drawer__body {
  28 + box-sizing: border-box;
  29 + padding: 16px;
  30 + width: 100%;
  31 + overflow-y: auto;
  32 +}
  33 +
  34 +.el-dialog {
  35 + margin-top: 50vh !important;
  36 + transform: translateY(-50%);
  37 + overflow: hidden;
  38 +}
  39 +.el-dialog__wrapper {
  40 + overflow: hidden;
  41 + max-height: 100vh;
  42 +}
  43 +.el-dialog__header {
  44 + padding: 16px 16px 8px 16px;
  45 + box-sizing: border-box;
  46 + border-bottom: 1px solid #e8e8e8;
  47 +}
  48 +.el-dialog__body {
  49 + padding: 16px;
  50 + max-height: 80vh;
  51 + box-sizing: border-box;
  52 + overflow-y: auto;
  53 +}
  54 +.el-dialog__footer {
  55 + padding: 16px;
  56 + box-sizing: border-box;
  57 + border-top: 1px solid #e8e8e8;
  58 +}
  59 +.el-dialog__close {
  60 + font-weight: 600;
  61 +}
  62 +.el-select {
  63 + width: 100%;
  64 +}
  65 +.el-divider:not(.el-divider--horizontal) {
  66 + margin: 0 8px ;
  67 +}
  68 +.el-divider.el-divider--horizontal {
  69 + margin: 16px 0;
  70 +}
yudao-admin-ui/src/components/bpmnProcessDesigner/package/theme/index.scss 0 → 100644
  1 +@import "./process-designer.scss";
  2 +@import "./process-panel.scss";
0 \ No newline at end of file 3 \ No newline at end of file
yudao-admin-ui/src/components/bpmnProcessDesigner/package/theme/process-designer.scss 0 → 100644
  1 +@import "~bpmn-js-token-simulation/assets/css/bpmn-js-token-simulation.css";
  2 +@import "~bpmn-js-token-simulation/assets/css/font-awesome.min.css";
  3 +@import "~bpmn-js-token-simulation/assets/css/normalize.css";
  4 +
  5 +// 边框被 token-simulation 样式覆盖了
  6 +.djs-palette {
  7 + background: var(--palette-background-color);
  8 + border: solid 1px var(--palette-border-color) !important;
  9 + border-radius: 2px;
  10 +}
  11 +
  12 +.my-process-designer {
  13 + display: flex;
  14 + flex-direction: column;
  15 + width: 100%;
  16 + height: 100%;
  17 + box-sizing: border-box;
  18 + .my-process-designer__header {
  19 + width: 100%;
  20 + min-height: 36px;
  21 + .el-button {
  22 + text-align: center;
  23 + }
  24 + .el-button-group {
  25 + margin: 4px;
  26 + }
  27 + .el-tooltip__popper {
  28 + .el-button {
  29 + width: 100%;
  30 + text-align: left;
  31 + padding-left: 8px;
  32 + padding-right: 8px;
  33 + }
  34 + .el-button:hover {
  35 + background: rgba(64, 158, 255, 0.8);
  36 + color: #ffffff;
  37 + }
  38 + }
  39 + .align {
  40 + position: relative;
  41 + i {
  42 + &:after {
  43 + content: "|";
  44 + position: absolute;
  45 + transform: rotate(90deg) translate(200%, 60%);
  46 + }
  47 + }
  48 + }
  49 + .align.align-left i {
  50 + transform: rotate(90deg);
  51 + }
  52 + .align.align-right i {
  53 + transform: rotate(-90deg);
  54 + }
  55 + .align.align-top i {
  56 + transform: rotate(180deg);
  57 + }
  58 + .align.align-bottom i {
  59 + transform: rotate(0deg);
  60 + }
  61 + .align.align-center i {
  62 + transform: rotate(90deg);
  63 + &:after {
  64 + transform: rotate(90deg) translate(0, 60%);
  65 + }
  66 + }
  67 + .align.align-middle i {
  68 + transform: rotate(0deg);
  69 + &:after {
  70 + transform: rotate(90deg) translate(0, 60%);
  71 + }
  72 + }
  73 + }
  74 + .my-process-designer__container {
  75 + display: inline-flex;
  76 + width: 100%;
  77 + flex: 1;
  78 + .my-process-designer__canvas {
  79 + flex: 1;
  80 + height: 100%;
  81 + position: relative;
  82 + background: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHBhdHRlcm4gaWQ9ImEiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHBhdGggZD0iTTAgMTBoNDBNMTAgMHY0ME0wIDIwaDQwTTIwIDB2NDBNMCAzMGg0ME0zMCAwdjQwIiBmaWxsPSJub25lIiBzdHJva2U9IiNlMGUwZTAiIG9wYWNpdHk9Ii4yIi8+PHBhdGggZD0iTTQwIDBIMHY0MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZTBlMGUwIi8+PC9wYXR0ZXJuPjwvZGVmcz48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSJ1cmwoI2EpIi8+PC9zdmc+")
  83 + repeat !important;
  84 + div.toggle-mode {
  85 + display: none;
  86 + }
  87 + }
  88 + .my-process-designer__property-panel {
  89 + height: 100%;
  90 + overflow: scroll;
  91 + overflow-y: auto;
  92 + z-index: 10;
  93 + * {
  94 + box-sizing: border-box;
  95 + }
  96 + }
  97 + svg {
  98 + width: 100%;
  99 + height: 100%;
  100 + min-height: 100%;
  101 + overflow: hidden;
  102 + }
  103 + }
  104 +}
  105 +
  106 +//侧边栏配置
  107 +.djs-palette.open {
  108 + .djs-palette-entries {
  109 + div[class^="bpmn-icon-"]:before,
  110 + div[class*="bpmn-icon-"]:before {
  111 + line-height: unset;
  112 + }
  113 + div.entry {
  114 + position: relative;
  115 + }
  116 + div.entry:hover {
  117 + &::after {
  118 + width: max-content;
  119 + content: attr(title);
  120 + vertical-align: text-bottom;
  121 + position: absolute;
  122 + right: -10px;
  123 + top: 0;
  124 + bottom: 0;
  125 + overflow: hidden;
  126 + transform: translateX(100%);
  127 + font-size: 0.5em;
  128 + display: inline-block;
  129 + text-decoration: inherit;
  130 + font-variant: normal;
  131 + text-transform: none;
  132 + background: #fafafa;
  133 + box-shadow: 0 0 6px #eeeeee;
  134 + border: 1px solid #cccccc;
  135 + box-sizing: border-box;
  136 + padding: 0 16px;
  137 + border-radius: 4px;
  138 + z-index: 100;
  139 + }
  140 + }
  141 + }
  142 +}
  143 +pre {
  144 + margin: 0;
  145 + height: 100%;
  146 + overflow: hidden;
  147 + max-height: calc(80vh - 32px);
  148 + overflow-y: auto;
  149 +}
  150 +.hljs {
  151 + word-break: break-word;
  152 + white-space: pre-wrap;
  153 +}
  154 +.hljs * {
  155 + font-family: Consolas, Monaco, monospace;
  156 +}
yudao-admin-ui/src/components/bpmnProcessDesigner/package/theme/process-panel.scss 0 → 100644
  1 +.process-panel__container {
  2 + box-sizing: border-box;
  3 + padding: 0 8px;
  4 + border-left: 1px solid #eeeeee;
  5 + box-shadow: 0 0 8px #cccccc;
  6 + max-height: 100%;
  7 + overflow-y: scroll;
  8 +}
  9 +.panel-tab__title {
  10 + font-weight: 600;
  11 + padding: 0 8px;
  12 + font-size: 1.1em;
  13 + line-height: 1.2em;
  14 + i {
  15 + margin-right: 8px;
  16 + font-size: 1.2em;
  17 + }
  18 +}
  19 +.panel-tab__content {
  20 + width: 100%;
  21 + box-sizing: border-box;
  22 + border-top: 1px solid #eeeeee;
  23 + padding: 8px 16px;
  24 + .panel-tab__content--title {
  25 + display: flex;
  26 + justify-content: space-between;
  27 + padding-bottom: 8px;
  28 + span {
  29 + flex: 1;
  30 + text-align: left;
  31 + }
  32 + }
  33 +}
  34 +.element-property {
  35 + width: 100%;
  36 + display: flex;
  37 + align-items: flex-start;
  38 + margin: 8px 0;
  39 + .element-property__label {
  40 + display: block;
  41 + width: 90px;
  42 + text-align: right;
  43 + overflow: hidden;
  44 + padding-right: 12px;
  45 + line-height: 32px;
  46 + font-size: 14px;
  47 + box-sizing: border-box;
  48 + }
  49 + .element-property__value {
  50 + flex: 1;
  51 + line-height: 32px;
  52 + }
  53 + .el-form-item {
  54 + width: 100%;
  55 + margin-bottom: 0;
  56 + padding-bottom: 18px;
  57 + }
  58 +}
  59 +.list-property {
  60 + flex-direction: column;
  61 + .element-listener-item {
  62 + width: 100%;
  63 + display: inline-grid;
  64 + grid-template-columns: 16px auto 32px 32px;
  65 + grid-column-gap: 8px;
  66 + }
  67 + .element-listener-item + .element-listener-item {
  68 + margin-top: 8px;
  69 + }
  70 +}
  71 +.listener-filed__title {
  72 + display: inline-flex;
  73 + width: 100%;
  74 + justify-content: space-between;
  75 + align-items: center;
  76 + margin-top: 0;
  77 + span {
  78 + width: 200px;
  79 + text-align: left;
  80 + font-size: 14px;
  81 + }
  82 + i {
  83 + margin-right: 8px;
  84 + }
  85 +}
  86 +.element-drawer__button {
  87 + margin-top: 8px;
  88 + width: 100%;
  89 + display: inline-flex;
  90 + justify-content: space-around;
  91 +}
  92 +.element-drawer__button > .el-button {
  93 + width: 100%;
  94 +}
  95 +
  96 +.el-collapse-item__content {
  97 + padding-bottom: 0;
  98 +}
  99 +.el-input.is-disabled .el-input__inner {
  100 + color: #999999;
  101 +}
  102 +.el-form-item.el-form-item--mini {
  103 + margin-bottom: 0;
  104 + & + .el-form-item {
  105 + margin-top: 16px;
  106 + }
  107 +}
yudao-admin-ui/src/components/bpmnProcessDesigner/package/utils.js 0 → 100644
  1 +// 创建监听器实例
  2 +export function createListenerObject(options, isTask, prefix) {
  3 + const listenerObj = Object.create(null);
  4 + listenerObj.event = options.event;
  5 + isTask && (listenerObj.id = options.id); // 任务监听器特有的 id 字段
  6 + switch (options.listenerType) {
  7 + case "scriptListener":
  8 + listenerObj.script = createScriptObject(options, prefix);
  9 + break;
  10 + case "expressionListener":
  11 + listenerObj.expression = options.expression;
  12 + break;
  13 + case "delegateExpressionListener":
  14 + listenerObj.delegateExpression = options.delegateExpression;
  15 + break;
  16 + default:
  17 + listenerObj.class = options.class;
  18 + }
  19 + // 注入字段
  20 + if (options.fields) {
  21 + listenerObj.fields = options.fields.map(field => {
  22 + return createFieldObject(field, prefix);
  23 + });
  24 + }
  25 + // 任务监听器的 定时器 设置
  26 + if (isTask && options.event === "timeout" && !!options.eventDefinitionType) {
  27 + const timeDefinition = window.bpmnInstances.moddle.create("bpmn:FormalExpression", { body: options.eventTimeDefinitions });
  28 + const TimerEventDefinition = window.bpmnInstances.moddle.create("bpmn:TimerEventDefinition", {
  29 + id: `TimerEventDefinition_${uuid(8)}`,
  30 + [`time${options.eventDefinitionType.replace(/^\S/, s => s.toUpperCase())}`]: timeDefinition
  31 + });
  32 + listenerObj.eventDefinitions = [TimerEventDefinition];
  33 + }
  34 + return window.bpmnInstances.moddle.create(`${prefix}:${isTask ? "TaskListener" : "ExecutionListener"}`, listenerObj);
  35 +}
  36 +
  37 +// 创建 监听器的注入字段 实例
  38 +export function createFieldObject(option, prefix) {
  39 + const { name, fieldType, string, expression } = option;
  40 + const fieldConfig = fieldType === "string" ? { name, string } : { name, expression };
  41 + return window.bpmnInstances.moddle.create(`${prefix}:Field`, fieldConfig);
  42 +}
  43 +
  44 +// 创建脚本实例
  45 +export function createScriptObject(options, prefix) {
  46 + const { scriptType, scriptFormat, value, resource } = options;
  47 + const scriptConfig = scriptType === "inlineScript" ? { scriptFormat, value } : { scriptFormat, resource };
  48 + return window.bpmnInstances.moddle.create(`${prefix}:Script`, scriptConfig);
  49 +}
  50 +
  51 +// 更新元素扩展属性
  52 +export function updateElementExtensions(element, extensionList) {
  53 + const extensions = window.bpmnInstances.moddle.create("bpmn:ExtensionElements", {
  54 + values: extensionList
  55 + });
  56 + window.bpmnInstances.modeling.updateProperties(element, {
  57 + extensionElements: extensions
  58 + });
  59 +}
  60 +
  61 +// 创建一个id
  62 +export function uuid(length = 8, chars) {
  63 + let result = "";
  64 + let charsString = chars || "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  65 + for (let i = length; i > 0; --i) {
  66 + result += charsString[Math.floor(Math.random() * charsString.length)];
  67 + }
  68 + return result;
  69 +}
yudao-admin-ui/src/components/bpmnProcessDesigner/src/App.vue 0 → 100644
  1 +<template>
  2 + <div id="app">
  3 + <my-process-palette />
  4 + <my-process-designer
  5 + :key="`designer-${reloadIndex}`"
  6 + v-model="xmlString"
  7 + v-bind="controlForm"
  8 + keyboard
  9 + ref="processDesigner"
  10 + @element-click="elementClick"
  11 + @init-finished="initModeler"
  12 + />
  13 + <my-properties-panel :key="`penal-${reloadIndex}`" :bpmn-modeler="modeler" :prefix="controlForm.prefix" class="process-panel" />
  14 +
  15 + <!-- demo config -->
  16 + <div class="demo-control-bar">
  17 + <div class="open-control-dialog" @click="controlDrawerVisible = true"><i class="el-icon-setting"></i></div>
  18 + </div>
  19 + <el-drawer :visible.sync="controlDrawerVisible" size="400px" title="偏好设置" append-to-body destroy-on-close>
  20 + <el-form :model="controlForm" size="small" label-width="100px" class="control-form" @submit.native.prevent>
  21 + <el-form-item label="流程ID">
  22 + <el-input v-model="controlForm.processId" @change="reloadProcessDesigner" />
  23 + </el-form-item>
  24 + <el-form-item label="流程名称">
  25 + <el-input v-model="controlForm.processName" @change="reloadProcessDesigner" />
  26 + </el-form-item>
  27 + <el-form-item label="流转模拟">
  28 + <el-switch v-model="controlForm.simulation" inactive-text="停用" active-text="启用" @change="reloadProcessDesigner" />
  29 + </el-form-item>
  30 + <el-form-item label="禁用双击">
  31 + <el-switch v-model="controlForm.labelEditing" inactive-text="停用" active-text="启用" @change="changeLabelEditingStatus" />
  32 + </el-form-item>
  33 + <el-form-item label="隐藏label">
  34 + <el-switch v-model="controlForm.labelVisible" inactive-text="停用" active-text="启用" @change="changeLabelVisibleStatus" />
  35 + </el-form-item>
  36 + <el-form-item label="流程引擎">
  37 + <el-radio-group v-model="controlForm.prefix" @change="reloadProcessDesigner(true)">
  38 + <el-radio label="camunda">camunda</el-radio>
  39 + <el-radio label="flowable">flowable</el-radio>
  40 + <el-radio label="activiti">activiti</el-radio>
  41 + </el-radio-group>
  42 + </el-form-item>
  43 + <el-form-item label="工具栏">
  44 + <el-radio-group v-model="controlForm.headerButtonSize">
  45 + <el-radio label="mini">mini</el-radio>
  46 + <el-radio label="small">small</el-radio>
  47 + <el-radio label="medium">medium</el-radio>
  48 + </el-radio-group>
  49 + </el-form-item>
  50 + </el-form>
  51 + </el-drawer>
  52 +
  53 + <div class="info-tip">
  54 + <p>注:activiti 好像不支持表单配置,控制台可能会报错</p>
  55 + <p>更多配置请查看源码:<a href="https://github.com/miyuesc/bpmn-process-designer">MiyueSC/bpmn-process-designer</a></p>
  56 + <p>疑问请在此留言:<a href="https://github.com/miyuesc/bpmn-process-designer/issues/16">MiyueSC/bpmn-process-designer/issues</a></p>
  57 + </div>
  58 + </div>
  59 +</template>
  60 +
  61 +<script>
  62 +import translations from "@/translations";
  63 +// 自定义渲染(隐藏了 label 标签)
  64 +import CustomRenderer from "@/modules/custom-renderer";
  65 +// 自定义元素选中时的弹出菜单(修改 默认任务 为 用户任务)
  66 +import CustomContentPadProvider from "../package/designer/plugins/content-pad";
  67 +// 自定义左侧菜单(修改 默认任务 为 用户任务)
  68 +import CustomPaletteProvider from "../package/designer/plugins/palette";
  69 +import xmlObj2json from "./utils/xml2json";
  70 +import MyProcessPalette from "../package/palette/ProcessPalette";
  71 +// 自定义侧边栏
  72 +// import MyProcessPanel from "../package/process-panel/ProcessPanel";
  73 +
  74 +export default {
  75 + name: "App",
  76 + components: { MyProcessPalette },
  77 + data() {
  78 + return {
  79 + xmlString: "",
  80 + modeler: null,
  81 + reloadIndex: 0,
  82 + controlDrawerVisible: false,
  83 + translationsSelf: translations,
  84 + controlForm: {
  85 + processId: "",
  86 + processName: "",
  87 + simulation: true,
  88 + labelEditing: false,
  89 + labelVisible: false,
  90 + prefix: "flowable",
  91 + headerButtonSize: "mini",
  92 + // additionalModel: []
  93 + additionalModel: [CustomContentPadProvider, CustomPaletteProvider]
  94 + },
  95 + addis: {
  96 + CustomContentPadProvider,
  97 + CustomPaletteProvider
  98 + }
  99 + };
  100 + },
  101 + created() {},
  102 + methods: {
  103 + initModeler(modeler) {
  104 + setTimeout(() => {
  105 + this.modeler = modeler;
  106 + console.log(modeler);
  107 + }, 10);
  108 + },
  109 + reloadProcessDesigner(deep) {
  110 + this.controlForm.additionalModel = [];
  111 + for (let key in this.addis) {
  112 + if (this.addis[key]) {
  113 + this.controlForm.additionalModel.push(this.addis[key]);
  114 + }
  115 + }
  116 + deep && (this.xmlString = undefined);
  117 + this.reloadIndex += 1;
  118 + this.modeler = null; // 避免 panel 异常
  119 + // if (deep) {
  120 + // this.xmlString = undefined;
  121 + // this.$refs.processDesigner.processRestart();
  122 + // }
  123 + },
  124 + changeLabelEditingStatus(status) {
  125 + this.addis.labelEditing = status ? { labelEditingProvider: ["value", ""] } : false;
  126 + this.reloadProcessDesigner();
  127 + },
  128 + changeLabelVisibleStatus(status) {
  129 + this.addis.customRenderer = status ? CustomRenderer : false;
  130 + this.reloadProcessDesigner();
  131 + },
  132 + elementClick(element) {
  133 + this.element = element;
  134 +
  135 + !this.elementOverlayIds && (this.elementOverlayIds = {});
  136 +
  137 + !this.overlays && (this.overlays = this.modeler.get("overlays"));
  138 + !this.contextPad && (this.contextPad = this.modeler.get("contextPad"));
  139 +
  140 + this.modeler.on("element.hover", ({ element }) => {
  141 + if (!this.elementOverlayIds[element.id] && element.type !== "bpmn:Process") {
  142 + this.elementOverlayIds[element.id] = this.overlays.add(element, {
  143 + position: { left: 0, bottom: 0 },
  144 + html: `<div class="element-overlays">
  145 + <p>Elemet id: ${element.id}</p>
  146 + <p>Elemet type: ${element.type}</p>
  147 + </div>`
  148 + });
  149 + }
  150 + });
  151 +
  152 + this.modeler.on("element.out", ({ element }) => {
  153 + if (element) {
  154 + this.overlays.remove({ element });
  155 + this.elementOverlayIds[element.id] = null;
  156 + }
  157 + });
  158 + }
  159 + }
  160 +};
  161 +</script>
  162 +
  163 +<style lang="scss">
  164 +body {
  165 + overflow: hidden;
  166 + margin: 0;
  167 + box-sizing: border-box;
  168 +}
  169 +#app {
  170 + width: 100%;
  171 + height: 100%;
  172 + box-sizing: border-box;
  173 + display: inline-grid;
  174 + grid-template-columns: 100px auto max-content;
  175 +}
  176 +.demo-control-bar {
  177 + position: fixed;
  178 + right: 8px;
  179 + bottom: 8px;
  180 + z-index: 1;
  181 + .open-control-dialog {
  182 + width: 48px;
  183 + height: 48px;
  184 + display: flex;
  185 + align-items: center;
  186 + justify-content: center;
  187 + border-radius: 4px;
  188 + font-size: 32px;
  189 + background: rgba(64, 158, 255, 1);
  190 + color: #ffffff;
  191 + cursor: pointer;
  192 + }
  193 +}
  194 +.info-tip {
  195 + position: fixed;
  196 + top: 40px;
  197 + right: 500px;
  198 + z-index: 10;
  199 + color: #999999;
  200 +}
  201 +.control-form {
  202 + .el-radio {
  203 + width: 100%;
  204 + line-height: 32px;
  205 + }
  206 +}
  207 +.element-overlays {
  208 + box-sizing: border-box;
  209 + padding: 8px;
  210 + background: rgba(0, 0, 0, 0.6);
  211 + border-radius: 4px;
  212 + color: #fafafa;
  213 +}
  214 +
  215 +body,
  216 +body * {
  217 + /* 滚动条 */
  218 + &::-webkit-scrollbar-track-piece {
  219 + background-color: #fff; /*滚动条的背景颜色*/
  220 + -webkit-border-radius: 0; /*滚动条的圆角宽度*/
  221 + }
  222 + &::-webkit-scrollbar {
  223 + width: 10px; /*滚动条的宽度*/
  224 + height: 8px; /*滚动条的高度*/
  225 + }
  226 + &::-webkit-scrollbar-thumb:vertical {
  227 + /*垂直滚动条的样式*/
  228 + height: 50px;
  229 + background-color: rgba(153, 153, 153, 0.5);
  230 + -webkit-border-radius: 4px;
  231 + outline: 2px solid #fff;
  232 + outline-offset: -2px;
  233 + border: 2px solid #fff;
  234 + }
  235 + &::-webkit-scrollbar-thumb {
  236 + /*滚动条的hover样式*/
  237 + background-color: rgba(159, 159, 159, 0.3);
  238 + -webkit-border-radius: 4px;
  239 + }
  240 + &::-webkit-scrollbar-thumb:hover {
  241 + /*滚动条的hover样式*/
  242 + background-color: rgba(159, 159, 159, 0.5);
  243 + -webkit-border-radius: 4px;
  244 + }
  245 +}
  246 +</style>
yudao-admin-ui/src/components/bpmnProcessDesigner/src/highlight/index.js 0 → 100644
  1 +const hljs = require("highlight.js/lib/core");
  2 +hljs.registerLanguage("xml", require("highlight.js/lib/languages/xml"));
  3 +hljs.registerLanguage("json", require("highlight.js/lib/languages/json"));
  4 +
  5 +module.exports = hljs;
yudao-admin-ui/src/components/bpmnProcessDesigner/src/main.js 0 → 100644
  1 +import Vue from "vue";
  2 +import App from "./App.vue";
  3 +
  4 +import axios from "axios";
  5 +Vue.prototype.$axios = axios;
  6 +
  7 +// 加载基础ElementUI
  8 +import ElementUI from "element-ui";
  9 +Vue.use(ElementUI);
  10 +import "../package/theme/element-variables.scss";
  11 +
  12 +import { vuePlugin } from "@/highlight";
  13 +import "highlight.js/styles/atom-one-dark-reasonable.css";
  14 +Vue.use(vuePlugin);
  15 +
  16 +import MyPD from "../package/index.js";
  17 +Vue.use(MyPD);
  18 +import "../package/theme/index.scss";
  19 +
  20 +import "bpmn-js/dist/assets/diagram-js.css";
  21 +import "bpmn-js/dist/assets/bpmn-font/css/bpmn.css";
  22 +import "bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css";
  23 +
  24 +// import "bpmn-js-properties-panel/dist/assets/bpmn-js-properties-panel.css"; // 右边工具栏样式
  25 +
  26 +new Vue({
  27 + render: h => h(App)
  28 +}).$mount("#app");
yudao-admin-ui/src/components/bpmnProcessDesigner/src/modules/custom-renderer/CustomRenderer.js 0 → 100644
  1 +import BpmnRenderer from "bpmn-js/lib/draw/BpmnRenderer";
  2 +
  3 +export default function CustomRenderer(config, eventBus, styles, pathMap, canvas, textRenderer) {
  4 + BpmnRenderer.call(this, config, eventBus, styles, pathMap, canvas, textRenderer, 2000);
  5 +
  6 + this.handlers["label"] = function() {
  7 + return null;
  8 + };
  9 +}
  10 +
  11 +const F = function() {}; // 核心,利用空对象作为中介;
  12 +F.prototype = BpmnRenderer.prototype; // 核心,将父类的原型赋值给空对象F;
  13 +CustomRenderer.prototype = new F(); // 核心,将 F的实例赋值给子类;
  14 +CustomRenderer.prototype.constructor = CustomRenderer; // 修复子类CustomRenderer的构造器指向,防止原型链的混乱;
yudao-admin-ui/src/components/bpmnProcessDesigner/src/modules/custom-renderer/index.js 0 → 100644
  1 +import CustomRenderer from "./CustomRenderer";
  2 +
  3 +export default {
  4 + __init__: ["customRenderer"],
  5 + customRenderer: ["type", CustomRenderer]
  6 +};
yudao-admin-ui/src/components/bpmnProcessDesigner/src/modules/rules/CustomRules.js 0 → 100644
  1 +import BpmnRules from "bpmn-js/lib/features/rules/BpmnRules";
  2 +import inherits from "inherits";
  3 +
  4 +export default function CustomRules(eventBus) {
  5 + BpmnRules.call(this, eventBus);
  6 +}
  7 +
  8 +inherits(CustomRules, BpmnRules);
  9 +
  10 +CustomRules.prototype.canDrop = function() {
  11 + return false;
  12 +};
  13 +
  14 +CustomRules.prototype.canMove = function() {
  15 + return false;
  16 +};
yudao-admin-ui/src/components/bpmnProcessDesigner/src/modules/rules/index.js 0 → 100644
  1 +import CustomRules from "./CustomRules";
  2 +
  3 +export default {
  4 + __init__: ["customRules"],
  5 + customRules: ["type", CustomRules]
  6 +};
yudao-admin-ui/src/components/bpmnProcessDesigner/src/translations.js 0 → 100644
  1 +/**
  2 + * This is a sample file that should be replaced with the actual translation.
  3 + *
  4 + * Checkout https://github.com/bpmn-io/bpmn-js-i18n for a list of available
  5 + * translations and labels to translate.
  6 + */
  7 +export default {
  8 + "Exclusive Gateway": "Exklusives Gateway",
  9 + "Parallel Gateway": "Paralleles Gateway",
  10 + "Inclusive Gateway": "Inklusives Gateway",
  11 + "Complex Gateway": "Komplexes Gateway",
  12 + "Event based Gateway": "Ereignis-basiertes Gateway",
  13 + "Message Start Event": "消息启动事件",
  14 + "Timer Start Event": "定时启动事件",
  15 + "Conditional Start Event": "条件启动事件",
  16 + "Signal Start Event": "信号启动事件",
  17 + "Error Start Event": "错误启动事件",
  18 + "Escalation Start Event": "升级启动事件",
  19 + "Compensation Start Event": "补偿启动事件",
  20 + "Message Start Event (non-interrupting)": "消息启动事件 (非中断)",
  21 + "Timer Start Event (non-interrupting)": "定时启动事件 (非中断)",
  22 + "Conditional Start Event (non-interrupting)": "条件启动事件 (非中断)",
  23 + "Signal Start Event (non-interrupting)": "信号启动事件 (非中断)",
  24 + "Escalation Start Event (non-interrupting)": "升级启动事件 (非中断)"
  25 +};
yudao-admin-ui/src/components/bpmnProcessDesigner/src/utils/directive/clickOutSide.js 0 → 100644
  1 +//outside.js
  2 +
  3 +const ctx = "@@clickoutsideContext";
  4 +
  5 +export default {
  6 + bind(el, binding, vnode) {
  7 + const ele = el;
  8 + const documentHandler = e => {
  9 + if (!vnode.context || ele.contains(e.target)) {
  10 + return false;
  11 + }
  12 + // 调用指令回调
  13 + if (binding.expression) {
  14 + vnode.context[el[ctx].methodName](e);
  15 + } else {
  16 + el[ctx].bindingFn(e);
  17 + }
  18 + };
  19 + // 将方法添加到ele
  20 + ele[ctx] = {
  21 + documentHandler,
  22 + methodName: binding.expression,
  23 + bindingFn: binding.value
  24 + };
  25 +
  26 + setTimeout(() => {
  27 + document.addEventListener("touchstart", documentHandler); // 为document绑定事件
  28 + });
  29 + },
  30 + update(el, binding) {
  31 + const ele = el;
  32 + ele[ctx].methodName = binding.expression;
  33 + ele[ctx].bindingFn = binding.value;
  34 + },
  35 + unbind(el) {
  36 + document.removeEventListener("touchstart", el[ctx].documentHandler); // 解绑
  37 + delete el[ctx];
  38 + }
  39 +};
yudao-admin-ui/src/components/bpmnProcessDesigner/src/utils/index.js 0 → 100644
  1 +export function debounce(fn, delay = 500) {
  2 + let timer;
  3 + return function(...args) {
  4 + if (timer) {
  5 + clearTimeout(timer);
  6 + timer = null;
  7 + }
  8 + timer = setTimeout(fn.bind(this, ...args), delay);
  9 + };
  10 +}
yudao-admin-ui/src/components/bpmnProcessDesigner/src/utils/log.js 0 → 100644
  1 +class Log {
  2 + static type = ["primary", "success", "warn", "error", "info"];
  3 +
  4 + static typeColor(type = "default") {
  5 + let color = "";
  6 + switch (type) {
  7 + case "primary":
  8 + color = "#2d8cf0";
  9 + break;
  10 + case "success":
  11 + color = "#19be6b";
  12 + break;
  13 + case "info":
  14 + color = "#909399";
  15 + break;
  16 + case "warn":
  17 + color = "#ff9900";
  18 + break;
  19 + case "error":
  20 + color = "#f03f14";
  21 + break;
  22 + case "default":
  23 + color = "#35495E";
  24 + break;
  25 + default:
  26 + color = type;
  27 + break;
  28 + }
  29 + return color;
  30 + }
  31 +
  32 + static print(text, type = "default", back = false) {
  33 + if (typeof text === "object") {
  34 + // 如果是對象則調用打印對象方式
  35 + console.dir(text);
  36 + return;
  37 + }
  38 + if (back) {
  39 + // 如果是打印帶背景圖的
  40 + console.log(`%c ${text} `, `background:${this.typeColor(type)}; padding: 2px; border-radius: 4px;color: #fff;`);
  41 + } else {
  42 + console.log(`%c ${text} `, `color: ${this.typeColor(type)};`);
  43 + }
  44 + }
  45 +
  46 + static pretty(title, text, type = "primary") {
  47 + if (typeof text === "object") {
  48 + console.log(
  49 + `%c ${title} %c`,
  50 + `background:${this.typeColor(type)};border:1px solid ${this.typeColor(type)}; padding: 1px; border-radius: 4px 0 0 4px; color: #fff;`
  51 + );
  52 + console.dir(text);
  53 + return;
  54 + }
  55 + console.log(
  56 + `%c ${title} %c ${text} %c`,
  57 + `background:${this.typeColor(type)};border:1px solid ${this.typeColor(type)}; padding: 1px; border-radius: 4px 0 0 4px; color: #fff;`,
  58 + `border:1px solid ${this.typeColor(type)}; padding: 1px; border-radius: 0 4px 4px 0; color: ${this.typeColor(type)};`,
  59 + "background:transparent"
  60 + );
  61 + }
  62 +}
  63 +export default Log;
yudao-admin-ui/src/components/bpmnProcessDesigner/src/utils/xml2json.js 0 → 100644
  1 +function xmlStr2XmlObj(xmlStr) {
  2 + let xmlObj = {};
  3 + if (document.all) {
  4 + const xmlDom = new window.ActiveXObject("Microsoft.XMLDOM");
  5 + xmlDom.loadXML(xmlStr);
  6 + xmlObj = xmlDom;
  7 + } else {
  8 + xmlObj = new DOMParser().parseFromString(xmlStr, "text/xml");
  9 + }
  10 + return xmlObj;
  11 +}
  12 +
  13 +function xml2json(xml) {
  14 + try {
  15 + let obj = {};
  16 + if (xml.children.length > 0) {
  17 + for (let i = 0; i < xml.children.length; i++) {
  18 + const item = xml.children.item(i);
  19 + const nodeName = item.nodeName;
  20 + if (typeof obj[nodeName] == "undefined") {
  21 + obj[nodeName] = xml2json(item);
  22 + } else {
  23 + if (typeof obj[nodeName].push == "undefined") {
  24 + const old = obj[nodeName];
  25 + obj[nodeName] = [];
  26 + obj[nodeName].push(old);
  27 + }
  28 + obj[nodeName].push(xml2json(item));
  29 + }
  30 + }
  31 + } else {
  32 + obj = xml.textContent;
  33 + }
  34 + return obj;
  35 + } catch (e) {
  36 + console.log(e.message);
  37 + }
  38 +}
  39 +
  40 +function xmlObj2json(xml) {
  41 + const xmlObj = xmlStr2XmlObj(xml);
  42 + console.log(xmlObj);
  43 + let jsonObj = {};
  44 + if (xmlObj.childNodes.length > 0) {
  45 + jsonObj = xml2json(xmlObj);
  46 + }
  47 + return jsonObj;
  48 +}
  49 +
  50 +export default xmlObj2json;
yudao-admin-ui/src/main.js
@@ -76,6 +76,15 @@ Vue.component(&#39;RightToolbar&#39;, RightToolbar) @@ -76,6 +76,15 @@ Vue.component(&#39;RightToolbar&#39;, RightToolbar)
76 Vue.use(permission) 76 Vue.use(permission)
77 // Vue.use(hljs.vuePlugin); 77 // Vue.use(hljs.vuePlugin);
78 78
  79 +// TODO 芋艿:bpmnProcessDesigner 引入
  80 +import MyPD from "@/components/bpmnProcessDesigner/package/index.js";
  81 +Vue.use(MyPD);
  82 +import "@/components/bpmnProcessDesigner/package/theme/index.scss";
  83 +// TODO 芋艿:bpmnProcessDesigner 引入
  84 +import "bpmn-js/dist/assets/diagram-js.css";
  85 +import "bpmn-js/dist/assets/bpmn-font/css/bpmn.css";
  86 +import "bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css";
  87 +
79 /** 88 /**
80 * If you don't want to use mock-server 89 * If you don't want to use mock-server
81 * you want to use MockJs for mock api 90 * you want to use MockJs for mock api
yudao-admin-ui/src/router/index.js
@@ -163,6 +163,19 @@ export const constantRoutes = [ @@ -163,6 +163,19 @@ export const constantRoutes = [
163 } 163 }
164 ] 164 ]
165 }, 165 },
  166 + {
  167 + path: '/bpm',
  168 + component: Layout,
  169 + hidden: true,
  170 + children: [
  171 + {
  172 + path: 'manager/model/edit',
  173 + component: (resolve) => require(['@/views/bpm/model/modelEditor'], resolve),
  174 + name: '流程模型-编辑',
  175 + meta: { title: '流程模型-编辑' }
  176 + }
  177 + ]
  178 + },
166 ] 179 ]
167 180
168 export default new Router({ 181 export default new Router({
yudao-admin-ui/src/views/bpm/model/modelEditor.vue 0 → 100644
  1 +<template>
  2 +<!-- <div id="app">-->
  3 + <div class="app-container">
  4 +
  5 + <my-process-palette />
  6 + <my-process-designer
  7 + :key="`designer-${reloadIndex}`"
  8 + v-model="xmlString"
  9 + v-bind="controlForm"
  10 + keyboard
  11 + ref="processDesigner"
  12 + @element-click="elementClick"
  13 + @init-finished="initModeler"
  14 + />
  15 + <my-properties-panel :key="`penal-${reloadIndex}`" :bpmn-modeler="modeler" :prefix="controlForm.prefix" class="process-panel" />
  16 +
  17 + <!-- demo config -->
  18 + <div class="demo-control-bar">
  19 + <div class="open-control-dialog" @click="controlDrawerVisible = true"><i class="el-icon-setting"></i></div>
  20 + </div>
  21 + <el-drawer :visible.sync="controlDrawerVisible" size="400px" title="偏好设置" append-to-body destroy-on-close>
  22 + <el-form :model="controlForm" size="small" label-width="100px" class="control-form" @submit.native.prevent>
  23 + <el-form-item label="流程ID">
  24 + <el-input v-model="controlForm.processId" @change="reloadProcessDesigner" />
  25 + </el-form-item>
  26 + <el-form-item label="流程名称">
  27 + <el-input v-model="controlForm.processName" @change="reloadProcessDesigner" />
  28 + </el-form-item>
  29 + <el-form-item label="流转模拟">
  30 + <el-switch v-model="controlForm.simulation" inactive-text="停用" active-text="启用" @change="reloadProcessDesigner" />
  31 + </el-form-item>
  32 + <el-form-item label="禁用双击">
  33 + <el-switch v-model="controlForm.labelEditing" inactive-text="停用" active-text="启用" @change="changeLabelEditingStatus" />
  34 + </el-form-item>
  35 + <!-- TODO 芋艿:custom render 依赖报错 -->
  36 +<!-- <el-form-item label="隐藏label">-->
  37 +<!-- <el-switch v-model="controlForm.labelVisible" inactive-text="停用" active-text="启用" @change="changeLabelVisibleStatus" />-->
  38 +<!-- </el-form-item>-->
  39 + <el-form-item label="流程引擎">
  40 + <el-radio-group v-model="controlForm.prefix" @change="reloadProcessDesigner(true)">
  41 + <el-radio label="camunda">camunda</el-radio>
  42 + <el-radio label="flowable">flowable</el-radio>
  43 + <el-radio label="activiti">activiti</el-radio>
  44 + </el-radio-group>
  45 + </el-form-item>
  46 + <el-form-item label="工具栏">
  47 + <el-radio-group v-model="controlForm.headerButtonSize">
  48 + <el-radio label="mini">mini</el-radio>
  49 + <el-radio label="small">small</el-radio>
  50 + <el-radio label="medium">medium</el-radio>
  51 + </el-radio-group>
  52 + </el-form-item>
  53 + </el-form>
  54 + </el-drawer>
  55 +
  56 + <div class="info-tip">
  57 + <p>注:activiti 好像不支持表单配置,控制台可能会报错</p>
  58 + <p>更多配置请查看源码:<a href="https://github.com/miyuesc/bpmn-process-designer">MiyueSC/bpmn-process-designer</a></p>
  59 + <p>疑问请在此留言:<a href="https://github.com/miyuesc/bpmn-process-designer/issues/16">MiyueSC/bpmn-process-designer/issues</a></p>
  60 + </div>
  61 + </div>
  62 +</template>
  63 +
  64 +<script>
  65 +import translations from "./translations";
  66 +// 自定义渲染(隐藏了 label 标签)
  67 +// TODO 芋艿:custom render 依赖报错
  68 +// import CustomRenderer from "@/modules/custom-renderer";
  69 +// 自定义元素选中时的弹出菜单(修改 默认任务 为 用户任务)
  70 +import CustomContentPadProvider from "@/components/bpmnProcessDesigner/package/designer/plugins/content-pad";
  71 +// 自定义左侧菜单(修改 默认任务 为 用户任务)
  72 +import CustomPaletteProvider from "@/components/bpmnProcessDesigner/package/designer/plugins/palette";
  73 +// import xmlObj2json from "./utils/xml2json";
  74 +import MyProcessPalette from "@/components/bpmnProcessDesigner/package/palette/ProcessPalette";
  75 +// 自定义侧边栏
  76 +// import MyProcessPanel from "../package/process-panel/ProcessPanel";
  77 +
  78 +
  79 +export default {
  80 + name: "App",
  81 + components: { MyProcessPalette },
  82 + data() {
  83 + return {
  84 + xmlString: "",
  85 + modeler: null,
  86 + reloadIndex: 0,
  87 + controlDrawerVisible: false,
  88 + translationsSelf: translations,
  89 + controlForm: {
  90 + processId: "",
  91 + processName: "",
  92 + simulation: true,
  93 + labelEditing: false,
  94 + labelVisible: false,
  95 + prefix: "flowable",
  96 + headerButtonSize: "mini",
  97 + // additionalModel: []
  98 + additionalModel: [CustomContentPadProvider, CustomPaletteProvider]
  99 + },
  100 + addis: {
  101 + CustomContentPadProvider,
  102 + CustomPaletteProvider
  103 + }
  104 + };
  105 + },
  106 + created() {},
  107 + methods: {
  108 + initModeler(modeler) {
  109 + setTimeout(() => {
  110 + this.modeler = modeler;
  111 + console.log(modeler);
  112 + }, 10);
  113 + },
  114 + reloadProcessDesigner(deep) {
  115 + this.controlForm.additionalModel = [];
  116 + for (let key in this.addis) {
  117 + if (this.addis[key]) {
  118 + this.controlForm.additionalModel.push(this.addis[key]);
  119 + }
  120 + }
  121 + deep && (this.xmlString = undefined);
  122 + this.reloadIndex += 1;
  123 + this.modeler = null; // 避免 panel 异常
  124 + // if (deep) {
  125 + // this.xmlString = undefined;
  126 + // this.$refs.processDesigner.processRestart();
  127 + // }
  128 + },
  129 + changeLabelEditingStatus(status) {
  130 + this.addis.labelEditing = status ? { labelEditingProvider: ["value", ""] } : false;
  131 + this.reloadProcessDesigner();
  132 + },
  133 + // TODO 芋艿:custom render 依赖报错
  134 + // changeLabelVisibleStatus(status) {
  135 + // this.addis.customRenderer = status ? CustomRenderer : false;
  136 + // this.reloadProcessDesigner();
  137 + // },
  138 + elementClick(element) {
  139 + this.element = element;
  140 +
  141 + !this.elementOverlayIds && (this.elementOverlayIds = {});
  142 +
  143 + !this.overlays && (this.overlays = this.modeler.get("overlays"));
  144 + !this.contextPad && (this.contextPad = this.modeler.get("contextPad"));
  145 +
  146 + this.modeler.on("element.hover", ({ element }) => {
  147 + if (!this.elementOverlayIds[element.id] && element.type !== "bpmn:Process") {
  148 + this.elementOverlayIds[element.id] = this.overlays.add(element, {
  149 + position: { left: 0, bottom: 0 },
  150 + html: `<div class="element-overlays">
  151 + <p>Elemet id: ${element.id}</p>
  152 + <p>Elemet type: ${element.type}</p>
  153 + </div>`
  154 + });
  155 + }
  156 + });
  157 +
  158 + this.modeler.on("element.out", ({ element }) => {
  159 + if (element) {
  160 + this.overlays.remove({ element });
  161 + this.elementOverlayIds[element.id] = null;
  162 + }
  163 + });
  164 + }
  165 + }
  166 +};
  167 +</script>
  168 +
  169 +<style lang="scss">
  170 +body {
  171 + overflow: hidden;
  172 + margin: 0;
  173 + box-sizing: border-box;
  174 +}
  175 +//#app {
  176 +// width: 100%;
  177 +// height: 100%;
  178 +// box-sizing: border-box;
  179 +// display: inline-grid;
  180 +// grid-template-columns: 100px auto max-content;
  181 +//}
  182 +.demo-control-bar {
  183 + position: fixed;
  184 + right: 8px;
  185 + bottom: 8px;
  186 + z-index: 1;
  187 + .open-control-dialog {
  188 + width: 48px;
  189 + height: 48px;
  190 + display: flex;
  191 + align-items: center;
  192 + justify-content: center;
  193 + border-radius: 4px;
  194 + font-size: 32px;
  195 + background: rgba(64, 158, 255, 1);
  196 + color: #ffffff;
  197 + cursor: pointer;
  198 + }
  199 +}
  200 +.info-tip {
  201 + position: fixed;
  202 + top: 40px;
  203 + right: 500px;
  204 + z-index: 10;
  205 + color: #999999;
  206 +}
  207 +.control-form {
  208 + .el-radio {
  209 + width: 100%;
  210 + line-height: 32px;
  211 + }
  212 +}
  213 +.element-overlays {
  214 + box-sizing: border-box;
  215 + padding: 8px;
  216 + background: rgba(0, 0, 0, 0.6);
  217 + border-radius: 4px;
  218 + color: #fafafa;
  219 +}
  220 +
  221 +body,
  222 +body * {
  223 + /* 滚动条 */
  224 + &::-webkit-scrollbar-track-piece {
  225 + background-color: #fff; /*滚动条的背景颜色*/
  226 + -webkit-border-radius: 0; /*滚动条的圆角宽度*/
  227 + }
  228 + &::-webkit-scrollbar {
  229 + width: 10px; /*滚动条的宽度*/
  230 + height: 8px; /*滚动条的高度*/
  231 + }
  232 + &::-webkit-scrollbar-thumb:vertical {
  233 + /*垂直滚动条的样式*/
  234 + height: 50px;
  235 + background-color: rgba(153, 153, 153, 0.5);
  236 + -webkit-border-radius: 4px;
  237 + outline: 2px solid #fff;
  238 + outline-offset: -2px;
  239 + border: 2px solid #fff;
  240 + }
  241 + &::-webkit-scrollbar-thumb {
  242 + /*滚动条的hover样式*/
  243 + background-color: rgba(159, 159, 159, 0.3);
  244 + -webkit-border-radius: 4px;
  245 + }
  246 + &::-webkit-scrollbar-thumb:hover {
  247 + /*滚动条的hover样式*/
  248 + background-color: rgba(159, 159, 159, 0.5);
  249 + -webkit-border-radius: 4px;
  250 + }
  251 +}
  252 +</style>
yudao-admin-ui/src/views/bpm/model/translations.js 0 → 100644
  1 +/**
  2 + * This is a sample file that should be replaced with the actual translation.
  3 + *
  4 + * Checkout https://github.com/bpmn-io/bpmn-js-i18n for a list of available
  5 + * translations and labels to translate.
  6 + */
  7 +export default {
  8 + "Exclusive Gateway": "Exklusives Gateway",
  9 + "Parallel Gateway": "Paralleles Gateway",
  10 + "Inclusive Gateway": "Inklusives Gateway",
  11 + "Complex Gateway": "Komplexes Gateway",
  12 + "Event based Gateway": "Ereignis-basiertes Gateway",
  13 + "Message Start Event": "消息启动事件",
  14 + "Timer Start Event": "定时启动事件",
  15 + "Conditional Start Event": "条件启动事件",
  16 + "Signal Start Event": "信号启动事件",
  17 + "Error Start Event": "错误启动事件",
  18 + "Escalation Start Event": "升级启动事件",
  19 + "Compensation Start Event": "补偿启动事件",
  20 + "Message Start Event (non-interrupting)": "消息启动事件 (非中断)",
  21 + "Timer Start Event (non-interrupting)": "定时启动事件 (非中断)",
  22 + "Conditional Start Event (non-interrupting)": "条件启动事件 (非中断)",
  23 + "Signal Start Event (non-interrupting)": "信号启动事件 (非中断)",
  24 + "Escalation Start Event (non-interrupting)": "升级启动事件 (非中断)"
  25 +};