workflow-editor 0.9.83-dwtmp1 → 0.9.84-dw-tmp1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/lib/css/workflow-editor.common~247b300f.28fbd3a3.css +1 -0
  2. package/lib/css/workflow-editor.common~62bcfb54.c1b3ecc5.css +1 -0
  3. package/lib/css/workflow-editor.common~95b80cda.16e04122.css +1 -0
  4. package/lib/css/workflow-editor.common~e19cd708.68e04fb4.css +1 -0
  5. package/lib/css/workflow-editor.umd.min~247b300f.28fbd3a3.css +1 -0
  6. package/lib/css/workflow-editor.umd.min~62bcfb54.c1b3ecc5.css +1 -0
  7. package/lib/css/workflow-editor.umd.min~95b80cda.16e04122.css +1 -0
  8. package/lib/css/workflow-editor.umd.min~e19cd708.68e04fb4.css +1 -0
  9. package/lib/css/workflow-editor.umd~247b300f.28fbd3a3.css +1 -0
  10. package/lib/css/workflow-editor.umd~62bcfb54.c1b3ecc5.css +1 -0
  11. package/lib/css/workflow-editor.umd~95b80cda.16e04122.css +1 -0
  12. package/lib/css/workflow-editor.umd~e19cd708.68e04fb4.css +1 -0
  13. package/lib/css/yarn.prismjs~0bd0e877.9093a967.css +1 -0
  14. package/lib/workflow-editor.common.vendors~workflow-editor.common~253ae210.js +4136 -0
  15. package/lib/workflow-editor.common.workflow-editor.common~0b5ad61a.js +1022 -0
  16. package/lib/workflow-editor.common.workflow-editor.common~247b300f.js +1948 -0
  17. package/lib/workflow-editor.common.workflow-editor.common~62bcfb54.js +14764 -0
  18. package/lib/workflow-editor.common.workflow-editor.common~95b80cda.js +3300 -0
  19. package/lib/workflow-editor.common.workflow-editor.common~e19cd708.js +1585 -0
  20. package/lib/workflow-editor.common.workflow-editor.common~e2e93592.js +1293 -0
  21. package/lib/workflow-editor.common.yarn.async-validator~7864cd12.js +1223 -0
  22. package/lib/workflow-editor.common.yarn.buffer~7e5e8261.js +1801 -0
  23. package/lib/workflow-editor.common.yarn.core-js~2b13b260.js +5078 -0
  24. package/lib/workflow-editor.common.yarn.imatrix-ui~f5767151.js +2256 -0
  25. package/lib/workflow-editor.common.yarn.prismjs~0bd0e877.js +2028 -0
  26. package/lib/workflow-editor.common.yarn.readable-stream~2b6d3a99.js +2435 -0
  27. package/lib/workflow-editor.common.yarn.sax~95191fae.js +1576 -0
  28. package/lib/workflow-editor.common.yarn.vue-i18n~02576867.js +2259 -0
  29. package/lib/workflow-editor.umd.min.js +1 -39
  30. package/lib/workflow-editor.umd.min.vendors~workflow-editor.umd.min~253ae210.js +12 -0
  31. package/lib/workflow-editor.umd.min.workflow-editor.umd.min~0b5ad61a.js +1 -0
  32. package/lib/workflow-editor.umd.min.workflow-editor.umd.min~247b300f.js +1 -0
  33. package/lib/workflow-editor.umd.min.workflow-editor.umd.min~62bcfb54.js +1 -0
  34. package/lib/workflow-editor.umd.min.workflow-editor.umd.min~95b80cda.js +1 -0
  35. package/lib/workflow-editor.umd.min.workflow-editor.umd.min~e19cd708.js +1 -0
  36. package/lib/workflow-editor.umd.min.workflow-editor.umd.min~e2e93592.js +1 -0
  37. package/lib/workflow-editor.umd.min.yarn.async-validator~7864cd12.js +1 -0
  38. package/lib/workflow-editor.umd.min.yarn.buffer~7e5e8261.js +8 -0
  39. package/lib/workflow-editor.umd.min.yarn.core-js~2b13b260.js +1 -0
  40. package/lib/workflow-editor.umd.min.yarn.imatrix-ui~f5767151.js +1 -0
  41. package/lib/workflow-editor.umd.min.yarn.prismjs~0bd0e877.js +9 -0
  42. package/lib/workflow-editor.umd.min.yarn.readable-stream~2b6d3a99.js +1 -0
  43. package/lib/workflow-editor.umd.min.yarn.sax~95191fae.js +2 -0
  44. package/lib/workflow-editor.umd.min.yarn.vue-i18n~02576867.js +6 -0
  45. package/lib/workflow-editor.umd.vendors~workflow-editor.umd~253ae210.js +4136 -0
  46. package/lib/workflow-editor.umd.workflow-editor.umd~0b5ad61a.js +1032 -0
  47. package/lib/workflow-editor.umd.workflow-editor.umd~247b300f.js +1948 -0
  48. package/lib/workflow-editor.umd.workflow-editor.umd~62bcfb54.js +14764 -0
  49. package/lib/workflow-editor.umd.workflow-editor.umd~95b80cda.js +3300 -0
  50. package/lib/workflow-editor.umd.workflow-editor.umd~e19cd708.js +1585 -0
  51. package/lib/workflow-editor.umd.workflow-editor.umd~e2e93592.js +1293 -0
  52. package/lib/workflow-editor.umd.yarn.async-validator~7864cd12.js +1223 -0
  53. package/lib/workflow-editor.umd.yarn.buffer~7e5e8261.js +1801 -0
  54. package/lib/workflow-editor.umd.yarn.core-js~2b13b260.js +5078 -0
  55. package/lib/workflow-editor.umd.yarn.imatrix-ui~f5767151.js +2256 -0
  56. package/lib/workflow-editor.umd.yarn.prismjs~0bd0e877.js +2028 -0
  57. package/lib/workflow-editor.umd.yarn.readable-stream~2b6d3a99.js +2435 -0
  58. package/lib/workflow-editor.umd.yarn.sax~95191fae.js +1576 -0
  59. package/lib/workflow-editor.umd.yarn.vue-i18n~02576867.js +2259 -0
  60. package/package.json +2 -2
  61. package/lib/workflow-editor.css +0 -1
@@ -0,0 +1,1585 @@
1
+ ((typeof self !== 'undefined' ? self : this)["webpackJsonpworkflow_editor"] = (typeof self !== 'undefined' ? self : this)["webpackJsonpworkflow_editor"] || []).push([[6],{
2
+
3
+ /***/ "2466":
4
+ /***/ (function(module, exports, __webpack_require__) {
5
+
6
+ // extracted by mini-css-extract-plugin
7
+
8
+ /***/ }),
9
+
10
+ /***/ "8a10":
11
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
12
+
13
+ "use strict";
14
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return getComponentList; });
15
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return getComponentInfo; });
16
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return getJoint; });
17
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return getMousePosition; });
18
+ /* unused harmony export getClientMousePosition */
19
+ /* unused harmony export getMouseOffset */
20
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return getVirtualRegion; });
21
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return getRealRegion; });
22
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return startDragTache; });
23
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return endDragTache; });
24
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return clearAllSelectedComponents; });
25
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return removeTextProperty; });
26
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return initializeProcessData; });
27
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return findOutgoingTransitionsByTacheId; });
28
+ /* unused harmony export findIncomingTransitionsByTacheId */
29
+ /* unused harmony export findTacheById */
30
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return deepCopy; });
31
+ /* unused harmony export updateTransitionsWhenTacheIdChanged */
32
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return validateTacheCode; });
33
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return getI18n; });
34
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return watchShowName; });
35
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return processTemplate; });
36
+ /* harmony import */ var core_js_modules_es7_symbol_async_iterator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("ac4d");
37
+ /* harmony import */ var core_js_modules_es7_symbol_async_iterator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es7_symbol_async_iterator__WEBPACK_IMPORTED_MODULE_0__);
38
+ /* harmony import */ var core_js_modules_es6_symbol__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("8a81");
39
+ /* harmony import */ var core_js_modules_es6_symbol__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_symbol__WEBPACK_IMPORTED_MODULE_1__);
40
+ /* harmony import */ var core_js_modules_es6_string_iterator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("5df3");
41
+ /* harmony import */ var core_js_modules_es6_string_iterator__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_string_iterator__WEBPACK_IMPORTED_MODULE_2__);
42
+ /* harmony import */ var core_js_modules_es6_array_from__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("1c4c");
43
+ /* harmony import */ var core_js_modules_es6_array_from__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_array_from__WEBPACK_IMPORTED_MODULE_3__);
44
+ /* harmony import */ var core_js_modules_es6_regexp_to_string__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("6b54");
45
+ /* harmony import */ var core_js_modules_es6_regexp_to_string__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_to_string__WEBPACK_IMPORTED_MODULE_4__);
46
+ /* harmony import */ var core_js_modules_es6_regexp_split__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("28a5");
47
+ /* harmony import */ var core_js_modules_es6_regexp_split__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_split__WEBPACK_IMPORTED_MODULE_5__);
48
+ /* harmony import */ var core_js_modules_es6_array_iterator__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("cadf");
49
+ /* harmony import */ var core_js_modules_es6_array_iterator__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_array_iterator__WEBPACK_IMPORTED_MODULE_6__);
50
+ /* harmony import */ var core_js_modules_es6_object_keys__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("456d");
51
+ /* harmony import */ var core_js_modules_es6_object_keys__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_object_keys__WEBPACK_IMPORTED_MODULE_7__);
52
+ /* harmony import */ var D_MyToolbox_ws_idea_plateform_dev_opt_workflow_editor_dev_opt_node_modules_babel_runtime_helpers_esm_typeof_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("53ca");
53
+ /* harmony import */ var core_js_modules_web_dom_iterable__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("ac6a");
54
+ /* harmony import */ var core_js_modules_web_dom_iterable__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_iterable__WEBPACK_IMPORTED_MODULE_9__);
55
+ /* harmony import */ var core_js_modules_es6_function_name__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__("7f7f");
56
+ /* harmony import */ var core_js_modules_es6_function_name__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_function_name__WEBPACK_IMPORTED_MODULE_10__);
57
+ /* harmony import */ var imatrix_ui_src_utils_util__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("29b3");
58
+ /* harmony import */ var _json_object_templates_process__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__("ec92");
59
+ /* harmony import */ var _json_object_templates_human_task__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__("b8c0");
60
+ /* harmony import */ var _json_object_templates_decision__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__("ac8e");
61
+ /* harmony import */ var _json_object_templates_start__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__("e177");
62
+ /* harmony import */ var _json_object_templates_end__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__("9ab1");
63
+ /* harmony import */ var _json_object_templates_transition__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__("10ab");
64
+ /* harmony import */ var _json_object_templates_subprocess__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__("a045");
65
+ /* harmony import */ var _json_object_templates_fork__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__("93e0");
66
+ /* harmony import */ var _json_object_templates_join__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__("6465");
67
+ /* harmony import */ var _json_object_templates_human_decision__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__("fe3a");
68
+ /* harmony import */ var _src_i18n_i18n__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__("0692");
69
+ /* harmony import */ var _json_object_templates_copy_task__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__("beb3");
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
82
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
83
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
84
+
85
+ function getStore() {
86
+ return window.$store;
87
+ }
88
+ function getI18n() {
89
+ if (!window.$locale) {
90
+ _src_i18n_i18n__WEBPACK_IMPORTED_MODULE_22__[/* default */ "a"].locale = 'cn';
91
+ } else {
92
+ _src_i18n_i18n__WEBPACK_IMPORTED_MODULE_22__[/* default */ "a"].locale = window.$locale;
93
+ }
94
+ return _src_i18n_i18n__WEBPACK_IMPORTED_MODULE_22__[/* default */ "a"];
95
+ }
96
+ // 组件的初始信息
97
+ function getComponentList() {
98
+ return [{
99
+ name: 'Start',
100
+ label: getI18n().t('workflowEditor.task.start'),
101
+ icon: 'start',
102
+ type: 'success',
103
+ round: true,
104
+ width: 48,
105
+ height: 48,
106
+ color: '#67C23A'
107
+ }, {
108
+ name: 'HumanTask',
109
+ label: getI18n().t('workflowEditor.task.humanTask'),
110
+ icon: 'human-task',
111
+ type: '',
112
+ round: false,
113
+ width: 80,
114
+ height: 40,
115
+ color: '#000'
116
+ }, {
117
+ name: 'Decision',
118
+ label: getI18n().t('workflowEditor.task.conditionJudgment'),
119
+ icon: 'decision',
120
+ type: '',
121
+ round: false,
122
+ width: 48,
123
+ height: 48,
124
+ color: '#999'
125
+ }, {
126
+ name: 'Fork',
127
+ label: getI18n().t('workflowEditor.task.branch'),
128
+ icon: 'fork',
129
+ type: '',
130
+ round: false,
131
+ width: 48,
132
+ height: 48,
133
+ color: '#999'
134
+ }, {
135
+ name: 'Join',
136
+ label: getI18n().t('workflowEditor.task.converge'),
137
+ icon: 'join',
138
+ type: '',
139
+ round: false,
140
+ width: 48,
141
+ height: 48,
142
+ color: '#999'
143
+ }, {
144
+ name: 'Subprocess',
145
+ label: getI18n().t('workflowEditor.task.subprocess'),
146
+ icon: 'subprocess',
147
+ type: 'warning',
148
+ round: false,
149
+ width: 80,
150
+ height: 40,
151
+ color: '#0777D4'
152
+ }, {
153
+ name: 'HumanDecision',
154
+ label: getI18n().t('workflowEditor.task.manualJudgment'),
155
+ icon: 'human-decision',
156
+ type: '',
157
+ round: false,
158
+ width: 48,
159
+ height: 48,
160
+ color: '#999'
161
+ }, {
162
+ name: 'CopyTask',
163
+ label: getI18n().t('workflowEditor.task.cCtask'),
164
+ icon: 'copy-task',
165
+ type: '',
166
+ round: false,
167
+ width: 80,
168
+ height: 40,
169
+ color: '#0777D4'
170
+ }, {
171
+ name: 'End',
172
+ label: getI18n().t('workflowEditor.task.end'),
173
+ icon: 'end',
174
+ type: 'danger',
175
+ round: true,
176
+ width: 48,
177
+ height: 48,
178
+ color: '#F56C6C'
179
+ }];
180
+ }
181
+ function getComponentInfo(name) {
182
+ var component = getComponentList().filter(function (item) {
183
+ return item.name === name;
184
+ });
185
+ if (component.length > 0) {
186
+ return component[0];
187
+ } else {
188
+ return null;
189
+ }
190
+ }
191
+ // 根据环节id找到环节对象
192
+ function getParent(parent) {
193
+ var taches = getStore().getters['wfEditor/taches'];
194
+ var tache = taches.filter(function (tache) {
195
+ return tache.id === parent;
196
+ });
197
+ return tache[0];
198
+ }
199
+ function getJoint(parent, position) {
200
+ // 如果parent只是一个名称的时候需要先找到环节对象
201
+ if (typeof parent === 'string') {
202
+ parent = getParent(parent);
203
+ }
204
+ switch (position) {
205
+ case 'up':
206
+ case 'top':
207
+ return {
208
+ position: 'up',
209
+ x: parent.x + parent.width / 2,
210
+ y: parent.y
211
+ };
212
+ case 'right':
213
+ return {
214
+ position: 'right',
215
+ x: parent.x + parent.width,
216
+ y: parent.y + parent.height / 2
217
+ };
218
+ case 'down':
219
+ case 'bottom':
220
+ return {
221
+ position: 'down',
222
+ x: parent.x + parent.width / 2,
223
+ y: parent.y + parent.height
224
+ };
225
+ case 'left':
226
+ return {
227
+ position: 'left',
228
+ x: parent.x,
229
+ y: parent.y + parent.height / 2
230
+ };
231
+ default:
232
+ return {
233
+ position: '',
234
+ x: parent.x,
235
+ y: parent.y
236
+ };
237
+ }
238
+ }
239
+ // 根据鼠标的位置clientX,clientY算出对应的SVG中的坐标
240
+ function getMousePosition(evt) {
241
+ var CTM = document.getElementById('svg').getScreenCTM();
242
+ return {
243
+ x: (evt.clientX - CTM.e) / CTM.a,
244
+ y: (evt.clientY - CTM.f) / CTM.d
245
+ };
246
+ }
247
+ // 根据svg中鼠标按下的位置算出对应在html中的鼠标位置
248
+ function getClientMousePosition() {
249
+ var CTM = document.getElementById('svg').getScreenCTM();
250
+ var mouseDownPosition = getStore().getters['wfEditor/mouseDownPosition'];
251
+ return {
252
+ x: mouseDownPosition.x * CTM.a + CTM.e,
253
+ y: mouseDownPosition.y * CTM.d + CTM.f
254
+ };
255
+ }
256
+ function getMouseOffset(event, tache) {
257
+ if (event.target.classList.contains('draggable')) {
258
+ var offset = getMousePosition(event);
259
+ offset.x -= tache.x;
260
+ offset.y -= tache.y;
261
+ return offset;
262
+ }
263
+ }
264
+ function getVirtualRegion(startPoint, endPoint) {
265
+ if (!startPoint || !endPoint) {
266
+ return {};
267
+ }
268
+ var x1 = startPoint.x,
269
+ y1 = startPoint.y;
270
+ var x2 = endPoint.x,
271
+ y2 = endPoint.y;
272
+ var area = {
273
+ x: 0,
274
+ y: 0,
275
+ width: Math.abs(x2 - x1),
276
+ height: Math.abs(y2 - y1)
277
+ };
278
+ if (x1 <= x2) {
279
+ if (y1 <= y2) {
280
+ // p2在p1的右下方
281
+ area.x = x1;
282
+ area.y = y1;
283
+ } else {
284
+ // p2在p1的右上方
285
+ area.x = x1;
286
+ area.y = y2;
287
+ }
288
+ } else {
289
+ if (y1 >= y2) {
290
+ // p2在p1的左上方
291
+ area.x = x2;
292
+ area.y = y2;
293
+ } else {
294
+ area.x = x2;
295
+ area.y = y1;
296
+ }
297
+ }
298
+ return area;
299
+ }
300
+ // 根据选中的环节裁剪选择区域
301
+ function getRealRegion(taches) {
302
+ var minX, minY;
303
+ minX = minY = 10000;
304
+ var maxX, maxY;
305
+ maxX = maxY = 0;
306
+ var _iterator = _createForOfIteratorHelper(taches),
307
+ _step;
308
+ try {
309
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
310
+ var tache = _step.value;
311
+ if (minX > tache.x) {
312
+ minX = tache.x;
313
+ }
314
+ if (minY > tache.y) {
315
+ minY = tache.y;
316
+ }
317
+ if (maxX < tache.x + tache.width) {
318
+ maxX = tache.x + tache.width;
319
+ }
320
+ if (maxY < tache.y + tache.height) {
321
+ maxY = tache.y + tache.height;
322
+ }
323
+ }
324
+ } catch (err) {
325
+ _iterator.e(err);
326
+ } finally {
327
+ _iterator.f();
328
+ }
329
+ return {
330
+ x: minX - 10,
331
+ y: minY - 10,
332
+ width: maxX - minX + 20,
333
+ height: maxY - minY + 20
334
+ };
335
+ }
336
+ function startDragTache(event, vm) {
337
+ // 清除选中的环节或者流向
338
+ clearAllSelectedComponents();
339
+ // 清除选择区域
340
+ vm.$parent.region = null;
341
+ // 不是显示流转历史的时候,需要选中当前环节
342
+ if (!vm.$parent.showHistory) {
343
+ vm.model.isSelected = true;
344
+ }
345
+ getStore().getters['wfEditor/selectedTaches'].push(vm.model);
346
+ var mouseDownPosition = getMousePosition(event);
347
+ getStore().commit('wfEditor/setMouseDownPosition', mouseDownPosition);
348
+ getStore().commit('wfEditor/setMovingTache', true);
349
+ }
350
+ function endDragTache() {
351
+ getStore().commit('wfEditor/setMovingTache', false);
352
+ getStore().commit('wfEditor/setMouseDownPosition', null);
353
+ }
354
+ function unselectTaches() {
355
+ var _iterator2 = _createForOfIteratorHelper(getStore().getters['wfEditor/selectedTaches']),
356
+ _step2;
357
+ try {
358
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
359
+ var tache = _step2.value;
360
+ tache.isSelected = false;
361
+ }
362
+ } catch (err) {
363
+ _iterator2.e(err);
364
+ } finally {
365
+ _iterator2.f();
366
+ }
367
+ getStore().commit('wfEditor/setSelectedTaches', []);
368
+ }
369
+ /**
370
+ * 包括选中的环节(可能有多个)和流向(0个或1个)
371
+ */
372
+ function clearAllSelectedComponents() {
373
+ unselectTaches();
374
+ if (getStore().getters['wfEditor/selectedTransition']) {
375
+ getStore().getters['wfEditor/selectedTransition'].isSelected = false;
376
+ }
377
+ getStore().commit('wfEditor/setSelectedTransition', null);
378
+ }
379
+
380
+ /**
381
+ * 通过xml-js库生成的js对象包含_text属性,需要把这个属性去掉,把值复制给父属性
382
+ * 如x:{_text:50}需要变成x:50
383
+ * @param {包含_text属性的对象} obj
384
+ */
385
+ function removeTextProperty(obj) {
386
+ var keys = Object.getOwnPropertyNames(obj);
387
+ keys.forEach(function (key) {
388
+ if (Object(D_MyToolbox_ws_idea_plateform_dev_opt_workflow_editor_dev_opt_node_modules_babel_runtime_helpers_esm_typeof_js__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"])(obj[key]) === 'object') {
389
+ if (obj[key]._text !== undefined) {
390
+ obj[key] = obj[key]._text;
391
+ return;
392
+ } else {
393
+ if (Object.keys(obj[key]).length > 0) {
394
+ removeTextProperty(obj[key]);
395
+ } else {
396
+ // 如果是空对象就转换为字符串,js-xml库会把每个xml节点都转换为对象,对底层的空节点应该是字符串,其他类型应该给默认值,true,0等
397
+ // variables和events节点不是最底层节点,有时候也会为空,不能处理他们
398
+ var specialNodes = ['variables', 'events', 'autoFilledFields'];
399
+ if (specialNodes.indexOf(key) < 0) {
400
+ obj[key] = '';
401
+ }
402
+ }
403
+ }
404
+ }
405
+ });
406
+ }
407
+ function generateTaches(type, arr) {
408
+ if (!arr) arr = [];
409
+ if (!Array.isArray(arr)) {
410
+ arr = [arr];
411
+ }
412
+ var taches = getStore().getters['wfEditor/taches'];
413
+ var _iterator3 = _createForOfIteratorHelper(arr),
414
+ _step3;
415
+ try {
416
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
417
+ var task = _step3.value;
418
+ var tache = {
419
+ id: task.attr.id,
420
+ name: task.attr.name,
421
+ // +号是把文本转换成数字的快捷方式
422
+ x: task.g.x,
423
+ y: task.g.y,
424
+ width: task.g.width,
425
+ height: task.g.height,
426
+ type: type,
427
+ isSelected: false,
428
+ ref: task
429
+ };
430
+ taches.push(tache);
431
+ }
432
+ } catch (err) {
433
+ _iterator3.e(err);
434
+ } finally {
435
+ _iterator3.f();
436
+ }
437
+ }
438
+ function generateTransitions(type, arr) {
439
+ if (!arr) arr = [];
440
+ if (!Array.isArray(arr)) {
441
+ arr = [arr];
442
+ }
443
+ var transitions = getStore().getters['wfEditor/transitions'];
444
+ var _iterator4 = _createForOfIteratorHelper(arr),
445
+ _step4;
446
+ try {
447
+ var _loop = function _loop() {
448
+ var transition = _step4.value;
449
+ var remark = transition.basicProperties.remark || '';
450
+ var model = {
451
+ id: transition.attr.id,
452
+ startJoint: {
453
+ parent: findTacheById(transition.attr.from),
454
+ position: transition.g.fromJoint
455
+ },
456
+ endJoint: {
457
+ parent: findTacheById(transition.attr.to),
458
+ position: transition.g.toJoint
459
+ },
460
+ isSelected: false,
461
+ remark: remark,
462
+ lineInfo: {
463
+ type: transition.g.lineType,
464
+ controlPoint: null
465
+ },
466
+ ref: transition
467
+ };
468
+ // 曲线的话会有控制点,如果以后要存多个控制点,就以'x1,y1 x2,y2 x3,y3'的形式来保存,目前只有一个控制点
469
+ if (transition.g.lineType === 'CurveLine' && transition.g.coordinate) {
470
+ var point = transition.g.coordinate.split(',');
471
+ model.lineInfo.controlPoint = {
472
+ x: point[0],
473
+ y: point[1]
474
+ };
475
+ } else if (transition.g.lineType === 'BrokenLine' && transition.g.coordinate) {
476
+ var points = transition.g.coordinate.split(';');
477
+ var controlPoints = [];
478
+ points.forEach(function (pointXY) {
479
+ if (pointXY !== '') {
480
+ var _point = pointXY.split(',');
481
+ controlPoints.push({
482
+ x: _point[0],
483
+ y: _point[1]
484
+ });
485
+ }
486
+ });
487
+ model.lineInfo.controlPoint = controlPoints;
488
+ }
489
+ transitions.push(model);
490
+ };
491
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
492
+ _loop();
493
+ }
494
+ } catch (err) {
495
+ _iterator4.e(err);
496
+ } finally {
497
+ _iterator4.f();
498
+ }
499
+ }
500
+ function initializeProcessData(process) {
501
+ if (!process) return;
502
+ generateTaches('HumanTask', process.humanTask);
503
+ generateTaches('Decision', process.decision);
504
+ generateTaches('Fork', process.fork);
505
+ generateTaches('Join', process.join);
506
+ generateTaches('Subprocess', process.subprocess);
507
+ generateTaches('HumanDecision', process.humanDecision);
508
+ generateTaches('CopyTask', process.copyTask);
509
+ generateTaches('Start', process.start);
510
+ generateTaches('End', process.end);
511
+ generateTransitions('Transition', process.transition);
512
+ }
513
+ function findOutgoingTransitionsByTacheId(tacheId) {
514
+ var transitions = getStore().getters['wfEditor/transitions'];
515
+ var result = transitions.filter(function (transition) {
516
+ return transition.startJoint.parent.id === tacheId || transition.ref.attr.from === tacheId;
517
+ });
518
+ return result;
519
+ }
520
+ function findIncomingTransitionsByTacheId(tacheId) {
521
+ var transitions = getStore().getters['wfEditor/transitions'];
522
+ var result = transitions.filter(function (transition) {
523
+ return transition.endJoint.parent.id === tacheId || transition.ref.attr.to === tacheId;
524
+ });
525
+ return result;
526
+ }
527
+ function findTacheById(tacheId) {
528
+ var taches = getStore().getters['wfEditor/taches'];
529
+ var tache = taches.filter(function (tache) {
530
+ return tache.ref.attr.id === tacheId;
531
+ });
532
+ if (tache.length > 0) {
533
+ return tache[0];
534
+ } else {
535
+ return null;
536
+ }
537
+ }
538
+ function deepCopy(source) {
539
+ return JSON.parse(JSON.stringify(source));
540
+ }
541
+ function updateTransitionsWhenTacheIdChanged(newId, oldId) {
542
+ var incomingTransitions = findIncomingTransitionsByTacheId(oldId);
543
+ incomingTransitions.map(function (item) {
544
+ item.ref.attr.to = newId;
545
+ item.ref.attr.id = 'flow_' + item.ref.attr.from + '_to_' + item.ref.attr.to;
546
+ item.id = item.ref.attr.id;
547
+ });
548
+ var outgoingTransitions = findOutgoingTransitionsByTacheId(oldId);
549
+ outgoingTransitions.map(function (item) {
550
+ item.ref.attr.from = newId;
551
+ item.ref.attr.id = 'flow_' + item.ref.attr.from + '_to_' + item.ref.attr.to;
552
+ item.id = item.ref.attr.id;
553
+ });
554
+ return true;
555
+ }
556
+ function validateTacheCode(vm) {
557
+ var tache = findTacheById(vm.formModel.id);
558
+ if (tache && tache.id !== vm.id) {
559
+ vm.$alert(getI18n().t('workflowEditorMessage.itIsTheSameAsTheExistingLink', {
560
+ name: tache.name
561
+ }));
562
+ // 编码重复,立即还原id
563
+ vm.formModel.id = vm.id;
564
+ return;
565
+ }
566
+ // 环节编码不重复的时候,就需要更新流入流向的to和流出流向的from属性了,同时把编码值回传给父组件
567
+ updateTransitionsWhenTacheIdChanged(vm.formModel.id, vm.id);
568
+ // 支持.snyc修饰符的写法
569
+ vm.$emit('update:id', vm.formModel.id);
570
+ }
571
+ function watchShowName(vm, newVal) {
572
+ var showName = '';
573
+ if (vm.processI18n && vm.model.ref && vm.model.ref.basicProperties && vm.model.ref.basicProperties.i18nKey) {
574
+ var i18nKey = vm.model.ref.basicProperties.i18nKey;
575
+ var language = Object(imatrix_ui_src_utils_util__WEBPACK_IMPORTED_MODULE_11__[/* getLanguageWithLocale */ "c"])();
576
+ if (vm.processI18n[i18nKey]) {
577
+ showName = vm.processI18n[i18nKey][language];
578
+ }
579
+ if (!showName) {
580
+ showName = newVal;
581
+ }
582
+ } else {
583
+ showName = newVal;
584
+ }
585
+ return showName;
586
+ }
587
+
588
+
589
+
590
+
591
+
592
+
593
+
594
+
595
+
596
+
597
+
598
+
599
+
600
+ var processTemplate = {
601
+ newProcess: _json_object_templates_process__WEBPACK_IMPORTED_MODULE_12__[/* default */ "a"],
602
+ newHumanTask: _json_object_templates_human_task__WEBPACK_IMPORTED_MODULE_13__[/* default */ "a"],
603
+ newDecision: _json_object_templates_decision__WEBPACK_IMPORTED_MODULE_14__[/* default */ "a"],
604
+ newStart: _json_object_templates_start__WEBPACK_IMPORTED_MODULE_15__[/* default */ "a"],
605
+ newEnd: _json_object_templates_end__WEBPACK_IMPORTED_MODULE_16__[/* default */ "a"],
606
+ newTransition: _json_object_templates_transition__WEBPACK_IMPORTED_MODULE_17__[/* default */ "a"],
607
+ newSubprocess: _json_object_templates_subprocess__WEBPACK_IMPORTED_MODULE_18__[/* default */ "a"],
608
+ newFork: _json_object_templates_fork__WEBPACK_IMPORTED_MODULE_19__[/* default */ "a"],
609
+ newJoin: _json_object_templates_join__WEBPACK_IMPORTED_MODULE_20__[/* default */ "a"],
610
+ newHumanDecision: _json_object_templates_human_decision__WEBPACK_IMPORTED_MODULE_21__[/* default */ "a"],
611
+ newCopyTask: _json_object_templates_copy_task__WEBPACK_IMPORTED_MODULE_23__[/* default */ "a"]
612
+ };
613
+
614
+
615
+ /***/ }),
616
+
617
+ /***/ "9eb1":
618
+ /***/ (function(module, exports, __webpack_require__) {
619
+
620
+ // extracted by mini-css-extract-plugin
621
+
622
+ /***/ }),
623
+
624
+ /***/ "a0da":
625
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
626
+
627
+ "use strict";
628
+
629
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"813ecc90-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/workflow-editor/src/workflow-history.vue?vue&type=template&id=422096c3&scoped=true&
630
+ var render = function render() {
631
+ var _vm = this,
632
+ _c = _vm._self._c;
633
+ return _c('div', {
634
+ ref: "wfEditor",
635
+ staticStyle: {
636
+ "position": "relative",
637
+ "height": "100%"
638
+ }
639
+ }, [_c('div', {
640
+ staticClass: "main"
641
+ }, [_c('section', [_c('wf-history-canvas', {
642
+ staticClass: "canvas",
643
+ attrs: {
644
+ "onselectstart": "return false",
645
+ "process": _vm.process,
646
+ "histories": _vm.histories,
647
+ "current-tasks": _vm.currentTasks,
648
+ "all-process-i18n": _vm.allProcessI18n,
649
+ "show-history": true
650
+ },
651
+ nativeOn: {
652
+ "contextmenu": function contextmenu($event) {
653
+ $event.preventDefault();
654
+ return _vm.showContextMenu.apply(null, arguments);
655
+ }
656
+ }
657
+ })], 1)])]);
658
+ };
659
+ var staticRenderFns = [];
660
+
661
+ // CONCATENATED MODULE: ./packages/workflow-editor/src/workflow-history.vue?vue&type=template&id=422096c3&scoped=true&
662
+
663
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es7.object.get-own-property-descriptors.js
664
+ var es7_object_get_own_property_descriptors = __webpack_require__("8e6e");
665
+
666
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/web.dom.iterable.js
667
+ var web_dom_iterable = __webpack_require__("ac6a");
668
+
669
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es6.array.iterator.js
670
+ var es6_array_iterator = __webpack_require__("cadf");
671
+
672
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es6.object.keys.js
673
+ var es6_object_keys = __webpack_require__("456d");
674
+
675
+ // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
676
+ var defineProperty = __webpack_require__("ade3");
677
+
678
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es6.number.constructor.js
679
+ var es6_number_constructor = __webpack_require__("c5f6");
680
+
681
+ // EXTERNAL MODULE: ./packages/workflow-editor/src/assets/wf-editor-icons.js
682
+ var wf_editor_icons = __webpack_require__("67f7");
683
+
684
+ // EXTERNAL MODULE: external "Vuex"
685
+ var external_Vuex_ = __webpack_require__("5880");
686
+
687
+ // EXTERNAL MODULE: ./packages/workflow-editor/src/util.js
688
+ var util = __webpack_require__("8a10");
689
+
690
+ // EXTERNAL MODULE: ./packages/workflow-editor/src/main/wf-history-canvas.vue + 9 modules
691
+ var wf_history_canvas = __webpack_require__("d2b4");
692
+
693
+ // EXTERNAL MODULE: ./node_modules/xml-js/lib/index.js
694
+ var lib = __webpack_require__("c51a");
695
+ var lib_default = /*#__PURE__*/__webpack_require__.n(lib);
696
+
697
+ // EXTERNAL MODULE: ./packages/workflow-editor/src/api.js
698
+ var api = __webpack_require__("019f");
699
+
700
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/workflow-editor/src/workflow-history.vue?vue&type=script&lang=js&
701
+
702
+
703
+
704
+
705
+
706
+
707
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
708
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
709
+
710
+
711
+
712
+
713
+
714
+
715
+ /* harmony default export */ var workflow_historyvue_type_script_lang_js_ = ({
716
+ name: 'WorkflowHistory',
717
+ components: {
718
+ WfHistoryCanvas: wf_history_canvas["a" /* default */]
719
+ },
720
+ props: {
721
+ // 实例id
722
+ id: {
723
+ type: Number,
724
+ default: null
725
+ }
726
+ },
727
+ data: function data() {
728
+ return {
729
+ process: null,
730
+ histories: [],
731
+ currentTasks: [],
732
+ allProcessI18n: null
733
+ };
734
+ },
735
+ computed: _objectSpread(_objectSpread({}, Object(external_Vuex_["mapGetters"])('wfEditor', ['componentToDraw', 'taches', 'transitions', 'contextMenuVisible'])), Object(external_Vuex_["mapGetters"])(['sidebar'])),
736
+ watch: {},
737
+ created: function created() {
738
+ this.showHistory();
739
+ },
740
+ mounted: function mounted() {},
741
+ methods: _objectSpread(_objectSpread(_objectSpread({}, api["a" /* default */]), Object(external_Vuex_["mapMutations"])('wfEditor', ['setComponentToDraw', 'clearCanvas', 'setContextMenuVisible', 'setProcessI18n'])), {}, {
742
+ showHistory: function showHistory() {
743
+ var _this = this;
744
+ // 打开或新建流程图时先清空画布,开发过程中代码热更新的时候可以避免节点重复
745
+ this.clearCanvas();
746
+ if (this.id) {
747
+ this.$http.get(this.baseAPI + '/wf-editor/i18n-settings/get-bundle-info?workflowId=' + this.id).then(function (processI18n) {
748
+ _this.allProcessI18n = processI18n;
749
+ var url = _this.baseAPI + '/wf-editor/instance-histories/' + _this.id;
750
+ _this.$http.get(url).then(function (data) {
751
+ _this.initProcessByXml(data.xml);
752
+ var mainBundleCode;
753
+ if (data.histories && data.histories.length > 0) {
754
+ mainBundleCode = data.histories[0].bundleCode;
755
+ }
756
+ if (!mainBundleCode && data.currentTasks && data.currentTasks.length > 0) {
757
+ mainBundleCode = data.currentTasks[0].bundleCode;
758
+ }
759
+ if (mainBundleCode) {
760
+ _this.setProcessI18n(processI18n[mainBundleCode]);
761
+ }
762
+ _this.histories = data.histories;
763
+ _this.currentTasks = data.currentTasks;
764
+ });
765
+ });
766
+ } else {
767
+ this.process = util["m" /* processTemplate */].newProcess();
768
+ Object(util["l" /* initializeProcessData */])(this.process);
769
+ }
770
+ },
771
+ showContextMenu: function showContextMenu(event) {},
772
+ initProcessByXml: function initProcessByXml(xml) {
773
+ var options = {
774
+ nativeType: true,
775
+ attributesKey: 'attr',
776
+ compact: true,
777
+ ignoreComment: true,
778
+ spaces: 4
779
+ };
780
+ var processObj = lib_default.a.xml2js(xml, options);
781
+ Object(util["n" /* removeTextProperty */])(processObj.process);
782
+ this.process = processObj.process;
783
+ Object(util["l" /* initializeProcessData */])(this.process);
784
+ }
785
+ })
786
+ });
787
+ // CONCATENATED MODULE: ./packages/workflow-editor/src/workflow-history.vue?vue&type=script&lang=js&
788
+ /* harmony default export */ var src_workflow_historyvue_type_script_lang_js_ = (workflow_historyvue_type_script_lang_js_);
789
+ // EXTERNAL MODULE: ./packages/workflow-editor/src/workflow-history.vue?vue&type=style&index=0&id=422096c3&prod&lang=scss&scoped=true&
790
+ var workflow_historyvue_type_style_index_0_id_422096c3_prod_lang_scss_scoped_true_ = __webpack_require__("fd8e");
791
+
792
+ // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
793
+ var componentNormalizer = __webpack_require__("2877");
794
+
795
+ // CONCATENATED MODULE: ./packages/workflow-editor/src/workflow-history.vue
796
+
797
+
798
+
799
+
800
+
801
+
802
+ /* normalize component */
803
+
804
+ var component = Object(componentNormalizer["a" /* default */])(
805
+ src_workflow_historyvue_type_script_lang_js_,
806
+ render,
807
+ staticRenderFns,
808
+ false,
809
+ null,
810
+ "422096c3",
811
+ null
812
+
813
+ )
814
+
815
+ /* harmony default export */ var workflow_history = __webpack_exports__["a"] = (component.exports);
816
+
817
+ /***/ }),
818
+
819
+ /***/ "d918":
820
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
821
+
822
+ "use strict";
823
+ /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_workflow_editor_vue_vue_type_style_index_0_id_37937af4_prod_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("2466");
824
+ /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_workflow_editor_vue_vue_type_style_index_0_id_37937af4_prod_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_workflow_editor_vue_vue_type_style_index_0_id_37937af4_prod_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0__);
825
+ /* unused harmony reexport * */
826
+
827
+
828
+ /***/ }),
829
+
830
+ /***/ "fa13":
831
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
832
+
833
+ "use strict";
834
+
835
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"813ecc90-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/workflow-editor/src/workflow-editor.vue?vue&type=template&id=37937af4&scoped=true&
836
+ var render = function render() {
837
+ var _vm = this,
838
+ _c = _vm._self._c;
839
+ return _c('div', {
840
+ ref: "wfEditor",
841
+ staticStyle: {
842
+ "position": "relative",
843
+ "height": "100%"
844
+ },
845
+ on: {
846
+ "mousedown": function mousedown($event) {
847
+ return _vm.setContextMenuVisible(false);
848
+ },
849
+ "mousewheel": function mousewheel($event) {
850
+ return _vm.setContextMenuVisible(false);
851
+ }
852
+ }
853
+ }, [_c('el-row', {
854
+ staticClass: "button-area"
855
+ }, [!_vm.readonly ? _c('el-button', {
856
+ attrs: {
857
+ "type": "primary",
858
+ "size": "small"
859
+ },
860
+ on: {
861
+ "click": _vm.saveXml
862
+ }
863
+ }, [_vm._v("\n " + _vm._s(_vm.$t('workflowEditorPublicModel.save')) + "\n ")]) : _vm._e(), !_vm.readonly ? _c('el-button', {
864
+ directives: [{
865
+ name: "permission",
866
+ rawName: "v-permission",
867
+ value: 'wf.workflowDefinition.adminSave',
868
+ expression: "'wf.workflowDefinition.adminSave'"
869
+ }],
870
+ attrs: {
871
+ "type": "primary",
872
+ "size": "small"
873
+ },
874
+ on: {
875
+ "click": _vm.adminSave
876
+ }
877
+ }, [_vm._v("\n " + _vm._s(_vm.$t('workflowEditorPublicModel.adminSave')) + "\n ")]) : _vm._e(), _c('el-button', {
878
+ attrs: {
879
+ "type": "primary",
880
+ "size": "small"
881
+ },
882
+ on: {
883
+ "click": _vm.exportProcessFromClient
884
+ }
885
+ }, [_vm._v("\n " + _vm._s(_vm.$t('workflowEditorPublicModel.export')) + "\n ")]), !_vm.readonly ? _c('el-button', {
886
+ attrs: {
887
+ "size": "small",
888
+ "type": "primary"
889
+ },
890
+ on: {
891
+ "click": _vm.selectProcessFile
892
+ }
893
+ }, [_vm._v("\n " + _vm._s(_vm.$t('workflowEditorPublicModel.open')) + "\n "), _c('input', {
894
+ ref: "processFile",
895
+ staticStyle: {
896
+ "display": "none"
897
+ },
898
+ attrs: {
899
+ "type": "file",
900
+ "name": "processFile",
901
+ "accept": ".xml"
902
+ },
903
+ on: {
904
+ "change": _vm.openXmlFromClient
905
+ }
906
+ })]) : _vm._e(), _c('el-button', {
907
+ attrs: {
908
+ "type": "primary",
909
+ "size": "small"
910
+ },
911
+ on: {
912
+ "click": function click($event) {
913
+ return _vm.$emit('back');
914
+ }
915
+ }
916
+ }, [_vm._v("\n " + _vm._s(_vm.$t('workflowEditorPublicModel.return')) + "\n ")])], 1), _c('div', {
917
+ staticClass: "main",
918
+ on: {
919
+ "mousedown": _vm.startDrag,
920
+ "mousemove": _vm.drag,
921
+ "mouseup": _vm.endDrag,
922
+ "mouseleave": _vm.clearStatus
923
+ }
924
+ }, [!_vm.readonly ? _c('toolbox', {
925
+ staticClass: "toolbox",
926
+ attrs: {
927
+ "onselectstart": "return false",
928
+ "oncontextmenu": "return false"
929
+ }
930
+ }) : _vm._e(), _c('section', [_c('el-tabs', {
931
+ staticClass: "tabs",
932
+ attrs: {
933
+ "type": "border-card"
934
+ },
935
+ model: {
936
+ value: _vm.activeTab,
937
+ callback: function callback($$v) {
938
+ _vm.activeTab = $$v;
939
+ },
940
+ expression: "activeTab"
941
+ }
942
+ }, [_c('el-tab-pane', {
943
+ staticClass: "tab-pane",
944
+ attrs: {
945
+ "label": _vm.$t('workflowEditorPublicModel.flowChart'),
946
+ "name": "canvas"
947
+ }
948
+ }, [_c('workflow-canvas', {
949
+ staticClass: "canvas",
950
+ attrs: {
951
+ "onselectstart": "return false",
952
+ "process": _vm.process
953
+ },
954
+ nativeOn: {
955
+ "mouseup": function mouseup($event) {
956
+ return _vm.addTache.apply(null, arguments);
957
+ },
958
+ "contextmenu": function contextmenu($event) {
959
+ $event.preventDefault();
960
+ return _vm.showContextMenu.apply(null, arguments);
961
+ }
962
+ }
963
+ })], 1), _c('el-tab-pane', {
964
+ staticClass: "tab-pane",
965
+ attrs: {
966
+ "label": "XML",
967
+ "name": "xml"
968
+ }
969
+ }, [_vm.activeTab === 'xml' ? _c('pre', {
970
+ staticClass: "xml line-numbers"
971
+ }, [_c('code', {
972
+ ref: "xml",
973
+ staticClass: "language-xml"
974
+ }, [_vm._v(_vm._s(_vm.xml))])]) : _vm._e()])], 1)], 1)], 1), _vm.componentToDraw ? _c('icon-svg', {
975
+ staticClass: "component-icon",
976
+ style: {
977
+ height: _vm.componentInfo.height,
978
+ width: _vm.componentInfo.width,
979
+ color: _vm.componentInfo.color,
980
+ left: _vm.currentPosition.x + 'px',
981
+ top: _vm.currentPosition.y + 'px'
982
+ },
983
+ attrs: {
984
+ "icon": _vm.componentInfo.icon
985
+ }
986
+ }) : _vm._e(), _vm.contextMenuVisible ? _c('context-menu', {
987
+ style: {
988
+ position: 'absolute',
989
+ left: _vm.contextMenuPosition.x + 'px',
990
+ top: _vm.contextMenuPosition.y + 'px'
991
+ }
992
+ }) : _vm._e(), _vm.isAdminSave ? _c('admin-save-dialog', {
993
+ on: {
994
+ "close": function close($event) {
995
+ _vm.isAdminSave = false;
996
+ },
997
+ "update": _vm.updateWfVersion,
998
+ "add": _vm.addWfVersion
999
+ }
1000
+ }) : _vm._e()], 1);
1001
+ };
1002
+ var staticRenderFns = [];
1003
+
1004
+ // CONCATENATED MODULE: ./packages/workflow-editor/src/workflow-editor.vue?vue&type=template&id=37937af4&scoped=true&
1005
+
1006
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es7.object.get-own-property-descriptors.js
1007
+ var es7_object_get_own_property_descriptors = __webpack_require__("8e6e");
1008
+
1009
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es6.array.iterator.js
1010
+ var es6_array_iterator = __webpack_require__("cadf");
1011
+
1012
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es6.object.keys.js
1013
+ var es6_object_keys = __webpack_require__("456d");
1014
+
1015
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es6.function.name.js
1016
+ var es6_function_name = __webpack_require__("7f7f");
1017
+
1018
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es6.promise.js
1019
+ var es6_promise = __webpack_require__("551c");
1020
+
1021
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/web.dom.iterable.js
1022
+ var web_dom_iterable = __webpack_require__("ac6a");
1023
+
1024
+ // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
1025
+ var defineProperty = __webpack_require__("ade3");
1026
+
1027
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es6.number.constructor.js
1028
+ var es6_number_constructor = __webpack_require__("c5f6");
1029
+
1030
+ // EXTERNAL MODULE: ./packages/workflow-editor/src/assets/wf-editor-icons.js
1031
+ var wf_editor_icons = __webpack_require__("67f7");
1032
+
1033
+ // EXTERNAL MODULE: external "Vuex"
1034
+ var external_Vuex_ = __webpack_require__("5880");
1035
+
1036
+ // EXTERNAL MODULE: ./packages/workflow-editor/src/util.js
1037
+ var util = __webpack_require__("8a10");
1038
+
1039
+ // EXTERNAL MODULE: ./packages/workflow-editor/src/main/toolbox.vue + 4 modules
1040
+ var toolbox = __webpack_require__("1842");
1041
+
1042
+ // EXTERNAL MODULE: ./packages/workflow-editor/src/main/canvas.vue + 9 modules
1043
+ var canvas = __webpack_require__("06a5");
1044
+
1045
+ // EXTERNAL MODULE: ./packages/workflow-editor/src/main/icon-svg.vue + 4 modules
1046
+ var icon_svg = __webpack_require__("e4fd");
1047
+
1048
+ // EXTERNAL MODULE: ./packages/workflow-editor/src/main/context-menu.vue + 4 modules
1049
+ var context_menu = __webpack_require__("ff16");
1050
+
1051
+ // EXTERNAL MODULE: ./node_modules/xml-js/lib/index.js
1052
+ var lib = __webpack_require__("c51a");
1053
+ var lib_default = /*#__PURE__*/__webpack_require__.n(lib);
1054
+
1055
+ // EXTERNAL MODULE: ./packages/workflow-editor/src/process-service.js
1056
+ var process_service = __webpack_require__("1e79");
1057
+
1058
+ // EXTERNAL MODULE: ./node_modules/file-saver/dist/FileSaver.min.js
1059
+ var FileSaver_min = __webpack_require__("21a6");
1060
+ var FileSaver_min_default = /*#__PURE__*/__webpack_require__.n(FileSaver_min);
1061
+
1062
+ // EXTERNAL MODULE: ./node_modules/prismjs/components/prism-core.js
1063
+ var prism_core = __webpack_require__("8c7a");
1064
+ var prism_core_default = /*#__PURE__*/__webpack_require__.n(prism_core);
1065
+
1066
+ // EXTERNAL MODULE: ./node_modules/prismjs/components/prism-clike.js
1067
+ var prism_clike = __webpack_require__("cb55");
1068
+
1069
+ // EXTERNAL MODULE: ./node_modules/prismjs/components/prism-javascript.js
1070
+ var prism_javascript = __webpack_require__("416b");
1071
+
1072
+ // EXTERNAL MODULE: ./node_modules/prismjs/components/prism-css.js
1073
+ var prism_css = __webpack_require__("6605");
1074
+
1075
+ // EXTERNAL MODULE: ./node_modules/prismjs/components/prism-markup.js
1076
+ var prism_markup = __webpack_require__("6cf3");
1077
+
1078
+ // EXTERNAL MODULE: ./node_modules/prismjs/plugins/line-numbers/prism-line-numbers.css
1079
+ var prism_line_numbers = __webpack_require__("4e93");
1080
+
1081
+ // EXTERNAL MODULE: ./node_modules/prismjs/plugins/line-numbers/prism-line-numbers.js
1082
+ var line_numbers_prism_line_numbers = __webpack_require__("c0f1");
1083
+
1084
+ // EXTERNAL MODULE: ./node_modules/prismjs/themes/prism-coy.css
1085
+ var prism_coy = __webpack_require__("6b2c");
1086
+
1087
+ // EXTERNAL MODULE: ./packages/workflow-editor/src/main/admin-save-dialog.vue + 4 modules
1088
+ var admin_save_dialog = __webpack_require__("98e7");
1089
+
1090
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/workflow-editor/src/workflow-editor.vue?vue&type=script&lang=js&
1091
+
1092
+
1093
+
1094
+
1095
+
1096
+
1097
+
1098
+
1099
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1100
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1101
+
1102
+
1103
+
1104
+
1105
+
1106
+
1107
+
1108
+
1109
+
1110
+
1111
+
1112
+
1113
+
1114
+
1115
+
1116
+
1117
+
1118
+
1119
+
1120
+ /* harmony default export */ var workflow_editorvue_type_script_lang_js_ = ({
1121
+ name: 'WorkflowEditor',
1122
+ components: {
1123
+ WorkflowCanvas: canvas["a" /* default */],
1124
+ Toolbox: toolbox["a" /* default */],
1125
+ IconSvg: icon_svg["a" /* default */],
1126
+ ContextMenu: context_menu["a" /* default */],
1127
+ AdminSaveDialog: admin_save_dialog["a" /* default */]
1128
+ },
1129
+ props: {
1130
+ // 流程编码
1131
+ code: {
1132
+ type: String,
1133
+ default: null
1134
+ },
1135
+ // 流程版本
1136
+ version: {
1137
+ type: Number,
1138
+ default: null
1139
+ },
1140
+ // 流程id
1141
+ id: {
1142
+ type: Number,
1143
+ default: null
1144
+ },
1145
+ readonly: {
1146
+ type: Boolean,
1147
+ default: false
1148
+ }
1149
+ },
1150
+ data: function data() {
1151
+ return {
1152
+ activeTab: 'canvas',
1153
+ count: 1,
1154
+ currentPosition: {
1155
+ x: 0,
1156
+ y: 0
1157
+ },
1158
+ process: null,
1159
+ definitionId: null,
1160
+ xml: '',
1161
+ contextMenuPosition: null,
1162
+ isAdminSave: false // 是否点击了管理员保存按钮
1163
+ };
1164
+ },
1165
+
1166
+ computed: _objectSpread(_objectSpread(_objectSpread({}, Object(external_Vuex_["mapGetters"])('wfEditor', ['componentToDraw', 'taches', 'transitions', 'contextMenuVisible'])), Object(external_Vuex_["mapGetters"])(['sidebar'])), {}, {
1167
+ componentInfo: function componentInfo() {
1168
+ return Object(util["e" /* getComponentInfo */])(this.componentToDraw);
1169
+ }
1170
+ }),
1171
+ watch: {
1172
+ activeTab: function activeTab(name) {
1173
+ if (name === 'xml') {
1174
+ this.xml = this.getProcessXml();
1175
+ this.$nextTick(function () {
1176
+ prism_core_default.a.highlightElement(this.$refs.xml);
1177
+ });
1178
+ }
1179
+ }
1180
+ },
1181
+ created: function created() {
1182
+ var _this = this;
1183
+ // 打开或新建流程图时先清空画布,开发过程中代码热更新的时候可以避免节点重复
1184
+ this.clearCanvas();
1185
+ if (this.id) {
1186
+ this.definitionId = this.id;
1187
+ }
1188
+ console.log('canvas-created=', this.code, this.id);
1189
+ if (this.code || this.id) {
1190
+ var url = this.baseAPI + '/wf-editor/open-xmls/with-definitions';
1191
+ url = this.packageUrlParam(url);
1192
+ this.$http.get(url).then(function (xml) {
1193
+ _this.initProcessByXml(xml);
1194
+ });
1195
+ } else {
1196
+ this.process = util["m" /* processTemplate */].newProcess();
1197
+ Object(util["l" /* initializeProcessData */])(this.process);
1198
+ }
1199
+ },
1200
+ mounted: function mounted() {},
1201
+ methods: _objectSpread(_objectSpread({}, Object(external_Vuex_["mapMutations"])('wfEditor', ['setComponentToDraw', 'clearCanvas', 'setContextMenuVisible', 'setSystemCode', 'setProcessCode'])), {}, {
1202
+ showContextMenu: function showContextMenu(event) {
1203
+ console.log(event);
1204
+ this.setContextMenuVisible(true);
1205
+ // 得到元素在页面上的位置信息,用来计算鼠标位置的偏移量
1206
+ var offset = this.$refs.wfEditor.getBoundingClientRect();
1207
+ this.contextMenuPosition = {
1208
+ x: event.clientX - offset.x,
1209
+ y: event.clientY - offset.y
1210
+ };
1211
+ },
1212
+ initProcessByXml: function initProcessByXml(xml) {
1213
+ var options = {
1214
+ nativeType: true,
1215
+ attributesKey: 'attr',
1216
+ compact: true,
1217
+ ignoreComment: true,
1218
+ spaces: 4
1219
+ };
1220
+ var processObj = lib_default.a.xml2js(xml, options);
1221
+ Object(util["n" /* removeTextProperty */])(processObj.process);
1222
+ this.process = processObj.process;
1223
+ if (this.process && this.process.properties && this.process.properties.basicProperties) {
1224
+ this.setSystemCode(this.process.properties.basicProperties.systemCode);
1225
+ }
1226
+ if (this.process && this.process.attr) {
1227
+ this.setProcessCode(this.process.attr.code);
1228
+ }
1229
+ // 得到表单字段放到vuex
1230
+ this.fetchFormFields();
1231
+ Object(util["l" /* initializeProcessData */])(this.process);
1232
+ this.count = this.getMaxCount() + 1;
1233
+ },
1234
+ fetchFormFields: function fetchFormFields() {
1235
+ var processProperties = this.process.properties.basicProperties;
1236
+ var formCode = processProperties.formCode;
1237
+ var formVersion = processProperties.formVersion;
1238
+ if (formCode && formCode !== '' && formVersion) {
1239
+ // 取出formFields放到vuex中
1240
+ process_service["a" /* default */].fetchFormFields(processProperties.formCode, processProperties.formVersion);
1241
+ }
1242
+ },
1243
+ packageUrlParam: function packageUrlParam(url) {
1244
+ if (this.id) {
1245
+ url = url + '?id=' + this.id;
1246
+ } else if (this.code) {
1247
+ url = url + '?code=' + this.code + '&version=' + this.version;
1248
+ }
1249
+ return url;
1250
+ },
1251
+ // 获得流程定义xml
1252
+ getProcessXml: function getProcessXml() {
1253
+ var process = {
1254
+ start: [],
1255
+ humanTask: [],
1256
+ decision: [],
1257
+ transition: [],
1258
+ fork: [],
1259
+ join: [],
1260
+ subprocess: [],
1261
+ humanDecision: [],
1262
+ copyTask: [],
1263
+ end: []
1264
+ };
1265
+ process.attr = this.process.attr;
1266
+ process.properties = this.process.properties;
1267
+ this.taches.map(function (tache) {
1268
+ var type = tache.type;
1269
+ // type的首字母小写形式就是process中各个数组的名字,ref才是真正的环节信息
1270
+ process[type.charAt(0).toLowerCase() + type.substring(1)].push(tache.ref);
1271
+ // 补充完整图形位置信息
1272
+ tache.ref.g = {
1273
+ x: tache.x,
1274
+ y: tache.y,
1275
+ width: tache.width,
1276
+ height: tache.height
1277
+ };
1278
+ });
1279
+ this.transitions.map(function (transition) {
1280
+ // ref才是真正的流向信息
1281
+ process.transition.push(transition.ref);
1282
+ // 补充完整图形位置信息
1283
+ transition.ref.g = {
1284
+ fromJoint: transition.startJoint.position,
1285
+ toJoint: transition.endJoint.position,
1286
+ coordinate: '',
1287
+ lineType: transition.lineInfo.type
1288
+ };
1289
+ if (transition.lineInfo.type === 'CurveLine' && transition.lineInfo.controlPoint) {
1290
+ transition.ref.g.coordinate = transition.lineInfo.controlPoint.x + ',' + transition.lineInfo.controlPoint.y;
1291
+ } else if (transition.lineInfo.type === 'BrokenLine' && transition.lineInfo.controlPoint) {
1292
+ var coordinate = '';
1293
+ transition.lineInfo.controlPoint.forEach(function (point) {
1294
+ coordinate += point.x + ',' + point.y + ';';
1295
+ });
1296
+ transition.ref.g.coordinate = coordinate;
1297
+ }
1298
+ });
1299
+ var options = {
1300
+ attributesKey: 'attr',
1301
+ compact: true,
1302
+ ignoreComment: true,
1303
+ spaces: 4
1304
+ };
1305
+ var result = lib_default.a.json2xml({
1306
+ process: process
1307
+ }, options);
1308
+ result = '<?xml version="1.0" encoding="utf-8"?>\n' + result;
1309
+ return result;
1310
+ },
1311
+ // 保存xml
1312
+ saveXml: function saveXml() {
1313
+ var _this2 = this;
1314
+ var xml = this.getProcessXml();
1315
+ // console.log(xml)
1316
+ // 保存流程定义xml
1317
+ if (this.code || this.id || this.definitionId) {
1318
+ // 表示修改
1319
+ this.saveWf(xml, this.baseAPI + '/wf-editor/workflow-definitions/updates').then(function () {
1320
+ _this2.$alert(_this2.$t('workflowEditorMessage.updateSuccessful'));
1321
+ });
1322
+ } else {
1323
+ // 表示新建
1324
+ var param = {
1325
+ xml: xml
1326
+ };
1327
+ this.$http.post(this.baseAPI + '/wf-editor/workflow-definitions', param).then(function (definition) {
1328
+ _this2.definitionId = definition.id;
1329
+ _this2.$alert(_this2.$t('workflowEditorMessage.savedSuccessfully'));
1330
+ // console.log('新建成功' + this.definitionId)
1331
+ });
1332
+ }
1333
+ },
1334
+ saveWf: function saveWf(xml, url, message) {
1335
+ var _this3 = this;
1336
+ return new Promise(function (resolve, reject) {
1337
+ var param = _this3.packageSaveXmlParam(xml);
1338
+ _this3.$http.post(url, param).then(function (definition) {
1339
+ _this3.definitionId = definition.id;
1340
+ // console.log('更新成功' + this.definitionId)
1341
+ resolve();
1342
+ });
1343
+ });
1344
+ },
1345
+ packageSaveXmlParam: function packageSaveXmlParam(xml) {
1346
+ var param = {
1347
+ xml: xml
1348
+ };
1349
+ if (this.definitionId) {
1350
+ // 表示已保存过,新流程定义的id
1351
+ param.id = this.definitionId;
1352
+ } else {
1353
+ if (this.id) {
1354
+ param.id = this.id;
1355
+ } else if (this.code) {
1356
+ param.code = this.code;
1357
+ param.version = this.version;
1358
+ }
1359
+ }
1360
+ return param;
1361
+ },
1362
+ adminSave: function adminSave() {
1363
+ var _this4 = this;
1364
+ var xml = this.getProcessXml();
1365
+ // console.log(xml)
1366
+ // 保存流程定义xml
1367
+ if (this.code || this.id || this.definitionId) {
1368
+ // 表示修改
1369
+ var url = this.baseAPI + '/wf-editor/workflow-definitions/states';
1370
+ var param = {};
1371
+ if (this.definitionId) {
1372
+ // 表示已保存过,新流程定义的id
1373
+ param.id = this.definitionId;
1374
+ } else {
1375
+ if (this.id) {
1376
+ param.id = this.id;
1377
+ } else if (this.code) {
1378
+ param.code = this.code;
1379
+ param.version = this.version;
1380
+ }
1381
+ }
1382
+ this.$http.post(url, param).then(function (state) {
1383
+ if (state === 'DRAFT') {
1384
+ // 如果是草稿状态直接保存
1385
+ _this4.saveWf(xml, _this4.baseAPI + '/wf-editor/workflow-definitions/updates').then(function () {
1386
+ _this4.$alert(_this4.$t('workflowEditorMessage.updateSuccessful'));
1387
+ });
1388
+ } else {
1389
+ // 如果是禁用或启用状态,让用户选择是增加版本还是更新版本
1390
+ _this4.isAdminSave = true;
1391
+ }
1392
+ });
1393
+ } else {
1394
+ // 表示新建
1395
+ var _param = {
1396
+ xml: xml
1397
+ };
1398
+ this.$http.post(this.baseAPI + '/wf-editor/workflow-definitions', _param).then(function (definition) {
1399
+ _this4.definitionId = definition.id;
1400
+ _this4.$alert(_this4.$t('workflowEditorMessage.savedSuccessfully'));
1401
+ // console.log('新建成功' + this.definitionId)
1402
+ });
1403
+ }
1404
+ },
1405
+ updateWfVersion: function updateWfVersion() {
1406
+ var _this5 = this;
1407
+ var xml = this.getProcessXml();
1408
+ this.saveWf(xml, this.baseAPI + '/wf-editor/workflow-definitions/update-version').then(function () {
1409
+ _this5.isAdminSave = false;
1410
+ _this5.$alert(_this5.$t('workflowEditorMessage.updateVersionSuccessful'));
1411
+ });
1412
+ },
1413
+ addWfVersion: function addWfVersion() {
1414
+ var _this6 = this;
1415
+ var xml = this.getProcessXml();
1416
+ this.saveWf(xml, this.baseAPI + '/wf-editor/workflow-definitions/updates').then(function () {
1417
+ _this6.isAdminSave = false;
1418
+ _this6.$alert(_this6.$t('workflowEditorMessage.addVersionSuccessful'));
1419
+ });
1420
+ },
1421
+ exportProcessFromClient: function exportProcessFromClient() {
1422
+ var blob = new Blob([this.getProcessXml()], {
1423
+ type: 'text/xml;charset=utf-8'
1424
+ });
1425
+ FileSaver_min_default.a.saveAs(blob, this.process.attr.name + '.xml');
1426
+ },
1427
+ // 导出xml
1428
+ exportProcess: function exportProcess() {
1429
+ var _this7 = this;
1430
+ var xml = this.getProcessXml();
1431
+ this.$http({
1432
+ method: 'post',
1433
+ url: this.baseAPI + '/wf-editor/save-as-xmls',
1434
+ data: {
1435
+ xmlContent: xml
1436
+ }
1437
+ }).then(function (response) {
1438
+ _this7.download(response);
1439
+ console.log(_this7.$t('workflowEditorMessage.exportSucceeded'));
1440
+ });
1441
+ },
1442
+ // 下载文件
1443
+ download: function download(data) {
1444
+ if (!data) {
1445
+ return;
1446
+ }
1447
+ var url = window.URL.createObjectURL(new Blob([data]));
1448
+ var link = document.createElement('a');
1449
+ link.style.display = 'none';
1450
+ link.href = url;
1451
+ link.setAttribute('download', 'myXml.xml');
1452
+ document.body.appendChild(link);
1453
+ link.click();
1454
+ },
1455
+ // 打开xml文件成功后
1456
+ uploadSuccess: function uploadSuccess(response, file, fileList) {
1457
+ var xml = response;
1458
+ // console.log('xml=', xml)
1459
+ // 打开或新建流程图时先清空画布,开发过程中代码热更新的时候可以避免节点重复
1460
+ this.clearCanvas();
1461
+ this.initProcessByXml(xml);
1462
+ this.$refs.upload.clearFiles();
1463
+ },
1464
+ getCurrentPosition: function getCurrentPosition(event) {
1465
+ if (this.componentToDraw) {
1466
+ var offset = this.$refs.wfEditor.getBoundingClientRect();
1467
+ this.currentPosition = {
1468
+ x: event.clientX - offset.x - 22,
1469
+ y: event.clientY - offset.y - 22
1470
+ };
1471
+ }
1472
+ },
1473
+ startDrag: function startDrag(event) {
1474
+ this.getCurrentPosition(event);
1475
+ },
1476
+ drag: function drag(event) {
1477
+ this.getCurrentPosition(event);
1478
+ },
1479
+ endDrag: function endDrag() {
1480
+ if (this.componentToDraw) {
1481
+ this.setComponentToDraw('');
1482
+ }
1483
+ },
1484
+ addTache: function addTache(event) {
1485
+ if (this.componentToDraw) {
1486
+ var positionInSVG = Object(util["i" /* getMousePosition */])(event);
1487
+ var ref = util["m" /* processTemplate */]['new' + this.componentToDraw]();
1488
+ // 组件类型转换为首字母小写形式
1489
+ ref.attr.id = this.componentToDraw.charAt(0).toLowerCase() + this.componentToDraw.substring(1) + '_' + this.count;
1490
+ var tache = {
1491
+ // 默认id是组件类型加上下划线和数字序号,每次打开流程图的时候都需要动态计算最大的序号,然后加1作为count的的初始值
1492
+ id: ref.attr.id,
1493
+ name: ref.attr.name,
1494
+ x: positionInSVG.x - this.componentInfo.width / 2,
1495
+ y: positionInSVG.y - this.componentInfo.height / 2,
1496
+ width: this.componentInfo.width,
1497
+ height: this.componentInfo.height,
1498
+ type: this.componentToDraw,
1499
+ isSelected: false
1500
+ };
1501
+ tache.ref = ref;
1502
+ this.taches.push(tache);
1503
+ this.count++;
1504
+ }
1505
+ },
1506
+ clearStatus: function clearStatus() {
1507
+ if (this.componentToDraw) {
1508
+ this.setComponentToDraw('');
1509
+ }
1510
+ },
1511
+ getMaxCount: function getMaxCount() {
1512
+ var max = 0;
1513
+ this.taches.map(function (item) {
1514
+ // 自动生成的id以下划线加数字编号结尾
1515
+ var index = item.id.substring(item.id.lastIndexOf('_') + 1);
1516
+ index = +index;
1517
+ if (max < index) {
1518
+ max = index;
1519
+ }
1520
+ });
1521
+ return max;
1522
+ },
1523
+ selectProcessFile: function selectProcessFile() {
1524
+ this.$refs.processFile.click();
1525
+ },
1526
+ openXmlFromClient: function openXmlFromClient() {
1527
+ if (this.$refs.processFile.value === '') return;
1528
+ var file = this.$refs.processFile.files[0];
1529
+ var reader = new FileReader();
1530
+ // 本地直接读取文件
1531
+ reader.readAsText(file);
1532
+ var vm = this;
1533
+ reader.onload = function () {
1534
+ // 打开或新建流程图时先清空画布,开发过程中代码热更新的时候可以避免节点重复
1535
+ vm.clearCanvas();
1536
+ vm.initProcessByXml(reader.result);
1537
+ vm.$refs.processFile.value = '';
1538
+ };
1539
+ }
1540
+ })
1541
+ });
1542
+ // CONCATENATED MODULE: ./packages/workflow-editor/src/workflow-editor.vue?vue&type=script&lang=js&
1543
+ /* harmony default export */ var src_workflow_editorvue_type_script_lang_js_ = (workflow_editorvue_type_script_lang_js_);
1544
+ // EXTERNAL MODULE: ./packages/workflow-editor/src/workflow-editor.vue?vue&type=style&index=0&id=37937af4&prod&lang=scss&scoped=true&
1545
+ var workflow_editorvue_type_style_index_0_id_37937af4_prod_lang_scss_scoped_true_ = __webpack_require__("d918");
1546
+
1547
+ // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
1548
+ var componentNormalizer = __webpack_require__("2877");
1549
+
1550
+ // CONCATENATED MODULE: ./packages/workflow-editor/src/workflow-editor.vue
1551
+
1552
+
1553
+
1554
+
1555
+
1556
+
1557
+ /* normalize component */
1558
+
1559
+ var component = Object(componentNormalizer["a" /* default */])(
1560
+ src_workflow_editorvue_type_script_lang_js_,
1561
+ render,
1562
+ staticRenderFns,
1563
+ false,
1564
+ null,
1565
+ "37937af4",
1566
+ null
1567
+
1568
+ )
1569
+
1570
+ /* harmony default export */ var workflow_editor = __webpack_exports__["a"] = (component.exports);
1571
+
1572
+ /***/ }),
1573
+
1574
+ /***/ "fd8e":
1575
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
1576
+
1577
+ "use strict";
1578
+ /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_workflow_history_vue_vue_type_style_index_0_id_422096c3_prod_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("9eb1");
1579
+ /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_workflow_history_vue_vue_type_style_index_0_id_422096c3_prod_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_workflow_history_vue_vue_type_style_index_0_id_422096c3_prod_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0__);
1580
+ /* unused harmony reexport * */
1581
+
1582
+
1583
+ /***/ })
1584
+
1585
+ }]);