gunter-kgd 1.0.0 → 1.0.2
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/common/dropdown.vue +227 -0
- package/components/common/loading.vue +67 -0
- package/components/gante_test/auto-scroll.js +32 -0
- package/components/gante_test/calendar.vue +257 -0
- package/components/gante_test/commit.js +2 -0
- package/components/gante_test/gante-drag-circle.vue +151 -0
- package/components/gante_test/gante-gc-item-content.vue +442 -0
- package/components/gante_test/gante-gc-item.vue +95 -0
- package/components/gante_test/gante-gc.vue +534 -0
- package/components/gante_test/gante-split.vue +125 -0
- package/components/gante_test/gante-table-td.vue +263 -0
- package/components/gante_test/gante-table-tr.vue +159 -0
- package/components/gante_test/gante-table.vue +349 -0
- package/components/gante_test/gante.vue +894 -0
- package/components/gante_test/gante_op.js +112 -0
- package/components/gante_test/requestAnimation.js +49 -0
- package/components/gante_test/resize.js +80 -0
- package/components/gante_test/search_last_width.js +27 -0
- package/gante.vue +9 -9
- package/index.js +1 -1
- package/package.json +3 -2
- package/utils/click-outside.js +18 -0
- package/utils/public.js +94 -0
- package/utils/requestAnimation.js +49 -0
|
@@ -0,0 +1,534 @@
|
|
|
1
|
+
<!--整体图表-->
|
|
2
|
+
<template>
|
|
3
|
+
<div ref="ganteview" class="ganteview-box">
|
|
4
|
+
<div @scroll.passive="ganteview_scroll" class="ganteview">
|
|
5
|
+
<!-- <div class="current_move_time">{{current_move_time}}</div>-->
|
|
6
|
+
<div class="ganteview-header">
|
|
7
|
+
<div class="ganteview-toptime">
|
|
8
|
+
<div class="ganteview-headercell" :title="item.date" v-for="item in top_time_data"
|
|
9
|
+
:style="{width:item.width+'px',left:item.left+'px'}">{{item.date}}
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
<div class="ganteview-bottomtime">
|
|
13
|
+
<div class="ganteview-headercell" :title="item.title" v-for="item in bottom_time_data"
|
|
14
|
+
:style="{width:item.width+'px',left:item.left+'px',color:item.is_rest?'#999':null}">{{item.date}}
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
<gante-gc-item
|
|
19
|
+
:th_data="th_data"
|
|
20
|
+
:start_time="start_time"
|
|
21
|
+
:end_time="end_time"
|
|
22
|
+
:time_1px="time_1px"
|
|
23
|
+
:time_mode="time_mode"
|
|
24
|
+
:toast-render="toastRender"
|
|
25
|
+
:toast-class="toastClass"
|
|
26
|
+
:style="{width:header_width+'px'}"
|
|
27
|
+
v-if="show_item"
|
|
28
|
+
class="ganteview-content-box"
|
|
29
|
+
:gante_data="gante_data">
|
|
30
|
+
<div v-for="item in bottom_time_data" class="ganteview-column"
|
|
31
|
+
:style="{width:item.width+'px',left:item.left+'px',background:item.is_rest?'#F3FDFF':null}"></div>
|
|
32
|
+
<div :style="{width: todayInfo.width + 'px',left: todayInfo.left +'px'}" id="today-ganteview-column"></div>
|
|
33
|
+
|
|
34
|
+
</gante-gc-item>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
<script>
|
|
39
|
+
import ganteGcItem from './gante-gc-item.vue';
|
|
40
|
+
import commitEmit from './commit.js';
|
|
41
|
+
import { mapState,mapMutations } from 'vuex';
|
|
42
|
+
export default {
|
|
43
|
+
data() {
|
|
44
|
+
return {
|
|
45
|
+
one_px: 75, //每个格子占的像素(默认为50)
|
|
46
|
+
first_day: null, //开始的时间
|
|
47
|
+
top_time_data: [],//顶部时间刻度
|
|
48
|
+
bottom_time_data: [],//底部时间刻度
|
|
49
|
+
header_width: 0, //时间组件的宽度
|
|
50
|
+
future_time: 0, //顶部时间的最大的时间
|
|
51
|
+
time_1px: 0, // 1px代表的刻度
|
|
52
|
+
time_mode: 0, // 显示的时间格式 时间刻度 1:日,2周,3月,4季,5年
|
|
53
|
+
todayInfo:{
|
|
54
|
+
width: 0,
|
|
55
|
+
left: 0,
|
|
56
|
+
}, // 当前时间的信息
|
|
57
|
+
time_jiange: 0,
|
|
58
|
+
show_item: false,
|
|
59
|
+
requestBol:true,
|
|
60
|
+
current_move_time:'',// 当前显示的时间
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
computed:{
|
|
64
|
+
...mapState([
|
|
65
|
+
'dashLine',
|
|
66
|
+
'lineList'
|
|
67
|
+
]),
|
|
68
|
+
},
|
|
69
|
+
props: {
|
|
70
|
+
gante_data: Array,
|
|
71
|
+
th_data: Object,
|
|
72
|
+
start_time: {}, //开始时间
|
|
73
|
+
end_time: {},
|
|
74
|
+
toastRender: Function,
|
|
75
|
+
toastClass: String,
|
|
76
|
+
},
|
|
77
|
+
methods: {
|
|
78
|
+
remove_before(item){
|
|
79
|
+
commitEmit.$emit('onBeforeDataChange',item.id, item.before_id,1)
|
|
80
|
+
},
|
|
81
|
+
ganteview_scroll(e) {
|
|
82
|
+
// 让左侧表格跟随滚动
|
|
83
|
+
document.getElementsByClassName('gante-tbody')[0].style.top = -(e.target.scrollTop) + 'px'
|
|
84
|
+
document.getElementsByClassName('ganteview-header')[0].style.left = -(e.target.scrollLeft) + 'px'
|
|
85
|
+
this.$parent.show_calendar = false
|
|
86
|
+
let scrollEl = e.target
|
|
87
|
+
if(scrollEl.scrollHeight <= scrollEl.scrollTop + scrollEl.clientHeight && this.requestBol){
|
|
88
|
+
this.requestBol = false
|
|
89
|
+
commitEmit.$emit('on-load')
|
|
90
|
+
}
|
|
91
|
+
// 显示顶部移动到的当前时间
|
|
92
|
+
if(scrollEl.scrollLeft >= 0){
|
|
93
|
+
for(let i of this.top_time_data){
|
|
94
|
+
if(i.left + i.width >= scrollEl.scrollLeft){
|
|
95
|
+
this.current_move_time = i.date;
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
/**
|
|
102
|
+
*
|
|
103
|
+
* @param time_mode 显示的时间格式 时间刻度 1:日,2周,3月,4季,5年
|
|
104
|
+
* @returns {{start_time: Date, time: number}}
|
|
105
|
+
*/
|
|
106
|
+
init(time_mode) {
|
|
107
|
+
this.header_width = 0
|
|
108
|
+
// console.log(this.start_time,this.end_time)
|
|
109
|
+
var time = 0,
|
|
110
|
+
gante_width = this.$refs.ganteview.offsetWidth, //当前右边图表的宽度
|
|
111
|
+
all_time = 0,//所有的时间总和
|
|
112
|
+
start_time = null, //最小的开始时间
|
|
113
|
+
mode = 1;
|
|
114
|
+
if(time_mode == 1){
|
|
115
|
+
start_time = new Date(this.start_time - (60 * 60 * 1 * 24 * 1000))
|
|
116
|
+
}
|
|
117
|
+
if(time_mode == 2){
|
|
118
|
+
start_time = new Date(this.start_time - (7 * 24 * 60 * 60 * 1000))
|
|
119
|
+
}
|
|
120
|
+
if(time_mode == 3){
|
|
121
|
+
start_time = new Date(this.start_time - (30 * 24 * 60 * 60 * 1000))
|
|
122
|
+
}
|
|
123
|
+
if(time_mode == 4){
|
|
124
|
+
start_time = new Date(this.start_time - (90 * 24 * 60 * 60 * 1000))
|
|
125
|
+
}
|
|
126
|
+
if(time_mode == 5){
|
|
127
|
+
start_time = new Date(this.start_time - (183 * 24 * 60 * 60 * 1000))
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
switch (time_mode) {
|
|
131
|
+
//日
|
|
132
|
+
case 1:
|
|
133
|
+
time = 60 * 60 * 1 * 24 * 1000 / this.one_px
|
|
134
|
+
this.first_day = start_time;
|
|
135
|
+
break;
|
|
136
|
+
// 周
|
|
137
|
+
case 2:
|
|
138
|
+
time = 7 * 24 * 60 * 60 * 1000 / this.one_px;
|
|
139
|
+
const daysToMonday = (start_time.getDay() + 6) % 7;
|
|
140
|
+
this.first_day = new Date(start_time.getFullYear(), start_time.getMonth(), start_time.getDate() - daysToMonday)
|
|
141
|
+
start_time = this.first_day
|
|
142
|
+
mode = 2
|
|
143
|
+
break;
|
|
144
|
+
// 月
|
|
145
|
+
case 3:
|
|
146
|
+
time = 30 * 24 * 60 * 60 * 1000 / this.one_px;
|
|
147
|
+
this.first_day = new Date(start_time.getFullYear(), start_time.getMonth(), 1)
|
|
148
|
+
start_time = this.first_day
|
|
149
|
+
mode = 2
|
|
150
|
+
break;
|
|
151
|
+
// 季
|
|
152
|
+
case 4:
|
|
153
|
+
time = 90 * 24 * 60 * 60 * 1000 / this.one_px
|
|
154
|
+
let month = 0,reference_month = start_time.getMonth() + 1
|
|
155
|
+
if (reference_month >= 1 && reference_month <= 3) {
|
|
156
|
+
month = 0
|
|
157
|
+
} else if (reference_month >= 4 && reference_month <= 6) {
|
|
158
|
+
month = 3
|
|
159
|
+
} else if (reference_month >= 7 && reference_month <= 9) {
|
|
160
|
+
month = 6
|
|
161
|
+
} else if (reference_month >= 10 && reference_month <= 12) {
|
|
162
|
+
month = 9
|
|
163
|
+
}
|
|
164
|
+
this.first_day = new Date(start_time.getFullYear(), month, 1)
|
|
165
|
+
start_time = this.first_day
|
|
166
|
+
mode = 2
|
|
167
|
+
break;
|
|
168
|
+
// 年
|
|
169
|
+
case 5:
|
|
170
|
+
time = 183 * 24 * 60 * 60 * 1000 / this.one_px
|
|
171
|
+
this.first_day = new Date(start_time.getFullYear(), 0, 1)
|
|
172
|
+
start_time = this.first_day
|
|
173
|
+
mode = 2
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
this.time_jiange = time
|
|
177
|
+
this.show_item = true
|
|
178
|
+
if (this.end_time) {
|
|
179
|
+
all_time = new Date(this.end_time).getTime()
|
|
180
|
+
if (gante_width * time >= (all_time - new Date(this.first_day).getTime())) {
|
|
181
|
+
all_time = gante_width * time + new Date(this.first_day).getTime()
|
|
182
|
+
}
|
|
183
|
+
} else {
|
|
184
|
+
all_time = gante_width * time + new Date(this.first_day).getTime()
|
|
185
|
+
}
|
|
186
|
+
this.get_top_time(mode, this.first_day, time, all_time, time_mode)
|
|
187
|
+
this.time_1px = time;
|
|
188
|
+
this.time_mode = time_mode;
|
|
189
|
+
return {time: time, start_time: start_time}
|
|
190
|
+
},
|
|
191
|
+
/**
|
|
192
|
+
* 格式化时间
|
|
193
|
+
* @param time 时间
|
|
194
|
+
* @param mode 1:年月日 2:年月 3:日 4:月 5:年
|
|
195
|
+
*/
|
|
196
|
+
format(time, mode) {
|
|
197
|
+
var year = time.getFullYear();
|
|
198
|
+
var month = time.getMonth() + 1;
|
|
199
|
+
var day = time.getDate()
|
|
200
|
+
if (mode == 1) {
|
|
201
|
+
return year + "-" + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day)
|
|
202
|
+
} else if (mode == 2) {
|
|
203
|
+
return year + "-" + (month < 10 ? '0' + month : month)
|
|
204
|
+
} else if (mode == 3) {
|
|
205
|
+
return day < 10 ? '0' + day : day
|
|
206
|
+
} else if (mode == 4) {
|
|
207
|
+
return month < 10 ? '0' + month : month
|
|
208
|
+
} else if (mode == 5) {
|
|
209
|
+
return year
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
/**
|
|
213
|
+
* 获取顶部时间
|
|
214
|
+
* @param mode 代表是以年什么为跨度 1:月 2:年
|
|
215
|
+
* @param first_time 第一个开始的时间
|
|
216
|
+
* @param time 时间刻度
|
|
217
|
+
* @param all_width 总的图表的宽度
|
|
218
|
+
* @param time_mode 时间刻度格式
|
|
219
|
+
*/
|
|
220
|
+
get_top_time(mode, first_time, time, all_width, time_mode) {
|
|
221
|
+
// 获取今天的位置和信息
|
|
222
|
+
this.todayInfo.width = 24*60*60*1000/time <= 5 ? 5 : 24*60*60*1000/time;
|
|
223
|
+
this.todayInfo.left = (new Date(new Date().toLocaleDateString()).getTime() - first_time.getTime())/time;
|
|
224
|
+
|
|
225
|
+
var list = [];
|
|
226
|
+
for (let i = 0; i <= all_width;) {
|
|
227
|
+
var old_time = first_time;
|
|
228
|
+
var date = '';
|
|
229
|
+
|
|
230
|
+
if (time_mode == 1) {
|
|
231
|
+
// 月的形式,保留月份显示
|
|
232
|
+
date = this.format(old_time, 2); // 格式: YYYY-MM
|
|
233
|
+
first_time = new Date(first_time.getFullYear(), first_time.getMonth() + 1, 1);
|
|
234
|
+
} else {
|
|
235
|
+
// 年的形式,只展示年份
|
|
236
|
+
date = this.format(old_time, 5); // 格式: YYYY
|
|
237
|
+
first_time = new Date(first_time.getFullYear() + 1, 0, 1);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
var width = (first_time.getTime() - old_time.getTime()) / time;
|
|
241
|
+
this.header_width += width;
|
|
242
|
+
list.push({
|
|
243
|
+
left: (old_time.getTime() - this.first_day.getTime()) / time,
|
|
244
|
+
width: width,
|
|
245
|
+
date: date
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
i = first_time.getTime();
|
|
249
|
+
this.future_time = i;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
this.top_time_data = list;
|
|
253
|
+
|
|
254
|
+
// 使用future_time作为新的时间范围边界
|
|
255
|
+
if (this.future_time) {
|
|
256
|
+
var new_time_range = this.future_time;
|
|
257
|
+
this.get_bottom_time(time_mode, this.first_day, time, new_time_range);
|
|
258
|
+
} else {
|
|
259
|
+
this.get_bottom_time(time_mode, this.first_day, time, all_width);
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
|
|
263
|
+
get_bottom_time(mode, first_time, time, all_width) {
|
|
264
|
+
var list = []
|
|
265
|
+
for (let i = 0; i <= all_width;) {
|
|
266
|
+
var old_time = first_time,
|
|
267
|
+
date = this.format(old_time, 3),
|
|
268
|
+
title = this.format(old_time, 1),
|
|
269
|
+
is_rest = false; //是否是双休
|
|
270
|
+
if (mode == 1) {
|
|
271
|
+
first_time = new Date(first_time.getFullYear(), first_time.getMonth(), first_time.getDate() + 1)
|
|
272
|
+
// | 返回值 | 含义 |
|
|
273
|
+
// | `0` | 星期日 |
|
|
274
|
+
// | `1` | 星期一 |
|
|
275
|
+
// | `2` | 星期二 |
|
|
276
|
+
// | `3` | 星期三 |
|
|
277
|
+
// | `4` | 星期四 |
|
|
278
|
+
// | `5` | 星期五 |
|
|
279
|
+
// | `6` | 星期六 |
|
|
280
|
+
if (old_time.getDay() == 0 || old_time.getDay() == 6) {
|
|
281
|
+
is_rest = true
|
|
282
|
+
}
|
|
283
|
+
} else if (mode == 2) {
|
|
284
|
+
first_time = new Date(first_time.getFullYear(), first_time.getMonth(), first_time.getDate() + 7)
|
|
285
|
+
const weekNumber = this.get_week_number(old_time)
|
|
286
|
+
date = `W${weekNumber}`
|
|
287
|
+
title = this.format(old_time, 1) + '~' + this.format(new Date(first_time.getFullYear(), first_time.getMonth(), first_time.getDate() - 1), 1)
|
|
288
|
+
} else if (mode == 3) {
|
|
289
|
+
first_time = new Date(first_time.getFullYear(), first_time.getMonth() + 1, 1)
|
|
290
|
+
date = this.format(old_time, 4)
|
|
291
|
+
title = this.format(old_time, 2)
|
|
292
|
+
} else if (mode == 4) {
|
|
293
|
+
first_time = new Date(first_time.getFullYear(), first_time.getMonth() + 3, 1)
|
|
294
|
+
date = this.get_date(old_time.getMonth(), 'month')
|
|
295
|
+
title = this.format(old_time, 1) + '~' + this.format(new Date(first_time.getFullYear(), first_time.getMonth(), 0), 1)
|
|
296
|
+
} else if (mode == 5) {
|
|
297
|
+
first_time = new Date(first_time.getFullYear(), first_time.getMonth() + 6, 1)
|
|
298
|
+
date = this.get_date(old_time.getMonth(), 'year')
|
|
299
|
+
title = this.format(old_time, 1) + '~' + this.format(new Date(first_time.getFullYear(), first_time.getMonth(), 0), 1)
|
|
300
|
+
}
|
|
301
|
+
var width = (first_time.getTime() - old_time.getTime()) / time
|
|
302
|
+
i = first_time.getTime()
|
|
303
|
+
if (i <= all_width) {
|
|
304
|
+
list.push({
|
|
305
|
+
left: (old_time.getTime() - this.first_day.getTime()) / time,
|
|
306
|
+
width: width,
|
|
307
|
+
date: date,
|
|
308
|
+
title: title,
|
|
309
|
+
is_rest: is_rest
|
|
310
|
+
})
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
this.bottom_time_data = list
|
|
314
|
+
},
|
|
315
|
+
// 格式化季度或年份的上下半年
|
|
316
|
+
get_date(time, mode) {
|
|
317
|
+
let date = ''
|
|
318
|
+
if (mode == 'month') {
|
|
319
|
+
if (time <= 2 && time >= 0) {
|
|
320
|
+
date = 'Q1'
|
|
321
|
+
} else if (time <= 5 && time >= 3) {
|
|
322
|
+
date = 'Q2'
|
|
323
|
+
} else if (time <= 8 && time >= 6) {
|
|
324
|
+
date = 'Q3'
|
|
325
|
+
} else if (time <= 11 && time >= 9) {
|
|
326
|
+
date = 'Q4'
|
|
327
|
+
}
|
|
328
|
+
} else if (mode == 'year') {
|
|
329
|
+
if (time <= 5 && time >= 0) {
|
|
330
|
+
date = 'Y1'
|
|
331
|
+
} else if (time <= 11 && time >= 6) {
|
|
332
|
+
date = 'Y2'
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
return date
|
|
336
|
+
},
|
|
337
|
+
// 获取指定日期在该年的周序号(以周一为一周开始)
|
|
338
|
+
get_week_number(time) {
|
|
339
|
+
const oneWeekMs = 7 * 24 * 60 * 60 * 1000
|
|
340
|
+
const yearStart = new Date(time.getFullYear(), 0, 1)
|
|
341
|
+
const startDay = (yearStart.getDay() + 6) % 7
|
|
342
|
+
const firstWeekStart = new Date(yearStart.getFullYear(), 0, 1 - startDay)
|
|
343
|
+
return Math.floor((time.getTime() - firstWeekStart.getTime()) / oneWeekMs) + 1
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
components: {
|
|
347
|
+
ganteGcItem
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
</script>
|
|
351
|
+
<style scoped lang="less">
|
|
352
|
+
.ganteview-box {
|
|
353
|
+
height: 100%;
|
|
354
|
+
position: relative;
|
|
355
|
+
overflow: hidden;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.ganteview {
|
|
359
|
+
height: 100%;
|
|
360
|
+
overflow: auto;
|
|
361
|
+
font-size: 13px;
|
|
362
|
+
box-sizing: border-box;
|
|
363
|
+
}
|
|
364
|
+
.ganteview .current_move_time {
|
|
365
|
+
position: absolute;
|
|
366
|
+
left: 3px;
|
|
367
|
+
top: 0;
|
|
368
|
+
padding-left: 10px;
|
|
369
|
+
line-height: 24px;
|
|
370
|
+
height: 24px;
|
|
371
|
+
color: #777;
|
|
372
|
+
background: #fff;
|
|
373
|
+
z-index: 3;
|
|
374
|
+
}
|
|
375
|
+
.ganteview-header {
|
|
376
|
+
position: absolute;
|
|
377
|
+
width: 100%;
|
|
378
|
+
top: 0;
|
|
379
|
+
left: 0;
|
|
380
|
+
height: 25px;
|
|
381
|
+
font-size: 13px;
|
|
382
|
+
z-index: 2;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
.ganteview-toptime, .ganteview-bottomtime {
|
|
386
|
+
height: 25px;
|
|
387
|
+
line-height: 25px;
|
|
388
|
+
position: relative;
|
|
389
|
+
background: #fff;
|
|
390
|
+
/*display: flex;*/
|
|
391
|
+
/*justify-content: flex-start;*/
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.ganteview-bottomtime{
|
|
395
|
+
height: 25px;
|
|
396
|
+
line-height: 25px;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.ganteview-toptime .ganteview-headercell {
|
|
400
|
+
padding-left: 4px;
|
|
401
|
+
text-align: left;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.ganteview-bottomtime .ganteview-headercell {
|
|
405
|
+
text-align: center;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
.ganteview-column {
|
|
410
|
+
position: absolute;
|
|
411
|
+
top: 54px;
|
|
412
|
+
border-right: 1px solid #ebeef5;
|
|
413
|
+
height: calc(100% - 54px);
|
|
414
|
+
z-index: 0;
|
|
415
|
+
box-sizing: border-box;
|
|
416
|
+
}
|
|
417
|
+
#today-ganteview-column{
|
|
418
|
+
position: absolute;
|
|
419
|
+
top: 54px;
|
|
420
|
+
height: calc(100% - 54px);
|
|
421
|
+
z-index: 0;
|
|
422
|
+
box-sizing: border-box;
|
|
423
|
+
background: #dcecfe;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
.ganteview-headercell {
|
|
427
|
+
box-sizing: border-box;
|
|
428
|
+
color: #666;
|
|
429
|
+
border-right: 1px solid #ebeef5;
|
|
430
|
+
border-bottom: 1px solid #ebeef5;
|
|
431
|
+
overflow: hidden;
|
|
432
|
+
word-break: break-all;
|
|
433
|
+
height: 100%;
|
|
434
|
+
position: absolute;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.ganteview-content-box {
|
|
438
|
+
padding-top: 50px;
|
|
439
|
+
border-bottom: 1px solid #ebeef5;
|
|
440
|
+
}
|
|
441
|
+
.gante-drag-line-Liu {
|
|
442
|
+
position: absolute;
|
|
443
|
+
height: 1px;
|
|
444
|
+
transform-origin: 0 0 0;
|
|
445
|
+
border-top: 1px dashed #2aa9a0;
|
|
446
|
+
pointer-events: none;
|
|
447
|
+
z-index: 1;
|
|
448
|
+
}
|
|
449
|
+
.gante-lines-component{
|
|
450
|
+
position: absolute;
|
|
451
|
+
left: 0;
|
|
452
|
+
top: 94px;
|
|
453
|
+
height: calc(100% - 94px);
|
|
454
|
+
width: 100%;
|
|
455
|
+
box-sizing: border-box;
|
|
456
|
+
.line-container{
|
|
457
|
+
.h-line{
|
|
458
|
+
position: absolute;
|
|
459
|
+
padding: 0 2px;
|
|
460
|
+
width: 1px;
|
|
461
|
+
cursor: pointer;
|
|
462
|
+
z-index: 2;
|
|
463
|
+
&:after{
|
|
464
|
+
position: absolute;
|
|
465
|
+
content: "";
|
|
466
|
+
left: 0;
|
|
467
|
+
width: 1px;
|
|
468
|
+
height: 100%;
|
|
469
|
+
background: #69d0ca;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
.row-line{
|
|
473
|
+
position: absolute;
|
|
474
|
+
height: 1px;
|
|
475
|
+
padding: 2px 0;
|
|
476
|
+
cursor: pointer;
|
|
477
|
+
z-index: 2;
|
|
478
|
+
&:after{
|
|
479
|
+
position: absolute;
|
|
480
|
+
content: "";
|
|
481
|
+
top: 0;
|
|
482
|
+
height: 1px;
|
|
483
|
+
width: 100%;
|
|
484
|
+
background: #69d0ca;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
.arrow {
|
|
488
|
+
position: absolute;
|
|
489
|
+
width: 0;
|
|
490
|
+
height: 0;
|
|
491
|
+
border-left: 5px solid transparent;
|
|
492
|
+
border-right: 5px solid transparent;
|
|
493
|
+
cursor: pointer;
|
|
494
|
+
z-index: 2;
|
|
495
|
+
&.arrow_up{
|
|
496
|
+
border-bottom: 5px solid #69d0ca;
|
|
497
|
+
}
|
|
498
|
+
&.arrow_down{
|
|
499
|
+
border-top: 5px solid #69d0ca;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
.remove{
|
|
503
|
+
position: absolute;
|
|
504
|
+
color: #ff1f1a;
|
|
505
|
+
width: 14px;
|
|
506
|
+
height: 14px;
|
|
507
|
+
border-radius: 7px;
|
|
508
|
+
visibility: hidden;
|
|
509
|
+
background: #fff;
|
|
510
|
+
cursor: pointer;
|
|
511
|
+
z-index: 3;
|
|
512
|
+
}
|
|
513
|
+
&:hover{
|
|
514
|
+
.h-line,.row-line{
|
|
515
|
+
z-index: 3;
|
|
516
|
+
&:after{
|
|
517
|
+
background: #ff1f1a;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
.arrow {
|
|
521
|
+
&.arrow_up{
|
|
522
|
+
border-bottom: 5px solid #ff1f1a;
|
|
523
|
+
}
|
|
524
|
+
&.arrow_down{
|
|
525
|
+
border-top: 5px solid #ff1f1a;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
.remove{
|
|
529
|
+
visibility: visible;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
</style>
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
<!--中间分割线,分割左侧表格和右侧图表-->
|
|
2
|
+
<template>
|
|
3
|
+
<div @mousedown="down" ref="split_liu" :style="{left:Number(left)?left+'px':left}" class="gante-split-liu">
|
|
4
|
+
<!--<div class="gante-split-column">-->
|
|
5
|
+
<!--<div></div>-->
|
|
6
|
+
<!--<div></div>-->
|
|
7
|
+
<!--<div></div>-->
|
|
8
|
+
<!--</div>-->
|
|
9
|
+
<div v-show="show_split" :style="{left:split_resize_left+'px'}" class="gante-split-liu-resize"></div>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
<script>
|
|
13
|
+
import searchLastWidth from './search_last_width'
|
|
14
|
+
export default{
|
|
15
|
+
mixins:[searchLastWidth],
|
|
16
|
+
data(){
|
|
17
|
+
return{
|
|
18
|
+
show_split:false,
|
|
19
|
+
split_resize_left:0,
|
|
20
|
+
mouseDown:false
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
props:['left','th_data'],
|
|
24
|
+
mounted(){
|
|
25
|
+
|
|
26
|
+
},
|
|
27
|
+
methods:{
|
|
28
|
+
// 获取元素距离浏览器的距离
|
|
29
|
+
getPos(ele){
|
|
30
|
+
var p=ele.offsetParent;
|
|
31
|
+
var left=ele.offsetLeft;
|
|
32
|
+
var top=ele.offsetTop
|
|
33
|
+
while(p){
|
|
34
|
+
if(window.navigator.userAgent.indexOf("MSIE 8")>-1){
|
|
35
|
+
left+=p.offsetLeft;
|
|
36
|
+
top+=p.offsetTop;
|
|
37
|
+
}else{
|
|
38
|
+
left+=p.offsetLeft+p.clientLeft;
|
|
39
|
+
top+=p.offsetTop+p.clientTop;
|
|
40
|
+
}
|
|
41
|
+
p=p.offsetParent;
|
|
42
|
+
}
|
|
43
|
+
var obj={};
|
|
44
|
+
obj.x=left;
|
|
45
|
+
obj.y=top;
|
|
46
|
+
return obj;
|
|
47
|
+
},
|
|
48
|
+
doc_move(e){
|
|
49
|
+
if(this.mouseDown){
|
|
50
|
+
var _body = document.getElementsByTagName('body')[0];
|
|
51
|
+
let _left = e.pageX - this.$refs.split_liu.getBoundingClientRect().left +3, // 移动的距离
|
|
52
|
+
_width = document.getElementsByClassName('gante-table-box')[0].offsetWidth, // 表格的宽度
|
|
53
|
+
_width_gc = document.getElementsByClassName('ganteview-box')[0].offsetWidth; // 图表的宽度
|
|
54
|
+
console.log(_left)
|
|
55
|
+
if(_left + _width <= 480){
|
|
56
|
+
_left = 480 - _width
|
|
57
|
+
}
|
|
58
|
+
if(_width_gc - _left <= 30){
|
|
59
|
+
_left = _width_gc - 30
|
|
60
|
+
}
|
|
61
|
+
this.split_resize_left = _left;
|
|
62
|
+
_body.style.cursor = 'e-resize'
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
doc_up(){
|
|
66
|
+
if(this.mouseDown){
|
|
67
|
+
var _body = document.getElementsByTagName('body')[0]
|
|
68
|
+
this.$parent.tabe_width = this.split_resize_left + document.getElementsByClassName('gante-table-box')[0].offsetWidth;
|
|
69
|
+
this.find_attr(this.$parent.tabe_width,this.th_data)
|
|
70
|
+
this.show_split = false
|
|
71
|
+
this.split_resize_left = 0
|
|
72
|
+
this.mouseDown = false
|
|
73
|
+
_body.classList.remove('unselecttable')
|
|
74
|
+
_body.style.cursor = null
|
|
75
|
+
document.removeEventListener('mousemove',this.doc_move,false)
|
|
76
|
+
document.removeEventListener('mouseup',this.doc_up,false)
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
down(){
|
|
80
|
+
this.mouseDown = true
|
|
81
|
+
this.show_split = true
|
|
82
|
+
document.getElementsByTagName('body')[0].classList.add('unselecttable')
|
|
83
|
+
document.addEventListener('mousemove',this.doc_move,{passive:false})
|
|
84
|
+
document.addEventListener('mouseup',this.doc_up,{passive:false})
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
</script>
|
|
89
|
+
<style>
|
|
90
|
+
.gante-split-liu{
|
|
91
|
+
width: 3px;
|
|
92
|
+
background: #ccc;
|
|
93
|
+
height: 100%;
|
|
94
|
+
position: absolute;
|
|
95
|
+
top: 0;
|
|
96
|
+
cursor: e-resize;
|
|
97
|
+
z-index:2;
|
|
98
|
+
transition: background .1s ease;
|
|
99
|
+
}
|
|
100
|
+
.gante-split-liu:hover{
|
|
101
|
+
background:#666 ;
|
|
102
|
+
}
|
|
103
|
+
.gante-split-column{
|
|
104
|
+
position: absolute;
|
|
105
|
+
top:50%;
|
|
106
|
+
width: 100%;
|
|
107
|
+
height:50px;
|
|
108
|
+
margin-top: -25px;
|
|
109
|
+
left: 0;
|
|
110
|
+
}
|
|
111
|
+
.gante-split-column div{
|
|
112
|
+
width: 3px;
|
|
113
|
+
height: 3px;
|
|
114
|
+
border-radius: 50%;
|
|
115
|
+
background: #fff;
|
|
116
|
+
margin: 3px auto;
|
|
117
|
+
}
|
|
118
|
+
.gante-split-liu-resize{
|
|
119
|
+
position: absolute;
|
|
120
|
+
top:0;
|
|
121
|
+
width: 3px;
|
|
122
|
+
background: #ccc;
|
|
123
|
+
height: 100%;
|
|
124
|
+
}
|
|
125
|
+
</style>
|