Selaa lähdekoodia

自定义可拖动弹窗宽高指令

RuoYi 4 vuotta sitten
vanhempi
commit
961fe9a5f1

+ 34 - 0
ruoyi-ui/src/directive/dialog/dragHeight.js

@@ -0,0 +1,34 @@
1
+/**
2
+* v-dialogDragWidth 可拖动弹窗高度(右下角)
3
+* Copyright (c) 2019 ruoyi
4
+*/
5
+
6
+export default {
7
+    bind(el) {
8
+        const dragDom = el.querySelector('.el-dialog');
9
+        const lineEl = document.createElement('div');
10
+        lineEl.style = 'width: 6px; background: inherit; height: 10px; position: absolute; right: 0; bottom: 0; margin: auto; z-index: 1; cursor: nwse-resize;';
11
+        lineEl.addEventListener('mousedown',
12
+            function(e) {
13
+                // 鼠标按下,计算当前元素距离可视区的距离
14
+                const disX = e.clientX - el.offsetLeft;
15
+                const disY = e.clientY - el.offsetTop;
16
+                // 当前宽度 高度
17
+                const curWidth = dragDom.offsetWidth;
18
+                const curHeight = dragDom.offsetHeight;
19
+                document.onmousemove = function(e) {
20
+                    e.preventDefault(); // 移动时禁用默认事件
21
+                    // 通过事件委托,计算移动的距离
22
+                    const xl = e.clientX - disX;
23
+                    const yl = e.clientY - disY
24
+                    dragDom.style.width = `${curWidth + xl}px`;
25
+                    dragDom.style.height = `${curHeight + yl}px`;
26
+                };
27
+                document.onmouseup = function(e) {
28
+                    document.onmousemove = null;
29
+                    document.onmouseup = null;
30
+                };
31
+            }, false);
32
+        dragDom.appendChild(lineEl);
33
+    }
34
+}

+ 30 - 0
ruoyi-ui/src/directive/dialog/dragWidth.js

@@ -0,0 +1,30 @@
1
+/**
2
+* v-dialogDragWidth 可拖动弹窗宽度(右侧边)
3
+* Copyright (c) 2019 ruoyi
4
+*/
5
+
6
+export default {
7
+    bind(el) {
8
+        const dragDom = el.querySelector('.el-dialog');
9
+        const lineEl = document.createElement('div');
10
+        lineEl.style = 'width: 5px; background: inherit; height: 80%; position: absolute; right: 0; top: 0; bottom: 0; margin: auto; z-index: 1; cursor: w-resize;';
11
+        lineEl.addEventListener('mousedown',
12
+            function (e) {
13
+                // 鼠标按下,计算当前元素距离可视区的距离
14
+                const disX = e.clientX - el.offsetLeft;
15
+                // 当前宽度
16
+                const curWidth = dragDom.offsetWidth;
17
+                document.onmousemove = function (e) {
18
+                    e.preventDefault(); // 移动时禁用默认事件
19
+                    // 通过事件委托,计算移动的距离
20
+                    const l = e.clientX - disX;
21
+                    dragDom.style.width = `${curWidth + l}px`;
22
+                };
23
+                document.onmouseup = function (e) {
24
+                    document.onmousemove = null;
25
+                    document.onmouseup = null;
26
+                };
27
+            }, false);
28
+        dragDom.appendChild(lineEl);
29
+    }
30
+}

+ 4 - 1
ruoyi-ui/src/directive/index.js

@@ -1,17 +1,20 @@
1 1
 import hasRole from './permission/hasRole'
2 2
 import hasPermi from './permission/hasPermi'
3 3
 import dialogDrag from './dialog/drag'
4
+import dialogDragWidth from './dialog/dragWidth'
5
+import dialogDragHeight from './dialog/dragHeight'
4 6
 
5 7
 const install = function(Vue) {
6 8
   Vue.directive('hasRole', hasRole)
7 9
   Vue.directive('hasPermi', hasPermi)
8 10
   Vue.directive('dialogDrag', dialogDrag)
11
+  Vue.directive('dialogDragWidth', dialogDragWidth)
12
+  Vue.directive('dialogDragHeight', dialogDragHeight)
9 13
 }
10 14
 
11 15
 if (window.Vue) {
12 16
   window['hasRole'] = hasRole
13 17
   window['hasPermi'] = hasPermi
14
-  window['dialogDrag'] = dialogDrag
15 18
   Vue.use(install); // eslint-disable-line
16 19
 }
17 20
 

+ 3 - 3
sql/quartz.sql

@@ -56,7 +56,7 @@ create table QRTZ_TRIGGERS (
56 56
 -- ----------------------------
57 57
 create table QRTZ_SIMPLE_TRIGGERS (
58 58
     sched_name           varchar(120)    not null            comment '调度名称',
59
-    trigger_name         varchar(200)    not null            comment 'qrtz_triggers表trigger_ name的外键',
59
+    trigger_name         varchar(200)    not null            comment 'qrtz_triggers表trigger_name的外键',
60 60
     trigger_group        varchar(200)    not null            comment 'qrtz_triggers表trigger_group的外键',
61 61
     repeat_count         bigint(7)       not null            comment '重复的次数统计',
62 62
     repeat_interval      bigint(12)      not null            comment '重复的间隔时间',
@@ -134,7 +134,7 @@ create table QRTZ_FIRED_TRIGGERS (
134 134
 -- ---------------------------- 
135 135
 create table QRTZ_SCHEDULER_STATE (
136 136
     sched_name           varchar(120)    not null            comment '调度名称',
137
-    instance_name        varchar(200)    not null            comment '之前配置文件中org.quartz.scheduler.instanceId配置的名字,就会写入该字段',
137
+    instance_name        varchar(200)    not null            comment '实例名称',
138 138
     last_checkin_time    bigint(13)      not null            comment '上次检查时间',
139 139
     checkin_interval     bigint(13)      not null            comment '检查间隔时间',
140 140
     primary key (sched_name, instance_name)
@@ -154,7 +154,7 @@ create table QRTZ_LOCKS (
154 154
 -- ---------------------------- 
155 155
 create table QRTZ_SIMPROP_TRIGGERS (
156 156
     sched_name           varchar(120)    not null            comment '调度名称',
157
-    trigger_name         varchar(200)    not null            comment 'qrtz_triggers表trigger_ name的外键',
157
+    trigger_name         varchar(200)    not null            comment 'qrtz_triggers表trigger_name的外键',
158 158
     trigger_group        varchar(200)    not null            comment 'qrtz_triggers表trigger_group的外键',
159 159
     str_prop_1           varchar(512)    null                comment 'String类型的trigger的第一个参数',
160 160
     str_prop_2           varchar(512)    null                comment 'String类型的trigger的第二个参数',