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.
- package/dist/index.full.min.js +3237 -0
- package/dist/style.css +1 -0
- package/es/_virtual/FileSaver.min.mjs +4 -0
- package/es/_virtual/___vite-browser-external.mjs +6 -0
- package/es/_virtual/__vite-browser-external.mjs +4 -0
- package/es/_virtual/_commonjsHelpers.mjs +30 -0
- package/es/_virtual/_plugin-vue_export-helper.mjs +9 -0
- package/es/_virtual/clipboard.mjs +4 -0
- package/es/_virtual/dayjs.min.mjs +4 -0
- package/es/_virtual/index.mjs +4 -0
- package/es/_virtual/nprogress.mjs +4 -0
- package/es/_virtual/prism.mjs +4 -0
- package/es/_virtual/sax.mjs +4 -0
- package/es/_virtual/string_decoder.mjs +4 -0
- package/es/_virtual/tinymce.mjs +4 -0
- package/es/_virtual/weekOfYear.mjs +4 -0
- package/es/index.mjs +20 -0
- package/es/plugins/formValidatorUtil.mjs +391 -0
- package/es/plugins/index.mjs +9 -0
- package/es/style.css +1 -0
- package/es/vite.svg +1 -0
- package/es/workflow-editor/index.mjs +14 -0
- package/lib/_virtual/FileSaver.min.cjs +1 -0
- package/lib/_virtual/___vite-browser-external.cjs +1 -0
- package/lib/_virtual/__vite-browser-external.cjs +1 -0
- package/lib/_virtual/_commonjsHelpers.cjs +1 -0
- package/lib/_virtual/_plugin-vue_export-helper.cjs +1 -0
- package/lib/_virtual/clipboard.cjs +1 -0
- package/lib/_virtual/dayjs.min.cjs +1 -0
- package/lib/_virtual/index.cjs +1 -0
- package/lib/_virtual/nprogress.cjs +1 -0
- package/lib/_virtual/prism.cjs +1 -0
- package/lib/_virtual/sax.cjs +1 -0
- package/lib/_virtual/string_decoder.cjs +1 -0
- package/lib/_virtual/tinymce.cjs +1 -0
- package/lib/_virtual/weekOfYear.cjs +1 -0
- package/lib/index.cjs +1 -0
- package/lib/plugins/formValidatorUtil.cjs +1 -0
- package/lib/plugins/index.cjs +1 -0
- package/lib/style.css +1 -0
- package/lib/workflow-editor/index.cjs +1 -0
- package/package.json +5 -3
- package/vite.config.js +44 -10
- package/lib/401-5a92e011.js +0 -101
- package/lib/404-2e472acc.js +0 -26
- package/lib/authredirect-ae6e75b4.js +0 -10
- package/lib/iframe-page-4e84c0f8.js +0 -33
- package/lib/index-27119bd2.js +0 -31464
- package/lib/index-369eae4a.js +0 -13
- package/lib/tab-content-iframe-index-e9146736.js +0 -33
- package/lib/tab-content-index-bbc6792b.js +0 -1241
- package/lib/tache-subprocess-history-d51d6a50.js +0 -56
- package/lib/workflow-editor.css +0 -1
- package/lib/workflow-editor.js +0 -5
- package/lib/workflow-editor.umd.cjs +0 -85
- package/packages/index.js +0 -34
- package/packages/plugins/formValidatorUtil.js +0 -723
- package/packages/plugins/index.js +0 -8
- package/packages/workflow-editor/index.js +0 -14
- package/packages/workflow-editor/src/api.js +0 -7
- package/packages/workflow-editor/src/assets/tab-select.png +0 -0
- package/packages/workflow-editor/src/assets/tab-selectWhite.png +0 -0
- package/packages/workflow-editor/src/assets/wf-editor-icons.js +0 -2
- package/packages/workflow-editor/src/constant.js +0 -8
- package/packages/workflow-editor/src/json-object-templates/auto-task.js +0 -70
- package/packages/workflow-editor/src/json-object-templates/copy-task.js +0 -72
- package/packages/workflow-editor/src/json-object-templates/decision.js +0 -11
- package/packages/workflow-editor/src/json-object-templates/end.js +0 -14
- package/packages/workflow-editor/src/json-object-templates/fork.js +0 -10
- package/packages/workflow-editor/src/json-object-templates/human-decision.js +0 -9
- package/packages/workflow-editor/src/json-object-templates/human-task.js +0 -208
- package/packages/workflow-editor/src/json-object-templates/join.js +0 -10
- package/packages/workflow-editor/src/json-object-templates/process.js +0 -99
- package/packages/workflow-editor/src/json-object-templates/start.js +0 -13
- package/packages/workflow-editor/src/json-object-templates/subprocess.js +0 -31
- package/packages/workflow-editor/src/json-object-templates/transition.js +0 -26
- package/packages/workflow-editor/src/main/admin-save-dialog.vue +0 -67
- package/packages/workflow-editor/src/main/canvas.vue +0 -493
- package/packages/workflow-editor/src/main/context-menu.vue +0 -147
- package/packages/workflow-editor/src/main/icon-svg.vue +0 -32
- package/packages/workflow-editor/src/main/selection-region.vue +0 -66
- package/packages/workflow-editor/src/main/tache-history-tooltip.vue +0 -38
- package/packages/workflow-editor/src/main/tache-name-input.vue +0 -19
- package/packages/workflow-editor/src/main/tache-subprocess-history-dialog.vue +0 -40
- package/packages/workflow-editor/src/main/toolbox.vue +0 -60
- package/packages/workflow-editor/src/main/wf-history-canvas.vue +0 -309
- package/packages/workflow-editor/src/process-json.js +0 -624
- package/packages/workflow-editor/src/process-service.js +0 -69
- package/packages/workflow-editor/src/properties-editors/auto-task/basic-properties.vue +0 -81
- package/packages/workflow-editor/src/properties-editors/auto-task/permission-settings.vue +0 -155
- package/packages/workflow-editor/src/properties-editors/auto-task.vue +0 -74
- package/packages/workflow-editor/src/properties-editors/common/additional-condition-utils.js +0 -568
- package/packages/workflow-editor/src/properties-editors/common/additional-condition.vue +0 -320
- package/packages/workflow-editor/src/properties-editors/common/auto-filled-fields-utils.js +0 -34
- package/packages/workflow-editor/src/properties-editors/common/auto-filled-fields.vue +0 -268
- package/packages/workflow-editor/src/properties-editors/common/common-notice-tool.vue +0 -81
- package/packages/workflow-editor/src/properties-editors/common/common-user-condition.vue +0 -242
- package/packages/workflow-editor/src/properties-editors/common/form-fields-utils.js +0 -23
- package/packages/workflow-editor/src/properties-editors/common/form-fields.vue +0 -117
- package/packages/workflow-editor/src/properties-editors/common/i18n-input.vue +0 -88
- package/packages/workflow-editor/src/properties-editors/common/i18n-set-dialog.vue +0 -143
- package/packages/workflow-editor/src/properties-editors/common/notice-reminder.vue +0 -149
- package/packages/workflow-editor/src/properties-editors/common/notice.vue +0 -108
- package/packages/workflow-editor/src/properties-editors/common/reminder.vue +0 -272
- package/packages/workflow-editor/src/properties-editors/common/select-mail-template.vue +0 -92
- package/packages/workflow-editor/src/properties-editors/common/standard-fields.vue +0 -66
- package/packages/workflow-editor/src/properties-editors/common/system-role-tree-inline.vue +0 -354
- package/packages/workflow-editor/src/properties-editors/common/system-role-tree.vue +0 -68
- package/packages/workflow-editor/src/properties-editors/common/task-title.vue +0 -165
- package/packages/workflow-editor/src/properties-editors/common/transactor-settings.vue +0 -275
- package/packages/workflow-editor/src/properties-editors/common/user-selection.vue +0 -426
- package/packages/workflow-editor/src/properties-editors/common/value-selection-dialog.vue +0 -272
- package/packages/workflow-editor/src/properties-editors/common/variables.vue +0 -139
- package/packages/workflow-editor/src/properties-editors/copy-task/basic-properties.vue +0 -90
- package/packages/workflow-editor/src/properties-editors/copy-task/permission-settings.vue +0 -155
- package/packages/workflow-editor/src/properties-editors/copy-task.vue +0 -95
- package/packages/workflow-editor/src/properties-editors/decision.vue +0 -95
- package/packages/workflow-editor/src/properties-editors/fork.vue +0 -77
- package/packages/workflow-editor/src/properties-editors/human-decision.vue +0 -49
- package/packages/workflow-editor/src/properties-editors/human-task/additional-condition-dialog.vue +0 -62
- package/packages/workflow-editor/src/properties-editors/human-task/basic-properties.vue +0 -184
- package/packages/workflow-editor/src/properties-editors/human-task/componentsConfigUtil.js +0 -359
- package/packages/workflow-editor/src/properties-editors/human-task/custom-actions.vue +0 -256
- package/packages/workflow-editor/src/properties-editors/human-task/editable-child-field-setting.vue +0 -405
- package/packages/workflow-editor/src/properties-editors/human-task/editable-child-fields.vue +0 -257
- package/packages/workflow-editor/src/properties-editors/human-task/editable-field-selection.vue +0 -430
- package/packages/workflow-editor/src/properties-editors/human-task/editable-fields.vue +0 -206
- package/packages/workflow-editor/src/properties-editors/human-task/events.vue +0 -60
- package/packages/workflow-editor/src/properties-editors/human-task/permission-settings.vue +0 -224
- package/packages/workflow-editor/src/properties-editors/human-task/selection-conditions.vue +0 -499
- package/packages/workflow-editor/src/properties-editors/human-task.vue +0 -107
- package/packages/workflow-editor/src/properties-editors/join.vue +0 -49
- package/packages/workflow-editor/src/properties-editors/process/basic-properties.vue +0 -336
- package/packages/workflow-editor/src/properties-editors/process/events.vue +0 -79
- package/packages/workflow-editor/src/properties-editors/process/notice-settings.vue +0 -68
- package/packages/workflow-editor/src/properties-editors/process/parameter-settings.vue +0 -106
- package/packages/workflow-editor/src/properties-editors/process/permission-settings.vue +0 -28
- package/packages/workflow-editor/src/properties-editors/process/selectPage.vue +0 -88
- package/packages/workflow-editor/src/properties-editors/process.vue +0 -115
- package/packages/workflow-editor/src/properties-editors/subprocess/basic-properties.vue +0 -201
- package/packages/workflow-editor/src/properties-editors/subprocess/events.vue +0 -26
- package/packages/workflow-editor/src/properties-editors/subprocess/field-mappings.vue +0 -216
- package/packages/workflow-editor/src/properties-editors/subprocess/transactor-settings.vue +0 -66
- package/packages/workflow-editor/src/properties-editors/subprocess.vue +0 -80
- package/packages/workflow-editor/src/properties-editors/transition/basic-properties.vue +0 -53
- package/packages/workflow-editor/src/properties-editors/transition.vue +0 -75
- package/packages/workflow-editor/src/properties-editors/user-condition.js +0 -183
- package/packages/workflow-editor/src/store/getters.js +0 -33
- package/packages/workflow-editor/src/store/workflow-editor.js +0 -153
- package/packages/workflow-editor/src/taches/auto-task.vue +0 -99
- package/packages/workflow-editor/src/taches/common-methods.js +0 -21
- package/packages/workflow-editor/src/taches/copy-task.vue +0 -99
- package/packages/workflow-editor/src/taches/custom-task.vue +0 -88
- package/packages/workflow-editor/src/taches/decision.vue +0 -102
- package/packages/workflow-editor/src/taches/end.vue +0 -76
- package/packages/workflow-editor/src/taches/fork.vue +0 -102
- package/packages/workflow-editor/src/taches/human-decision.vue +0 -102
- package/packages/workflow-editor/src/taches/human-task.vue +0 -113
- package/packages/workflow-editor/src/taches/join.vue +0 -91
- package/packages/workflow-editor/src/taches/joint.vue +0 -177
- package/packages/workflow-editor/src/taches/start.vue +0 -76
- package/packages/workflow-editor/src/taches/subprocess.vue +0 -99
- package/packages/workflow-editor/src/taches/tache-resizer.vue +0 -80
- package/packages/workflow-editor/src/transitions/broken-line.vue +0 -91
- package/packages/workflow-editor/src/transitions/curve-line.vue +0 -91
- package/packages/workflow-editor/src/transitions/straight-line.vue +0 -26
- package/packages/workflow-editor/src/transitions/transition.vue +0 -209
- package/packages/workflow-editor/src/transitions/virtual-transition.vue +0 -43
- package/packages/workflow-editor/src/util.js +0 -499
- package/packages/workflow-editor/src/workflow-editor.vue +0 -852
- package/packages/workflow-editor/src/workflow-history.vue +0 -153
- package/src/i18n/i18n.js +0 -16
- package/src/i18n/langs/cn.js +0 -521
- package/src/i18n/langs/en.js +0 -529
- /package/{public → dist}/vite.svg +0 -0
|
@@ -1,723 +0,0 @@
|
|
|
1
|
-
import Validator from 'async-validator'
|
|
2
|
-
import { getI18n } from '../workflow-editor/src/util'
|
|
3
|
-
import { parseSubTablePermissionCondition } from 'agilebuilder-ui/src/utils/calculator/calculator-util'
|
|
4
|
-
function getLeafPropRule(editField, dataTypeMap) {
|
|
5
|
-
const rule = {}
|
|
6
|
-
const dataType = editField.dataType
|
|
7
|
-
if (dataType === 'DATE' || dataType === 'TIME') {
|
|
8
|
-
// 对象的值需要是毫秒值数字
|
|
9
|
-
// if (editField.valueType && editField.valueType === 'number') {
|
|
10
|
-
// // 表示值是毫秒值
|
|
11
|
-
// rule.type = 'number'
|
|
12
|
-
// }
|
|
13
|
-
rule.type = 'date'
|
|
14
|
-
packageCustomValidator(rule)
|
|
15
|
-
rule.message = editField.label + ' ' + getI18n().t('workflowEditorMessage.requiredAndMustBeADate')
|
|
16
|
-
} else if (dataType === 'INTEGER' || dataType === 'LONG') {
|
|
17
|
-
// rule.type = 'number'
|
|
18
|
-
rule.pattern = /^-?\d+$/
|
|
19
|
-
rule.message = editField.label + ' ' + getI18n().t('workflowEditorMessage.requiredAndMustBeAnInteger')
|
|
20
|
-
} else if (dataType === 'FLOAT' || dataType === 'DOUBLE') {
|
|
21
|
-
rule.pattern = new RegExp('^(-?\\d+)(\\.\\d+)?$')
|
|
22
|
-
rule.message = editField.label + ' ' + getI18n().t('workflowEditorMessage.requiredAndMustBeDecimal')
|
|
23
|
-
} else if (dataType === 'BOOLEAN') {
|
|
24
|
-
rule.type = 'boolean'
|
|
25
|
-
rule.message = editField.label + ' ' + getI18n().t('workflowEditorMessage.mustFill')
|
|
26
|
-
// 布尔型校验需要自定义,为了兼容oracle和mysql数据
|
|
27
|
-
packageCustomValidator(rule)
|
|
28
|
-
} else {
|
|
29
|
-
// if (entity[editField.name] || entity[editField.name] === 0) {
|
|
30
|
-
// if (typeof entity[editField.name] === 'number' && dataType === 'TEXT') {
|
|
31
|
-
// rule.type = 'number'
|
|
32
|
-
// }
|
|
33
|
-
// }
|
|
34
|
-
rule.message = editField.label + ' ' + getI18n().t('workflowEditorMessage.mustFill')
|
|
35
|
-
}
|
|
36
|
-
if (editField.canEdit) {
|
|
37
|
-
rule.required = true
|
|
38
|
-
// 失去焦点时触发
|
|
39
|
-
rule.trigger = 'blur'
|
|
40
|
-
}
|
|
41
|
-
if (editField.rowIndexes) {
|
|
42
|
-
// 子表时受控制的行记录下标
|
|
43
|
-
rule.rowIndexes = editField.rowIndexes
|
|
44
|
-
}
|
|
45
|
-
if (editField.condition) {
|
|
46
|
-
// 必填条件
|
|
47
|
-
rule.condition = editField.condition
|
|
48
|
-
}
|
|
49
|
-
dataTypeMap[editField.name] = editField.dataType
|
|
50
|
-
return rule
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* 布尔型和日期校验需要自定义,为了兼容oracle和mysql数据库
|
|
55
|
-
* @param fieldRule
|
|
56
|
-
*/
|
|
57
|
-
function packageCustomValidator(fieldRule) {
|
|
58
|
-
if (fieldRule && fieldRule.type && fieldRule.type === 'boolean') {
|
|
59
|
-
fieldRule.validator = function (rule, value, callback) {
|
|
60
|
-
if (value === undefined || value === null) {
|
|
61
|
-
if (rule.required) {
|
|
62
|
-
return false
|
|
63
|
-
} else {
|
|
64
|
-
return true
|
|
65
|
-
}
|
|
66
|
-
} else if (typeof value === 'number' && (value === 1 || value === 0)) {
|
|
67
|
-
return true
|
|
68
|
-
} else if (typeof value === 'boolean' && (value === true || value === false)) {
|
|
69
|
-
return true
|
|
70
|
-
}
|
|
71
|
-
return false
|
|
72
|
-
}
|
|
73
|
-
} else if (fieldRule && fieldRule.type && fieldRule.type === 'date') {
|
|
74
|
-
fieldRule.validator = function (rule, value, callback) {
|
|
75
|
-
if (value === undefined || value === null) {
|
|
76
|
-
if (rule.required) {
|
|
77
|
-
return false
|
|
78
|
-
} else {
|
|
79
|
-
return true
|
|
80
|
-
}
|
|
81
|
-
} else {
|
|
82
|
-
// 验证是否是合法日期
|
|
83
|
-
const date = new Date(value)
|
|
84
|
-
return !isNaN(date.getTime())
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* 获得对象验证规则
|
|
92
|
-
* @param {*} editField 字段信息
|
|
93
|
-
* @param {*} rules 验证规则
|
|
94
|
-
*/
|
|
95
|
-
function setObjectPropRule(editField, rules, isSql, dataTypeMap) {
|
|
96
|
-
const rule = {}
|
|
97
|
-
let prop = editField.name
|
|
98
|
-
if (isSql === true) {
|
|
99
|
-
prop = underscoreName(prop)
|
|
100
|
-
}
|
|
101
|
-
if (!rules) {
|
|
102
|
-
rules = {}
|
|
103
|
-
}
|
|
104
|
-
const props = prop.split('.')
|
|
105
|
-
for (let num = 0; num < props.length; num++) {
|
|
106
|
-
const subProp = props[num]
|
|
107
|
-
let objectRule
|
|
108
|
-
if (num === props.length - 1) {
|
|
109
|
-
// 说明是最后一个
|
|
110
|
-
objectRule = getEndObjectRule(rule, props, subProp)
|
|
111
|
-
objectRule.fields[subProp] = getLeafPropRule(editField, dataTypeMap)
|
|
112
|
-
} else {
|
|
113
|
-
let lastObjectRule
|
|
114
|
-
if (num === 0) {
|
|
115
|
-
objectRule = rules
|
|
116
|
-
} else {
|
|
117
|
-
lastObjectRule = getLastObjectRule(rule, props, props[num - 1])
|
|
118
|
-
objectRule = lastObjectRule.fields
|
|
119
|
-
}
|
|
120
|
-
if (!objectRule[subProp]) {
|
|
121
|
-
objectRule[subProp] = {
|
|
122
|
-
type: 'object',
|
|
123
|
-
required: true,
|
|
124
|
-
fields: {}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
if (num === 0) {
|
|
128
|
-
rule[subProp] = objectRule[subProp]
|
|
129
|
-
} else {
|
|
130
|
-
lastObjectRule.fields[subProp] = objectRule[subProp]
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function getLastObjectRule(rule, props, currentProp) {
|
|
137
|
-
let lastObjectdRule
|
|
138
|
-
for (let i = 0; i < props.length; i++) {
|
|
139
|
-
const subProp = props[i]
|
|
140
|
-
if (i === 0) {
|
|
141
|
-
lastObjectdRule = rule[subProp]
|
|
142
|
-
} else {
|
|
143
|
-
lastObjectdRule = lastObjectdRule.fields[props[i]]
|
|
144
|
-
}
|
|
145
|
-
if (subProp === currentProp) {
|
|
146
|
-
break
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return lastObjectdRule
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
function getEndObjectRule(rule, props, currentProp) {
|
|
153
|
-
let lastObjectdRule
|
|
154
|
-
for (let i = 0; i < props.length; i++) {
|
|
155
|
-
if (i === 0) {
|
|
156
|
-
lastObjectdRule = rule[props[i]]
|
|
157
|
-
} else {
|
|
158
|
-
lastObjectdRule = lastObjectdRule.fields[props[i]]
|
|
159
|
-
}
|
|
160
|
-
if (i !== props.length - 1) {
|
|
161
|
-
const leafSubProp = props[i + 1]
|
|
162
|
-
if (leafSubProp === currentProp) {
|
|
163
|
-
break
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
return lastObjectdRule
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* 获得主表及子表验证规则
|
|
172
|
-
* @param {editFieldInfos} editFieldInfos 编辑字段信息集合
|
|
173
|
-
* @param {entity} entity 当前表单数据model
|
|
174
|
-
* @param {isSql} isSql 是否是sql操作流程表单,如果是字段名需要修改为下划线命名规则
|
|
175
|
-
*/
|
|
176
|
-
function getValidator(editFieldInfos, entity, isSql, additionalParamMap, taskParamMap, contextParameter) {
|
|
177
|
-
// console.log('workflowEditor-getValidator-editFieldInfos=', editFieldInfos, 'entity=', entity, 'isSql', isSql)
|
|
178
|
-
if (typeof isSql === 'undefined') {
|
|
179
|
-
isSql = false
|
|
180
|
-
}
|
|
181
|
-
// 主表验证规则
|
|
182
|
-
const rules = {}
|
|
183
|
-
// 子表验证规则,格式为:
|
|
184
|
-
// {prop:
|
|
185
|
-
// {subField1:{required: true},
|
|
186
|
-
// subField2:{required: true}
|
|
187
|
-
// }
|
|
188
|
-
// }
|
|
189
|
-
// 子表整个表的权限
|
|
190
|
-
// {
|
|
191
|
-
// 子表表名1:{required:true/false(必填/禁止编辑),message:'xxx子表必需录入数据'},
|
|
192
|
-
// 子表表名2:{required:true/false(必填/禁止编辑),message:'xxx子表必需录入数据'}
|
|
193
|
-
// }
|
|
194
|
-
const dataTypeMap = {}
|
|
195
|
-
const totalSubRules = {}
|
|
196
|
-
const subRules = {}
|
|
197
|
-
if (editFieldInfos) {
|
|
198
|
-
editFieldInfos.forEach((editField) => {
|
|
199
|
-
const canEdit = editField.canEdit
|
|
200
|
-
// 必填
|
|
201
|
-
if (typeof canEdit !== 'undefined' && canEdit === true) {
|
|
202
|
-
let prop = editField.name
|
|
203
|
-
if (prop) {
|
|
204
|
-
if (isSql === true) {
|
|
205
|
-
prop = underscoreName(prop)
|
|
206
|
-
}
|
|
207
|
-
const condition = editField.condition
|
|
208
|
-
const parentFormData = null
|
|
209
|
-
let result = null
|
|
210
|
-
if (prop.indexOf('.') > 0 && prop.indexOf('$') === 0) {
|
|
211
|
-
// 当是子表记录时候 result设置为true 获取行记录校验条件
|
|
212
|
-
result = true
|
|
213
|
-
} else {
|
|
214
|
-
result = parseSubTablePermissionCondition(
|
|
215
|
-
condition,
|
|
216
|
-
dataTypeMap,
|
|
217
|
-
parentFormData,
|
|
218
|
-
entity,
|
|
219
|
-
additionalParamMap,
|
|
220
|
-
taskParamMap,
|
|
221
|
-
contextParameter
|
|
222
|
-
)
|
|
223
|
-
}
|
|
224
|
-
if (result !== undefined && result !== null && result === true) {
|
|
225
|
-
let rule = {}
|
|
226
|
-
if (prop.indexOf('.') > 0) {
|
|
227
|
-
if (prop.indexOf('$') === 0) {
|
|
228
|
-
// 表示是子表字段
|
|
229
|
-
setSubObjectFieldRule(editField, subRules, entity, isSql, dataTypeMap)
|
|
230
|
-
} else {
|
|
231
|
-
// 表示是主表的关联属性字段。
|
|
232
|
-
setMainObjectFieldRule(editField, rules, entity, isSql, dataTypeMap)
|
|
233
|
-
}
|
|
234
|
-
} else if (prop.indexOf('$') === 0) {
|
|
235
|
-
// 表示是子表整个表的权限
|
|
236
|
-
// 获得子表表名
|
|
237
|
-
const subTable = prop.substring(prop.indexOf('$') + 1)
|
|
238
|
-
totalSubRules[subTable] = {
|
|
239
|
-
required: true,
|
|
240
|
-
message: getI18n().t('workflowEditorMessage.subTableMustInputDatas', {
|
|
241
|
-
subTable: editField.label
|
|
242
|
-
})
|
|
243
|
-
}
|
|
244
|
-
} else {
|
|
245
|
-
// 表示是主表的直接属性
|
|
246
|
-
rule = getLeafPropRule(editField, dataTypeMap, entity)
|
|
247
|
-
rules[prop] = rule
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
})
|
|
253
|
-
}
|
|
254
|
-
// console.log('rules', rules, 'subRules=', subRules, 'totalSubRules=', totalSubRules)
|
|
255
|
-
const subRulesKeys = Object.keys(subRules)
|
|
256
|
-
if (subRulesKeys.length > 0 || Object.keys(totalSubRules).length > 0) {
|
|
257
|
-
// 表示有子表规则
|
|
258
|
-
return {
|
|
259
|
-
rules,
|
|
260
|
-
subRules,
|
|
261
|
-
totalSubRules,
|
|
262
|
-
dataTypeMap
|
|
263
|
-
}
|
|
264
|
-
} else {
|
|
265
|
-
// 表示只有主表规则
|
|
266
|
-
return rules
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* 设置主对象字段验证规则
|
|
272
|
-
*/
|
|
273
|
-
function setMainObjectFieldRule(editField, rules, entity, isSql, dataTypeMap) {
|
|
274
|
-
// 例如:a.b.c
|
|
275
|
-
let prop = editField.name
|
|
276
|
-
if (isSql === true) {
|
|
277
|
-
prop = underscoreName(prop)
|
|
278
|
-
}
|
|
279
|
-
// 获得a
|
|
280
|
-
const mainProp = prop.substring(0, prop.indexOf('.'))
|
|
281
|
-
if (entity) {
|
|
282
|
-
if (!entity[mainProp]) {
|
|
283
|
-
entity[mainProp] = {}
|
|
284
|
-
}
|
|
285
|
-
const mainEntity = entity[mainProp]
|
|
286
|
-
// 说明这个字段是该表单的字段,才需要添加验证
|
|
287
|
-
// 不是该表单的字段的情况,可能是被数据表删除的字段,但是没有修改流程图表单字段权限设置导致的
|
|
288
|
-
// 获得b.c
|
|
289
|
-
const mainSubProp = prop.substring(prop.indexOf('.') + 1)
|
|
290
|
-
if (isNeedValidate(mainSubProp, mainEntity)) {
|
|
291
|
-
// 需要验证该字段,表示是表单的字段
|
|
292
|
-
setObjectPropRule(editField, rules, isSql, dataTypeMap)
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* 是否需要验证该属性,例如:b.c 或 a
|
|
299
|
-
* @param {*} mainSubProp 字段信息,例如:字段为:a.b.c,则mainSubProp应为b.c
|
|
300
|
-
* @param {*} mainEntity
|
|
301
|
-
*/
|
|
302
|
-
function isNeedValidate(mainSubProp, mainEntity) {
|
|
303
|
-
// 表示由可以必填
|
|
304
|
-
if (mainSubProp.indexOf('.') > 0) {
|
|
305
|
-
let parentObject = mainEntity
|
|
306
|
-
const subProps = mainSubProp.split('.')
|
|
307
|
-
for (let num = 0; num < subProps.length - 1; num++) {
|
|
308
|
-
const subProp = subProps[num]
|
|
309
|
-
if (!parentObject || !parentObject[subProp]) {
|
|
310
|
-
// 当前对象不存在,不是该表单的字段,不需要验证
|
|
311
|
-
return false
|
|
312
|
-
}
|
|
313
|
-
// 重新给"父对象"赋值,为下次循环准备
|
|
314
|
-
parentObject = parentObject[subProp]
|
|
315
|
-
}
|
|
316
|
-
return true
|
|
317
|
-
} else {
|
|
318
|
-
return true
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
function setSubObjectFieldRule(editField, subRules, entity, isSql, dataTypeMap) {
|
|
323
|
-
let prop = editField.name
|
|
324
|
-
if (isSql === true) {
|
|
325
|
-
prop = underscoreName(prop)
|
|
326
|
-
}
|
|
327
|
-
// 获得主表字段名称
|
|
328
|
-
const mainProp = prop.substring(prop.indexOf('$') + 1, prop.indexOf('.'))
|
|
329
|
-
if (!entity) {
|
|
330
|
-
return
|
|
331
|
-
}
|
|
332
|
-
const tableData = entity[mainProp]
|
|
333
|
-
// V10注释, 因为在gets请求后就来获取校验,此时实体内的子表数据还没有加载完成,所以会导致没有添加上子表的数据校验规则
|
|
334
|
-
// if (typeof (tableData) === 'undefined' || tableData === null || tableData.length === 0) {
|
|
335
|
-
// // 表单中不存在该子表字段,不需要验证
|
|
336
|
-
// return
|
|
337
|
-
// }
|
|
338
|
-
// 获得子表字段名
|
|
339
|
-
const subProp = prop.substring(prop.indexOf('.') + 1)
|
|
340
|
-
// mainProp对应的所有子表字段验证规则信息
|
|
341
|
-
if (!subRules[mainProp]) {
|
|
342
|
-
subRules[mainProp] = {}
|
|
343
|
-
}
|
|
344
|
-
// 修改属性名为去掉$mainProp的字段名
|
|
345
|
-
// 此处要重新拷贝一份字段,否则会导致原字段的name信息被修改
|
|
346
|
-
const copyEditField = JSON.parse(JSON.stringify(editField))
|
|
347
|
-
copyEditField.name = subProp
|
|
348
|
-
if (subProp.indexOf('.') > 0) {
|
|
349
|
-
// 表示关联属性
|
|
350
|
-
if (typeof tableData !== 'undefined' && tableData === null && tableData.length === 0) {
|
|
351
|
-
const subEntity = tableData[0]
|
|
352
|
-
setMainObjectFieldRule(copyEditField, subRules[mainProp], subEntity, isSql, dataTypeMap)
|
|
353
|
-
}
|
|
354
|
-
} else {
|
|
355
|
-
// 表示是子表的直接属性
|
|
356
|
-
subRules[mainProp][subProp] = getLeafPropRule(copyEditField, dataTypeMap)
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
function validator(entity, validateRules, rowIndex, isSql, pageNum, pageRowIndex, isNeedField) {
|
|
361
|
-
return validatorEntity(entity, validateRules, rowIndex, true, isSql, pageNum, pageRowIndex, isNeedField)
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
*
|
|
365
|
-
* @param {*} entity
|
|
366
|
-
* @param {*} validateRules
|
|
367
|
-
* @param {*} rowIndex
|
|
368
|
-
* @param {*} isShouldRepeateValdate 是否需要再次验证大写字段名
|
|
369
|
-
* @returns
|
|
370
|
-
*/
|
|
371
|
-
function validatorEntity(entity, validateRules, rowIndex, isShouldRepeateValdate, isSql, pageNum, pageRowIndex, isNeedField) {
|
|
372
|
-
let result = false
|
|
373
|
-
const validator = new Validator(validateRules)
|
|
374
|
-
let fieldName
|
|
375
|
-
validator.validate(
|
|
376
|
-
entity,
|
|
377
|
-
{
|
|
378
|
-
first: true
|
|
379
|
-
},
|
|
380
|
-
(errors, fields) => {
|
|
381
|
-
if (errors) {
|
|
382
|
-
const message = errors[0]['message']
|
|
383
|
-
fieldName = errors[0]['field']
|
|
384
|
-
if (typeof rowIndex !== 'undefined' && rowIndex !== null) {
|
|
385
|
-
// 表示是子表字段验证失败
|
|
386
|
-
if (pageNum !== undefined && pageRowIndex !== undefined) {
|
|
387
|
-
// 表示子表分页时的验证提示信息
|
|
388
|
-
result =
|
|
389
|
-
getI18n().t('workflowEditorMessage.pageRecordLine', {
|
|
390
|
-
pageNum: pageNum,
|
|
391
|
-
row: pageRowIndex
|
|
392
|
-
}) +
|
|
393
|
-
',' +
|
|
394
|
-
message
|
|
395
|
-
} else {
|
|
396
|
-
result =
|
|
397
|
-
getI18n().t('workflowEditorMessage.recordLine', {
|
|
398
|
-
row: rowIndex + 1
|
|
399
|
-
}) +
|
|
400
|
-
',' +
|
|
401
|
-
message
|
|
402
|
-
}
|
|
403
|
-
} else {
|
|
404
|
-
// 表示是主表字段验证失败
|
|
405
|
-
result = message
|
|
406
|
-
}
|
|
407
|
-
} else {
|
|
408
|
-
result = true
|
|
409
|
-
}
|
|
410
|
-
if (fieldName && isShouldRepeateValdate === true) {
|
|
411
|
-
// 将实体中字段名改为大写,然后再验证一次该字段是否已填值。因为mysql中jdbc获得实体记录字段名是小写的,但是验证规则中字段名是大写的,所以会导致字段验证失败
|
|
412
|
-
const reg1 = /[A-Z]+/ // 大写字母
|
|
413
|
-
if (
|
|
414
|
-
isSql !== undefined &&
|
|
415
|
-
isSql === true &&
|
|
416
|
-
reg1.test(fieldName) &&
|
|
417
|
-
entity[fieldName.toLowerCase()] !== undefined
|
|
418
|
-
) {
|
|
419
|
-
const copyEntity = JSON.parse(JSON.stringify(entity))
|
|
420
|
-
copyEntity[fieldName.toUpperCase()] = entity[fieldName.toLowerCase()]
|
|
421
|
-
delete copyEntity[fieldName.toLowerCase()]
|
|
422
|
-
result = validatorEntity(copyEntity, validateRules, rowIndex, false, isSql, pageNum, pageRowIndex)
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
)
|
|
427
|
-
if(isNeedField){
|
|
428
|
-
let myResult = {msg: result, field: fieldName}
|
|
429
|
-
if(pageNum !== undefined && pageRowIndex !== undefined){
|
|
430
|
-
myResult.pageNum = pageNum
|
|
431
|
-
myResult.rowIndex = pageRowIndex
|
|
432
|
-
} else {
|
|
433
|
-
myResult.rowIndex = rowIndex
|
|
434
|
-
}
|
|
435
|
-
return myResult
|
|
436
|
-
} else {
|
|
437
|
-
return result
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
/**
|
|
442
|
-
* 验证子表必填验证
|
|
443
|
-
* @param {*}} entity
|
|
444
|
-
* @param {*} subRules
|
|
445
|
-
* @param {*} subTablePageInfo 列表分页信息{列表编码: 每页显示多少条记录}
|
|
446
|
-
*/
|
|
447
|
-
function validateSub(
|
|
448
|
-
entity,
|
|
449
|
-
subRules,
|
|
450
|
-
totalSubRules,
|
|
451
|
-
isSql,
|
|
452
|
-
dataTypeMap,
|
|
453
|
-
additionalParamMap,
|
|
454
|
-
taskParamMap,
|
|
455
|
-
contextParameter,
|
|
456
|
-
subTablePageInfo,
|
|
457
|
-
isNeedField
|
|
458
|
-
) {
|
|
459
|
-
let copyTotalSubRules = {}
|
|
460
|
-
if (totalSubRules) {
|
|
461
|
-
copyTotalSubRules = JSON.parse(JSON.stringify(totalSubRules))
|
|
462
|
-
}
|
|
463
|
-
if (subRules) {
|
|
464
|
-
console.log('formValidator333--subRules=', subRules)
|
|
465
|
-
const subProps = Object.keys(subRules)
|
|
466
|
-
for (let i = 0; i < subProps.length; i++) {
|
|
467
|
-
const prop = subProps[i]
|
|
468
|
-
const subFieldRule = subRules[prop]
|
|
469
|
-
console.log('formValidator44--subFieldRule=', subFieldRule)
|
|
470
|
-
// 受控制的行下标集合
|
|
471
|
-
const subFieldProps = Object.keys(subFieldRule)
|
|
472
|
-
console.log('formValidator555--subFieldProps=', subFieldProps)
|
|
473
|
-
let subTableData = entity[prop]
|
|
474
|
-
if (!subTableData) {
|
|
475
|
-
// 如果子表集合数据不存在
|
|
476
|
-
subTableData = []
|
|
477
|
-
}
|
|
478
|
-
// 验证整个子表是否已填记录,如果是必填,但是没有子记录集合,则提示
|
|
479
|
-
const validateResult = validateTotalSubTable(copyTotalSubRules, entity, prop)
|
|
480
|
-
if (validateResult !== true) {
|
|
481
|
-
delete copyTotalSubRules[prop]
|
|
482
|
-
if(isNeedField){
|
|
483
|
-
return {msg: validateResult, listCode: prop}
|
|
484
|
-
} else {
|
|
485
|
-
return validateResult
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
let pageSize
|
|
489
|
-
let hasAuthFields = []
|
|
490
|
-
if (subTablePageInfo && subTablePageInfo[prop]) {
|
|
491
|
-
pageSize = subTablePageInfo[prop].pageSize
|
|
492
|
-
hasAuthFields = subTablePageInfo[prop].fields || []
|
|
493
|
-
}
|
|
494
|
-
for (let j = 0; j < subTableData.length; j++) {
|
|
495
|
-
const rowData = subTableData[j]
|
|
496
|
-
const rowRule = packageRowRule(
|
|
497
|
-
subFieldProps,
|
|
498
|
-
subFieldRule,
|
|
499
|
-
subTableData[j],
|
|
500
|
-
dataTypeMap,
|
|
501
|
-
entity,
|
|
502
|
-
additionalParamMap,
|
|
503
|
-
taskParamMap,
|
|
504
|
-
contextParameter,
|
|
505
|
-
hasAuthFields
|
|
506
|
-
)
|
|
507
|
-
console.log('formValidator666--rowRule=', rowRule)
|
|
508
|
-
let pageNum
|
|
509
|
-
// 每页的记录下标,提示时使用
|
|
510
|
-
let pageRowIndex
|
|
511
|
-
if (pageSize !== undefined && pageSize > 0) {
|
|
512
|
-
pageNum = Math.ceil((j + 1) / pageSize)
|
|
513
|
-
pageRowIndex = j + 1 - (pageNum - 1) * pageSize
|
|
514
|
-
}
|
|
515
|
-
Object.keys(rowRule).forEach((field) => {
|
|
516
|
-
const fieldRule = rowRule[field]
|
|
517
|
-
if (fieldRule && fieldRule.rules) {
|
|
518
|
-
// 如果有rules规则,则将rules规则添加到rowRule中 ,为了统一表单和子表的校验规则传递参数方式
|
|
519
|
-
rowRule[field] = fieldRule.rules
|
|
520
|
-
}
|
|
521
|
-
if (fieldRule && fieldRule.beforeValidate) {
|
|
522
|
-
// 如果有beforeValidate方法,则执行
|
|
523
|
-
const beforeValidate = fieldRule.beforeValidate
|
|
524
|
-
if (typeof beforeValidate === 'function') {
|
|
525
|
-
const result = beforeValidate({
|
|
526
|
-
row: rowData,
|
|
527
|
-
parent: entity,
|
|
528
|
-
rowIndex: j
|
|
529
|
-
})
|
|
530
|
-
// 如果是false,表示当前规则不需要在当前行验证,
|
|
531
|
-
// 移除当前规则,其他行还是要根据beforeValidate的返回值判断是否需要验证
|
|
532
|
-
if (result === false) {
|
|
533
|
-
rowRule[field] = []
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
})
|
|
538
|
-
const validateResult = validator(rowData, rowRule, j, isSql, pageNum, pageRowIndex, isNeedField)
|
|
539
|
-
if ((!isNeedField && validateResult !== true) || (isNeedField && validateResult.msg !== true)) {
|
|
540
|
-
// 表示验证失败,无需继续验证
|
|
541
|
-
if(isNeedField){
|
|
542
|
-
validateResult.listCode = prop
|
|
543
|
-
}
|
|
544
|
-
return validateResult
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
for (const subTableName in copyTotalSubRules) {
|
|
551
|
-
const validateResult = validateTotalSubTable(copyTotalSubRules, entity, subTableName)
|
|
552
|
-
if (validateResult !== true) {
|
|
553
|
-
if(isNeedField){
|
|
554
|
-
return {msg: validateResult, listCode: subTableName}
|
|
555
|
-
} else {
|
|
556
|
-
return validateResult
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
return isNeedField?{msg: true}: true
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
function getEntityId(row) {
|
|
564
|
-
if (row && row.id) {
|
|
565
|
-
return row.id
|
|
566
|
-
} else if (row && row.ID) {
|
|
567
|
-
return row.ID
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
/**
|
|
572
|
-
* 封装行记录的验证规则
|
|
573
|
-
* @param {*}} subProps
|
|
574
|
-
* @param {*} subFieldRule
|
|
575
|
-
* @param {*} rowIndex
|
|
576
|
-
* @returns
|
|
577
|
-
*/
|
|
578
|
-
function packageRowRule(
|
|
579
|
-
subProps,
|
|
580
|
-
subFieldRule,
|
|
581
|
-
row,
|
|
582
|
-
dataTypeMap,
|
|
583
|
-
parentFormData,
|
|
584
|
-
additionalParamMap,
|
|
585
|
-
taskParamMap,
|
|
586
|
-
contextParameter,
|
|
587
|
-
hasAuthFields
|
|
588
|
-
) {
|
|
589
|
-
const rowId = getEntityId(row)
|
|
590
|
-
const rowRule = {}
|
|
591
|
-
for (let n = 0; n < subProps.length; n++) {
|
|
592
|
-
const field = subProps[n]
|
|
593
|
-
if (hasAuthFields.indexOf(field) < 0) {
|
|
594
|
-
// 如果没有权限编辑该字段,则不需要验证
|
|
595
|
-
continue
|
|
596
|
-
}
|
|
597
|
-
const fieldRule = subFieldRule[field]
|
|
598
|
-
const condition = fieldRule.condition
|
|
599
|
-
const result = parseSubTablePermissionCondition(
|
|
600
|
-
condition,
|
|
601
|
-
dataTypeMap,
|
|
602
|
-
parentFormData,
|
|
603
|
-
row,
|
|
604
|
-
additionalParamMap,
|
|
605
|
-
taskParamMap,
|
|
606
|
-
contextParameter
|
|
607
|
-
)
|
|
608
|
-
if (result !== undefined && result !== null && result === true) {
|
|
609
|
-
// 表示由可以必填
|
|
610
|
-
if (rowId === undefined) {
|
|
611
|
-
// 表示是新建的记录,需要验证
|
|
612
|
-
rowRule[field] = fieldRule
|
|
613
|
-
} else {
|
|
614
|
-
// 表示是已保存的记录,验证id是否在可修改的集合内
|
|
615
|
-
const rowIndexes = fieldRule.rowIndexes
|
|
616
|
-
if (!rowIndexes || rowIndexes.indexOf(rowId) >= 0) {
|
|
617
|
-
// 表示该行记录的该字段需要做必填验证
|
|
618
|
-
rowRule[field] = fieldRule
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
return rowRule
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
// 验证整个子表是否已填记录
|
|
627
|
-
function validateTotalSubTable(totalSubRules, entity, subTableName) {
|
|
628
|
-
let subTableData = entity[subTableName]
|
|
629
|
-
if (!subTableData) {
|
|
630
|
-
// 如果子表集合数据不存在
|
|
631
|
-
subTableData = []
|
|
632
|
-
}
|
|
633
|
-
if (
|
|
634
|
-
subTableData.length === 0 &&
|
|
635
|
-
totalSubRules &&
|
|
636
|
-
totalSubRules[subTableName] &&
|
|
637
|
-
totalSubRules[subTableName].required !== undefined &&
|
|
638
|
-
totalSubRules[subTableName].required === true
|
|
639
|
-
) {
|
|
640
|
-
return totalSubRules[subTableName].message
|
|
641
|
-
}
|
|
642
|
-
return true
|
|
643
|
-
}
|
|
644
|
-
/**
|
|
645
|
-
*
|
|
646
|
-
* @param {*} entity
|
|
647
|
-
* @param {*} validateRules
|
|
648
|
-
* @param {*} isSql
|
|
649
|
-
* @param {*} additionalParamMap
|
|
650
|
-
* @param {*} taskParamMap
|
|
651
|
-
* @param {*} contextParameter
|
|
652
|
-
* @param {*} subTablePageInfo
|
|
653
|
-
* @param {*} isNeedField 如果为true,表示返回的是{}对象,msg: true/提示信息、field:字段名
|
|
654
|
-
* @returns
|
|
655
|
-
*/
|
|
656
|
-
function formValidator(
|
|
657
|
-
entity,
|
|
658
|
-
validateRules,
|
|
659
|
-
isSql,
|
|
660
|
-
additionalParamMap,
|
|
661
|
-
taskParamMap,
|
|
662
|
-
contextParameter,
|
|
663
|
-
subTablePageInfo,
|
|
664
|
-
isNeedField
|
|
665
|
-
) {
|
|
666
|
-
const validateRulesKeys = Object.keys(validateRules)
|
|
667
|
-
if (
|
|
668
|
-
validateRulesKeys.indexOf('rules') >= 0 &&
|
|
669
|
-
validateRulesKeys.indexOf('subRules') >= 0 &&
|
|
670
|
-
validateRulesKeys.indexOf('totalSubRules') >= 0
|
|
671
|
-
) {
|
|
672
|
-
// 表示是带有子表验证规则的
|
|
673
|
-
const rules = validateRules.rules
|
|
674
|
-
const subRules = validateRules.subRules
|
|
675
|
-
const totalSubRules = validateRules.totalSubRules
|
|
676
|
-
const dataTypeMap = validateRules.dataTypeMap
|
|
677
|
-
let validateResult = validator(entity, rules, null, isSql, null, null, isNeedField)
|
|
678
|
-
if ((!isNeedField && validateResult === true) || (isNeedField && validateResult.msg === true)) {
|
|
679
|
-
if (subRules || totalSubRules) {
|
|
680
|
-
validateResult = validateSub(
|
|
681
|
-
entity,
|
|
682
|
-
subRules,
|
|
683
|
-
totalSubRules,
|
|
684
|
-
isSql,
|
|
685
|
-
dataTypeMap,
|
|
686
|
-
additionalParamMap,
|
|
687
|
-
taskParamMap,
|
|
688
|
-
contextParameter,
|
|
689
|
-
subTablePageInfo,
|
|
690
|
-
isNeedField
|
|
691
|
-
)
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
return validateResult
|
|
695
|
-
} else {
|
|
696
|
-
// 表示没有子表验证规则
|
|
697
|
-
return validator(entity, validateRules, null, isSql, null, null, isNeedField)
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
// 驼峰命名改为下划线命名,例如:helloWord->hello_world
|
|
702
|
-
function underscoreName(name) {
|
|
703
|
-
// if (name.indexOf('_') > 0) {
|
|
704
|
-
// 如果包括下划线,表示是下划线命名,需要再转换
|
|
705
|
-
return name
|
|
706
|
-
// }
|
|
707
|
-
// return name.replace(/([A-Z])/g, '_$1').toLowerCase()
|
|
708
|
-
}
|
|
709
|
-
// 下划线命名改为驼峰命名,例如:hello_word->helloWorld
|
|
710
|
-
// function camelName(name) {
|
|
711
|
-
// if (name.indexOf('_') < 0) {
|
|
712
|
-
// // 如果不包括下划线不需要转换
|
|
713
|
-
// return name
|
|
714
|
-
// }
|
|
715
|
-
// return name.replace(/_(\w)/g, function(all, letter) {
|
|
716
|
-
// return letter.toUpperCase()
|
|
717
|
-
// })
|
|
718
|
-
// }
|
|
719
|
-
|
|
720
|
-
export default {
|
|
721
|
-
formValidator,
|
|
722
|
-
getValidator
|
|
723
|
-
}
|