Browse Source

fix: 去除流程设计器跳过表达式值为null

master
tony 3 years ago
parent
commit
31e14dd7a3
  1. 15
      ruoyi-ui/src/components/Process/components/nodePanel/sequenceFlow.vue
  2. 31
      ruoyi-ui/src/components/Process/components/nodePanel/task.vue
  3. 153
      ruoyi-ui/src/utils/StrUtil.js

15
ruoyi-ui/src/components/Process/components/nodePanel/sequenceFlow.vue

@ -18,6 +18,7 @@
<script>
import mixinPanel from '../../common/mixinPanel'
import {StrUtil} from '@/utils/StrUtil'
import mixinExecutionListener from '../../common/mixinExecutionListener'
import { commonParse, conditionExpressionParse } from '../../common/parseElement'
export default {
@ -69,16 +70,20 @@ export default {
},
watch: {
'formData.conditionExpression': function(val) {
if (val) {
if (StrUtil.isNotBlank(val)) {
const newCondition = this.modeler.get('moddle').create('bpmn:FormalExpression', { body: val })
this.updateProperties({ conditionExpression: newCondition })
} else {
this.updateProperties({ conditionExpression: null })
}
// else {
// this.updateProperties({ conditionExpression: null })
// }
},
'formData.skipExpression': function(val) {
if (val === '') val = null
this.updateProperties({ 'flowable:skipExpression': val })
if (StrUtil.isNotBlank(val)) {
this.updateProperties({'flowable:skipExpression': val})
} else {
delete this.element.businessObject.$attrs[`flowable:skipExpression`]
}
}
},
created() {

31
ruoyi-ui/src/components/Process/components/nodePanel/task.vue

@ -119,6 +119,7 @@ import executionListenerDialog from './property/executionListener'
import taskListenerDialog from './property/taskListener'
import multiInstanceDialog from './property/multiInstance'
import { commonParse, userTaskParse } from '../../common/parseElement'
import {StrUtil} from '@/utils/StrUtil'
import FlowUser from '@/components/flow/User'
import FlowRole from '@/components/flow/Role'
import FlowExp from '@/components/flow/Expression'
@ -357,7 +358,7 @@ export default {
watch: {
'formData.userType': function(val, oldVal) {
const types = ['assignee', 'candidateUsers', 'candidateGroups']
if (oldVal) {
if (StrUtil.isNotBlank(oldVal)) {
types.forEach(type => {
delete this.element.businessObject.$attrs[`flowable:${type}`]
delete this.formData[type]
@ -367,67 +368,69 @@ export default {
this.updateProperties({'flowable:userType': val})
},
'formData.async': function(val) {
if (val) {
if (StrUtil.isNotBlank(val)) {
this.updateProperties({'flowable:async': val})
}
},
'formData.dueDate': function(val) {
if (val) {
if (StrUtil.isNotBlank(val)) {
this.updateProperties({'flowable:dueDate': val})
}
},
'formData.formKey': function(val) {
if (val) {
if (StrUtil.isNotBlank(val)) {
this.updateProperties({'flowable:formKey': val})
}
},
'formData.priority': function(val) {
if (val) {
if (StrUtil.isNotBlank(val)) {
this.updateProperties({'flowable:priority': val})
}
},
'formData.skipExpression': function(val) {
if (val) {
if (StrUtil.isNotBlank(val)) {
this.updateProperties({'flowable:skipExpression': val})
} else {
delete this.element.businessObject.$attrs[`flowable:skipExpression`]
}
},
'formData.isForCompensation': function(val) {
if (val) {
if (StrUtil.isNotBlank(val)) {
this.updateProperties({'isForCompensation': val})
}
},
'formData.triggerable': function(val) {
if (val) {
if (StrUtil.isNotBlank(val)) {
this.updateProperties({'flowable:triggerable': val})
}
},
'formData.class': function(val) {
if (val) {
if (StrUtil.isNotBlank(val)) {
this.updateProperties({'flowable:class': val})
}
},
'formData.autoStoreVariables': function(val) {
if (val) {
if (StrUtil.isNotBlank(val)) {
this.updateProperties({'flowable:autoStoreVariables': val})
}
},
'formData.exclude': function(val) {
if (val) {
if (StrUtil.isNotBlank(val)) {
this.updateProperties({'flowable:exclude': val})
}
},
'formData.ruleVariablesInput': function(val) {
if (val) {
if (StrUtil.isNotBlank(val)) {
this.updateProperties({'flowable:ruleVariablesInput': val})
}
},
'formData.rules': function(val) {
if (val) {
if (StrUtil.isNotBlank(val)) {
this.updateProperties({'flowable:rules': val})
}
},
'formData.resultVariable': function(val) {
if (val) {
if (StrUtil.isNotBlank(val)) {
this.updateProperties({'flowable:resultVariable': val})
}
}

153
ruoyi-ui/src/utils/StrUtil.js

@ -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…
Cancel
Save