lambo-design-bi 0.0.182 → 0.0.184

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.
@@ -107,7 +107,7 @@ export default {
107
107
  if (rows && rows.length > 0) {
108
108
  let rowData = rows[0]
109
109
  if(rowData && Object.prototype.hasOwnProperty.call(rowData, "val")){
110
- this.chartsNote = rowData["val"]
110
+ this.chartsNote = rowData["val"] || ''
111
111
  }
112
112
  }
113
113
  } else {
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <LamboNumberInfoBi :title="title" :sub-title="subTitle" :num="num" :sub-num1="subNum1" :trend1="trend1"
3
- :is-drill="isDrill" @on-drill="onDrill" :sub-num2="subNum2" :trend2="trend2" :polar1="polar1" :polar2="polar2">
2
+ <LamboNumberInfoBi :title="title" :sub-title="subTitle" :num="num" :sub-num1="subNum1" :trend1="trend1" :widget="widget"
3
+ :is-drill="isDrill" @on-drill="onDrill" :sub-num2="subNum2" :trend2="trend2" :polar1="polar1" :polar2="polar2" :eva-level="evaLevel">
4
4
  </LamboNumberInfoBi>
5
5
  </template>
6
6
  <script>
@@ -41,7 +41,8 @@ export default {
41
41
  drillK2: null,
42
42
  drillV2: null,
43
43
  drillK3: null,
44
- dirllV3: null
44
+ dirllV3: null,
45
+ evaLevel: null
45
46
  }
46
47
  },
47
48
  methods: {
@@ -90,6 +91,9 @@ export default {
90
91
  this.drillK3 = row['drill_k3'] || ''
91
92
  this.drillV3 = row['drill_v3'] || ''
92
93
  }
94
+ if (Object.prototype.hasOwnProperty.call(row, 'eva_level')) {
95
+ this.evaLevel = row['eva_level'] || ''
96
+ }
93
97
  }
94
98
  }
95
99
  }
@@ -26,6 +26,7 @@ import { getPageConfig } from '../api/config'
26
26
  import { deepCopy } from "@lambo-design/shared/utils/assist"
27
27
  import { getWidgetName } from '../util/widget-map'
28
28
  import { setRouteCfg2Search, getInitSearchRes, getSearchFormRes } from './util/common'
29
+ import { EventBus, EVENT_TYPES } from '../util/event-bus'
29
30
 
30
31
  export default {
31
32
  name: 'BiIndexPageTm',
@@ -101,12 +102,19 @@ export default {
101
102
  }
102
103
  this.params = deepCopy(formParams)
103
104
  console.log("index-page-tm doSearch 2 this.params:", this.params)
105
+ },
106
+ handleNumIdxActivated(eventData) {
107
+ console.log('BiPage handleNumIdxActivated eventData:', eventData)
108
+ // 处理数值指标激活事件的逻辑
109
+
104
110
  }
105
111
  },
106
112
  created() {
107
113
  this.getConfig()
108
114
  },
109
115
  mounted() {
116
+ // 监听卡片激活事件
117
+ EventBus.$on(EVENT_TYPES.NUM_IDX_ACTIVATED, this.handleNumIdxActivated)
110
118
 
111
119
  },
112
120
  computed: {
@@ -122,6 +130,10 @@ export default {
122
130
  )
123
131
  return filteredWidgets.length > 0
124
132
  }
133
+ },
134
+ beforeDestroy() {
135
+ // 组件销毁前移除事件监听
136
+ EventBus.$off(EVENT_TYPES.NUM_IDX_ACTIVATED, this.handleOtherCardActivated)
125
137
  }
126
138
  }
127
139
  </script>
@@ -0,0 +1,10 @@
1
+ import Vue from 'vue'
2
+
3
+ // 创建全局事件总线
4
+ export const EventBus = new Vue()
5
+
6
+ // 定义事件类型常量
7
+ export const EVENT_TYPES = {
8
+ NUM_IDX_ACTIVATED: 'num-idx-activated',
9
+ NUM_IDX_DEACTIVATED: 'num-idx-deactivated'
10
+ }
@@ -8,7 +8,7 @@ import BiRow2 from "../layout/row2.vue"
8
8
  import BiCol from "../layout/col.vue"
9
9
  import BiDetailTable from "../table/detail-table.vue"
10
10
  import BiCharts from "../charts/index.vue"
11
- import BiTextGroup from '../text/text-group.vue';
11
+ import BiTextGroup from '../text/text-group.vue'
12
12
 
13
13
  /**
14
14
  * Strictly define the order to prevent circular references. For component reuse, copy new components instead of direct references.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lambo-design-bi",
3
- "version": "0.0.182",
3
+ "version": "0.0.184",
4
4
  "description": "Vue2 BI 数据可视化组件库",
5
5
  "main": "index.js",
6
6
  "author": "finch",
@@ -1,158 +1,290 @@
1
- <template>
2
- <div class="ivu-number-info">
3
- <div class="ivu-number-info-title-lambo title-div" :class="{ 'isDrill': isDrill }" v-if="title || $slots.title"
4
- @click="drill">
5
- <slot name="title">{{ title }}</slot>
6
- <Icon v-if="isDrill" type="ios-redo-outline" />
7
- </div>
8
- <div v-if="subTitle" class="ivu-number-info-subTitle">
9
- <slot name="subTitle">{{ subTitle }}</slot>
10
- </div>
11
- <div class="ivu-number-info-value-lambo" :style="valueStyle">
12
- <span class="ivu-number-info-total">
13
- <slot name="num">{{ num }}</slot>
14
- </span>
15
- <span class="ivu-number-info-subTotal" v-if="subNum1 || subNum2">
16
- <slot name="subNum">
17
- <template v-if="subNum1">
18
- <template v-if="trend1">
19
- <template v-if="polar1 === 'pos'">
20
- <Trend :flag="trend1" text-color reverse-color>{{ subNum1 }}</Trend>
21
- </template>
22
- <template v-else>
23
- <Trend :flag="trend1" text-color>{{ subNum1 }}</Trend>
24
- </template>
25
- </template>
26
- <template v-else>
27
- {{ subNum1 }}
28
- </template>
29
- </template>
30
- <template v-if="subNum2">
31
- <template v-if="trend2">
32
- <template v-if="polar2 === 'pos'">
33
- <Trend :flag="trend2" text-color reverse-color>{{ subNum2 }}</Trend>
34
- </template>
35
- <template v-else>
36
- <Trend :flag="trend2" text-color>{{ subNum2 }}</Trend>
37
- </template>
38
- </template>
39
- <template v-else>
40
- {{ subNum2 }}
41
- </template>
42
- </template>
43
- </slot>
44
- </span>
45
- </div>
46
- </div>
47
- </template>
48
- <script>
49
- import { oneOf } from 'view-ui-plus/src/utils/assist'
50
- import Trend from 'view-ui-plus/src/components/trend'
51
- import 'view-ui-plus/dist/styles/viewuiplus.css'
52
-
53
- export default {
54
- name: 'LamboNumberInfoBi',
55
- components: { Trend },
56
- props: {
57
- title: {
58
- type: String
59
- },
60
- subTitle: {
61
- type: String,
62
- default: ''
63
- },
64
- num: {
65
- type: [String, Number]
66
- },
67
- subNum1: {
68
- type: [String, Number]
69
- },
70
- trend1: {
71
- validator(value) {
72
- return oneOf(value, ['up', 'down']);
73
- }
74
- },
75
- polar1: {
76
- type: String,
77
- required: false,
78
- validator(value) {
79
- return !value || ['pos', 'neg'].includes(value);
80
- }
81
- },
82
- subNum2: {
83
- type: [String, Number]
84
- },
85
- trend2: {
86
- validator(value) {
87
- return oneOf(value, ['up', 'down']);
88
- }
89
- },
90
- polar2: {
91
- type: String,
92
- required: false,
93
- validator(value) {
94
- return !value || ['pos', 'neg'].includes(value);
95
- }
96
- },
97
- gap: {
98
- type: [String, Number],
99
- default: 6
100
- },
101
- isDrill: {
102
- type: Boolean,
103
- default: false
104
- }
105
- },
106
- computed: {
107
- valueStyle() {
108
- return {
109
- 'margin-top': this.gap + 'px'
110
- };
111
- }
112
- },
113
- methods: {
114
- drill() {
115
- if (this.isDrill) {
116
- console.log("number-info 点击了下钻按钮")
117
- this.$emit('on-drill', {})
118
- }
119
- }
120
- }
121
- };
122
- </script>
123
- <style scoped lang="less">
124
- .ivu-number-info-value-lambo {
125
- margin-top: 4px;
126
- overflow: hidden;
127
- font-size: 0;
128
- white-space: nowrap;
129
- text-overflow: ellipsis;
130
- word-break: break-all;
131
- display: flex;
132
- flex-direction: column;
133
- }
134
-
135
- .ivu-number-info-title-lambo {
136
- margin-bottom: 9px;
137
- color: #17233d;
138
- font-size: 16px;
139
- -webkit-transition: all .2s;
140
- transition: all .2s
141
- }
142
-
143
- .title-div {
144
- display: flex;
145
- justify-content: space-between;
146
- align-items: center;
147
- transition: all 0.2s ease;
148
- border-radius: 5px;
149
- }
150
-
151
- .title-div.isDrill {
152
- cursor: pointer;
153
- }
154
-
155
- .title-div.isDrill:hover {
156
- transform: scale(1.02);
157
- }
158
- </style>
1
+ <template>
2
+ <div class="ivu-number-info" :class="{ 'card-active': isActive, 'card-clickable': clickable }"
3
+ @click="handleCardClick">
4
+ <div class="ivu-number-info-title-lambo title-div" :class="{ 'isDrill': isDrill }" v-if="title" @click="drill">
5
+ <slot name="title">{{ title }}</slot>
6
+ <div class="cd-right-top">
7
+ <Icon v-if="isDrill" type="ios-redo-outline" />
8
+
9
+ <img class="badge-img" v-if="evaLevel == 'high'"
10
+ src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M32 0 L32 32 L0 0 Z' fill='%2321DA2E'/%3E%3Ctext x='24' y='12' font-size='12' font-weight='bold' text-anchor='end' fill='white' font-family='system-ui, sans-serif'%3E优%3C/text%3E%3C/svg%3E"
11
+ alt="优">
12
+ <img class="badge-img" v-if="evaLevel == 'mid'"
13
+ src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M32 0 L32 32 L0 0 Z' fill='%231E58F8'/%3E%3Ctext x='24' y='12' font-size='12' font-weight='bold' text-anchor='end' fill='white' font-family='system-ui, sans-serif'%3E中%3C/text%3E%3C/svg%3E"
14
+ alt="中">
15
+ <img class="badge-img" v-if="evaLevel == 'low'"
16
+ src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M32 0 L32 32 L0 0 Z' fill='%23ff9900'/%3E%3Ctext x='24' y='12' font-size='12' font-weight='bold' text-anchor='end' fill='white' font-family='system-ui, sans-serif'%3E低%3C/text%3E%3C/svg%3E"
17
+ alt="低">
18
+ </div>
19
+
20
+ </div>
21
+ <div v-if="subTitle" class="ivu-number-info-subTitle">
22
+ <slot name="subTitle">{{ subTitle }}</slot>
23
+ </div>
24
+ <div class="ivu-number-info-value-lambo" :style="valueStyle">
25
+ <span class="ivu-number-info-total">
26
+ <slot name="num">{{ num }}</slot>
27
+ </span>
28
+ <span class="ivu-number-info-subTotal" v-if="subNum1 || subNum2">
29
+ <slot name="subNum">
30
+ <template v-if="subNum1">
31
+ <template v-if="trend1">
32
+ <template v-if="polar1 === 'pos'">
33
+ <Trend :flag="trend1" text-color reverse-color>{{ subNum1 }}</Trend>
34
+ </template>
35
+ <template v-else>
36
+ <Trend :flag="trend1" text-color>{{ subNum1 }}</Trend>
37
+ </template>
38
+ </template>
39
+ <template v-else>
40
+ {{ subNum1 }}
41
+ </template>
42
+ </template>
43
+ <template v-if="subNum2">
44
+ <template v-if="trend2">
45
+ <template v-if="polar2 === 'pos'">
46
+ <Trend :flag="trend2" text-color reverse-color>{{ subNum2 }}</Trend>
47
+ </template>
48
+ <template v-else>
49
+ <Trend :flag="trend2" text-color>{{ subNum2 }}</Trend>
50
+ </template>
51
+ </template>
52
+ <template v-else>
53
+ {{ subNum2 }}
54
+ </template>
55
+ </template>
56
+ </slot>
57
+ </span>
58
+ </div>
59
+
60
+ <div class="card-bottom-line" :class="{ 'active': isActive }"></div>
61
+ </div>
62
+ </template>
63
+ <script>
64
+ import { oneOf } from 'view-ui-plus/src/utils/assist'
65
+ import Trend from 'view-ui-plus/src/components/trend'
66
+ import { EVENT_TYPES, EventBus } from '../../bi/widget/util/event-bus';
67
+ import 'view-ui-plus/dist/styles/viewuiplus.css'
68
+
69
+
70
+ export default {
71
+ name: 'LamboNumberInfoBi',
72
+ components: { Trend },
73
+ props: {
74
+ title: {
75
+ type: String
76
+ },
77
+ subTitle: {
78
+ type: String,
79
+ default: ''
80
+ },
81
+ num: {
82
+ type: [String, Number]
83
+ },
84
+ subNum1: {
85
+ type: [String, Number]
86
+ },
87
+ trend1: {
88
+ validator(value) {
89
+ return oneOf(value, ['up', 'down']);
90
+ }
91
+ },
92
+ polar1: {
93
+ type: String,
94
+ required: false,
95
+ validator(value) {
96
+ return !value || ['pos', 'neg'].includes(value);
97
+ }
98
+ },
99
+ subNum2: {
100
+ type: [String, Number]
101
+ },
102
+ trend2: {
103
+ validator(value) {
104
+ return oneOf(value, ['up', 'down']);
105
+ }
106
+ },
107
+ polar2: {
108
+ type: String,
109
+ required: false,
110
+ validator(value) {
111
+ return !value || ['pos', 'neg'].includes(value);
112
+ }
113
+ },
114
+ gap: {
115
+ type: [String, Number],
116
+ default: 6
117
+ },
118
+ isDrill: {
119
+ type: Boolean,
120
+ default: false
121
+ },
122
+ evaLevel: {
123
+ type: String,
124
+ default: ''
125
+ },
126
+ clickable: {
127
+ type: Boolean,
128
+ default: true
129
+ },
130
+ active: {
131
+ type: Boolean,
132
+ default: false
133
+ },
134
+ widget: {
135
+ type: Object,
136
+ default: () => ({})
137
+ },
138
+ },
139
+ computed: {
140
+ valueStyle() {
141
+ return {
142
+ 'margin-top': this.gap + 'px'
143
+ };
144
+ }
145
+ },
146
+ data() {
147
+ return {
148
+ isActive: this.active
149
+ }
150
+ },
151
+ watch: {
152
+ active(newVal) {
153
+ this.isActive = newVal
154
+ }
155
+ },
156
+ methods: {
157
+ drill() {
158
+ if (this.isDrill) {
159
+ console.log("number-info 点击了下钻按钮")
160
+ this.$emit('on-drill', {})
161
+ }
162
+ },
163
+ handleCardClick() {
164
+ if (this.clickable) {
165
+ if (!this.isActive) {
166
+ this.activateCard()
167
+ }
168
+ console.log("num-info handleCardClick 卡片被点击,当前实例:", this.widget.id + "_" + this.widget.name)
169
+ }
170
+ },
171
+ // 激活卡片
172
+ activateCard() {
173
+ this.isActive = true
174
+
175
+ // 发布卡片激活事件
176
+ EventBus.$emit(EVENT_TYPES.NUM_IDX_ACTIVATED, {
177
+ widgetId: this.widget.id,
178
+ widgetName: this.widget.name,
179
+ options: this.widget.options,
180
+ instance: this
181
+ })
182
+ },
183
+ // 处理其他卡片激活事件
184
+ handleOtherCardActivated(eventData) {
185
+ // 如果是同一组且不是当前卡片,则取消激活
186
+ if (this.isActive === true && eventData.widgetId !== this.widget.id) {
187
+ this.isActive = false
188
+ console.log(`num-info handleOtherCardActivated 卡片 ${this.widget.id}_${this.widget.name} 因 ${eventData.widgetId}_${eventData.widgetName} 激活而取消激活`)
189
+ }
190
+ }
191
+ },
192
+ mounted() {
193
+ // 监听卡片激活事件
194
+ EventBus.$on(EVENT_TYPES.NUM_IDX_ACTIVATED, this.handleOtherCardActivated)
195
+ },
196
+
197
+ beforeDestroy() {
198
+ // 组件销毁前移除事件监听
199
+ EventBus.$off(EVENT_TYPES.NUM_IDX_ACTIVATED, this.handleOtherCardActivated)
200
+ }
201
+ };
202
+ </script>
203
+ <style scoped lang="less">
204
+ .ivu-number-info-value-lambo {
205
+ margin-top: 4px;
206
+ overflow: hidden;
207
+ font-size: 0;
208
+ white-space: nowrap;
209
+ text-overflow: ellipsis;
210
+ word-break: break-all;
211
+ display: flex;
212
+ flex-direction: column;
213
+ }
214
+
215
+ .ivu-number-info-title-lambo {
216
+ margin-bottom: 9px;
217
+ color: #17233d;
218
+ font-size: 16px;
219
+ -webkit-transition: all .2s;
220
+ transition: all .2s
221
+ }
222
+
223
+ .title-div {
224
+ display: flex;
225
+ justify-content: space-between;
226
+ align-items: center;
227
+ transition: all 0.2s ease;
228
+ border-radius: 5px;
229
+ }
230
+
231
+ .title-div.isDrill {
232
+ cursor: pointer;
233
+ }
234
+
235
+ .title-div.isDrill:hover {
236
+ transform: scale(1.02);
237
+ }
238
+
239
+ .cd-right-top {
240
+ display: flex;
241
+ justify-content: end;
242
+ }
243
+
244
+ .badge-img {
245
+ width: 32px;
246
+ height: 32px;
247
+ margin-top: -8px;
248
+ margin-right: -8px;
249
+ border-top-right-radius: 6px;
250
+ }
251
+
252
+ // 重写卡片基础样式,添加点击效果
253
+ .ivu-number-info {
254
+ cursor: default;
255
+
256
+ // 新增:可点击状态
257
+ &.card-clickable {
258
+ cursor: pointer;
259
+
260
+ &:hover {
261
+ transform: translateY(-2px);
262
+ }
263
+ }
264
+
265
+ // 新增:激活状态
266
+ &.card-active {
267
+ .card-bottom-line.active {
268
+ opacity: 1;
269
+ transform: scaleX(1);
270
+ }
271
+ }
272
+ }
273
+
274
+ .card-bottom-line {
275
+ width: 100%;
276
+ height: 3px;
277
+ margin-bottom: -10px;
278
+ background: linear-gradient(90deg, #1890ff, #69c0ff);
279
+ opacity: 0;
280
+ transform: scaleX(0.8);
281
+ transition: all 0.3s ease;
282
+ border-bottom-left-radius: 6px;
283
+ border-bottom-right-radius: 6px;
284
+
285
+ &.active {
286
+ opacity: 1;
287
+ transform: scaleX(1);
288
+ }
289
+ }
290
+ </style>
@@ -59,6 +59,6 @@ export default {
59
59
  padding: 20px 5px 15px 5px;
60
60
  border-radius: 5px;
61
61
  line-height: 1.6;
62
- font-size: 14px;
62
+ font-size: 15px;
63
63
  }
64
64
  </style>