lambo-design-bi 0.0.176 → 0.0.178
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/bi/widget/charts/index.vue +2 -5
- package/bi/widget/page/index.vue +3 -3
- package/bi/widget/text/text-group.vue +104 -0
- package/bi/widget/util/widget-map.js +2 -0
- package/package.json +1 -1
- package/pub/text/text-obj-group.vue +39 -0
- package/pub/text/text-obj.vue +64 -0
- package/pub/theme/color.js +12 -1
- package/pub/words-info/index.vue +0 -64
|
@@ -106,23 +106,20 @@ export default {
|
|
|
106
106
|
let rows = res.data.data.rows
|
|
107
107
|
if (rows && rows.length > 0) {
|
|
108
108
|
let rowData = rows[0]
|
|
109
|
-
if(rowData && Object.prototype.hasOwnProperty.call(rowData, "
|
|
110
|
-
this.chartsNote = rowData["
|
|
109
|
+
if(rowData && Object.prototype.hasOwnProperty.call(rowData, "val")){
|
|
110
|
+
this.chartsNote = rowData["val"]
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
} else {
|
|
114
114
|
console.warn("charts说明服务[" + this.widget.options.apiId + "]请求数据为空:" + res.data.message)
|
|
115
|
-
this.noteApiId = null
|
|
116
115
|
this.chartsNote = null
|
|
117
116
|
}
|
|
118
117
|
}
|
|
119
118
|
}).catch(err => {
|
|
120
119
|
console.error("charts说明服务[" + this.widget.options.apiId + "]请求异常:", err)
|
|
121
|
-
this.noteApiId = null
|
|
122
120
|
this.chartsNote = null
|
|
123
121
|
})
|
|
124
122
|
}
|
|
125
|
-
|
|
126
123
|
}
|
|
127
124
|
},
|
|
128
125
|
computed: {
|
package/bi/widget/page/index.vue
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<!-- eslint-disable -->
|
|
2
2
|
<template>
|
|
3
3
|
<div>
|
|
4
|
-
<
|
|
5
|
-
<component :is="getWidgetName(item)" :widget="item" :
|
|
4
|
+
<div v-for="(item, index) in widget.widgets" :key="index">
|
|
5
|
+
<component :is="getWidgetName(item)" :widget="item" :params="params">
|
|
6
6
|
<template v-for="slot in Object.keys($scopedSlots)" v-slot:[slot]="scope">
|
|
7
7
|
<slot :name="slot" v-bind="scope" />
|
|
8
8
|
</template>
|
|
9
9
|
</component>
|
|
10
|
-
</
|
|
10
|
+
</div>
|
|
11
11
|
</div>
|
|
12
12
|
</template>
|
|
13
13
|
<script>
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<lambo-text-obj-group-bi :text-obj-list="textList"></lambo-text-obj-group-bi>
|
|
3
|
+
</template>
|
|
4
|
+
<script>
|
|
5
|
+
import LamboTextObjGroupBi from "../../../pub/text/text-obj-group.vue"
|
|
6
|
+
import { getListMapData } from "../api/data"
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
name: 'BiTextGroup',
|
|
10
|
+
components: { LamboTextObjGroupBi },
|
|
11
|
+
props: {
|
|
12
|
+
widget: {
|
|
13
|
+
type: Object,
|
|
14
|
+
default: () => ({})
|
|
15
|
+
},
|
|
16
|
+
params: {
|
|
17
|
+
type: Object,
|
|
18
|
+
default: () => ({})
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
data() {
|
|
22
|
+
return {
|
|
23
|
+
textList: []
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
methods: {
|
|
27
|
+
initConfig() {
|
|
28
|
+
let oldTextList = this.widget.options.textList || []
|
|
29
|
+
let newTextList = oldTextList.map(item => ({
|
|
30
|
+
...item,
|
|
31
|
+
titleStyle: parseStyleString(item.titleStyle),
|
|
32
|
+
valStyle: parseStyleString(item.valStyle)
|
|
33
|
+
}))
|
|
34
|
+
this.textList = newTextList
|
|
35
|
+
},
|
|
36
|
+
async doSearch() {
|
|
37
|
+
if (!this.textList || this.textList.length < 1) {
|
|
38
|
+
this.$Message.warning("组件[" + this.widget.name + "]未配置全")
|
|
39
|
+
return false
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
let apiIdArr = this.textList.map(item => item.apiId) || []
|
|
43
|
+
const promiseArray = apiIdArr.map((apiId, index) => {
|
|
44
|
+
return getListMapData(apiId, this.params)
|
|
45
|
+
.then(res => {
|
|
46
|
+
return { success: true, data: res, apiId, index }
|
|
47
|
+
})
|
|
48
|
+
.catch(err => {
|
|
49
|
+
return { success: false, error: err, apiId, index }
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
const results = await Promise.all(promiseArray)
|
|
55
|
+
results.forEach(result => {
|
|
56
|
+
if (result.success) {
|
|
57
|
+
const res = result.data
|
|
58
|
+
if (res.data.code === 0) {
|
|
59
|
+
console.error(`文字卡片的服务[${result.apiId}]调用失败:${res.data.message}`)
|
|
60
|
+
} else {
|
|
61
|
+
if (res.data.data.rows.length > 0) {
|
|
62
|
+
let row = res.data.data.rows[0]
|
|
63
|
+
if (row) {
|
|
64
|
+
this.$set(this.textList[result.index], 'val', row['val'])
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
console.error(`文字卡片的服务[${result.apiId}]调用异常:`, result.error)
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
} catch (error) {
|
|
73
|
+
console.error("文字卡片批量请求异常:", error)
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
parseStyleString(styleStr) {
|
|
77
|
+
if (typeof styleStr === 'string') {
|
|
78
|
+
try {
|
|
79
|
+
return JSON.parse(styleStr)
|
|
80
|
+
} catch (e) {
|
|
81
|
+
console.warn('样式字符串解析失败:', styleStr)
|
|
82
|
+
return {}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return styleStr || {}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
created() {
|
|
89
|
+
console.log("text-group widget:", this.widget)
|
|
90
|
+
this.initConfig()
|
|
91
|
+
this.doSearch()
|
|
92
|
+
},
|
|
93
|
+
watch: {
|
|
94
|
+
params: {
|
|
95
|
+
handler: function (val, oldVal) {
|
|
96
|
+
console.log('text-group widget watch val,oldVal', val, oldVal)
|
|
97
|
+
this.doSearch()
|
|
98
|
+
},
|
|
99
|
+
deep: true
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
</script>
|
|
104
|
+
<style scoped></style>
|
|
@@ -8,6 +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
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Strictly define the order to prevent circular references. For component reuse, copy new components instead of direct references.
|
|
@@ -18,6 +19,7 @@ export const WIDGET_MAP = {
|
|
|
18
19
|
"33": BiCol,
|
|
19
20
|
"40": BiContainerCard,
|
|
20
21
|
"41": BiNumIndex,
|
|
22
|
+
"46": BiTextGroup,
|
|
21
23
|
"50": BiPagingTable,
|
|
22
24
|
"51": BiDetailTable,
|
|
23
25
|
"60": BiCharts,
|
package/package.json
CHANGED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="text-obj-div" v-for="(item, index) in textObjList" :key="index">
|
|
4
|
+
<lambo-text-obj-bi :title="item.title" :title-style="item.titleStyle || { backgroundColor: defaultTitleColor }"
|
|
5
|
+
:val="item.val" :val-style="item.valStyle || {}"></lambo-text-obj-bi>
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
<script>
|
|
10
|
+
import LamboTextObjBi from './text-obj.vue'
|
|
11
|
+
import { BLUE_COLOR1 } from '../theme/color'
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
name: 'LamboTextObjGroupBi',
|
|
15
|
+
components: { LamboTextObjBi },
|
|
16
|
+
props: {
|
|
17
|
+
textObjList: {
|
|
18
|
+
type: Array,
|
|
19
|
+
default: () => []
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
data() {
|
|
23
|
+
return {
|
|
24
|
+
defaultTitleColor: BLUE_COLOR1
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
</script>
|
|
29
|
+
<style scoped>
|
|
30
|
+
.text-obj-div {
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
margin-bottom: 10px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.text-obj-div:last-child {
|
|
37
|
+
margin-bottom: 0;
|
|
38
|
+
}
|
|
39
|
+
</style>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="text-obj-container">
|
|
3
|
+
<div v-if="title" class="text-title" :style="titleStyle">
|
|
4
|
+
{{ title }}
|
|
5
|
+
</div>
|
|
6
|
+
<p class="text-content" :style="valStyle || {}" v-html="val">
|
|
7
|
+
</p>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
<script>
|
|
11
|
+
import { BLUE_COLOR1 } from '../theme/color'
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
name: 'LamboTextObjBi',
|
|
15
|
+
props: {
|
|
16
|
+
title: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: ""
|
|
19
|
+
},
|
|
20
|
+
val: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: ""
|
|
23
|
+
},
|
|
24
|
+
// 标题样式对象
|
|
25
|
+
titleStyle: {
|
|
26
|
+
type: Object,
|
|
27
|
+
default: () => ({
|
|
28
|
+
backgroundColor: BLUE_COLOR1
|
|
29
|
+
})
|
|
30
|
+
},
|
|
31
|
+
// 内容样式对象
|
|
32
|
+
valStyle: {
|
|
33
|
+
type: Object,
|
|
34
|
+
default: () => ({})
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
</script>
|
|
39
|
+
<style scoped>
|
|
40
|
+
.text-obj-container {
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.text-title {
|
|
46
|
+
width: 150px;
|
|
47
|
+
height: 30px;
|
|
48
|
+
line-height: 30px;
|
|
49
|
+
font-size: 14px;
|
|
50
|
+
font-weight: bold;
|
|
51
|
+
color: #FFFFFF;
|
|
52
|
+
text-align: center;
|
|
53
|
+
border-radius: 6px;
|
|
54
|
+
z-index: 1;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.text-content {
|
|
58
|
+
margin-top: -14px;
|
|
59
|
+
padding: 20px 5px 15px 5px;
|
|
60
|
+
border-radius: 5px;
|
|
61
|
+
line-height: 1.6;
|
|
62
|
+
font-size: 14px;
|
|
63
|
+
}
|
|
64
|
+
</style>
|
package/pub/theme/color.js
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
// 这个color要根据lambo-design和ant-design去合并修改
|
|
3
|
-
export const biColorArr = ['#
|
|
3
|
+
export const biColorArr = ['#57a3f3', '#47cb89', '#FFBF37', '#FD7336', '#655EF3', '#47D791', '#F85968', '#33BFF3', '#C74EF4', '#F84CEE', '#F5D000', '#B7E518']
|
|
4
|
+
|
|
5
|
+
export const PRIMARY_COLOR = '#488aff'
|
|
6
|
+
export const SUCC_COLOR = '#19be6b'
|
|
7
|
+
export const WARNING_COLOR = '#ff9900'
|
|
8
|
+
export const ERR_COLOR = '#ed4014'
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
export const GREEN_COLOR1 = '#21DA2E'
|
|
12
|
+
export const BLUE_COLOR1 = '#1E58F8'
|
|
13
|
+
|
|
14
|
+
export const LIGHT_BLUE_BG_COLOR1 = '#F3F8FE'
|
package/pub/words-info/index.vue
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<div class="words-item" v-for="(item, index) in suggestions" :key="index">
|
|
4
|
-
<div class="words-title" :style="{ background: item.titleBackgroundColor || '#21DA2E' }">
|
|
5
|
-
{{ item.title }}
|
|
6
|
-
</div>
|
|
7
|
-
<div class="words-content">{{ item.content }}</div>
|
|
8
|
-
</div>
|
|
9
|
-
</div>
|
|
10
|
-
</template>
|
|
11
|
-
<script>
|
|
12
|
-
export default {
|
|
13
|
-
name: 'LamboWordsInfoBi',
|
|
14
|
-
props: {
|
|
15
|
-
suggestions: {
|
|
16
|
-
type: Array,
|
|
17
|
-
default: () => [
|
|
18
|
-
{
|
|
19
|
-
title: '旺季建议',
|
|
20
|
-
titleBackgroundColor: '#1E58F8',
|
|
21
|
-
content: '成都市在旺季期间,例如11,12月份,装载率高于90%,建议增加配送车辆,优化路线规划,提高配送效率。成都市在旺季期间,例如11,12月份,装载率高于90%,建议增加配送车辆,优化路线规划,提高配送效率。成都市在旺季期间,例如11,12月份,装载率高于90%,建议增加配送车辆,优化路线规划,提高配送效率。成都市在旺季期间,例如11,12月份,装载率高于90%,建议增加配送车辆,优化路线规划,提高配送效率。成都市在旺季期间,例如11,12月份,装载率高于90%,建议增加配送车辆,优化路线规划,提高配送效率。成都市在旺季期间,例如11,12月份,装载率高于90%,建议增加配送车辆,优化路线规划,提高配送效率。成都市在旺季期间,例如11,12月份,装载率高于90%,建议增加配送车辆,优化路线规划,提高配送效率。'
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
title: '淡季建议',
|
|
25
|
-
titleBackgroundColor: '#21DA2E',
|
|
26
|
-
content: '成都市在旺季期间,例如11,12月份,装载率高于90%,建议增加配送车辆,优化路线规划,提高配送效率。成都市在旺季期间,例如11,12月份,装载率高于90%,建议增加配送车辆,优化路线规划,提高配送效率。成都市在旺季期间,例如11,12月份,装载率高于90%,建议增加配送车辆,优化路线规划,提高配送效率。'
|
|
27
|
-
}
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
</script>
|
|
33
|
-
<style scoped>
|
|
34
|
-
.words-item {
|
|
35
|
-
display: flex;
|
|
36
|
-
flex-direction: column;
|
|
37
|
-
margin-bottom: 15px;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.words-item:last-child {
|
|
41
|
-
margin-bottom: 0;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.words-title {
|
|
45
|
-
width: 150px;
|
|
46
|
-
height: 30px;
|
|
47
|
-
line-height: 30px;
|
|
48
|
-
font-size: 14px;
|
|
49
|
-
font-weight: bold;
|
|
50
|
-
color: #FFFFFF;
|
|
51
|
-
text-align: center;
|
|
52
|
-
border-radius: 6px;
|
|
53
|
-
z-index: 1;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.words-content {
|
|
57
|
-
margin-top: -14px;
|
|
58
|
-
padding: 20px 5px 15px 5px;
|
|
59
|
-
background: #F3F8FE;
|
|
60
|
-
border-radius: 5px;
|
|
61
|
-
line-height: 1.6;
|
|
62
|
-
font-size: 14px;
|
|
63
|
-
}
|
|
64
|
-
</style>
|