gyyg-components 0.3.12 → 0.3.14
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 +96 -96
- package/lib/gyyg-components.umd.js +96 -96
- package/lib/gyyg-components.umd.min.js +96 -96
- package/package.json +2 -2
- package/src/components/MecInput/MecInput.vue +1 -1
- package/src/components/MecTable/MecTable.vue +2 -0
- package/src/directive/el-drag-dialog/drag.js +47 -28
- package/src/directive/hasPermi.js +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gyyg-components",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.14",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "lib/gyyg-components.umd.js",
|
|
6
6
|
"scripts": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"babel-plugin-component": "^1.1.1",
|
|
14
14
|
"core-js": "^3.6.5",
|
|
15
15
|
"element-resize-detector": "^1.2.4",
|
|
16
|
-
"element-ui": "2.15.
|
|
16
|
+
"element-ui": "^2.15.14",
|
|
17
17
|
"moment": "^2.30.1",
|
|
18
18
|
"sortablejs": "^1.15.6",
|
|
19
19
|
"vue": "^2.6.11"
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
} else if (this.inputType === 'english') {
|
|
144
144
|
// 只允许输入英文
|
|
145
145
|
value = value.replace(/[^a-zA-Z\s]/g, '');
|
|
146
|
-
}else if (this.inputType === 'amount') {
|
|
146
|
+
}else if (this.inputType === 'amount') { // 金额
|
|
147
147
|
// 只允许输入数字和小数点
|
|
148
148
|
value = value.replace(/[^0-9.]/g, '');
|
|
149
149
|
// 确保小数点只出现一次
|
|
@@ -2,7 +2,7 @@ export default {
|
|
|
2
2
|
bind(el, binding, vnode) {
|
|
3
3
|
const dialogHeaderEl = el.querySelector('.el-dialog__header');
|
|
4
4
|
const dragDom = el.querySelector('.el-dialog');
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
// 设置鼠标样式为可移动
|
|
7
7
|
dialogHeaderEl.style.cssText += ';cursor:move;';
|
|
8
8
|
|
|
@@ -15,7 +15,16 @@ export default {
|
|
|
15
15
|
}
|
|
16
16
|
})();
|
|
17
17
|
|
|
18
|
+
let isMouseDown = false; // 标记鼠标是否按下
|
|
19
|
+
|
|
20
|
+
// 监听鼠标进入页面时的状态
|
|
21
|
+
document.addEventListener('mouseenter', () => {
|
|
22
|
+
isMouseDown = false; // 确保初始状态为未按下
|
|
23
|
+
});
|
|
24
|
+
|
|
18
25
|
dialogHeaderEl.onmousedown = (e) => {
|
|
26
|
+
isMouseDown = true; // 鼠标按下时设置为 true
|
|
27
|
+
|
|
19
28
|
// 鼠标按下时,计算当前元素距离可视区的距离
|
|
20
29
|
const disX = e.clientX - dialogHeaderEl.offsetLeft;
|
|
21
30
|
const disY = e.clientY - dialogHeaderEl.offsetTop;
|
|
@@ -33,36 +42,46 @@ export default {
|
|
|
33
42
|
styT = +styT.replace(/\px/g, '');
|
|
34
43
|
}
|
|
35
44
|
|
|
36
|
-
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
45
|
+
const onMouseMove = (e) => {
|
|
46
|
+
if (!isMouseDown) return; // 如果鼠标未按下,直接返回
|
|
47
|
+
|
|
48
|
+
requestAnimationFrame(() => {
|
|
49
|
+
// 计算移动的距离
|
|
50
|
+
let left = e.clientX - disX;
|
|
51
|
+
let top = e.clientY - disY;
|
|
52
|
+
|
|
53
|
+
// 获取屏幕宽高
|
|
54
|
+
const screenWidth = document.body.clientWidth;
|
|
55
|
+
const screenHeight = document.body.clientHeight;
|
|
56
|
+
|
|
57
|
+
// 获取对话框宽高
|
|
58
|
+
const dialogWidth = dragDom.offsetWidth;
|
|
59
|
+
const dialogHeight = dragDom.offsetHeight;
|
|
60
|
+
|
|
61
|
+
// 边界限制逻辑
|
|
62
|
+
left = Math.max(0, Math.min(left + styL, screenWidth - dialogWidth));
|
|
63
|
+
top = Math.max(0, Math.min(top + styT, screenHeight - dialogHeight));
|
|
64
|
+
|
|
65
|
+
// 更新对话框位置
|
|
66
|
+
dragDom.style.left = `${left}px`;
|
|
67
|
+
dragDom.style.top = `${top}px`;
|
|
68
|
+
|
|
69
|
+
// 触发拖拽事件
|
|
70
|
+
vnode.child.$emit('dragDialog');
|
|
71
|
+
});
|
|
59
72
|
};
|
|
60
73
|
|
|
61
|
-
|
|
74
|
+
const onMouseUp = () => {
|
|
75
|
+
isMouseDown = false; // 鼠标松开时设置为 false
|
|
76
|
+
|
|
62
77
|
// 清除事件监听
|
|
63
|
-
document.
|
|
64
|
-
document.
|
|
78
|
+
document.removeEventListener('mousemove', onMouseMove);
|
|
79
|
+
document.removeEventListener('mouseup', onMouseUp);
|
|
65
80
|
};
|
|
81
|
+
|
|
82
|
+
// 绑定事件监听
|
|
83
|
+
document.addEventListener('mousemove', onMouseMove);
|
|
84
|
+
document.addEventListener('mouseup', onMouseUp); // 在 document 上监听 mouseup
|
|
66
85
|
};
|
|
67
|
-
}
|
|
86
|
+
},
|
|
68
87
|
};
|
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
Vue.directive('hasPermi', {
|
|
7
7
|
inserted(el, binding, vnode) {
|
|
8
8
|
const { value } = binding
|
|
9
|
-
console.log('value',value)
|
|
10
9
|
const all_permission = "*:*:*";
|
|
11
10
|
const permissions = localStorage.getItem('authorities').split(',')//用户拥有的权限
|
|
12
11
|
if (value && value instanceof Array && value.length > 0) {
|
|
13
|
-
const permissionFlag =
|
|
14
|
-
|
|
12
|
+
const permissionFlag = value.join().split(',')//
|
|
13
|
+
console.log(permissionFlag)
|
|
15
14
|
const hasPermissions = permissions.some(permission => {
|
|
16
15
|
return all_permission === permission || permissionFlag.includes(permission)
|
|
17
16
|
})
|
|
17
|
+
console.log(hasPermissions)
|
|
18
18
|
if (!hasPermissions) {
|
|
19
19
|
console.log(el.parentNode);
|
|
20
20
|
el.parentNode && el.parentNode.removeChild(el)
|