派生自 wuyushui/SewerAndRainNetwork

徐旺旺
2021-05-10 cb85033879c74f34925a303402c1ad3e4a8646f2
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
122
123
124
125
126
127
128
129
130
<template>
  <div class="public-bounced map-background" v-drag :style="style">
    <div class="public-bounced-title panel-title" ref="publicBounced">
      <span>{{ title }}</span>
      <i class="el-icon-circle-close" @click="close"></i>
    </div>
    <div class="public-bounced-content" :id="id"></div>
  </div>
</template>
 
<script>
import helper from './helper/helper.js'
 
export default {
  data () {
    return {
      style: {},
      id: 'sewer_layeropen_' + new Date().getTime()
    }
  },
  props: {
    options: {
      type: Object,
      default: function () {
        return {}
      }
    }
  },
  computed: {},
  mounted () {
    let left = this.left
    let top = this.top
    if (left > 0) {
      left = left + 'px'
    }
    if (top > 0) {
      top = top + 'px'
    }
    this.style = {
      left: left || '25%',
      top: top || '35%'
    }
  },
  methods: {
    close () {
      this.layer.close(this.id)
    },
    init () {
      const propsData = helper.deepClone(this.content.data) || {}
      propsData.layerid = this.id
      propsData.lydata = this.content.data
      propsData.lyoption = this.options
      const instance = new this.content.content({
        // parent: this.content.parent,
        propsData: propsData
      })
      instance.vm = instance.$mount()
      document.getElementById(this.id).appendChild(instance.vm.$el)
    },
    max () {
      // 最大化窗口
      let height = document.documentElement.clientHeight
      if (height % 2 === 1) {
        height += 1
      }
      this.style = {
        overflow: 'hidden',
        left: '50%',
        width: '100%',
        height: height + 'px',
        minHeight: '42px'
      }
      this.maxMiniState = 2
    },
    maxmini () { // 还原
      document.getElementById(this.options.id).removeAttribute('style')
      this.maxMiniState = 0
    }
  }
}
</script>
 
<style lang="less" scoped>
.public-bounced {
  z-index: 2000;
  position: absolute;
 
  .public-bounced-title {
    cursor: move;
    height: 0.1rem;
    padding: 10px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
 
    span {
      color: #f4f7ff;
      margin: 0 15px;
      font-size: 14px;
    }
 
    i {
      color: #C0C4CC;
      margin: 0 15px;
      font-size: 22px;
      cursor: pointer;
    }
 
    i:hover {
      color: #00fff6;
    }
  }
 
  .public-bounced-content {
    //padding: 0.1rem;
    display: flex;
    //align-items: center;
    //justify-content: space-around;
 
    .public-bounced-content-left {
      //width: 4.8rem;
    }
 
    .public-bounced-content-right {
      //width: 3rem;
      margin-left: 0.1rem;
    }
  }
}
</style>