lambo-design-bi 0.0.1
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/README.md +18 -0
- package/bi/widget/api/data.js +48 -0
- package/bi/widget/atom/index.vue +36 -0
- package/bi/widget/atom/test.vue +36 -0
- package/bi/widget/config/config.js +7 -0
- package/bi/widget/container/card/card-widget.vue +46 -0
- package/bi/widget/container/card/comps/indicator-card/index.js +7 -0
- package/bi/widget/container/card/comps/indicator-card/src/indicator-card-bi-search.vue +132 -0
- package/bi/widget/container/card/comps/indicator-card/src/indicator-card-bi.vue +129 -0
- package/bi/widget/container/card/comps/indicator-card/src/indicator-card-item-bi.vue +97 -0
- package/bi/widget/container/card/comps/indicator-card/src/styles/css/card-search.less +108 -0
- package/bi/widget/container/card/comps/indicator-card/src/styles/css/card.less +114 -0
- package/bi/widget/layout/col.vue +35 -0
- package/bi/widget/layout/row.vue +40 -0
- package/bi/widget/num/index.vue +101 -0
- package/bi/widget/page/index.vue +38 -0
- package/bi/widget/search/search-form.vue +85 -0
- package/bi/widget/search/search-item.vue +205 -0
- package/bi/widget/table/detail-table.vue +65 -0
- package/bi/widget/table/paging-table.vue +188 -0
- package/bi/widget/util/widget-map.js +41 -0
- package/package.json +39 -0
- package/pub/charts/echarts.vue +57 -0
- package/pub/charts/factory/charts-factory.vue +58 -0
- package/pub/charts/factory/options.js +2351 -0
- package/pub/empty/index.vue +33 -0
- package/pub/helpbox/README.md +6 -0
- package/pub/helpbox/index.vue +363 -0
- package/pub/num-index/num-index.vue +120 -0
- package/pub/table/detail-table/index.vue +41 -0
- package/pub/table/paging-table/README.md +4 -0
- package/pub/table/paging-table/comps/export-data.vue +390 -0
- package/pub/table/paging-table/comps/export-drawer.vue +429 -0
- package/pub/table/paging-table/index.js +3 -0
- package/pub/table/paging-table/index.vue +1577 -0
- package/pub/table/paging-table/styles/css/index.less +190 -0
- package/pub/theme/color.js +3 -0
- package/util/math-util.js +71 -0
- package/util/num-util.js +16 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div style="width: 100%">
|
|
3
|
+
<LamboPagingTableBi ref="table" :auto-search="false" :columns="columns" :dataUrl="widget.options.url"
|
|
4
|
+
:export-batch-size="20000" :show-table-option="true" :exportName="widget.name"
|
|
5
|
+
:page-disable="widget.options.isPaging === '0'" :page-size="widget.options.pageSize" :export-request-limit="200"
|
|
6
|
+
:isSingleSelectModel="true" :showSummary="widget.options.isPageSum === '1'" :summary-method="handleSummary"
|
|
7
|
+
@on-data-load="onDataLoad" :searchParams="tableSearchParams">
|
|
8
|
+
<div slot="search"></div>
|
|
9
|
+
</LamboPagingTableBi>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
<script>
|
|
13
|
+
import biConfig from '../config/config'
|
|
14
|
+
import { getListMapData } from '../api/data'
|
|
15
|
+
import LamboPagingTableBi from '../../../pub/table/paging-table/index.vue'
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
name: 'BiPagingTable',
|
|
19
|
+
components: { LamboPagingTableBi },
|
|
20
|
+
props: {
|
|
21
|
+
widget: {
|
|
22
|
+
type: Object,
|
|
23
|
+
default: () => ({})
|
|
24
|
+
},
|
|
25
|
+
params: {
|
|
26
|
+
type: Object,
|
|
27
|
+
default: () => ({})
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
data() {
|
|
31
|
+
return {
|
|
32
|
+
tableSearchParams: {
|
|
33
|
+
inJson: ''
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
methods: {
|
|
38
|
+
doSearch() {
|
|
39
|
+
console.log("BiPagingTable -- doSearch -- params:", this.params)
|
|
40
|
+
this.$set(this.tableSearchParams, 'inJson', this.params)
|
|
41
|
+
},
|
|
42
|
+
goDetail(routerName, pageId, row) {
|
|
43
|
+
let newQuery = Object.assign({}, this.params, row);
|
|
44
|
+
newQuery['pageId'] = pageId
|
|
45
|
+
console.log("goDetail newQuery:", newQuery)
|
|
46
|
+
console.log("goDetail routerName:", routerName)
|
|
47
|
+
this.$router.push({
|
|
48
|
+
name: routerName,
|
|
49
|
+
query: newQuery
|
|
50
|
+
})
|
|
51
|
+
},
|
|
52
|
+
onDataLoad() {
|
|
53
|
+
if (this.widget.options.isAllSum === '1' && this.widget.options.sumApiId !== '' && this.$refs.table.tableData.length > 0) {
|
|
54
|
+
getListMapData(this.widget.options.sumApiId, this.params).then(res => {
|
|
55
|
+
if (res.data.code === 0) {
|
|
56
|
+
console.error("调用总计服务[" + this.widget.options.sumApiId + "]失败:" + res.data.message)
|
|
57
|
+
} else {
|
|
58
|
+
if (res.data.data.rows.length > 0) {
|
|
59
|
+
let sumRows = res.data.data.rows[0];
|
|
60
|
+
if (this.columns.length > 0) {
|
|
61
|
+
console.log(JSON.stringify(this.columns))
|
|
62
|
+
if (this.columns[0].key === 'index' || this.columns[0].key === 'checkbox') {
|
|
63
|
+
sumRows[this.columns[1].key] = '总计';
|
|
64
|
+
} else {
|
|
65
|
+
sumRows[this.columns[0].key] = '总计';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
sumRows.is_append_page_all_sum = true;
|
|
69
|
+
this.$refs.table.tableData.push(sumRows)
|
|
70
|
+
console.log("列表增加总计成功")
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}).catch(err => {
|
|
74
|
+
console.error("调用总计服务[" + this.widget.options.sumApiId + "]异常:", err)
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
/*合计 根据columns中的hasSum是否合计来进行计算*/
|
|
79
|
+
handleSummary({ columns, data }) {
|
|
80
|
+
const sums = {};
|
|
81
|
+
let tempData = [...data];
|
|
82
|
+
if (tempData.length > 0 && tempData[tempData.length - 1].is_append_page_all_sum) {
|
|
83
|
+
tempData.pop();
|
|
84
|
+
}
|
|
85
|
+
columns.forEach((column, index) => {
|
|
86
|
+
const key = column.key;
|
|
87
|
+
const hasSum = column.hasSum;
|
|
88
|
+
if (hasSum === 'true') {
|
|
89
|
+
const values = tempData.map(item => Number(item[key]));
|
|
90
|
+
if (!values.every(value => isNaN(value))) {
|
|
91
|
+
const v = values.reduce((prev, curr) => {
|
|
92
|
+
const value = Number(curr);
|
|
93
|
+
if (!isNaN(value)) {
|
|
94
|
+
return prev + curr;
|
|
95
|
+
} else {
|
|
96
|
+
return prev;
|
|
97
|
+
}
|
|
98
|
+
}, 0);
|
|
99
|
+
sums[key] = {
|
|
100
|
+
key,
|
|
101
|
+
value: v
|
|
102
|
+
};
|
|
103
|
+
} else {
|
|
104
|
+
sums[key] = {
|
|
105
|
+
key,
|
|
106
|
+
value: ''
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
} else {
|
|
110
|
+
if (key === 'index' || key === 'checkbox') {
|
|
111
|
+
sums[key] = {
|
|
112
|
+
key,
|
|
113
|
+
value: '合计'
|
|
114
|
+
};
|
|
115
|
+
} else if (index === 0) {
|
|
116
|
+
sums[key] = {
|
|
117
|
+
key,
|
|
118
|
+
value: '合计'
|
|
119
|
+
};
|
|
120
|
+
} else {
|
|
121
|
+
sums[key] = {
|
|
122
|
+
key,
|
|
123
|
+
value: ''
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
return sums;
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
created() {
|
|
132
|
+
// eslint-disable-next-line
|
|
133
|
+
this.widget.options.url = biConfig.dataServerContext + biConfig.dataServiceUri + this.widget.options.apiId
|
|
134
|
+
console.log("BiPagingTable -- created() -- this.widget:", this.widget)
|
|
135
|
+
},
|
|
136
|
+
mounted() {
|
|
137
|
+
this.doSearch()
|
|
138
|
+
},
|
|
139
|
+
computed: {
|
|
140
|
+
columns() {
|
|
141
|
+
let columns = []
|
|
142
|
+
if (this.widget &&
|
|
143
|
+
Object.prototype.hasOwnProperty.call(this.widget, "options") &&
|
|
144
|
+
Object.prototype.hasOwnProperty.call(this.widget.options, "columns")) {
|
|
145
|
+
if (this.widget.options.columns) {
|
|
146
|
+
try {
|
|
147
|
+
columns = JSON.parse(this.widget.options.columns)
|
|
148
|
+
columns.forEach((column) => {
|
|
149
|
+
if (column.detailName && column.pageId) {
|
|
150
|
+
let self = this
|
|
151
|
+
column.render = function (h, params) {
|
|
152
|
+
return h(
|
|
153
|
+
"a",
|
|
154
|
+
{
|
|
155
|
+
on: {
|
|
156
|
+
click: () => {
|
|
157
|
+
self.goDetail(params.column.detailName, params.column.pageId, params.row);
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
params.row[params.column.key]
|
|
162
|
+
);
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
} catch (e) {
|
|
167
|
+
console.log("BiPagingTable -- columns() -- this.widget.options.columns:", this.widget.options.columns)
|
|
168
|
+
console.error("BiPagingTable -- columns() JSON解析异常:", e)
|
|
169
|
+
this.$Message.info("表格头配置数据解析异常")
|
|
170
|
+
columns = []
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return columns
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
watch: {
|
|
178
|
+
params: {
|
|
179
|
+
handler: function (val, oldVal) {
|
|
180
|
+
console.log('watch val,oldVal', val, oldVal)
|
|
181
|
+
this.doSearch()
|
|
182
|
+
},
|
|
183
|
+
deep: true
|
|
184
|
+
},
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
</script>
|
|
188
|
+
<style scoped></style>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import BiEmpty from "../../../pub/empty/index.vue"
|
|
2
|
+
import BiPagingTable from "../table/paging-table.vue"
|
|
3
|
+
import BiContainerCard from "../container/card/card-widget.vue"
|
|
4
|
+
import BiNumIndex from "../num/index.vue"
|
|
5
|
+
import BiRow from "../layout/row.vue"
|
|
6
|
+
import BiCol from "../layout/col.vue"
|
|
7
|
+
import BiPage from "../page/index.vue"
|
|
8
|
+
import BiDetailTable from "../table/detail-table.vue"
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Strictly define the order to prevent circular references. For component reuse, copy new components instead of direct references.
|
|
12
|
+
*/
|
|
13
|
+
export const WIDGET_MAP = {
|
|
14
|
+
"20": BiPage,
|
|
15
|
+
"32": BiRow,
|
|
16
|
+
"33": BiCol,
|
|
17
|
+
"40": BiContainerCard,
|
|
18
|
+
"41": BiNumIndex,
|
|
19
|
+
"50": BiPagingTable,
|
|
20
|
+
"51": BiDetailTable,
|
|
21
|
+
"_empty": BiEmpty,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function getWidgetName(item) {
|
|
25
|
+
let type = item.type
|
|
26
|
+
if (type && Object.prototype.hasOwnProperty.call(WIDGET_MAP, type) && WIDGET_MAP[type]) {
|
|
27
|
+
return WIDGET_MAP[type]
|
|
28
|
+
} else {
|
|
29
|
+
console.warn(`未找到type=${type}对应的组件,使用默认组件`)
|
|
30
|
+
console.log('getWidgetName item=', item)
|
|
31
|
+
console.log('getWidgetName type=', type)
|
|
32
|
+
console.log('getWidgetName WIDGET_MAP=', WIDGET_MAP)
|
|
33
|
+
if (type && Object.prototype.hasOwnProperty.call(WIDGET_MAP, type)) {
|
|
34
|
+
console.log('getWidgetName 类型包含组件但未成功获取 WIDGET_MAP[type]=', WIDGET_MAP[type])
|
|
35
|
+
} else {
|
|
36
|
+
console.log('getWidgetName 类型无效值或者不包含 type=', type)
|
|
37
|
+
}
|
|
38
|
+
return WIDGET_MAP['_empty']
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lambo-design-bi",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"author": "finch",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public",
|
|
10
|
+
"registry": "https://registry.npmjs.org/",
|
|
11
|
+
"files": [
|
|
12
|
+
"!**/.*",
|
|
13
|
+
"!**/CHANGELOG.md",
|
|
14
|
+
"**/*"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@lambo-design/core": "^4.7.1-beta.162",
|
|
19
|
+
"@lambo-design/file-list": "^1.0.0-beta.9",
|
|
20
|
+
"@lambo-design/percent-progress": "^1.0.0-beta.9",
|
|
21
|
+
"@lambo-design/shared": "^1.0.0-beta.283",
|
|
22
|
+
"@lambo-design/query-filter": "^1.0.0-beta.38",
|
|
23
|
+
"@lambo-design/detail-table": "^1.0.0-beta.23",
|
|
24
|
+
"axios": "1.6.7",
|
|
25
|
+
"core-js": "^3.8.3",
|
|
26
|
+
"echarts": "^4.8.0",
|
|
27
|
+
"element-ui": "^2.15.14",
|
|
28
|
+
"moment": "^2.30.1",
|
|
29
|
+
"xlsx": "^0.13.3",
|
|
30
|
+
"xlsx-style": "^0.8.13",
|
|
31
|
+
"jszip": "^3.5.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"less": "^4.4.0",
|
|
35
|
+
"less-loader": "^12.3.0",
|
|
36
|
+
"vue": "^2.6.14"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {}
|
|
39
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="chartContainer" :style="{ width: '100%', height: height }"></div>
|
|
3
|
+
</template>
|
|
4
|
+
<script>
|
|
5
|
+
import * as echarts from 'echarts'
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
name: 'LamboCharts',
|
|
9
|
+
props: {
|
|
10
|
+
options: {
|
|
11
|
+
type: Object,
|
|
12
|
+
default: () => ({})
|
|
13
|
+
},
|
|
14
|
+
height: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: '300px'
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
data() {
|
|
20
|
+
return {
|
|
21
|
+
chart: null
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
mounted() {
|
|
25
|
+
this.initChart();
|
|
26
|
+
},
|
|
27
|
+
watch: {
|
|
28
|
+
options: {
|
|
29
|
+
handler(newOptions) {
|
|
30
|
+
if (this.chart) {
|
|
31
|
+
this.chart.setOption(newOptions)
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
deep: true,
|
|
35
|
+
immediate: true
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
methods: {
|
|
39
|
+
initChart() {
|
|
40
|
+
if (!this.chart) {
|
|
41
|
+
const container = this.$refs.chartContainer
|
|
42
|
+
if (container) {
|
|
43
|
+
this.chart = echarts.init(container)
|
|
44
|
+
this.chart.setOption(this.options || {})
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
beforeDestroy() {
|
|
50
|
+
if (this.chart) {
|
|
51
|
+
this.chart.dispose()
|
|
52
|
+
this.chart = null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
</script>
|
|
57
|
+
<style scoped></style>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<lambo-charts :options="getOptions"></lambo-charts>
|
|
3
|
+
</template>
|
|
4
|
+
<script>
|
|
5
|
+
import LamboCharts from "../echarts.vue"
|
|
6
|
+
import { getECharts } from "./options"
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
name: "LamboChartsFactory",
|
|
10
|
+
components: { LamboCharts },
|
|
11
|
+
props: {
|
|
12
|
+
type: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: ''
|
|
15
|
+
},
|
|
16
|
+
dataX: {
|
|
17
|
+
type: Array,
|
|
18
|
+
default: () => ([])
|
|
19
|
+
},
|
|
20
|
+
dataY: {
|
|
21
|
+
type: Array,
|
|
22
|
+
default: () => ([])
|
|
23
|
+
},
|
|
24
|
+
dataZ: {
|
|
25
|
+
type: Array,
|
|
26
|
+
default: () => ([])
|
|
27
|
+
},
|
|
28
|
+
dataDim: {
|
|
29
|
+
type: Array,
|
|
30
|
+
default: () => ([])
|
|
31
|
+
},
|
|
32
|
+
height: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: '300px'
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
data() {
|
|
38
|
+
return {
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
methods: {
|
|
43
|
+
|
|
44
|
+
},
|
|
45
|
+
computed: {
|
|
46
|
+
getOptions() {
|
|
47
|
+
return getECharts(this.type, this.dataX, this.dataY, this.dataDim, this.dataZ)
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
created() {
|
|
51
|
+
|
|
52
|
+
},
|
|
53
|
+
mounted() {
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
</script>
|
|
58
|
+
<style scoped></style>
|