sequenceFlow.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <div>
  3. <x-form ref="xForm" v-model="formData" :config="formConfig">
  4. <template #executionListener>
  5. <el-badge :value="executionListenerLength">
  6. <el-button size="small" @click="dialogName = 'executionListenerDialog'">编辑</el-button>
  7. </el-badge>
  8. </template>
  9. <template #conditionExpressionListener>
  10. <el-button size="small" @click="dialogName = 'conditionListenerDialog'">编辑</el-button>
  11. </template>
  12. </x-form>
  13. <executionListenerDialog
  14. v-if="dialogName === 'executionListenerDialog'"
  15. :element="element"
  16. :modeler="modeler"
  17. @close="finishExecutionListener"
  18. />
  19. <conditionListenerDialog
  20. v-if="dialogName === 'conditionListenerDialog'"
  21. :element="element"
  22. :modeler="modeler"
  23. :tableName = "tableName"
  24. @getCondition = "getCondition"
  25. @close="finishExecutionListener"
  26. />
  27. </div>
  28. </template>
  29. <script>
  30. import mixinPanel from '../../common/mixinPanel'
  31. import mixinExecutionListener from '../../common/mixinExecutionListener'
  32. import { commonParse, conditionExpressionParse } from '../../common/parseElement'
  33. import conditionListenerDialog from './property/conditionListener'
  34. export default {
  35. mixins: [mixinPanel, mixinExecutionListener],
  36. props: {
  37. tableName : {
  38. type: String,
  39. default: ''
  40. }
  41. },
  42. data() {
  43. return {
  44. formData: {}
  45. }
  46. },
  47. components:{
  48. conditionListenerDialog
  49. },
  50. computed: {
  51. formConfig() {
  52. return {
  53. inline: false,
  54. item: [
  55. {
  56. xType: 'input',
  57. name: 'id',
  58. label: '节点 id',
  59. rules: [{ required: true, message: 'Id 不能为空' }],
  60. disabled : true
  61. },
  62. {
  63. xType: 'input',
  64. name: 'name',
  65. label: '节点名称'
  66. },
  67. {
  68. xType: 'input',
  69. name: 'documentation',
  70. label: '节点描述'
  71. },
  72. {
  73. xType: 'slot',
  74. name: 'executionListener',
  75. label: '执行监听器'
  76. },
  77. {
  78. xType: 'input',
  79. name: 'conditionExpression',
  80. label: '跳转条件',
  81. readonly : true
  82. },
  83. {
  84. xType: 'slot',
  85. name: 'conditionExpressionListener',
  86. label: '条件编辑'
  87. },
  88. /* {
  89. xType: 'input',
  90. name: 'skipExpression',
  91. label: '跳过表达式'
  92. } */
  93. ]
  94. }
  95. }
  96. },
  97. methods:{
  98. getCondition(data) {
  99. this.$set(this.formData, "conditionExpression", data);
  100. }
  101. },
  102. watch: {
  103. 'formData.conditionExpression': function(val) {
  104. if (val) {
  105. const newCondition = this.modeler.get('moddle').create('bpmn:FormalExpression', { body: val })
  106. this.updateProperties({ conditionExpression: newCondition })
  107. } else {
  108. this.updateProperties({ conditionExpression: null })
  109. }
  110. },
  111. 'formData.skipExpression': function(val) {
  112. if (val === '') val = null
  113. this.updateProperties({ 'flowable:skipExpression': val })
  114. }
  115. },
  116. created() {
  117. let cache = commonParse(this.element)
  118. cache = conditionExpressionParse(cache)
  119. this.formData = cache
  120. }
  121. }
  122. </script>
  123. <style></style>