workflow-editor 0.9.84-dw-tmp8 → 0.9.84-dw-tmp10

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 (111) hide show
  1. package/lib/workflow-editor.css +1 -1
  2. package/lib/workflow-editor.umd.min.js +5 -5
  3. package/package.json +1 -1
  4. package/packages/index.js +0 -34
  5. package/packages/plugins/formValidatorUtil.js +0 -528
  6. package/packages/plugins/index.js +0 -8
  7. package/packages/workflow-editor/index.js +0 -14
  8. package/packages/workflow-editor/src/api.js +0 -7
  9. package/packages/workflow-editor/src/assets/wf-editor-icons.js +0 -2
  10. package/packages/workflow-editor/src/constant.js +0 -8
  11. package/packages/workflow-editor/src/json-object-templates/copy-task.js +0 -67
  12. package/packages/workflow-editor/src/json-object-templates/decision.js +0 -11
  13. package/packages/workflow-editor/src/json-object-templates/end.js +0 -14
  14. package/packages/workflow-editor/src/json-object-templates/fork.js +0 -10
  15. package/packages/workflow-editor/src/json-object-templates/human-decision.js +0 -9
  16. package/packages/workflow-editor/src/json-object-templates/human-task.js +0 -199
  17. package/packages/workflow-editor/src/json-object-templates/join.js +0 -10
  18. package/packages/workflow-editor/src/json-object-templates/process.js +0 -98
  19. package/packages/workflow-editor/src/json-object-templates/start.js +0 -13
  20. package/packages/workflow-editor/src/json-object-templates/subprocess.js +0 -30
  21. package/packages/workflow-editor/src/json-object-templates/transition.js +0 -26
  22. package/packages/workflow-editor/src/main/admin-save-dialog.vue +0 -66
  23. package/packages/workflow-editor/src/main/canvas.vue +0 -479
  24. package/packages/workflow-editor/src/main/context-menu.vue +0 -132
  25. package/packages/workflow-editor/src/main/icon-svg.vue +0 -32
  26. package/packages/workflow-editor/src/main/selection-region.vue +0 -66
  27. package/packages/workflow-editor/src/main/tache-history-tooltip.vue +0 -38
  28. package/packages/workflow-editor/src/main/tache-name-input.vue +0 -19
  29. package/packages/workflow-editor/src/main/tache-subprocess-history-dialog.vue +0 -35
  30. package/packages/workflow-editor/src/main/toolbox.vue +0 -60
  31. package/packages/workflow-editor/src/main/wf-history-canvas.vue +0 -302
  32. package/packages/workflow-editor/src/process-json.js +0 -622
  33. package/packages/workflow-editor/src/process-service.js +0 -31
  34. package/packages/workflow-editor/src/properties-editors/common/additional-condition-utils.js +0 -522
  35. package/packages/workflow-editor/src/properties-editors/common/additional-condition.vue +0 -276
  36. package/packages/workflow-editor/src/properties-editors/common/auto-filled-fields-utils.js +0 -34
  37. package/packages/workflow-editor/src/properties-editors/common/auto-filled-fields.vue +0 -239
  38. package/packages/workflow-editor/src/properties-editors/common/common-notice-tool.vue +0 -47
  39. package/packages/workflow-editor/src/properties-editors/common/common-user-condition.vue +0 -241
  40. package/packages/workflow-editor/src/properties-editors/common/form-fields-utils.js +0 -23
  41. package/packages/workflow-editor/src/properties-editors/common/form-fields.vue +0 -116
  42. package/packages/workflow-editor/src/properties-editors/common/i18n-input.vue +0 -75
  43. package/packages/workflow-editor/src/properties-editors/common/i18n-set-dialog.vue +0 -125
  44. package/packages/workflow-editor/src/properties-editors/common/notice.vue +0 -98
  45. package/packages/workflow-editor/src/properties-editors/common/reminder.vue +0 -179
  46. package/packages/workflow-editor/src/properties-editors/common/select-mail-template.vue +0 -83
  47. package/packages/workflow-editor/src/properties-editors/common/standard-fields.vue +0 -65
  48. package/packages/workflow-editor/src/properties-editors/common/system-role-tree-inline.vue +0 -355
  49. package/packages/workflow-editor/src/properties-editors/common/system-role-tree.vue +0 -63
  50. package/packages/workflow-editor/src/properties-editors/common/task-title.vue +0 -148
  51. package/packages/workflow-editor/src/properties-editors/common/transactor-settings.vue +0 -220
  52. package/packages/workflow-editor/src/properties-editors/common/user-selection.vue +0 -386
  53. package/packages/workflow-editor/src/properties-editors/common/value-selection-dialog.vue +0 -209
  54. package/packages/workflow-editor/src/properties-editors/common/variables.vue +0 -135
  55. package/packages/workflow-editor/src/properties-editors/copy-task/basic-properties.vue +0 -90
  56. package/packages/workflow-editor/src/properties-editors/copy-task/permission-settings.vue +0 -155
  57. package/packages/workflow-editor/src/properties-editors/copy-task.vue +0 -80
  58. package/packages/workflow-editor/src/properties-editors/decision.vue +0 -90
  59. package/packages/workflow-editor/src/properties-editors/fork.vue +0 -72
  60. package/packages/workflow-editor/src/properties-editors/human-decision.vue +0 -44
  61. package/packages/workflow-editor/src/properties-editors/human-task/additional-condition-dialog.vue +0 -60
  62. package/packages/workflow-editor/src/properties-editors/human-task/basic-properties.vue +0 -156
  63. package/packages/workflow-editor/src/properties-editors/human-task/componentsConfigUtil.js +0 -291
  64. package/packages/workflow-editor/src/properties-editors/human-task/custom-actions.vue +0 -249
  65. package/packages/workflow-editor/src/properties-editors/human-task/editable-child-field-setting.vue +0 -392
  66. package/packages/workflow-editor/src/properties-editors/human-task/editable-child-fields.vue +0 -241
  67. package/packages/workflow-editor/src/properties-editors/human-task/editable-field-selection.vue +0 -220
  68. package/packages/workflow-editor/src/properties-editors/human-task/editable-fields.vue +0 -204
  69. package/packages/workflow-editor/src/properties-editors/human-task/events.vue +0 -59
  70. package/packages/workflow-editor/src/properties-editors/human-task/permission-settings.vue +0 -207
  71. package/packages/workflow-editor/src/properties-editors/human-task/selection-conditions.vue +0 -390
  72. package/packages/workflow-editor/src/properties-editors/human-task.vue +0 -103
  73. package/packages/workflow-editor/src/properties-editors/join.vue +0 -44
  74. package/packages/workflow-editor/src/properties-editors/process/basic-properties.vue +0 -273
  75. package/packages/workflow-editor/src/properties-editors/process/events.vue +0 -76
  76. package/packages/workflow-editor/src/properties-editors/process/notice-settings.vue +0 -60
  77. package/packages/workflow-editor/src/properties-editors/process/parameter-settings.vue +0 -95
  78. package/packages/workflow-editor/src/properties-editors/process/permission-settings.vue +0 -28
  79. package/packages/workflow-editor/src/properties-editors/process/selectPage.vue +0 -81
  80. package/packages/workflow-editor/src/properties-editors/process.vue +0 -109
  81. package/packages/workflow-editor/src/properties-editors/subprocess/basic-properties.vue +0 -176
  82. package/packages/workflow-editor/src/properties-editors/subprocess/events.vue +0 -26
  83. package/packages/workflow-editor/src/properties-editors/subprocess/field-mappings.vue +0 -206
  84. package/packages/workflow-editor/src/properties-editors/subprocess/transactor-settings.vue +0 -64
  85. package/packages/workflow-editor/src/properties-editors/subprocess.vue +0 -79
  86. package/packages/workflow-editor/src/properties-editors/transition/basic-properties.vue +0 -53
  87. package/packages/workflow-editor/src/properties-editors/transition.vue +0 -74
  88. package/packages/workflow-editor/src/properties-editors/user-condition.js +0 -177
  89. package/packages/workflow-editor/src/store/getters.js +0 -27
  90. package/packages/workflow-editor/src/store/workflow-editor.js +0 -125
  91. package/packages/workflow-editor/src/taches/common-methods.js +0 -21
  92. package/packages/workflow-editor/src/taches/copy-task.vue +0 -99
  93. package/packages/workflow-editor/src/taches/custom-task.vue +0 -88
  94. package/packages/workflow-editor/src/taches/decision.vue +0 -102
  95. package/packages/workflow-editor/src/taches/end.vue +0 -76
  96. package/packages/workflow-editor/src/taches/fork.vue +0 -102
  97. package/packages/workflow-editor/src/taches/human-decision.vue +0 -102
  98. package/packages/workflow-editor/src/taches/human-task.vue +0 -113
  99. package/packages/workflow-editor/src/taches/join.vue +0 -91
  100. package/packages/workflow-editor/src/taches/joint.vue +0 -177
  101. package/packages/workflow-editor/src/taches/start.vue +0 -76
  102. package/packages/workflow-editor/src/taches/subprocess.vue +0 -99
  103. package/packages/workflow-editor/src/taches/tache-resizer.vue +0 -80
  104. package/packages/workflow-editor/src/transitions/broken-line.vue +0 -91
  105. package/packages/workflow-editor/src/transitions/curve-line.vue +0 -91
  106. package/packages/workflow-editor/src/transitions/straight-line.vue +0 -26
  107. package/packages/workflow-editor/src/transitions/transition.vue +0 -212
  108. package/packages/workflow-editor/src/transitions/virtual-transition.vue +0 -43
  109. package/packages/workflow-editor/src/util.js +0 -493
  110. package/packages/workflow-editor/src/workflow-editor.vue +0 -605
  111. package/packages/workflow-editor/src/workflow-history.vue +0 -153
@@ -1,177 +0,0 @@
1
- <template>
2
- <g @mousedown.stop="">
3
- <rect
4
- :x="jointContainer.x"
5
- :y="jointContainer.y"
6
- :class="{'joint-container':true,'joint-activated':isActivated}"
7
- width="20"
8
- height="20"
9
- rx="3"
10
- ry="3"
11
- @mousemove.stop="enterJoint"
12
- @mouseout.stop="leaveJoint"
13
- @mousedown.stop="setContextMenuVisible(false);setStartJoint({parent:parent,position:position})"
14
- @mouseup="mouseup"
15
- />
16
- <circle v-show="!isActivated" :cx="joint.x" :cy="joint.y" r="3" class="joint" />
17
- </g>
18
- </template>
19
- <script>
20
- import { mapGetters, mapMutations } from 'vuex'
21
- import { getJoint, processTemplate, findOutgoingTransitionsByTacheId } from '../util'
22
- export default {
23
- name: 'Joint',
24
- props: {
25
- parent: {
26
- type: Object,
27
- default: null
28
- },
29
- position: {
30
- type: String,
31
- default: null
32
- }
33
- },
34
- data() {
35
- return {
36
- isActivated: false
37
- }
38
- },
39
- computed: {
40
- ...mapGetters('wfEditor', [
41
- 'transitions',
42
- 'startJoint',
43
- 'endJoint',
44
- 'draggerToMove'
45
- ]),
46
- joint() {
47
- return getJoint(this.parent, this.position)
48
- },
49
- jointContainer() {
50
- return {
51
- x: this.joint.x - 10,
52
- y: this.joint.y - 10
53
- }
54
- }
55
- },
56
- methods: {
57
- ...mapMutations('wfEditor', [
58
- 'setStartJoint',
59
- 'setEndJoint',
60
- 'stopDrawingLine',
61
- 'setDraggerToMove',
62
- 'setContextMenuVisible'
63
- ]),
64
- // 流向是否有效的判断规则
65
- isValidTransition(startJoint, endJoint) {
66
- // 防御性编程,没有起点就直接是无效流向了,确保后续代码一定能取到startJoint
67
- if (!startJoint) return false
68
- // 目前不支持transition的起点和终点都在同一个环节上,如果需要自循环的节点,可以改这里
69
- if (startJoint.parent === endJoint.parent) {
70
- this.$alert(this.$t('workflowEditorMessage.theStartAndEndOfTheFlowDirectionCannotBeTheSame'))
71
- return false
72
- }
73
- if (startJoint.parent.type !== 'Decision' && startJoint.parent.type !== 'Fork' && startJoint.parent.type !== 'HumanDecision') {
74
- // 除了分支和条件判断节点外,其他节点只能有一条外出流向,那么新建流向时,这些节点上的流向数量应该为零
75
- let maxCount = 0
76
- // 移动流向的端点后,流向的起始环节上最多只能有一条外出流向
77
- if (this.draggerToMove) {
78
- maxCount = 1
79
- }
80
- const transitions = findOutgoingTransitionsByTacheId(startJoint.parent.id)
81
- if (transitions.length > maxCount) {
82
- this.$alert(this.$t('workflowEditorMessage.onlyConditionJudgmentBranchAndManualJudgmentCanHaveMultipleOutboundFlows'))
83
- return false
84
- }
85
- }
86
-
87
- if (startJoint.parent.type === 'Start' && endJoint.parent.type === 'End') {
88
- this.$alert(this.$t('workflowEditorMessage.startAndEndNodesCannotBeConnectedDirectly'))
89
- return false
90
- }
91
- if (startJoint.parent.type === 'End') {
92
- this.$alert(this.$t('workflowEditorMessage.endNodeCannotHaveOutFlowDirection'))
93
- return false
94
- }
95
- return true
96
- },
97
- mouseup() {
98
- console.log('joint mouseup')
99
- // 如果正在移动transition
100
- if (this.draggerToMove) {
101
- const position = this.draggerToMove.position
102
- const joint = { parent: this.parent, position: this.position }
103
- if (position === 'start') {
104
- this.draggerToMove.owner.startJoint = joint
105
- } else {
106
- this.draggerToMove.owner.endJoint = joint
107
- }
108
- if (this.isValidTransition(this.draggerToMove.owner.startJoint, this.draggerToMove.owner.endJoint)) {
109
- // 改变流向的id和xml的对应信息
110
- const transition = this.draggerToMove.owner
111
- transition.id = 'flow_' + transition.startJoint.parent.id + '_to_' + transition.endJoint.parent.id
112
- transition.ref.attr = {
113
- id: transition.id,
114
- from: transition.startJoint.parent.id,
115
- to: transition.endJoint.parent.id
116
- }
117
- } else {
118
- // 改变端点无效时还原流向
119
- this.draggerToMove.owner.startJoint = this.draggerToMove.originStartJoint
120
- this.draggerToMove.owner.endJoint = this.draggerToMove.originEndJoint
121
- }
122
-
123
- this.setDraggerToMove(null)
124
- } else {
125
- // 说明正在画流向
126
- this.addTransition()
127
- }
128
- },
129
- addTransition() {
130
- const endJoint = { parent: this.parent, position: this.position }
131
- if (this.isValidTransition(this.startJoint, endJoint)) {
132
- this.setEndJoint(endJoint)
133
- const transition = {
134
- id: 'flow_' + this.startJoint.parent.id + '_to_' + this.endJoint.parent.id,
135
- startJoint: this.startJoint,
136
- endJoint: this.endJoint,
137
- isSelected: false,
138
- // controlPoint这个属性也得定义,动态增加的属性vue默认是不监听的(除非用vue.$set方法),就不会有任何动态效果
139
- lineInfo: { type: 'StraightLine', controlPoint: null }
140
- }
141
- transition.ref = processTemplate.newTransition()
142
- transition.ref.attr = {
143
- id: transition.id,
144
- from: this.startJoint.parent.id,
145
- to: this.endJoint.parent.id
146
- }
147
- this.transitions.push(transition)
148
- }
149
- this.stopDrawingLine()
150
- },
151
- enterJoint() {
152
- this.isActivated = true
153
- this.$emit('enter-joint')
154
- },
155
- leaveJoint() {
156
- this.isActivated = false
157
- this.$emit('leave-joint')
158
- }
159
- }
160
- }
161
- </script>
162
- <style>
163
- .joint-container{
164
- stroke-width: 0;
165
- fill: #fff;
166
- fill-opacity: 0
167
- }
168
- .joint{
169
- fill:#00f;
170
- stroke-width: 1px
171
- }
172
- .joint-activated{
173
- fill: #f00;
174
- stroke-width:1px;
175
- fill-opacity: 1;
176
- }
177
- </style>
@@ -1,76 +0,0 @@
1
- <template>
2
- <g
3
- @mousedown.stop="startDrag"
4
- @mouseup="endDrag"
5
- @mouseenter="showJoints"
6
- @mouseleave="hideJoints"
7
- @dblclick.stop="setPropertiesEditorFor('')"
8
- >
9
- <rect
10
- :width="model.width"
11
- :height="model.height"
12
- :class="{'draggable':true,'start':!model.isSelected, 'selected':model.isSelected}"
13
- :x="model.x"
14
- :y="model.y"
15
- rx="6"
16
- ry="6"
17
- />
18
- <use
19
- xlink:href="#icon-start"
20
- :x="model.x"
21
- :y="model.y"
22
- :width="model.width"
23
- :height="model.height"
24
- fill="#67C23A"
25
- class="draggable"
26
- />
27
- <joint
28
- v-for="position in jointPoints"
29
- :key="position"
30
- :parent="model"
31
- :position="position"
32
- />
33
- </g>
34
- </template>
35
- <script>
36
- import { mapGetters, mapMutations } from 'vuex'
37
- import Joint from './joint'
38
- import tacheMethods from './common-methods'
39
- export default {
40
- name: 'Start',
41
- components: {
42
- Joint
43
- },
44
- props: {
45
- model: {
46
- type: Object,
47
- default: null
48
- }
49
- },
50
- data() {
51
- return {
52
- // 一个tache有上右下左四个连接点,这四个连接点的坐标根据tache的位置和大小计算出来
53
- jointPoints: []
54
- }
55
- },
56
- computed: {
57
- ...mapGetters('wfEditor', [
58
- 'selectedTaches'
59
- ])
60
- },
61
- methods: {
62
- ...mapMutations('wfEditor', [
63
- 'setPropertiesEditorFor',
64
- 'setContextMenuVisible'
65
- ]),
66
- ...tacheMethods
67
- }
68
- }
69
- </script>
70
- <style>
71
- .start{
72
- stroke-width: 0;
73
- fill:#fff;
74
- }
75
- </style>
76
-
@@ -1,99 +0,0 @@
1
- <template>
2
- <g
3
- @mousedown.stop="startDrag"
4
- @mouseup="endDrag"
5
- @mouseenter="showJoints"
6
- @mouseleave="hideJoints"
7
- @dblclick.stop="setPropertiesEditorFor('Subprocess')"
8
- >
9
- <rect
10
- ref="tache"
11
- :width="model.width"
12
- :height="model.height"
13
- :class="{'draggable':true,'task-tache':true, 'selected':model.isSelected}"
14
- :x="model.x"
15
- :y="model.y"
16
- rx="6"
17
- ry="6"
18
- />
19
- <text
20
- :x="text.x"
21
- :y="text.y"
22
- text-anchor="middle"
23
- class="draggable"
24
- >
25
- {{ name }}
26
- </text>
27
- <joint
28
- v-for="position in jointPoints"
29
- :key="position"
30
- :parent="model"
31
- :position="position"
32
- />
33
- <tache-resizer
34
- v-for="position in resizers"
35
- :key="position"
36
- :owner="model"
37
- :position="position"
38
- />
39
- </g>
40
- </template>
41
- <script>
42
- import { mapGetters, mapMutations } from 'vuex'
43
- import Joint from './joint'
44
- import TacheResizer from './tache-resizer'
45
- import tacheMethods from './common-methods'
46
- import { watchShowName } from '../util'
47
- export default {
48
- name: 'Subprocess',
49
- components: {
50
- Joint,
51
- TacheResizer
52
- },
53
- props: {
54
- model: {
55
- type: Object,
56
- default: null
57
- }
58
- },
59
- data() {
60
- return {
61
- // 一个tache有上右下左四个连接点,这四个连接点的坐标根据tache的位置和大小计算出来
62
- jointPoints: [],
63
- resizers: ['NW', 'NE', 'SW', 'SE'],
64
- name: this.model.name
65
- }
66
- },
67
- computed: {
68
- ...mapGetters('wfEditor', [
69
- 'selectedTaches',
70
- 'processI18n'
71
- ]),
72
- text() {
73
- return {
74
- x: this.model.x + this.model.width / 2,
75
- y: this.model.y + this.model.height / 2
76
- }
77
- }
78
- },
79
- created() {
80
- this.name = watchShowName(this, this.name)
81
- },
82
- mounted() {
83
- this.$watch('model.name', function(newVal) {
84
- this.name = watchShowName(this, newVal)
85
- })
86
- },
87
- methods: {
88
- ...mapMutations('wfEditor', [
89
- 'setPropertiesEditorFor',
90
- 'setContextMenuVisible'
91
- ]),
92
- ...tacheMethods
93
- }
94
- }
95
- </script>
96
- <style>
97
-
98
- </style>
99
-
@@ -1,80 +0,0 @@
1
- <template>
2
- <rect
3
- v-if="owner.isSelected&&selectedTaches.length==1"
4
- :x="area.x"
5
- :y="area.y"
6
- :width="area.width"
7
- :height="area.height"
8
- :style="{cursor:area.cursor}"
9
- class="resizer"
10
- @mousedown.stop="setContextMenuVisible(false);setResizerToMove({owner,position})"
11
- @mouseup.stop="setResizerToMove(null)"
12
- />
13
- </template>
14
- <script>
15
- import { mapGetters, mapMutations } from 'vuex'
16
- export default {
17
- name: 'TacheResizer',
18
- props: {
19
- owner: {
20
- type: Object,
21
- default: null
22
- },
23
- position: {
24
- type: String,
25
- default: ''
26
- }
27
- },
28
- computed: {
29
- ...mapGetters('wfEditor', [
30
- 'selectedTaches'
31
- ]),
32
- area() {
33
- const width = 8
34
- const height = 8
35
- let x, y
36
- switch (this.position) {
37
- case 'NW':
38
- x = this.owner.x
39
- y = this.owner.y
40
- break
41
- case 'NE':
42
- x = this.owner.x + this.owner.width
43
- y = this.owner.y
44
- break
45
- case 'SW':
46
- x = this.owner.x
47
- y = this.owner.y + this.owner.height
48
- break
49
- case 'SE':
50
- x = this.owner.x + this.owner.width
51
- y = this.owner.y + this.owner.height
52
- break
53
- }
54
- // 环节的四个顶点是resizer的中心点
55
- x = x - width / 2
56
- y = y - height / 2
57
- const cursor = this.position.toLowerCase() + '-resize'
58
- return {
59
- x, y, width, height, cursor
60
- }
61
- }
62
- },
63
- methods: {
64
- ...mapMutations('wfEditor', [
65
- 'setMovingResizer',
66
- 'setResizerToMove',
67
- 'setContextMenuVisible'
68
- ])
69
-
70
- }
71
- }
72
- </script>
73
- <style>
74
- .resizer{
75
- stroke: blue;
76
- stroke-width: 1;
77
- fill: white;
78
- }
79
- </style>
80
-
@@ -1,91 +0,0 @@
1
- <template>
2
- <g>
3
- <path
4
- :d="path"
5
- marker-end="url(#arrow)"
6
- />
7
- <template v-if="owner.isSelected">
8
- <template v-if="controlPoint">
9
- <circle
10
- v-for="(point,index) in controlPoint"
11
- :key="point.x+point.y"
12
- :cx="point.x"
13
- :cy="point.y"
14
- r="3"
15
- class="control-point"
16
- @mousedown.stop="startDrag(index, $event)"
17
- @mouseup.stop="endDrag"
18
- />
19
- </template>
20
- </template>
21
- </g>
22
- </template>
23
- <script>
24
- import { getJoint } from '../util'
25
- import { mapMutations } from 'vuex'
26
- export default {
27
- name: 'BrokenLine',
28
- props: {
29
- owner: {
30
- type: Object,
31
- default: null
32
- }
33
- },
34
- computed: {
35
- // 二次贝塞尔曲线由两个端点和一个控制点组成,Q命令就是用来画二次曲线的
36
- startPoint() {
37
- return getJoint(this.owner.startJoint.parent, this.owner.startJoint.position)
38
- },
39
- endPoint() {
40
- return getJoint(this.owner.endJoint.parent, this.owner.endJoint.position)
41
- },
42
- controlPoint() {
43
- return this.owner.lineInfo.controlPoint
44
- },
45
- path() {
46
- let myPath = 'M ' + this.startPoint.x + ' ' + this.startPoint.y + ' '
47
- if (this.controlPoint) {
48
- this.controlPoint.forEach(point => {
49
- myPath += 'L ' + point.x + ' ' + point.y
50
- })
51
- }
52
- myPath += 'L ' + this.endPoint.x + ' ' + this.endPoint.y
53
- return myPath
54
- }
55
- },
56
- created: function() {
57
- console.log('this.owner.lineInfo=', this.owner.lineInfo)
58
- // controlPoint没有值是需要给一个初始值:默认的控制点是起点的x坐标和终点的y坐标结合
59
- if (!this.owner.lineInfo.controlPoint) {
60
- const x = this.startPoint.x + (this.endPoint.x - this.startPoint.x) / 2
61
- const y = this.startPoint.y + (this.endPoint.y - this.startPoint.y) / 2
62
- this.owner.lineInfo.controlPoint = [{ x, y }]
63
- }
64
- },
65
- methods: {
66
- ...mapMutations('wfEditor', [
67
- 'setControlPointToMove'
68
- ]),
69
- startDrag(pointIndex, $event) {
70
- console.log('brokenLine--startDrag-----')
71
- this.setControlPointToMove({
72
- owner: this.owner,
73
- pointIndex: pointIndex
74
- })
75
- },
76
- endDrag() {
77
- this.setControlPointToMove(null)
78
- }
79
- }
80
- }
81
- </script>
82
- <style scoped>
83
- .control-point{
84
- fill: #fff;
85
- cursor: move;
86
- }
87
- .control-line {
88
- stroke-dasharray: 2 2
89
- }
90
- </style>
91
-
@@ -1,91 +0,0 @@
1
- <template>
2
- <g>
3
- <path
4
- :d="path"
5
- marker-end="url(#arrow)"
6
- />
7
- <template v-if="owner.isSelected">
8
- <path :d="pathToStartPoint" class="control-line" />
9
- <path :d="pathToEndPoint" class="control-line" />
10
- <circle
11
- :cx="controlPoint.x"
12
- :cy="controlPoint.y"
13
- r="3"
14
- class="control-point"
15
- @mousedown.stop="startDrag"
16
- @mouseup.stop="endDrag"
17
- />
18
- </template>
19
- </g>
20
- </template>
21
- <script>
22
- import { getJoint } from '../util'
23
- import { mapMutations } from 'vuex'
24
- export default {
25
- name: 'CurveLine',
26
- props: {
27
- owner: {
28
- type: Object,
29
- default: null
30
- }
31
- },
32
- computed: {
33
- // 二次贝塞尔曲线由两个端点和一个控制点组成,Q命令就是用来画二次曲线的
34
- startPoint() {
35
- return getJoint(this.owner.startJoint.parent, this.owner.startJoint.position)
36
- },
37
- endPoint() {
38
- return getJoint(this.owner.endJoint.parent, this.owner.endJoint.position)
39
- },
40
- controlPoint() {
41
- return this.owner.lineInfo.controlPoint
42
- },
43
- path() {
44
- return 'M ' + this.startPoint.x + ' ' + this.startPoint.y + ' ' +
45
- 'Q ' + this.controlPoint.x + ' ' + this.controlPoint.y + ' ' +
46
- this.endPoint.x + ' ' + this.endPoint.y
47
- },
48
- pathToStartPoint() {
49
- return 'M ' + this.controlPoint.x + ' ' + this.controlPoint.y +
50
- 'L ' + this.startPoint.x + ' ' + this.startPoint.y
51
- },
52
- pathToEndPoint() {
53
- return 'M ' + this.controlPoint.x + ' ' + this.controlPoint.y +
54
- 'L ' + this.endPoint.x + ' ' + this.endPoint.y
55
- }
56
- },
57
- created: function() {
58
- // controlPoint没有值是需要给一个初始值:默认的控制点是起点的x坐标和终点的y坐标结合
59
- if (!this.owner.lineInfo.controlPoint) {
60
- let x = this.startPoint.x + (this.endPoint.x - this.startPoint.x) / 2
61
- if (x + 10 < this.startPoint.x || x < this.startPoint.x + 10) {
62
- x = this.startPoint.x + 30
63
- }
64
- this.owner.lineInfo.controlPoint = { x, y: this.endPoint.y }
65
- }
66
- },
67
- methods: {
68
- ...mapMutations('wfEditor', [
69
- 'setControlPointToMove'
70
- ]),
71
- startDrag(event) {
72
- this.setControlPointToMove({
73
- owner: this.owner
74
- })
75
- },
76
- endDrag() {
77
- this.setControlPointToMove(null)
78
- }
79
- }
80
- }
81
- </script>
82
- <style scoped>
83
- .control-point{
84
- fill: #fff;
85
- cursor: move;
86
- }
87
- .control-line {
88
- stroke-dasharray: 2 2
89
- }
90
- </style>
91
-
@@ -1,26 +0,0 @@
1
- <template>
2
- <path
3
- :d="path"
4
- marker-end="url(#arrow)"
5
- />
6
- </template>
7
- <script>
8
- import { getJoint } from '../util'
9
- export default {
10
- name: 'StraightLine',
11
- props: {
12
- owner: {
13
- type: Object,
14
- default: null
15
- }
16
- },
17
- computed: {
18
- path() {
19
- const startPoint = getJoint(this.owner.startJoint.parent, this.owner.startJoint.position)
20
- const endPoint = getJoint(this.owner.endJoint.parent, this.owner.endJoint.position)
21
- return 'M' + startPoint.x + ' ' + startPoint.y + ' L' + endPoint.x + ' ' + endPoint.y
22
- }
23
- }
24
- }
25
- </script>
26
-