Skip to content

Commit

Permalink
移除对element的监听,提升性能 fix #12
Browse files Browse the repository at this point in the history
  • Loading branch information
Nayacco committed Sep 30, 2020
1 parent 750782e commit 7cbf05d
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 75 deletions.
33 changes: 15 additions & 18 deletions package/components/nodePanel/gateway.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,25 +67,22 @@ export default {
'formData.async': function(val) {
if (val === '') val = null
this.updateProperties({ 'flowable:async': val })
},
element: {
handler: function(val) {
const cache = {
...this.element.businessObject,
...this.element.businessObject.$attrs
}
// 移除flowable前缀,格式化数组
for (const key in cache) {
if (key.indexOf('flowable:') === 0) {
const newKey = key.replace('flowable:', '')
cache[newKey] = cache[key]
delete cache[key]
}
}
this.formData = cache
},
immediate: true
}
},
created() {
const cache = {
...this.element.businessObject,
...this.element.businessObject.$attrs
}
// 移除flowable前缀,格式化数组
for (const key in cache) {
if (key.indexOf('flowable:') === 0) {
const newKey = key.replace('flowable:', '')
cache[newKey] = cache[key]
delete cache[key]
}
}
this.formData = cache
}
}
</script>
Expand Down
33 changes: 15 additions & 18 deletions package/components/nodePanel/process.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,23 @@ export default {
'formData.processCategory': function(val) {
if (val === '') val = null
this.updateProperties({ 'flowable:processCategory': val })
},
element: {
handler: function(val) {
const cache = {
...this.element.businessObject,
...this.element.businessObject.$attrs
}
// 移除flowable前缀,格式化数组
for (const key in cache) {
if (key.indexOf('flowable:') === 0) {
const newKey = key.replace('flowable:', '')
cache[newKey] = cache[key]
delete cache[key]
}
}
this.formData = cache
},
immediate: true
}
},
created() {
const cache = {
...this.element.businessObject,
...this.element.businessObject.$attrs
}
// 移除flowable前缀,格式化数组
for (const key in cache) {
if (key.indexOf('flowable:') === 0) {
const newKey = key.replace('flowable:', '')
cache[newKey] = cache[key]
delete cache[key]
}
}
this.formData = cache
},
methods: {
computedSignalLength() {
this.signalLength = this.element.businessObject.extensionElements?.values?.length ?? 0
Expand Down
39 changes: 18 additions & 21 deletions package/components/nodePanel/sequenceFlow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,28 +79,25 @@ export default {
'formData.skipExpression': function(val) {
if (val === '') val = null
this.updateProperties({ 'flowable:skipExpression': val })
},
element: {
handler: function(val) {
const cache = {
...this.element.businessObject,
...this.element.businessObject.$attrs
}
// 移除flowable前缀,格式化数组
for (const key in cache) {
if (key.indexOf('flowable:') === 0) {
const newKey = key.replace('flowable:', '')
cache[newKey] = cache[key]
delete cache[key]
}
if (key === 'conditionExpression') {
cache[key] = parseCDATA(cache[key].body)
}
}
this.formData = cache
},
immediate: true
}
},
created() {
const cache = {
...this.element.businessObject,
...this.element.businessObject.$attrs
}
// 移除flowable前缀,格式化数组
for (const key in cache) {
if (key.indexOf('flowable:') === 0) {
const newKey = key.replace('flowable:', '')
cache[newKey] = cache[key]
delete cache[key]
}
if (key === 'conditionExpression') {
cache[key] = parseCDATA(cache[key].body)
}
}
this.formData = cache
}
}
</script>
Expand Down
33 changes: 15 additions & 18 deletions package/components/nodePanel/startEnd.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,25 +77,22 @@ export default {
'formData.formKey': function(val) {
if (val === '') val = null
this.updateProperties({ 'flowable:formKey': val })
},
element: {
handler: function(val) {
const cache = {
...this.element.businessObject,
...this.element.businessObject.$attrs
}
// 移除flowable前缀,格式化数组
for (const key in cache) {
if (key.indexOf('flowable:') === 0) {
const newKey = key.replace('flowable:', '')
cache[newKey] = cache[key]
delete cache[key]
}
}
this.formData = cache
},
immediate: true
}
},
created() {
const cache = {
...this.element.businessObject,
...this.element.businessObject.$attrs
}
// 移除flowable前缀,格式化数组
for (const key in cache) {
if (key.indexOf('flowable:') === 0) {
const newKey = key.replace('flowable:', '')
cache[newKey] = cache[key]
delete cache[key]
}
}
this.formData = cache
}
}
</script>
Expand Down

0 comments on commit 7cbf05d

Please sign in to comment.