lambo-design-bi 0.0.106 → 0.0.108
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/api/config.js +19 -0
- package/bi/widget/page/child-page-tm.vue +192 -0
- package/bi/widget/page/index-page-tm.vue +102 -0
- package/bi/widget/page/index.vue +3 -2
- package/bi/widget/search/search-form.vue +2 -1
- package/bi/widget/util/widget-map.js +0 -5
- package/package.json +2 -1
- package/util/constants.js +40 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import biConfig from "../config/config";
|
|
2
|
+
import ajax from "@lambo-design/shared/utils/ajax";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 获取页面配置
|
|
6
|
+
*
|
|
7
|
+
* @param {*} pageId
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
export function getPageConfig(pageId) {
|
|
11
|
+
const params = {
|
|
12
|
+
pageId: pageId
|
|
13
|
+
}
|
|
14
|
+
return ajax.request({
|
|
15
|
+
url: biConfig.dataServerContext + '/bi/config/page',
|
|
16
|
+
method: 'get',
|
|
17
|
+
params
|
|
18
|
+
})
|
|
19
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<LamboPageContainer :has-footer="false" :has-header="true">
|
|
3
|
+
<template #page-title>{{ childPageWidget.options.title || '' }}</template>
|
|
4
|
+
<template #page-extend>
|
|
5
|
+
<Button @click="goBack" type="primary" class="btn-margin" ghost>返回</Button>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<LamboIndicatorCardBiSearch v-if="childPageWidget && childPageWidget.search" :has-extend="false" :has-title="false">
|
|
9
|
+
<BiSearchForm v-if="childPageWidget && childPageWidget.search" :widget="childPageWidget.search"
|
|
10
|
+
@on-search="doSearch">
|
|
11
|
+
</BiSearchForm>
|
|
12
|
+
</LamboIndicatorCardBiSearch>
|
|
13
|
+
|
|
14
|
+
<BiPage :widget="childPageWidget" :params="params"></BiPage>
|
|
15
|
+
|
|
16
|
+
</LamboPageContainer>
|
|
17
|
+
</template>
|
|
18
|
+
<script>
|
|
19
|
+
import LamboPageContainer from '@lambo-design/page-container'
|
|
20
|
+
import BiSearchForm from '../search/search-form.vue'
|
|
21
|
+
import LamboIndicatorCardBiSearch from '../container/card/comps/indicator-card/src/indicator-card-bi-search.vue'
|
|
22
|
+
import BiPage from './index.vue'
|
|
23
|
+
import { getPageConfig } from '../api/config'
|
|
24
|
+
import { deepCopy } from "@lambo-design/shared/utils/assist"
|
|
25
|
+
import { SEARCH_DICT } from '@/components/lambo/util/constants'
|
|
26
|
+
import moment from "moment/moment"
|
|
27
|
+
import { DATE_RANGE_PFIX } from '@/components/lambo/util/constants'
|
|
28
|
+
|
|
29
|
+
export default {
|
|
30
|
+
name: 'BiChildPageTm',
|
|
31
|
+
components: { LamboPageContainer, BiSearchForm, LamboIndicatorCardBiSearch, BiPage },
|
|
32
|
+
props: {},
|
|
33
|
+
data() {
|
|
34
|
+
return {
|
|
35
|
+
childPageWidget: {},
|
|
36
|
+
params: {},
|
|
37
|
+
pageId: ''
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
methods: {
|
|
41
|
+
getConfig() {
|
|
42
|
+
// 从路由参数中获取pageId
|
|
43
|
+
console.log("child-page-tm getConfig this.$route.query:", this.$route.query)
|
|
44
|
+
this.pageId = this.$route.query.pageId || ''
|
|
45
|
+
if (!this.pageId) {
|
|
46
|
+
console.error("pageId为空,请检查菜单配置:", this.pageId)
|
|
47
|
+
this.$Message.error('pageId为空,请检查菜单配置')
|
|
48
|
+
return false
|
|
49
|
+
}
|
|
50
|
+
// 获取页面配置
|
|
51
|
+
getPageConfig(this.pageId).then(res => {
|
|
52
|
+
if (res.data.code !== 1) {
|
|
53
|
+
console.error("获取页面配置[" + this.pageId + "]失败:" + res.data.message)
|
|
54
|
+
} else {
|
|
55
|
+
if (res.data.data) {
|
|
56
|
+
let pageWidgetTree = deepCopy(res.data.data)
|
|
57
|
+
console.log("获取页面配置 1:", pageWidgetTree)
|
|
58
|
+
this.setRouteConfig2Search(pageWidgetTree)
|
|
59
|
+
console.log("获取页面配置 2:", pageWidgetTree)
|
|
60
|
+
this.childPageWidget = deepCopy(pageWidgetTree)
|
|
61
|
+
} else {
|
|
62
|
+
console.error("获取页面配置[" + this.pageId + "]失败:配置数据为空")
|
|
63
|
+
return
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}).catch(err => {
|
|
67
|
+
console.error("获取页面配置[" + this.pageId + "]异常:", err)
|
|
68
|
+
})
|
|
69
|
+
},
|
|
70
|
+
goBack() {
|
|
71
|
+
this.$router.go(-1)
|
|
72
|
+
// TODO: 或者跳转到指定路由
|
|
73
|
+
// name从路由里面取
|
|
74
|
+
// this.$router.push({ name: 'xxx' })
|
|
75
|
+
},
|
|
76
|
+
doSearch(params) {
|
|
77
|
+
console.log("child-page-tm doSearch params:", params)
|
|
78
|
+
console.log("child-page-tm doSearch this.childPageWidget:", this.childPageWidget)
|
|
79
|
+
let emptySearchArr = []
|
|
80
|
+
// 增加前端校验是否必传
|
|
81
|
+
let searchConfig = this.childPageWidget.search
|
|
82
|
+
if (searchConfig && Object.prototype.hasOwnProperty.call(searchConfig, "widgets") && searchConfig.widgets) {
|
|
83
|
+
for (let i = 0; i < searchConfig.widgets.length; i++) {
|
|
84
|
+
let oneSearch = searchConfig.widgets[i]
|
|
85
|
+
console.log("child-page-tm doSearch oneSearch:", oneSearch)
|
|
86
|
+
if (oneSearch && oneSearch.options.isRequired === '1' && oneSearch.options.qKey) {
|
|
87
|
+
// 时间范围选择框
|
|
88
|
+
if (oneSearch.options.searchType && oneSearch.options.searchType === SEARCH_DICT.MUlTI_DATE.id) {
|
|
89
|
+
if (!params[oneSearch.options.qKey + DATE_RANGE_PFIX.START] || !params[oneSearch.options.qKey + DATE_RANGE_PFIX.END]) {
|
|
90
|
+
emptySearchArr.push(oneSearch.name)
|
|
91
|
+
}
|
|
92
|
+
} else {
|
|
93
|
+
if (!params[oneSearch.options.qKey]) {
|
|
94
|
+
emptySearchArr.push(oneSearch.name)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (emptySearchArr.length > 0) {
|
|
101
|
+
console.log("必选查询条件为空:", emptySearchArr)
|
|
102
|
+
this.$Message.warning({ content: "必选查询条件" + emptySearchArr.join() + "为空,请选择", duration: 1.8 })
|
|
103
|
+
return
|
|
104
|
+
}
|
|
105
|
+
this.params = deepCopy(params)
|
|
106
|
+
},
|
|
107
|
+
setRouteConfig2Search(widgetData) {
|
|
108
|
+
let routeConfig = this.$route.query || {}
|
|
109
|
+
console.log("child-page-tm setRouteConfig2Search -- routeConfig:", routeConfig)
|
|
110
|
+
console.log("child-page-tm setRouteConfig2Search -- widgetData:", widgetData)
|
|
111
|
+
if (routeConfig && widgetData && widgetData.search && widgetData.search.widgets) {
|
|
112
|
+
widgetData.search.widgets.map(item => {
|
|
113
|
+
if (item.options && Object.prototype.hasOwnProperty.call(item.options, "qKey") && item.options['qKey']) {
|
|
114
|
+
let searchType = item.options['searchType']
|
|
115
|
+
let qKey = item.options['qKey']
|
|
116
|
+
if (searchType === SEARCH_DICT.INPUT.id) {
|
|
117
|
+
item['val'] = routeConfig[qKey]
|
|
118
|
+
} else if (searchType === SEARCH_DICT.SINGLE_SELECT.id) {
|
|
119
|
+
let val = routeConfig[qKey]
|
|
120
|
+
let valName = ''
|
|
121
|
+
let selDataList = item.options['dataList']
|
|
122
|
+
if (val && selDataList) {
|
|
123
|
+
for (let i = 0; i < selDataList.length; i++) {
|
|
124
|
+
let selDataItem = selDataList[i]
|
|
125
|
+
if (selDataItem && Object.prototype.hasOwnProperty.call(selDataItem, "K") && Object.prototype.hasOwnProperty.call(selDataItem, "V")) {
|
|
126
|
+
if (selDataItem['K'] && selDataItem['K'] === val) {
|
|
127
|
+
valName = selDataItem['V']
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (valName) {
|
|
133
|
+
item['val'] = val
|
|
134
|
+
item['valName'] = valName
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
} else if (searchType === SEARCH_DICT.MUlTI_SELECT.id) {
|
|
138
|
+
let val = routeConfig[qKey]
|
|
139
|
+
let valNameArr = []
|
|
140
|
+
let selDataList = item.options['dataList']
|
|
141
|
+
if (val && selDataList) {
|
|
142
|
+
let valArr = val.split(',')
|
|
143
|
+
for (let i = 0; i < selDataList.length; i++) {
|
|
144
|
+
let selDataItem = selDataList[i]
|
|
145
|
+
if (selDataItem && Object.prototype.hasOwnProperty.call(selDataItem, "K") && Object.prototype.hasOwnProperty.call(selDataItem, "V")) {
|
|
146
|
+
if (selDataItem['K'] && valArr.includes(selDataItem['K'])) {
|
|
147
|
+
valNameArr.push(selDataItem['V'])
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (valNameArr && valNameArr.length > 0) {
|
|
152
|
+
item['val'] = val
|
|
153
|
+
item['valName'] = valNameArr.join()
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
} else if (searchType === SEARCH_DICT.SINGLE_DATE.id) {
|
|
157
|
+
let val = routeConfig[qKey]
|
|
158
|
+
if (val && val.indexOf('-') > 0) {
|
|
159
|
+
val = moment(val).format("YYYYMMDD")
|
|
160
|
+
}
|
|
161
|
+
item['val'] = val
|
|
162
|
+
} else if (searchType === SEARCH_DICT.MUlTI_DATE.id) {
|
|
163
|
+
console.log("detail -- getPageConfig -- routeConfig:", routeConfig)
|
|
164
|
+
let startDate = routeConfig[qKey + '_start']
|
|
165
|
+
console.log("detail -- getPageConfig -- startDate:", startDate)
|
|
166
|
+
if (startDate.indexOf('-') > 0) {
|
|
167
|
+
startDate = moment(startDate).format("YYYYMMDD") || ''
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
let endDate = routeConfig[qKey + '_end']
|
|
171
|
+
console.log("detail -- getPageConfig -- endDate:", endDate)
|
|
172
|
+
if (endDate.indexOf('-')) {
|
|
173
|
+
endDate = moment(endDate).format("YYYYMMDD") || ''
|
|
174
|
+
}
|
|
175
|
+
if (startDate && endDate) {
|
|
176
|
+
item.options['val'] = [startDate, endDate]
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
})
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
created() {
|
|
185
|
+
this.getConfig()
|
|
186
|
+
},
|
|
187
|
+
mounted() {
|
|
188
|
+
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
</script>
|
|
192
|
+
<style scoped></style>
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<LamboPageContainer :has-footer="false" :has-header="pageWidget.options.title ? true : false">
|
|
3
|
+
<template #page-title>{{ pageWidget.options.title }}</template>
|
|
4
|
+
|
|
5
|
+
<LamboIndicatorCardBiSearch v-if="pageWidget && pageWidget.search" :has-extend="false" :has-title="false">
|
|
6
|
+
<BiSearchForm v-if="pageWidget && pageWidget.search" :widget="pageWidget.search" @on-search="doSearch">
|
|
7
|
+
</BiSearchForm>
|
|
8
|
+
</LamboIndicatorCardBiSearch>
|
|
9
|
+
|
|
10
|
+
<BiPage :widget="pageWidget" :params="params"></BiPage>
|
|
11
|
+
</LamboPageContainer>
|
|
12
|
+
</template>
|
|
13
|
+
<script>
|
|
14
|
+
import LamboPageContainer from '@lambo-design/page-container'
|
|
15
|
+
import BiSearchForm from '../search/search-form.vue'
|
|
16
|
+
import LamboIndicatorCardBiSearch from '../container/card/comps/indicator-card/src/indicator-card-bi-search.vue'
|
|
17
|
+
import BiPage from './index.vue'
|
|
18
|
+
import { getPageConfig } from '../api/config'
|
|
19
|
+
import { deepCopy } from "@lambo-design/shared/utils/assist"
|
|
20
|
+
import { SEARCH_DICT } from '@/components/lambo/util/constants'
|
|
21
|
+
import { DATE_RANGE_PFIX } from '@/components/lambo/util/constants'
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
name: 'BiIndexPageTm',
|
|
25
|
+
components: { LamboPageContainer, BiSearchForm, LamboIndicatorCardBiSearch, BiPage },
|
|
26
|
+
props: {},
|
|
27
|
+
data() {
|
|
28
|
+
return {
|
|
29
|
+
pageWidget: {},
|
|
30
|
+
params: {},
|
|
31
|
+
pageId: ''
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
methods: {
|
|
35
|
+
getConfig() {
|
|
36
|
+
// 从路由参数中获取pageId
|
|
37
|
+
console.log("index-page-tm getConfig this.$route.query:", this.$route.query)
|
|
38
|
+
this.pageId = this.$route.query.pageId || ''
|
|
39
|
+
if (!this.pageId) {
|
|
40
|
+
console.error("pageId为空,请检查菜单配置:", this.pageId)
|
|
41
|
+
this.$Message.error('pageId为空,请检查菜单配置')
|
|
42
|
+
return false
|
|
43
|
+
}
|
|
44
|
+
// 获取页面配置
|
|
45
|
+
getPageConfig(this.pageId).then(res => {
|
|
46
|
+
if (res.data.code !== 1) {
|
|
47
|
+
console.error("获取页面配置[" + this.pageId + "]失败:" + res.data.message)
|
|
48
|
+
} else {
|
|
49
|
+
let pageWidgetTree = res.data.data
|
|
50
|
+
if (pageWidgetTree) {
|
|
51
|
+
this.pageWidget = deepCopy(pageWidgetTree)
|
|
52
|
+
console.log("获取页面配置成功:", this.pageWidget)
|
|
53
|
+
} else {
|
|
54
|
+
console.error("获取页面配置[" + this.pageId + "]失败:配置数据为空")
|
|
55
|
+
return
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}).catch(err => {
|
|
59
|
+
console.error("获取页面配置[" + this.pageId + "]异常:", err)
|
|
60
|
+
})
|
|
61
|
+
},
|
|
62
|
+
doSearch(params) {
|
|
63
|
+
console.log("index-page-tm doSearch params:", params)
|
|
64
|
+
console.log("index-page-tm doSearch this.pageWidget:", this.pageWidget)
|
|
65
|
+
let emptySearchArr = []
|
|
66
|
+
// 增加前端校验是否必传
|
|
67
|
+
let searchConfig = this.pageWidget.search
|
|
68
|
+
if (searchConfig && Object.prototype.hasOwnProperty.call(searchConfig, "widgets") && searchConfig.widgets) {
|
|
69
|
+
for (let i = 0; i < searchConfig.widgets.length; i++) {
|
|
70
|
+
let oneSearch = searchConfig.widgets[i]
|
|
71
|
+
console.log("index-page-tm doSearch oneSearch:", oneSearch)
|
|
72
|
+
if (oneSearch && oneSearch.options.isRequired === '1' && oneSearch.options.qKey) {
|
|
73
|
+
// 时间范围选择框
|
|
74
|
+
if (oneSearch.options.searchType && oneSearch.options.searchType === SEARCH_DICT.MUlTI_DATE.id) {
|
|
75
|
+
if (!params[oneSearch.options.qKey + DATE_RANGE_PFIX.START] || !params[oneSearch.options.qKey + DATE_RANGE_PFIX.END]) {
|
|
76
|
+
emptySearchArr.push(oneSearch.name)
|
|
77
|
+
}
|
|
78
|
+
} else {
|
|
79
|
+
if (!params[oneSearch.options.qKey]) {
|
|
80
|
+
emptySearchArr.push(oneSearch.name)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (emptySearchArr.length > 0) {
|
|
87
|
+
console.log("必选查询条件为空:", emptySearchArr)
|
|
88
|
+
this.$Message.warning({ content: "必选查询条件" + emptySearchArr.join() + "为空,请选择", duration: 1.8 })
|
|
89
|
+
return
|
|
90
|
+
}
|
|
91
|
+
this.params = deepCopy(params)
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
created() {
|
|
95
|
+
this.getConfig()
|
|
96
|
+
},
|
|
97
|
+
mounted() {
|
|
98
|
+
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
</script>
|
|
102
|
+
<style scoped></style>
|
package/bi/widget/page/index.vue
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
</div>
|
|
11
11
|
</template>
|
|
12
12
|
<script>
|
|
13
|
-
import getWidgetName from '../util/widget-map'
|
|
13
|
+
import { getWidgetName } from '../util/widget-map'
|
|
14
14
|
|
|
15
15
|
export default {
|
|
16
16
|
name: "BiPage",
|
|
@@ -26,7 +26,8 @@ export default {
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
data() {
|
|
29
|
-
return {
|
|
29
|
+
return {
|
|
30
|
+
}
|
|
30
31
|
},
|
|
31
32
|
methods: {
|
|
32
33
|
getWidgetName
|
|
@@ -14,10 +14,11 @@
|
|
|
14
14
|
import LamboQueryFilter from "@lambo-design/query-filter"
|
|
15
15
|
import { deepCopy } from "@lambo-design/shared/utils/assist"
|
|
16
16
|
import moment from 'moment'
|
|
17
|
+
import BiSearchItem from "./search-item.vue"
|
|
17
18
|
|
|
18
19
|
export default {
|
|
19
20
|
name: 'BiSearchForm',
|
|
20
|
-
components: { LamboQueryFilter },
|
|
21
|
+
components: { LamboQueryFilter, BiSearchItem },
|
|
21
22
|
props: {
|
|
22
23
|
widget: {
|
|
23
24
|
type: Object,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lambo-design-bi",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.108",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "finch",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"@lambo-design/shared": "^1.0.0-beta.283",
|
|
22
22
|
"@lambo-design/query-filter": "^1.0.0-beta.38",
|
|
23
23
|
"@lambo-design/detail-table": "^1.0.0-beta.23",
|
|
24
|
+
"@lambo-design/page-container": "^1.0.0-beta.35",
|
|
24
25
|
"axios": "1.6.7",
|
|
25
26
|
"core-js": "^3.8.3",
|
|
26
27
|
"echarts": "^4.8.0",
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export const SEARCH_DICT = Object.freeze({
|
|
2
|
+
INPUT: {
|
|
3
|
+
id: "00",
|
|
4
|
+
name: "输入框"
|
|
5
|
+
},
|
|
6
|
+
SINGLE_SELECT: {
|
|
7
|
+
id: "10",
|
|
8
|
+
name: "单选下拉框"
|
|
9
|
+
},
|
|
10
|
+
MUlTI_SELECT: {
|
|
11
|
+
id: "20",
|
|
12
|
+
name: "多选下拉框"
|
|
13
|
+
},
|
|
14
|
+
SINGLE_HELP: {
|
|
15
|
+
id: "30",
|
|
16
|
+
name: "单选帮助框"
|
|
17
|
+
},
|
|
18
|
+
MUlTI_HELP: {
|
|
19
|
+
id: "40",
|
|
20
|
+
name: "单选帮助框"
|
|
21
|
+
},
|
|
22
|
+
SINGLE_DATE: {
|
|
23
|
+
id: "50",
|
|
24
|
+
name: "日期选择框"
|
|
25
|
+
},
|
|
26
|
+
MUlTI_DATE: {
|
|
27
|
+
id: "51",
|
|
28
|
+
name: "日期范围帮助框"
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
export const DATE_RANGE_PFIX = Object.freeze({
|
|
33
|
+
START: "_start",
|
|
34
|
+
END: "_end"
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
export const DEFAULT_DATE_FORMAT = "YYYYMMDD"
|
|
38
|
+
export const DEFAULT_DATE_TIME_FORMAT = "YYYYMMDDHHmmss"
|
|
39
|
+
export const DEFAULT_DISPLAY_DATE_FORMAT = "YYYY-MM-DD"
|
|
40
|
+
export const DEFAULT_DISPLAY_DATE_TIME_FORMAT = "YYYY-MM-DD HH:mm:ss"
|