workflow-editor 0.0.46-up-tmp1 → 0.0.47-temp1

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.46-up-tmp1",
4
+ "version": "0.0.47-temp1",
5
5
  "type": "module",
6
6
  "main": "./lib/workflow-editor.js",
7
7
  "scripts": {
@@ -10,10 +10,12 @@ function getLeafPropRule(editField, dataTypeMap) {
10
10
  const dataType = editField.dataType
11
11
  if (dataType === 'DATE' || dataType === 'TIME') {
12
12
  // 对象的值需要是毫秒值数字
13
- if (editField.valueType && editField.valueType === 'number') {
14
- // 表示值是毫秒值
15
- rule.type = 'number'
16
- }
13
+ // if (editField.valueType && editField.valueType === 'number') {
14
+ // // 表示值是毫秒值
15
+ // rule.type = 'number'
16
+ // }
17
+ rule.type = 'date'
18
+ packageCustomValidator(rule)
17
19
  rule.message = editField.label + ' ' + getI18n().t('workflowEditorMessage.requiredAndMustBeADate')
18
20
  } else if (dataType === 'INTEGER' || dataType === 'LONG') {
19
21
  // rule.type = 'number'
@@ -26,7 +28,7 @@ function getLeafPropRule(editField, dataTypeMap) {
26
28
  rule.type = 'boolean'
27
29
  rule.message = editField.label + ' ' + getI18n().t('workflowEditorMessage.mustFill')
28
30
  // 布尔型校验需要自定义,为了兼容oracle和mysql数据
29
- packageBooleanRule(rule)
31
+ packageCustomValidator(rule)
30
32
  } else {
31
33
  // if (entity[editField.name] || entity[editField.name] === 0) {
32
34
  // if (typeof entity[editField.name] === 'number' && dataType === 'TEXT') {
@@ -53,11 +55,11 @@ function getLeafPropRule(editField, dataTypeMap) {
53
55
  }
54
56
 
55
57
  /**
56
- * 布尔型校验需要自定义,为了兼容oracle和mysql数据库
58
+ * 布尔型和日期校验需要自定义,为了兼容oracle和mysql数据库
57
59
  * @param fieldRule
58
60
  */
59
- function packageBooleanRule(fieldRule) {
60
- if (fieldRule.type && fieldRule.type === 'boolean') {
61
+ function packageCustomValidator(fieldRule) {
62
+ if (fieldRule && fieldRule.type && fieldRule.type === 'boolean') {
61
63
  fieldRule.validator = function (rule, value, callback) {
62
64
  if (value === undefined || value === null) {
63
65
  if (rule.required) {
@@ -72,6 +74,20 @@ function getLeafPropRule(editField, dataTypeMap) {
72
74
  }
73
75
  return false
74
76
  }
77
+ } else if (fieldRule && fieldRule.type && fieldRule.type === 'date') {
78
+ fieldRule.validator = function (rule, value, callback) {
79
+ if (value === undefined || value === null) {
80
+ if (rule.required) {
81
+ return false
82
+ } else {
83
+ return true
84
+ }
85
+ } else {
86
+ // 验证是否是合法日期
87
+ const date = new Date(value)
88
+ return !isNaN(date.getTime())
89
+ }
90
+ }
75
91
  }
76
92
  }
77
93
 
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div>
2
+ <div style="overflow: auto">
3
3
  <el-row>
4
4
  <el-button type="primary" size="small" plain icon="CirclePlus" @click="add">
5
5
  {{ $t('workflowEditorPublicModel.add') }}
@@ -22,7 +22,7 @@
22
22
  :data="tableData"
23
23
  row-key="id"
24
24
  border
25
- style="width: 100%;padding-top:10px"
25
+ style="width: 100%; padding-top: 10px"
26
26
  highlight-current-row
27
27
  @current-change="handleCurrentChange"
28
28
  >
@@ -44,18 +44,34 @@
44
44
  <el-table-column :label="$t('workflowEditor.common.operator')" width="110">
45
45
  <template v-slot="scope">
46
46
  <el-select v-model="scope.row.operator" placeholder="" @focus="selectRow(scope.row)">
47
- <el-option v-for="option in getOperatorOptions(scope.row.key)" :key="option.name" :label="option.label" :value="option.name" />
47
+ <el-option
48
+ v-for="option in getOperatorOptions(scope.row.key)"
49
+ :key="option.name"
50
+ :label="option.label"
51
+ :value="option.name"
52
+ />
48
53
  </el-select>
49
54
  </template>
50
55
  </el-table-column>
51
56
  <el-table-column :label="$t('workflowEditor.common.value')">
52
57
  <template v-slot="scope">
53
- <el-input v-if="scope.row.key.indexOf('${field[')>=0 || isTransitionOtherField(scope.row.key)" v-model.trim="scope.row.value" />
54
- <el-select v-else-if="scope.row.key === '${approvalResult}'" v-model.trim="scope.row.value">
58
+ <el-input
59
+ v-if="scope.row.key.indexOf('${field[') >= 0 || isTransitionOtherField(scope.row.key)"
60
+ v-model.trim="scope.row.value"
61
+ />
62
+ <el-select
63
+ v-else-if="scope.row.key === '${approvalResult}'"
64
+ v-model.trim="scope.row.value"
65
+ >
55
66
  <el-option value="同意" :label="$t('workflowEditorPublicModel.agree')" />
56
67
  <el-option value="不同意" :label="$t('workflowEditorPublicModel.disagree')" />
57
68
  </el-select>
58
- <el-input v-else :value="format(scope.row.value,scope.row)" readonly @click="selectValue" />
69
+ <el-input
70
+ v-else
71
+ :value="format(scope.row.value, scope.row)"
72
+ readonly
73
+ @click="selectValue"
74
+ />
59
75
  </template>
60
76
  </el-table-column>
61
77
  <el-table-column prop="rightBracket" label=")" width="90" @focus="selectRow(scope.row)">
@@ -68,10 +84,21 @@
68
84
  </el-select>
69
85
  </template>
70
86
  </el-table-column>
71
- <el-table-column prop="logicOperator" :label="$t('workflowEditorPublicModel.andOr')" width="110">
87
+ <el-table-column
88
+ prop="logicOperator"
89
+ :label="$t('workflowEditorPublicModel.andOr')"
90
+ width="110"
91
+ >
72
92
  <template v-slot="scope">
73
- <el-select v-model="scope.row.logicOperator" :placeholder="$t('workflowEditorMessage.pleaseSelect')" @focus="selectRow(scope.row)">
74
- <el-option :label="$t('workflowEditor.process.perhaps')" value="condition.operator.or" />
93
+ <el-select
94
+ v-model="scope.row.logicOperator"
95
+ :placeholder="$t('workflowEditorMessage.pleaseSelect')"
96
+ @focus="selectRow(scope.row)"
97
+ >
98
+ <el-option
99
+ :label="$t('workflowEditor.process.perhaps')"
100
+ value="condition.operator.or"
101
+ />
75
102
  <el-option :label="$t('workflowEditor.process.also')" value="condition.operator.and" />
76
103
  </el-select>
77
104
  </template>
@@ -88,7 +115,16 @@
88
115
  </div>
89
116
  </template>
90
117
  <script>
91
- import { getFieldLabel, parseCondition, generateCondition, displayCondition, getRelatedStandardFields, getOperators, getStandardFieldsByTacheType, isTransitionOtherField } from './additional-condition-utils'
118
+ import {
119
+ getFieldLabel,
120
+ parseCondition,
121
+ generateCondition,
122
+ displayCondition,
123
+ getRelatedStandardFields,
124
+ getOperators,
125
+ getStandardFieldsByTacheType,
126
+ isTransitionOtherField
127
+ } from './additional-condition-utils'
92
128
  import { standardFields } from './additional-condition-utils'
93
129
  import ValueSelectionDialog from '../common/value-selection-dialog'
94
130
  import { mapGetters } from 'vuex'
@@ -124,9 +160,7 @@ export default {
124
160
  }
125
161
  },
126
162
  computed: {
127
- ...mapGetters('wfEditor', [
128
- 'formFields'
129
- ]),
163
+ ...mapGetters('wfEditor', ['formFields']),
130
164
  availableStandardFields() {
131
165
  if (this.currentInput === 'key') {
132
166
  return getStandardFieldsByTacheType(this.isTransition)
@@ -139,12 +173,16 @@ export default {
139
173
  if (this.tableData.length > 0) {
140
174
  this.$refs.table.setCurrentRow(this.tableData[this.tableData.length - 1])
141
175
  }
142
- this.$watch('tableData', function(newVal, oldVal) {
143
- // this.$emit('input', generateCondition(this.tableData))
144
- this.$emit('update:modelValue', generateCondition(this.tableData))
145
- }, {
146
- deep: true
147
- })
176
+ this.$watch(
177
+ 'tableData',
178
+ function (newVal, oldVal) {
179
+ // this.$emit('input', generateCondition(this.tableData))
180
+ this.$emit('update:modelValue', generateCondition(this.tableData))
181
+ },
182
+ {
183
+ deep: true
184
+ }
185
+ )
148
186
  },
149
187
  methods: {
150
188
  format(value, row) {
@@ -190,7 +228,12 @@ export default {
190
228
  return -1
191
229
  },
192
230
  add() {
193
- if (this.count === null || this.count === undefined || this.count.isNaN || this.count === 'NaN') {
231
+ if (
232
+ this.count === null ||
233
+ this.count === undefined ||
234
+ this.count.isNaN ||
235
+ this.count === 'NaN'
236
+ ) {
194
237
  this.count = 0
195
238
  }
196
239
  const newRow = {
@@ -232,7 +275,7 @@ export default {
232
275
  let index = this.getRowIndex(this.currentRow)
233
276
  this.tableData.splice(index, 1)
234
277
  if (this.tableData.length > 0) {
235
- index = (index <= (this.tableData.length - 1) ? index : (this.tableData.length - 1))
278
+ index = index <= this.tableData.length - 1 ? index : this.tableData.length - 1
236
279
  this.$refs.table.setCurrentRow(this.tableData[index])
237
280
  }
238
281
  },
@@ -245,7 +288,7 @@ export default {
245
288
  showConfirmButton: false,
246
289
  showCancelButton: false,
247
290
  // 增加这个空的回退函数防止报错
248
- callback: function() {}
291
+ callback: function () {}
249
292
  })
250
293
  },
251
294
  selectField(row) {
@@ -261,7 +304,7 @@ export default {
261
304
  this.orgType = this.getStandardFieldOrgType()
262
305
  },
263
306
  getStandardFieldOrgType() {
264
- const fields = this.standardFields.filter(standardField => {
307
+ const fields = this.standardFields.filter((standardField) => {
265
308
  return standardField.name === this.currentRow.key
266
309
  })
267
310
  if (fields.length > 0) {
@@ -19,13 +19,13 @@
19
19
  </el-checkbox>
20
20
  </el-checkbox-group>
21
21
  </el-col>
22
- <div style="width: 100%;vertical-align: middle" v-if="showUserList">
22
+ <div style="width: 100%; vertical-align: middle" v-if="showUserList">
23
23
  <el-col>
24
24
  <el-row>
25
25
  <el-col :span="4">
26
26
  {{ $t('workflowEditor.process.listOfDesignatedPersons') }}
27
27
  </el-col>
28
- <el-col style="display: flex;justify-content: center;align-items: center;" :span="5">
28
+ <el-col style="display: flex; justify-content: center; align-items: center" :span="5">
29
29
  <el-dropdown size="small" split-button type="primary" plain @command="handleCommand">
30
30
  <span class="el-dropdown-link">
31
31
  <i class="fa fa-search" /> {{ $t('workflowEditorPublicModel.choice') }}
@@ -68,9 +68,24 @@
68
68
  </el-col>
69
69
  </el-row>
70
70
  </el-col>
71
- <department-user-tree v-if="showSelectUser" width="60%" :multiple="true" @close="addPointUsers" />
72
- <department-tree v-if="showSelectDepartment" width="30%" :multiple="true" @close="addPointDepartments" />
73
- <workgroup-tree v-if="showSelectWorkgroup" width="30%" :multiple="true" @close="addPointWorkgroups" />
71
+ <department-user-tree
72
+ v-if="showSelectUser"
73
+ width="60%"
74
+ :multiple="true"
75
+ @close="addPointUsers"
76
+ />
77
+ <department-tree
78
+ v-if="showSelectDepartment"
79
+ width="30%"
80
+ :multiple="true"
81
+ @close="addPointDepartments"
82
+ />
83
+ <workgroup-tree
84
+ v-if="showSelectWorkgroup"
85
+ width="30%"
86
+ :multiple="true"
87
+ @close="addPointWorkgroups"
88
+ />
74
89
  <system-role-tree v-if="showSelectRole" :multiple="true" @close="addPointRoles" />
75
90
  <form-fields v-if="showSelectField" @close="setField" />
76
91
  </div>
@@ -146,7 +161,7 @@ export default {
146
161
  return getFormFieldLabel(name)
147
162
  },
148
163
  getValue() {
149
- const checkList = this.checkList.filter(item => {
164
+ const checkList = this.checkList.filter((item) => {
150
165
  return item !== '' && item !== 'assignUser'
151
166
  })
152
167
  let value = checkList.join(' condition.operator.or ')
@@ -219,7 +234,7 @@ export default {
219
234
  // 用户姓名和分支名称的分隔符
220
235
  const userNameAndBranchSeparator = '/'
221
236
  const fixCondition = '${user} operator.text.eq '
222
- selectedUsers.forEach(user => {
237
+ selectedUsers.forEach((user) => {
223
238
  let loginName = user.loginName
224
239
  let userName = user.name
225
240
  if (user.subCompanyId && user.subCompanyId !== null) {
@@ -248,7 +263,10 @@ export default {
248
263
  // 如果不包含分支机构,直接封装为用户条件
249
264
  packageSelectedUserConditionsWithOutBranch(selectedUsers) {
250
265
  const fixCondition = '${user} operator.text.eq '
251
- selectedUsers.forEach(user => {
266
+ selectedUsers.forEach((user) => {
267
+ if (!this.selectedUsers) {
268
+ this.selectedUsers = []
269
+ }
252
270
  const condition = fixCondition + user.name + '[' + user.loginName + ']'
253
271
  const selectedUserCondition = this.selectedUsers.filter(this.filterCondition(condition))
254
272
  if (selectedUserCondition.length === 0) {
@@ -260,11 +278,15 @@ export default {
260
278
  getSelectedUsersShowValue() {
261
279
  if (this.selectedUsers) {
262
280
  const selectedUsersCondition = this.selectedUsers.join(' condition.operator.or ')
263
- this.selectedUsersShowValue = selectedUsersCondition.replace(/\$\{user\}/g, '用户')
264
- .replace(/\$\{department\}/g, '部门').replace(/\$\{workGroup\}/g, '工作组')
281
+ this.selectedUsersShowValue = selectedUsersCondition
282
+ .replace(/\$\{user\}/g, '用户')
283
+ .replace(/\$\{department\}/g, '部门')
284
+ .replace(/\$\{workGroup\}/g, '工作组')
265
285
  .replace(/\$\{role\}/g, '角色')
266
- .replace(/operator\.text\.eq/g, '等于').replace(/condition\.operator\.or/g, '或者')
267
- .replace(/\$\{field/g, '字段').replace(/]\}/g, ']')
286
+ .replace(/operator\.text\.eq/g, '等于')
287
+ .replace(/condition\.operator\.or/g, '或者')
288
+ .replace(/\$\{field/g, '字段')
289
+ .replace(/]\}/g, ']')
268
290
  }
269
291
  },
270
292
  // 过滤已选条件中是否包含condition条件
@@ -279,10 +301,16 @@ export default {
279
301
  const isContainBranch = selectNodeInfo.containBranch
280
302
  if (isContainBranch) {
281
303
  // 如果包含分支机构,需要拼接显示的分支名称,格式为:部门名称/分支名称,并封装为部门条件
282
- this.packageSelectedDepartmentOrWorkgroupConditionsWithBranch(selectNodeInfo.departments, '${department}')
304
+ this.packageSelectedDepartmentOrWorkgroupConditionsWithBranch(
305
+ selectNodeInfo.departments,
306
+ '${department}'
307
+ )
283
308
  } else {
284
309
  // 如果不包含分支机构,直接封装为部门条件
285
- this.packageSelectedDepartmentOrWorkgroupConditionsWithOutBranch(selectNodeInfo.departments, '${department}')
310
+ this.packageSelectedDepartmentOrWorkgroupConditionsWithOutBranch(
311
+ selectNodeInfo.departments,
312
+ '${department}'
313
+ )
286
314
  }
287
315
  // 获得显示时的条件值
288
316
  this.getSelectedUsersShowValue()
@@ -294,7 +322,7 @@ export default {
294
322
  // 部门姓名和分支名称的分隔符
295
323
  const departmentNameAndBranchSeparator = '/'
296
324
  const fixCondition = type + ' operator.text.eq '
297
- selectedDepartments.forEach(department => {
325
+ selectedDepartments.forEach((department) => {
298
326
  const departmentCode = department.code
299
327
  let departmentName = department.name
300
328
  if (department.subCompanyId && department.subCompanyId !== null) {
@@ -322,7 +350,7 @@ export default {
322
350
  // 如果不包含分支机构,直接封装为部门条件 或 工作组条件
323
351
  packageSelectedDepartmentOrWorkgroupConditionsWithOutBranch(selectedDepartments, type) {
324
352
  const fixCondition = type + ' operator.text.eq '
325
- selectedDepartments.forEach(department => {
353
+ selectedDepartments.forEach((department) => {
326
354
  const condition = fixCondition + department.name + '[' + department.code + ']'
327
355
  if (this.selectedUsers) {
328
356
  const selectedCondition = this.selectedUsers.filter(this.filterCondition(condition))
@@ -341,10 +369,16 @@ export default {
341
369
  const isContainBranch = selectNodeInfo.containBranch
342
370
  if (isContainBranch) {
343
371
  // 如果包含分支机构,需要拼接分支名称,格式为:工作组名称/分支名称,并封装为工作组条件
344
- this.packageSelectedDepartmentOrWorkgroupConditionsWithBranch(selectNodeInfo.workgroups, '${workGroup}')
372
+ this.packageSelectedDepartmentOrWorkgroupConditionsWithBranch(
373
+ selectNodeInfo.workgroups,
374
+ '${workGroup}'
375
+ )
345
376
  } else {
346
377
  // 如果不包含分支机构,直接封装为工作组条件
347
- this.packageSelectedDepartmentOrWorkgroupConditionsWithOutBranch(selectNodeInfo.workgroups, '${workGroup}')
378
+ this.packageSelectedDepartmentOrWorkgroupConditionsWithOutBranch(
379
+ selectNodeInfo.workgroups,
380
+ '${workGroup}'
381
+ )
348
382
  }
349
383
  // 获得显示时的条件值
350
384
  this.getSelectedUsersShowValue()
@@ -355,7 +389,10 @@ export default {
355
389
  addPointRoles(selectNodeInfo) {
356
390
  if (selectNodeInfo) {
357
391
  // 角色不需要考虑分支机构
358
- this.packageSelectedDepartmentOrWorkgroupConditionsWithOutBranch(selectNodeInfo.roles, '${role}')
392
+ this.packageSelectedDepartmentOrWorkgroupConditionsWithOutBranch(
393
+ selectNodeInfo.roles,
394
+ '${role}'
395
+ )
359
396
  // 获得显示时的条件值
360
397
  this.getSelectedUsersShowValue()
361
398
  }
@@ -387,4 +424,3 @@ export default {
387
424
  }
388
425
  }
389
426
  </script>
390
-