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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
  | <template> 
 |    <el-drawer 
 |      class="global-window" 
 |      title="title" 
 |      :visible="visible" 
 |      :with-header="true" 
 |      :size="width" 
 |      :close-on-press-escape="false" 
 |      :wrapper-closable="false" 
 |      :append-to-body="true" 
 |      :modal="true" 
 |      @close="close" 
 |    > 
 |      <div slot="title" class="window__header"> 
 |        <span class="header__btn-back" @click="close"><i class="el-icon-arrow-left"></i></span>{{title}} 
 |        <!-- {{title}} --> 
 |      </div> 
 |      <div class="window__body"> 
 |        <slot></slot> 
 |      </div> 
 |      <div v-if="withFooter" class="window__footer"> 
 |        <slot name="footer"> 
 |          <el-button v-if="showConfirm" @click="confirm" :loading="confirmWorking" type="primary">{{text}}</el-button> 
 |          <slot name="btns" /> 
 |          <el-button @click="close">{{ backText }}</el-button> 
 |        </slot> 
 |      </div> 
 |    </el-drawer> 
 |  </template> 
 |    
 |  <script> 
 |  export default { 
 |    name: 'GlobalWindow', 
 |    props: { 
 |      width: { 
 |        type: String, 
 |        default: '100%' 
 |      }, 
 |      // 是否包含底部操作 
 |      withFooter: { 
 |        type: Boolean, 
 |        default: true 
 |      }, 
 |      // 提交按钮文字 
 |      text: { 
 |        type: String, 
 |        default: '确定' 
 |      }, 
 |      backText: { 
 |        type: String, 
 |        default: '返回' 
 |      }, 
 |      // 确认按钮loading状态 
 |      confirmWorking: { 
 |        type: Boolean, 
 |        default: false 
 |      }, 
 |      showConfirm: { 
 |        type: Boolean, 
 |        default: true 
 |      }, 
 |      // 标题 
 |      title: { 
 |        type: String, 
 |        default: '' 
 |      }, 
 |      // 是否展示 
 |      visible: { 
 |        type: Boolean, 
 |        required: true 
 |      } 
 |    }, 
 |    methods: { 
 |      confirm () { 
 |        this.$emit('confirm') 
 |      }, 
 |      close () { 
 |        this.$emit('close') 
 |        this.$emit('update:visible', false) 
 |      } 
 |    } 
 |  } 
 |  </script> 
 |    
 |  <style scoped lang="scss"> 
 |  @import "@/assets/style/variables.scss"; 
 |  // 输入框高度 
 |  $input-height: 32px; 
 |  .global-window { 
 |    top: 0; 
 |    left: 250px !important; 
 |    // 头部标题 
 |    ::v-deep .el-drawer__header { 
 |      padding: 0 10px 0 0; 
 |      line-height: 40px; 
 |      border-bottom: 1px solid #eee; 
 |      // text-align: center; 
 |      font-weight: 500; 
 |      color: #222; 
 |      // 返回按钮 
 |      .header__btn-back { 
 |        display: inline-block; 
 |        width: 30px; 
 |        background: $primary-color; 
 |        color: #fff; 
 |        text-align: center; 
 |        margin-right: 12px; 
 |        border-right: 1px solid #eee; 
 |      } 
 |      .el-drawer__close-btn:focus { 
 |        outline: none; 
 |      } 
 |    } 
 |    // 主体 
 |    ::v-deep .el-drawer__body { 
 |      display: flex; 
 |      flex-direction: column; 
 |      position: absolute; 
 |      top: 40px; 
 |      bottom: 0; 
 |      width: 100%; 
 |      overflow: hidden; 
 |      // background-color: #f7f7f7; 
 |      // 内容 
 |      .window__body { 
 |        // width: 1100px; 
 |        // margin: 0 auto; 
 |        background-color: #fff; 
 |        width: 100%; 
 |        height: 100%; 
 |        overflow-y: auto; 
 |        padding: 0 16px 12px 16px; 
 |        // 标签 
 |        // .el-form-item__label { 
 |        //   float: none; 
 |        // } 
 |        // 元素宽度为100% 
 |        .el-form-item__content > *{ 
 |          width: 100%; 
 |        } 
 |      } 
 |      // 尾部 
 |      .window__footer { 
 |        user-select: none; 
 |        border-top: 1px solid #eee; 
 |        height: 60px; 
 |        line-height: 60px; 
 |        text-align: center; 
 |      } 
 |    } 
 |  } 
 |  </style> 
 |  
  |