fix: 去除流程设计器跳过表达式值为null
parent
de8e4d5881
commit
31e14dd7a3
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import mixinPanel from '../../common/mixinPanel'
|
import mixinPanel from '../../common/mixinPanel'
|
||||||
|
import {StrUtil} from '@/utils/StrUtil'
|
||||||
import mixinExecutionListener from '../../common/mixinExecutionListener'
|
import mixinExecutionListener from '../../common/mixinExecutionListener'
|
||||||
import { commonParse, conditionExpressionParse } from '../../common/parseElement'
|
import { commonParse, conditionExpressionParse } from '../../common/parseElement'
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -69,16 +70,20 @@ export default {
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'formData.conditionExpression': function(val) {
|
'formData.conditionExpression': function(val) {
|
||||||
if (val) {
|
if (StrUtil.isNotBlank(val)) {
|
||||||
const newCondition = this.modeler.get('moddle').create('bpmn:FormalExpression', { body: val })
|
const newCondition = this.modeler.get('moddle').create('bpmn:FormalExpression', { body: val })
|
||||||
this.updateProperties({ conditionExpression: newCondition })
|
this.updateProperties({ conditionExpression: newCondition })
|
||||||
} else {
|
|
||||||
this.updateProperties({ conditionExpression: null })
|
|
||||||
}
|
}
|
||||||
|
// else {
|
||||||
|
// this.updateProperties({ conditionExpression: null })
|
||||||
|
// }
|
||||||
},
|
},
|
||||||
'formData.skipExpression': function(val) {
|
'formData.skipExpression': function(val) {
|
||||||
if (val === '') val = null
|
if (StrUtil.isNotBlank(val)) {
|
||||||
this.updateProperties({ 'flowable:skipExpression': val })
|
this.updateProperties({'flowable:skipExpression': val})
|
||||||
|
} else {
|
||||||
|
delete this.element.businessObject.$attrs[`flowable:skipExpression`]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,7 @@ import executionListenerDialog from './property/executionListener'
|
||||||
import taskListenerDialog from './property/taskListener'
|
import taskListenerDialog from './property/taskListener'
|
||||||
import multiInstanceDialog from './property/multiInstance'
|
import multiInstanceDialog from './property/multiInstance'
|
||||||
import { commonParse, userTaskParse } from '../../common/parseElement'
|
import { commonParse, userTaskParse } from '../../common/parseElement'
|
||||||
|
import {StrUtil} from '@/utils/StrUtil'
|
||||||
import FlowUser from '@/components/flow/User'
|
import FlowUser from '@/components/flow/User'
|
||||||
import FlowRole from '@/components/flow/Role'
|
import FlowRole from '@/components/flow/Role'
|
||||||
import FlowExp from '@/components/flow/Expression'
|
import FlowExp from '@/components/flow/Expression'
|
||||||
|
|
@ -357,7 +358,7 @@ export default {
|
||||||
watch: {
|
watch: {
|
||||||
'formData.userType': function(val, oldVal) {
|
'formData.userType': function(val, oldVal) {
|
||||||
const types = ['assignee', 'candidateUsers', 'candidateGroups']
|
const types = ['assignee', 'candidateUsers', 'candidateGroups']
|
||||||
if (oldVal) {
|
if (StrUtil.isNotBlank(oldVal)) {
|
||||||
types.forEach(type => {
|
types.forEach(type => {
|
||||||
delete this.element.businessObject.$attrs[`flowable:${type}`]
|
delete this.element.businessObject.$attrs[`flowable:${type}`]
|
||||||
delete this.formData[type]
|
delete this.formData[type]
|
||||||
|
|
@ -367,67 +368,69 @@ export default {
|
||||||
this.updateProperties({'flowable:userType': val})
|
this.updateProperties({'flowable:userType': val})
|
||||||
},
|
},
|
||||||
'formData.async': function(val) {
|
'formData.async': function(val) {
|
||||||
if (val) {
|
if (StrUtil.isNotBlank(val)) {
|
||||||
this.updateProperties({'flowable:async': val})
|
this.updateProperties({'flowable:async': val})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'formData.dueDate': function(val) {
|
'formData.dueDate': function(val) {
|
||||||
if (val) {
|
if (StrUtil.isNotBlank(val)) {
|
||||||
this.updateProperties({'flowable:dueDate': val})
|
this.updateProperties({'flowable:dueDate': val})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'formData.formKey': function(val) {
|
'formData.formKey': function(val) {
|
||||||
if (val) {
|
if (StrUtil.isNotBlank(val)) {
|
||||||
this.updateProperties({'flowable:formKey': val})
|
this.updateProperties({'flowable:formKey': val})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'formData.priority': function(val) {
|
'formData.priority': function(val) {
|
||||||
if (val) {
|
if (StrUtil.isNotBlank(val)) {
|
||||||
this.updateProperties({'flowable:priority': val})
|
this.updateProperties({'flowable:priority': val})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'formData.skipExpression': function(val) {
|
'formData.skipExpression': function(val) {
|
||||||
if (val) {
|
if (StrUtil.isNotBlank(val)) {
|
||||||
this.updateProperties({'flowable:skipExpression': val})
|
this.updateProperties({'flowable:skipExpression': val})
|
||||||
|
} else {
|
||||||
|
delete this.element.businessObject.$attrs[`flowable:skipExpression`]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'formData.isForCompensation': function(val) {
|
'formData.isForCompensation': function(val) {
|
||||||
if (val) {
|
if (StrUtil.isNotBlank(val)) {
|
||||||
this.updateProperties({'isForCompensation': val})
|
this.updateProperties({'isForCompensation': val})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'formData.triggerable': function(val) {
|
'formData.triggerable': function(val) {
|
||||||
if (val) {
|
if (StrUtil.isNotBlank(val)) {
|
||||||
this.updateProperties({'flowable:triggerable': val})
|
this.updateProperties({'flowable:triggerable': val})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'formData.class': function(val) {
|
'formData.class': function(val) {
|
||||||
if (val) {
|
if (StrUtil.isNotBlank(val)) {
|
||||||
this.updateProperties({'flowable:class': val})
|
this.updateProperties({'flowable:class': val})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'formData.autoStoreVariables': function(val) {
|
'formData.autoStoreVariables': function(val) {
|
||||||
if (val) {
|
if (StrUtil.isNotBlank(val)) {
|
||||||
this.updateProperties({'flowable:autoStoreVariables': val})
|
this.updateProperties({'flowable:autoStoreVariables': val})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'formData.exclude': function(val) {
|
'formData.exclude': function(val) {
|
||||||
if (val) {
|
if (StrUtil.isNotBlank(val)) {
|
||||||
this.updateProperties({'flowable:exclude': val})
|
this.updateProperties({'flowable:exclude': val})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'formData.ruleVariablesInput': function(val) {
|
'formData.ruleVariablesInput': function(val) {
|
||||||
if (val) {
|
if (StrUtil.isNotBlank(val)) {
|
||||||
this.updateProperties({'flowable:ruleVariablesInput': val})
|
this.updateProperties({'flowable:ruleVariablesInput': val})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'formData.rules': function(val) {
|
'formData.rules': function(val) {
|
||||||
if (val) {
|
if (StrUtil.isNotBlank(val)) {
|
||||||
this.updateProperties({'flowable:rules': val})
|
this.updateProperties({'flowable:rules': val})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'formData.resultVariable': function(val) {
|
'formData.resultVariable': function(val) {
|
||||||
if (val) {
|
if (StrUtil.isNotBlank(val)) {
|
||||||
this.updateProperties({'flowable:resultVariable': val})
|
this.updateProperties({'flowable:resultVariable': val})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,153 @@
|
||||||
|
/**
|
||||||
|
* 字符串工具类
|
||||||
|
**/
|
||||||
|
export const StrUtil = {
|
||||||
|
/**
|
||||||
|
* 字符串是否为空白 空白的定义如下: <br>
|
||||||
|
* 1、为null <br>
|
||||||
|
* 2、为不可见字符(如空格)<br>
|
||||||
|
* 3、""<br>
|
||||||
|
*
|
||||||
|
* @param str 被检测的字符串
|
||||||
|
* @return boolean 是否为空
|
||||||
|
*/
|
||||||
|
isBlank: function (str) {
|
||||||
|
return str === undefined || str == null || this.trim(str) === "";
|
||||||
|
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 字符串是否为非空白 空白的定义如下: <br>
|
||||||
|
* 1、不为null <br>
|
||||||
|
* 2、不为不可见字符(如空格)<br>
|
||||||
|
* 3、不为""<br>
|
||||||
|
*
|
||||||
|
* @param str 被检测的字符串
|
||||||
|
* @return boolean 是否为非空
|
||||||
|
*/
|
||||||
|
isNotBlank: function (str) {
|
||||||
|
// == 代表相同,=== 代表严格相同
|
||||||
|
return false === StrUtil.isBlank(str);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 字符串是否为空,空的定义如下:<br>
|
||||||
|
* 1、为null <br>
|
||||||
|
* 2、为""<br>
|
||||||
|
*
|
||||||
|
* @param str 被检测的字符串
|
||||||
|
* @return boolean 是否为空
|
||||||
|
*/
|
||||||
|
isEmpty: function (str) {
|
||||||
|
return str == null || str === "";
|
||||||
|
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 字符串是否为非空白 空白的定义如下: <br>
|
||||||
|
* 1、不为null <br>
|
||||||
|
* 2、不为""<br>
|
||||||
|
*
|
||||||
|
* @param str 被检测的字符串
|
||||||
|
* @return boolean 是否为非空
|
||||||
|
*/
|
||||||
|
isNotEmpty: function (str) {
|
||||||
|
return !StrUtil.isEmpty(str);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 空对象转字符串
|
||||||
|
*
|
||||||
|
* @param str 被检查的字符串
|
||||||
|
* @return string 原字符串或者空串
|
||||||
|
*/
|
||||||
|
nullToStr: function (str) {
|
||||||
|
if (StrUtil.isEmpty(str)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 空格截取
|
||||||
|
*
|
||||||
|
* @param str 截取的字符串
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
trim: function (str) {
|
||||||
|
if (str == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return str.toString().replace(/(^\s*)|(\s*$)|\r|\n/g, "");
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 比较两个字符串(大小写敏感)
|
||||||
|
*
|
||||||
|
* @param str 字符串
|
||||||
|
* @param that 比较的字符串
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
equals: function (str, that) {
|
||||||
|
return str === that;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 比较两个字符串(大小写不敏感)
|
||||||
|
*
|
||||||
|
* @param str 字符串
|
||||||
|
* @param that 比较的字符串
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
equalsIgnoreCase: function (str, that) {
|
||||||
|
return String(str).toUpperCase() === String(that).toUpperCase();
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 将字符串按指定字符分割
|
||||||
|
*
|
||||||
|
* @param str 字符串
|
||||||
|
* @param sep 比较的字符串
|
||||||
|
* @param maxLen 最大长度
|
||||||
|
* @return string[] 分割后的数组
|
||||||
|
*/
|
||||||
|
split: function (str, sep, maxLen) {
|
||||||
|
if (StrUtil.isEmpty(str)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const value = String(str).split(sep);
|
||||||
|
return maxLen ? value.slice(0, maxLen - 1) : value;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 字符串格式化(%s )
|
||||||
|
*
|
||||||
|
* @param str 字符串
|
||||||
|
* @return 格式化后的字符串
|
||||||
|
*/
|
||||||
|
sprintf: function (str) {
|
||||||
|
let args = arguments, flag = true, i = 1;
|
||||||
|
str = str.replace(/%s/g, function () {
|
||||||
|
const arg = args[i++];
|
||||||
|
if (typeof arg === 'undefined') {
|
||||||
|
flag = false;
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return arg;
|
||||||
|
});
|
||||||
|
return flag ? str : '';
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 判断字符串是否是以start开头
|
||||||
|
*
|
||||||
|
* @param str 字符串
|
||||||
|
* @param start 开始的字符串
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
startWith: function (str, start) {
|
||||||
|
const reg = new RegExp("^" + start);
|
||||||
|
return reg.test(str);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 判断字符串是否是以end结尾
|
||||||
|
*
|
||||||
|
* @param str 字符串
|
||||||
|
* @param end 结尾的字符串
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
endWith: function (str, end) {
|
||||||
|
const reg = new RegExp(end + "$");
|
||||||
|
return reg.test(str);
|
||||||
|
}
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue