Blame view

public/components/frame/bpmnjsInit/bpmnjsInit.js 2.47 KB
809d9ffa   wuxw   流程设计页面组件没法和vue兼容只...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
  (function (vc) {
  
      vc.extends({
          data: {
              bpmnjsInfo: {
                  condition: '',
                  staffId: '',
                  from: 'bpmn'
              }
          },
          _initMethod: function () {
              $that._initBpmnjs();
          },
          watch: {
              'bpmnjsInfo.staffId': {
                  deep: true,
                  handler: function () {
                      let camundaAssignee = document.querySelector('#camunda-assignee');
                      camundaAssignee.value = $that.bpmnjsInfo.staffId;
                      //创建输入框修改事件
                      let changeEvent = document.createEvent("HTMLEvents");
                      changeEvent.initEvent("change", true, true);
                      //触发修改事件,触发绑定的事件,更新数据
                      camundaAssignee.dispatchEvent(changeEvent);
                  }
              }
          },
          _initEvent: function () {
              //初始化侦听
              vc.on('bpmnjs', 'index', function (_data) {
                  let camCondition = document.querySelector('#cam-condition');
                  camCondition.value = _data.condition;
                  //创建输入框修改事件
                  let changeEvent = document.createEvent("HTMLEvents");
                  changeEvent.initEvent("change", true, true);
                  //触发修改事件,触发绑定的事件,更新数据
                  camCondition.dispatchEvent(changeEvent);
              })
          },
          methods: {
              _initBpmnjs: function () {
                  window._elementEvent = function (e) {
                      console.log('元素被点击', e);
                      // 线表达式 onclick 处理
                      let camCondition = document.querySelector('#cam-condition')
                      if (camCondition) {
                          camCondition.onclick = function () {
                              vc.emit('chooseFlowElementCondition', 'openModal', {
                                  condition: camCondition.value
                              });
                          };
                      }
  
                      let camundaAssignee = document.querySelector('#camunda-assignee');
                      if (camundaAssignee) {
                          camundaAssignee.onclick = function () {
                              vc.emit('selectStaff', 'openStaff', $that.bpmnjsInfo);
                          };
                      }
                  }
              }
  
          }
      });
  
  })(window.vc);