gunter-kgd 1.0.5 → 1.0.6
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/components/gante_test/gante-gc-item-content.vue +22 -0
- package/components/gante_test/gante-gc-item.vue +6 -3
- package/components/gante_test/gante-gc.vue +15 -5
- package/components/gante_test/gante-split.vue +17 -5
- package/components/gante_test/gante-table.vue +26 -5
- package/components/gante_test/gante.vue +9 -2
- package/gante.vue +9 -2
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<div
|
|
4
4
|
@mousemove.passive="showToast"
|
|
5
5
|
@mouseleave="hideToast"
|
|
6
|
+
@click.stop="handleClick"
|
|
6
7
|
@mousedown="dragDown($event,'drag')"
|
|
7
8
|
:style="{
|
|
8
9
|
cursor: DragObject.mouseDown ? 'grabbing' : 'grab',
|
|
@@ -30,6 +31,7 @@
|
|
|
30
31
|
requestId: '',
|
|
31
32
|
canShow: false,// 是否可以显示toast ,为了防止触发了mouseout事件后立马触发showToast事件
|
|
32
33
|
toastClassResolved: '',
|
|
34
|
+
justDragged: false,
|
|
33
35
|
DragObject:{
|
|
34
36
|
startX: 0, // 开始的位置
|
|
35
37
|
mouseDown: false,// 是否按下了鼠标
|
|
@@ -56,6 +58,19 @@
|
|
|
56
58
|
toastClass: String,
|
|
57
59
|
},
|
|
58
60
|
methods:{
|
|
61
|
+
handleClick(){
|
|
62
|
+
if(this.DragObject.mouseDown || this.justDragged){
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if(!this.current_data){
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
emitter.$emit('on-click', {
|
|
69
|
+
argument: 'taskBar',
|
|
70
|
+
value: this.current_data.gunter_id,
|
|
71
|
+
data: JSON.parse(JSON.stringify(this.current_data))
|
|
72
|
+
});
|
|
73
|
+
},
|
|
59
74
|
buildToastContent() {
|
|
60
75
|
if (!this.current_data || !this.current_data.params) {
|
|
61
76
|
this.toastClassResolved = (this.toastClass || '').trim();
|
|
@@ -159,6 +174,7 @@
|
|
|
159
174
|
dragDown(e,type){
|
|
160
175
|
if(this.current_data){
|
|
161
176
|
if(this.current_data.params){
|
|
177
|
+
this.justDragged = false;
|
|
162
178
|
this.DragObject.mouseDown = true;
|
|
163
179
|
this.DragObject.startX = e.clientX;
|
|
164
180
|
this.DragObject.move_type = type;
|
|
@@ -198,6 +214,7 @@
|
|
|
198
214
|
// 拖动时间
|
|
199
215
|
doc_move(e){
|
|
200
216
|
if(this.DragObject.mouseDown){
|
|
217
|
+
this.justDragged = true;
|
|
201
218
|
this.hideToast();
|
|
202
219
|
let move_mode_width = 0, // 宽度基值
|
|
203
220
|
move_mode_left = 0; // left基值
|
|
@@ -325,6 +342,11 @@
|
|
|
325
342
|
move_type: null,
|
|
326
343
|
};
|
|
327
344
|
this.hideToast();
|
|
345
|
+
if(this.justDragged){
|
|
346
|
+
setTimeout(() => {
|
|
347
|
+
this.justDragged = false;
|
|
348
|
+
}, 30);
|
|
349
|
+
}
|
|
328
350
|
}
|
|
329
351
|
}
|
|
330
352
|
}
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
:time_1px="time_1px"
|
|
14
14
|
:time_mode="time_mode"
|
|
15
15
|
:toast-render="toastRender"
|
|
16
|
-
:toast-class="toastClass"
|
|
16
|
+
:toast-class="toastClass"
|
|
17
|
+
:instance-id="instanceId"></ganteGcItemContent>
|
|
17
18
|
<button
|
|
18
19
|
v-if="shouldShowLocateStart(item)"
|
|
19
20
|
type="button"
|
|
@@ -46,7 +47,8 @@
|
|
|
46
47
|
:time_mode="time_mode"
|
|
47
48
|
:toast-render="toastRender"
|
|
48
49
|
:toast-class="toastClass"
|
|
49
|
-
:gante_data="item.children"
|
|
50
|
+
:gante_data="item.children"
|
|
51
|
+
:instance-id="instanceId">
|
|
50
52
|
<span style="display: none">1</span>
|
|
51
53
|
</ganteview-item>
|
|
52
54
|
</div>
|
|
@@ -82,10 +84,11 @@
|
|
|
82
84
|
end_time: {},
|
|
83
85
|
toastRender: Function,
|
|
84
86
|
toastClass: String,
|
|
87
|
+
instanceId: String,
|
|
85
88
|
},
|
|
86
89
|
created() {
|
|
87
90
|
this._onGcScroll = (info = {}) => {
|
|
88
|
-
if(info && typeof info === 'object'){
|
|
91
|
+
if(info && typeof info === 'object' && (!info.instanceId || info.instanceId === this.instanceId)){
|
|
89
92
|
this.scrollInfo.scrollLeft = Number(info.scrollLeft) || 0
|
|
90
93
|
this.scrollInfo.clientWidth = Number(info.clientWidth) || 0
|
|
91
94
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<div ref="ganteview" class="ganteview-box">
|
|
4
4
|
<div @scroll.passive="ganteview_scroll" class="ganteview">
|
|
5
5
|
<!-- <div class="current_move_time">{{current_move_time}}</div>-->
|
|
6
|
-
<div class="ganteview-header">
|
|
6
|
+
<div class="ganteview-header" :style="{width: header_width + 'px'}">
|
|
7
7
|
<div class="ganteview-toptime">
|
|
8
8
|
<div class="ganteview-headercell" :title="item.date" v-for="item in top_time_data"
|
|
9
9
|
:style="{width:item.width+'px',left:item.left+'px'}">{{item.date}}
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
:time_mode="time_mode"
|
|
24
24
|
:toast-render="toastRender"
|
|
25
25
|
:toast-class="toastClass"
|
|
26
|
+
:instance-id="instanceId"
|
|
26
27
|
:style="{width:header_width+'px'}"
|
|
27
28
|
v-if="show_item"
|
|
28
29
|
class="ganteview-content-box"
|
|
@@ -73,6 +74,7 @@
|
|
|
73
74
|
end_time: {},
|
|
74
75
|
toastRender: Function,
|
|
75
76
|
toastClass: String,
|
|
77
|
+
instanceId: String,
|
|
76
78
|
},
|
|
77
79
|
methods: {
|
|
78
80
|
remove_before(item){
|
|
@@ -80,11 +82,18 @@
|
|
|
80
82
|
},
|
|
81
83
|
ganteview_scroll(e) {
|
|
82
84
|
// 让左侧表格跟随滚动
|
|
83
|
-
|
|
84
|
-
|
|
85
|
+
const container = this.$el && this.$el.closest ? this.$el.closest('.gante-box') : null
|
|
86
|
+
const tbody = container ? container.querySelector('.gante-tbody') : null
|
|
87
|
+
const header = this.$el ? this.$el.querySelector('.ganteview-header') : null
|
|
88
|
+
if(tbody){
|
|
89
|
+
tbody.style.top = -(e.target.scrollTop) + 'px'
|
|
90
|
+
}
|
|
91
|
+
if(header){
|
|
92
|
+
header.style.left = -(e.target.scrollLeft) + 'px'
|
|
93
|
+
}
|
|
85
94
|
this.$parent.show_calendar = false
|
|
86
95
|
let scrollEl = e.target
|
|
87
|
-
commitEmit.$emit('gc-scroll', { scrollLeft: scrollEl.scrollLeft, clientWidth: scrollEl.clientWidth })
|
|
96
|
+
commitEmit.$emit('gc-scroll', { scrollLeft: scrollEl.scrollLeft, clientWidth: scrollEl.clientWidth, instanceId: this.instanceId })
|
|
88
97
|
if(scrollEl.scrollHeight <= scrollEl.scrollTop + scrollEl.clientHeight && this.requestBol){
|
|
89
98
|
this.requestBol = false
|
|
90
99
|
commitEmit.$emit('on-load')
|
|
@@ -190,7 +199,7 @@
|
|
|
190
199
|
this.$nextTick(() => {
|
|
191
200
|
const el = this.$el && this.$el.querySelector ? this.$el.querySelector('.ganteview') : null
|
|
192
201
|
if(el){
|
|
193
|
-
commitEmit.$emit('gc-scroll', { scrollLeft: el.scrollLeft, clientWidth: el.clientWidth })
|
|
202
|
+
commitEmit.$emit('gc-scroll', { scrollLeft: el.scrollLeft, clientWidth: el.clientWidth, instanceId: this.instanceId })
|
|
194
203
|
}
|
|
195
204
|
})
|
|
196
205
|
return {time: time, start_time: start_time}
|
|
@@ -387,6 +396,7 @@
|
|
|
387
396
|
height: 25px;
|
|
388
397
|
font-size: 13px;
|
|
389
398
|
z-index: 2;
|
|
399
|
+
background: #fff;
|
|
390
400
|
}
|
|
391
401
|
|
|
392
402
|
.ganteview-toptime, .ganteview-bottomtime {
|
|
@@ -25,7 +25,10 @@
|
|
|
25
25
|
mounted(){
|
|
26
26
|
|
|
27
27
|
},
|
|
28
|
-
|
|
28
|
+
methods:{
|
|
29
|
+
getContainer(){
|
|
30
|
+
return this.$el && this.$el.closest ? this.$el.closest('.gante-box') : null;
|
|
31
|
+
},
|
|
29
32
|
// 获取元素距离浏览器的距离
|
|
30
33
|
getPos(ele){
|
|
31
34
|
var p=ele.offsetParent;
|
|
@@ -49,9 +52,15 @@
|
|
|
49
52
|
doc_move(e){
|
|
50
53
|
if(this.mouseDown){
|
|
51
54
|
var _body = document.getElementsByTagName('body')[0];
|
|
55
|
+
const container = this.getContainer();
|
|
56
|
+
const tableBox = container ? container.querySelector('.gante-table-box') : null;
|
|
57
|
+
const gcBox = container ? container.querySelector('.ganteview-box') : null;
|
|
58
|
+
if(!tableBox || !gcBox){
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
52
61
|
let _left = e.pageX - this.$refs.split_liu.getBoundingClientRect().left +3, // 移动的距离
|
|
53
|
-
_width =
|
|
54
|
-
_width_gc =
|
|
62
|
+
_width = tableBox.offsetWidth, // 表格的宽度
|
|
63
|
+
_width_gc = gcBox.offsetWidth; // 图表的宽度
|
|
55
64
|
if(_left + _width <= 480){
|
|
56
65
|
_left = 480 - _width
|
|
57
66
|
}
|
|
@@ -65,8 +74,11 @@
|
|
|
65
74
|
doc_up(){
|
|
66
75
|
if(this.mouseDown){
|
|
67
76
|
var _body = document.getElementsByTagName('body')[0]
|
|
68
|
-
const
|
|
69
|
-
const
|
|
77
|
+
const container = this.getContainer();
|
|
78
|
+
const tableBox = container ? container.querySelector('.gante-table-box') : null;
|
|
79
|
+
const gcBox = container ? container.querySelector('.ganteview-box') : null;
|
|
80
|
+
const baseTableWidth = tableBox ? tableBox.offsetWidth : 0;
|
|
81
|
+
const baseGanttWidth = gcBox ? gcBox.offsetWidth : 0;
|
|
70
82
|
const delta = this.split_resize_left;
|
|
71
83
|
this.$parent.tabe_width = delta + baseTableWidth;
|
|
72
84
|
this.find_attr(this.$parent.tabe_width,this.th_data)
|
|
@@ -45,6 +45,13 @@
|
|
|
45
45
|
onColumnResize: Function,
|
|
46
46
|
},
|
|
47
47
|
methods:{
|
|
48
|
+
getContainer(){
|
|
49
|
+
return this.$el && this.$el.closest ? this.$el.closest('.gante-box') : null;
|
|
50
|
+
},
|
|
51
|
+
getTableBox(){
|
|
52
|
+
const container = this.getContainer();
|
|
53
|
+
return container ? container.querySelector('.gante-table-box') : null;
|
|
54
|
+
},
|
|
48
55
|
collectColumnWidths(changedKey,changedWidth){
|
|
49
56
|
const columnWidths = {}
|
|
50
57
|
let tableWidth = 0
|
|
@@ -137,8 +144,12 @@
|
|
|
137
144
|
return; // 如果是水平滚动,直接返回不处理
|
|
138
145
|
}
|
|
139
146
|
let speed = -200
|
|
140
|
-
|
|
141
|
-
|
|
147
|
+
const container = this.$el && this.$el.closest ? this.$el.closest('.gante-box') : null
|
|
148
|
+
const ganteview = container ? container.querySelector('.ganteview') : null
|
|
149
|
+
if(!ganteview){
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
let scrollTop = ganteview.scrollTop
|
|
142
153
|
if(e.wheelDelta && e.wheelDelta < 0){//兼容IE,Opera,Chrome
|
|
143
154
|
speed = 200
|
|
144
155
|
}else if(e.detail > 0){
|
|
@@ -181,7 +192,11 @@
|
|
|
181
192
|
doc_move(e){
|
|
182
193
|
var _body = document.getElementsByTagName('body')[0]
|
|
183
194
|
if(this.tTD.mouseDown){
|
|
184
|
-
|
|
195
|
+
const gante_table_box = this.getTableBox()
|
|
196
|
+
if(!gante_table_box){
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
var gante_left = this.getPos(this.$refs.gante_table).x,cel = e.clientX
|
|
185
200
|
if(gante_table_box.scrollLeft){
|
|
186
201
|
cel = cel + gante_table_box.scrollLeft
|
|
187
202
|
}
|
|
@@ -199,7 +214,11 @@
|
|
|
199
214
|
if(e.target.tagName === 'SPAN' ||e.target.tagName === 'I'){
|
|
200
215
|
return;
|
|
201
216
|
}
|
|
202
|
-
|
|
217
|
+
const gante_table_box = this.getTableBox()
|
|
218
|
+
if(!gante_table_box){
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
var table_width = this.getPos(this.$refs.gante_table).x,target=e.target,client_x = e.clientX
|
|
203
222
|
if(target.classList.contains('cell')){
|
|
204
223
|
target = target.parentNode
|
|
205
224
|
}
|
|
@@ -224,7 +243,9 @@
|
|
|
224
243
|
// 设置拖动后的宽度
|
|
225
244
|
this.th_data[this.tTD.current_index].width = this.old_width+(this.proxy_left - this.oldx)
|
|
226
245
|
// 获取到左边表格所有td加起来的宽度
|
|
227
|
-
|
|
246
|
+
const gante_table_box = this.getTableBox()
|
|
247
|
+
const _width = gante_table_box ? gante_table_box.offsetWidth : 0;
|
|
248
|
+
let str = 0;
|
|
228
249
|
for(let key in this.th_data){
|
|
229
250
|
if(this.th_data[key].show != false){
|
|
230
251
|
str += this.th_data[key].width ? Number(this.th_data[key].width) + 1 : 81;
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
:th_data="th_data"
|
|
34
34
|
:gante_data="ganteData"
|
|
35
35
|
:toast-render="toastRender"
|
|
36
|
-
:toast-class="toastClass"
|
|
36
|
+
:toast-class="toastClass"
|
|
37
|
+
:instance-id="instanceId"></gante-gc>
|
|
37
38
|
</div>
|
|
38
39
|
<gante-split :left="tabe_width" :th_data="th_data" :onSplitResize="onSplitResize"></gante-split>
|
|
39
40
|
</div>
|
|
@@ -84,6 +85,7 @@
|
|
|
84
85
|
onDragChangeTime: () => {}, // 拖动改变时间
|
|
85
86
|
onSplitResize: () => {}, // 拖动分割线改变宽度回调
|
|
86
87
|
onColumnResize: () => {}, // 拖动列宽回调
|
|
88
|
+
instanceId: `gante-${Math.random().toString(36).slice(2)}`,
|
|
87
89
|
dropdownOptions: [
|
|
88
90
|
{ value: 1, label: '日' },
|
|
89
91
|
{ value: 2, label: '周' },
|
|
@@ -335,7 +337,12 @@
|
|
|
335
337
|
// 初始化
|
|
336
338
|
init(params,mode = true) {
|
|
337
339
|
|
|
338
|
-
Object.assign(
|
|
340
|
+
const cloneParams = Object.assign({}, params);
|
|
341
|
+
if(params.th_data){
|
|
342
|
+
cloneParams.th_data = JSON.parse(JSON.stringify(params.th_data));
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
Object.assign(this.$data, cloneParams);
|
|
339
346
|
|
|
340
347
|
if(params.ganteData == undefined){
|
|
341
348
|
let ganteData = JSON.parse(JSON.stringify(this.ganteData));
|
package/gante.vue
CHANGED
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
:th_data="th_data"
|
|
35
35
|
:gante_data="ganteData"
|
|
36
36
|
:toast-render="toastRender"
|
|
37
|
-
:toast-class="toastClass"
|
|
37
|
+
:toast-class="toastClass"
|
|
38
|
+
:instance-id="instanceId"></gante-gc>
|
|
38
39
|
</div>
|
|
39
40
|
<gante-split :left="tabe_width" :th_data="th_data" :onSplitResize="onSplitResize"></gante-split>
|
|
40
41
|
</div>
|
|
@@ -87,6 +88,7 @@
|
|
|
87
88
|
onDragChangeTime: () => {}, // 拖动改变时间
|
|
88
89
|
onSplitResize: () => {}, // 拖动分割线改变宽度回调
|
|
89
90
|
onColumnResize: () => {}, // 拖动列宽回调
|
|
91
|
+
instanceId: `gante-${Math.random().toString(36).slice(2)}`,
|
|
90
92
|
dropdownOptions: [
|
|
91
93
|
{ value: 1, label: '日' },
|
|
92
94
|
{ value: 2, label: '周' },
|
|
@@ -350,7 +352,12 @@
|
|
|
350
352
|
// 初始化
|
|
351
353
|
init(params,mode = true) {
|
|
352
354
|
|
|
353
|
-
Object.assign(
|
|
355
|
+
const cloneParams = Object.assign({}, params);
|
|
356
|
+
if(params.th_data){
|
|
357
|
+
cloneParams.th_data = JSON.parse(JSON.stringify(params.th_data));
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
Object.assign(this.$data, cloneParams);
|
|
354
361
|
|
|
355
362
|
if(params.ganteData == undefined){
|
|
356
363
|
let ganteData = JSON.parse(JSON.stringify(this.ganteData));
|