workflow-editor 0.0.81-up → 0.0.81-up-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 (175) hide show
  1. package/dist/index.full.min.js +3237 -0
  2. package/dist/style.css +1 -0
  3. package/es/_virtual/FileSaver.min.mjs +4 -0
  4. package/es/_virtual/___vite-browser-external.mjs +6 -0
  5. package/es/_virtual/__vite-browser-external.mjs +4 -0
  6. package/es/_virtual/_commonjsHelpers.mjs +30 -0
  7. package/es/_virtual/_plugin-vue_export-helper.mjs +9 -0
  8. package/es/_virtual/clipboard.mjs +4 -0
  9. package/es/_virtual/dayjs.min.mjs +4 -0
  10. package/es/_virtual/index.mjs +4 -0
  11. package/es/_virtual/nprogress.mjs +4 -0
  12. package/es/_virtual/prism.mjs +4 -0
  13. package/es/_virtual/sax.mjs +4 -0
  14. package/es/_virtual/string_decoder.mjs +4 -0
  15. package/es/_virtual/tinymce.mjs +4 -0
  16. package/es/_virtual/weekOfYear.mjs +4 -0
  17. package/es/index.mjs +20 -0
  18. package/es/plugins/formValidatorUtil.mjs +391 -0
  19. package/es/plugins/index.mjs +9 -0
  20. package/es/style.css +1 -0
  21. package/es/vite.svg +1 -0
  22. package/es/workflow-editor/index.mjs +14 -0
  23. package/lib/_virtual/FileSaver.min.cjs +1 -0
  24. package/lib/_virtual/___vite-browser-external.cjs +1 -0
  25. package/lib/_virtual/__vite-browser-external.cjs +1 -0
  26. package/lib/_virtual/_commonjsHelpers.cjs +1 -0
  27. package/lib/_virtual/_plugin-vue_export-helper.cjs +1 -0
  28. package/lib/_virtual/clipboard.cjs +1 -0
  29. package/lib/_virtual/dayjs.min.cjs +1 -0
  30. package/lib/_virtual/index.cjs +1 -0
  31. package/lib/_virtual/nprogress.cjs +1 -0
  32. package/lib/_virtual/prism.cjs +1 -0
  33. package/lib/_virtual/sax.cjs +1 -0
  34. package/lib/_virtual/string_decoder.cjs +1 -0
  35. package/lib/_virtual/tinymce.cjs +1 -0
  36. package/lib/_virtual/weekOfYear.cjs +1 -0
  37. package/lib/index.cjs +1 -0
  38. package/lib/plugins/formValidatorUtil.cjs +1 -0
  39. package/lib/plugins/index.cjs +1 -0
  40. package/lib/style.css +1 -0
  41. package/lib/workflow-editor/index.cjs +1 -0
  42. package/package.json +5 -3
  43. package/vite.config.js +44 -10
  44. package/lib/401-5a92e011.js +0 -101
  45. package/lib/404-2e472acc.js +0 -26
  46. package/lib/authredirect-ae6e75b4.js +0 -10
  47. package/lib/iframe-page-4e84c0f8.js +0 -33
  48. package/lib/index-27119bd2.js +0 -31464
  49. package/lib/index-369eae4a.js +0 -13
  50. package/lib/tab-content-iframe-index-e9146736.js +0 -33
  51. package/lib/tab-content-index-bbc6792b.js +0 -1241
  52. package/lib/tache-subprocess-history-d51d6a50.js +0 -56
  53. package/lib/workflow-editor.css +0 -1
  54. package/lib/workflow-editor.js +0 -5
  55. package/lib/workflow-editor.umd.cjs +0 -85
  56. package/packages/index.js +0 -34
  57. package/packages/plugins/formValidatorUtil.js +0 -723
  58. package/packages/plugins/index.js +0 -8
  59. package/packages/workflow-editor/index.js +0 -14
  60. package/packages/workflow-editor/src/api.js +0 -7
  61. package/packages/workflow-editor/src/assets/tab-select.png +0 -0
  62. package/packages/workflow-editor/src/assets/tab-selectWhite.png +0 -0
  63. package/packages/workflow-editor/src/assets/wf-editor-icons.js +0 -2
  64. package/packages/workflow-editor/src/constant.js +0 -8
  65. package/packages/workflow-editor/src/json-object-templates/auto-task.js +0 -70
  66. package/packages/workflow-editor/src/json-object-templates/copy-task.js +0 -72
  67. package/packages/workflow-editor/src/json-object-templates/decision.js +0 -11
  68. package/packages/workflow-editor/src/json-object-templates/end.js +0 -14
  69. package/packages/workflow-editor/src/json-object-templates/fork.js +0 -10
  70. package/packages/workflow-editor/src/json-object-templates/human-decision.js +0 -9
  71. package/packages/workflow-editor/src/json-object-templates/human-task.js +0 -208
  72. package/packages/workflow-editor/src/json-object-templates/join.js +0 -10
  73. package/packages/workflow-editor/src/json-object-templates/process.js +0 -99
  74. package/packages/workflow-editor/src/json-object-templates/start.js +0 -13
  75. package/packages/workflow-editor/src/json-object-templates/subprocess.js +0 -31
  76. package/packages/workflow-editor/src/json-object-templates/transition.js +0 -26
  77. package/packages/workflow-editor/src/main/admin-save-dialog.vue +0 -67
  78. package/packages/workflow-editor/src/main/canvas.vue +0 -493
  79. package/packages/workflow-editor/src/main/context-menu.vue +0 -147
  80. package/packages/workflow-editor/src/main/icon-svg.vue +0 -32
  81. package/packages/workflow-editor/src/main/selection-region.vue +0 -66
  82. package/packages/workflow-editor/src/main/tache-history-tooltip.vue +0 -38
  83. package/packages/workflow-editor/src/main/tache-name-input.vue +0 -19
  84. package/packages/workflow-editor/src/main/tache-subprocess-history-dialog.vue +0 -40
  85. package/packages/workflow-editor/src/main/toolbox.vue +0 -60
  86. package/packages/workflow-editor/src/main/wf-history-canvas.vue +0 -309
  87. package/packages/workflow-editor/src/process-json.js +0 -624
  88. package/packages/workflow-editor/src/process-service.js +0 -69
  89. package/packages/workflow-editor/src/properties-editors/auto-task/basic-properties.vue +0 -81
  90. package/packages/workflow-editor/src/properties-editors/auto-task/permission-settings.vue +0 -155
  91. package/packages/workflow-editor/src/properties-editors/auto-task.vue +0 -74
  92. package/packages/workflow-editor/src/properties-editors/common/additional-condition-utils.js +0 -568
  93. package/packages/workflow-editor/src/properties-editors/common/additional-condition.vue +0 -320
  94. package/packages/workflow-editor/src/properties-editors/common/auto-filled-fields-utils.js +0 -34
  95. package/packages/workflow-editor/src/properties-editors/common/auto-filled-fields.vue +0 -268
  96. package/packages/workflow-editor/src/properties-editors/common/common-notice-tool.vue +0 -81
  97. package/packages/workflow-editor/src/properties-editors/common/common-user-condition.vue +0 -242
  98. package/packages/workflow-editor/src/properties-editors/common/form-fields-utils.js +0 -23
  99. package/packages/workflow-editor/src/properties-editors/common/form-fields.vue +0 -117
  100. package/packages/workflow-editor/src/properties-editors/common/i18n-input.vue +0 -88
  101. package/packages/workflow-editor/src/properties-editors/common/i18n-set-dialog.vue +0 -143
  102. package/packages/workflow-editor/src/properties-editors/common/notice-reminder.vue +0 -149
  103. package/packages/workflow-editor/src/properties-editors/common/notice.vue +0 -108
  104. package/packages/workflow-editor/src/properties-editors/common/reminder.vue +0 -272
  105. package/packages/workflow-editor/src/properties-editors/common/select-mail-template.vue +0 -92
  106. package/packages/workflow-editor/src/properties-editors/common/standard-fields.vue +0 -66
  107. package/packages/workflow-editor/src/properties-editors/common/system-role-tree-inline.vue +0 -354
  108. package/packages/workflow-editor/src/properties-editors/common/system-role-tree.vue +0 -68
  109. package/packages/workflow-editor/src/properties-editors/common/task-title.vue +0 -165
  110. package/packages/workflow-editor/src/properties-editors/common/transactor-settings.vue +0 -275
  111. package/packages/workflow-editor/src/properties-editors/common/user-selection.vue +0 -426
  112. package/packages/workflow-editor/src/properties-editors/common/value-selection-dialog.vue +0 -272
  113. package/packages/workflow-editor/src/properties-editors/common/variables.vue +0 -139
  114. package/packages/workflow-editor/src/properties-editors/copy-task/basic-properties.vue +0 -90
  115. package/packages/workflow-editor/src/properties-editors/copy-task/permission-settings.vue +0 -155
  116. package/packages/workflow-editor/src/properties-editors/copy-task.vue +0 -95
  117. package/packages/workflow-editor/src/properties-editors/decision.vue +0 -95
  118. package/packages/workflow-editor/src/properties-editors/fork.vue +0 -77
  119. package/packages/workflow-editor/src/properties-editors/human-decision.vue +0 -49
  120. package/packages/workflow-editor/src/properties-editors/human-task/additional-condition-dialog.vue +0 -62
  121. package/packages/workflow-editor/src/properties-editors/human-task/basic-properties.vue +0 -184
  122. package/packages/workflow-editor/src/properties-editors/human-task/componentsConfigUtil.js +0 -359
  123. package/packages/workflow-editor/src/properties-editors/human-task/custom-actions.vue +0 -256
  124. package/packages/workflow-editor/src/properties-editors/human-task/editable-child-field-setting.vue +0 -405
  125. package/packages/workflow-editor/src/properties-editors/human-task/editable-child-fields.vue +0 -257
  126. package/packages/workflow-editor/src/properties-editors/human-task/editable-field-selection.vue +0 -430
  127. package/packages/workflow-editor/src/properties-editors/human-task/editable-fields.vue +0 -206
  128. package/packages/workflow-editor/src/properties-editors/human-task/events.vue +0 -60
  129. package/packages/workflow-editor/src/properties-editors/human-task/permission-settings.vue +0 -224
  130. package/packages/workflow-editor/src/properties-editors/human-task/selection-conditions.vue +0 -499
  131. package/packages/workflow-editor/src/properties-editors/human-task.vue +0 -107
  132. package/packages/workflow-editor/src/properties-editors/join.vue +0 -49
  133. package/packages/workflow-editor/src/properties-editors/process/basic-properties.vue +0 -336
  134. package/packages/workflow-editor/src/properties-editors/process/events.vue +0 -79
  135. package/packages/workflow-editor/src/properties-editors/process/notice-settings.vue +0 -68
  136. package/packages/workflow-editor/src/properties-editors/process/parameter-settings.vue +0 -106
  137. package/packages/workflow-editor/src/properties-editors/process/permission-settings.vue +0 -28
  138. package/packages/workflow-editor/src/properties-editors/process/selectPage.vue +0 -88
  139. package/packages/workflow-editor/src/properties-editors/process.vue +0 -115
  140. package/packages/workflow-editor/src/properties-editors/subprocess/basic-properties.vue +0 -201
  141. package/packages/workflow-editor/src/properties-editors/subprocess/events.vue +0 -26
  142. package/packages/workflow-editor/src/properties-editors/subprocess/field-mappings.vue +0 -216
  143. package/packages/workflow-editor/src/properties-editors/subprocess/transactor-settings.vue +0 -66
  144. package/packages/workflow-editor/src/properties-editors/subprocess.vue +0 -80
  145. package/packages/workflow-editor/src/properties-editors/transition/basic-properties.vue +0 -53
  146. package/packages/workflow-editor/src/properties-editors/transition.vue +0 -75
  147. package/packages/workflow-editor/src/properties-editors/user-condition.js +0 -183
  148. package/packages/workflow-editor/src/store/getters.js +0 -33
  149. package/packages/workflow-editor/src/store/workflow-editor.js +0 -153
  150. package/packages/workflow-editor/src/taches/auto-task.vue +0 -99
  151. package/packages/workflow-editor/src/taches/common-methods.js +0 -21
  152. package/packages/workflow-editor/src/taches/copy-task.vue +0 -99
  153. package/packages/workflow-editor/src/taches/custom-task.vue +0 -88
  154. package/packages/workflow-editor/src/taches/decision.vue +0 -102
  155. package/packages/workflow-editor/src/taches/end.vue +0 -76
  156. package/packages/workflow-editor/src/taches/fork.vue +0 -102
  157. package/packages/workflow-editor/src/taches/human-decision.vue +0 -102
  158. package/packages/workflow-editor/src/taches/human-task.vue +0 -113
  159. package/packages/workflow-editor/src/taches/join.vue +0 -91
  160. package/packages/workflow-editor/src/taches/joint.vue +0 -177
  161. package/packages/workflow-editor/src/taches/start.vue +0 -76
  162. package/packages/workflow-editor/src/taches/subprocess.vue +0 -99
  163. package/packages/workflow-editor/src/taches/tache-resizer.vue +0 -80
  164. package/packages/workflow-editor/src/transitions/broken-line.vue +0 -91
  165. package/packages/workflow-editor/src/transitions/curve-line.vue +0 -91
  166. package/packages/workflow-editor/src/transitions/straight-line.vue +0 -26
  167. package/packages/workflow-editor/src/transitions/transition.vue +0 -209
  168. package/packages/workflow-editor/src/transitions/virtual-transition.vue +0 -43
  169. package/packages/workflow-editor/src/util.js +0 -499
  170. package/packages/workflow-editor/src/workflow-editor.vue +0 -852
  171. package/packages/workflow-editor/src/workflow-history.vue +0 -153
  172. package/src/i18n/i18n.js +0 -16
  173. package/src/i18n/langs/cn.js +0 -521
  174. package/src/i18n/langs/en.js +0 -529
  175. /package/{public → dist}/vite.svg +0 -0
@@ -1,852 +0,0 @@
1
- <template>
2
- <div
3
- ref="wfEditor"
4
- style="position: relative; height: 100%"
5
- @mousedown="setContextMenuVisible(false)"
6
- @mousewheel="setContextMenuVisible(false)"
7
- >
8
- <el-row class="button-area">
9
- <el-button v-if="!readonly" type="primary" @click="saveXml">
10
- {{ $t('workflowEditorPublicModel.save') }}
11
- </el-button>
12
- <el-button
13
- v-if="!readonly"
14
- v-permission="'wf.workflowDefinition.adminSave'"
15
- class="button--default"
16
- @click="adminSave"
17
- >
18
- {{ $t('workflowEditorPublicModel.adminSave') }}
19
- </el-button>
20
- <el-button v-if="isShowEnable" class="button--default" @click="enableWf">
21
- {{ $t('workflowEditorPublicModel.enable') }}
22
- </el-button>
23
- <el-button class="button--default" @click="exportProcessFromClient">
24
- {{ $t('workflowEditorPublicModel.export') }}
25
- </el-button>
26
- <el-button v-if="!readonly" class="button--default" @click="selectProcessFile">
27
- {{ $t('workflowEditorPublicModel.open') }}
28
- <input
29
- ref="processFile"
30
- type="file"
31
- name="processFile"
32
- accept=".xml"
33
- style="display: none"
34
- @change="openXmlFromClient"
35
- />
36
- </el-button>
37
- <el-button type="primary" class="button--return" @click="$emit('back')">
38
- {{ $t('workflowEditorPublicModel.return') }}
39
- </el-button>
40
- <el-select
41
- v-if="isShowDefVersionList"
42
- v-model="defVersion"
43
- style="padding-left: 10px; width: 200px"
44
- @change="changeDefVersion"
45
- >
46
- <el-option
47
- v-for="systemInfo in workflowDefVersionList"
48
- :key="systemInfo.definitionVersion"
49
- :label="systemInfo.definitionVersion"
50
- :value="systemInfo.definitionVersion"
51
- />
52
- </el-select>
53
- </el-row>
54
- <div class="main" @mousedown="startDrag" @mousemove="drag" @mouseup="endDrag" @mouseleave="clearStatus">
55
- <toolbox v-if="!readonly" class="toolbox" onselectstart="return false" oncontextmenu="return false" />
56
- <section class="tabBox" :key="canvasKey">
57
- <el-tabs v-model="activeTab" class="tabs">
58
- <el-tab-pane :label="$t('workflowEditorPublicModel.flowChart')" name="canvas" class="tab-pane">
59
- <workflow-canvas
60
- onselectstart="return false"
61
- :process="process"
62
- class="canvas"
63
- @mouseup.native="addTache"
64
- @contextmenu.native.prevent="showContextMenu"
65
- />
66
- </el-tab-pane>
67
- <el-tab-pane label="XML" name="xml" class="tab-pane">
68
- <div style="width: 100%; height: 100%; background: #fff">
69
- <pre
70
- v-if="activeTab === 'xml'"
71
- class="xml line-numbers"
72
- ><code ref="xml" class="language-xml">{{ xml }}</code></pre>
73
- </div>
74
- </el-tab-pane>
75
- </el-tabs>
76
- </section>
77
- </div>
78
- <icon-svg
79
- v-if="componentToDraw"
80
- :style="{
81
- height: componentInfo.height,
82
- width: componentInfo.width,
83
- color: componentInfo.color,
84
- left: currentPosition.x + 'px',
85
- top: currentPosition.y + 'px'
86
- }"
87
- :icon="componentInfo.icon"
88
- class="component-icon"
89
- />
90
- <context-menu
91
- v-if="contextMenuVisible"
92
- :style="{
93
- position: 'absolute',
94
- left: contextMenuPosition.x + 'px',
95
- top: contextMenuPosition.y + 'px'
96
- }"
97
- />
98
- <admin-save-dialog v-if="isAdminSave" @close="isAdminSave = false" @update="updateWfVersion" @add="addWfVersion" />
99
- </div>
100
- </template>
101
- <script>
102
- import './assets/wf-editor-icons.js'
103
- import { mapGetters, mapMutations } from 'vuex'
104
- import { getMousePosition, removeTextProperty, getComponentInfo, initializeProcessData, processTemplate } from './util'
105
- import Toolbox from './main/toolbox.vue'
106
- import WorkflowCanvas from './main/canvas.vue'
107
- import IconSvg from './main/icon-svg.vue'
108
- import ContextMenu from './main/context-menu.vue'
109
- import convert from 'xml-js'
110
- import processService from './process-service'
111
- import FileSaver from 'file-saver'
112
- import Prism from 'prismjs'
113
- import AdminSaveDialog from './main/admin-save-dialog.vue'
114
- import authApi from 'agilebuilder-ui/src/utils/auth-api'
115
- import http from 'agilebuilder-ui/src/utils/request'
116
-
117
- export default {
118
- name: 'WorkflowEditor',
119
- components: {
120
- WorkflowCanvas,
121
- Toolbox,
122
- IconSvg,
123
- ContextMenu,
124
- AdminSaveDialog
125
- },
126
- props: {
127
- // 流程编码
128
- code: {
129
- type: String,
130
- default: null
131
- },
132
- // 流程版本
133
- version: {
134
- type: Number,
135
- default: null
136
- },
137
- // 流程id
138
- id: {
139
- type: Number,
140
- default: null
141
- },
142
- readonly: {
143
- type: Boolean,
144
- default: false
145
- },
146
- // 系统编码,新增时选中的系统编码,或修改时流程定义所属的系统编码
147
- systemCode: {
148
- type: String,
149
- default: null
150
- },
151
- // 系统版本号,修改时流程定义中的系统版本号,例如:v1.0.0,新增不会使用该属性
152
- systemPublishVersion: {
153
- type: Number,
154
- default: null
155
- },
156
- // 新页面设计中页面编码
157
- pageCode: {
158
- type: String,
159
- default: null
160
- }
161
- },
162
- data: function () {
163
- return {
164
- activeTab: 'canvas',
165
- count: 1,
166
- currentPosition: { x: 0, y: 0 },
167
- process: null,
168
- definitionId: null,
169
- xml: '',
170
- contextMenuPosition: null,
171
- isAdminSave: false, // 是否点击了管理员保存按钮
172
- isShowEnable: false, // 流程定义是否已启用,如果已启用,则不显示“启用”按钮,草稿和禁用时才显示启用按钮
173
- defVersion: 0, //流程定义版本
174
- workflowDefVersionList: [], // 流程定义各版本集合
175
- isShowDefVersionList: false, // 是否显示流程定义版本下拉选
176
- canvasKey: 0
177
- }
178
- },
179
- computed: {
180
- ...mapGetters('wfEditor', [
181
- 'componentToDraw',
182
- 'taches',
183
- 'selectedTaches',
184
- 'transitions',
185
- 'contextMenuVisible',
186
- 'systemVersion',
187
- 'tableCode',
188
- 'pageCode',
189
- 'sourceComponentType'
190
- ]),
191
- ...mapGetters(['sidebar']),
192
- componentInfo() {
193
- return getComponentInfo(this.componentToDraw)
194
- }
195
- },
196
- watch: {
197
- activeTab(name) {
198
- if (name === 'xml') {
199
- this.xml = this.getProcessXml()
200
- this.$nextTick(function () {
201
- Prism.highlightElement(this.$refs.xml)
202
- })
203
- }
204
- },
205
- sourceComponentType(newVal) {
206
- if (newVal) {
207
- this.copyTache()
208
- }
209
- }
210
- },
211
- created: function () {
212
- // if (this.systemPublishVersion) {
213
- // this.setSystemVersion(this.systemPublishVersion)
214
- // }
215
- authApi.setSessionCache('wf_editor_systemVersion', this.systemPublishVersion)
216
- this.setPageCode(this.pageCode)
217
- if (this.systemCode) {
218
- this.setSystemCode(this.systemCode)
219
- }
220
-
221
- // 请求版本所有列表
222
- if (this.systemCode) {
223
- this.getWorkflowDefVersionList()
224
- }
225
- // 打开或新建流程图时先清空画布,开发过程中代码热更新的时候可以避免节点重复
226
- this.clearCanvas()
227
- if (this.id) {
228
- this.definitionId = this.id
229
- }
230
- console.log('canvas-created=', this.code, this.id)
231
- if (this.code || this.id) {
232
- this.initShowDefinitionWhenUpdate(this.id, this.code, this.version)
233
- } else {
234
- this.isShowEnable = false
235
- window.$store.commit('wfEditor/setIsCreateDefinition', 'true')
236
- this.process = processTemplate.newProcess()
237
- initializeProcessData(this.process)
238
- }
239
- },
240
- mounted: function () {},
241
- methods: {
242
- ...mapMutations('wfEditor', [
243
- 'setComponentToDraw',
244
- 'clearCanvas',
245
- 'setContextMenuVisible',
246
- 'setSystemCode',
247
- 'setSystemVersion',
248
- 'setProcessCode',
249
- 'setPageCode',
250
- 'setSourceComponentForCopy'
251
- ]),
252
- initShowDefinitionWhenUpdate(defId, workflowCode, workflowVersion) {
253
- window.$store.commit('wfEditor/setIsCreateDefinition', 'false')
254
- let url = this.baseAPI + '/wf-editor/open-xmls/with-definitions'
255
- url = this.packageUrlParam(url, defId, workflowCode, workflowVersion)
256
- this.$http.get(url).then((data) => {
257
- const definition = data.definition
258
- if (definition) {
259
- this.definitionId = definition.id
260
- this.defVersion = definition.definitionVersion
261
- window.$store.commit('wfEditor/setTableCode', definition.tableCode)
262
- const state = definition.enable
263
- if (state && state === 'ENABLE') {
264
- this.isShowEnable = false
265
- } else {
266
- this.isShowEnable = true
267
- }
268
- if (definition.formCode) {
269
- // 表示在流程定义模块中创建的流程
270
- window.$store.commit('wfEditor/setIsHandleCreate', 'true')
271
- } else {
272
- // 表示在页面设计中创建的流程
273
- window.$store.commit('wfEditor/setIsHandleCreate', 'false')
274
- }
275
- }
276
- const xml = data.xml
277
- this.initProcessByXml(xml, definition)
278
- this.canvasKey++
279
- })
280
- },
281
- getWorkflowDefVersionList() {
282
- // 重新初始显示流程版本下拉选
283
- this.isShowDefVersionList = false
284
- let queryBody = {
285
- wfDefinitionCode: this.code,
286
- publishVersion: this.systemPublishVersion
287
- }
288
- http
289
- .post(
290
- window['$vueApp'].config.globalProperties.baseAPI +
291
- `/component/super-page-design/workflow-definitions/version-list`,
292
- queryBody
293
- )
294
- .then((res) => {
295
- this.workflowDefVersionList = res
296
- if (res.length > 0 && !this.defVersion) {
297
- this.defVersion = res[0].definitionVersion
298
- }
299
- this.isShowDefVersionList = true
300
- })
301
- },
302
- showContextMenu(event) {
303
- this.setContextMenuVisible(true)
304
- // 得到元素在页面上的位置信息,用来计算鼠标位置的偏移量
305
- const offset = this.$refs.wfEditor.getBoundingClientRect()
306
- this.contextMenuPosition = {
307
- x: event.clientX - offset.x,
308
- y: event.clientY - offset.y
309
- }
310
- },
311
- changeDefVersion(newDefVersion) {
312
- const defList = this.workflowDefVersionList.filter((def) => def.definitionVersion === newDefVersion)
313
- if (defList && defList.length > 0) {
314
- const newDef = defList[0]
315
- // 打开或新建流程图时先清空画布,开发过程中代码热更新的时候可以避免节点重复
316
- this.clearCanvas()
317
- this.initShowDefinitionWhenUpdate(newDef.id, newDef.code, newDef.definitionVersion)
318
- this.$emit('changeDefVersion', newDef)
319
- }
320
- },
321
- initProcessByXml(xml, definition) {
322
- if (!xml) {
323
- // xml内容为空,则初始化xml
324
- this.process = processTemplate.newProcess()
325
- this.initProcessBaseInfo(definition)
326
- } else {
327
- const options = {
328
- nativeType: true,
329
- attributesKey: 'attr',
330
- compact: true,
331
- ignoreComment: true,
332
- spaces: 4
333
- }
334
- const processObj = convert.xml2js(xml, options)
335
- removeTextProperty(processObj.process)
336
- this.process = processObj.process
337
- }
338
- if (this.process && this.process.properties && this.process.properties.basicProperties) {
339
- this.setSystemCode(this.process.properties.basicProperties.systemCode)
340
- } else {
341
- // 新增时,将传过来的系统编码缓存起来
342
- this.setSystemCode(this.systemCode)
343
- }
344
- if (this.process && this.process.attr) {
345
- this.setProcessCode(this.process.attr.code)
346
- }
347
- // 得到表单字段放到vuex
348
- this.fetchFormFields()
349
- this.clearCanvas()
350
- initializeProcessData(this.process)
351
- this.count = this.getMaxCount() + 1
352
- },
353
- initProcessBaseInfo(definition) {
354
- this.process.attr.name = definition.name
355
- this.process.attr.code = definition.code
356
- this.process.properties.basicProperties.systemCode = definition.systemCode
357
- if (this.pageCode) {
358
- if (!this.process.properties.parameterSettings) {
359
- this.process.properties.parameterSettings = {}
360
- }
361
- if (!this.process.properties.parameterSettings.doTask) {
362
- this.process.properties.parameterSettings.doTask = {}
363
- }
364
- this.process.properties.parameterSettings.doTask.url = 'page:' + this.pageCode
365
- }
366
- },
367
- fetchFormFields() {
368
- const processProperties = this.process.properties.basicProperties
369
- const formCode = processProperties.formCode
370
- const formVersion = processProperties.formVersion
371
- console.log('fetchFormFields---this.tableCode=', this.tableCode)
372
- if (formCode && formCode !== '' && formVersion) {
373
- // 取出formFields放到vuex中
374
- processService.fetchFormFields(
375
- processProperties.formCode,
376
- processProperties.formVersion,
377
- null,
378
- this.systemPublishVersion
379
- )
380
- } else if (this.tableCode) {
381
- // TODO: 根据数据表获得字段集合 表示在页面设计中创建的流程
382
- processService.fetchFormFields(null, null, this.tableCode, this.systemPublishVersion)
383
- }
384
- },
385
- packageUrlParam(url, defId, workflowCode, workflowVersion) {
386
- if (defId) {
387
- url = url + '?id=' + defId
388
- } else if (workflowCode) {
389
- url = url + '?code=' + workflowCode + '&version=' + workflowVersion
390
- }
391
- return url
392
- },
393
- // 获得流程定义xml
394
- getProcessXml() {
395
- const process = {
396
- start: [],
397
- humanTask: [],
398
- decision: [],
399
- transition: [],
400
- fork: [],
401
- join: [],
402
- subprocess: [],
403
- humanDecision: [],
404
- copyTask: [],
405
- autoTask: [],
406
- end: []
407
- }
408
- process.attr = this.process.attr
409
- process.properties = this.process.properties
410
- this.taches.map((tache) => {
411
- const type = tache.type
412
- // type的首字母小写形式就是process中各个数组的名字,ref才是真正的环节信息
413
- process[type.charAt(0).toLowerCase() + type.substring(1)].push(tache.ref)
414
- // 补充完整图形位置信息
415
- tache.ref.g = {
416
- x: tache.x,
417
- y: tache.y,
418
- width: tache.width,
419
- height: tache.height
420
- }
421
- })
422
- this.transitions.map((transition) => {
423
- // ref才是真正的流向信息
424
- process.transition.push(transition.ref)
425
- // 补充完整图形位置信息
426
- transition.ref.g = {
427
- fromJoint: transition.startJoint.position,
428
- toJoint: transition.endJoint.position,
429
- coordinate: '',
430
- lineType: transition.lineInfo.type
431
- }
432
- if (transition.lineInfo.type === 'CurveLine' && transition.lineInfo.controlPoint) {
433
- transition.ref.g.coordinate = transition.lineInfo.controlPoint.x + ',' + transition.lineInfo.controlPoint.y
434
- } else if (transition.lineInfo.type === 'BrokenLine' && transition.lineInfo.controlPoint) {
435
- let coordinate = ''
436
- transition.lineInfo.controlPoint.forEach((point) => {
437
- coordinate += point.x + ',' + point.y + ';'
438
- })
439
- transition.ref.g.coordinate = coordinate
440
- }
441
- })
442
- const options = { attributesKey: 'attr', compact: true, ignoreComment: true, spaces: 4 }
443
- let result = convert.json2xml({ process }, options)
444
- result = '<?xml version="1.0" encoding="utf-8"?>\n' + result
445
- return result
446
- },
447
- // 保存xml
448
- saveXml() {
449
- const xml = this.getProcessXml()
450
- // console.log(xml)
451
- // 保存流程定义xml
452
- if (this.code || this.id || this.definitionId) {
453
- // 表示修改
454
- this.saveWf(xml, this.baseAPI + '/wf-editor/workflow-definitions/updates').then(() => {
455
- // 表示新增版本后,流程定义状态是草稿
456
- this.isShowEnable = true
457
- window.$store.commit('wfEditor/setIsCreateDefinition', 'false')
458
- this.$alert(this.$t('workflowEditorMessage.updateSuccessful'))
459
- })
460
- } else {
461
- // 表示新建
462
- const param = {
463
- xml: xml,
464
- publishVersion: this.systemPublishVersion
465
- }
466
- this.$http.post(this.baseAPI + '/wf-editor/workflow-definitions', param).then((definition) => {
467
- // 表示草稿状态保存
468
- this.isShowEnable = true
469
- window.$store.commit('wfEditor/setIsCreateDefinition', 'false')
470
- this.definitionId = definition.id
471
- this.$alert(this.$t('workflowEditorMessage.savedSuccessfully'))
472
- // console.log('新建成功' + this.definitionId)
473
- })
474
- }
475
- },
476
- saveWf(xml, url, message) {
477
- return new Promise((resolve, reject) => {
478
- const param = this.packageSaveXmlParam(xml)
479
-
480
- this.$http.post(url, param).then((definition) => {
481
- this.definitionId = definition.id
482
- // console.log('更新成功' + this.definitionId)
483
- resolve()
484
- })
485
- })
486
- },
487
- packageSaveXmlParam(xml) {
488
- const param = {
489
- xml: xml,
490
- publishVersion: this.systemPublishVersion
491
- }
492
- if (this.definitionId) {
493
- // 表示已保存过,新流程定义的id
494
- param.id = this.definitionId
495
- } else {
496
- if (this.id) {
497
- param.id = this.id
498
- } else if (this.code) {
499
- param.code = this.code
500
- param.version = this.version
501
- }
502
- }
503
- return param
504
- },
505
- adminSave() {
506
- const xml = this.getProcessXml()
507
- // console.log(xml)
508
- // 保存流程定义xml
509
- if (this.code || this.id || this.definitionId) {
510
- // 表示修改
511
- const url = this.baseAPI + '/wf-editor/workflow-definitions/states'
512
- const param = {}
513
- if (this.definitionId) {
514
- // 表示已保存过,新流程定义的id
515
- param.id = this.definitionId
516
- } else {
517
- if (this.id) {
518
- param.id = this.id
519
- } else if (this.code) {
520
- param.code = this.code
521
- param.version = this.version
522
- }
523
- }
524
- this.$http.post(url, param).then((state) => {
525
- if (state === 'DRAFT') {
526
- // 如果是草稿状态直接保存
527
- this.saveWf(xml, this.baseAPI + '/wf-editor/workflow-definitions/updates').then(() => {
528
- // 表示草稿状态保存
529
- this.isShowEnable = true
530
- window.$store.commit('wfEditor/setIsCreateDefinition', 'false')
531
- this.$alert(this.$t('workflowEditorMessage.updateSuccessful'))
532
- })
533
- } else {
534
- // 如果是禁用或启用状态,让用户选择是增加版本还是更新版本
535
- this.isAdminSave = true
536
- }
537
- })
538
- } else {
539
- // 表示新建
540
- const param = {
541
- xml: xml,
542
- publishVersion: this.systemPublishVersion
543
- }
544
- this.$http.post(this.baseAPI + '/wf-editor/workflow-definitions', param).then((definition) => {
545
- // 表示草稿状态保存
546
- this.isShowEnable = true
547
- window.$store.commit('wfEditor/setIsCreateDefinition', 'false')
548
- this.definitionId = definition.id
549
- this.$alert(this.$t('workflowEditorMessage.savedSuccessfully'))
550
- // console.log('新建成功' + this.definitionId)
551
- })
552
- }
553
- },
554
- updateWfVersion() {
555
- const xml = this.getProcessXml()
556
- this.saveWf(xml, this.baseAPI + '/wf-editor/workflow-definitions/update-version').then(() => {
557
- window.$store.commit('wfEditor/setIsCreateDefinition', 'false')
558
- this.isAdminSave = false
559
- this.$alert(this.$t('workflowEditorMessage.updateVersionSuccessful'))
560
- })
561
- },
562
- addWfVersion() {
563
- const xml = this.getProcessXml()
564
- this.saveWf(xml, this.baseAPI + '/wf-editor/workflow-definitions/updates').then(() => {
565
- // 表示增加版本,所以流程定义状态是草稿状态
566
- this.isShowEnable = true
567
- window.$store.commit('wfEditor/setIsCreateDefinition', 'false')
568
- this.isAdminSave = false
569
- this.$alert(this.$t('workflowEditorMessage.addVersionSuccessful'))
570
- })
571
- },
572
- exportProcessFromClient() {
573
- const blob = new Blob([this.getProcessXml()], { type: 'text/xml;charset=utf-8' })
574
- FileSaver.saveAs(blob, this.process.attr.name + '.xml')
575
- },
576
- // 导出xml
577
- exportProcess() {
578
- const xml = this.getProcessXml()
579
- this.$http({
580
- method: 'post',
581
- url: this.baseAPI + '/wf-editor/save-as-xmls',
582
- data: {
583
- xmlContent: xml
584
- }
585
- }).then((response) => {
586
- this.download(response)
587
- console.log(this.$t('workflowEditorMessage.exportSucceeded'))
588
- })
589
- },
590
- // 下载文件
591
- download(data) {
592
- if (!data) {
593
- return
594
- }
595
- const url = window.URL.createObjectURL(new Blob([data]))
596
- const link = document.createElement('a')
597
- link.style.display = 'none'
598
- link.href = url
599
- link.setAttribute('download', 'myXml.xml')
600
-
601
- document.body.appendChild(link)
602
- link.click()
603
- },
604
- // 打开xml文件成功后
605
- uploadSuccess(response, file, fileList) {
606
- const xml = response
607
- // console.log('xml=', xml)
608
- // 打开或新建流程图时先清空画布,开发过程中代码热更新的时候可以避免节点重复
609
- this.clearCanvas()
610
- this.initProcessByXml(xml)
611
- this.$refs.upload.clearFiles()
612
- },
613
- getCurrentPosition(event) {
614
- if (this.componentToDraw) {
615
- const offset = this.$refs.wfEditor.getBoundingClientRect()
616
-
617
- this.currentPosition = {
618
- x: event.clientX - offset.x - 22,
619
- y: event.clientY - offset.y - 22
620
- }
621
- }
622
- },
623
- startDrag(event) {
624
- this.getCurrentPosition(event)
625
- },
626
- drag(event) {
627
- this.getCurrentPosition(event)
628
- },
629
- endDrag() {
630
- if (this.componentToDraw) {
631
- this.setComponentToDraw('')
632
- }
633
- },
634
-
635
- addTache(event) {
636
- if (this.componentToDraw) {
637
- const positionInSVG = getMousePosition(event)
638
- const ref = processTemplate['new' + this.componentToDraw]()
639
- // 组件类型转换为首字母小写形式
640
- ref.attr.id =
641
- this.componentToDraw.charAt(0).toLowerCase() + this.componentToDraw.substring(1) + '_' + this.count
642
- const tache = {
643
- // 默认id是组件类型加上下划线和数字序号,每次打开流程图的时候都需要动态计算最大的序号,然后加1作为count的的初始值
644
- id: ref.attr.id,
645
- name: ref.attr.name,
646
- x: positionInSVG.x - this.componentInfo.width / 2,
647
- y: positionInSVG.y - this.componentInfo.height / 2,
648
- width: this.componentInfo.width,
649
- height: this.componentInfo.height,
650
- type: this.componentToDraw,
651
- isSelected: false
652
- }
653
- tache.ref = ref
654
- this.taches.push(tache)
655
- this.count++
656
- }
657
- },
658
- copyTache() {
659
- const sourceTache = this.selectedTaches && this.selectedTaches.length > 0 ? this.selectedTaches[0] : null
660
- if (!sourceTache) {
661
- return
662
- }
663
- const tache = JSON.parse(JSON.stringify(sourceTache))
664
- const tacheType = tache.type
665
- const ref = tache.ref
666
- // 组件类型转换为首字母小写形式
667
- ref.attr.id = tacheType.charAt(0).toLowerCase() + tacheType.substring(1) + '_' + this.count
668
- ref.attr.name = sourceTache.name + '_copy'
669
- // 默认id是组件类型加上下划线和数字序号,每次打开流程图的时候都需要动态计算最大的序号,然后加1作为count的的初始值
670
- tache.id = ref.attr.id
671
- tache.name = ref.attr.name
672
- tache.x = sourceTache.x + 20 // 偏移20个像素
673
- tache.y = sourceTache.y + 20
674
- tache.isSelected = false
675
- tache.ref = ref
676
- this.taches.push(tache)
677
- this.count++
678
- // 还原拷贝的状态位
679
- this.setSourceComponentForCopy('')
680
- },
681
- clearStatus() {
682
- if (this.componentToDraw) {
683
- this.setComponentToDraw('')
684
- }
685
- },
686
- getMaxCount() {
687
- let max = 0
688
- this.taches.map((item) => {
689
- // 自动生成的id以下划线加数字编号结尾
690
- let index = item.id.substring(item.id.lastIndexOf('_') + 1)
691
- index = +index
692
- if (max < index) {
693
- max = index
694
- }
695
- })
696
- return max
697
- },
698
- selectProcessFile() {
699
- this.$refs.processFile.click()
700
- },
701
- openXmlFromClient() {
702
- if (this.$refs.processFile.value === '') return
703
- const file = this.$refs.processFile.files[0]
704
- const reader = new FileReader()
705
- // 本地直接读取文件
706
- reader.readAsText(file)
707
- const vm = this
708
- reader.onload = function () {
709
- // 打开或新建流程图时先清空画布,开发过程中代码热更新的时候可以避免节点重复
710
- vm.clearCanvas()
711
- vm.initProcessByXml(reader.result)
712
- vm.$refs.processFile.value = ''
713
- }
714
- },
715
- // 启用流程定义
716
- enableWf() {
717
- if (this.definitionId) {
718
- this.$http.put(this.baseAPI + '/wf-editor/workflow-editors/' + this.definitionId + '/states').then(() => {
719
- this.getWorkflowDefVersionList()
720
- this.isShowEnable = false
721
- this.$alert(this.$t('workflowEditorMessage.enabledSuccessfully'))
722
- })
723
- }
724
- }
725
- }
726
- }
727
- </script>
728
-
729
- <style lang="scss" scoped>
730
- $toolboxWidth: 150px;
731
- $buttonAreaHeight: 50px;
732
- $tabsHeaderHeight: 41px;
733
- .button-area {
734
- padding: 5px 0 5px 5px;
735
- height: $buttonAreaHeight;
736
- background-color: #ffffff;
737
- }
738
- .el-row {
739
- border: 1px solid #f1f1f1;
740
- border-radius: 5px;
741
- }
742
- .el-col {
743
- padding-left: 5px;
744
- }
745
- .main {
746
- position: relative;
747
- display: flex;
748
- height: calc(100% - #{$buttonAreaHeight});
749
- width: 100%;
750
- }
751
- .canvas-container {
752
- position: relative;
753
- // display:flex;
754
- height: calc(100% - #{$buttonAreaHeight});
755
- width: 100%;
756
- }
757
- .toolbox {
758
- width: $toolboxWidth;
759
- overflow-y: auto;
760
- height: 100%;
761
- // border:1px solid black;
762
- background: #f7f7f7;
763
- padding: 10px;
764
- // min-height: 500px;
765
- text-align: center;
766
- flex: none;
767
- // min-width: 140px;
768
- // max-width:180px;
769
- }
770
- section {
771
- overflow: hidden;
772
- flex: 1 1 auto;
773
- height: 100%;
774
- padding: 0;
775
- // min-height: 500px;
776
- }
777
- .tabs {
778
- height: 100%;
779
- width: 100%;
780
- }
781
-
782
- .tabBox {
783
- padding: 20px;
784
- }
785
-
786
- .tab-pane {
787
- height: 100%;
788
- width: 100%;
789
- }
790
- // 在scss中需要使用/deep/这个别名来代替 '>>>'
791
- .tabs :deep(.el-tabs__content) {
792
- //height: calc(100% - #{$tabsHeaderHeight});
793
- height: calc(100vh - 138px);
794
- width: 100%;
795
- }
796
-
797
- .canvas,
798
- .xml {
799
- overflow: auto;
800
- height: 100%;
801
- width: 100%;
802
- // border:1px solid red;
803
- // background: #ffffff;
804
- padding: 0;
805
- min-height: 500px;
806
- }
807
- pre {
808
- margin: 0;
809
- font-size: 16px;
810
- }
811
- .component-icon {
812
- position: absolute;
813
- pointer-events: none;
814
- // border: 1px solid red;
815
- }
816
- .canvas :deep(.draggable) {
817
- cursor: move;
818
- }
819
-
820
- :deep(.el-tabs__header .el-tabs__item.is-active) {
821
- background-image: url('./assets/tab-select.png') !important;
822
- background-size: 100% 100%;
823
- min-width: 100px;
824
- text-align: center;
825
- }
826
-
827
- :deep(.el-tabs__header .el-tabs__item) {
828
- background-image: url('./assets/tab-selectWhite.png') !important;
829
- background-size: 100% 100%;
830
- min-width: 100px;
831
- text-align: center;
832
- }
833
-
834
- /* 去除table选中下划线 */
835
- :deep(.el-tabs__active-bar) {
836
- display: none;
837
- }
838
-
839
- :deep(.el-tabs__item) {
840
- padding: 0;
841
- }
842
-
843
- /* 去掉tab横线 */
844
- :deep(.el-tabs__nav-wrap::after) {
845
- width: 0;
846
- }
847
-
848
- /* 去掉卡片和tab表头的距离 */
849
- :deep(.el-tabs__header) {
850
- margin: 0;
851
- }
852
- </style>