zydx-plus 1.0.8 → 1.0.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/package.json +1 -4
- package/src/components/calendar/src/Calendar.css +82 -8
- package/src/components/calendar/src/Calendar.vue +99 -54
- package/src/components/coloring/index.js +6 -0
- package/src/components/coloring/src/coloring.vue +212 -0
- package/src/components/coloring/src/data.js +103 -0
- package/src/components/menuTree/index.js +7 -0
- package/src/components/menuTree/src/ZydxMenuTree.vue +135 -0
- package/src/components/menuTree/src/ZydxMenuTreeInfo.vue +169 -0
- package/src/components/menuTree/src/iconfont.ttf +0 -0
- package/src/components/tree/index.js +6 -0
- package/src/components/tree/src/tree.vue +219 -0
- package/src/index.js +12 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zydx-plus",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "Vue.js",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -88,9 +88,6 @@
|
|
|
88
88
|
"uglifyjs-webpack-plugin": "^2.1.1",
|
|
89
89
|
"uppercamelcase": "^1.1.0",
|
|
90
90
|
"url-loader": "^1.0.1",
|
|
91
|
-
"vue": "2.5.21",
|
|
92
|
-
"vue-loader": "^15.7.0",
|
|
93
|
-
"vue-router": "^3.0.1",
|
|
94
91
|
"vue-template-compiler": "2.5.21",
|
|
95
92
|
"vue-template-es2015-compiler": "^1.6.0",
|
|
96
93
|
"webpack": "^4.14.0",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
li{list-style-type:none;}
|
|
1
2
|
.cale{
|
|
2
3
|
position: absolute;
|
|
3
4
|
top: 22px;
|
|
4
5
|
right: 0;
|
|
5
6
|
width: 300px;
|
|
6
|
-
height: 330px;
|
|
7
7
|
z-index: 100;
|
|
8
8
|
background-color: #fff;
|
|
9
9
|
box-shadow: 0 0 4px 1px #ccc;
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
}
|
|
15
15
|
.cale-cont{
|
|
16
16
|
width: 100%;
|
|
17
|
-
height: 300px;
|
|
18
17
|
background-color: #fff;
|
|
19
18
|
border-radius: 10px;
|
|
20
19
|
}
|
|
@@ -229,11 +228,6 @@
|
|
|
229
228
|
.calendar-out-of-Date .calendar-date{
|
|
230
229
|
color: gray;
|
|
231
230
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
231
|
/* 以下为实现0.5px底部边界 */
|
|
238
232
|
.under_line{position: relative;}
|
|
239
233
|
.under_line:before,
|
|
@@ -245,9 +239,89 @@
|
|
|
245
239
|
/* 以上为实现0.5px底部边界 */
|
|
246
240
|
.cle-but-cont{
|
|
247
241
|
margin-top: 5px;
|
|
248
|
-
padding: 5px 0
|
|
242
|
+
padding: 5px 0;
|
|
249
243
|
text-align: right;
|
|
250
244
|
border-top: 1px solid #ccc;
|
|
245
|
+
display: flex;
|
|
246
|
+
}
|
|
247
|
+
.cle-but-left{
|
|
248
|
+
flex: 8;
|
|
249
|
+
text-align: left;
|
|
250
|
+
}
|
|
251
|
+
.cle-but-right{
|
|
252
|
+
flex: 2;
|
|
253
|
+
}
|
|
254
|
+
.cle-time{
|
|
255
|
+
display: inline-block;
|
|
256
|
+
position: relative;
|
|
257
|
+
}
|
|
258
|
+
.cle-time input{
|
|
259
|
+
width: 130px;
|
|
260
|
+
border: 1px solid #ccc;
|
|
261
|
+
border-radius: 5px;
|
|
262
|
+
height: 22px;
|
|
263
|
+
padding-left: 10px;
|
|
264
|
+
box-sizing: border-box;
|
|
265
|
+
}
|
|
266
|
+
.cle-time-list{
|
|
267
|
+
position: absolute;
|
|
268
|
+
top: 22px;
|
|
269
|
+
left: 0;
|
|
270
|
+
width: 130px;
|
|
271
|
+
height: 180px;
|
|
272
|
+
background-color: #fff;
|
|
273
|
+
box-shadow: 0 0 12px rgba(0, 0, 0, .12);
|
|
274
|
+
display: flex;
|
|
275
|
+
}
|
|
276
|
+
.cle-time-y{
|
|
277
|
+
flex: 1;
|
|
278
|
+
text-align: center;
|
|
279
|
+
font-size: 12px;
|
|
280
|
+
position: relative;
|
|
281
|
+
overflow: hidden;
|
|
282
|
+
}
|
|
283
|
+
.cle-time-li{
|
|
284
|
+
position: absolute !important;
|
|
285
|
+
top: 0;
|
|
286
|
+
left: 0;
|
|
287
|
+
right: 0;
|
|
288
|
+
z-index: 1;
|
|
289
|
+
transition-duration: 100ms;
|
|
290
|
+
}
|
|
291
|
+
.cle-time-li>p{
|
|
292
|
+
padding: 5px 0;
|
|
293
|
+
height: 26px;
|
|
294
|
+
box-sizing: border-box;
|
|
295
|
+
color: #999;
|
|
296
|
+
}
|
|
297
|
+
.cle-time-act{
|
|
298
|
+
color: #000 !important;
|
|
299
|
+
font-weight: 600;
|
|
300
|
+
}
|
|
301
|
+
.cle-time-y ul{
|
|
302
|
+
height: 100%;
|
|
303
|
+
overflow-y: scroll;
|
|
304
|
+
scrollbar-width: none;
|
|
305
|
+
position: relative;
|
|
306
|
+
z-index: 2;
|
|
307
|
+
}
|
|
308
|
+
ul::-webkit-scrollbar {width: 0}
|
|
309
|
+
.cle-frame{
|
|
310
|
+
height: 26px;
|
|
311
|
+
box-sizing: border-box;
|
|
312
|
+
border-top: 1px solid #ccc;
|
|
313
|
+
border-bottom: 1px solid #ccc;
|
|
314
|
+
position: absolute;
|
|
315
|
+
top: 78px;
|
|
316
|
+
left: 0;
|
|
317
|
+
z-index: 1;
|
|
318
|
+
width: calc(100% - 20px);
|
|
319
|
+
margin: 0 10px;
|
|
320
|
+
}
|
|
321
|
+
.cle-time-y li{
|
|
322
|
+
padding: 5px 0;
|
|
323
|
+
height: 26px;
|
|
324
|
+
box-sizing: border-box;
|
|
251
325
|
}
|
|
252
326
|
.cle-but{
|
|
253
327
|
margin-left: 5px;
|
|
@@ -51,7 +51,35 @@
|
|
|
51
51
|
<div class="ClearBoth"></div>
|
|
52
52
|
</div>
|
|
53
53
|
<div class="cle-but-cont">
|
|
54
|
-
<
|
|
54
|
+
<div class="cle-but-left" v-if="showDate">
|
|
55
|
+
<div class="cle-time">
|
|
56
|
+
<form>
|
|
57
|
+
<input type="text" autocomplete="new-pwd" v-model="cleDate" @focus="cleFocus" @blur="cleBlur" />
|
|
58
|
+
</form>
|
|
59
|
+
<div class="cle-time-list" v-if="cleFocusShow">
|
|
60
|
+
<div class="cle-frame"></div>
|
|
61
|
+
<div class="cle-time-y">
|
|
62
|
+
<ul @scroll="scrollHour($event)">
|
|
63
|
+
<li v-for="(item,index) in 30"></li>
|
|
64
|
+
</ul>
|
|
65
|
+
<div class="cle-time-li" :style="{transform: 'translateY('+ transHour +'px)'}">
|
|
66
|
+
<p v-for="(item,index) in 30" :class="{'cle-time-act': index === -(transHour/26)+3}">{{ (index > 2 && index < 27)? ((index - 3) < 10)? '0'+(index - 3): (index - 3) : '' }}</p>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
<div class="cle-time-y">
|
|
70
|
+
<ul @scroll="scrollMinute($event)">
|
|
71
|
+
<li v-for="(item,index) in 66"></li>
|
|
72
|
+
</ul>
|
|
73
|
+
<div class="cle-time-li" :style="{transform: 'translateY('+ transMinute +'px)'}">
|
|
74
|
+
<p v-for="(item,index) in 66" :class="{'cle-time-act': index === -(transMinute/26)+3}">{{ (index > 2 && index < 63)? ((index - 3) < 10)? '0'+(index - 3): (index - 3) : '' }}</p>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
<div class="cle-but-right">
|
|
81
|
+
<button class="cle-but" @click="confirm">确认</button>
|
|
82
|
+
</div>
|
|
55
83
|
</div>
|
|
56
84
|
</div>
|
|
57
85
|
</div>
|
|
@@ -115,6 +143,13 @@
|
|
|
115
143
|
type: Boolean,
|
|
116
144
|
default: true
|
|
117
145
|
},
|
|
146
|
+
/**
|
|
147
|
+
* @description 是否显示时间
|
|
148
|
+
*/
|
|
149
|
+
showDate: {
|
|
150
|
+
type: Boolean,
|
|
151
|
+
default: false
|
|
152
|
+
},
|
|
118
153
|
/**
|
|
119
154
|
* @description 设置标记范围
|
|
120
155
|
*/
|
|
@@ -178,67 +213,77 @@
|
|
|
178
213
|
tileMonth: '',
|
|
179
214
|
monthY: '',
|
|
180
215
|
dayChange: '',
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
{
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
id: '06',
|
|
203
|
-
name: 'June'
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
id: '07',
|
|
207
|
-
name: 'July'
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
id: '08',
|
|
211
|
-
name: 'August'
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
id: '09',
|
|
215
|
-
name: 'September'
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
id: '10',
|
|
219
|
-
name: 'October'
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
id: '11',
|
|
223
|
-
name: 'November'
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
id: '12',
|
|
227
|
-
name: 'December'
|
|
228
|
-
},
|
|
216
|
+
cleDate: '00:00',
|
|
217
|
+
hour: '00',
|
|
218
|
+
minute: '00',
|
|
219
|
+
transHour: 0,
|
|
220
|
+
transMinute: 0,
|
|
221
|
+
cleFocusShow: false,
|
|
222
|
+
monthList: [
|
|
223
|
+
{id: '01', name: 'January'},
|
|
224
|
+
{id: '02', name: 'February'},
|
|
225
|
+
{id: '03', name: 'March'},
|
|
226
|
+
{id: '04', name: 'April'},
|
|
227
|
+
{id: '05', name: 'May'},
|
|
228
|
+
{id: '06', name: 'June'},
|
|
229
|
+
{id: '07', name: 'July'},
|
|
230
|
+
{id: '08', name: 'August'},
|
|
231
|
+
{id: '09', name: 'September'},
|
|
232
|
+
{id: '10', name: 'October'},
|
|
233
|
+
{id: '11', name: 'November'},
|
|
234
|
+
{id: '12', name: 'December'},
|
|
229
235
|
]
|
|
230
236
|
};
|
|
231
237
|
},
|
|
232
238
|
methods: {
|
|
239
|
+
cleBlur() {
|
|
240
|
+
this.cleFocusShow = false
|
|
241
|
+
},
|
|
242
|
+
//获取焦点选择时间
|
|
243
|
+
cleFocus() {
|
|
244
|
+
this.cleFocusShow = true
|
|
245
|
+
},
|
|
246
|
+
scrollMinute(e) {
|
|
247
|
+
let top = e.target.scrollTop
|
|
248
|
+
let index = Math.floor(top/26)
|
|
249
|
+
this.transMinute = -(index * 26)
|
|
250
|
+
this.minute = (index < 10)? '0'+ index: index
|
|
251
|
+
this.cleDate = `${this.hour}:${this.minute}`
|
|
252
|
+
},
|
|
253
|
+
scrollHour(e) {
|
|
254
|
+
let top = e.target.scrollTop
|
|
255
|
+
let index = Math.floor(top/26)
|
|
256
|
+
this.transHour = -(index * 26)
|
|
257
|
+
this.hour = (index < 10)? '0'+ index: index
|
|
258
|
+
this.cleDate = `${this.hour}:${this.minute}`
|
|
259
|
+
},
|
|
260
|
+
//确认按钮
|
|
233
261
|
confirm() {
|
|
234
262
|
let that = this
|
|
235
263
|
if(that.rangeMode) {
|
|
236
|
-
that
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
264
|
+
if(that.showDate) {
|
|
265
|
+
that.$emit('confirm', {
|
|
266
|
+
start: that.rangeStart_,
|
|
267
|
+
end: that.rangeEnd_,
|
|
268
|
+
date: that.cleDate
|
|
269
|
+
});
|
|
270
|
+
}else {
|
|
271
|
+
that.$emit('confirm', {
|
|
272
|
+
start: that.rangeStart_,
|
|
273
|
+
end: that.rangeEnd_
|
|
274
|
+
});
|
|
275
|
+
}
|
|
240
276
|
}else {
|
|
241
|
-
|
|
277
|
+
if(that.showDate) {
|
|
278
|
+
that.$emit('confirm', {
|
|
279
|
+
start: that.dayChange.time,
|
|
280
|
+
date: that.cleDate
|
|
281
|
+
});
|
|
282
|
+
}else {
|
|
283
|
+
that.$emit('confirm', {
|
|
284
|
+
start: that.dayChange.time
|
|
285
|
+
});
|
|
286
|
+
}
|
|
242
287
|
}
|
|
243
288
|
},
|
|
244
289
|
render(setTimeStr) { //初始化
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="color-pop">
|
|
3
|
+
<div class="color-cont" :style="{background: backColor}">
|
|
4
|
+
<div class="color-cont-l" ref="color">
|
|
5
|
+
<div class="color-mask"
|
|
6
|
+
@mousedown="drawBegin($event)"
|
|
7
|
+
@mousemove="drawMove($event)"
|
|
8
|
+
@mouseup="drawEnd($event)">
|
|
9
|
+
</div>
|
|
10
|
+
<div class="color-pointer"
|
|
11
|
+
@mousedown="drawBegin($event)"
|
|
12
|
+
@mousemove="drawMove($event)"
|
|
13
|
+
@mouseup="drawEnd($event)"
|
|
14
|
+
:style="{transform: 'translate('+ colorX +'px,'+ colorY +'px)'}">
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
<div class="control-box-item">
|
|
19
|
+
<div class="controller" ref="circle">
|
|
20
|
+
<div class="hue"
|
|
21
|
+
@mousedown="circleBegin($event)"
|
|
22
|
+
@mousemove="circleMove($event)"
|
|
23
|
+
@mouseup="circleEnd($event)">
|
|
24
|
+
</div>
|
|
25
|
+
<div class="circle"
|
|
26
|
+
@mousedown="circleBegin($event)"
|
|
27
|
+
@mousemove="circleMove($event)"
|
|
28
|
+
@mouseup="circleEnd($event)"
|
|
29
|
+
:style="{transform: 'translateX('+ circleX +'px)'}">
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script>
|
|
37
|
+
import {hsv2rgb,rgb2hsv,rgbToHsb} from './data.js'
|
|
38
|
+
export default {
|
|
39
|
+
name: 'zydx-coloring',
|
|
40
|
+
data() {
|
|
41
|
+
return {
|
|
42
|
+
backColor: 'rgb(103, 194, 58)',
|
|
43
|
+
isCDown: false,
|
|
44
|
+
circleCDown: false,
|
|
45
|
+
colorX: 0,
|
|
46
|
+
colorY: 0,
|
|
47
|
+
x: 0,
|
|
48
|
+
y: 0,
|
|
49
|
+
cx: 0,
|
|
50
|
+
circleX: 0,
|
|
51
|
+
Rgb:{r:255,g:255,b:255},
|
|
52
|
+
opacity: 1,
|
|
53
|
+
s: 0,
|
|
54
|
+
l: 0
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
props: {
|
|
58
|
+
color: Object,
|
|
59
|
+
},
|
|
60
|
+
created() {
|
|
61
|
+
this.$nextTick(() => {
|
|
62
|
+
if(this.color === undefined) return
|
|
63
|
+
this.alternativeColor(this.color)
|
|
64
|
+
})
|
|
65
|
+
},
|
|
66
|
+
methods: {
|
|
67
|
+
alternativeColor(data) {
|
|
68
|
+
let a = this.$refs.color.getBoundingClientRect().width
|
|
69
|
+
let b = this.$refs.color.getBoundingClientRect().height
|
|
70
|
+
let c = this.$refs.circle.getBoundingClientRect().width
|
|
71
|
+
let hsv = rgb2hsv(data.r,data.g, data.b)
|
|
72
|
+
let hsb = rgbToHsb(data)
|
|
73
|
+
let l = hsv.h / 360 * c
|
|
74
|
+
let f = parseInt(hsb.s * a / 100)
|
|
75
|
+
let t = parseInt((100 - hsb.b) * b / 100)
|
|
76
|
+
this.mask(f,t)
|
|
77
|
+
this.circleMask(l)
|
|
78
|
+
},
|
|
79
|
+
drawBegin(event) {
|
|
80
|
+
this.isCDown = true
|
|
81
|
+
this.x = this.$refs.color.getBoundingClientRect().x
|
|
82
|
+
this.y = this.$refs.color.getBoundingClientRect().y
|
|
83
|
+
let x = event.clientX - this.x
|
|
84
|
+
let y = event.clientY - this.y
|
|
85
|
+
this.mask(x,y)
|
|
86
|
+
},
|
|
87
|
+
drawMove(event) {
|
|
88
|
+
if(this.isCDown) {
|
|
89
|
+
let x = event.clientX - this.x
|
|
90
|
+
let y = event.clientY - this.y
|
|
91
|
+
this.mask(x,y)
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
drawEnd(event) {
|
|
95
|
+
this.isCDown = false
|
|
96
|
+
},
|
|
97
|
+
mask (x,y) {
|
|
98
|
+
let w = this.$refs.color.getBoundingClientRect().width
|
|
99
|
+
let h = this.$refs.color.getBoundingClientRect().height
|
|
100
|
+
this.colorX = x
|
|
101
|
+
this.colorY = y
|
|
102
|
+
if(x <= 0) this.colorX = 0
|
|
103
|
+
if(x >= w) this.colorX = w
|
|
104
|
+
if(y <= 0) this.colorY = 0
|
|
105
|
+
if(y >= h) this.colorY = h
|
|
106
|
+
this.s = x / w
|
|
107
|
+
this.l = (h - y) / h
|
|
108
|
+
this.rgbaColor()
|
|
109
|
+
},
|
|
110
|
+
rgbaColor() {
|
|
111
|
+
let hsv = rgb2hsv(this.Rgb.r,this.Rgb.g,this.Rgb.b)
|
|
112
|
+
let hsvRgb = hsv2rgb(hsv.h,this.s,this.l)
|
|
113
|
+
this.maskRgb = {r: hsvRgb.r,g: hsvRgb.g,b: hsvRgb.b,a: this.opacity}
|
|
114
|
+
this.$emit('rgba', this.maskRgb)
|
|
115
|
+
},
|
|
116
|
+
circleBegin(event) {
|
|
117
|
+
this.circleCDown = true
|
|
118
|
+
this.cx = this.$refs.circle.getBoundingClientRect().x
|
|
119
|
+
let x = event.clientX - this.cx
|
|
120
|
+
this.circleMask(x)
|
|
121
|
+
},
|
|
122
|
+
circleMove(event) {
|
|
123
|
+
if(this.circleCDown) {
|
|
124
|
+
let x = event.clientX - this.cx
|
|
125
|
+
this.circleMask(x)
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
circleEnd(event) {
|
|
129
|
+
this.circleCDown = false
|
|
130
|
+
},
|
|
131
|
+
circleMask(x) {
|
|
132
|
+
let w = this.$refs.circle.getBoundingClientRect().width
|
|
133
|
+
this.circleX = x
|
|
134
|
+
if(x <= 0) this.circleX = 0
|
|
135
|
+
if(x >= w) this.circleX = w
|
|
136
|
+
let Hval = (x + 5) / (w)*360;
|
|
137
|
+
this.Rgb = hsv2rgb(Hval, 1, 1)
|
|
138
|
+
this.backColor = 'rgb('+ this.Rgb.r +','+ this.Rgb.g +','+ this.Rgb.b +')'
|
|
139
|
+
this.rgbaColor()
|
|
140
|
+
},
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
</script>
|
|
144
|
+
|
|
145
|
+
<style>
|
|
146
|
+
.color-pop{
|
|
147
|
+
position: absolute;
|
|
148
|
+
top: 0;
|
|
149
|
+
left: 0;
|
|
150
|
+
z-index: 100;
|
|
151
|
+
background-color: #fff;
|
|
152
|
+
border-radius: 5px;
|
|
153
|
+
box-shadow: 0 0 3px #ccc;
|
|
154
|
+
padding: 10px;
|
|
155
|
+
user-select: none;
|
|
156
|
+
}
|
|
157
|
+
.color-cont{
|
|
158
|
+
width: 200px;
|
|
159
|
+
height: 200px;
|
|
160
|
+
}
|
|
161
|
+
.color-cont-l{
|
|
162
|
+
position: relative;
|
|
163
|
+
width: 100%;
|
|
164
|
+
height: 100%;
|
|
165
|
+
background: linear-gradient(90deg,#fff,hsla(0,0%,100%,0));
|
|
166
|
+
}
|
|
167
|
+
.color-mask{
|
|
168
|
+
width: 100%;
|
|
169
|
+
height: 100%;
|
|
170
|
+
background: linear-gradient(0deg,#000,transparent);
|
|
171
|
+
}
|
|
172
|
+
.color-pointer{
|
|
173
|
+
position: absolute;
|
|
174
|
+
top: -7px;
|
|
175
|
+
left: -7px;
|
|
176
|
+
z-index: 2;
|
|
177
|
+
width: 15px;
|
|
178
|
+
height: 15px;
|
|
179
|
+
border: 2px #fff solid;
|
|
180
|
+
border-radius: 50%;
|
|
181
|
+
}
|
|
182
|
+
.control-box-item{
|
|
183
|
+
width: 100%;
|
|
184
|
+
height: 15px;
|
|
185
|
+
margin-top: 10px;
|
|
186
|
+
}
|
|
187
|
+
.controller{
|
|
188
|
+
position: relative;
|
|
189
|
+
width: 100%;
|
|
190
|
+
height: 100%;
|
|
191
|
+
background-color: #fff;
|
|
192
|
+
background-image: linear-gradient(45deg,#eee 25%,transparent 0,transparent 75%,#eee 0,#eee),linear-gradient(45deg,#eee 25%,transparent 0,transparent 75%,#eee 0,#eee);
|
|
193
|
+
background-size: 32px 32px;
|
|
194
|
+
background-position: 0 0,16px 16px;
|
|
195
|
+
}
|
|
196
|
+
.hue{
|
|
197
|
+
width: 100%;
|
|
198
|
+
height: 100%;
|
|
199
|
+
background: linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);
|
|
200
|
+
}
|
|
201
|
+
.circle{
|
|
202
|
+
position: absolute;
|
|
203
|
+
top: -2px;
|
|
204
|
+
width: 20px;
|
|
205
|
+
height: 20px;
|
|
206
|
+
left: -10px;
|
|
207
|
+
box-sizing: border-box;
|
|
208
|
+
border-radius: 50%;
|
|
209
|
+
background: #fff;
|
|
210
|
+
box-shadow: 0 0 2px 1px rgba(0,0,0,0.1);
|
|
211
|
+
}
|
|
212
|
+
</style>
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
function hsv2rgb(h, s, v) {
|
|
2
|
+
h = boundValue(h, 360)
|
|
3
|
+
s = boundValue(s * 100, 100)
|
|
4
|
+
v = boundValue(v * 100, 100)
|
|
5
|
+
|
|
6
|
+
var i = ~~(h*6)
|
|
7
|
+
var f = h * 6 - i
|
|
8
|
+
var p = v * (1 - s)
|
|
9
|
+
var q = v * (1 - f * s)
|
|
10
|
+
var t = v * (1 - (1 - f) * s)
|
|
11
|
+
var r = 0,g = 0,b = 0;
|
|
12
|
+
switch(i % 6){
|
|
13
|
+
case 0: r = v; g = t; b = p; break;
|
|
14
|
+
case 1: r = q; g = v; b = p; break;
|
|
15
|
+
case 2: r = p; g = v; b = t; break;
|
|
16
|
+
case 3: r = p; g = q; b = v; break;
|
|
17
|
+
case 4: r = t; g = p; b = v; break;
|
|
18
|
+
case 5: r = v, g = p, b = q; break;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
var round = (value) => Math.round(value * 255)
|
|
22
|
+
return {
|
|
23
|
+
r: round(r),
|
|
24
|
+
g: round(g),
|
|
25
|
+
b: round(b)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function boundValue(value, max) {
|
|
29
|
+
value = Math.min(max, Math.max(0, value))
|
|
30
|
+
if ((Math.abs(value - max) < 0.000001)) {
|
|
31
|
+
return 1
|
|
32
|
+
}
|
|
33
|
+
return (value % max) / (~~max)
|
|
34
|
+
}
|
|
35
|
+
function rgb2hsv(r, g, b) {
|
|
36
|
+
r = boundValue(r, 255)
|
|
37
|
+
g = boundValue(g, 255)
|
|
38
|
+
b = boundValue(b, 255)
|
|
39
|
+
var max = Math.max(r, g, b)
|
|
40
|
+
var min = Math.min(r, g, b)
|
|
41
|
+
var h, s
|
|
42
|
+
var v = max
|
|
43
|
+
|
|
44
|
+
var d = max - min
|
|
45
|
+
s = max === 0 ? 0 : d / max
|
|
46
|
+
|
|
47
|
+
if (max === min) {
|
|
48
|
+
h = 0
|
|
49
|
+
} else {
|
|
50
|
+
switch (max) {
|
|
51
|
+
case r:
|
|
52
|
+
h = (g - b) / d + (g < b ? 6 : 0)
|
|
53
|
+
break
|
|
54
|
+
case g:
|
|
55
|
+
h = (b - r) / d + 2
|
|
56
|
+
break
|
|
57
|
+
case b:
|
|
58
|
+
h = (r - g) / d + 4
|
|
59
|
+
break
|
|
60
|
+
}
|
|
61
|
+
h /= 6
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
h: h * 360,
|
|
66
|
+
s: s,
|
|
67
|
+
v: v
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function rgbToHsb(rgb) {
|
|
71
|
+
let hsb = {
|
|
72
|
+
h: 0,
|
|
73
|
+
s: 0,
|
|
74
|
+
b: 0
|
|
75
|
+
};
|
|
76
|
+
let min = Math.min(rgb.r, rgb.g, rgb.b);
|
|
77
|
+
let max = Math.max(rgb.r, rgb.g, rgb.b);
|
|
78
|
+
let delta = max - min;
|
|
79
|
+
hsb.b = max;
|
|
80
|
+
hsb.s = max != 0 ? 255 * delta / max : 0;
|
|
81
|
+
if (hsb.s != 0) {
|
|
82
|
+
if (rgb.r == max) hsb.h = (rgb.g - rgb.b) / delta;
|
|
83
|
+
else if (rgb.g == max) hsb.h = 2 + (rgb.b - rgb.r) / delta;
|
|
84
|
+
else hsb.h = 4 + (rgb.r - rgb.g) / delta;
|
|
85
|
+
} else hsb.h = -1;
|
|
86
|
+
hsb.h *= 60;
|
|
87
|
+
if (hsb.h < 0) hsb.h = 0;
|
|
88
|
+
hsb.s *= 100 / 255;
|
|
89
|
+
hsb.b *= 100 / 255;
|
|
90
|
+
return hsb;
|
|
91
|
+
}
|
|
92
|
+
function rgb2Hex(r, g, b) {
|
|
93
|
+
var o = (r << 16 | g << 8 | b).toString(16)
|
|
94
|
+
return o.length < 6 ? ("#".concat("0".repeat(6 - o.length)).concat(o)):"#".concat(o);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
module.exports = {
|
|
99
|
+
hsv2rgb,
|
|
100
|
+
rgb2hsv,
|
|
101
|
+
rgbToHsb,
|
|
102
|
+
rgb2Hex
|
|
103
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="menuTree">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
<div v-for="(item, index) in targetTree" :key="index">
|
|
5
|
+
<zydx-menu-tree-info
|
|
6
|
+
:nodeSet="nodeSet"
|
|
7
|
+
:isShowLine="isShowLine"
|
|
8
|
+
:isShowUpDown="isShowUpDown"
|
|
9
|
+
:menu-info="item"
|
|
10
|
+
:selectItem="selectItem"
|
|
11
|
+
@clickItem="clickItem"
|
|
12
|
+
></zydx-menu-tree-info>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
import zydxMenuTreeInfo from "./ZydxMenuTreeInfo";
|
|
19
|
+
export default {
|
|
20
|
+
name: "zydx-menu-tree",
|
|
21
|
+
components: {
|
|
22
|
+
zydxMenuTreeInfo,
|
|
23
|
+
},
|
|
24
|
+
props: {
|
|
25
|
+
// 是否显示展开收起动作
|
|
26
|
+
isShowUpDown: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false,
|
|
29
|
+
},
|
|
30
|
+
// 是否显示底线
|
|
31
|
+
isShowLine: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: false,
|
|
34
|
+
},
|
|
35
|
+
// 节点设置
|
|
36
|
+
nodeSet: {
|
|
37
|
+
type: Number,
|
|
38
|
+
default: 2,
|
|
39
|
+
},
|
|
40
|
+
// 选择当前的节点
|
|
41
|
+
selectItem: {
|
|
42
|
+
type: Object,
|
|
43
|
+
default: function () {
|
|
44
|
+
return {};
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
// 树数据
|
|
48
|
+
treeData: {
|
|
49
|
+
type: Array,
|
|
50
|
+
required: true,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
computed: {
|
|
54
|
+
targetTree: function () {
|
|
55
|
+
let that = this;
|
|
56
|
+
let targetTree = [];
|
|
57
|
+
let minLevel = "";
|
|
58
|
+
that.treeData.map(function (item) {
|
|
59
|
+
if (that.isShowUpDown) {
|
|
60
|
+
// 如果设置收起展开, 添加控制变量
|
|
61
|
+
Reflect.set(item, "isShowUpDown", false);
|
|
62
|
+
} else {
|
|
63
|
+
Reflect.set(item, "isShowUpDown", true);
|
|
64
|
+
}
|
|
65
|
+
if (minLevel === "") {
|
|
66
|
+
minLevel = item.level;
|
|
67
|
+
} else {
|
|
68
|
+
if (item.level < minLevel) {
|
|
69
|
+
minLevel = item.level;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
this.treeData.map(function (item) {
|
|
74
|
+
if (item.level === minLevel) {
|
|
75
|
+
targetTree.push(item);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
targetTree.map(function (item) {
|
|
79
|
+
that.forArr(that.treeData, item);
|
|
80
|
+
});
|
|
81
|
+
if (that.isShowUpDown) {
|
|
82
|
+
for (let i = 0; i < targetTree.length; i++) {
|
|
83
|
+
this.setIsShowUpDown(targetTree[i], i);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return targetTree;
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
methods: {
|
|
90
|
+
// 原始目录树转换方法
|
|
91
|
+
forArr: function (arr, obj) {
|
|
92
|
+
let that = this;
|
|
93
|
+
let newArr = [];
|
|
94
|
+
arr.map(function (item) {
|
|
95
|
+
if (item.pcatalogId === obj.catalogId) {
|
|
96
|
+
newArr.push(item);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
if (newArr.length === 0) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
obj.children = newArr;
|
|
103
|
+
newArr.map(function (item) {
|
|
104
|
+
that.forArr(arr, item);
|
|
105
|
+
});
|
|
106
|
+
},
|
|
107
|
+
// 点击回调事件
|
|
108
|
+
clickItem(item) {
|
|
109
|
+
this.$emit("clickItem", item);
|
|
110
|
+
},
|
|
111
|
+
// 递归调用修改状态
|
|
112
|
+
setIsShowUpDown(item, index) {
|
|
113
|
+
if (index === 0) {
|
|
114
|
+
let children = item.children;
|
|
115
|
+
if (children && children.length !== 0) {
|
|
116
|
+
Reflect.set(item, "isShowUpDown", true);
|
|
117
|
+
for (let i = 0; i < children.length; i++) {
|
|
118
|
+
this.setIsShowUpDown(children[i], i);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
</script>
|
|
126
|
+
|
|
127
|
+
<style scoped>
|
|
128
|
+
.menuTree {
|
|
129
|
+
overflow: hidden;
|
|
130
|
+
white-space: nowrap;
|
|
131
|
+
text-overflow: ellipsis;
|
|
132
|
+
padding: 0px 10px;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
</style>
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @开发者: zmy
|
|
3
|
+
* @描述: 目录树通用组件
|
|
4
|
+
* @创建时间: 2022-08-16 11:00:00
|
|
5
|
+
* @内容:
|
|
6
|
+
必传值:名字/类型/默认值/作用
|
|
7
|
+
menuInfo 目录树数据
|
|
8
|
+
非必传值:
|
|
9
|
+
nodeSet 传入当前的节点设置, 小于当前节点设置不可点,灰色
|
|
10
|
+
selectItem 传入当前选择的节点,是一个对象
|
|
11
|
+
* @回调事件:
|
|
12
|
+
* clickItem 点击点前节点的回调, 返回点击的节点
|
|
13
|
+
@组件内方法:
|
|
14
|
+
*/
|
|
15
|
+
<template>
|
|
16
|
+
<div>
|
|
17
|
+
<div
|
|
18
|
+
class="lineHeight30"
|
|
19
|
+
:class="menuInfo.level === 0 ? '' : 'marginLeft14'"
|
|
20
|
+
>
|
|
21
|
+
<div
|
|
22
|
+
:class=" this.isShowLine ? 'dashed' : 'no_dashed'"
|
|
23
|
+
>
|
|
24
|
+
<div
|
|
25
|
+
class="widthB100 ellipse cursor"
|
|
26
|
+
:class="menuTitleStyle"
|
|
27
|
+
@click.stop="clickItem(menuInfo)"
|
|
28
|
+
>
|
|
29
|
+
{{ menuInfo.title }}
|
|
30
|
+
</div>
|
|
31
|
+
<div v-show="isShowUpDown && menuInfo.children">
|
|
32
|
+
<span
|
|
33
|
+
class="iconfont"
|
|
34
|
+
v-html="defaultFont"
|
|
35
|
+
@click="clickFont(menuInfo)"
|
|
36
|
+
></span>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
<div v-show="menuInfo.isShowUpDown">
|
|
40
|
+
<div v-for="(item, index) in menuInfo.children" :key="index">
|
|
41
|
+
<zydx-menu-tree-info
|
|
42
|
+
:isShowUpDown="isShowUpDown"
|
|
43
|
+
:isShowLine="isShowLine"
|
|
44
|
+
:selectItem="selectItem"
|
|
45
|
+
:menu-info="item"
|
|
46
|
+
:nodeSet="nodeSet"
|
|
47
|
+
@clickItem="clickItem"
|
|
48
|
+
>
|
|
49
|
+
</zydx-menu-tree-info>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
<script>
|
|
57
|
+
import zydxMenuTreeInfo from "./ZydxMenuTreeInfo";
|
|
58
|
+
export default {
|
|
59
|
+
name: "zydx-menu-tree-info",
|
|
60
|
+
components: {
|
|
61
|
+
zydxMenuTreeInfo,
|
|
62
|
+
},
|
|
63
|
+
props: {
|
|
64
|
+
// 是否显示展开收起动作
|
|
65
|
+
isShowUpDown: {
|
|
66
|
+
type: Boolean,
|
|
67
|
+
default: false,
|
|
68
|
+
},
|
|
69
|
+
// 是否显示底线
|
|
70
|
+
isShowLine: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: false,
|
|
73
|
+
},
|
|
74
|
+
// 节点等级设置
|
|
75
|
+
nodeSet: {
|
|
76
|
+
type: Number,
|
|
77
|
+
required: true,
|
|
78
|
+
},
|
|
79
|
+
// 选择当前的节点
|
|
80
|
+
selectItem: {
|
|
81
|
+
type: Object,
|
|
82
|
+
default: function () {
|
|
83
|
+
return {};
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
// 树数据
|
|
87
|
+
menuInfo: {
|
|
88
|
+
type: Object,
|
|
89
|
+
required: true,
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
computed: {
|
|
93
|
+
defaultFont() {
|
|
94
|
+
if (this.menuInfo.isShowUpDown) {
|
|
95
|
+
return "";
|
|
96
|
+
}
|
|
97
|
+
return "";
|
|
98
|
+
},
|
|
99
|
+
menuTitleStyle() {
|
|
100
|
+
let ar = [];
|
|
101
|
+
if (parseInt(this.menuInfo.level) > parseInt(this.nodeSet)) {
|
|
102
|
+
ar.push("disable");
|
|
103
|
+
}
|
|
104
|
+
if (this.selectItem === this.menuInfo) {
|
|
105
|
+
ar.push("active");
|
|
106
|
+
}
|
|
107
|
+
return ar;
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
methods: {
|
|
111
|
+
clickItem(item) {
|
|
112
|
+
this.$emit("clickItem", item);
|
|
113
|
+
},
|
|
114
|
+
clickFont(item) {
|
|
115
|
+
item.isShowUpDown = !item.isShowUpDown;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
</script>
|
|
120
|
+
|
|
121
|
+
<style scoped>
|
|
122
|
+
@font-face {
|
|
123
|
+
font-family: "iconfont";
|
|
124
|
+
src: url("./iconfont.ttf?t=1660878683989") format("truetype");
|
|
125
|
+
}
|
|
126
|
+
.iconfont {
|
|
127
|
+
font-family: "iconfont" !important;
|
|
128
|
+
font-size: 16px;
|
|
129
|
+
font-style: normal;
|
|
130
|
+
-webkit-font-smoothing: antialiased;
|
|
131
|
+
-moz-osx-font-smoothing: grayscale;
|
|
132
|
+
cursor: pointer;
|
|
133
|
+
}
|
|
134
|
+
.cursor {
|
|
135
|
+
cursor: pointer;
|
|
136
|
+
}
|
|
137
|
+
.disable {
|
|
138
|
+
color: #7c7c7c;
|
|
139
|
+
pointer-events: none;
|
|
140
|
+
cursor: default;
|
|
141
|
+
}
|
|
142
|
+
.border_bottom {
|
|
143
|
+
border-bottom: 1px #cccccc dashed;
|
|
144
|
+
}
|
|
145
|
+
.active {
|
|
146
|
+
color: #00ff00;
|
|
147
|
+
}
|
|
148
|
+
.ellipse {
|
|
149
|
+
text-overflow: ellipsis;
|
|
150
|
+
white-space: nowrap;
|
|
151
|
+
overflow: hidden;
|
|
152
|
+
}
|
|
153
|
+
.marginLeft14 {
|
|
154
|
+
margin-left: 14px;
|
|
155
|
+
}
|
|
156
|
+
.widthB100 {
|
|
157
|
+
width: 100%;
|
|
158
|
+
}
|
|
159
|
+
.dashed {
|
|
160
|
+
display: flex;
|
|
161
|
+
flex-direction: row;
|
|
162
|
+
border-bottom: 1px #CCCCCC dashed;
|
|
163
|
+
}
|
|
164
|
+
.no_dashed {
|
|
165
|
+
display: flex;
|
|
166
|
+
flex-direction: row;
|
|
167
|
+
border-bottom: 1px #FFFFFF dashed;
|
|
168
|
+
}
|
|
169
|
+
</style>
|
|
Binary file
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
<!-- eslint-disable vue/no-multiple-template-root -->
|
|
2
|
+
<script >
|
|
3
|
+
/**
|
|
4
|
+
** treeData[]
|
|
5
|
+
** interface treeData {
|
|
6
|
+
name string,
|
|
7
|
+
level number,
|
|
8
|
+
id: string unique,
|
|
9
|
+
icon?: string,
|
|
10
|
+
children?: treeData[]
|
|
11
|
+
}
|
|
12
|
+
*/
|
|
13
|
+
export default {
|
|
14
|
+
name: 'zydx-tree',
|
|
15
|
+
props: {
|
|
16
|
+
/**
|
|
17
|
+
** treeData[]
|
|
18
|
+
*/
|
|
19
|
+
data: {
|
|
20
|
+
type: Array,
|
|
21
|
+
default: () => []
|
|
22
|
+
},
|
|
23
|
+
/**
|
|
24
|
+
**
|
|
25
|
+
** 是否开启手风琴模式
|
|
26
|
+
*/
|
|
27
|
+
accordian: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
**
|
|
33
|
+
** 选中时的颜色
|
|
34
|
+
*/
|
|
35
|
+
active_color: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: 'red'
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
**
|
|
41
|
+
** 下边框样式
|
|
42
|
+
*/
|
|
43
|
+
border: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: 'none'
|
|
46
|
+
},
|
|
47
|
+
height: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: '30px'
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
data() {
|
|
53
|
+
return {
|
|
54
|
+
treeData: []
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
mounted() {
|
|
58
|
+
|
|
59
|
+
},
|
|
60
|
+
watch: {
|
|
61
|
+
data: {
|
|
62
|
+
handler: function (v) {
|
|
63
|
+
if (v.length) {
|
|
64
|
+
this.treeData = this.traverse(v)
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
immediate: true
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
methods: {
|
|
71
|
+
traverse: function (array) {
|
|
72
|
+
if (!array.length) {
|
|
73
|
+
return
|
|
74
|
+
}
|
|
75
|
+
let output = []
|
|
76
|
+
for (const leaf of array) {
|
|
77
|
+
let next = {
|
|
78
|
+
...leaf,
|
|
79
|
+
isOpen: false,
|
|
80
|
+
children: leaf.children ? this.traverse(leaf.children) : []
|
|
81
|
+
}
|
|
82
|
+
output.push(next)
|
|
83
|
+
}
|
|
84
|
+
return output
|
|
85
|
+
},
|
|
86
|
+
handleClick: function (tree) {
|
|
87
|
+
this.$emit('update:select', tree)
|
|
88
|
+
const { id } = tree
|
|
89
|
+
this.treeData = this.treeData.map((item) => {
|
|
90
|
+
if (item.id === id) {
|
|
91
|
+
return {
|
|
92
|
+
...item,
|
|
93
|
+
isOpen: !item.isOpen
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
return {
|
|
97
|
+
...item,
|
|
98
|
+
isOpen: this.accordian ? false : item.isOpen
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
},
|
|
103
|
+
updateSelect: function (tree) {
|
|
104
|
+
this.$emit('update:select', tree)
|
|
105
|
+
},
|
|
106
|
+
textStyle: function (tree) {
|
|
107
|
+
const { fontSize = 16 } = tree
|
|
108
|
+
return `font-size: ${fontSize}px`
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
}
|
|
112
|
+
</script>
|
|
113
|
+
|
|
114
|
+
<template>
|
|
115
|
+
<div class="tree"
|
|
116
|
+
:key="tree.id"
|
|
117
|
+
v-for="(tree) in treeData">
|
|
118
|
+
<div class="tree_node"
|
|
119
|
+
:class="{ 'tree_node_active': tree.isOpen }"
|
|
120
|
+
@click="handleClick(tree)">
|
|
121
|
+
<template v-if="tree.level">
|
|
122
|
+
<div class="tree_node_indent"
|
|
123
|
+
v-for="i in tree.level"
|
|
124
|
+
:key="i">
|
|
125
|
+
<div :style="`width: ${tree.indent}px`"></div>
|
|
126
|
+
</div>
|
|
127
|
+
</template>
|
|
128
|
+
<template v-if="tree.icon">
|
|
129
|
+
<template v-if="['svg', 'image'].includes(tree.icon.type)">
|
|
130
|
+
<span class="tree_icon"
|
|
131
|
+
v-html="tree.icon.value"></span>
|
|
132
|
+
</template>
|
|
133
|
+
<template v-else>
|
|
134
|
+
<i :class="`iconfont' 'tree_icon' ${tree.icon.value}`"></i>
|
|
135
|
+
</template>
|
|
136
|
+
</template>
|
|
137
|
+
<span class="tree_text"
|
|
138
|
+
:style="textStyle(tree)">
|
|
139
|
+
{{ tree.name }}
|
|
140
|
+
</span>
|
|
141
|
+
</div>
|
|
142
|
+
<template v-if="tree.isOpen">
|
|
143
|
+
<tree :data="tree.children"
|
|
144
|
+
:active_color="active_color"
|
|
145
|
+
:border="border"
|
|
146
|
+
:key="tree.id"
|
|
147
|
+
@update:select="updateSelect"
|
|
148
|
+
:accordian="accordian"></tree>
|
|
149
|
+
</template>
|
|
150
|
+
|
|
151
|
+
</div>
|
|
152
|
+
</template>
|
|
153
|
+
<style scoped>
|
|
154
|
+
.tree {
|
|
155
|
+
width: 100%;
|
|
156
|
+
height: auto;
|
|
157
|
+
display: flex;
|
|
158
|
+
flex-direction: column;
|
|
159
|
+
align-items: center;
|
|
160
|
+
justify-content: flex-start;
|
|
161
|
+
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.tree_node {
|
|
165
|
+
width: 100%;
|
|
166
|
+
display: flex;
|
|
167
|
+
align-items: center;
|
|
168
|
+
justify-content: flex-start;
|
|
169
|
+
text-align: left;
|
|
170
|
+
height: v-bind(height);
|
|
171
|
+
cursor: pointer;
|
|
172
|
+
gap: 16px;
|
|
173
|
+
border-bottom: v-bind(border)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.tree_text_active {
|
|
177
|
+
color: red
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.tree_node_active {
|
|
181
|
+
color: v-bind(active_color)
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.tree_node_indent {
|
|
185
|
+
flex-grow: 0;
|
|
186
|
+
flex-shrink: 0;
|
|
187
|
+
height: 0;
|
|
188
|
+
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.tree_node_box {
|
|
192
|
+
width: 100%;
|
|
193
|
+
display: flex;
|
|
194
|
+
align-items: center;
|
|
195
|
+
justify-content: flex-start;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.tree_icon {
|
|
199
|
+
width: 16px;
|
|
200
|
+
height: 16px;
|
|
201
|
+
display: flex;
|
|
202
|
+
align-items: center;
|
|
203
|
+
justify-content: center;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.tree_text {
|
|
207
|
+
font-size: 16px;
|
|
208
|
+
line-height: 30px;
|
|
209
|
+
letter-spacing: 0px;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.children {
|
|
213
|
+
width: 100%;
|
|
214
|
+
display: flex;
|
|
215
|
+
flex-direction: column;
|
|
216
|
+
align-items: center;
|
|
217
|
+
justify-content: flex-start;
|
|
218
|
+
}
|
|
219
|
+
</style>
|
package/src/index.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import Message from './components/tipBox/index';
|
|
2
2
|
import Calendar from './components/calendar/index';
|
|
3
3
|
import Switch from './components/switch/index';
|
|
4
|
+
import menuTree from './components/menuTree/index';
|
|
5
|
+
import coloring from './components/coloring/index';
|
|
6
|
+
import tree from './components/tree/index';
|
|
4
7
|
|
|
5
8
|
const components = [
|
|
6
9
|
Calendar,
|
|
7
|
-
Switch
|
|
10
|
+
Switch,
|
|
11
|
+
menuTree,
|
|
12
|
+
coloring,
|
|
13
|
+
tree
|
|
8
14
|
];
|
|
9
15
|
|
|
10
16
|
function install(app) {
|
|
@@ -15,10 +21,13 @@ function install(app) {
|
|
|
15
21
|
}
|
|
16
22
|
|
|
17
23
|
export default {
|
|
18
|
-
version: '1.0.
|
|
24
|
+
version: '1.0.12',
|
|
19
25
|
install,
|
|
20
26
|
Calendar,
|
|
21
27
|
Message,
|
|
22
|
-
Switch
|
|
28
|
+
Switch,
|
|
29
|
+
menuTree,
|
|
30
|
+
coloring,
|
|
31
|
+
tree
|
|
23
32
|
};
|
|
24
33
|
|