zhiyong.zhou
2024-02-26 60d911172b1dbebe0ab952ce10366b327d5744f1
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<template>
  <el-main>
    <div class="switchStyle">
      <el-button  size="small" @click="switchCss" >切换</el-button>
 
    </div>
    <div class="scale">
      <el-button icon="el-icon-plus" size="small" @click="scale += 10" :disabled="scale >= 150" circle></el-button>
      <span>{{ scale }}%</span>
      <el-button icon="el-icon-minus" size="small" @click="scale -= 10" :disabled="scale <= 40" circle></el-button>
<!--      <el-button @click="validate">校验流程</el-button>-->
    </div>
    <div class="design" :style="'transform: scale('+ scale / 100 +');'">
      <process-tree ref="process-tree" @selectedNode="nodeSelected"/>
    </div>
    <el-drawer :title="selectedNode.name" :visible.sync="showConfig"
               :modal-append-to-body="false"
               :size="selectedNode.type === 'CONDITION' ? '600px':'500px'"
               direction="rtl" :modal="false" destroy-on-close>
      <div slot="title">
        <el-input v-model="selectedNode.name" size="medium" v-show="showInput"
                  style="width: 300px" @blur="showInput = false"></el-input>
        <el-link v-show="!showInput" @click="showInput = true" style="font-size: medium">
          <i class="el-icon-edit" style="margin-right: 10px"></i>
          {{selectedNode.name}}
        </el-link>
      </div>
      <div class="node-config-content">
        <node-config/>
      </div>
    </el-drawer>
  </el-main>
</template>
 
<script>
import ProcessTree from './process/ProcessTree.vue'
import NodeConfig from '../../common/process/config/NodeConfig'
 
export default {
  name: "ProcessDesign",
  components: {ProcessTree, NodeConfig},
  data() {
    return {
      scale: 100,
      selected: {},
      showInput: false,
      showConfig: false
    }
  },
  computed:{
    selectedNode(){
      console.log("ProcessDesign-selectedNode")
      return this.$store.state.selectedNode
    }
  },
  mounted() {
 
  },
  methods: {
    switchCss(){
 
      console.log(this.$cssSrc)
      console.log(this.$isVertical)
 
      if(this.$isVertical){
        this.$cssSrc=require('@/assets/flowDesign.scss')
        this.$isVertical=false;
      }else{
        this.$cssSrc=require('@/assets/flowDesignVertical.scss')
        this.$isVertical=true;
      }
      this.$forceUpdate()
 
    },
    validate(){
      return this.$refs["process-tree"].validateProcess()
    },
    nodeSelected(node){
      console.log('配置节点aaa', node)
      this.showConfig = true
    }
  },
  watch:{
  }
}
</script>
 
<style lang="less" scoped>
.design {
  margin-top: 100px;
  display: flex;
  transform-origin: 50% 0px 0px;
}
.switchStyle {
    z-index: 999;
    position: fixed;
    top: 80px;
    right: 16%;
  }
.scale {
  z-index: 999;
  position: fixed;
  top: 80px;
  right: 40px;
 
  span {
    margin: 0 10px;
    font-size: 15px;
    color: #7a7a7a;
    width: 50px;
  }
}
 
.node-config-content{
  padding: 0 20px 20px;
}
 
/deep/ .el-drawer__body{
  overflow-y: auto;
}
</style>