workflow-editor 0.9.65 → 0.9.66
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/lib/workflow-editor.css +1 -1
- package/lib/workflow-editor.umd.min.js +10 -10
- package/package.json +2 -2
- package/packages/index.js +34 -0
- package/packages/plugins/formValidatorUtil.js +528 -0
- package/packages/plugins/index.js +8 -0
- package/packages/workflow-editor/index.js +14 -0
- package/packages/workflow-editor/src/api.js +7 -0
- package/packages/workflow-editor/src/assets/wf-editor-icons.js +2 -0
- package/packages/workflow-editor/src/constant.js +8 -0
- package/packages/workflow-editor/src/json-object-templates/copy-task.js +67 -0
- package/packages/workflow-editor/src/json-object-templates/decision.js +11 -0
- package/packages/workflow-editor/src/json-object-templates/end.js +14 -0
- package/packages/workflow-editor/src/json-object-templates/fork.js +10 -0
- package/packages/workflow-editor/src/json-object-templates/human-decision.js +9 -0
- package/packages/workflow-editor/src/json-object-templates/human-task.js +199 -0
- package/packages/workflow-editor/src/json-object-templates/join.js +10 -0
- package/packages/workflow-editor/src/json-object-templates/process.js +98 -0
- package/packages/workflow-editor/src/json-object-templates/start.js +13 -0
- package/packages/workflow-editor/src/json-object-templates/subprocess.js +30 -0
- package/packages/workflow-editor/src/json-object-templates/transition.js +26 -0
- package/packages/workflow-editor/src/main/admin-save-dialog.vue +66 -0
- package/packages/workflow-editor/src/main/canvas.vue +479 -0
- package/packages/workflow-editor/src/main/context-menu.vue +132 -0
- package/packages/workflow-editor/src/main/icon-svg.vue +32 -0
- package/packages/workflow-editor/src/main/selection-region.vue +66 -0
- package/packages/workflow-editor/src/main/tache-history-tooltip.vue +38 -0
- package/packages/workflow-editor/src/main/tache-name-input.vue +19 -0
- package/packages/workflow-editor/src/main/tache-subprocess-history-dialog.vue +35 -0
- package/packages/workflow-editor/src/main/toolbox.vue +60 -0
- package/packages/workflow-editor/src/main/wf-history-canvas.vue +302 -0
- package/packages/workflow-editor/src/process-json.js +622 -0
- package/packages/workflow-editor/src/process-service.js +31 -0
- package/packages/workflow-editor/src/properties-editors/common/additional-condition-utils.js +531 -0
- package/packages/workflow-editor/src/properties-editors/common/additional-condition.vue +276 -0
- package/packages/workflow-editor/src/properties-editors/common/auto-filled-fields-utils.js +34 -0
- package/packages/workflow-editor/src/properties-editors/common/auto-filled-fields.vue +239 -0
- package/packages/workflow-editor/src/properties-editors/common/common-notice-tool.vue +47 -0
- package/packages/workflow-editor/src/properties-editors/common/common-user-condition.vue +241 -0
- package/packages/workflow-editor/src/properties-editors/common/form-fields-utils.js +23 -0
- package/packages/workflow-editor/src/properties-editors/common/form-fields.vue +116 -0
- package/packages/workflow-editor/src/properties-editors/common/i18n-input.vue +75 -0
- package/packages/workflow-editor/src/properties-editors/common/i18n-set-dialog.vue +125 -0
- package/packages/workflow-editor/src/properties-editors/common/notice.vue +98 -0
- package/packages/workflow-editor/src/properties-editors/common/reminder.vue +179 -0
- package/packages/workflow-editor/src/properties-editors/common/select-mail-template.vue +83 -0
- package/packages/workflow-editor/src/properties-editors/common/standard-fields.vue +65 -0
- package/packages/workflow-editor/src/properties-editors/common/system-role-tree-inline.vue +355 -0
- package/packages/workflow-editor/src/properties-editors/common/system-role-tree.vue +63 -0
- package/packages/workflow-editor/src/properties-editors/common/task-title.vue +148 -0
- package/packages/workflow-editor/src/properties-editors/common/transactor-settings.vue +233 -0
- package/packages/workflow-editor/src/properties-editors/common/user-selection.vue +386 -0
- package/packages/workflow-editor/src/properties-editors/common/value-selection-dialog.vue +209 -0
- package/packages/workflow-editor/src/properties-editors/common/variables.vue +135 -0
- package/packages/workflow-editor/src/properties-editors/copy-task/basic-properties.vue +90 -0
- package/packages/workflow-editor/src/properties-editors/copy-task/permission-settings.vue +155 -0
- package/packages/workflow-editor/src/properties-editors/copy-task.vue +80 -0
- package/packages/workflow-editor/src/properties-editors/decision.vue +90 -0
- package/packages/workflow-editor/src/properties-editors/fork.vue +72 -0
- package/packages/workflow-editor/src/properties-editors/human-decision.vue +44 -0
- package/packages/workflow-editor/src/properties-editors/human-task/additional-condition-dialog.vue +60 -0
- package/packages/workflow-editor/src/properties-editors/human-task/basic-properties.vue +156 -0
- package/packages/workflow-editor/src/properties-editors/human-task/componentsConfigUtil.js +291 -0
- package/packages/workflow-editor/src/properties-editors/human-task/custom-actions.vue +249 -0
- package/packages/workflow-editor/src/properties-editors/human-task/editable-child-field-setting.vue +392 -0
- package/packages/workflow-editor/src/properties-editors/human-task/editable-child-fields.vue +241 -0
- package/packages/workflow-editor/src/properties-editors/human-task/editable-field-selection.vue +220 -0
- package/packages/workflow-editor/src/properties-editors/human-task/editable-fields.vue +204 -0
- package/packages/workflow-editor/src/properties-editors/human-task/events.vue +59 -0
- package/packages/workflow-editor/src/properties-editors/human-task/permission-settings.vue +207 -0
- package/packages/workflow-editor/src/properties-editors/human-task/selection-conditions.vue +390 -0
- package/packages/workflow-editor/src/properties-editors/human-task.vue +103 -0
- package/packages/workflow-editor/src/properties-editors/join.vue +44 -0
- package/packages/workflow-editor/src/properties-editors/process/basic-properties.vue +273 -0
- package/packages/workflow-editor/src/properties-editors/process/events.vue +76 -0
- package/packages/workflow-editor/src/properties-editors/process/notice-settings.vue +60 -0
- package/packages/workflow-editor/src/properties-editors/process/parameter-settings.vue +95 -0
- package/packages/workflow-editor/src/properties-editors/process/permission-settings.vue +28 -0
- package/packages/workflow-editor/src/properties-editors/process/selectPage.vue +81 -0
- package/packages/workflow-editor/src/properties-editors/process.vue +109 -0
- package/packages/workflow-editor/src/properties-editors/subprocess/basic-properties.vue +187 -0
- package/packages/workflow-editor/src/properties-editors/subprocess/events.vue +26 -0
- package/packages/workflow-editor/src/properties-editors/subprocess/field-mappings.vue +206 -0
- package/packages/workflow-editor/src/properties-editors/subprocess/transactor-settings.vue +64 -0
- package/packages/workflow-editor/src/properties-editors/subprocess.vue +79 -0
- package/packages/workflow-editor/src/properties-editors/transition/basic-properties.vue +53 -0
- package/packages/workflow-editor/src/properties-editors/transition.vue +74 -0
- package/packages/workflow-editor/src/properties-editors/user-condition.js +177 -0
- package/packages/workflow-editor/src/store/getters.js +27 -0
- package/packages/workflow-editor/src/store/workflow-editor.js +125 -0
- package/packages/workflow-editor/src/taches/common-methods.js +21 -0
- package/packages/workflow-editor/src/taches/copy-task.vue +99 -0
- package/packages/workflow-editor/src/taches/custom-task.vue +88 -0
- package/packages/workflow-editor/src/taches/decision.vue +102 -0
- package/packages/workflow-editor/src/taches/end.vue +76 -0
- package/packages/workflow-editor/src/taches/fork.vue +102 -0
- package/packages/workflow-editor/src/taches/human-decision.vue +102 -0
- package/packages/workflow-editor/src/taches/human-task.vue +113 -0
- package/packages/workflow-editor/src/taches/join.vue +91 -0
- package/packages/workflow-editor/src/taches/joint.vue +177 -0
- package/packages/workflow-editor/src/taches/start.vue +76 -0
- package/packages/workflow-editor/src/taches/subprocess.vue +99 -0
- package/packages/workflow-editor/src/taches/tache-resizer.vue +80 -0
- package/packages/workflow-editor/src/transitions/broken-line.vue +91 -0
- package/packages/workflow-editor/src/transitions/curve-line.vue +91 -0
- package/packages/workflow-editor/src/transitions/straight-line.vue +26 -0
- package/packages/workflow-editor/src/transitions/transition.vue +212 -0
- package/packages/workflow-editor/src/transitions/virtual-transition.vue +43 -0
- package/packages/workflow-editor/src/util.js +493 -0
- package/packages/workflow-editor/src/workflow-editor.vue +605 -0
- package/packages/workflow-editor/src/workflow-history.vue +153 -0
- package/src/i18n/langs/cn.js +4 -1
- package/src/i18n/langs/en.js +4 -1
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<el-card class="box-card">
|
|
4
|
+
<span v-for="(mapValue, key) in subtableConditionMap" :key="key">
|
|
5
|
+
<div slot="header" class="clearfix">
|
|
6
|
+
<el-row>
|
|
7
|
+
<el-col :span="12">
|
|
8
|
+
<span>{{ key }}</span>
|
|
9
|
+
</el-col>
|
|
10
|
+
<el-col v-if="selectedFieldMap[key]" :span="12">
|
|
11
|
+
<el-switch
|
|
12
|
+
v-model="selectedFieldMap[key].sumPermission"
|
|
13
|
+
:inactive-text="$t('workflowEditor.condition.accessControl')"
|
|
14
|
+
@change="changeSumPermission(key)"
|
|
15
|
+
/>
|
|
16
|
+
</el-col>
|
|
17
|
+
</el-row>
|
|
18
|
+
<el-row>
|
|
19
|
+
<el-col>
|
|
20
|
+
<span v-if="selectedFieldMap[key] && selectedFieldMap[key].sumPermission">
|
|
21
|
+
<span style="color: cornflowerblue">{{ $t('workflowEditor.condition.formBindingModel') }}:</span>
|
|
22
|
+
<span style="padding-left:5px"><el-input v-model="selectedFieldMap[key].modelName" style="width:300px" /></span>
|
|
23
|
+
<el-button icon="el-icon-refresh" type="text" @click="refreshModelName(key)" />
|
|
24
|
+
</span>
|
|
25
|
+
</el-col>
|
|
26
|
+
</el-row>
|
|
27
|
+
<!-- <span>{{ selectedFieldMap }}</span> -->
|
|
28
|
+
</div>
|
|
29
|
+
<div v-if="selectedFieldMap[key] && selectedFieldMap[key].sumPermission">
|
|
30
|
+
<editable-child-field-setting :setting="selectedFieldMap[key]" :table-name="key" @combinationParameters="combinationParameters" />
|
|
31
|
+
</div>
|
|
32
|
+
</span>
|
|
33
|
+
</el-card>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script>
|
|
38
|
+
import editableChildFieldSetting from './editable-child-field-setting'
|
|
39
|
+
import componentsConfigUtil from './componentsConfigUtil'
|
|
40
|
+
import { mapGetters } from 'vuex'
|
|
41
|
+
export default {
|
|
42
|
+
name: 'EditableChildFields',
|
|
43
|
+
components: {
|
|
44
|
+
editableChildFieldSetting
|
|
45
|
+
},
|
|
46
|
+
props: {
|
|
47
|
+
value: {
|
|
48
|
+
type: [Array, Object],
|
|
49
|
+
default: null
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
data() {
|
|
53
|
+
let selectedFields = []
|
|
54
|
+
if (this.value !== '' && this.value !== null && this.value !== undefined) {
|
|
55
|
+
if (Array.isArray(this.value)) {
|
|
56
|
+
selectedFields = this.value
|
|
57
|
+
} else {
|
|
58
|
+
// 只有一个字段时其实是field对象
|
|
59
|
+
selectedFields.push(this.value)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
selectedFields,
|
|
64
|
+
selectedFieldMap: {}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
computed: {
|
|
68
|
+
...mapGetters('wfEditor', [
|
|
69
|
+
'subtableConditionMap'
|
|
70
|
+
])
|
|
71
|
+
},
|
|
72
|
+
watch: {
|
|
73
|
+
},
|
|
74
|
+
created() {
|
|
75
|
+
if (this.selectedFields && this.selectedFields.length > 0) {
|
|
76
|
+
this.selectedFields.forEach(item => {
|
|
77
|
+
const sss = {}
|
|
78
|
+
const tableName = item.tableName
|
|
79
|
+
if (item.action) {
|
|
80
|
+
if (Array.isArray(item.action)) {
|
|
81
|
+
if (item.action.length > 0) {
|
|
82
|
+
const sssActionArr = []
|
|
83
|
+
const actionVisibleCondition = {}
|
|
84
|
+
item.action.forEach(item1 => {
|
|
85
|
+
sssActionArr.push(item1.name)
|
|
86
|
+
const param = {}
|
|
87
|
+
if (item1.condition) {
|
|
88
|
+
param.condition = this.xmlToData(item1.condition)
|
|
89
|
+
}
|
|
90
|
+
param.parentCondition = item1.parentCondition
|
|
91
|
+
param.userCondition = item1.userCondition
|
|
92
|
+
actionVisibleCondition[item1.name] = param
|
|
93
|
+
// actionVisibleCondition[item1.name] = item1.visibleCondition
|
|
94
|
+
})
|
|
95
|
+
sss.actionArr = sssActionArr
|
|
96
|
+
sss.visibleConditionArr = actionVisibleCondition
|
|
97
|
+
}
|
|
98
|
+
} else {
|
|
99
|
+
const sssActionArr = []
|
|
100
|
+
const actionVisibleCondition = {}
|
|
101
|
+
sssActionArr.push(item.action.name)
|
|
102
|
+
const param = {}
|
|
103
|
+
if (item.action.condition) {
|
|
104
|
+
param.condition = this.xmlToData(item.action.condition)
|
|
105
|
+
}
|
|
106
|
+
param.parentCondition = item.action.parentCondition
|
|
107
|
+
param.userCondition = item.action.userCondition
|
|
108
|
+
actionVisibleCondition[item.action.name] = param
|
|
109
|
+
sss.actionArr = sssActionArr
|
|
110
|
+
sss.visibleConditionArr = actionVisibleCondition
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (item.field) {
|
|
114
|
+
if (Array.isArray(item.field)) {
|
|
115
|
+
if (item.field.length > 0) {
|
|
116
|
+
const sssFieldArr = []
|
|
117
|
+
item.field.forEach(item2 => {
|
|
118
|
+
const fieldItem = {}
|
|
119
|
+
fieldItem.name = item2.name
|
|
120
|
+
fieldItem.constraintRule = item2.constraintRule
|
|
121
|
+
fieldItem.condition = this.xmlToData(item2.condition)
|
|
122
|
+
fieldItem.userCondition = item2.userCondition
|
|
123
|
+
fieldItem.parentCondition = item2.parentCondition
|
|
124
|
+
sssFieldArr.push(fieldItem)
|
|
125
|
+
})
|
|
126
|
+
sss.fieldArr = sssFieldArr
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
const sssFieldArr = []
|
|
130
|
+
const fieldItem = {}
|
|
131
|
+
fieldItem.name = item.field.name
|
|
132
|
+
fieldItem.constraintRule = item.field.constraintRule
|
|
133
|
+
fieldItem.condition = this.xmlToData(item.field.condition)
|
|
134
|
+
fieldItem.userCondition = item.field.userCondition
|
|
135
|
+
fieldItem.parentCondition = item.field.parentCondition
|
|
136
|
+
sssFieldArr.push(fieldItem)
|
|
137
|
+
sss.fieldArr = sssFieldArr
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (item.modelName) {
|
|
141
|
+
sss.modelName = item.modelName
|
|
142
|
+
} else {
|
|
143
|
+
sss.modelName = null
|
|
144
|
+
}
|
|
145
|
+
if (item.permission) {
|
|
146
|
+
sss.sumPermission = item.permission
|
|
147
|
+
} else {
|
|
148
|
+
sss.sumPermission = false
|
|
149
|
+
}
|
|
150
|
+
this.$set(this.selectedFieldMap, tableName, sss)
|
|
151
|
+
})
|
|
152
|
+
}
|
|
153
|
+
if (this.subtableConditionMap) {
|
|
154
|
+
for (var key in this.subtableConditionMap) {
|
|
155
|
+
if (!this.selectedFieldMap[key]) {
|
|
156
|
+
const sss = {}
|
|
157
|
+
sss.tableName = key
|
|
158
|
+
sss.modelName = this.subtableConditionMap[key].modelName
|
|
159
|
+
sss.sumPermission = false
|
|
160
|
+
this.$set(this.selectedFieldMap, key, sss)
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
mounted() {
|
|
166
|
+
|
|
167
|
+
},
|
|
168
|
+
methods: {
|
|
169
|
+
...componentsConfigUtil,
|
|
170
|
+
combinationParameters(subTableItem) {
|
|
171
|
+
if (subTableItem && subTableItem.tableName) {
|
|
172
|
+
if (this.selectedFields && this.selectedFields.length > 0) {
|
|
173
|
+
const index = this.selectedFields.findIndex((fie) => fie.tableName === subTableItem.tableName)
|
|
174
|
+
if (index !== -1) {
|
|
175
|
+
// this.selectedFields[index] = subTableItem
|
|
176
|
+
this.$set(this.selectedFields, index, subTableItem)
|
|
177
|
+
} else {
|
|
178
|
+
this.selectedFields.push(subTableItem)
|
|
179
|
+
}
|
|
180
|
+
} else {
|
|
181
|
+
this.selectedFields = []
|
|
182
|
+
this.selectedFields.push(subTableItem)
|
|
183
|
+
}
|
|
184
|
+
this.$emit('input', this.selectedFields)
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
refreshModelName(key) {
|
|
188
|
+
if (this.subtableConditionMap && this.subtableConditionMap[key] && this.subtableConditionMap[key].modelName) {
|
|
189
|
+
if (this.selectedFieldMap[key]) {
|
|
190
|
+
const sss = this.selectedFieldMap[key]
|
|
191
|
+
sss.modelName = this.subtableConditionMap[key].modelName
|
|
192
|
+
} else {
|
|
193
|
+
const sss = {}
|
|
194
|
+
sss.modelName = this.subtableConditionMap[key].modelName
|
|
195
|
+
this.$set(this.selectedFieldMap, key, sss)
|
|
196
|
+
}
|
|
197
|
+
this.$message({
|
|
198
|
+
showClose: true,
|
|
199
|
+
type: 'success',
|
|
200
|
+
message: this.$t('workflowEditorMessage.updateSuccessful')
|
|
201
|
+
})
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
changeSumPermission(key) {
|
|
205
|
+
if (key && this.selectedFieldMap[key]) {
|
|
206
|
+
if (!this.selectedFields) {
|
|
207
|
+
this.$set(this, 'selectedFields', [])
|
|
208
|
+
}
|
|
209
|
+
if (this.selectedFieldMap[key].sumPermission === false) {
|
|
210
|
+
const index = this.selectedFields.findIndex((fie) => fie.tableName === key)
|
|
211
|
+
if (index !== null && index !== undefined && index !== -1) {
|
|
212
|
+
// this.$delete(this.selectedFields, index)
|
|
213
|
+
this.$set(this.selectedFields[index], 'permission', false)
|
|
214
|
+
} else {
|
|
215
|
+
this.$set(this.selectedFields, this.selectedFields.length, {
|
|
216
|
+
permission: false,
|
|
217
|
+
tableName: key
|
|
218
|
+
})
|
|
219
|
+
}
|
|
220
|
+
} else {
|
|
221
|
+
const index = this.selectedFields.findIndex((fie) => fie.tableName === key)
|
|
222
|
+
if (index !== null && index !== undefined && index !== -1) {
|
|
223
|
+
// this.$delete(this.selectedFields, index)
|
|
224
|
+
this.$set(this.selectedFields[index], 'permission', true)
|
|
225
|
+
} else {
|
|
226
|
+
this.$set(this.selectedFields, this.selectedFields.length, {
|
|
227
|
+
permission: true,
|
|
228
|
+
tableName: key
|
|
229
|
+
})
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
this.$emit('input', this.selectedFields)
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
</script>
|
|
238
|
+
|
|
239
|
+
<style lang="scss" scoped>
|
|
240
|
+
|
|
241
|
+
</style>
|
package/packages/workflow-editor/src/properties-editors/human-task/editable-field-selection.vue
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-dialog
|
|
3
|
+
id="appContainer"
|
|
4
|
+
width="50%"
|
|
5
|
+
:title="$t('workflowEditor.task.selectEditableField')"
|
|
6
|
+
:visible="true"
|
|
7
|
+
top="10vh"
|
|
8
|
+
append-to-body
|
|
9
|
+
custom-class="properties-editor-noTab"
|
|
10
|
+
center
|
|
11
|
+
@close="$emit('close')"
|
|
12
|
+
>
|
|
13
|
+
<el-form :model="formModel">
|
|
14
|
+
<!-- <el-transfer
|
|
15
|
+
v-model="formModel.selectedFields"
|
|
16
|
+
filterable
|
|
17
|
+
:filter-method="filterMethod"
|
|
18
|
+
:render-content="renderTransferFunc"
|
|
19
|
+
:filter-placeholder="$t('workflowEditorMessage.pleaseEnterFieldName')"
|
|
20
|
+
:data="availableFields"
|
|
21
|
+
:props="{
|
|
22
|
+
key:'name',
|
|
23
|
+
label:'label'
|
|
24
|
+
}"
|
|
25
|
+
:titles="[this.$t('workflowEditor.task.optionalField'),this.$t('workflowEditor.task.selectedFields')]"
|
|
26
|
+
/> -->
|
|
27
|
+
<!-- <el-checkbox-group v-model="formModel.selectedFields">
|
|
28
|
+
<span :key="count" :v-for="count in availableFieldsCount">
|
|
29
|
+
<el-row>
|
|
30
|
+
<el-col :span="8">
|
|
31
|
+
<el-checkbox label="复选框 A" />
|
|
32
|
+
</el-col>
|
|
33
|
+
<el-col :span="8">
|
|
34
|
+
<el-checkbox label="复选框 A" />
|
|
35
|
+
</el-col>
|
|
36
|
+
<el-col :span="8">
|
|
37
|
+
<el-checkbox label="复选框 A" />
|
|
38
|
+
</el-col>
|
|
39
|
+
</el-row>
|
|
40
|
+
</span>
|
|
41
|
+
</el-checkbox-group> -->
|
|
42
|
+
<el-checkbox-group v-model="formModel.selectedFields">
|
|
43
|
+
<span v-for="(item,count) in availableFieldsCount" :key="item.prop">
|
|
44
|
+
<el-row>
|
|
45
|
+
<el-col v-if="availableFields[count*3 +0]" :span="8">
|
|
46
|
+
<el-checkbox v-if="availableFields[count*3 +0].name.indexOf('$')===-1" :label="availableFields[count*3 +0].name" @change="pinSelect(availableFields[count*3 +0].name,availableFields[count*3 +0].index)"><span :title="availableFields[count*3 +0].label">{{ availableFields[count*3 +0].label }}</span></el-checkbox>
|
|
47
|
+
<el-checkbox v-else :label="availableFields[count*3 +0].name" @change="pinSelect(availableFields[count*3 +0].name,availableFields[count*3 +0].index)"><span style="color:#409EFF" class="ellipsis" :title="availableFields[count*3 +0].label">{{ availableFields[count*3 +0].label }}</span></el-checkbox>
|
|
48
|
+
</el-col>
|
|
49
|
+
<el-col v-if="availableFields[count*3 +1]" :span="8">
|
|
50
|
+
<el-checkbox v-if="availableFields[count*3 +1].name.indexOf('$')===-1" :label="availableFields[count*3 +1].name" @change="pinSelect(availableFields[count*3 +1].name,availableFields[count*3 +1].index)"><span :title="availableFields[count*3 +1].label">{{ availableFields[count*3 +1].label }}</span></el-checkbox>
|
|
51
|
+
<el-checkbox v-else :label="availableFields[count*3 +1].name" @change="pinSelect(availableFields[count*3 +1].name,availableFields[count*3 +1].index)"><span style="color:#409EFF" class="ellipsis" :title="availableFields[count*3 +1].label">{{ availableFields[count*3 +1].label }}</span></el-checkbox>
|
|
52
|
+
</el-col>
|
|
53
|
+
<el-col v-if="availableFields[count*3 +2]" :span="8">
|
|
54
|
+
<el-checkbox v-if="availableFields[count*3 +2].name.indexOf('$')===-1" :label="availableFields[count*3 +2].name" @change="pinSelect(availableFields[count*3 +2].name,availableFields[count*3 +2].index)"><span :title="availableFields[count*3 +2].label">{{ availableFields[count*3 +2].label }}</span></el-checkbox>
|
|
55
|
+
<el-checkbox v-else :label="availableFields[count*3 +2].name" @change="pinSelect(availableFields[count*3 +2].name,availableFields[count*3 +2].index)"><span style="color:#409EFF" class="ellipsis" :title="availableFields[count*3 +2].label">{{ availableFields[count*3 +2].label }}</span></el-checkbox>
|
|
56
|
+
</el-col>
|
|
57
|
+
</el-row>
|
|
58
|
+
</span>
|
|
59
|
+
</el-checkbox-group>
|
|
60
|
+
|
|
61
|
+
<el-form-item :label="$t('workflowEditor.task.editingMethod')">
|
|
62
|
+
<el-radio-group v-model="formModel.constraintRule">
|
|
63
|
+
<el-radio label="REQUIRED">
|
|
64
|
+
{{ $t('workflowEditorMessage.mustFill') }}
|
|
65
|
+
</el-radio>
|
|
66
|
+
<el-radio label="READ_ONLY">
|
|
67
|
+
{{ $t('workflowEditorMessage.readOnly') }}
|
|
68
|
+
</el-radio>
|
|
69
|
+
</el-radio-group>
|
|
70
|
+
</el-form-item>
|
|
71
|
+
<el-form-item :label="$t('workflowEditor.task.additionalConditions')">
|
|
72
|
+
<el-switch v-model="formModel.showCondition" />
|
|
73
|
+
<additional-condition v-if="formModel.showCondition" v-model="formModel.condition" />
|
|
74
|
+
</el-form-item>
|
|
75
|
+
</el-form>
|
|
76
|
+
<span slot="footer" class="dialog-footer">
|
|
77
|
+
<el-button type="primary" size="small" @click="setSelectedFields">
|
|
78
|
+
{{ $t('workflowEditorPublicModel.determine') }}
|
|
79
|
+
</el-button>
|
|
80
|
+
<el-button size="small" @click="$emit('close')">
|
|
81
|
+
{{ $t('workflowEditorPublicModel.cancel') }}
|
|
82
|
+
</el-button>
|
|
83
|
+
</span>
|
|
84
|
+
</el-dialog>
|
|
85
|
+
</template>
|
|
86
|
+
|
|
87
|
+
<script>
|
|
88
|
+
import AdditionalCondition from '../common/additional-condition'
|
|
89
|
+
import { mapGetters } from 'vuex'
|
|
90
|
+
export default {
|
|
91
|
+
name: 'EditableFieldSelection',
|
|
92
|
+
components: {
|
|
93
|
+
AdditionalCondition
|
|
94
|
+
},
|
|
95
|
+
props: {
|
|
96
|
+
value: {
|
|
97
|
+
type: Array,
|
|
98
|
+
default: null
|
|
99
|
+
},
|
|
100
|
+
disabledFields: {
|
|
101
|
+
type: Array,
|
|
102
|
+
default: null
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
data() {
|
|
106
|
+
return {
|
|
107
|
+
availableFields: [],
|
|
108
|
+
formModel: {
|
|
109
|
+
selectedFields: [],
|
|
110
|
+
constraintRule: 'REQUIRED',
|
|
111
|
+
showCondition: false,
|
|
112
|
+
condition: ''
|
|
113
|
+
},
|
|
114
|
+
availableFieldsCount: null,
|
|
115
|
+
orange: -1,
|
|
116
|
+
pin: false,
|
|
117
|
+
renderTransferFunc(h, option) {
|
|
118
|
+
if (option.name.indexOf('$') === 0) {
|
|
119
|
+
// 表示是子表字段
|
|
120
|
+
return <span style='color:#409EFF'>{ option.label }</span>
|
|
121
|
+
} else {
|
|
122
|
+
return <span>{ option.label }</span>
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
computed: {
|
|
128
|
+
...mapGetters('wfEditor', [
|
|
129
|
+
'formFieldsWithSub'
|
|
130
|
+
])
|
|
131
|
+
},
|
|
132
|
+
created() {
|
|
133
|
+
let fieldIndex = 0
|
|
134
|
+
this.formFieldsWithSub.map(item => {
|
|
135
|
+
if (this.disabledFields.indexOf(item.name) < 0) {
|
|
136
|
+
item.index = fieldIndex
|
|
137
|
+
this.availableFields.push(item)
|
|
138
|
+
fieldIndex++
|
|
139
|
+
}
|
|
140
|
+
})
|
|
141
|
+
const length = this.availableFields.length
|
|
142
|
+
this.$set(this, 'availableFieldsCount', Math.ceil(length / 3))
|
|
143
|
+
// this.$set(this, 'availableFieldsCount', 21)
|
|
144
|
+
},
|
|
145
|
+
mounted() {
|
|
146
|
+
window.addEventListener('keydown', code => {
|
|
147
|
+
console.log('按住')
|
|
148
|
+
if (code.keyCode === 16 && code.shiftKey) {
|
|
149
|
+
this.pin = true
|
|
150
|
+
}
|
|
151
|
+
})
|
|
152
|
+
window.addEventListener('keyup', code => {
|
|
153
|
+
console.log('松开')
|
|
154
|
+
if (code.keyCode === 16) {
|
|
155
|
+
this.pin = false
|
|
156
|
+
}
|
|
157
|
+
})
|
|
158
|
+
},
|
|
159
|
+
methods: {
|
|
160
|
+
filterMethod(query, item) {
|
|
161
|
+
if (item.label && item.label.indexOf(query) > -1) {
|
|
162
|
+
return true
|
|
163
|
+
} else {
|
|
164
|
+
console.log('filterMethod--item.label=', item.label, item)
|
|
165
|
+
return false
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
setSelectedFields() {
|
|
169
|
+
const fields = []
|
|
170
|
+
for (const field of this.formModel.selectedFields) {
|
|
171
|
+
fields.push({
|
|
172
|
+
name: field,
|
|
173
|
+
constraintRule: this.formModel.constraintRule,
|
|
174
|
+
condition: this.formModel.showCondition ? this.formModel.condition : ''
|
|
175
|
+
})
|
|
176
|
+
}
|
|
177
|
+
this.$emit('input', fields)
|
|
178
|
+
this.$emit('close')
|
|
179
|
+
},
|
|
180
|
+
pinSelect(item, index) {
|
|
181
|
+
console.log(item, index)
|
|
182
|
+
const dataList = this.availableFields
|
|
183
|
+
const origin = this.origin
|
|
184
|
+
const endIdx = index
|
|
185
|
+
if (this.pin && this.formModel.selectedFields.indexOf(item) !== -1) {
|
|
186
|
+
console.log(this.formModel.selectedFields.indexOf(item))
|
|
187
|
+
const sum = Math.abs(origin - endIdx) + 1
|
|
188
|
+
const min = Math.min(origin, endIdx)
|
|
189
|
+
let i = 0
|
|
190
|
+
while (i < sum) {
|
|
191
|
+
const index = min + i
|
|
192
|
+
if (this.formModel.selectedFields.indexOf(dataList[index].name) === -1) {
|
|
193
|
+
this.formModel.selectedFields.push(dataList[index].name)
|
|
194
|
+
}
|
|
195
|
+
i++
|
|
196
|
+
}
|
|
197
|
+
} else {
|
|
198
|
+
this.origin = index
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
</script>
|
|
204
|
+
|
|
205
|
+
<style lang="scss" scoped>
|
|
206
|
+
#appContainer /deep/ .el-checkbox {
|
|
207
|
+
display: block
|
|
208
|
+
}
|
|
209
|
+
#appContainer /deep/ .el-transfer-panel{
|
|
210
|
+
width:400px
|
|
211
|
+
}
|
|
212
|
+
#appContainer /deep/ .ellipsis {
|
|
213
|
+
display:inline-block;
|
|
214
|
+
overflow:hidden;
|
|
215
|
+
text-overflow: ellipsis;
|
|
216
|
+
white-space: nowrap;
|
|
217
|
+
word-break: keep-all;
|
|
218
|
+
width: 55%
|
|
219
|
+
}
|
|
220
|
+
</style>
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<el-row>
|
|
4
|
+
<el-button type="primary" size="mini" plain icon="el-icon-circle-plus-outline" @click="add">
|
|
5
|
+
{{ $t('workflowEditorPublicModel.add') }}
|
|
6
|
+
</el-button>
|
|
7
|
+
<el-button type="primary" size="mini" plain icon="el-icon-delete" @click="remove">
|
|
8
|
+
{{ $t('workflowEditorPublicModel.delete') }}
|
|
9
|
+
</el-button>
|
|
10
|
+
</el-row>
|
|
11
|
+
<el-table
|
|
12
|
+
ref="table"
|
|
13
|
+
:data="selectedFields"
|
|
14
|
+
border
|
|
15
|
+
highlight-current-row
|
|
16
|
+
style="width: 100%"
|
|
17
|
+
@selection-change="handleSelectionChange"
|
|
18
|
+
@current-change="handleCurrentChange"
|
|
19
|
+
>
|
|
20
|
+
<el-table-column
|
|
21
|
+
type="selection"
|
|
22
|
+
width="55"
|
|
23
|
+
/>
|
|
24
|
+
<el-table-column
|
|
25
|
+
type="index"
|
|
26
|
+
width="50"
|
|
27
|
+
/>
|
|
28
|
+
<el-table-column
|
|
29
|
+
:label="$t('workflowEditor.common.name')"
|
|
30
|
+
width="180"
|
|
31
|
+
>
|
|
32
|
+
<template slot-scope="scope">
|
|
33
|
+
<span :style="{color:(scope.row.name && scope.row.name.indexOf('$')=== 0) ?'#409EFF':''}">{{ getFieldLabel(scope.row) }}</span>
|
|
34
|
+
</template>
|
|
35
|
+
</el-table-column>
|
|
36
|
+
<el-table-column
|
|
37
|
+
prop="name"
|
|
38
|
+
:label="$t('workflowEditor.task.propertyName')"
|
|
39
|
+
width="180"
|
|
40
|
+
/>
|
|
41
|
+
<el-table-column
|
|
42
|
+
prop="constraintRule"
|
|
43
|
+
:label="$t('workflowEditor.task.editingMethod')"
|
|
44
|
+
>
|
|
45
|
+
<template slot-scope="scope">
|
|
46
|
+
<el-radio-group v-model="scope.row.constraintRule">
|
|
47
|
+
<el-radio label="REQUIRED">
|
|
48
|
+
{{ $t('workflowEditorMessage.mustFill') }}
|
|
49
|
+
</el-radio>
|
|
50
|
+
<el-radio label="READ_ONLY">
|
|
51
|
+
{{ $t('workflowEditorMessage.readOnly') }}
|
|
52
|
+
</el-radio>
|
|
53
|
+
</el-radio-group>
|
|
54
|
+
</template>
|
|
55
|
+
</el-table-column>
|
|
56
|
+
<el-table-column
|
|
57
|
+
prop="condition"
|
|
58
|
+
:label="$t('workflowEditor.task.condition')"
|
|
59
|
+
>
|
|
60
|
+
<template slot-scope="scope">
|
|
61
|
+
<el-input
|
|
62
|
+
:value="formatCondition(scope.row.condition)"
|
|
63
|
+
type="textarea"
|
|
64
|
+
autosize
|
|
65
|
+
@focus="selectCondition(scope.row)"
|
|
66
|
+
/>
|
|
67
|
+
</template>
|
|
68
|
+
</el-table-column>
|
|
69
|
+
</el-table>
|
|
70
|
+
<editable-field-selection v-if="showFieldSelection" :disabled-fields="disabledFields" @input="setSelectedFields" @close="showFieldSelection=false" />
|
|
71
|
+
<additional-condition-dialog v-if="showAdditionalCondition" v-model="currentRow.condition" @close="showAdditionalCondition=false" />
|
|
72
|
+
</div>
|
|
73
|
+
</template>
|
|
74
|
+
|
|
75
|
+
<script>
|
|
76
|
+
import EditableFieldSelection from './editable-field-selection'
|
|
77
|
+
import AdditionalConditionDialog from './additional-condition-dialog'
|
|
78
|
+
import { mapGetters } from 'vuex'
|
|
79
|
+
import { parseCondition, displayCondition } from '../common/additional-condition-utils'
|
|
80
|
+
export default {
|
|
81
|
+
name: 'EditableFields',
|
|
82
|
+
components: {
|
|
83
|
+
EditableFieldSelection,
|
|
84
|
+
AdditionalConditionDialog
|
|
85
|
+
},
|
|
86
|
+
props: {
|
|
87
|
+
value: {
|
|
88
|
+
type: [Array, Object],
|
|
89
|
+
default: null
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
data() {
|
|
93
|
+
let selectedFields = []
|
|
94
|
+
if (this.value !== '' && this.value !== null && this.value !== undefined) {
|
|
95
|
+
if (Array.isArray(this.value)) {
|
|
96
|
+
selectedFields = this.value
|
|
97
|
+
} else {
|
|
98
|
+
// 只有一个字段时其实是field对象
|
|
99
|
+
selectedFields.push(this.value)
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
showFieldSelection: false,
|
|
104
|
+
showAdditionalCondition: false,
|
|
105
|
+
selectedFields,
|
|
106
|
+
currentRow: null,
|
|
107
|
+
multipleSelection: []
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
computed: {
|
|
111
|
+
...mapGetters('wfEditor', [
|
|
112
|
+
'formFieldsWithSub'
|
|
113
|
+
]),
|
|
114
|
+
// 列表中出现的字段不能重复添加
|
|
115
|
+
disabledFields() {
|
|
116
|
+
if (this.value === null || this.value === undefined) return []
|
|
117
|
+
const result = []
|
|
118
|
+
// value可能是数组或者对象(一个字段时),要分别处理
|
|
119
|
+
if (Array.isArray(this.value)) {
|
|
120
|
+
this.value.map(item => {
|
|
121
|
+
result.push(item.name)
|
|
122
|
+
})
|
|
123
|
+
} else {
|
|
124
|
+
result.push(this.value)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return result
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
mounted() {
|
|
131
|
+
if (this.selectedFields.length > 0) {
|
|
132
|
+
this.selectRow(this.selectedFields[this.selectedFields.length - 1])
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
methods: {
|
|
136
|
+
handleCurrentChange(val) {
|
|
137
|
+
this.currentRow = val
|
|
138
|
+
},
|
|
139
|
+
handleSelectionChange(val) {
|
|
140
|
+
this.multipleSelection = val
|
|
141
|
+
},
|
|
142
|
+
selectRow(row) {
|
|
143
|
+
this.$refs.table.setCurrentRow(row)
|
|
144
|
+
},
|
|
145
|
+
add() {
|
|
146
|
+
this.showFieldSelection = true
|
|
147
|
+
},
|
|
148
|
+
getCurrentRowIndex() {
|
|
149
|
+
let index = -1
|
|
150
|
+
for (let i = 0; i < this.selectedFields.length; i++) {
|
|
151
|
+
if (this.selectedFields[i].name === this.currentRow.name) {
|
|
152
|
+
index = i
|
|
153
|
+
break
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return index
|
|
157
|
+
},
|
|
158
|
+
remove() {
|
|
159
|
+
if (this.multipleSelection && this.multipleSelection.length > 0) {
|
|
160
|
+
for (var i = 0; i < this.multipleSelection.length; i++) {
|
|
161
|
+
const selectRow = this.multipleSelection[i]
|
|
162
|
+
this.selectRow(selectRow)
|
|
163
|
+
const index = this.getCurrentRowIndex()
|
|
164
|
+
this.selectedFields.splice(index, 1)
|
|
165
|
+
}
|
|
166
|
+
this.$emit('input', this.selectedFields)
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
setSelectedFields(fields) {
|
|
170
|
+
// 新选中的字段需要以追加的方式放到xml中
|
|
171
|
+
if (fields === null || fields === undefined) {
|
|
172
|
+
fields = []
|
|
173
|
+
}
|
|
174
|
+
this.selectedFields = this.selectedFields.concat(fields)
|
|
175
|
+
this.selectRow(this.selectedFields[this.selectedFields.length - 1])
|
|
176
|
+
this.$emit('input', this.selectedFields)
|
|
177
|
+
},
|
|
178
|
+
formatCondition(value) {
|
|
179
|
+
if (value === '' || !value) return this.$t('workflowEditor.task.nothing')
|
|
180
|
+
const conditions = []
|
|
181
|
+
parseCondition(conditions, value)
|
|
182
|
+
return displayCondition(conditions)
|
|
183
|
+
},
|
|
184
|
+
getFieldLabel(row) {
|
|
185
|
+
const field = this.formFieldsWithSub.filter(item => {
|
|
186
|
+
return item.name === row.name
|
|
187
|
+
})
|
|
188
|
+
if (field.length > 0) {
|
|
189
|
+
return field[0].label
|
|
190
|
+
} else {
|
|
191
|
+
return ''
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
selectCondition(row) {
|
|
195
|
+
this.selectRow(row)
|
|
196
|
+
this.showAdditionalCondition = true
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
</script>
|
|
201
|
+
|
|
202
|
+
<style lang="scss" scoped>
|
|
203
|
+
|
|
204
|
+
</style>
|