workflow-editor 0.0.66-up → 0.0.66-up-rc2

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "workflow-editor",
3
3
  "private": false,
4
- "version": "0.0.66-up",
4
+ "version": "0.0.66-up-rc2",
5
5
  "type": "module",
6
6
  "main": "./lib/workflow-editor.js",
7
7
  "scripts": {
@@ -557,7 +557,7 @@ function validateSub(
557
557
  }
558
558
  }
559
559
  }
560
- return true
560
+ return isNeedField?{msg: true, listCode: prop}: true
561
561
  }
562
562
 
563
563
  function getEntityId(row) {
@@ -51,26 +51,11 @@
51
51
  />
52
52
  </el-select>
53
53
  </el-row>
54
- <div
55
- class="main"
56
- @mousedown="startDrag"
57
- @mousemove="drag"
58
- @mouseup="endDrag"
59
- @mouseleave="clearStatus"
60
- >
61
- <toolbox
62
- v-if="!readonly"
63
- class="toolbox"
64
- onselectstart="return false"
65
- oncontextmenu="return false"
66
- />
67
- <section class="tabBox">
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">
68
57
  <el-tabs v-model="activeTab" class="tabs">
69
- <el-tab-pane
70
- :label="$t('workflowEditorPublicModel.flowChart')"
71
- name="canvas"
72
- class="tab-pane"
73
- >
58
+ <el-tab-pane :label="$t('workflowEditorPublicModel.flowChart')" name="canvas" class="tab-pane">
74
59
  <workflow-canvas
75
60
  onselectstart="return false"
76
61
  :process="process"
@@ -110,33 +95,22 @@
110
95
  top: contextMenuPosition.y + 'px'
111
96
  }"
112
97
  />
113
- <admin-save-dialog
114
- v-if="isAdminSave"
115
- @close="isAdminSave = false"
116
- @update="updateWfVersion"
117
- @add="addWfVersion"
118
- />
98
+ <admin-save-dialog v-if="isAdminSave" @close="isAdminSave = false" @update="updateWfVersion" @add="addWfVersion" />
119
99
  </div>
120
100
  </template>
121
101
  <script>
122
102
  import './assets/wf-editor-icons.js'
123
103
  import { mapGetters, mapMutations } from 'vuex'
124
- import {
125
- getMousePosition,
126
- removeTextProperty,
127
- getComponentInfo,
128
- initializeProcessData,
129
- processTemplate
130
- } from './util'
131
- import Toolbox from './main/toolbox'
132
- import WorkflowCanvas from './main/canvas'
133
- import IconSvg from './main/icon-svg'
134
- import ContextMenu from './main/context-menu'
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'
135
109
  import convert from 'xml-js'
136
110
  import processService from './process-service'
137
111
  import FileSaver from 'file-saver'
138
112
  import Prism from 'prismjs'
139
- import AdminSaveDialog from './main/admin-save-dialog'
113
+ import AdminSaveDialog from './main/admin-save-dialog.vue'
140
114
  import authApi from 'agilebuilder-ui/src/utils/auth-api'
141
115
  import http from 'agilebuilder-ui/src/utils/request'
142
116
 
@@ -198,7 +172,8 @@ export default {
198
172
  isShowEnable: false, // 流程定义是否已启用,如果已启用,则不显示“启用”按钮,草稿和禁用时才显示启用按钮
199
173
  defVersion: 0, //流程定义版本
200
174
  workflowDefVersionList: [], // 流程定义各版本集合
201
- isShowDefVersionList: false // 是否显示流程定义版本下拉选
175
+ isShowDefVersionList: false, // 是否显示流程定义版本下拉选
176
+ canvasKey: 0
202
177
  }
203
178
  },
204
179
  computed: {
@@ -228,7 +203,7 @@ export default {
228
203
  }
229
204
  },
230
205
  sourceComponentType(newVal) {
231
- if(newVal) {
206
+ if (newVal) {
232
207
  this.copyTache()
233
208
  }
234
209
  }
@@ -273,7 +248,6 @@ export default {
273
248
  'setProcessCode',
274
249
  'setPageCode',
275
250
  'setSourceComponentForCopy'
276
-
277
251
  ]),
278
252
  initShowDefinitionWhenUpdate(defId, workflowCode, workflowVersion) {
279
253
  window.$store.commit('wfEditor/setIsCreateDefinition', 'false')
@@ -301,6 +275,7 @@ export default {
301
275
  }
302
276
  const xml = data.xml
303
277
  this.initProcessByXml(xml, definition)
278
+ this.canvasKey++
304
279
  })
305
280
  },
306
281
  getWorkflowDefVersionList() {
@@ -334,9 +309,7 @@ export default {
334
309
  }
335
310
  },
336
311
  changeDefVersion(newDefVersion) {
337
- const defList = this.workflowDefVersionList.filter(
338
- (def) => def.definitionVersion === newDefVersion
339
- )
312
+ const defList = this.workflowDefVersionList.filter((def) => def.definitionVersion === newDefVersion)
340
313
  if (defList && defList.length > 0) {
341
314
  const newDef = defList[0]
342
315
  // 打开或新建流程图时先清空画布,开发过程中代码热更新的时候可以避免节点重复
@@ -373,6 +346,7 @@ export default {
373
346
  }
374
347
  // 得到表单字段放到vuex
375
348
  this.fetchFormFields()
349
+ this.clearCanvas()
376
350
  initializeProcessData(this.process)
377
351
  this.count = this.getMaxCount() + 1
378
352
  },
@@ -381,10 +355,10 @@ export default {
381
355
  this.process.attr.code = definition.code
382
356
  this.process.properties.basicProperties.systemCode = definition.systemCode
383
357
  if (this.pageCode) {
384
- if(!this.process.properties.parameterSettings){
358
+ if (!this.process.properties.parameterSettings) {
385
359
  this.process.properties.parameterSettings = {}
386
360
  }
387
- if(!this.process.properties.parameterSettings.doTask){
361
+ if (!this.process.properties.parameterSettings.doTask) {
388
362
  this.process.properties.parameterSettings.doTask = {}
389
363
  }
390
364
  this.process.properties.parameterSettings.doTask.url = 'page:' + this.pageCode
@@ -456,8 +430,7 @@ export default {
456
430
  lineType: transition.lineInfo.type
457
431
  }
458
432
  if (transition.lineInfo.type === 'CurveLine' && transition.lineInfo.controlPoint) {
459
- transition.ref.g.coordinate =
460
- transition.lineInfo.controlPoint.x + ',' + transition.lineInfo.controlPoint.y
433
+ transition.ref.g.coordinate = transition.lineInfo.controlPoint.x + ',' + transition.lineInfo.controlPoint.y
461
434
  } else if (transition.lineInfo.type === 'BrokenLine' && transition.lineInfo.controlPoint) {
462
435
  let coordinate = ''
463
436
  transition.lineInfo.controlPoint.forEach((point) => {
@@ -490,16 +463,14 @@ export default {
490
463
  xml: xml,
491
464
  publishVersion: this.systemPublishVersion
492
465
  }
493
- this.$http
494
- .post(this.baseAPI + '/wf-editor/workflow-definitions', param)
495
- .then((definition) => {
496
- // 表示草稿状态保存
497
- this.isShowEnable = true
498
- window.$store.commit('wfEditor/setIsCreateDefinition', 'false')
499
- this.definitionId = definition.id
500
- this.$alert(this.$t('workflowEditorMessage.savedSuccessfully'))
501
- // console.log('新建成功' + this.definitionId)
502
- })
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
+ })
503
474
  }
504
475
  },
505
476
  saveWf(xml, url, message) {
@@ -570,16 +541,14 @@ export default {
570
541
  xml: xml,
571
542
  publishVersion: this.systemPublishVersion
572
543
  }
573
- this.$http
574
- .post(this.baseAPI + '/wf-editor/workflow-definitions', param)
575
- .then((definition) => {
576
- // 表示草稿状态保存
577
- this.isShowEnable = true
578
- window.$store.commit('wfEditor/setIsCreateDefinition', 'false')
579
- this.definitionId = definition.id
580
- this.$alert(this.$t('workflowEditorMessage.savedSuccessfully'))
581
- // console.log('新建成功' + this.definitionId)
582
- })
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
+ })
583
552
  }
584
553
  },
585
554
  updateWfVersion() {
@@ -669,10 +638,7 @@ export default {
669
638
  const ref = processTemplate['new' + this.componentToDraw]()
670
639
  // 组件类型转换为首字母小写形式
671
640
  ref.attr.id =
672
- this.componentToDraw.charAt(0).toLowerCase() +
673
- this.componentToDraw.substring(1) +
674
- '_' +
675
- this.count
641
+ this.componentToDraw.charAt(0).toLowerCase() + this.componentToDraw.substring(1) + '_' + this.count
676
642
  const tache = {
677
643
  // 默认id是组件类型加上下划线和数字序号,每次打开流程图的时候都需要动态计算最大的序号,然后加1作为count的的初始值
678
644
  id: ref.attr.id,
@@ -690,26 +656,22 @@ export default {
690
656
  }
691
657
  },
692
658
  copyTache() {
693
- const sourceTache = this.selectedTaches && this.selectedTaches.length > 0? this.selectedTaches[0] : null
694
- if(!sourceTache){
659
+ const sourceTache = this.selectedTaches && this.selectedTaches.length > 0 ? this.selectedTaches[0] : null
660
+ if (!sourceTache) {
695
661
  return
696
662
  }
697
663
  const tache = JSON.parse(JSON.stringify(sourceTache))
698
664
  const tacheType = tache.type
699
665
  const ref = tache.ref
700
666
  // 组件类型转换为首字母小写形式
701
- ref.attr.id =
702
- tacheType.charAt(0).toLowerCase() +
703
- tacheType.substring(1) +
704
- '_' +
705
- this.count
667
+ ref.attr.id = tacheType.charAt(0).toLowerCase() + tacheType.substring(1) + '_' + this.count
706
668
  ref.attr.name = sourceTache.name + '_copy'
707
669
  // 默认id是组件类型加上下划线和数字序号,每次打开流程图的时候都需要动态计算最大的序号,然后加1作为count的的初始值
708
- tache.id=ref.attr.id
709
- tache.name=ref.attr.name
710
- tache.x=sourceTache.x + 20 // 偏移20个像素
711
- tache.y=sourceTache.y + 20
712
- tache.isSelected=false
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
713
675
  tache.ref = ref
714
676
  this.taches.push(tache)
715
677
  this.count++
@@ -753,13 +715,11 @@ export default {
753
715
  // 启用流程定义
754
716
  enableWf() {
755
717
  if (this.definitionId) {
756
- this.$http
757
- .put(this.baseAPI + '/wf-editor/workflow-editors/' + this.definitionId + '/states')
758
- .then(() => {
759
- this.getWorkflowDefVersionList()
760
- this.isShowEnable = false
761
- this.$alert(this.$t('workflowEditorMessage.enabledSuccessfully'))
762
- })
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
+ })
763
723
  }
764
724
  }
765
725
  }