lambo-design-bi 0.0.240 → 0.0.242
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.
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<lambo-indicator-card-bi
|
|
3
|
-
:has-
|
|
4
|
-
:has-extend="isTabsLayout">
|
|
2
|
+
<lambo-indicator-card-bi :has-title="(cardOptions.title && cardOptions.title.length > 0) ? true : false"
|
|
3
|
+
:has-extend="hasSwitchLayout">
|
|
5
4
|
<template slot="content-title" v-if="(cardOptions.title && cardOptions.title.length > 0)">
|
|
6
5
|
<div>{{ cardOptions.title }}</div>
|
|
7
6
|
<div class="card-subtitle" v-if="subTitle">{{ subTitle }}</div>
|
|
8
7
|
</template>
|
|
9
|
-
<template slot="content-extend" v-if="
|
|
10
|
-
<RadioGroup v-model="
|
|
11
|
-
<Radio v-for="
|
|
8
|
+
<template slot="content-extend" v-if="hasSwitchLayout">
|
|
9
|
+
<RadioGroup v-model="activeSwitchValue" type="button" size="small" class="card-tabs-radio">
|
|
10
|
+
<Radio v-for="item in switchItems" :key="item.key" :label="item.key">{{ item.title }}</Radio>
|
|
12
11
|
</RadioGroup>
|
|
13
12
|
</template>
|
|
14
13
|
<div :style="containerStyle || {}">
|
|
@@ -44,7 +43,8 @@ export default {
|
|
|
44
43
|
return {
|
|
45
44
|
containerStyle: {},
|
|
46
45
|
subTitle: null,
|
|
47
|
-
activeWidgetIndex: 0
|
|
46
|
+
activeWidgetIndex: 0,
|
|
47
|
+
activeGroupKey: ''
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
computed: {
|
|
@@ -54,14 +54,107 @@ export default {
|
|
|
54
54
|
isTabsLayout() {
|
|
55
55
|
return this.cardOptions.layout === 'tabs'
|
|
56
56
|
},
|
|
57
|
+
isGroupTabsLayout() {
|
|
58
|
+
return this.cardOptions.layout === 'groupTabs'
|
|
59
|
+
},
|
|
60
|
+
hasSwitchLayout() {
|
|
61
|
+
return (this.isTabsLayout && this.childWidgets.length > 0)
|
|
62
|
+
|| (this.isGroupTabsLayout && this.groupedWidgets.length > 1)
|
|
63
|
+
},
|
|
57
64
|
childWidgets() {
|
|
58
65
|
return this.widget.widgets || []
|
|
59
66
|
},
|
|
67
|
+
childWidgetMap() {
|
|
68
|
+
const map = {}
|
|
69
|
+
this.childWidgets.forEach(item => {
|
|
70
|
+
if (item && (item.id || item.id === 0)) {
|
|
71
|
+
map[String(item.id)] = item
|
|
72
|
+
}
|
|
73
|
+
})
|
|
74
|
+
return map
|
|
75
|
+
},
|
|
76
|
+
groupConfig() {
|
|
77
|
+
const rawConfig = this.cardOptions.groupConfig
|
|
78
|
+
|| this.cardOptions.group_config
|
|
79
|
+
if (!rawConfig) {
|
|
80
|
+
return []
|
|
81
|
+
}
|
|
82
|
+
let configList = rawConfig
|
|
83
|
+
if (typeof configList === 'string') {
|
|
84
|
+
const trimConfig = configList.trim()
|
|
85
|
+
if (!trimConfig) {
|
|
86
|
+
return []
|
|
87
|
+
}
|
|
88
|
+
try {
|
|
89
|
+
configList = JSON.parse(trimConfig)
|
|
90
|
+
} catch (e) {
|
|
91
|
+
console.error("BiContainerCard -- groupConfig JSON解析异常:", rawConfig, e)
|
|
92
|
+
return []
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (!Array.isArray(configList)) {
|
|
96
|
+
console.warn("BiContainerCard -- groupConfig 不是数组,忽略:", rawConfig)
|
|
97
|
+
return []
|
|
98
|
+
}
|
|
99
|
+
return configList.filter(item => item && item.key !== undefined && item.key !== null && item.key !== '')
|
|
100
|
+
},
|
|
101
|
+
groupedWidgets() {
|
|
102
|
+
const widgetMap = this.childWidgetMap
|
|
103
|
+
return this.groupConfig.map(group => {
|
|
104
|
+
const widgetIds = Array.isArray(group.widgets) ? group.widgets : []
|
|
105
|
+
const widgets = widgetIds
|
|
106
|
+
.map(id => widgetMap[String(id)])
|
|
107
|
+
.filter(Boolean)
|
|
108
|
+
return {
|
|
109
|
+
key: String(group.key),
|
|
110
|
+
title: group.title || group.label || group.name || String(group.key),
|
|
111
|
+
widgets
|
|
112
|
+
}
|
|
113
|
+
})
|
|
114
|
+
},
|
|
115
|
+
switchItems() {
|
|
116
|
+
if (this.isTabsLayout) {
|
|
117
|
+
return this.childWidgets.map((item, index) => ({
|
|
118
|
+
key: index,
|
|
119
|
+
title: this.getWidgetLabel(item, index)
|
|
120
|
+
}))
|
|
121
|
+
}
|
|
122
|
+
if (this.isGroupTabsLayout) {
|
|
123
|
+
return this.groupedWidgets.map(item => ({
|
|
124
|
+
key: item.key,
|
|
125
|
+
title: item.title
|
|
126
|
+
}))
|
|
127
|
+
}
|
|
128
|
+
return []
|
|
129
|
+
},
|
|
60
130
|
visibleWidgets() {
|
|
61
|
-
if (
|
|
62
|
-
return this.childWidgets
|
|
131
|
+
if (this.isTabsLayout) {
|
|
132
|
+
return this.childWidgets[this.activeWidgetIndex]
|
|
133
|
+
? [this.childWidgets[this.activeWidgetIndex]]
|
|
134
|
+
: []
|
|
135
|
+
}
|
|
136
|
+
if (this.isGroupTabsLayout) {
|
|
137
|
+
const groups = this.groupedWidgets
|
|
138
|
+
if (!groups.length) {
|
|
139
|
+
// 分组配置缺失或无效,回退展示全部子组件,避免页面空白
|
|
140
|
+
return this.childWidgets
|
|
141
|
+
}
|
|
142
|
+
const activeGroup = groups.find(item => item.key === this.activeGroupKey) || groups[0]
|
|
143
|
+
return activeGroup ? activeGroup.widgets : []
|
|
144
|
+
}
|
|
145
|
+
return this.childWidgets
|
|
146
|
+
},
|
|
147
|
+
activeSwitchValue: {
|
|
148
|
+
get() {
|
|
149
|
+
return this.isGroupTabsLayout ? this.activeGroupKey : this.activeWidgetIndex
|
|
150
|
+
},
|
|
151
|
+
set(value) {
|
|
152
|
+
if (this.isGroupTabsLayout) {
|
|
153
|
+
this.activeGroupKey = value
|
|
154
|
+
} else {
|
|
155
|
+
this.activeWidgetIndex = value
|
|
156
|
+
}
|
|
63
157
|
}
|
|
64
|
-
return this.childWidgets[this.activeWidgetIndex] ? [this.childWidgets[this.activeWidgetIndex]] : []
|
|
65
158
|
}
|
|
66
159
|
},
|
|
67
160
|
methods: {
|
|
@@ -70,7 +163,13 @@ export default {
|
|
|
70
163
|
return item.name || (item.options && item.options.title) || `组件${index + 1}`
|
|
71
164
|
},
|
|
72
165
|
getWidgetKey(item, index) {
|
|
73
|
-
|
|
166
|
+
if (this.isTabsLayout) {
|
|
167
|
+
return `${this.activeWidgetIndex}_${item.id || index}`
|
|
168
|
+
}
|
|
169
|
+
if (this.isGroupTabsLayout) {
|
|
170
|
+
return `${this.activeGroupKey}_${item.id || index}`
|
|
171
|
+
}
|
|
172
|
+
return item.id || index
|
|
74
173
|
},
|
|
75
174
|
initConfig() {
|
|
76
175
|
if (this.cardOptions) {
|
|
@@ -81,6 +180,21 @@ export default {
|
|
|
81
180
|
this.containerStyle = parseStyleStr(this.cardOptions["style"] || {}) || {}
|
|
82
181
|
}
|
|
83
182
|
}
|
|
183
|
+
this.syncActiveGroupKey()
|
|
184
|
+
},
|
|
185
|
+
syncActiveGroupKey() {
|
|
186
|
+
if (!this.isGroupTabsLayout) {
|
|
187
|
+
return
|
|
188
|
+
}
|
|
189
|
+
const groups = this.groupedWidgets
|
|
190
|
+
if (!groups.length) {
|
|
191
|
+
this.activeGroupKey = ''
|
|
192
|
+
return
|
|
193
|
+
}
|
|
194
|
+
const exists = groups.some(item => item.key === this.activeGroupKey)
|
|
195
|
+
if (!exists) {
|
|
196
|
+
this.activeGroupKey = groups[0].key
|
|
197
|
+
}
|
|
84
198
|
}
|
|
85
199
|
},
|
|
86
200
|
created() {
|
|
@@ -96,6 +210,18 @@ export default {
|
|
|
96
210
|
if (this.activeWidgetIndex >= (val || []).length) {
|
|
97
211
|
this.activeWidgetIndex = 0
|
|
98
212
|
}
|
|
213
|
+
this.syncActiveGroupKey()
|
|
214
|
+
},
|
|
215
|
+
deep: true
|
|
216
|
+
},
|
|
217
|
+
'cardOptions.layout': {
|
|
218
|
+
handler() {
|
|
219
|
+
this.syncActiveGroupKey()
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
groupConfig: {
|
|
223
|
+
handler() {
|
|
224
|
+
this.syncActiveGroupKey()
|
|
99
225
|
},
|
|
100
226
|
deep: true
|
|
101
227
|
}
|
package/package.json
CHANGED
|
@@ -9,17 +9,20 @@
|
|
|
9
9
|
</div>
|
|
10
10
|
</div>
|
|
11
11
|
<div class="node-info">
|
|
12
|
-
<div class="node-title-row">
|
|
12
|
+
<div class="node-title-row" v-if="nodeInfo.taskName">
|
|
13
13
|
<span class="task-name">{{ nodeInfo.taskName }}</span>
|
|
14
14
|
<slot name="extra"></slot>
|
|
15
15
|
</div>
|
|
16
|
+
<div class="node-title-row" v-else>
|
|
17
|
+
<slot name="extra"></slot>
|
|
18
|
+
</div>
|
|
16
19
|
<div
|
|
17
20
|
class="node-user-row"
|
|
18
21
|
v-if="nodeInfo.handleUserName"
|
|
19
22
|
:class="{ 'user-bold': !nodeInfo.taskName }"
|
|
20
23
|
>
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
<span class="user-name">{{ nodeInfo.handleUserName }}</span>
|
|
25
|
+
</div>
|
|
23
26
|
</div>
|
|
24
27
|
</div>
|
|
25
28
|
</template>
|
|
@@ -66,6 +69,18 @@ export default {
|
|
|
66
69
|
margin-right: 12px;
|
|
67
70
|
flex-shrink: 0;
|
|
68
71
|
}
|
|
72
|
+
.avatar-wrapper ::v-deep .ivu-avatar {
|
|
73
|
+
text-align: center !important;
|
|
74
|
+
}
|
|
75
|
+
.avatar-wrapper ::v-deep .ivu-avatar-inner {
|
|
76
|
+
text-align: center !important;
|
|
77
|
+
display: flex !important;
|
|
78
|
+
align-items: center !important;
|
|
79
|
+
justify-content: center !important;
|
|
80
|
+
}
|
|
81
|
+
.avatar-wrapper ::v-deep .ivu-avatar-string {
|
|
82
|
+
left: calc(50% - 10px) !important;
|
|
83
|
+
}
|
|
69
84
|
|
|
70
85
|
.avatar-wrapper >>> .avatar-no-image {
|
|
71
86
|
background: #1890ff !important;
|
|
@@ -435,10 +435,5 @@ export default {
|
|
|
435
435
|
margin: 12px 0 0 0;
|
|
436
436
|
font-size: 14px;
|
|
437
437
|
}
|
|
438
|
-
|
|
439
|
-
display: flex !important;
|
|
440
|
-
align-items: center !important;
|
|
441
|
-
justify-content: center !important;
|
|
442
|
-
text-align: center !important;
|
|
443
|
-
}
|
|
438
|
+
|
|
444
439
|
</style>
|