gyyg-components 0.3.10 → 0.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/gyyg-components.common.js +97 -265
- package/lib/gyyg-components.umd.js +97 -265
- package/lib/gyyg-components.umd.min.js +97 -265
- package/package.json +1 -1
- package/src/components/MECDescriptions/MECDescriptions.vue +1 -0
- package/src/components/MecDialog/MecDialog.vue +35 -11
- package/src/directive/el-drag-dialog/drag.js +46 -42
- package/src/directive/hasPermi.js +1 -3
package/package.json
CHANGED
|
@@ -18,14 +18,23 @@
|
|
|
18
18
|
@close="closeMethod"
|
|
19
19
|
:destroy-on-close="destroyOnClose"
|
|
20
20
|
:modal='modal'
|
|
21
|
-
|
|
21
|
+
ref="dialog"
|
|
22
22
|
>
|
|
23
|
-
<div
|
|
24
|
-
|
|
23
|
+
<div
|
|
24
|
+
slot="title"
|
|
25
|
+
style="font-size: 16px; color: #303133;"
|
|
26
|
+
>
|
|
27
|
+
<el-icon
|
|
28
|
+
:class="titleIcon"
|
|
29
|
+
style="color: #1890ff; font-size: 18px;margin-right: 5px;"
|
|
30
|
+
></el-icon>
|
|
25
31
|
<span>{{ title }}</span>
|
|
26
32
|
</div>
|
|
27
33
|
<slot name="body" />
|
|
28
|
-
<div
|
|
34
|
+
<div
|
|
35
|
+
v-if="footer"
|
|
36
|
+
slot="footer"
|
|
37
|
+
>
|
|
29
38
|
<slot name="footer" />
|
|
30
39
|
</div>
|
|
31
40
|
</el-dialog>
|
|
@@ -78,7 +87,7 @@ export default {
|
|
|
78
87
|
type: Boolean
|
|
79
88
|
},
|
|
80
89
|
//是否需要遮罩层
|
|
81
|
-
modal:{
|
|
90
|
+
modal: {
|
|
82
91
|
default: true,
|
|
83
92
|
type: Boolean
|
|
84
93
|
},
|
|
@@ -107,16 +116,24 @@ export default {
|
|
|
107
116
|
},
|
|
108
117
|
computed: {
|
|
109
118
|
customClass() {
|
|
110
|
-
let className = this.dialogClass;
|
|
119
|
+
let className = this.height !== 'auto' ? 'haveHeight-dialog' : this.dialogClass;
|
|
111
120
|
return className;
|
|
112
121
|
},
|
|
113
122
|
},
|
|
123
|
+
|
|
114
124
|
created() {
|
|
115
125
|
this.type === "fullscreen" && (this.fullscreen = true);
|
|
116
126
|
},
|
|
117
127
|
methods: {
|
|
118
128
|
open() {
|
|
119
129
|
this.visible = true;
|
|
130
|
+
console.log(this.height)
|
|
131
|
+
if(this.height !== 'auto' && this.height) {
|
|
132
|
+
this.$nextTick(() => {
|
|
133
|
+
this.$refs.dialog.$el.firstElementChild.style.height = this.height;
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
120
137
|
},
|
|
121
138
|
close() {
|
|
122
139
|
this.visible = false;
|
|
@@ -135,18 +152,21 @@ export default {
|
|
|
135
152
|
.base-dialog {
|
|
136
153
|
text-align: left;
|
|
137
154
|
}
|
|
155
|
+
|
|
138
156
|
/deep/.el-dialog__wrapper {
|
|
139
157
|
overflow: hidden;
|
|
140
158
|
display: flex;
|
|
141
159
|
justify-content: center;
|
|
142
160
|
align-items: center;
|
|
143
161
|
margin: auto 0;
|
|
162
|
+
|
|
144
163
|
.el-dialog {
|
|
145
164
|
display: flex;
|
|
146
165
|
flex-direction: column;
|
|
147
166
|
border-radius: 8px;
|
|
148
167
|
margin: 0;
|
|
149
168
|
margin-top: 0 !important;
|
|
169
|
+
|
|
150
170
|
.el-dialog__header {
|
|
151
171
|
text-align: left;
|
|
152
172
|
background-color: #efefef;
|
|
@@ -201,6 +221,7 @@ export default {
|
|
|
201
221
|
}
|
|
202
222
|
|
|
203
223
|
.custom-table {
|
|
224
|
+
|
|
204
225
|
// 取消表格下边线
|
|
205
226
|
tbody tr:last-child td {
|
|
206
227
|
border-bottom: none !important;
|
|
@@ -220,6 +241,7 @@ export default {
|
|
|
220
241
|
.el-dialog__body {
|
|
221
242
|
padding: 10px;
|
|
222
243
|
}
|
|
244
|
+
|
|
223
245
|
.el-dialog__footer {
|
|
224
246
|
padding: 10px;
|
|
225
247
|
border: none;
|
|
@@ -229,12 +251,14 @@ export default {
|
|
|
229
251
|
}
|
|
230
252
|
}
|
|
231
253
|
}
|
|
254
|
+
|
|
255
|
+
.shan-maintenance-dialog {
|
|
256
|
+
/deep/ .el-dialog {
|
|
257
|
+
height: 90%;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
232
261
|
/deep/ .el-dialog {
|
|
233
262
|
height: 100%;
|
|
234
263
|
}
|
|
235
|
-
.shan-maintenance-dialog {
|
|
236
|
-
/deep/ .el-dialog {
|
|
237
|
-
height: 90%;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
264
|
</style>
|
|
@@ -1,64 +1,68 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
bind(el, binding, vnode) {
|
|
3
|
-
const dialogHeaderEl = el.querySelector('.el-dialog__header')
|
|
4
|
-
const dragDom = el.querySelector('.el-dialog')
|
|
5
|
-
|
|
3
|
+
const dialogHeaderEl = el.querySelector('.el-dialog__header');
|
|
4
|
+
const dragDom = el.querySelector('.el-dialog');
|
|
5
|
+
|
|
6
|
+
// 设置鼠标样式为可移动
|
|
7
|
+
dialogHeaderEl.style.cssText += ';cursor:move;';
|
|
6
8
|
|
|
7
|
-
//
|
|
9
|
+
// 获取元素样式兼容方法
|
|
8
10
|
const getStyle = (function() {
|
|
9
11
|
if (window.document.currentStyle) {
|
|
10
|
-
return (dom, attr) => dom.currentStyle[attr]
|
|
12
|
+
return (dom, attr) => dom.currentStyle[attr];
|
|
11
13
|
} else {
|
|
12
|
-
return (dom, attr) => getComputedStyle(dom, false)[attr]
|
|
14
|
+
return (dom, attr) => getComputedStyle(dom, false)[attr];
|
|
13
15
|
}
|
|
14
|
-
})()
|
|
16
|
+
})();
|
|
15
17
|
|
|
16
18
|
dialogHeaderEl.onmousedown = (e) => {
|
|
17
|
-
//
|
|
18
|
-
const disX = e.clientX - dialogHeaderEl.offsetLeft
|
|
19
|
-
const disY = e.clientY - dialogHeaderEl.offsetTop
|
|
19
|
+
// 鼠标按下时,计算当前元素距离可视区的距离
|
|
20
|
+
const disX = e.clientX - dialogHeaderEl.offsetLeft;
|
|
21
|
+
const disY = e.clientY - dialogHeaderEl.offsetTop;
|
|
20
22
|
|
|
21
|
-
//
|
|
22
|
-
let styL = getStyle(dragDom, 'left')
|
|
23
|
-
let styT = getStyle(dragDom, 'top')
|
|
23
|
+
// 获取初始位置样式
|
|
24
|
+
let styL = getStyle(dragDom, 'left');
|
|
25
|
+
let styT = getStyle(dragDom, 'top');
|
|
24
26
|
|
|
27
|
+
// 如果样式值包含百分比,则转换为像素值
|
|
25
28
|
if (styL.includes('%')) {
|
|
26
|
-
styL = +document.body.clientWidth * (+styL.replace(/\%/g, '') / 100)
|
|
27
|
-
styT = +document.body.clientHeight * (+styT.replace(/\%/g, '') / 100)
|
|
29
|
+
styL = +document.body.clientWidth * (+styL.replace(/\%/g, '') / 100);
|
|
30
|
+
styT = +document.body.clientHeight * (+styT.replace(/\%/g, '') / 100);
|
|
28
31
|
} else {
|
|
29
|
-
styL = +styL.replace(/\px/g, '')
|
|
30
|
-
styT = +styT.replace(/\px/g, '')
|
|
32
|
+
styL = +styL.replace(/\px/g, '');
|
|
33
|
+
styT = +styT.replace(/\px/g, '');
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
document.onmousemove = function(e) {
|
|
34
|
-
//
|
|
35
|
-
let left = e.clientX - disX
|
|
36
|
-
let top = e.clientY - disY
|
|
37
|
+
// 计算移动的距离
|
|
38
|
+
let left = e.clientX - disX;
|
|
39
|
+
let top = e.clientY - disY;
|
|
40
|
+
console.log(left, top)
|
|
37
41
|
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
// } else if (left > maxDragDomLeft) {
|
|
42
|
-
// left = maxDragDomLeft
|
|
43
|
-
// }
|
|
42
|
+
// 获取屏幕宽高
|
|
43
|
+
const screenWidth = document.body.clientWidth;
|
|
44
|
+
const screenHeight = document.body.clientHeight;
|
|
44
45
|
|
|
45
|
-
//
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// top = maxDragDomTop
|
|
49
|
-
// }
|
|
46
|
+
// 获取对话框宽高
|
|
47
|
+
const dialogWidth = dragDom.offsetWidth;
|
|
48
|
+
const dialogHeight = dragDom.offsetHeight;
|
|
50
49
|
|
|
51
|
-
//
|
|
52
|
-
|
|
50
|
+
// 边界限制逻辑
|
|
51
|
+
left = Math.max(0, Math.min(left + styL, screenWidth - dialogWidth));
|
|
52
|
+
top = Math.max(0, Math.min(top + styT, screenHeight - dialogHeight));
|
|
53
53
|
|
|
54
|
-
//
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
// 更新对话框位置
|
|
55
|
+
dragDom.style.left = `${left}px`;
|
|
56
|
+
dragDom.style.top = `${top}px`;
|
|
57
|
+
// 触发拖拽事件
|
|
58
|
+
vnode.child.$emit('dragDialog');
|
|
59
|
+
};
|
|
57
60
|
|
|
58
|
-
document.onmouseup = function(
|
|
59
|
-
|
|
60
|
-
document.
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
document.onmouseup = function() {
|
|
62
|
+
// 清除事件监听
|
|
63
|
+
document.onmousemove = null;
|
|
64
|
+
document.onmouseup = null;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
63
67
|
}
|
|
64
|
-
}
|
|
68
|
+
};
|