@travel-screen/l-module-components 1.0.0
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/README.md +86 -0
- package/package.json +34 -0
- package/src/index.js +60 -0
- package/src/l-bar-chart/README.md +302 -0
- package/src/l-bar-chart/index.vue +405 -0
- package/src/l-bar-chart/interface/index.js +210 -0
- package/src/l-data-panel/README.md +331 -0
- package/src/l-data-panel/img/images.js +47 -0
- package/src/l-data-panel/img/l-data-panel_bg_1.png +0 -0
- package/src/l-data-panel/img/l-data-panel_bg_2.png +0 -0
- package/src/l-data-panel/img/l-data-panel_bg_3.png +0 -0
- package/src/l-data-panel/index.vue +150 -0
- package/src/l-data-panel/interface/index.js +249 -0
- package/src/l-data-ring/README.md +292 -0
- package/src/l-data-ring/img/images.js +21 -0
- package/src/l-data-ring/img/l-data-ring_bg.png +0 -0
- package/src/l-data-ring/index.vue +93 -0
- package/src/l-data-ring/interface/index.js +116 -0
- package/src/l-date-picker/README.md +276 -0
- package/src/l-date-picker/index.vue +185 -0
- package/src/l-date-picker/interface/index.js +128 -0
- package/src/l-icon-label/README.md +356 -0
- package/src/l-icon-label/img/images.js +28 -0
- package/src/l-icon-label/img/l-icon-label_bg.png +0 -0
- package/src/l-icon-label/img/l-icon-label_icon.png +0 -0
- package/src/l-icon-label/index.vue +162 -0
- package/src/l-icon-label/interface/index.js +234 -0
- package/src/l-label-value/README.md +358 -0
- package/src/l-label-value/img/images.js +19 -0
- package/src/l-label-value/img/l-label-value_line.png +0 -0
- package/src/l-label-value/index.vue +132 -0
- package/src/l-label-value/interface/index.js +116 -0
- package/src/l-metric-tile/README.md +391 -0
- package/src/l-metric-tile/img/images.js +19 -0
- package/src/l-metric-tile/img/l-metric-tile_bg_1.png +0 -0
- package/src/l-metric-tile/index.vue +138 -0
- package/src/l-metric-tile/interface/index.js +241 -0
- package/src/l-module-box/README.md +289 -0
- package/src/l-module-box/img/images.js +28 -0
- package/src/l-module-box/img/l-module-box_bg.png +0 -0
- package/src/l-module-box/img/l-module-box_icon.png +0 -0
- package/src/l-module-box/index.vue +125 -0
- package/src/l-module-box/interface/index.js +93 -0
- package/src/l-module-tag/README.md +243 -0
- package/src/l-module-tag/index.vue +137 -0
- package/src/l-module-tag/interface/index.js +91 -0
- package/src/l-rank-list/README.md +553 -0
- package/src/l-rank-list/img/images.js +34 -0
- package/src/l-rank-list/img/l-rank-list_icon_line.png +0 -0
- package/src/l-rank-list/img/l-rank-list_icon_rank_1.png +0 -0
- package/src/l-rank-list/img/l-rank-list_icon_rank_2.png +0 -0
- package/src/l-rank-list/img/l-rank-list_icon_rank_other.png +0 -0
- package/src/l-rank-list/index.vue +610 -0
- package/src/l-rank-list/interface/index.js +343 -0
- package/src/l-stat-card/README.md +309 -0
- package/src/l-stat-card/img/images.js +36 -0
- package/src/l-stat-card/img/img-bg.png +0 -0
- package/src/l-stat-card/img/l-stat-card_img_1.png +0 -0
- package/src/l-stat-card/index.vue +136 -0
- package/src/l-stat-card/interface/index.js +159 -0
- package/src/l-tabs/README.md +285 -0
- package/src/l-tabs/img/images.js +19 -0
- package/src/l-tabs/img/l-tabs_bg.png +0 -0
- package/src/l-tabs/index.vue +97 -0
- package/src/l-tabs/interface/index.js +115 -0
- package/src/l-trend-card/README.md +415 -0
- package/src/l-trend-card/img/images.js +41 -0
- package/src/l-trend-card/img/l-trend-card_bg.png +0 -0
- package/src/l-trend-card/img/l-trend-card_icon_1.png +0 -0
- package/src/l-trend-card/img/l-trend-card_icon_down.png +0 -0
- package/src/l-trend-card/img/l-trend-card_icon_up.png +0 -0
- package/src/l-trend-card/index.vue +181 -0
- package/src/l-trend-card/interface/index.js +243 -0
- package/src/utils/tooltip.js +30 -0
- package/src/utils/util.js +27 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="l-trend-card" :style="cardStyle">
|
|
3
|
+
<img class="l-trend-card__icon" :src="computedIcon" :style="iconStyle" />
|
|
4
|
+
<div class="l-trend-card__content" :style="contentStyle">
|
|
5
|
+
<div class="l-trend-card__title" :style="titleStyle">{{ title }}</div>
|
|
6
|
+
<div class="l-trend-card__num" :style="numStyle">{{ num }}</div>
|
|
7
|
+
<div class="l-trend-card__rate" :style="rateStyle">
|
|
8
|
+
<span class="l-trend-card__rate-label" :style="rateLabelStyle">同比</span>
|
|
9
|
+
<span class="l-trend-card__rate-value" :style="rateValueStyle">{{ dealPercentdDisplay(yoy) }}%</span>
|
|
10
|
+
<img
|
|
11
|
+
v-if="judgeRateType(yoy)"
|
|
12
|
+
class="l-trend-card__rate-trend-icon"
|
|
13
|
+
:src="judgeRateType(yoy) === 'up' ? computedUpIcon : computedDownIcon"
|
|
14
|
+
:style="trendIconStyle"
|
|
15
|
+
/>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="l-trend-card__rate" :style="rateStyle">
|
|
18
|
+
<span class="l-trend-card__rate-label" :style="rateLabelStyle">环比</span>
|
|
19
|
+
<span class="l-trend-card__rate-value" :style="rateValueStyle">{{ dealPercentdDisplay(mom) }}%</span>
|
|
20
|
+
<img
|
|
21
|
+
v-if="judgeRateType(mom)"
|
|
22
|
+
class="l-trend-card__rate-trend-icon"
|
|
23
|
+
:src="judgeRateType(mom) === 'up' ? computedUpIcon : computedDownIcon"
|
|
24
|
+
:style="trendIconStyle"
|
|
25
|
+
/>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script>
|
|
32
|
+
import interfaceObj from './interface/index'
|
|
33
|
+
import { dealPercentdDisplay, judgeRateType } from '../../utils/util'
|
|
34
|
+
import { getBgPath, getIconPath, getTrendIconPath } from './img/images'
|
|
35
|
+
|
|
36
|
+
export default {
|
|
37
|
+
name: 'LTrendCard',
|
|
38
|
+
props: interfaceObj,
|
|
39
|
+
components: {},
|
|
40
|
+
data() {
|
|
41
|
+
return {}
|
|
42
|
+
},
|
|
43
|
+
computed: {
|
|
44
|
+
// 图标(外部传入优先,否则使用默认)
|
|
45
|
+
computedIcon() {
|
|
46
|
+
if (this.icon) {
|
|
47
|
+
return this.icon
|
|
48
|
+
}
|
|
49
|
+
return getIconPath(1)
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
// 上升图标(外部传入优先,否则使用默认)
|
|
53
|
+
computedUpIcon() {
|
|
54
|
+
if (this.upIcon) {
|
|
55
|
+
return this.upIcon
|
|
56
|
+
}
|
|
57
|
+
return getTrendIconPath('up')
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
// 下降图标(外部传入优先,否则使用默认)
|
|
61
|
+
computedDownIcon() {
|
|
62
|
+
if (this.downIcon) {
|
|
63
|
+
return this.downIcon
|
|
64
|
+
}
|
|
65
|
+
return getTrendIconPath('down')
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
// 背景图(外部传入优先,否则使用默认)
|
|
69
|
+
computedBgImage() {
|
|
70
|
+
if (this.bgImage) {
|
|
71
|
+
return this.bgImage
|
|
72
|
+
}
|
|
73
|
+
return getBgPath()
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
// 卡片容器样式
|
|
77
|
+
cardStyle() {
|
|
78
|
+
return {
|
|
79
|
+
width: typeof this.cardWidth === 'number' ? `${this.cardWidth}px` : this.cardWidth,
|
|
80
|
+
height: typeof this.cardHeight === 'number' ? `${this.cardHeight}px` : this.cardHeight,
|
|
81
|
+
padding: this.cardPadding,
|
|
82
|
+
boxSizing: this.cardBoxSizing,
|
|
83
|
+
display: this.cardDisplay,
|
|
84
|
+
background: this.computedBgImage ? `url(${this.computedBgImage}) no-repeat center / ${this.cardBgSize}` : ''
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
// 图标样式
|
|
89
|
+
iconStyle() {
|
|
90
|
+
return {
|
|
91
|
+
width: typeof this.iconWidth === 'number' ? `${this.iconWidth}px` : this.iconWidth,
|
|
92
|
+
height: typeof this.iconHeight === 'number' ? `${this.iconHeight}px` : this.iconHeight,
|
|
93
|
+
marginLeft: typeof this.iconMarginLeft === 'number' ? `${this.iconMarginLeft}px` : this.iconMarginLeft,
|
|
94
|
+
marginTop: typeof this.iconMarginTop === 'number' ? `${this.iconMarginTop}px` : this.iconMarginTop,
|
|
95
|
+
flexShrink: this.iconFlexShrink
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
// 内容容器样式
|
|
100
|
+
contentStyle() {
|
|
101
|
+
return {
|
|
102
|
+
flex: this.contentFlex,
|
|
103
|
+
display: this.contentDisplay,
|
|
104
|
+
flexDirection: this.contentFlexDirection,
|
|
105
|
+
justifyContent: this.contentJustifyContent
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
// 标题样式
|
|
110
|
+
titleStyle() {
|
|
111
|
+
return {
|
|
112
|
+
fontFamily: this.titleFontFamily,
|
|
113
|
+
fontWeight: this.titleFontWeight,
|
|
114
|
+
fontSize: typeof this.titleFontSize === 'number' ? `${this.titleFontSize}px` : this.titleFontSize,
|
|
115
|
+
color: this.titleColor,
|
|
116
|
+
lineHeight: this.titleLineHeight
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
// 数值样式
|
|
121
|
+
numStyle() {
|
|
122
|
+
return {
|
|
123
|
+
fontFamily: this.numFontFamily,
|
|
124
|
+
fontWeight: this.numFontWeight,
|
|
125
|
+
fontStyle: this.numFontStyle,
|
|
126
|
+
fontSize: typeof this.numFontSize === 'number' ? `${this.numFontSize}px` : this.numFontSize,
|
|
127
|
+
color: this.numColor,
|
|
128
|
+
textShadow: this.numTextShadow,
|
|
129
|
+
lineHeight: this.numLineHeight,
|
|
130
|
+
margin: this.numMargin
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
// 比率容器样式
|
|
135
|
+
rateStyle() {
|
|
136
|
+
return {
|
|
137
|
+
fontSize: typeof this.rateFontSize === 'number' ? `${this.rateFontSize}px` : this.rateFontSize,
|
|
138
|
+
color: this.rateColor,
|
|
139
|
+
lineHeight: this.rateLineHeight,
|
|
140
|
+
display: this.rateDisplay,
|
|
141
|
+
alignItems: this.rateAlignItems
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
// 比率标签样式
|
|
146
|
+
rateLabelStyle() {
|
|
147
|
+
return {
|
|
148
|
+
marginRight: typeof this.labelMarginRight === 'number' ? `${this.labelMarginRight}px` : this.labelMarginRight
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
// 比率数值样式
|
|
153
|
+
rateValueStyle() {
|
|
154
|
+
return {
|
|
155
|
+
marginRight: typeof this.valueMarginRight === 'number' ? `${this.valueMarginRight}px` : this.valueMarginRight
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
// 趋势图标样式
|
|
160
|
+
trendIconStyle() {
|
|
161
|
+
return {
|
|
162
|
+
width: typeof this.trendIconWidth === 'number' ? `${this.trendIconWidth}px` : this.trendIconWidth,
|
|
163
|
+
height: typeof this.trendIconHeight === 'number' ? `${this.trendIconHeight}px` : this.trendIconHeight
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
watch: {},
|
|
168
|
+
mounted() {},
|
|
169
|
+
created() {},
|
|
170
|
+
methods: {
|
|
171
|
+
dealPercentdDisplay,
|
|
172
|
+
judgeRateType
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
</script>
|
|
176
|
+
|
|
177
|
+
<style lang="scss" scoped>
|
|
178
|
+
.l-trend-card {
|
|
179
|
+
// 所有样式通过内联样式控制
|
|
180
|
+
}
|
|
181
|
+
</style>
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
const interfaceObj = {
|
|
2
|
+
// 图标图片:卡片左侧的主图标URL,未传入时使用默认图标
|
|
3
|
+
icon: {
|
|
4
|
+
type: String,
|
|
5
|
+
default: ''
|
|
6
|
+
},
|
|
7
|
+
// 标题文本:显示在卡片上的标题文字
|
|
8
|
+
title: {
|
|
9
|
+
type: String,
|
|
10
|
+
default: ''
|
|
11
|
+
},
|
|
12
|
+
// 数值:卡片显示的主要数据值
|
|
13
|
+
num: {
|
|
14
|
+
type: [String, Number],
|
|
15
|
+
default: ''
|
|
16
|
+
},
|
|
17
|
+
// 同比增长率:与去年同期相比的增长率(%)
|
|
18
|
+
yoy: {
|
|
19
|
+
type: [String, Number],
|
|
20
|
+
default: 0
|
|
21
|
+
},
|
|
22
|
+
// 环比增长率:与上一周期相比的增长率(%)
|
|
23
|
+
mom: {
|
|
24
|
+
type: [String, Number],
|
|
25
|
+
default: 0
|
|
26
|
+
},
|
|
27
|
+
// 上升图标:增长率上升时显示的图标URL,未传入时使用默认
|
|
28
|
+
upIcon: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: ''
|
|
31
|
+
},
|
|
32
|
+
// 下降图标:增长率下降时显示的图标URL,未传入时使用默认
|
|
33
|
+
downIcon: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: ''
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
// ========== 卡片容器相关 ==========
|
|
39
|
+
// 卡片宽度:整个卡片的宽度
|
|
40
|
+
cardWidth: {
|
|
41
|
+
type: [String, Number],
|
|
42
|
+
default: '150px'
|
|
43
|
+
},
|
|
44
|
+
// 卡片高度:整个卡片的高度
|
|
45
|
+
cardHeight: {
|
|
46
|
+
type: [String, Number],
|
|
47
|
+
default: '107px'
|
|
48
|
+
},
|
|
49
|
+
// 卡片内边距:卡片内容与边缘的间距(上 右 下 左)
|
|
50
|
+
cardPadding: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: '8px 8px 0 4px'
|
|
53
|
+
},
|
|
54
|
+
// 卡片盒模型:CSS box-sizing属性
|
|
55
|
+
cardBoxSizing: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: 'border-box'
|
|
58
|
+
},
|
|
59
|
+
// 卡片显示方式:CSS display属性
|
|
60
|
+
cardDisplay: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: 'flex'
|
|
63
|
+
},
|
|
64
|
+
// 背景图:卡片容器的背景图片URL,未传入时使用默认背景图
|
|
65
|
+
bgImage: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: ''
|
|
68
|
+
},
|
|
69
|
+
// 背景图尺寸:背景图的缩放方式(如:100% 100%)
|
|
70
|
+
cardBgSize: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: '100% 100%'
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
// ========== 图标相关 ==========
|
|
76
|
+
// 图标宽度:主图标的显示宽度
|
|
77
|
+
iconWidth: {
|
|
78
|
+
type: [String, Number],
|
|
79
|
+
default: '50px'
|
|
80
|
+
},
|
|
81
|
+
// 图标高度:主图标的显示高度
|
|
82
|
+
iconHeight: {
|
|
83
|
+
type: [String, Number],
|
|
84
|
+
default: '61px'
|
|
85
|
+
},
|
|
86
|
+
// 图标左边距:图标距离卡片左侧的间距
|
|
87
|
+
iconMarginLeft: {
|
|
88
|
+
type: [String, Number],
|
|
89
|
+
default: '2px'
|
|
90
|
+
},
|
|
91
|
+
// 图标上边距:图标距离卡片顶部的间距
|
|
92
|
+
iconMarginTop: {
|
|
93
|
+
type: [String, Number],
|
|
94
|
+
default: '5px'
|
|
95
|
+
},
|
|
96
|
+
// 图标收缩比例:flex布局中图标的收缩比例(0表示不收缩)
|
|
97
|
+
iconFlexShrink: {
|
|
98
|
+
type: [String, Number],
|
|
99
|
+
default: 0
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
// ========== 内容容器相关 ==========
|
|
103
|
+
// 内容区弹性比例:内容区域的flex比例
|
|
104
|
+
contentFlex: {
|
|
105
|
+
type: [String, Number],
|
|
106
|
+
default: 1
|
|
107
|
+
},
|
|
108
|
+
// 内容区显示方式:内容区域的CSS display属性
|
|
109
|
+
contentDisplay: {
|
|
110
|
+
type: String,
|
|
111
|
+
default: 'flex'
|
|
112
|
+
},
|
|
113
|
+
// 内容区主轴方向:内容区域的flex主轴方向
|
|
114
|
+
contentFlexDirection: {
|
|
115
|
+
type: String,
|
|
116
|
+
default: 'column'
|
|
117
|
+
},
|
|
118
|
+
// 内容区主轴对齐:内容区域的flex主轴对齐方式
|
|
119
|
+
contentJustifyContent: {
|
|
120
|
+
type: String,
|
|
121
|
+
default: 'center'
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
// ========== 标题相关 ==========
|
|
125
|
+
// 标题字体:标题文字的字体族
|
|
126
|
+
titleFontFamily: {
|
|
127
|
+
type: String,
|
|
128
|
+
default: 'PingFangSC, PingFang SC'
|
|
129
|
+
},
|
|
130
|
+
// 标题字重:标题文字的粗细
|
|
131
|
+
titleFontWeight: {
|
|
132
|
+
type: [String, Number],
|
|
133
|
+
default: 400
|
|
134
|
+
},
|
|
135
|
+
// 标题字号:标题文字的大小
|
|
136
|
+
titleFontSize: {
|
|
137
|
+
type: [String, Number],
|
|
138
|
+
default: '16px'
|
|
139
|
+
},
|
|
140
|
+
// 标题颜色:标题文字的颜色
|
|
141
|
+
titleColor: {
|
|
142
|
+
type: String,
|
|
143
|
+
default: '#ffffff'
|
|
144
|
+
},
|
|
145
|
+
// 标题行高:标题文字的行高
|
|
146
|
+
titleLineHeight: {
|
|
147
|
+
type: [String, Number],
|
|
148
|
+
default: 1.2
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
// ========== 数值相关 ==========
|
|
152
|
+
// 数值字体:数值文字的字体族
|
|
153
|
+
numFontFamily: {
|
|
154
|
+
type: String,
|
|
155
|
+
default: 'DINAlternate, DIN Alternate, YouSheBiaoTiHei, sans-serif'
|
|
156
|
+
},
|
|
157
|
+
// 数值字重:数值文字的粗细
|
|
158
|
+
numFontWeight: {
|
|
159
|
+
type: [String, Number],
|
|
160
|
+
default: 'bold'
|
|
161
|
+
},
|
|
162
|
+
// 数值字体样式:数值文字的样式(italic为斜体)
|
|
163
|
+
numFontStyle: {
|
|
164
|
+
type: String,
|
|
165
|
+
default: 'italic'
|
|
166
|
+
},
|
|
167
|
+
// 数值字号:数值文字的大小
|
|
168
|
+
numFontSize: {
|
|
169
|
+
type: [String, Number],
|
|
170
|
+
default: '22px'
|
|
171
|
+
},
|
|
172
|
+
// 数值颜色:数值文字的颜色
|
|
173
|
+
numColor: {
|
|
174
|
+
type: String,
|
|
175
|
+
default: '#4aefa0'
|
|
176
|
+
},
|
|
177
|
+
// 数值文字阴影:数值文字的阴影效果
|
|
178
|
+
numTextShadow: {
|
|
179
|
+
type: String,
|
|
180
|
+
default: '0 0 6px rgba(74, 239, 160, 0.5)'
|
|
181
|
+
},
|
|
182
|
+
// 数值行高:数值文字的行高
|
|
183
|
+
numLineHeight: {
|
|
184
|
+
type: [String, Number],
|
|
185
|
+
default: 1.2
|
|
186
|
+
},
|
|
187
|
+
// 数值外边距:数值文字的上下外边距
|
|
188
|
+
numMargin: {
|
|
189
|
+
type: String,
|
|
190
|
+
default: '4px 0'
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
// ========== 比率相关 ==========
|
|
194
|
+
// 比率字号:同比/环比文字的字体大小
|
|
195
|
+
rateFontSize: {
|
|
196
|
+
type: [String, Number],
|
|
197
|
+
default: '12px'
|
|
198
|
+
},
|
|
199
|
+
// 比率颜色:同比/环比文字的颜色
|
|
200
|
+
rateColor: {
|
|
201
|
+
type: String,
|
|
202
|
+
default: '#ffffff'
|
|
203
|
+
},
|
|
204
|
+
// 比率行高:同比/环比文字的行高
|
|
205
|
+
rateLineHeight: {
|
|
206
|
+
type: [String, Number],
|
|
207
|
+
default: 1.6
|
|
208
|
+
},
|
|
209
|
+
// 比率显示方式:比率区域的CSS display属性
|
|
210
|
+
rateDisplay: {
|
|
211
|
+
type: String,
|
|
212
|
+
default: 'flex'
|
|
213
|
+
},
|
|
214
|
+
// 比率交叉轴对齐:比率区域的flex交叉轴对齐
|
|
215
|
+
rateAlignItems: {
|
|
216
|
+
type: String,
|
|
217
|
+
default: 'center'
|
|
218
|
+
},
|
|
219
|
+
// 比率标签右边距:"同比"/"环比"标签右侧的间距
|
|
220
|
+
labelMarginRight: {
|
|
221
|
+
type: [String, Number],
|
|
222
|
+
default: '4px'
|
|
223
|
+
},
|
|
224
|
+
// 比率数值右边距:比率数值与趋势图标之间的间距
|
|
225
|
+
valueMarginRight: {
|
|
226
|
+
type: [String, Number],
|
|
227
|
+
default: '4px'
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
// ========== 趋势图标相关 ==========
|
|
231
|
+
// 趋势图标宽度:上升/下降图标的显示宽度
|
|
232
|
+
trendIconWidth: {
|
|
233
|
+
type: [String, Number],
|
|
234
|
+
default: '7px'
|
|
235
|
+
},
|
|
236
|
+
// 趋势图标高度:上升/下降图标的显示高度
|
|
237
|
+
trendIconHeight: {
|
|
238
|
+
type: [String, Number],
|
|
239
|
+
default: '10px'
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export default interfaceObj
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ECharts tooltip 工具函数
|
|
3
|
+
* 从主项目 src/utils/common.js 中提取,去除 $pubFun 全局依赖
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 柱状图/折线图 tooltip 格式化
|
|
8
|
+
* @param {Array} items - ECharts tooltip params 数组
|
|
9
|
+
* @param {String} units - 单位
|
|
10
|
+
* @returns {String} HTML 字符串
|
|
11
|
+
*/
|
|
12
|
+
export function tooltipItemsHtmlString(items, units = '') {
|
|
13
|
+
return items
|
|
14
|
+
.map(
|
|
15
|
+
(el) => `<div class="content-panel">
|
|
16
|
+
<p>
|
|
17
|
+
${
|
|
18
|
+
el.marker ? el.marker : `<span style="background-color: ${el.color}" class="tooltip-item-icon"></span>`
|
|
19
|
+
}
|
|
20
|
+
<span>
|
|
21
|
+
${el.seriesName}:
|
|
22
|
+
</span>
|
|
23
|
+
</p>
|
|
24
|
+
<span class="tooltip-value">
|
|
25
|
+
${Number(el.value || 0).toLocaleString()} <span class="tip-units">${units}</span>
|
|
26
|
+
</span>
|
|
27
|
+
</div>`
|
|
28
|
+
)
|
|
29
|
+
.join('')
|
|
30
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* L-Module-Components 工具函数
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 处理百分比显示(负数取绝对值)
|
|
7
|
+
* @param {Number} percentage - 百分比值
|
|
8
|
+
* @returns {Number} 处理后的值
|
|
9
|
+
*/
|
|
10
|
+
export function dealPercentdDisplay(percentage) {
|
|
11
|
+
return percentage < 0 ? percentage * -1 : percentage
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 判断增长率方向
|
|
16
|
+
* @param {Number} rate - 增长率
|
|
17
|
+
* @returns {String} 'up' | 'down' | ''
|
|
18
|
+
*/
|
|
19
|
+
export function judgeRateType(rate) {
|
|
20
|
+
if (rate > 0) {
|
|
21
|
+
return 'up'
|
|
22
|
+
} else if (rate < 0) {
|
|
23
|
+
return 'down'
|
|
24
|
+
} else {
|
|
25
|
+
return ''
|
|
26
|
+
}
|
|
27
|
+
}
|